@remnic/core 1.1.9 → 1.1.11
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-cli.js +35 -32
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +8 -7
- package/dist/access-http.js +17 -14
- package/dist/access-mcp.d.ts +8 -7
- package/dist/access-mcp.js +16 -13
- package/dist/{access-service-BJCIjVRY.d.ts → access-service-BkXt3di1.d.ts} +11 -9
- package/dist/access-service.d.ts +8 -7
- package/dist/access-service.js +15 -12
- package/dist/active-memory-bridge.d.ts +2 -1
- package/dist/active-recall.d.ts +2 -1
- package/dist/behavior-learner.d.ts +2 -1
- package/dist/behavior-signals.d.ts +2 -1
- package/dist/bootstrap.d.ts +7 -6
- package/dist/briefing.d.ts +3 -2
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +2 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/calibration.d.ts +4 -1
- package/dist/calibration.js +10 -5
- package/dist/calibration.js.map +1 -1
- package/dist/causal-behavior.d.ts +2 -1
- package/dist/causal-consolidation.d.ts +5 -2
- package/dist/causal-consolidation.js +14 -8
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-ICULSMDG.js → chunk-2YMTO4ZJ.js} +2 -2
- package/dist/{chunk-XL3UCAZA.js → chunk-363MWCD3.js} +35 -35
- package/dist/{chunk-PHQH2VUO.js → chunk-36CTNQY7.js} +7 -7
- package/dist/{chunk-XN4D6Z7X.js → chunk-4DXC6HQQ.js} +5 -3
- package/dist/chunk-4DXC6HQQ.js.map +1 -0
- package/dist/{chunk-OWGGXPKV.js → chunk-57QNCUEZ.js} +5 -5
- package/dist/{chunk-LOBRX7VD.js → chunk-5UM2VJ6D.js} +12 -1
- package/dist/chunk-5UM2VJ6D.js.map +1 -0
- package/dist/{chunk-KMWZXT5T.js → chunk-6XA7UN4Z.js} +2 -2
- package/dist/{chunk-G6NX57V2.js → chunk-C5HUWVH2.js} +2 -2
- package/dist/{chunk-NN3TS5BM.js → chunk-D54LZC5L.js} +4 -4
- package/dist/{chunk-U4SZXGEO.js → chunk-EYNQTST2.js} +2 -2
- package/dist/chunk-HJYHRE4S.js +647 -0
- package/dist/chunk-HJYHRE4S.js.map +1 -0
- package/dist/{chunk-M3DK45UM.js → chunk-I6BQZSML.js} +4 -4
- package/dist/chunk-IBX3VFOM.js +446 -0
- package/dist/chunk-IBX3VFOM.js.map +1 -0
- package/dist/{chunk-G3G3LY22.js → chunk-KBYWQWSB.js} +7 -7
- package/dist/{chunk-FPWUENQH.js → chunk-KUHRUM6B.js} +92 -487
- package/dist/chunk-KUHRUM6B.js.map +1 -0
- package/dist/chunk-KWBPHZUU.js +83 -0
- package/dist/chunk-KWBPHZUU.js.map +1 -0
- package/dist/{chunk-CTYRIJ5E.js → chunk-LIO5X3CM.js} +2 -2
- package/dist/{chunk-MJLUHRSF.js → chunk-MCC6KDQF.js} +2 -2
- package/dist/{chunk-J3P6WSFZ.js → chunk-O4XJUPSF.js} +2 -2
- package/dist/{chunk-6OAQEOGV.js → chunk-PB5KW5PL.js} +2 -2
- package/dist/{chunk-Y3VT6ZCP.js → chunk-PHNGXFQ6.js} +5 -3
- package/dist/chunk-PHNGXFQ6.js.map +1 -0
- package/dist/{chunk-2MVUXO4H.js → chunk-RXTFCYQF.js} +2 -2
- package/dist/chunk-S2JJBLJG.js +2101 -0
- package/dist/chunk-S2JJBLJG.js.map +1 -0
- package/dist/{chunk-Q7FJ5ZHM.js → chunk-S3IP6R6K.js} +8 -2
- package/dist/{chunk-Q7FJ5ZHM.js.map → chunk-S3IP6R6K.js.map} +1 -1
- package/dist/{chunk-ET4BL42V.js → chunk-VQXK37XA.js} +1 -1
- package/dist/{chunk-ET4BL42V.js.map → chunk-VQXK37XA.js.map} +1 -1
- package/dist/{chunk-FLBYSB2V.js → chunk-VX2IUQFE.js} +94 -8
- package/dist/chunk-VX2IUQFE.js.map +1 -0
- package/dist/{chunk-QPLYTPYL.js → chunk-WGK4VHGP.js} +77 -15
- package/dist/chunk-WGK4VHGP.js.map +1 -0
- package/dist/{chunk-7SFAENUZ.js → chunk-WTFWLUSX.js} +2 -2
- package/dist/{chunk-A6PGANSE.js → chunk-Y5KDIOKF.js} +3 -3
- package/dist/{chunk-KIF7QNKL.js → chunk-Z5S5HNGY.js} +5 -3
- package/dist/chunk-Z5S5HNGY.js.map +1 -0
- package/dist/{chunk-BIHCWSWA.js → chunk-ZL4S7ARC.js} +3 -3
- package/dist/{cli-BojuyOOp.d.ts → cli-Cvy2SNhF.d.ts} +4 -4
- package/dist/cli.d.ts +9 -8
- package/dist/cli.js +27 -25
- package/dist/codex-cli-fallback.d.ts +44 -0
- package/dist/codex-cli-fallback.js +12 -0
- package/dist/{codex-materialize-YVC2wb6n.d.ts → codex-materialize-CQlLTzke.d.ts} +1 -1
- package/dist/compression-optimizer.d.ts +2 -1
- package/dist/config.d.ts +2 -1
- package/dist/consolidation-provenance-check.d.ts +3 -2
- package/dist/consolidation-undo.d.ts +3 -2
- package/dist/day-summary.d.ts +2 -1
- package/dist/delinearize.d.ts +2 -1
- package/dist/direct-answer-wiring.d.ts +2 -1
- package/dist/direct-answer.d.ts +2 -1
- package/dist/embedding-fallback.d.ts +2 -1
- package/dist/{engine-EDFFOWDD.js → engine-FOC3IJLA.js} +4 -4
- package/dist/entity-retrieval.d.ts +3 -2
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +2 -1
- package/dist/explicit-capture.d.ts +7 -6
- package/dist/explicit-cue-recall.d.ts +16 -1
- package/dist/explicit-cue-recall.js +7 -3
- package/dist/extraction-judge-telemetry.d.ts +2 -1
- package/dist/extraction-judge-training.d.ts +2 -1
- package/dist/extraction-judge.d.ts +2 -1
- package/dist/extraction.d.ts +2 -1
- package/dist/extraction.js +6 -4
- package/dist/fallback-llm.d.ts +8 -1
- package/dist/fallback-llm.js +5 -3
- package/dist/identity-continuity.d.ts +2 -1
- package/dist/importance.d.ts +2 -1
- package/dist/index-1qIcnbG1.d.ts +34 -0
- package/dist/index.d.ts +16 -14
- package/dist/index.js +62 -51
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +2 -1
- package/dist/lifecycle.d.ts +2 -1
- package/dist/live-connectors-runner.d.ts +2 -1
- package/dist/local-llm.d.ts +2 -1
- package/dist/memory-action-policy.d.ts +2 -1
- package/dist/memory-cache.d.ts +2 -1
- package/dist/{memory-governance-AAQPBZEP.js → memory-governance-F3QOJGEY.js} +4 -4
- package/dist/memory-governance-F3QOJGEY.js.map +1 -0
- package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
- package/dist/{memory-projection-store-BW8u5U0u.d.ts → memory-projection-store-CY8TU40w.d.ts} +1 -1
- package/dist/memory-projection-store.d.ts +3 -2
- package/dist/memory-worth-outcomes.d.ts +3 -2
- package/dist/models-json.d.ts +2 -1
- package/dist/native-knowledge.d.ts +2 -1
- package/dist/objective-state-writers.d.ts +23 -1
- package/dist/objective-state-writers.js +10 -306
- package/dist/objective-state-writers.js.map +1 -1
- package/dist/objective-state.d.ts +7 -1
- package/dist/objective-state.js +3 -1
- package/dist/operator-toolkit.d.ts +3 -2
- package/dist/operator-toolkit.js +6 -6
- package/dist/{orchestrator-CYqmqxco.d.ts → orchestrator-AOQMo7QI.d.ts} +5 -3
- package/dist/orchestrator.d.ts +7 -6
- package/dist/orchestrator.js +29 -27
- package/dist/patterns-cli.d.ts +2 -1
- package/dist/policy-runtime.d.ts +2 -1
- package/dist/{port-Br27H8dy.d.ts → port-B6VEDIkC.d.ts} +1 -1
- package/dist/qmd-recall-cache.d.ts +3 -2
- package/dist/qmd.d.ts +3 -2
- package/dist/recall-disclosure-escalation.d.ts +2 -1
- package/dist/recall-explain-renderer.d.ts +2 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-state.d.ts +2 -1
- package/dist/recall-tag-filter.d.ts +2 -1
- package/dist/recall-xray-cli.d.ts +2 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +2 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +2 -1
- package/dist/recall-xray.js +2 -2
- package/dist/resolve-auth-token.d.ts +2 -1
- package/dist/resolve-provider-secret.d.ts +2 -1
- package/dist/resolve-provider-secret.js +3 -1
- package/dist/resume-bundles.js +3 -3
- package/dist/retrieval-agents.d.ts +3 -2
- package/dist/retrieval-tiers.d.ts +2 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/sdk-compat.d.ts +3 -2
- package/dist/sdk-compat.js.map +1 -1
- package/dist/{semantic-consolidation-GPcLr9BQ.d.ts → semantic-consolidation-ByBXb-sf.d.ts} +2 -2
- package/dist/semantic-consolidation.d.ts +4 -3
- package/dist/semantic-consolidation.js +3 -3
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +2 -1
- package/dist/semantic-rule-verifier.js +3 -3
- package/dist/session-observer-bands.d.ts +2 -1
- package/dist/session-observer-state.d.ts +2 -1
- package/dist/signal.d.ts +2 -1
- package/dist/storage.d.ts +3 -2
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +2 -1
- package/dist/summarizer.js +6 -4
- package/dist/summary-snapshot.d.ts +2 -1
- package/dist/temporal-supersession.d.ts +3 -2
- package/dist/temporal-validity.d.ts +2 -1
- package/dist/threading.d.ts +2 -1
- package/dist/tier-migration.d.ts +4 -3
- package/dist/tier-routing.d.ts +2 -1
- package/dist/topics.d.ts +2 -1
- package/dist/transcript.d.ts +2 -1
- package/dist/types.d.ts +2693 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +2 -1
- package/dist/verified-recall.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-3VRIIII5.js +0 -905
- package/dist/chunk-3VRIIII5.js.map +0 -1
- package/dist/chunk-FLBYSB2V.js.map +0 -1
- package/dist/chunk-FPWUENQH.js.map +0 -1
- package/dist/chunk-KIF7QNKL.js.map +0 -1
- package/dist/chunk-LOBRX7VD.js.map +0 -1
- package/dist/chunk-QPLYTPYL.js.map +0 -1
- package/dist/chunk-XN4D6Z7X.js.map +0 -1
- package/dist/chunk-Y3VT6ZCP.js.map +0 -1
- package/dist/types-Bmp9ssU2.d.ts +0 -2714
- /package/dist/{chunk-ICULSMDG.js.map → chunk-2YMTO4ZJ.js.map} +0 -0
- /package/dist/{chunk-XL3UCAZA.js.map → chunk-363MWCD3.js.map} +0 -0
- /package/dist/{chunk-PHQH2VUO.js.map → chunk-36CTNQY7.js.map} +0 -0
- /package/dist/{chunk-OWGGXPKV.js.map → chunk-57QNCUEZ.js.map} +0 -0
- /package/dist/{chunk-KMWZXT5T.js.map → chunk-6XA7UN4Z.js.map} +0 -0
- /package/dist/{chunk-G6NX57V2.js.map → chunk-C5HUWVH2.js.map} +0 -0
- /package/dist/{chunk-NN3TS5BM.js.map → chunk-D54LZC5L.js.map} +0 -0
- /package/dist/{chunk-U4SZXGEO.js.map → chunk-EYNQTST2.js.map} +0 -0
- /package/dist/{chunk-M3DK45UM.js.map → chunk-I6BQZSML.js.map} +0 -0
- /package/dist/{chunk-G3G3LY22.js.map → chunk-KBYWQWSB.js.map} +0 -0
- /package/dist/{chunk-CTYRIJ5E.js.map → chunk-LIO5X3CM.js.map} +0 -0
- /package/dist/{chunk-MJLUHRSF.js.map → chunk-MCC6KDQF.js.map} +0 -0
- /package/dist/{chunk-J3P6WSFZ.js.map → chunk-O4XJUPSF.js.map} +0 -0
- /package/dist/{chunk-6OAQEOGV.js.map → chunk-PB5KW5PL.js.map} +0 -0
- /package/dist/{chunk-2MVUXO4H.js.map → chunk-RXTFCYQF.js.map} +0 -0
- /package/dist/{chunk-7SFAENUZ.js.map → chunk-WTFWLUSX.js.map} +0 -0
- /package/dist/{chunk-A6PGANSE.js.map → chunk-Y5KDIOKF.js.map} +0 -0
- /package/dist/{chunk-BIHCWSWA.js.map → chunk-ZL4S7ARC.js.map} +0 -0
- /package/dist/{engine-EDFFOWDD.js.map → codex-cli-fallback.js.map} +0 -0
- /package/dist/{memory-governance-AAQPBZEP.js.map → engine-FOC3IJLA.js.map} +0 -0
|
@@ -2,12 +2,15 @@ import {
|
|
|
2
2
|
CompoundingEngine,
|
|
3
3
|
SharedContextManager,
|
|
4
4
|
defaultTierMigrationCycleBudget
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4DXC6HQQ.js";
|
|
6
6
|
import {
|
|
7
7
|
applyUtilityPromotionRuntimePolicy,
|
|
8
8
|
applyUtilityRankingRuntimeDelta,
|
|
9
9
|
loadUtilityRuntimeValues
|
|
10
10
|
} from "./chunk-FSFEQI74.js";
|
|
11
|
+
import {
|
|
12
|
+
isValidAsOf
|
|
13
|
+
} from "./chunk-MDYG7VI7.js";
|
|
11
14
|
import {
|
|
12
15
|
TierMigrationExecutor
|
|
13
16
|
} from "./chunk-Z5AAYHUC.js";
|
|
@@ -22,15 +25,12 @@ import {
|
|
|
22
25
|
} from "./chunk-UHGBNIOS.js";
|
|
23
26
|
import {
|
|
24
27
|
HourlySummarizer
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-PHNGXFQ6.js";
|
|
26
29
|
import {
|
|
27
30
|
applyTemporalSupersession,
|
|
28
31
|
normalizeSupersessionKey,
|
|
29
32
|
shouldFilterSupersededFromRecall
|
|
30
33
|
} from "./chunk-ZTSE2ZJ6.js";
|
|
31
|
-
import {
|
|
32
|
-
isValidAsOf
|
|
33
|
-
} from "./chunk-MDYG7VI7.js";
|
|
34
34
|
import {
|
|
35
35
|
SessionObserverState
|
|
36
36
|
} from "./chunk-JR4ZC3G4.js";
|
|
@@ -107,9 +107,21 @@ import {
|
|
|
107
107
|
import {
|
|
108
108
|
classifyMemoryKind
|
|
109
109
|
} from "./chunk-YAZNBMNF.js";
|
|
110
|
+
import {
|
|
111
|
+
ExtractionEngine
|
|
112
|
+
} from "./chunk-Z5S5HNGY.js";
|
|
113
|
+
import {
|
|
114
|
+
parseMemoryActionEligibilityContext
|
|
115
|
+
} from "./chunk-WW3QQF4H.js";
|
|
116
|
+
import {
|
|
117
|
+
ModelRegistry
|
|
118
|
+
} from "./chunk-QR3C7BKQ.js";
|
|
119
|
+
import {
|
|
120
|
+
LocalLlmClient
|
|
121
|
+
} from "./chunk-NN3LPQ5D.js";
|
|
110
122
|
import {
|
|
111
123
|
buildExplicitCueRecallSection
|
|
112
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-S2JJBLJG.js";
|
|
113
125
|
import {
|
|
114
126
|
recordJudgeTrainingPair
|
|
115
127
|
} from "./chunk-DF3RVK3X.js";
|
|
@@ -120,18 +132,6 @@ import {
|
|
|
120
132
|
judgeFactDurability,
|
|
121
133
|
validateProcedureExtraction
|
|
122
134
|
} from "./chunk-C4SQJZAF.js";
|
|
123
|
-
import {
|
|
124
|
-
ExtractionEngine
|
|
125
|
-
} from "./chunk-KIF7QNKL.js";
|
|
126
|
-
import {
|
|
127
|
-
parseMemoryActionEligibilityContext
|
|
128
|
-
} from "./chunk-WW3QQF4H.js";
|
|
129
|
-
import {
|
|
130
|
-
ModelRegistry
|
|
131
|
-
} from "./chunk-QR3C7BKQ.js";
|
|
132
|
-
import {
|
|
133
|
-
LocalLlmClient
|
|
134
|
-
} from "./chunk-NN3LPQ5D.js";
|
|
135
135
|
import {
|
|
136
136
|
formatDaySummaryMemories
|
|
137
137
|
} from "./chunk-3IQ2TR4N.js";
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
buildEntityRecallSection,
|
|
146
146
|
entityRecentTranscriptLookbackHours,
|
|
147
147
|
readRecentEntityTranscriptEntries
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-LIO5X3CM.js";
|
|
149
149
|
import {
|
|
150
150
|
buildCompressionGuidelinesMarkdown,
|
|
151
151
|
computeCompressionGuidelineCandidate,
|
|
@@ -158,13 +158,13 @@ import {
|
|
|
158
158
|
} from "./chunk-SRBJUAMP.js";
|
|
159
159
|
import {
|
|
160
160
|
searchVerifiedEpisodes
|
|
161
|
-
} from "./chunk-
|
|
161
|
+
} from "./chunk-RXTFCYQF.js";
|
|
162
162
|
import {
|
|
163
163
|
ThreadingManager
|
|
164
164
|
} from "./chunk-JRNQ3RNA.js";
|
|
165
165
|
import {
|
|
166
166
|
searchVerifiedSemanticRules
|
|
167
|
-
} from "./chunk-
|
|
167
|
+
} from "./chunk-PB5KW5PL.js";
|
|
168
168
|
import {
|
|
169
169
|
searchWorkProductLedgerEntries
|
|
170
170
|
} from "./chunk-CULXMQJH.js";
|
|
@@ -178,16 +178,13 @@ import {
|
|
|
178
178
|
createConversationIndexRuntime,
|
|
179
179
|
createSearchBackend,
|
|
180
180
|
writeConversationChunks
|
|
181
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-57QNCUEZ.js";
|
|
182
182
|
import {
|
|
183
183
|
parseQmdExplain
|
|
184
184
|
} from "./chunk-P77UEOU2.js";
|
|
185
185
|
import {
|
|
186
186
|
PolicyRuntimeManager
|
|
187
187
|
} from "./chunk-EABGC2TL.js";
|
|
188
|
-
import {
|
|
189
|
-
searchObjectiveStateSnapshots
|
|
190
|
-
} from "./chunk-LOBRX7VD.js";
|
|
191
188
|
import {
|
|
192
189
|
searchHarmonicRetrieval
|
|
193
190
|
} from "./chunk-HMDCOMYU.js";
|
|
@@ -207,12 +204,12 @@ import {
|
|
|
207
204
|
formatNativeKnowledgeSection,
|
|
208
205
|
searchNativeKnowledge
|
|
209
206
|
} from "./chunk-7SEAZFFB.js";
|
|
210
|
-
import {
|
|
211
|
-
CODEX_THREAD_KEY_PREFIX
|
|
212
|
-
} from "./chunk-3PG3H5TD.js";
|
|
213
207
|
import {
|
|
214
208
|
applyCommitmentLedgerLifecycle
|
|
215
209
|
} from "./chunk-FYIYMQ5N.js";
|
|
210
|
+
import {
|
|
211
|
+
CODEX_THREAD_KEY_PREFIX
|
|
212
|
+
} from "./chunk-3PG3H5TD.js";
|
|
216
213
|
import {
|
|
217
214
|
semanticChunkContent
|
|
218
215
|
} from "./chunk-KVE7R4CG.js";
|
|
@@ -231,10 +228,10 @@ import {
|
|
|
231
228
|
materializeAfterSemanticConsolidation,
|
|
232
229
|
parseConsolidationResponse,
|
|
233
230
|
parseOperatorAwareConsolidationResponse
|
|
234
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-C5HUWVH2.js";
|
|
235
232
|
import {
|
|
236
233
|
FallbackLlmClient
|
|
237
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-VX2IUQFE.js";
|
|
238
235
|
import {
|
|
239
236
|
buildRecallQueryPolicy
|
|
240
237
|
} from "./chunk-6HZ6AO2P.js";
|
|
@@ -259,26 +256,33 @@ import {
|
|
|
259
256
|
import {
|
|
260
257
|
clusterByKey,
|
|
261
258
|
stableHash
|
|
262
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-D54LZC5L.js";
|
|
263
260
|
import {
|
|
264
261
|
listTrustZoneRecords,
|
|
265
262
|
searchTrustZoneRecords
|
|
266
263
|
} from "./chunk-EQINRHYR.js";
|
|
267
264
|
import {
|
|
268
265
|
buildXraySnapshot
|
|
269
|
-
} from "./chunk-
|
|
266
|
+
} from "./chunk-2YMTO4ZJ.js";
|
|
270
267
|
import {
|
|
271
|
-
|
|
272
|
-
} from "./chunk-
|
|
268
|
+
parseMessageParts
|
|
269
|
+
} from "./chunk-IBX3VFOM.js";
|
|
273
270
|
import {
|
|
274
|
-
|
|
275
|
-
|
|
271
|
+
objectiveStateStoreOverrideForNamespace,
|
|
272
|
+
searchObjectiveStateSnapshots
|
|
273
|
+
} from "./chunk-5UM2VJ6D.js";
|
|
276
274
|
import {
|
|
277
275
|
ProfilingCollector
|
|
278
276
|
} from "./chunk-NBNN5GOB.js";
|
|
279
277
|
import {
|
|
280
278
|
launchProcessSync
|
|
281
279
|
} from "./chunk-OR64ZGRZ.js";
|
|
280
|
+
import {
|
|
281
|
+
shouldSkipImplicitExtraction
|
|
282
|
+
} from "./chunk-GVPWB7EY.js";
|
|
283
|
+
import {
|
|
284
|
+
selectRouteRule
|
|
285
|
+
} from "./chunk-2LGMW3DJ.js";
|
|
282
286
|
import {
|
|
283
287
|
buildProcedurePersistBody
|
|
284
288
|
} from "./chunk-QDW3E4RD.js";
|
|
@@ -306,7 +310,7 @@ import {
|
|
|
306
310
|
normalizeAttributePairs,
|
|
307
311
|
normalizeEntityName,
|
|
308
312
|
parseEntityFile
|
|
309
|
-
} from "./chunk-
|
|
313
|
+
} from "./chunk-MCC6KDQF.js";
|
|
310
314
|
import {
|
|
311
315
|
attachCitation,
|
|
312
316
|
hasCitationForTemplate,
|
|
@@ -314,7 +318,7 @@ import {
|
|
|
314
318
|
} from "./chunk-NN2DKE4T.js";
|
|
315
319
|
import {
|
|
316
320
|
confidenceTier
|
|
317
|
-
} from "./chunk-
|
|
321
|
+
} from "./chunk-VQXK37XA.js";
|
|
318
322
|
import {
|
|
319
323
|
isActiveMemoryStatus
|
|
320
324
|
} from "./chunk-RULE4VG5.js";
|
|
@@ -1734,423 +1738,6 @@ function createTables(db) {
|
|
|
1734
1738
|
);
|
|
1735
1739
|
}
|
|
1736
1740
|
|
|
1737
|
-
// src/message-parts/index.ts
|
|
1738
|
-
var LCM_MESSAGE_PART_KINDS = [
|
|
1739
|
-
"text",
|
|
1740
|
-
"tool_call",
|
|
1741
|
-
"tool_result",
|
|
1742
|
-
"patch",
|
|
1743
|
-
"file_read",
|
|
1744
|
-
"file_write",
|
|
1745
|
-
"step_start",
|
|
1746
|
-
"step_finish",
|
|
1747
|
-
"snapshot",
|
|
1748
|
-
"retry"
|
|
1749
|
-
];
|
|
1750
|
-
var SECRET_KEY_RE = /(api[_-]?key|authorization|bearer|credential|password|secret|token)/i;
|
|
1751
|
-
var MAX_PAYLOAD_STRING = 8e3;
|
|
1752
|
-
var MAX_FILE_SCAN_CHARS = 2e4;
|
|
1753
|
-
function isLcmMessagePartKind(value) {
|
|
1754
|
-
return typeof value === "string" && LCM_MESSAGE_PART_KINDS.includes(value);
|
|
1755
|
-
}
|
|
1756
|
-
function parseMessageParts(input, options = {}) {
|
|
1757
|
-
const explicit = normalizeExplicitParts(input);
|
|
1758
|
-
if (explicit.length > 0) return explicit;
|
|
1759
|
-
const format = options.sourceFormat ?? inferSourceFormat(input);
|
|
1760
|
-
switch (format) {
|
|
1761
|
-
case "openai":
|
|
1762
|
-
return withRenderedFallback(parseOpenAiMessageParts(input, options), options);
|
|
1763
|
-
case "anthropic":
|
|
1764
|
-
return withRenderedFallback(parseAnthropicMessageParts(input, options), options);
|
|
1765
|
-
case "openclaw":
|
|
1766
|
-
return withRenderedFallback(parseOpenClawMessageParts(input, options), options);
|
|
1767
|
-
case "lossless-claw":
|
|
1768
|
-
case "remnic":
|
|
1769
|
-
return withRenderedFallback(normalizeExplicitParts(input), options);
|
|
1770
|
-
default:
|
|
1771
|
-
return renderedFallbackParts(options);
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
function normalizeExplicitParts(input) {
|
|
1775
|
-
const rawParts = pickArray(input, "parts") ?? pickArray(input, "message_parts");
|
|
1776
|
-
if (!rawParts) return [];
|
|
1777
|
-
const parts = [];
|
|
1778
|
-
rawParts.forEach((raw, index) => {
|
|
1779
|
-
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
|
|
1780
|
-
const obj = raw;
|
|
1781
|
-
const kind = normalizeKind(obj.kind ?? obj.type);
|
|
1782
|
-
if (!kind) return;
|
|
1783
|
-
const payload = obj.payload && typeof obj.payload === "object" && !Array.isArray(obj.payload) ? obj.payload : { value: sanitizePayload(obj) };
|
|
1784
|
-
const toolName = asNonEmptyString(obj.toolName ?? obj.tool_name ?? obj.name);
|
|
1785
|
-
const filePath = asNonEmptyString(obj.filePath ?? obj.file_path ?? obj.path);
|
|
1786
|
-
const ordinal = typeof obj.ordinal === "number" && Number.isInteger(obj.ordinal) ? Math.max(0, obj.ordinal) : index;
|
|
1787
|
-
parts.push({
|
|
1788
|
-
ordinal,
|
|
1789
|
-
kind,
|
|
1790
|
-
payload: sanitizePayload(payload),
|
|
1791
|
-
toolName,
|
|
1792
|
-
filePath,
|
|
1793
|
-
createdAt: asNonEmptyString(obj.createdAt ?? obj.created_at)
|
|
1794
|
-
});
|
|
1795
|
-
});
|
|
1796
|
-
return parts;
|
|
1797
|
-
}
|
|
1798
|
-
function parseOpenAiMessageParts(input, _options = {}) {
|
|
1799
|
-
const items = gatherOpenAiItems(input);
|
|
1800
|
-
const parts = [];
|
|
1801
|
-
for (const item of items) {
|
|
1802
|
-
const type = asNonEmptyString(item.type) ?? asNonEmptyString(item.kind);
|
|
1803
|
-
if (!type) continue;
|
|
1804
|
-
if (isOpenAiContentBlock(item)) {
|
|
1805
|
-
const text = asNonEmptyString(item.text ?? item.content);
|
|
1806
|
-
if (text) parts.push(makePart("text", { type, text }, { filePath: firstFilePath(text) }));
|
|
1807
|
-
continue;
|
|
1808
|
-
}
|
|
1809
|
-
if (type === "message") {
|
|
1810
|
-
for (const block of gatherContentBlocks(item.content)) {
|
|
1811
|
-
const text = asNonEmptyString(block.text ?? block.content);
|
|
1812
|
-
if (text) parts.push(makePart("text", { type, text }, { filePath: firstFilePath(text) }));
|
|
1813
|
-
}
|
|
1814
|
-
continue;
|
|
1815
|
-
}
|
|
1816
|
-
if (type === "function_call") {
|
|
1817
|
-
const toolName = asNonEmptyString(item.name ?? item.tool_name);
|
|
1818
|
-
const payload = {
|
|
1819
|
-
id: item.id ?? item.call_id,
|
|
1820
|
-
name: toolName,
|
|
1821
|
-
arguments: parseMaybeJson(item.arguments)
|
|
1822
|
-
};
|
|
1823
|
-
parts.push(classifyToolPart(toolName, payload));
|
|
1824
|
-
continue;
|
|
1825
|
-
}
|
|
1826
|
-
if (type === "function_call_output") {
|
|
1827
|
-
const output = asNonEmptyString(item.output) ?? JSON.stringify(sanitizePayload(item.output ?? item));
|
|
1828
|
-
parts.push(makePart("tool_result", { id: item.id ?? item.call_id, output }, {
|
|
1829
|
-
filePath: firstFilePath(output)
|
|
1830
|
-
}));
|
|
1831
|
-
continue;
|
|
1832
|
-
}
|
|
1833
|
-
if (type === "reasoning") {
|
|
1834
|
-
parts.push(makePart("step_start", { type, summary: sanitizePayload(item.summary ?? item) }));
|
|
1835
|
-
continue;
|
|
1836
|
-
}
|
|
1837
|
-
if (type === "retry") {
|
|
1838
|
-
parts.push(makePart("retry", { type, item: sanitizePayload(item) }));
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
return withOrdinals(parts);
|
|
1842
|
-
}
|
|
1843
|
-
function parseAnthropicMessageParts(input, _options = {}) {
|
|
1844
|
-
const blocks = gatherContentBlocks(
|
|
1845
|
-
Array.isArray(input) ? input : input && typeof input === "object" ? input.content : input
|
|
1846
|
-
);
|
|
1847
|
-
const parts = [];
|
|
1848
|
-
for (const block of blocks) {
|
|
1849
|
-
const type = asNonEmptyString(block.type);
|
|
1850
|
-
if (type === "text") {
|
|
1851
|
-
const text = asNonEmptyString(block.text);
|
|
1852
|
-
if (text) parts.push(makePart("text", { type, text }, { filePath: firstFilePath(text) }));
|
|
1853
|
-
continue;
|
|
1854
|
-
}
|
|
1855
|
-
if (type === "tool_use") {
|
|
1856
|
-
const toolName = asNonEmptyString(block.name);
|
|
1857
|
-
parts.push(classifyToolPart(toolName, {
|
|
1858
|
-
id: block.id,
|
|
1859
|
-
name: toolName,
|
|
1860
|
-
input: sanitizePayload(block.input)
|
|
1861
|
-
}));
|
|
1862
|
-
continue;
|
|
1863
|
-
}
|
|
1864
|
-
if (type === "tool_result") {
|
|
1865
|
-
const content = block.content;
|
|
1866
|
-
const rendered = renderUnknownContent(content);
|
|
1867
|
-
parts.push(makePart("tool_result", { id: block.tool_use_id, content: sanitizePayload(content) }, {
|
|
1868
|
-
filePath: firstFilePath(rendered)
|
|
1869
|
-
}));
|
|
1870
|
-
continue;
|
|
1871
|
-
}
|
|
1872
|
-
if (type === "thinking") {
|
|
1873
|
-
parts.push(makePart("step_start", {
|
|
1874
|
-
type,
|
|
1875
|
-
thinking: truncateString(asNonEmptyString(block.thinking) ?? ""),
|
|
1876
|
-
signature: asNonEmptyString(block.signature)
|
|
1877
|
-
}));
|
|
1878
|
-
continue;
|
|
1879
|
-
}
|
|
1880
|
-
if (type === "redacted_thinking") {
|
|
1881
|
-
parts.push(makePart("step_finish", { type }));
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
return withOrdinals(parts);
|
|
1885
|
-
}
|
|
1886
|
-
function parseOpenClawMessageParts(input, options = {}) {
|
|
1887
|
-
const explicit = normalizeExplicitParts(input);
|
|
1888
|
-
if (explicit.length > 0) return explicit;
|
|
1889
|
-
if (!input || typeof input !== "object") return [];
|
|
1890
|
-
const obj = input;
|
|
1891
|
-
const content = obj.content;
|
|
1892
|
-
if (Array.isArray(content)) {
|
|
1893
|
-
const hasOpenAiBlocks = content.some(isOpenAiContentBlock);
|
|
1894
|
-
if (hasOpenAiBlocks) return parseOpenAiMessageParts(content, options);
|
|
1895
|
-
const hasAnthropicBlocks = content.some(
|
|
1896
|
-
(block) => block && typeof block === "object" && typeof block.type === "string"
|
|
1897
|
-
);
|
|
1898
|
-
if (hasAnthropicBlocks) return parseAnthropicMessageParts({ content }, options);
|
|
1899
|
-
}
|
|
1900
|
-
const toolName = asNonEmptyString(obj.toolName ?? obj.tool_name ?? obj.name);
|
|
1901
|
-
if (toolName) {
|
|
1902
|
-
return withOrdinals([
|
|
1903
|
-
classifyToolPart(toolName, {
|
|
1904
|
-
name: toolName,
|
|
1905
|
-
input: sanitizePayload(obj.input ?? obj.arguments ?? obj.params),
|
|
1906
|
-
output: sanitizePayload(obj.output ?? obj.result)
|
|
1907
|
-
})
|
|
1908
|
-
]);
|
|
1909
|
-
}
|
|
1910
|
-
const rendered = options.renderedContent ?? asNonEmptyString(obj.content);
|
|
1911
|
-
return rendered ? withOrdinals(partsFromRenderedText(rendered)) : [];
|
|
1912
|
-
}
|
|
1913
|
-
function partsFromRenderedText(text) {
|
|
1914
|
-
if (text.includes("*** Begin Patch")) {
|
|
1915
|
-
const paths2 = extractFilePaths(text);
|
|
1916
|
-
const patchPaths = extractPatchPaths(text);
|
|
1917
|
-
return withOrdinals((patchPaths.length > 0 ? patchPaths : paths2).map(
|
|
1918
|
-
(filePath) => makePart("patch", { text: truncateString(text) }, { filePath })
|
|
1919
|
-
));
|
|
1920
|
-
}
|
|
1921
|
-
const paths = extractFilePaths(text);
|
|
1922
|
-
if (paths.length === 0) return [];
|
|
1923
|
-
return withOrdinals(paths.map(
|
|
1924
|
-
(filePath) => makePart("file_read", { text: truncateString(text) }, { filePath })
|
|
1925
|
-
));
|
|
1926
|
-
}
|
|
1927
|
-
function inferSourceFormat(input) {
|
|
1928
|
-
if (input && typeof input === "object") {
|
|
1929
|
-
const obj = input;
|
|
1930
|
-
const explicit = asNonEmptyString(obj.sourceFormat ?? obj.source_format);
|
|
1931
|
-
if (explicit === "openai" || explicit === "anthropic" || explicit === "openclaw" || explicit === "lossless-claw" || explicit === "remnic") {
|
|
1932
|
-
return explicit;
|
|
1933
|
-
}
|
|
1934
|
-
if (Array.isArray(obj.output)) return "openai";
|
|
1935
|
-
if (isOpenAiResponseItem(obj)) return "openai";
|
|
1936
|
-
if (Array.isArray(obj.content) && obj.content.some(isOpenAiContentBlock)) return "openai";
|
|
1937
|
-
if (Array.isArray(obj.content)) return "anthropic";
|
|
1938
|
-
}
|
|
1939
|
-
if (Array.isArray(input)) {
|
|
1940
|
-
return input.some(
|
|
1941
|
-
(item) => isRecord(item) && (isOpenAiResponseItem(item) || isOpenAiContentBlock(item))
|
|
1942
|
-
) ? "openai" : "anthropic";
|
|
1943
|
-
}
|
|
1944
|
-
return void 0;
|
|
1945
|
-
}
|
|
1946
|
-
function isOpenAiResponseItem(obj) {
|
|
1947
|
-
const type = asNonEmptyString(obj.type ?? obj.kind);
|
|
1948
|
-
return type === "message" || type === "function_call" || type === "function_call_output" || type === "reasoning" || type === "retry";
|
|
1949
|
-
}
|
|
1950
|
-
function isOpenAiContentBlock(value) {
|
|
1951
|
-
if (!isRecord(value)) return false;
|
|
1952
|
-
const type = asNonEmptyString(value.type);
|
|
1953
|
-
return type === "input_text" || type === "output_text" || type === "input_image" || type === "input_file" || type === "refusal";
|
|
1954
|
-
}
|
|
1955
|
-
function gatherOpenAiItems(input) {
|
|
1956
|
-
if (Array.isArray(input)) return input.filter(isRecord);
|
|
1957
|
-
if (!isRecord(input)) return [];
|
|
1958
|
-
if (Array.isArray(input.output)) return input.output.filter(isRecord);
|
|
1959
|
-
if (Array.isArray(input.items)) return input.items.filter(isRecord);
|
|
1960
|
-
return [input];
|
|
1961
|
-
}
|
|
1962
|
-
function gatherContentBlocks(input) {
|
|
1963
|
-
if (Array.isArray(input)) return input.filter(isRecord);
|
|
1964
|
-
if (typeof input === "string") return [{ type: "text", text: input }];
|
|
1965
|
-
if (isRecord(input)) return [input];
|
|
1966
|
-
return [];
|
|
1967
|
-
}
|
|
1968
|
-
function classifyToolPart(toolName, payload) {
|
|
1969
|
-
const normalized = (toolName ?? "").toLowerCase();
|
|
1970
|
-
const rendered = renderUnknownContent(payload);
|
|
1971
|
-
const filePath = firstFilePathFromObject(payload) ?? firstFilePath(rendered) ?? null;
|
|
1972
|
-
if (normalized.includes("apply_patch") || rendered.includes("*** Begin Patch")) {
|
|
1973
|
-
return makePart("patch", payload, { toolName, filePath: filePath ?? extractPatchPaths(rendered)[0] ?? null });
|
|
1974
|
-
}
|
|
1975
|
-
if (/(write|edit|multiedit|create|save)/i.test(normalized)) {
|
|
1976
|
-
return makePart("file_write", payload, { toolName, filePath });
|
|
1977
|
-
}
|
|
1978
|
-
if (/(read|grep|glob|search|list|ls)/i.test(normalized)) {
|
|
1979
|
-
return makePart("file_read", payload, { toolName, filePath });
|
|
1980
|
-
}
|
|
1981
|
-
return makePart("tool_call", payload, { toolName, filePath });
|
|
1982
|
-
}
|
|
1983
|
-
function makePart(kind, payload, options = {}) {
|
|
1984
|
-
return {
|
|
1985
|
-
kind,
|
|
1986
|
-
payload: sanitizePayload(payload),
|
|
1987
|
-
toolName: options.toolName ?? null,
|
|
1988
|
-
filePath: options.filePath ?? null
|
|
1989
|
-
};
|
|
1990
|
-
}
|
|
1991
|
-
function withOrdinals(parts) {
|
|
1992
|
-
return parts.map((part, ordinal) => ({ ...part, ordinal: part.ordinal ?? ordinal }));
|
|
1993
|
-
}
|
|
1994
|
-
function withRenderedFallback(parts, options) {
|
|
1995
|
-
return parts.length > 0 ? parts : renderedFallbackParts(options);
|
|
1996
|
-
}
|
|
1997
|
-
function renderedFallbackParts(options) {
|
|
1998
|
-
const rendered = asNonEmptyString(options.renderedContent);
|
|
1999
|
-
return rendered ? partsFromRenderedText(rendered) : [];
|
|
2000
|
-
}
|
|
2001
|
-
function normalizeKind(value) {
|
|
2002
|
-
if (isLcmMessagePartKind(value)) return value;
|
|
2003
|
-
if (value === "tool_use" || value === "function_call") return "tool_call";
|
|
2004
|
-
if (value === "function_call_output") return "tool_result";
|
|
2005
|
-
if (value === "thinking" || value === "reasoning") return "step_start";
|
|
2006
|
-
return null;
|
|
2007
|
-
}
|
|
2008
|
-
function pickArray(input, key) {
|
|
2009
|
-
if (!input || typeof input !== "object" || Array.isArray(input)) return null;
|
|
2010
|
-
const value = input[key];
|
|
2011
|
-
return Array.isArray(value) ? value : null;
|
|
2012
|
-
}
|
|
2013
|
-
function asNonEmptyString(value) {
|
|
2014
|
-
if (typeof value !== "string") return null;
|
|
2015
|
-
const trimmed = value.trim();
|
|
2016
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
2017
|
-
}
|
|
2018
|
-
function isRecord(value) {
|
|
2019
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
2020
|
-
}
|
|
2021
|
-
function parseMaybeJson(value) {
|
|
2022
|
-
if (typeof value !== "string") return sanitizePayload(value);
|
|
2023
|
-
try {
|
|
2024
|
-
return sanitizePayload(JSON.parse(value));
|
|
2025
|
-
} catch {
|
|
2026
|
-
return truncateString(value);
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
2029
|
-
function sanitizePayload(value, depth = 0) {
|
|
2030
|
-
if (value === null || value === void 0) return value;
|
|
2031
|
-
if (typeof value === "string") return truncateString(value);
|
|
2032
|
-
if (typeof value === "number" || typeof value === "boolean") return value;
|
|
2033
|
-
if (Array.isArray(value)) {
|
|
2034
|
-
if (depth >= 4) return "[truncated]";
|
|
2035
|
-
return value.slice(0, 100).map((item) => sanitizePayload(item, depth + 1));
|
|
2036
|
-
}
|
|
2037
|
-
if (typeof value === "object") {
|
|
2038
|
-
if (depth >= 4) return "[truncated]";
|
|
2039
|
-
const out = {};
|
|
2040
|
-
for (const [key, child] of Object.entries(value)) {
|
|
2041
|
-
out[key] = SECRET_KEY_RE.test(key) ? "[redacted]" : sanitizePayload(child, depth + 1);
|
|
2042
|
-
}
|
|
2043
|
-
return out;
|
|
2044
|
-
}
|
|
2045
|
-
return String(value);
|
|
2046
|
-
}
|
|
2047
|
-
function truncateString(value) {
|
|
2048
|
-
return value.length > MAX_PAYLOAD_STRING ? `${value.slice(0, MAX_PAYLOAD_STRING)}...[truncated]` : value;
|
|
2049
|
-
}
|
|
2050
|
-
function renderUnknownContent(value) {
|
|
2051
|
-
if (typeof value === "string") return value;
|
|
2052
|
-
try {
|
|
2053
|
-
return JSON.stringify(value ?? "");
|
|
2054
|
-
} catch {
|
|
2055
|
-
return String(value ?? "");
|
|
2056
|
-
}
|
|
2057
|
-
}
|
|
2058
|
-
function firstFilePathFromObject(value) {
|
|
2059
|
-
if (!isRecord(value)) return null;
|
|
2060
|
-
const keys = ["file_path", "filePath", "path", "filename", "cwd"];
|
|
2061
|
-
for (const key of keys) {
|
|
2062
|
-
const candidate = asNonEmptyString(value[key]);
|
|
2063
|
-
if (candidate) return candidate;
|
|
2064
|
-
}
|
|
2065
|
-
for (const child of Object.values(value)) {
|
|
2066
|
-
if (typeof child === "string") {
|
|
2067
|
-
const fromText = extractPatchPaths(child)[0] ?? firstFilePath(child);
|
|
2068
|
-
if (fromText) return fromText;
|
|
2069
|
-
}
|
|
2070
|
-
if (isRecord(child)) {
|
|
2071
|
-
const nested = firstFilePathFromObject(child);
|
|
2072
|
-
if (nested) return nested;
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
return null;
|
|
2076
|
-
}
|
|
2077
|
-
function firstFilePath(text) {
|
|
2078
|
-
return extractFilePaths(text)[0] ?? null;
|
|
2079
|
-
}
|
|
2080
|
-
function extractFilePaths(text) {
|
|
2081
|
-
const out = /* @__PURE__ */ new Set();
|
|
2082
|
-
let token = "";
|
|
2083
|
-
const scanLength = Math.min(text.length, MAX_FILE_SCAN_CHARS);
|
|
2084
|
-
for (let index = 0; index <= scanLength; index += 1) {
|
|
2085
|
-
const char = index < scanLength ? text[index] : " ";
|
|
2086
|
-
if (isFilePathTokenSeparator(char)) {
|
|
2087
|
-
addFilePathCandidate(out, token);
|
|
2088
|
-
token = "";
|
|
2089
|
-
continue;
|
|
2090
|
-
}
|
|
2091
|
-
token += char;
|
|
2092
|
-
if (token.length > 512) {
|
|
2093
|
-
addFilePathCandidate(out, token);
|
|
2094
|
-
token = "";
|
|
2095
|
-
}
|
|
2096
|
-
}
|
|
2097
|
-
return [...out].slice(0, 20);
|
|
2098
|
-
}
|
|
2099
|
-
function isFilePathTokenSeparator(char) {
|
|
2100
|
-
return char === " " || char === "\n" || char === "\r" || char === " " || char === '"' || char === "'" || char === "`" || char === "(" || char === ")" || char === "[" || char === "]" || char === "{" || char === "}" || char === "<" || char === ">" || char === ",";
|
|
2101
|
-
}
|
|
2102
|
-
function addFilePathCandidate(out, raw) {
|
|
2103
|
-
const candidate = trimFilePathPunctuation(raw);
|
|
2104
|
-
if (candidate.length === 0 || candidate.includes("://")) return;
|
|
2105
|
-
if (isLikelyFilePath(candidate)) out.add(candidate);
|
|
2106
|
-
}
|
|
2107
|
-
function trimFilePathPunctuation(raw) {
|
|
2108
|
-
let start = 0;
|
|
2109
|
-
let end = raw.length;
|
|
2110
|
-
while (start < end && isLeadingFilePathPunctuation(raw[start])) start += 1;
|
|
2111
|
-
while (end > start && isTrailingFilePathPunctuation(raw[end - 1])) end -= 1;
|
|
2112
|
-
return raw.slice(start, end);
|
|
2113
|
-
}
|
|
2114
|
-
function isLeadingFilePathPunctuation(char) {
|
|
2115
|
-
return char === ":" || char === ";" || char === "!" || char === "?" || char === "|" || char === "*" || char === "=";
|
|
2116
|
-
}
|
|
2117
|
-
function isTrailingFilePathPunctuation(char) {
|
|
2118
|
-
return char === "." || char === ":" || char === ";" || char === "!" || char === "?" || char === "|" || char === "*" || char === "=";
|
|
2119
|
-
}
|
|
2120
|
-
function isLikelyFilePath(value) {
|
|
2121
|
-
if (value.startsWith("/") || value.startsWith("./") || value.startsWith("../") || value.startsWith("~/")) {
|
|
2122
|
-
return hasValidFileExtension(value);
|
|
2123
|
-
}
|
|
2124
|
-
if (value.includes("/")) return hasValidFileExtension(value);
|
|
2125
|
-
return hasValidFileExtension(value);
|
|
2126
|
-
}
|
|
2127
|
-
function hasValidFileExtension(value) {
|
|
2128
|
-
const lastSlash = value.lastIndexOf("/");
|
|
2129
|
-
const basename = value.slice(lastSlash + 1);
|
|
2130
|
-
const dot = basename.lastIndexOf(".");
|
|
2131
|
-
if (dot <= 0 || dot === basename.length - 1) return false;
|
|
2132
|
-
const ext = basename.slice(dot + 1);
|
|
2133
|
-
if (ext.length < 1 || ext.length > 12) return false;
|
|
2134
|
-
for (const char of ext) {
|
|
2135
|
-
if (!isFileExtensionChar(char)) return false;
|
|
2136
|
-
}
|
|
2137
|
-
return true;
|
|
2138
|
-
}
|
|
2139
|
-
function isFileExtensionChar(char) {
|
|
2140
|
-
const code = char.charCodeAt(0);
|
|
2141
|
-
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || char === "_" || char === "+" || char === "-";
|
|
2142
|
-
}
|
|
2143
|
-
function extractPatchPaths(text) {
|
|
2144
|
-
const out = /* @__PURE__ */ new Set();
|
|
2145
|
-
for (const line of text.split(/\r?\n/)) {
|
|
2146
|
-
const match = line.match(/^\*\*\* (?:Add|Update|Delete) File: (.+)$/);
|
|
2147
|
-
if (match?.[1]) out.add(match[1].trim());
|
|
2148
|
-
const move = line.match(/^\*\*\* Move to: (.+)$/);
|
|
2149
|
-
if (move?.[1]) out.add(move[1].trim());
|
|
2150
|
-
}
|
|
2151
|
-
return [...out].slice(0, 20);
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
1741
|
// src/lcm/archive.ts
|
|
2155
1742
|
function estimateTokens(text) {
|
|
2156
1743
|
return Math.ceil(text.length / 4);
|
|
@@ -3438,7 +3025,8 @@ ${preview}`,
|
|
|
3438
3025
|
return {
|
|
3439
3026
|
totalMessages: this.archive.getMessageCount(sessionId),
|
|
3440
3027
|
totalSummaryNodes: this.dag.getNodeCount(sessionId),
|
|
3441
|
-
maxDepth: this.dag.getMaxDepth(sessionId)
|
|
3028
|
+
maxDepth: this.dag.getMaxDepth(sessionId),
|
|
3029
|
+
maxTurnIndex: this.archive.getMaxTurnIndex(sessionId)
|
|
3442
3030
|
};
|
|
3443
3031
|
}
|
|
3444
3032
|
return {
|
|
@@ -4639,7 +4227,9 @@ var Orchestrator = class _Orchestrator {
|
|
|
4639
4227
|
client.disableThinking = true;
|
|
4640
4228
|
return client;
|
|
4641
4229
|
})() : this.localLlm;
|
|
4642
|
-
this._fastGatewayLlm = config.modelSource === "gateway" ? new FallbackLlmClient(config.gatewayConfig
|
|
4230
|
+
this._fastGatewayLlm = config.modelSource === "gateway" ? new FallbackLlmClient(config.gatewayConfig, {
|
|
4231
|
+
workspaceDir: config.workspaceDir
|
|
4232
|
+
}) : null;
|
|
4643
4233
|
if (config.modelSource === "gateway") {
|
|
4644
4234
|
log.debug(
|
|
4645
4235
|
`orchestrator: gateway model source active` + (config.gatewayAgentId ? ` (primary: ${config.gatewayAgentId})` : "") + (config.fastGatewayAgentId ? ` (fast: ${config.fastGatewayAgentId})` : "")
|
|
@@ -4665,17 +4255,19 @@ var Orchestrator = class _Orchestrator {
|
|
|
4665
4255
|
const summarizeFn = async (text, targetTokens, aggressive) => {
|
|
4666
4256
|
const instructionText = aggressive ? `Compress the following into bullet points. One bullet per distinct fact or decision. Maximum ${targetTokens} tokens total. No prose.` : `Compress the following conversation segment into a dense summary. Preserve: decisions made, code artifacts mentioned, errors encountered, open questions, and any commitments or next-steps. Omit: pleasantries, restatements, and anything the agent would not need to recall later. Output a single paragraph, maximum ${targetTokens} tokens.`;
|
|
4667
4257
|
try {
|
|
4668
|
-
const
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4258
|
+
const messages = [
|
|
4259
|
+
{ role: "system", content: instructionText },
|
|
4260
|
+
{ role: "user", content: text.slice(0, 12e3) }
|
|
4261
|
+
];
|
|
4262
|
+
const result = this.config.modelSource === "gateway" && this._fastGatewayLlm ? await this._fastGatewayLlm.chatCompletion(messages, {
|
|
4263
|
+
maxTokens: targetTokens * 2,
|
|
4264
|
+
timeoutMs: this.config.localLlmFastTimeoutMs,
|
|
4265
|
+
agentId: this.config.fastGatewayAgentId || this.config.gatewayAgentId || void 0
|
|
4266
|
+
}) : await this.localLlm.chatCompletion(messages, {
|
|
4267
|
+
maxTokens: targetTokens * 2,
|
|
4268
|
+
operation: "lcm-summarize",
|
|
4269
|
+
priority: "background"
|
|
4270
|
+
});
|
|
4679
4271
|
return result?.content ?? null;
|
|
4680
4272
|
} catch {
|
|
4681
4273
|
return null;
|
|
@@ -5556,7 +5148,7 @@ ${doc.content}` : doc.content,
|
|
|
5556
5148
|
}
|
|
5557
5149
|
async runDeepSleepGovernanceNow(options) {
|
|
5558
5150
|
const targetStorage = options?.storage ?? this.storage;
|
|
5559
|
-
const { runMemoryGovernance } = await import("./memory-governance-
|
|
5151
|
+
const { runMemoryGovernance } = await import("./memory-governance-F3QOJGEY.js");
|
|
5560
5152
|
const { summarizeGovernanceResultForDreams } = await import("./dreams-ledger-LR2NBAZE.js");
|
|
5561
5153
|
const govResult = await runMemoryGovernance({
|
|
5562
5154
|
memoryDir: targetStorage.dir,
|
|
@@ -5620,7 +5212,9 @@ ${doc.content}` : doc.content,
|
|
|
5620
5212
|
log.info("[semantic-consolidation] using fast local LLM for synthesis");
|
|
5621
5213
|
}
|
|
5622
5214
|
const gatewayAgentId = useGateway ? modelSetting === "fast" && this.config.fastGatewayAgentId ? this.config.fastGatewayAgentId : this.config.gatewayAgentId || void 0 : void 0;
|
|
5623
|
-
const llm = new FallbackLlmClient2(this.config.gatewayConfig
|
|
5215
|
+
const llm = new FallbackLlmClient2(this.config.gatewayConfig, {
|
|
5216
|
+
workspaceDir: this.config.workspaceDir
|
|
5217
|
+
});
|
|
5624
5218
|
if (!llm.isAvailable(gatewayAgentId) && !(modelSetting === "fast" && this.fastLlm && !useGateway)) {
|
|
5625
5219
|
log.warn(
|
|
5626
5220
|
"[semantic-consolidation] no LLM available \u2014 skipping synthesis"
|
|
@@ -5774,7 +5368,9 @@ ${doc.content}` : doc.content,
|
|
|
5774
5368
|
if (this.config.peerProfileReasonerEnabled) {
|
|
5775
5369
|
try {
|
|
5776
5370
|
const { runPeerProfileReasoner } = await import("./peers-HCVGHMAE.js");
|
|
5777
|
-
const llm2 = new FallbackLlmClient2(this.config.gatewayConfig
|
|
5371
|
+
const llm2 = new FallbackLlmClient2(this.config.gatewayConfig, {
|
|
5372
|
+
workspaceDir: this.config.workspaceDir
|
|
5373
|
+
});
|
|
5778
5374
|
const peerResult = await runPeerProfileReasoner({
|
|
5779
5375
|
memoryDir: targetStorage.dir,
|
|
5780
5376
|
enabled: true,
|
|
@@ -8243,13 +7839,27 @@ ${lines.join("\n\n")}`;
|
|
|
8243
7839
|
});
|
|
8244
7840
|
return null;
|
|
8245
7841
|
}
|
|
8246
|
-
const
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
7842
|
+
const objectiveStateSearches = await Promise.all(
|
|
7843
|
+
recallNamespaces.map(async (namespace) => {
|
|
7844
|
+
const storage = this.config.namespacesEnabled ? await this.getStorage(namespace) : null;
|
|
7845
|
+
return searchObjectiveStateSnapshots({
|
|
7846
|
+
memoryDir: this.config.namespacesEnabled ? storage.dir : this.config.memoryDir,
|
|
7847
|
+
objectiveStateStoreDir: objectiveStateStoreOverrideForNamespace({
|
|
7848
|
+
memoryDir: this.config.memoryDir,
|
|
7849
|
+
configuredStoreDir: this.config.objectiveStateStoreDir,
|
|
7850
|
+
namespacesEnabled: this.config.namespacesEnabled,
|
|
7851
|
+
namespace
|
|
7852
|
+
}),
|
|
7853
|
+
query: retrievalQuery,
|
|
7854
|
+
maxResults,
|
|
7855
|
+
sessionKey
|
|
7856
|
+
});
|
|
7857
|
+
})
|
|
7858
|
+
);
|
|
7859
|
+
const results = objectiveStateSearches.flat().sort((left, right) => {
|
|
7860
|
+
if (right.score !== left.score) return right.score - left.score;
|
|
7861
|
+
return right.snapshot.recordedAt.localeCompare(left.snapshot.recordedAt);
|
|
7862
|
+
}).slice(0, maxResults);
|
|
8253
7863
|
recordRecallSectionMetric({
|
|
8254
7864
|
section: "objectiveState",
|
|
8255
7865
|
priority: "core",
|
|
@@ -11836,7 +11446,9 @@ ${normalized}`).digest("hex");
|
|
|
11836
11446
|
judgeCandidates,
|
|
11837
11447
|
this.config,
|
|
11838
11448
|
this.localLlm,
|
|
11839
|
-
new FallbackLlmClient(this.config.gatewayConfig
|
|
11449
|
+
new FallbackLlmClient(this.config.gatewayConfig, {
|
|
11450
|
+
workspaceDir: this.config.workspaceDir
|
|
11451
|
+
}),
|
|
11840
11452
|
this.judgeVerdictCache,
|
|
11841
11453
|
this.judgeDeferCounts,
|
|
11842
11454
|
judgeTelemetryHandler
|
|
@@ -14750,13 +14362,6 @@ export {
|
|
|
14750
14362
|
openLcmDatabase,
|
|
14751
14363
|
ensureLcmStateDir,
|
|
14752
14364
|
applyLcmSchema,
|
|
14753
|
-
isLcmMessagePartKind,
|
|
14754
|
-
parseMessageParts,
|
|
14755
|
-
normalizeExplicitParts,
|
|
14756
|
-
parseOpenAiMessageParts,
|
|
14757
|
-
parseAnthropicMessageParts,
|
|
14758
|
-
parseOpenClawMessageParts,
|
|
14759
|
-
partsFromRenderedText,
|
|
14760
14365
|
projectNamespaceName,
|
|
14761
14366
|
branchNamespaceName,
|
|
14762
14367
|
resolveCodingNamespaceOverlay,
|
|
@@ -14789,4 +14394,4 @@ export {
|
|
|
14789
14394
|
resolvePersistedMemoryRelativePath,
|
|
14790
14395
|
Orchestrator
|
|
14791
14396
|
};
|
|
14792
|
-
//# sourceMappingURL=chunk-
|
|
14397
|
+
//# sourceMappingURL=chunk-KUHRUM6B.js.map
|