@psiclawops/hypermem 0.9.3 → 0.9.5

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 (69) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/INSTALL.md +75 -68
  3. package/README.md +18 -36
  4. package/assets/default-config.json +41 -0
  5. package/bench/data-access-bench.mjs +1 -1
  6. package/bin/hypermem-doctor.mjs +76 -2
  7. package/bin/hypermem-status.mjs +255 -7
  8. package/dist/adaptive-lifecycle.d.ts +39 -0
  9. package/dist/adaptive-lifecycle.d.ts.map +1 -1
  10. package/dist/adaptive-lifecycle.js +87 -9
  11. package/dist/background-indexer.d.ts.map +1 -1
  12. package/dist/background-indexer.js +16 -14
  13. package/dist/compositor.d.ts.map +1 -1
  14. package/dist/compositor.js +239 -20
  15. package/dist/cross-agent.d.ts +1 -1
  16. package/dist/cross-agent.js +17 -17
  17. package/dist/hybrid-retrieval.d.ts +8 -0
  18. package/dist/hybrid-retrieval.d.ts.map +1 -1
  19. package/dist/hybrid-retrieval.js +112 -10
  20. package/dist/index.d.ts +16 -5
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +19 -4
  23. package/dist/message-store.d.ts +62 -1
  24. package/dist/message-store.d.ts.map +1 -1
  25. package/dist/message-store.js +355 -2
  26. package/dist/open-domain.d.ts.map +1 -1
  27. package/dist/open-domain.js +3 -2
  28. package/dist/proactive-pass.d.ts +42 -2
  29. package/dist/proactive-pass.d.ts.map +1 -1
  30. package/dist/proactive-pass.js +294 -39
  31. package/dist/seed.d.ts +1 -1
  32. package/dist/seed.js +1 -1
  33. package/dist/session-flusher.d.ts +2 -2
  34. package/dist/session-flusher.js +2 -2
  35. package/dist/spawn-context.d.ts +1 -1
  36. package/dist/spawn-context.js +1 -1
  37. package/dist/topic-store.js +5 -5
  38. package/dist/topic-synthesizer.d.ts.map +1 -1
  39. package/dist/topic-synthesizer.js +10 -4
  40. package/dist/trigger-registry.d.ts +1 -1
  41. package/dist/trigger-registry.js +4 -4
  42. package/dist/types.d.ts +101 -2
  43. package/dist/types.d.ts.map +1 -1
  44. package/dist/vector-store.d.ts +10 -1
  45. package/dist/vector-store.d.ts.map +1 -1
  46. package/dist/vector-store.js +45 -9
  47. package/docs/DIAGNOSTICS.md +88 -1
  48. package/docs/INTEGRATION_VALIDATION.md +40 -1
  49. package/docs/MIGRATION.md +1 -1
  50. package/docs/TUNING.md +47 -6
  51. package/install.sh +5 -60
  52. package/memory-plugin/dist/index.js +192 -0
  53. package/memory-plugin/openclaw.plugin.json +199 -2
  54. package/memory-plugin/package.json +2 -2
  55. package/package.json +29 -10
  56. package/plugin/dist/index.d.ts +2 -0
  57. package/plugin/dist/index.d.ts.map +1 -1
  58. package/plugin/dist/index.js +178 -11
  59. package/plugin/dist/index.js.map +1 -1
  60. package/plugin/openclaw.plugin.json +199 -2
  61. package/plugin/package.json +2 -2
  62. package/scripts/install-packed-runtime.mjs +99 -0
  63. package/scripts/install-runtime.mjs +164 -4
  64. package/ARCHITECTURE.md +0 -298
  65. package/docs/KNOWN_LIMITATIONS.md +0 -35
  66. package/docs/PHASE1-VALIDATION.md +0 -132
  67. package/docs/RELEASE_0.8.0_VALIDATION.md +0 -70
  68. package/docs/RELEASE_PROCESS.md +0 -10
  69. package/docs/ROADMAP.md +0 -266
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@psiclawops/hypermem",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Agent-centric memory and context composition engine for OpenClaw",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,7 +45,10 @@
45
45
  "validate:public-surface": "node scripts/validate-public-surface.mjs",
46
46
  "bench:memory": "node bench/data-access-bench.mjs --iterations 1000 --warmup 50",
47
47
  "validate:doctor": "node test/doctor-cli.mjs",
48
- "build:all": "npm run build && npm --prefix plugin install --prefer-offline && npm --prefix plugin run build && npm --prefix memory-plugin install --prefer-offline && npm --prefix memory-plugin run build"
48
+ "build:all": "npm run build && npm --prefix plugin install --prefer-offline && npm --prefix plugin run build && npm --prefix memory-plugin install --prefer-offline && npm --prefix memory-plugin run build",
49
+ "validate:history-query": "npm run build && npm --prefix memory-plugin run build && node scripts/validate-history-query.mjs",
50
+ "install:runtime:packed": "node scripts/install-packed-runtime.mjs",
51
+ "release:install-smoke": "bash release-gate-internal/fresh-install-smoke.sh"
49
52
  },
50
53
  "dependencies": {
51
54
  "sqlite-vec": "^0.1.9",
@@ -58,14 +61,11 @@
58
61
  "engines": {
59
62
  "node": ">=22.0.0"
60
63
  },
61
- "bundledDependencies": [
62
- "sqlite-vec",
63
- "zod"
64
- ],
65
64
  "files": [
66
65
  "dist/**/*.js",
67
66
  "dist/**/*.d.ts",
68
67
  "dist/**/*.d.ts.map",
68
+ "assets/default-config.json",
69
69
  "bin/hypermem-status.mjs",
70
70
  "bin/hypermem-model-audit.mjs",
71
71
  "bin/hypermem-doctor.mjs",
@@ -79,19 +79,26 @@
79
79
  "memory-plugin/package.json",
80
80
  "memory-plugin/openclaw.plugin.json",
81
81
  "scripts/install-runtime.mjs",
82
- "docs/*.md",
82
+ "scripts/install-packed-runtime.mjs",
83
+ "docs/API_STABILITY.md",
84
+ "docs/DIAGNOSTICS.md",
85
+ "docs/INTEGRATION_VALIDATION.md",
86
+ "docs/MEMORY_MD_AUTHORING.md",
87
+ "docs/MIGRATION.md",
88
+ "docs/MIGRATION_GUIDE.md",
89
+ "docs/SLASH_COMMANDS.md",
90
+ "docs/TUNING.md",
83
91
  "install.sh",
84
92
  "README.md",
85
93
  "INSTALL.md",
86
94
  "CHANGELOG.md",
87
- "ARCHITECTURE.md",
88
95
  "LICENSE"
89
96
  ],
90
97
  "author": "PsiClawOps",
91
98
  "license": "Apache-2.0",
92
99
  "repository": {
93
100
  "type": "git",
94
- "url": "https://github.com/PsiClawOps/hypermem.git"
101
+ "url": "git+https://github.com/PsiClawOps/hypermem.git"
95
102
  },
96
103
  "publishConfig": {
97
104
  "access": "public",
@@ -106,5 +113,17 @@
106
113
  "sqlite-vec",
107
114
  "redis",
108
115
  "rag"
109
- ]
116
+ ],
117
+ "bundleDependencies": [
118
+ "sqlite-vec",
119
+ "zod"
120
+ ],
121
+ "directories": {
122
+ "doc": "docs",
123
+ "test": "test"
124
+ },
125
+ "bugs": {
126
+ "url": "https://github.com/PsiClawOps/hypermem/issues"
127
+ },
128
+ "homepage": "https://github.com/PsiClawOps/hypermem#readme"
110
129
  }
@@ -81,6 +81,8 @@ declare function lifecyclePolicyTelemetry(fields: {
81
81
  pressurePct?: number;
82
82
  topicShiftConfidence?: number;
83
83
  trimSoftTarget?: number;
84
+ protectedWarmingFloorFraction?: number;
85
+ protectedSlotsKept?: number;
84
86
  reasons?: string[];
85
87
  }): void;
86
88
  declare function nextTurnId(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAaH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EAId,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAUL,kBAAkB,EASnB,MAAM,sBAAsB,CAAC;AAW9B,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;AAYlG,KAAK,iBAAiB,GAClB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,SAAS,GACT,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,qBAAqB,GACrB,WAAW,CAAC;AAEhB,KAAK,wBAAwB,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvD,UAAU,0BAA0B;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,wBAAwB,CAAC;IAC/B,oBAAoB,CAAC,E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resolveAfterTurnProtectedWarmingTelemetry(policy, effectiveBudget) {
132
+ if (policy.band !== 'bootstrap' && policy.band !== 'warmup')
133
+ return {};
134
+ if (Math.max(0, Math.floor(effectiveBudget ?? 0)) <= 0)
135
+ return {};
136
+ const elevatedFloor = 0.34;
137
+ const bandFloor = Math.max(elevatedFloor, Math.max(0, policy.warmHistoryBudgetFraction ?? 0) * 0.60);
138
+ return {
139
+ protectedWarmingFloorFraction: Math.round(bandFloor * 10000) / 10000,
140
+ // Metadata-only count: one protected warming slot is active for this
141
+ // afterTurn gradient refresh. No message text or identifiers are emitted.
142
+ protectedSlotsKept: 1,
143
+ };
144
+ }
131
145
  function nextTurnId() {
132
146
  _telemetryTurnCounter = (_telemetryTurnCounter + 1) >>> 0;
133
147
  return `${Date.now().toString(36)}-${_telemetryTurnCounter.toString(36)}`;
@@ -623,7 +637,7 @@ async function getHyperMem() {
623
637
  // same provider as the indexer (Ollama vs OpenAI).
624
638
  if (typeof mod.generateEmbeddings === 'function') {
625
639
  const rawGenerate = mod.generateEmbeddings;
626
- _generateEmbeddings = (texts) => rawGenerate(texts, _embeddingConfig ?? undefined);
640
+ _generateEmbeddings = (texts) => rawGenerate(texts, _embeddingConfig ?? undefined, 'query');
627
641
  }
628
642
  // Load optional user config — compositor tuning overrides
629
643
  const userConfig = await loadUserConfig();
@@ -645,13 +659,18 @@ async function getHyperMem() {
645
659
  geminiBaseUrl: ue.geminiBaseUrl,
646
660
  geminiIndexTaskType: ue.geminiIndexTaskType,
647
661
  geminiQueryTaskType: ue.geminiQueryTaskType,
662
+ queryInputType: ue.queryInputType,
663
+ documentInputType: ue.documentInputType,
664
+ queryPrefix: ue.queryPrefix,
665
+ documentPrefix: ue.documentPrefix,
648
666
  model: ue.model ?? providerDefaults.model,
649
667
  dimensions: ue.dimensions ?? providerDefaults.dimensions,
650
668
  timeout: ue.timeout ?? providerDefaults.timeout,
651
669
  batchSize: ue.batchSize ?? providerDefaults.batchSize,
652
670
  };
653
- console.log(`[hypermem-plugin] Embedding provider: ${_embeddingConfig.provider} ` +
654
- `(model: ${_embeddingConfig.model}, ${_embeddingConfig.dimensions}d, batch: ${_embeddingConfig.batchSize})`);
671
+ const embeddingConfig = _embeddingConfig;
672
+ console.log(`[hypermem-plugin] Embedding provider: ${embeddingConfig.provider} ` +
673
+ `(model: ${embeddingConfig.model}, ${embeddingConfig.dimensions}d, batch: ${embeddingConfig.batchSize})`);
655
674
  }
656
675
  // Cache eviction config at module scope so assemble() can read it
657
676
  // synchronously without re-reading disk on every turn.
@@ -794,6 +813,35 @@ function extractTextFromInboundContent(content) {
794
813
  .map(part => part.text ?? '')
795
814
  .join('\n');
796
815
  }
816
+ /**
817
+ * Determine whether a user turn is "topic-bearing" (substantive).
818
+ *
819
+ * Heartbeat, empty, and small-talk turns are NOT topic-bearing and do not
820
+ * extend the warmup window. This is intentionally a lightweight heuristic:
821
+ * no topic-detector architecture change, no model calls.
822
+ */
823
+ function isTopicBearingTurn(msg, isHeartbeat) {
824
+ if (isHeartbeat)
825
+ return false;
826
+ if (!msg)
827
+ return false;
828
+ if (msg.role !== 'user')
829
+ return false;
830
+ const text = stripMessageMetadata(extractTextFromInboundContent(msg.content)).trim();
831
+ // Empty turn
832
+ if (text.length === 0)
833
+ return false;
834
+ // Small-talk: very short generic acknowledgments
835
+ if (text.length < 15) {
836
+ if (/^(ok|okay|yes|no|thanks|thank\s+you|got\s+it|sure|yep|nah|nope|alright|cool|nice|great|good|k|kk|heartbeat[_\s-]*ok|👍|👎|hi|hello|hey)[.!]*$/iu.test(text)) {
837
+ return false;
838
+ }
839
+ }
840
+ // Pure punctuation or emoji
841
+ if (/^[\s\p{P}\p{Emoji}]+$/u.test(text))
842
+ return false;
843
+ return true;
844
+ }
797
845
  function resolveAssistantTokenCount(msg, runtimeContext) {
798
846
  const usage = msg.usage;
799
847
  if (usage && typeof usage === 'object') {
@@ -1484,7 +1532,7 @@ function createHyperMemEngine() {
1484
1532
  // Post-warm pressure check: if messages.db had accumulated history,
1485
1533
  // warm() may have loaded the session straight to 80%+. Pre-trim now
1486
1534
  // so the first turn has headroom instead of starting saturated.
1487
- // This is the "restart at 98%" failure mode reported by Helm 2026-04-05:
1535
+ // This is the "restart at 98%" failure mode reported by Eve 2026-04-05:
1488
1536
  // JSONL truncation + Redis flush isn't enough if messages.db is still full
1489
1537
  // and warm() reloads it. Trim here closes the loop.
1490
1538
  try {
@@ -2248,7 +2296,11 @@ function createHyperMemEngine() {
2248
2296
  // (contextBlock) is cached, since that's what determines prefix identity.
2249
2297
  const cacheReplayThresholdMs = _cacheReplayThresholdMs;
2250
2298
  let cachedContextBlock = null;
2251
- if (cacheReplayThresholdMs > 0 && !replayRecovery.shouldSkipCacheReplay) {
2299
+ const promptHasUserText = typeof prompt === 'string' && prompt.trim().length > 0;
2300
+ // A new user prompt must force a fresh context block. Prefix-cache replay is
2301
+ // only safe for tool-loop/maintenance paths where no new conversational
2302
+ // antecedent needs to be reflected in the transcript context.
2303
+ if (cacheReplayThresholdMs > 0 && !promptHasUserText && !replayRecovery.shouldSkipCacheReplay) {
2252
2304
  try {
2253
2305
  const cachedAt = await hm.cache.getSlot(agentId, sk, 'assemblyContextAt');
2254
2306
  if (cachedAt && Date.now() - parseInt(cachedAt) < cacheReplayThresholdMs) {
@@ -2401,6 +2453,49 @@ function createHyperMemEngine() {
2401
2453
  ${replayRecovery.emittedText}`
2402
2454
  : replayRecovery.emittedText;
2403
2455
  }
2456
+ if (forkedContext) {
2457
+ try {
2458
+ let parentHistoryText = forkedContext?.parentHistoryText;
2459
+ if (!parentHistoryText) {
2460
+ const rawParentHistory = await hm.cache.getSlot(agentId, sk, 'parentHistory');
2461
+ if (rawParentHistory) {
2462
+ const parentHistory = JSON.parse(rawParentHistory);
2463
+ parentHistoryText = parentHistory
2464
+ .map(m => ({ role: m.role, text: m.textContent ?? m.content ?? null }))
2465
+ .filter(m => m && typeof m.role === 'string' && typeof m.text === 'string' && m.text.trim())
2466
+ .slice(-12)
2467
+ .map(m => `${m.role}: ${m.text.trim()}`)
2468
+ .join('\n');
2469
+ }
2470
+ }
2471
+ if (!parentHistoryText && forkedContext.parentSessionKey) {
2472
+ const parentAgentId = extractAgentId(forkedContext.parentSessionKey);
2473
+ const durableParentHistory = hm.queryHistory({
2474
+ agentId: parentAgentId,
2475
+ sessionKey: forkedContext.parentSessionKey,
2476
+ mode: 'runtime_chain',
2477
+ limit: 12,
2478
+ });
2479
+ parentHistoryText = durableParentHistory.messages
2480
+ .filter(m => typeof m.textContent === 'string' && m.textContent.trim())
2481
+ .map(m => `${m.role}: ${m.textContent.trim()}`)
2482
+ .join('\n');
2483
+ }
2484
+ if (parentHistoryText && !(result.contextBlock ?? '').includes(parentHistoryText)) {
2485
+ const forkedHistoryBlock = `## Forked Parent Working History\n${parentHistoryText}`;
2486
+ result.contextBlock = result.contextBlock
2487
+ ? `${result.contextBlock}\n\n${forkedHistoryBlock}`
2488
+ : forkedHistoryBlock;
2489
+ result.messages.unshift({
2490
+ role: 'system',
2491
+ content: forkedHistoryBlock,
2492
+ });
2493
+ }
2494
+ }
2495
+ catch {
2496
+ // Parent-history injection is advisory; seeded hot history remains primary.
2497
+ }
2498
+ }
2404
2499
  // Convert NeutralMessage[] → AgentMessage[] for the OpenClaw runtime.
2405
2500
  // neutralToAgentMessage can return a single message or an array (tool results
2406
2501
  // expand to individual ToolResultMessage objects), so we flatMap.
@@ -2853,7 +2948,7 @@ ${replayRecovery.emittedText}`
2853
2948
  // gradient-compressed window to budget before writing to Redis. Without
2854
2949
  // this, afterTurn writes up to 250 messages regardless of budget, causing
2855
2950
  // trimHistoryToTokenBudget to fire and trim ~200 messages on every
2856
- // subsequent assemble() — the churn loop seen in Helm's logs.
2951
+ // subsequent assemble() — the churn loop seen in Eve's logs.
2857
2952
  if (hm.cache.isConnected) {
2858
2953
  try {
2859
2954
  const modelState = await hm.cache.getModelState(agentId, sk);
@@ -2865,11 +2960,38 @@ ${replayRecovery.emittedText}`
2865
2960
  const inboundUserText = inboundUserMsg
2866
2961
  ? stripMessageMetadata(extractTextFromInboundContent(inboundUserMsg.content))
2867
2962
  : '';
2963
+ // Packet 2: topic-bearing warmup decay.
2964
+ // Persist a running count of substantive user turns per session.
2965
+ // Heartbeat/empty/small-talk turns do not increment the counter.
2966
+ const isCurrentTurnTopicBearing = isTopicBearingTurn(inboundUserMsg, Boolean(isHeartbeat));
2967
+ let topicBearingTurnCount = 0;
2968
+ try {
2969
+ const raw = await hm.cache.getSlot(agentId, sk, 'topicBearingTurnCount');
2970
+ if (raw)
2971
+ topicBearingTurnCount = Math.max(0, parseInt(raw, 10) || 0);
2972
+ }
2973
+ catch { /* non-fatal */ }
2974
+ const explicitNewSession = /^\/new(?:\s|$)/i.test(inboundUserText.trim());
2975
+ if (explicitNewSession) {
2976
+ topicBearingTurnCount = 0;
2977
+ try {
2978
+ await hm.cache.setSlot(agentId, sk, 'topicBearingTurnCount', '0');
2979
+ }
2980
+ catch { /* non-fatal */ }
2981
+ }
2982
+ else if (isCurrentTurnTopicBearing) {
2983
+ topicBearingTurnCount++;
2984
+ try {
2985
+ await hm.cache.setSlot(agentId, sk, 'topicBearingTurnCount', String(topicBearingTurnCount));
2986
+ }
2987
+ catch { /* non-fatal */ }
2988
+ }
2868
2989
  const lifecyclePolicy = resolveAdaptiveLifecyclePolicy({
2869
2990
  usedTokens: estimateMessageArrayTokens(messages),
2870
2991
  effectiveBudget: gradientBudget,
2871
2992
  userTurnCount: messages.filter(m => m.role === 'user').length,
2872
- explicitNewSession: /^\/new(?:\s|$)/i.test(inboundUserText.trim()),
2993
+ topicBearingTurnCount,
2994
+ explicitNewSession,
2873
2995
  topicShiftConfidence: adaptiveTopicShiftConfidence,
2874
2996
  });
2875
2997
  lifecyclePolicyTelemetry({
@@ -2880,6 +3002,7 @@ ${replayRecovery.emittedText}`
2880
3002
  pressurePct: lifecyclePolicy.pressurePct,
2881
3003
  topicShiftConfidence: adaptiveTopicShiftConfidence,
2882
3004
  trimSoftTarget: lifecyclePolicy.trimSoftTarget,
3005
+ ...resolveAfterTurnProtectedWarmingTelemetry(lifecyclePolicy, gradientBudget),
2883
3006
  reasons: lifecyclePolicy.reasons,
2884
3007
  });
2885
3008
  await hm.refreshRedisGradient(agentId, sk, gradientBudget, gradientDepth, lifecyclePolicy.trimSoftTarget);
@@ -2900,7 +3023,7 @@ ${replayRecovery.emittedText}`
2900
3023
  // If a session just finished a turn at >80% pressure, the NEXT turn's
2901
3024
  // incoming tool results (parallel web searches, large exec output, etc.)
2902
3025
  // will hit a window with no headroom — the ingestion wave failure mode
2903
- // (reported by Helm, 2026-04-05). Pre-trim here so the tool-loop
3026
+ // (reported by Eve, 2026-04-05). Pre-trim here so the tool-loop
2904
3027
  // assemble() path starts the next turn with meaningful space.
2905
3028
  //
2906
3029
  // Uses modelState.tokenBudget if cached; skips if unavailable (non-fatal).
@@ -3069,6 +3192,7 @@ ${replayRecovery.emittedText}`
3069
3192
  let parentHistoryMessages = 0;
3070
3193
  let parentUserTurnCount = 0;
3071
3194
  let parentPressureFraction;
3195
+ let parentHistoryText;
3072
3196
  // Seed child with parent's active facts. This preserves the historical
3073
3197
  // slot for compatibility; facts still primarily come from L4 by agent id.
3074
3198
  const facts = hm.getActiveFacts(parentAgentId, { limit: 50 });
@@ -3078,12 +3202,41 @@ ${replayRecovery.emittedText}`
3078
3202
  .join('\n');
3079
3203
  await hm.cache.setSlot(childAgentId, childSessionKey, 'parentFacts', factBlock);
3080
3204
  }
3081
- const history = await hm.cache.getHistory(parentAgentId, parentSessionKey);
3205
+ const maxSeededHistory = _subagentWarming === 'full' ? 25 : 12;
3206
+ let history = await hm.cache.getHistory(parentAgentId, parentSessionKey, maxSeededHistory);
3207
+ if (!history || history.length === 0) {
3208
+ const durableHistory = hm.queryHistory({
3209
+ agentId: parentAgentId,
3210
+ sessionKey: parentSessionKey,
3211
+ mode: 'runtime_chain',
3212
+ limit: maxSeededHistory,
3213
+ });
3214
+ history = durableHistory.messages.map(message => ({
3215
+ id: message.id,
3216
+ conversationId: durableHistory.scopedBy.conversationId ?? 0,
3217
+ agentId: parentAgentId,
3218
+ role: message.role,
3219
+ textContent: message.textContent ?? null,
3220
+ toolCalls: Array.isArray(message.toolCalls) ? message.toolCalls : null,
3221
+ toolResults: Array.isArray(message.toolResults) ? message.toolResults : null,
3222
+ messageIndex: message.messageIndex,
3223
+ tokenCount: null,
3224
+ isHeartbeat: false,
3225
+ createdAt: message.createdAt,
3226
+ }));
3227
+ }
3082
3228
  if (history && history.length > 0) {
3083
- const maxSeededHistory = _subagentWarming === 'full' ? 25 : 12;
3084
3229
  const recentHistory = history.slice(-maxSeededHistory);
3085
3230
  parentHistoryMessages = recentHistory.length;
3086
3231
  parentUserTurnCount = recentHistory.filter(m => m.role === 'user').length;
3232
+ parentHistoryText = recentHistory
3233
+ .map(m => ({
3234
+ role: m.role,
3235
+ text: typeof m.textContent === 'string' ? m.textContent : (typeof m.content === 'string' ? m.content : null),
3236
+ }))
3237
+ .filter(m => typeof m.text === 'string' && m.text.trim())
3238
+ .map(m => `${m.role}: ${m.text.trim()}`)
3239
+ .join('\n');
3087
3240
  const parentTokens = estimateMessageArrayTokens(recentHistory);
3088
3241
  const parentModelState = await hm.cache.getModelState(parentAgentId, parentSessionKey).catch(() => null);
3089
3242
  const parentBudget = parentModelState?.tokenBudget && parentModelState.tokenBudget > 0
@@ -3091,7 +3244,16 @@ ${replayRecovery.emittedText}`
3091
3244
  : undefined;
3092
3245
  parentPressureFraction = parentBudget ? parentTokens / parentBudget : undefined;
3093
3246
  if (isForkedContext || _subagentWarming === 'full') {
3094
- await hm.cache.replaceHistory(childAgentId, childSessionKey, recentHistory, maxSeededHistory);
3247
+ const forkedHistoryText = parentHistoryText
3248
+ ? `Forked parent working history:\n${parentHistoryText}`
3249
+ : undefined;
3250
+ if (isForkedContext && forkedHistoryText) {
3251
+ await hm.recordUserMessage(childAgentId, childSessionKey, forkedHistoryText, { channelType: 'subagent' });
3252
+ }
3253
+ const seededHistory = isForkedContext && parentHistoryText
3254
+ ? [{ role: 'system', textContent: `## Forked Parent Working History\n${parentHistoryText}`, toolCalls: null, toolResults: null }, ...recentHistory]
3255
+ : recentHistory;
3256
+ await hm.cache.replaceHistory(childAgentId, childSessionKey, seededHistory, maxSeededHistory + 1);
3095
3257
  await hm.cache.invalidateWindow(childAgentId, childSessionKey).catch(() => { });
3096
3258
  }
3097
3259
  await hm.cache.setSlot(childAgentId, childSessionKey, 'parentHistory', JSON.stringify(recentHistory));
@@ -3105,6 +3267,7 @@ ${replayRecovery.emittedText}`
3105
3267
  parentPressureFraction,
3106
3268
  parentUserTurnCount,
3107
3269
  parentHistoryMessages,
3270
+ parentHistoryText,
3108
3271
  };
3109
3272
  await hm.cache.setSlot(childAgentId, childSessionKey, FORKED_CONTEXT_META_SLOT, JSON.stringify(forkedMeta));
3110
3273
  }
@@ -3352,6 +3515,10 @@ const hypercompositorConfigSchema = z.object({
3352
3515
  geminiBaseUrl: z.string().optional(),
3353
3516
  geminiIndexTaskType: z.string().optional(),
3354
3517
  geminiQueryTaskType: z.string().optional(),
3518
+ queryInputType: z.string().optional(),
3519
+ documentInputType: z.string().optional(),
3520
+ queryPrefix: z.string().optional(),
3521
+ documentPrefix: z.string().optional(),
3355
3522
  model: z.string().optional(),
3356
3523
  dimensions: z.number().int().positive().optional(),
3357
3524
  timeout: z.number().int().positive().optional(),