@psiclawops/hypermem 0.8.5 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +2 -2
- package/CHANGELOG.md +36 -1
- package/INSTALL.md +132 -9
- package/README.md +119 -272
- package/bench/README.md +42 -0
- package/bench/data-access-bench.mjs +380 -0
- package/bin/hypermem-bench.mjs +2 -0
- package/bin/hypermem-doctor.mjs +412 -0
- package/bin/hypermem-model-audit.mjs +339 -0
- package/bin/hypermem-status.mjs +491 -70
- package/docs/DIAGNOSTICS.md +205 -0
- package/docs/INTEGRATION_VALIDATION.md +186 -0
- package/docs/MIGRATION.md +9 -6
- package/docs/MIGRATION_GUIDE.md +125 -101
- package/docs/ROADMAP.md +247 -20
- package/docs/TUNING.md +19 -5
- package/install.sh +152 -401
- package/memory-plugin/LICENSE +190 -0
- package/memory-plugin/README.md +20 -0
- package/memory-plugin/package.json +3 -3
- package/package.json +19 -4
- package/plugin/LICENSE +190 -0
- package/plugin/README.md +20 -0
- package/plugin/package.json +4 -4
- package/scripts/install-runtime.mjs +12 -1
- package/dist/background-indexer.d.ts +0 -161
- package/dist/background-indexer.d.ts.map +0 -1
- package/dist/background-indexer.js +0 -1263
- package/dist/budget-policy.d.ts +0 -22
- package/dist/budget-policy.d.ts.map +0 -1
- package/dist/budget-policy.js +0 -27
- package/dist/cache.d.ts +0 -147
- package/dist/cache.d.ts.map +0 -1
- package/dist/cache.js +0 -569
- package/dist/compaction-fence.d.ts +0 -97
- package/dist/compaction-fence.d.ts.map +0 -1
- package/dist/compaction-fence.js +0 -174
- package/dist/compositor-utils.d.ts +0 -31
- package/dist/compositor-utils.d.ts.map +0 -1
- package/dist/compositor-utils.js +0 -47
- package/dist/compositor.d.ts +0 -394
- package/dist/compositor.d.ts.map +0 -1
- package/dist/compositor.js +0 -3632
- package/dist/content-hash.d.ts +0 -43
- package/dist/content-hash.d.ts.map +0 -1
- package/dist/content-hash.js +0 -75
- package/dist/content-type-classifier.d.ts +0 -41
- package/dist/content-type-classifier.d.ts.map +0 -1
- package/dist/content-type-classifier.js +0 -181
- package/dist/context-backfill.d.ts +0 -46
- package/dist/context-backfill.d.ts.map +0 -1
- package/dist/context-backfill.js +0 -113
- package/dist/context-store.d.ts +0 -131
- package/dist/context-store.d.ts.map +0 -1
- package/dist/context-store.js +0 -279
- package/dist/contradiction-audit-store.d.ts +0 -54
- package/dist/contradiction-audit-store.d.ts.map +0 -1
- package/dist/contradiction-audit-store.js +0 -88
- package/dist/contradiction-detector.d.ts +0 -78
- package/dist/contradiction-detector.d.ts.map +0 -1
- package/dist/contradiction-detector.js +0 -362
- package/dist/contradiction-resolution-policy.d.ts +0 -21
- package/dist/contradiction-resolution-policy.d.ts.map +0 -1
- package/dist/contradiction-resolution-policy.js +0 -17
- package/dist/cross-agent.d.ts +0 -74
- package/dist/cross-agent.d.ts.map +0 -1
- package/dist/cross-agent.js +0 -271
- package/dist/db.d.ts +0 -131
- package/dist/db.d.ts.map +0 -1
- package/dist/db.js +0 -410
- package/dist/degradation.d.ts +0 -102
- package/dist/degradation.d.ts.map +0 -1
- package/dist/degradation.js +0 -141
- package/dist/desired-state-store.d.ts +0 -100
- package/dist/desired-state-store.d.ts.map +0 -1
- package/dist/desired-state-store.js +0 -222
- package/dist/doc-chunk-store.d.ts +0 -140
- package/dist/doc-chunk-store.d.ts.map +0 -1
- package/dist/doc-chunk-store.js +0 -391
- package/dist/doc-chunker.d.ts +0 -99
- package/dist/doc-chunker.d.ts.map +0 -1
- package/dist/doc-chunker.js +0 -324
- package/dist/dreaming-promoter.d.ts +0 -124
- package/dist/dreaming-promoter.d.ts.map +0 -1
- package/dist/dreaming-promoter.js +0 -447
- package/dist/episode-store.d.ts +0 -49
- package/dist/episode-store.d.ts.map +0 -1
- package/dist/episode-store.js +0 -135
- package/dist/expertise-store.d.ts +0 -129
- package/dist/expertise-store.d.ts.map +0 -1
- package/dist/expertise-store.js +0 -342
- package/dist/fact-store.d.ts +0 -90
- package/dist/fact-store.d.ts.map +0 -1
- package/dist/fact-store.js +0 -283
- package/dist/fleet-store.d.ts +0 -144
- package/dist/fleet-store.d.ts.map +0 -1
- package/dist/fleet-store.js +0 -276
- package/dist/fos-mod.d.ts +0 -178
- package/dist/fos-mod.d.ts.map +0 -1
- package/dist/fos-mod.js +0 -416
- package/dist/hybrid-retrieval.d.ts +0 -64
- package/dist/hybrid-retrieval.d.ts.map +0 -1
- package/dist/hybrid-retrieval.js +0 -344
- package/dist/image-eviction.d.ts +0 -49
- package/dist/image-eviction.d.ts.map +0 -1
- package/dist/image-eviction.js +0 -251
- package/dist/index.d.ts +0 -718
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1469
- package/dist/keystone-scorer.d.ts +0 -51
- package/dist/keystone-scorer.d.ts.map +0 -1
- package/dist/keystone-scorer.js +0 -52
- package/dist/knowledge-graph.d.ts +0 -110
- package/dist/knowledge-graph.d.ts.map +0 -1
- package/dist/knowledge-graph.js +0 -305
- package/dist/knowledge-lint.d.ts +0 -31
- package/dist/knowledge-lint.d.ts.map +0 -1
- package/dist/knowledge-lint.js +0 -155
- package/dist/knowledge-store.d.ts +0 -72
- package/dist/knowledge-store.d.ts.map +0 -1
- package/dist/knowledge-store.js +0 -247
- package/dist/library-schema.d.ts +0 -27
- package/dist/library-schema.d.ts.map +0 -1
- package/dist/library-schema.js +0 -1343
- package/dist/message-store.d.ts +0 -181
- package/dist/message-store.d.ts.map +0 -1
- package/dist/message-store.js +0 -573
- package/dist/metrics-dashboard.d.ts +0 -114
- package/dist/metrics-dashboard.d.ts.map +0 -1
- package/dist/metrics-dashboard.js +0 -260
- package/dist/obsidian-exporter.d.ts +0 -57
- package/dist/obsidian-exporter.d.ts.map +0 -1
- package/dist/obsidian-exporter.js +0 -274
- package/dist/obsidian-watcher.d.ts +0 -147
- package/dist/obsidian-watcher.d.ts.map +0 -1
- package/dist/obsidian-watcher.js +0 -403
- package/dist/open-domain.d.ts +0 -46
- package/dist/open-domain.d.ts.map +0 -1
- package/dist/open-domain.js +0 -125
- package/dist/preference-store.d.ts +0 -54
- package/dist/preference-store.d.ts.map +0 -1
- package/dist/preference-store.js +0 -109
- package/dist/preservation-gate.d.ts +0 -82
- package/dist/preservation-gate.d.ts.map +0 -1
- package/dist/preservation-gate.js +0 -150
- package/dist/proactive-pass.d.ts +0 -63
- package/dist/proactive-pass.d.ts.map +0 -1
- package/dist/proactive-pass.js +0 -293
- package/dist/profiles.d.ts +0 -46
- package/dist/profiles.d.ts.map +0 -1
- package/dist/profiles.js +0 -262
- package/dist/provider-translator.d.ts +0 -50
- package/dist/provider-translator.d.ts.map +0 -1
- package/dist/provider-translator.js +0 -403
- package/dist/rate-limiter.d.ts +0 -76
- package/dist/rate-limiter.d.ts.map +0 -1
- package/dist/rate-limiter.js +0 -179
- package/dist/repair-tool-pairs.d.ts +0 -38
- package/dist/repair-tool-pairs.d.ts.map +0 -1
- package/dist/repair-tool-pairs.js +0 -209
- package/dist/replay-recovery.d.ts +0 -29
- package/dist/replay-recovery.d.ts.map +0 -1
- package/dist/replay-recovery.js +0 -82
- package/dist/reranker.d.ts +0 -95
- package/dist/reranker.d.ts.map +0 -1
- package/dist/reranker.js +0 -308
- package/dist/retrieval-policy.d.ts +0 -51
- package/dist/retrieval-policy.d.ts.map +0 -1
- package/dist/retrieval-policy.js +0 -77
- package/dist/schema.d.ts +0 -15
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -300
- package/dist/secret-scanner.d.ts +0 -51
- package/dist/secret-scanner.d.ts.map +0 -1
- package/dist/secret-scanner.js +0 -248
- package/dist/seed.d.ts +0 -108
- package/dist/seed.d.ts.map +0 -1
- package/dist/seed.js +0 -177
- package/dist/session-flusher.d.ts +0 -53
- package/dist/session-flusher.d.ts.map +0 -1
- package/dist/session-flusher.js +0 -69
- package/dist/session-topic-map.d.ts +0 -41
- package/dist/session-topic-map.d.ts.map +0 -1
- package/dist/session-topic-map.js +0 -77
- package/dist/spawn-context.d.ts +0 -54
- package/dist/spawn-context.d.ts.map +0 -1
- package/dist/spawn-context.js +0 -159
- package/dist/system-store.d.ts +0 -73
- package/dist/system-store.d.ts.map +0 -1
- package/dist/system-store.js +0 -182
- package/dist/temporal-store.d.ts +0 -81
- package/dist/temporal-store.d.ts.map +0 -1
- package/dist/temporal-store.js +0 -149
- package/dist/tool-artifact-store.d.ts +0 -98
- package/dist/tool-artifact-store.d.ts.map +0 -1
- package/dist/tool-artifact-store.js +0 -244
- package/dist/topic-detector.d.ts +0 -35
- package/dist/topic-detector.d.ts.map +0 -1
- package/dist/topic-detector.js +0 -249
- package/dist/topic-store.d.ts +0 -51
- package/dist/topic-store.d.ts.map +0 -1
- package/dist/topic-store.js +0 -175
- package/dist/topic-synthesizer.d.ts +0 -51
- package/dist/topic-synthesizer.d.ts.map +0 -1
- package/dist/topic-synthesizer.js +0 -316
- package/dist/trigger-registry.d.ts +0 -63
- package/dist/trigger-registry.d.ts.map +0 -1
- package/dist/trigger-registry.js +0 -163
- package/dist/types.d.ts +0 -815
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -9
- package/dist/vector-store.d.ts +0 -180
- package/dist/vector-store.d.ts.map +0 -1
- package/dist/vector-store.js +0 -1041
- package/dist/version.d.ts +0 -34
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -34
- package/dist/wiki-page-emitter.d.ts +0 -65
- package/dist/wiki-page-emitter.d.ts.map +0 -1
- package/dist/wiki-page-emitter.js +0 -258
- package/dist/work-store.d.ts +0 -112
- package/dist/work-store.d.ts.map +0 -1
- package/dist/work-store.js +0 -273
- package/memory-plugin/dist/index.d.ts +0 -24
- package/memory-plugin/dist/index.d.ts.map +0 -1
- package/memory-plugin/dist/index.js +0 -300
- package/memory-plugin/dist/index.js.map +0 -1
- package/node_modules/sqlite-vec/README.md +0 -1
- package/node_modules/sqlite-vec/index.cjs +0 -46
- package/node_modules/sqlite-vec/index.d.ts +0 -17
- package/node_modules/sqlite-vec/index.mjs +0 -47
- package/node_modules/sqlite-vec/package.json +0 -1
- package/node_modules/sqlite-vec-linux-x64/README.md +0 -1
- package/node_modules/sqlite-vec-linux-x64/package.json +0 -1
- package/node_modules/sqlite-vec-linux-x64/vec0.so +0 -0
- package/node_modules/zod/LICENSE +0 -21
- package/node_modules/zod/README.md +0 -208
- package/node_modules/zod/index.cjs +0 -33
- package/node_modules/zod/index.d.cts +0 -4
- package/node_modules/zod/index.d.ts +0 -4
- package/node_modules/zod/index.js +0 -4
- package/node_modules/zod/locales/index.cjs +0 -17
- package/node_modules/zod/locales/index.d.cts +0 -1
- package/node_modules/zod/locales/index.d.ts +0 -1
- package/node_modules/zod/locales/index.js +0 -1
- package/node_modules/zod/locales/package.json +0 -6
- package/node_modules/zod/mini/index.cjs +0 -32
- package/node_modules/zod/mini/index.d.cts +0 -3
- package/node_modules/zod/mini/index.d.ts +0 -3
- package/node_modules/zod/mini/index.js +0 -3
- package/node_modules/zod/mini/package.json +0 -6
- package/node_modules/zod/package.json +0 -135
- package/node_modules/zod/src/index.ts +0 -4
- package/node_modules/zod/src/locales/index.ts +0 -1
- package/node_modules/zod/src/mini/index.ts +0 -3
- package/node_modules/zod/src/v3/ZodError.ts +0 -330
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
- package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
- package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
- package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
- package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
- package/node_modules/zod/src/v3/errors.ts +0 -13
- package/node_modules/zod/src/v3/external.ts +0 -6
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
- package/node_modules/zod/src/v3/helpers/util.ts +0 -224
- package/node_modules/zod/src/v3/index.ts +0 -4
- package/node_modules/zod/src/v3/locales/en.ts +0 -124
- package/node_modules/zod/src/v3/standard-schema.ts +0 -113
- package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
- package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
- package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
- package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
- package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
- package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
- package/node_modules/zod/src/v3/tests/complex.test.ts +0 -70
- package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
- package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
- package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
- package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
- package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
- package/node_modules/zod/src/v3/tests/function.test.ts +0 -261
- package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
- package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
- package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
- package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
- package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
- package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
- package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
- package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
- package/node_modules/zod/src/v3/tests/nan.test.ts +0 -24
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
- package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
- package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
- package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
- package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
- package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
- package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
- package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
- package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
- package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
- package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
- package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
- package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
- package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
- package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
- package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
- package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
- package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
- package/node_modules/zod/src/v3/types.ts +0 -5138
- package/node_modules/zod/src/v4/classic/checks.ts +0 -32
- package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
- package/node_modules/zod/src/v4/classic/compat.ts +0 -70
- package/node_modules/zod/src/v4/classic/errors.ts +0 -82
- package/node_modules/zod/src/v4/classic/external.ts +0 -51
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +0 -643
- package/node_modules/zod/src/v4/classic/index.ts +0 -5
- package/node_modules/zod/src/v4/classic/iso.ts +0 -90
- package/node_modules/zod/src/v4/classic/parse.ts +0 -82
- package/node_modules/zod/src/v4/classic/schemas.ts +0 -2409
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +0 -59
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -106
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -276
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -562
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -374
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -62
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -365
- package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +0 -27
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -661
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -595
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
- package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +0 -26
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +0 -734
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -360
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -939
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -60
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -198
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -109
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -330
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -270
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -640
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -223
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -427
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -211
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -282
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -632
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -582
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -570
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -243
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -134
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1175
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -771
- package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +0 -438
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2990
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -361
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -183
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -219
- package/node_modules/zod/src/v4/classic/tests/url.test.ts +0 -13
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
- package/node_modules/zod/src/v4/core/api.ts +0 -1798
- package/node_modules/zod/src/v4/core/checks.ts +0 -1293
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- package/node_modules/zod/src/v4/core/core.ts +0 -138
- package/node_modules/zod/src/v4/core/doc.ts +0 -44
- package/node_modules/zod/src/v4/core/errors.ts +0 -448
- package/node_modules/zod/src/v4/core/index.ts +0 -16
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +0 -126
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +0 -667
- package/node_modules/zod/src/v4/core/json-schema.ts +0 -147
- package/node_modules/zod/src/v4/core/parse.ts +0 -195
- package/node_modules/zod/src/v4/core/regexes.ts +0 -183
- package/node_modules/zod/src/v4/core/registries.ts +0 -105
- package/node_modules/zod/src/v4/core/schemas.ts +0 -4538
- package/node_modules/zod/src/v4/core/standard-schema.ts +0 -159
- package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -59
- package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
- package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +0 -379
- package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +0 -46
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +0 -83
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +0 -67
- package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +0 -45
- package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -613
- package/node_modules/zod/src/v4/core/util.ts +0 -966
- package/node_modules/zod/src/v4/core/versions.ts +0 -5
- package/node_modules/zod/src/v4/core/zsf.ts +0 -323
- package/node_modules/zod/src/v4/index.ts +0 -4
- package/node_modules/zod/src/v4/locales/ar.ts +0 -115
- package/node_modules/zod/src/v4/locales/az.ts +0 -111
- package/node_modules/zod/src/v4/locales/be.ts +0 -176
- package/node_modules/zod/src/v4/locales/bg.ts +0 -128
- package/node_modules/zod/src/v4/locales/ca.ts +0 -116
- package/node_modules/zod/src/v4/locales/cs.ts +0 -118
- package/node_modules/zod/src/v4/locales/da.ts +0 -123
- package/node_modules/zod/src/v4/locales/de.ts +0 -116
- package/node_modules/zod/src/v4/locales/en.ts +0 -119
- package/node_modules/zod/src/v4/locales/eo.ts +0 -118
- package/node_modules/zod/src/v4/locales/es.ts +0 -141
- package/node_modules/zod/src/v4/locales/fa.ts +0 -126
- package/node_modules/zod/src/v4/locales/fi.ts +0 -121
- package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -116
- package/node_modules/zod/src/v4/locales/fr.ts +0 -116
- package/node_modules/zod/src/v4/locales/he.ts +0 -246
- package/node_modules/zod/src/v4/locales/hu.ts +0 -117
- package/node_modules/zod/src/v4/locales/hy.ts +0 -164
- package/node_modules/zod/src/v4/locales/id.ts +0 -115
- package/node_modules/zod/src/v4/locales/index.ts +0 -49
- package/node_modules/zod/src/v4/locales/is.ts +0 -119
- package/node_modules/zod/src/v4/locales/it.ts +0 -116
- package/node_modules/zod/src/v4/locales/ja.ts +0 -114
- package/node_modules/zod/src/v4/locales/ka.ts +0 -123
- package/node_modules/zod/src/v4/locales/kh.ts +0 -7
- package/node_modules/zod/src/v4/locales/km.ts +0 -119
- package/node_modules/zod/src/v4/locales/ko.ts +0 -121
- package/node_modules/zod/src/v4/locales/lt.ts +0 -239
- package/node_modules/zod/src/v4/locales/mk.ts +0 -118
- package/node_modules/zod/src/v4/locales/ms.ts +0 -115
- package/node_modules/zod/src/v4/locales/nl.ts +0 -121
- package/node_modules/zod/src/v4/locales/no.ts +0 -116
- package/node_modules/zod/src/v4/locales/ota.ts +0 -117
- package/node_modules/zod/src/v4/locales/pl.ts +0 -118
- package/node_modules/zod/src/v4/locales/ps.ts +0 -126
- package/node_modules/zod/src/v4/locales/pt.ts +0 -116
- package/node_modules/zod/src/v4/locales/ru.ts +0 -176
- package/node_modules/zod/src/v4/locales/sl.ts +0 -118
- package/node_modules/zod/src/v4/locales/sv.ts +0 -119
- package/node_modules/zod/src/v4/locales/ta.ts +0 -118
- package/node_modules/zod/src/v4/locales/th.ts +0 -119
- package/node_modules/zod/src/v4/locales/tr.ts +0 -111
- package/node_modules/zod/src/v4/locales/ua.ts +0 -7
- package/node_modules/zod/src/v4/locales/uk.ts +0 -117
- package/node_modules/zod/src/v4/locales/ur.ts +0 -119
- package/node_modules/zod/src/v4/locales/uz.ts +0 -116
- package/node_modules/zod/src/v4/locales/vi.ts +0 -117
- package/node_modules/zod/src/v4/locales/yo.ts +0 -124
- package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -116
- package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -115
- package/node_modules/zod/src/v4/mini/checks.ts +0 -32
- package/node_modules/zod/src/v4/mini/coerce.ts +0 -27
- package/node_modules/zod/src/v4/mini/external.ts +0 -40
- package/node_modules/zod/src/v4/mini/index.ts +0 -3
- package/node_modules/zod/src/v4/mini/iso.ts +0 -66
- package/node_modules/zod/src/v4/mini/parse.ts +0 -14
- package/node_modules/zod/src/v4/mini/schemas.ts +0 -1916
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +0 -24
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -94
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -529
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -5
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -963
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -227
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
- package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +0 -50
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -347
- package/node_modules/zod/src/v4-mini/index.ts +0 -3
- package/node_modules/zod/v3/ZodError.cjs +0 -138
- package/node_modules/zod/v3/ZodError.d.cts +0 -164
- package/node_modules/zod/v3/ZodError.d.ts +0 -164
- package/node_modules/zod/v3/ZodError.js +0 -133
- package/node_modules/zod/v3/errors.cjs +0 -17
- package/node_modules/zod/v3/errors.d.cts +0 -5
- package/node_modules/zod/v3/errors.d.ts +0 -5
- package/node_modules/zod/v3/errors.js +0 -9
- package/node_modules/zod/v3/external.cjs +0 -22
- package/node_modules/zod/v3/external.d.cts +0 -6
- package/node_modules/zod/v3/external.d.ts +0 -6
- package/node_modules/zod/v3/external.js +0 -6
- package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
- package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
- package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
- package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
- package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
- package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
- package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
- package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
- package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
- package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
- package/node_modules/zod/v3/helpers/util.cjs +0 -137
- package/node_modules/zod/v3/helpers/util.d.cts +0 -85
- package/node_modules/zod/v3/helpers/util.d.ts +0 -85
- package/node_modules/zod/v3/helpers/util.js +0 -133
- package/node_modules/zod/v3/index.cjs +0 -33
- package/node_modules/zod/v3/index.d.cts +0 -4
- package/node_modules/zod/v3/index.d.ts +0 -4
- package/node_modules/zod/v3/index.js +0 -4
- package/node_modules/zod/v3/locales/en.cjs +0 -112
- package/node_modules/zod/v3/locales/en.d.cts +0 -3
- package/node_modules/zod/v3/locales/en.d.ts +0 -3
- package/node_modules/zod/v3/locales/en.js +0 -109
- package/node_modules/zod/v3/package.json +0 -6
- package/node_modules/zod/v3/standard-schema.cjs +0 -2
- package/node_modules/zod/v3/standard-schema.d.cts +0 -102
- package/node_modules/zod/v3/standard-schema.d.ts +0 -102
- package/node_modules/zod/v3/standard-schema.js +0 -1
- package/node_modules/zod/v3/types.cjs +0 -3777
- package/node_modules/zod/v3/types.d.cts +0 -1034
- package/node_modules/zod/v3/types.d.ts +0 -1034
- package/node_modules/zod/v3/types.js +0 -3695
- package/node_modules/zod/v4/classic/checks.cjs +0 -33
- package/node_modules/zod/v4/classic/checks.d.cts +0 -1
- package/node_modules/zod/v4/classic/checks.d.ts +0 -1
- package/node_modules/zod/v4/classic/checks.js +0 -1
- package/node_modules/zod/v4/classic/coerce.cjs +0 -47
- package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
- package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
- package/node_modules/zod/v4/classic/coerce.js +0 -17
- package/node_modules/zod/v4/classic/compat.cjs +0 -61
- package/node_modules/zod/v4/classic/compat.d.cts +0 -50
- package/node_modules/zod/v4/classic/compat.d.ts +0 -50
- package/node_modules/zod/v4/classic/compat.js +0 -31
- package/node_modules/zod/v4/classic/errors.cjs +0 -74
- package/node_modules/zod/v4/classic/errors.d.cts +0 -30
- package/node_modules/zod/v4/classic/errors.d.ts +0 -30
- package/node_modules/zod/v4/classic/errors.js +0 -48
- package/node_modules/zod/v4/classic/external.cjs +0 -73
- package/node_modules/zod/v4/classic/external.d.cts +0 -15
- package/node_modules/zod/v4/classic/external.d.ts +0 -15
- package/node_modules/zod/v4/classic/external.js +0 -20
- package/node_modules/zod/v4/classic/from-json-schema.cjs +0 -610
- package/node_modules/zod/v4/classic/from-json-schema.d.cts +0 -12
- package/node_modules/zod/v4/classic/from-json-schema.d.ts +0 -12
- package/node_modules/zod/v4/classic/from-json-schema.js +0 -584
- package/node_modules/zod/v4/classic/index.cjs +0 -33
- package/node_modules/zod/v4/classic/index.d.cts +0 -4
- package/node_modules/zod/v4/classic/index.d.ts +0 -4
- package/node_modules/zod/v4/classic/index.js +0 -4
- package/node_modules/zod/v4/classic/iso.cjs +0 -60
- package/node_modules/zod/v4/classic/iso.d.cts +0 -22
- package/node_modules/zod/v4/classic/iso.d.ts +0 -22
- package/node_modules/zod/v4/classic/iso.js +0 -30
- package/node_modules/zod/v4/classic/package.json +0 -6
- package/node_modules/zod/v4/classic/parse.cjs +0 -41
- package/node_modules/zod/v4/classic/parse.d.cts +0 -31
- package/node_modules/zod/v4/classic/parse.d.ts +0 -31
- package/node_modules/zod/v4/classic/parse.js +0 -15
- package/node_modules/zod/v4/classic/schemas.cjs +0 -1272
- package/node_modules/zod/v4/classic/schemas.d.cts +0 -739
- package/node_modules/zod/v4/classic/schemas.d.ts +0 -739
- package/node_modules/zod/v4/classic/schemas.js +0 -1157
- package/node_modules/zod/v4/core/api.cjs +0 -1222
- package/node_modules/zod/v4/core/api.d.cts +0 -304
- package/node_modules/zod/v4/core/api.d.ts +0 -304
- package/node_modules/zod/v4/core/api.js +0 -1082
- package/node_modules/zod/v4/core/checks.cjs +0 -601
- package/node_modules/zod/v4/core/checks.d.cts +0 -278
- package/node_modules/zod/v4/core/checks.d.ts +0 -278
- package/node_modules/zod/v4/core/checks.js +0 -575
- package/node_modules/zod/v4/core/core.cjs +0 -83
- package/node_modules/zod/v4/core/core.d.cts +0 -70
- package/node_modules/zod/v4/core/core.d.ts +0 -70
- package/node_modules/zod/v4/core/core.js +0 -76
- package/node_modules/zod/v4/core/doc.cjs +0 -39
- package/node_modules/zod/v4/core/doc.d.cts +0 -14
- package/node_modules/zod/v4/core/doc.d.ts +0 -14
- package/node_modules/zod/v4/core/doc.js +0 -35
- package/node_modules/zod/v4/core/errors.cjs +0 -213
- package/node_modules/zod/v4/core/errors.d.cts +0 -220
- package/node_modules/zod/v4/core/errors.d.ts +0 -220
- package/node_modules/zod/v4/core/errors.js +0 -182
- package/node_modules/zod/v4/core/index.cjs +0 -47
- package/node_modules/zod/v4/core/index.d.cts +0 -16
- package/node_modules/zod/v4/core/index.d.ts +0 -16
- package/node_modules/zod/v4/core/index.js +0 -16
- package/node_modules/zod/v4/core/json-schema-generator.cjs +0 -99
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +0 -65
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +0 -65
- package/node_modules/zod/v4/core/json-schema-generator.js +0 -95
- package/node_modules/zod/v4/core/json-schema-processors.cjs +0 -648
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -49
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -49
- package/node_modules/zod/v4/core/json-schema-processors.js +0 -605
- package/node_modules/zod/v4/core/json-schema.cjs +0 -2
- package/node_modules/zod/v4/core/json-schema.d.cts +0 -88
- package/node_modules/zod/v4/core/json-schema.d.ts +0 -88
- package/node_modules/zod/v4/core/json-schema.js +0 -1
- package/node_modules/zod/v4/core/package.json +0 -6
- package/node_modules/zod/v4/core/parse.cjs +0 -131
- package/node_modules/zod/v4/core/parse.d.cts +0 -49
- package/node_modules/zod/v4/core/parse.d.ts +0 -49
- package/node_modules/zod/v4/core/parse.js +0 -93
- package/node_modules/zod/v4/core/regexes.cjs +0 -166
- package/node_modules/zod/v4/core/regexes.d.cts +0 -79
- package/node_modules/zod/v4/core/regexes.d.ts +0 -79
- package/node_modules/zod/v4/core/regexes.js +0 -133
- package/node_modules/zod/v4/core/registries.cjs +0 -56
- package/node_modules/zod/v4/core/registries.d.cts +0 -35
- package/node_modules/zod/v4/core/registries.d.ts +0 -35
- package/node_modules/zod/v4/core/registries.js +0 -51
- package/node_modules/zod/v4/core/schemas.cjs +0 -2124
- package/node_modules/zod/v4/core/schemas.d.cts +0 -1146
- package/node_modules/zod/v4/core/schemas.d.ts +0 -1146
- package/node_modules/zod/v4/core/schemas.js +0 -2093
- package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
- package/node_modules/zod/v4/core/standard-schema.d.cts +0 -126
- package/node_modules/zod/v4/core/standard-schema.d.ts +0 -126
- package/node_modules/zod/v4/core/standard-schema.js +0 -1
- package/node_modules/zod/v4/core/to-json-schema.cjs +0 -446
- package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -114
- package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -114
- package/node_modules/zod/v4/core/to-json-schema.js +0 -437
- package/node_modules/zod/v4/core/util.cjs +0 -710
- package/node_modules/zod/v4/core/util.d.cts +0 -199
- package/node_modules/zod/v4/core/util.d.ts +0 -199
- package/node_modules/zod/v4/core/util.js +0 -651
- package/node_modules/zod/v4/core/versions.cjs +0 -8
- package/node_modules/zod/v4/core/versions.d.cts +0 -5
- package/node_modules/zod/v4/core/versions.d.ts +0 -5
- package/node_modules/zod/v4/core/versions.js +0 -5
- package/node_modules/zod/v4/index.cjs +0 -22
- package/node_modules/zod/v4/index.d.cts +0 -3
- package/node_modules/zod/v4/index.d.ts +0 -3
- package/node_modules/zod/v4/index.js +0 -3
- package/node_modules/zod/v4/locales/ar.cjs +0 -133
- package/node_modules/zod/v4/locales/ar.d.cts +0 -5
- package/node_modules/zod/v4/locales/ar.d.ts +0 -4
- package/node_modules/zod/v4/locales/ar.js +0 -106
- package/node_modules/zod/v4/locales/az.cjs +0 -132
- package/node_modules/zod/v4/locales/az.d.cts +0 -5
- package/node_modules/zod/v4/locales/az.d.ts +0 -4
- package/node_modules/zod/v4/locales/az.js +0 -105
- package/node_modules/zod/v4/locales/be.cjs +0 -183
- package/node_modules/zod/v4/locales/be.d.cts +0 -5
- package/node_modules/zod/v4/locales/be.d.ts +0 -4
- package/node_modules/zod/v4/locales/be.js +0 -156
- package/node_modules/zod/v4/locales/bg.cjs +0 -147
- package/node_modules/zod/v4/locales/bg.d.cts +0 -5
- package/node_modules/zod/v4/locales/bg.d.ts +0 -4
- package/node_modules/zod/v4/locales/bg.js +0 -120
- package/node_modules/zod/v4/locales/ca.cjs +0 -134
- package/node_modules/zod/v4/locales/ca.d.cts +0 -5
- package/node_modules/zod/v4/locales/ca.d.ts +0 -4
- package/node_modules/zod/v4/locales/ca.js +0 -107
- package/node_modules/zod/v4/locales/cs.cjs +0 -138
- package/node_modules/zod/v4/locales/cs.d.cts +0 -5
- package/node_modules/zod/v4/locales/cs.d.ts +0 -4
- package/node_modules/zod/v4/locales/cs.js +0 -111
- package/node_modules/zod/v4/locales/da.cjs +0 -142
- package/node_modules/zod/v4/locales/da.d.cts +0 -5
- package/node_modules/zod/v4/locales/da.d.ts +0 -4
- package/node_modules/zod/v4/locales/da.js +0 -115
- package/node_modules/zod/v4/locales/de.cjs +0 -135
- package/node_modules/zod/v4/locales/de.d.cts +0 -5
- package/node_modules/zod/v4/locales/de.d.ts +0 -4
- package/node_modules/zod/v4/locales/de.js +0 -108
- package/node_modules/zod/v4/locales/en.cjs +0 -136
- package/node_modules/zod/v4/locales/en.d.cts +0 -5
- package/node_modules/zod/v4/locales/en.d.ts +0 -4
- package/node_modules/zod/v4/locales/en.js +0 -109
- package/node_modules/zod/v4/locales/eo.cjs +0 -136
- package/node_modules/zod/v4/locales/eo.d.cts +0 -5
- package/node_modules/zod/v4/locales/eo.d.ts +0 -4
- package/node_modules/zod/v4/locales/eo.js +0 -109
- package/node_modules/zod/v4/locales/es.cjs +0 -159
- package/node_modules/zod/v4/locales/es.d.cts +0 -5
- package/node_modules/zod/v4/locales/es.d.ts +0 -4
- package/node_modules/zod/v4/locales/es.js +0 -132
- package/node_modules/zod/v4/locales/fa.cjs +0 -141
- package/node_modules/zod/v4/locales/fa.d.cts +0 -5
- package/node_modules/zod/v4/locales/fa.d.ts +0 -4
- package/node_modules/zod/v4/locales/fa.js +0 -114
- package/node_modules/zod/v4/locales/fi.cjs +0 -139
- package/node_modules/zod/v4/locales/fi.d.cts +0 -5
- package/node_modules/zod/v4/locales/fi.d.ts +0 -4
- package/node_modules/zod/v4/locales/fi.js +0 -112
- package/node_modules/zod/v4/locales/fr-CA.cjs +0 -134
- package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
- package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
- package/node_modules/zod/v4/locales/fr-CA.js +0 -107
- package/node_modules/zod/v4/locales/fr.cjs +0 -135
- package/node_modules/zod/v4/locales/fr.d.cts +0 -5
- package/node_modules/zod/v4/locales/fr.d.ts +0 -4
- package/node_modules/zod/v4/locales/fr.js +0 -108
- package/node_modules/zod/v4/locales/he.cjs +0 -241
- package/node_modules/zod/v4/locales/he.d.cts +0 -5
- package/node_modules/zod/v4/locales/he.d.ts +0 -4
- package/node_modules/zod/v4/locales/he.js +0 -214
- package/node_modules/zod/v4/locales/hu.cjs +0 -135
- package/node_modules/zod/v4/locales/hu.d.cts +0 -5
- package/node_modules/zod/v4/locales/hu.d.ts +0 -4
- package/node_modules/zod/v4/locales/hu.js +0 -108
- package/node_modules/zod/v4/locales/hy.cjs +0 -174
- package/node_modules/zod/v4/locales/hy.d.cts +0 -5
- package/node_modules/zod/v4/locales/hy.d.ts +0 -4
- package/node_modules/zod/v4/locales/hy.js +0 -147
- package/node_modules/zod/v4/locales/id.cjs +0 -133
- package/node_modules/zod/v4/locales/id.d.cts +0 -5
- package/node_modules/zod/v4/locales/id.d.ts +0 -4
- package/node_modules/zod/v4/locales/id.js +0 -106
- package/node_modules/zod/v4/locales/index.cjs +0 -104
- package/node_modules/zod/v4/locales/index.d.cts +0 -49
- package/node_modules/zod/v4/locales/index.d.ts +0 -49
- package/node_modules/zod/v4/locales/index.js +0 -49
- package/node_modules/zod/v4/locales/is.cjs +0 -136
- package/node_modules/zod/v4/locales/is.d.cts +0 -5
- package/node_modules/zod/v4/locales/is.d.ts +0 -4
- package/node_modules/zod/v4/locales/is.js +0 -109
- package/node_modules/zod/v4/locales/it.cjs +0 -135
- package/node_modules/zod/v4/locales/it.d.cts +0 -5
- package/node_modules/zod/v4/locales/it.d.ts +0 -4
- package/node_modules/zod/v4/locales/it.js +0 -108
- package/node_modules/zod/v4/locales/ja.cjs +0 -134
- package/node_modules/zod/v4/locales/ja.d.cts +0 -5
- package/node_modules/zod/v4/locales/ja.d.ts +0 -4
- package/node_modules/zod/v4/locales/ja.js +0 -107
- package/node_modules/zod/v4/locales/ka.cjs +0 -139
- package/node_modules/zod/v4/locales/ka.d.cts +0 -5
- package/node_modules/zod/v4/locales/ka.d.ts +0 -4
- package/node_modules/zod/v4/locales/ka.js +0 -112
- package/node_modules/zod/v4/locales/kh.cjs +0 -12
- package/node_modules/zod/v4/locales/kh.d.cts +0 -5
- package/node_modules/zod/v4/locales/kh.d.ts +0 -5
- package/node_modules/zod/v4/locales/kh.js +0 -5
- package/node_modules/zod/v4/locales/km.cjs +0 -137
- package/node_modules/zod/v4/locales/km.d.cts +0 -5
- package/node_modules/zod/v4/locales/km.d.ts +0 -4
- package/node_modules/zod/v4/locales/km.js +0 -110
- package/node_modules/zod/v4/locales/ko.cjs +0 -138
- package/node_modules/zod/v4/locales/ko.d.cts +0 -5
- package/node_modules/zod/v4/locales/ko.d.ts +0 -4
- package/node_modules/zod/v4/locales/ko.js +0 -111
- package/node_modules/zod/v4/locales/lt.cjs +0 -230
- package/node_modules/zod/v4/locales/lt.d.cts +0 -5
- package/node_modules/zod/v4/locales/lt.d.ts +0 -4
- package/node_modules/zod/v4/locales/lt.js +0 -203
- package/node_modules/zod/v4/locales/mk.cjs +0 -136
- package/node_modules/zod/v4/locales/mk.d.cts +0 -5
- package/node_modules/zod/v4/locales/mk.d.ts +0 -4
- package/node_modules/zod/v4/locales/mk.js +0 -109
- package/node_modules/zod/v4/locales/ms.cjs +0 -134
- package/node_modules/zod/v4/locales/ms.d.cts +0 -5
- package/node_modules/zod/v4/locales/ms.d.ts +0 -4
- package/node_modules/zod/v4/locales/ms.js +0 -107
- package/node_modules/zod/v4/locales/nl.cjs +0 -137
- package/node_modules/zod/v4/locales/nl.d.cts +0 -5
- package/node_modules/zod/v4/locales/nl.d.ts +0 -4
- package/node_modules/zod/v4/locales/nl.js +0 -110
- package/node_modules/zod/v4/locales/no.cjs +0 -135
- package/node_modules/zod/v4/locales/no.d.cts +0 -5
- package/node_modules/zod/v4/locales/no.d.ts +0 -4
- package/node_modules/zod/v4/locales/no.js +0 -108
- package/node_modules/zod/v4/locales/ota.cjs +0 -136
- package/node_modules/zod/v4/locales/ota.d.cts +0 -5
- package/node_modules/zod/v4/locales/ota.d.ts +0 -4
- package/node_modules/zod/v4/locales/ota.js +0 -109
- package/node_modules/zod/v4/locales/package.json +0 -6
- package/node_modules/zod/v4/locales/pl.cjs +0 -136
- package/node_modules/zod/v4/locales/pl.d.cts +0 -5
- package/node_modules/zod/v4/locales/pl.d.ts +0 -4
- package/node_modules/zod/v4/locales/pl.js +0 -109
- package/node_modules/zod/v4/locales/ps.cjs +0 -141
- package/node_modules/zod/v4/locales/ps.d.cts +0 -5
- package/node_modules/zod/v4/locales/ps.d.ts +0 -4
- package/node_modules/zod/v4/locales/ps.js +0 -114
- package/node_modules/zod/v4/locales/pt.cjs +0 -135
- package/node_modules/zod/v4/locales/pt.d.cts +0 -5
- package/node_modules/zod/v4/locales/pt.d.ts +0 -4
- package/node_modules/zod/v4/locales/pt.js +0 -108
- package/node_modules/zod/v4/locales/ru.cjs +0 -183
- package/node_modules/zod/v4/locales/ru.d.cts +0 -5
- package/node_modules/zod/v4/locales/ru.d.ts +0 -4
- package/node_modules/zod/v4/locales/ru.js +0 -156
- package/node_modules/zod/v4/locales/sl.cjs +0 -136
- package/node_modules/zod/v4/locales/sl.d.cts +0 -5
- package/node_modules/zod/v4/locales/sl.d.ts +0 -4
- package/node_modules/zod/v4/locales/sl.js +0 -109
- package/node_modules/zod/v4/locales/sv.cjs +0 -137
- package/node_modules/zod/v4/locales/sv.d.cts +0 -5
- package/node_modules/zod/v4/locales/sv.d.ts +0 -4
- package/node_modules/zod/v4/locales/sv.js +0 -110
- package/node_modules/zod/v4/locales/ta.cjs +0 -137
- package/node_modules/zod/v4/locales/ta.d.cts +0 -5
- package/node_modules/zod/v4/locales/ta.d.ts +0 -4
- package/node_modules/zod/v4/locales/ta.js +0 -110
- package/node_modules/zod/v4/locales/th.cjs +0 -137
- package/node_modules/zod/v4/locales/th.d.cts +0 -5
- package/node_modules/zod/v4/locales/th.d.ts +0 -4
- package/node_modules/zod/v4/locales/th.js +0 -110
- package/node_modules/zod/v4/locales/tr.cjs +0 -132
- package/node_modules/zod/v4/locales/tr.d.cts +0 -5
- package/node_modules/zod/v4/locales/tr.d.ts +0 -4
- package/node_modules/zod/v4/locales/tr.js +0 -105
- package/node_modules/zod/v4/locales/ua.cjs +0 -12
- package/node_modules/zod/v4/locales/ua.d.cts +0 -5
- package/node_modules/zod/v4/locales/ua.d.ts +0 -5
- package/node_modules/zod/v4/locales/ua.js +0 -5
- package/node_modules/zod/v4/locales/uk.cjs +0 -135
- package/node_modules/zod/v4/locales/uk.d.cts +0 -5
- package/node_modules/zod/v4/locales/uk.d.ts +0 -4
- package/node_modules/zod/v4/locales/uk.js +0 -108
- package/node_modules/zod/v4/locales/ur.cjs +0 -137
- package/node_modules/zod/v4/locales/ur.d.cts +0 -5
- package/node_modules/zod/v4/locales/ur.d.ts +0 -4
- package/node_modules/zod/v4/locales/ur.js +0 -110
- package/node_modules/zod/v4/locales/uz.cjs +0 -136
- package/node_modules/zod/v4/locales/uz.d.cts +0 -5
- package/node_modules/zod/v4/locales/uz.d.ts +0 -4
- package/node_modules/zod/v4/locales/uz.js +0 -109
- package/node_modules/zod/v4/locales/vi.cjs +0 -135
- package/node_modules/zod/v4/locales/vi.d.cts +0 -5
- package/node_modules/zod/v4/locales/vi.d.ts +0 -4
- package/node_modules/zod/v4/locales/vi.js +0 -108
- package/node_modules/zod/v4/locales/yo.cjs +0 -134
- package/node_modules/zod/v4/locales/yo.d.cts +0 -5
- package/node_modules/zod/v4/locales/yo.d.ts +0 -4
- package/node_modules/zod/v4/locales/yo.js +0 -107
- package/node_modules/zod/v4/locales/zh-CN.cjs +0 -136
- package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
- package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
- package/node_modules/zod/v4/locales/zh-CN.js +0 -109
- package/node_modules/zod/v4/locales/zh-TW.cjs +0 -134
- package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
- package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
- package/node_modules/zod/v4/locales/zh-TW.js +0 -107
- package/node_modules/zod/v4/mini/checks.cjs +0 -34
- package/node_modules/zod/v4/mini/checks.d.cts +0 -1
- package/node_modules/zod/v4/mini/checks.d.ts +0 -1
- package/node_modules/zod/v4/mini/checks.js +0 -1
- package/node_modules/zod/v4/mini/coerce.cjs +0 -52
- package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
- package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
- package/node_modules/zod/v4/mini/coerce.js +0 -22
- package/node_modules/zod/v4/mini/external.cjs +0 -63
- package/node_modules/zod/v4/mini/external.d.cts +0 -12
- package/node_modules/zod/v4/mini/external.d.ts +0 -12
- package/node_modules/zod/v4/mini/external.js +0 -14
- package/node_modules/zod/v4/mini/index.cjs +0 -32
- package/node_modules/zod/v4/mini/index.d.cts +0 -3
- package/node_modules/zod/v4/mini/index.d.ts +0 -3
- package/node_modules/zod/v4/mini/index.js +0 -3
- package/node_modules/zod/v4/mini/iso.cjs +0 -64
- package/node_modules/zod/v4/mini/iso.d.cts +0 -22
- package/node_modules/zod/v4/mini/iso.d.ts +0 -22
- package/node_modules/zod/v4/mini/iso.js +0 -34
- package/node_modules/zod/v4/mini/package.json +0 -6
- package/node_modules/zod/v4/mini/parse.cjs +0 -16
- package/node_modules/zod/v4/mini/parse.d.cts +0 -1
- package/node_modules/zod/v4/mini/parse.d.ts +0 -1
- package/node_modules/zod/v4/mini/parse.js +0 -1
- package/node_modules/zod/v4/mini/schemas.cjs +0 -1046
- package/node_modules/zod/v4/mini/schemas.d.cts +0 -427
- package/node_modules/zod/v4/mini/schemas.d.ts +0 -427
- package/node_modules/zod/v4/mini/schemas.js +0 -925
- package/node_modules/zod/v4/package.json +0 -6
- package/node_modules/zod/v4-mini/index.cjs +0 -32
- package/node_modules/zod/v4-mini/index.d.cts +0 -3
- package/node_modules/zod/v4-mini/index.d.ts +0 -3
- package/node_modules/zod/v4-mini/index.js +0 -3
- package/node_modules/zod/v4-mini/package.json +0 -6
- package/plugin/dist/index.d.ts +0 -179
- package/plugin/dist/index.d.ts.map +0 -1
- package/plugin/dist/index.js +0 -3209
- package/plugin/dist/index.js.map +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Artifact Store
|
|
3
|
-
*
|
|
4
|
-
* Durable, addressable storage for full tool result payloads. Schema v9.
|
|
5
|
-
*
|
|
6
|
-
* Why: the wave-guard at ingest time replaces oversized tool result payloads
|
|
7
|
-
* with a small stub for pressure relief. Before this store existed, the full
|
|
8
|
-
* payload was discarded. Now the stub in the transcript carries an
|
|
9
|
-
* `artifactId` pointing at the durable copy here, and hydration is an
|
|
10
|
-
* explicit decision, not an automatic transcript rewrite.
|
|
11
|
-
*
|
|
12
|
-
* Retention is deliberately independent of transcript eviction. Artifacts
|
|
13
|
-
* outlive the messages that referenced them, and GC is a separate concern
|
|
14
|
-
* (Phase 2).
|
|
15
|
-
*
|
|
16
|
-
* See: specs/TOOL_ARTIFACT_STORE.md
|
|
17
|
-
*/
|
|
18
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
19
|
-
export interface ToolArtifactRetentionPolicy {
|
|
20
|
-
/** TTL in ms for non-sensitive artifacts (e.g. 7 * 24 * 60 * 60 * 1000). */
|
|
21
|
-
standardTtlMs: number;
|
|
22
|
-
/** TTL in ms for sensitive artifacts. Should be <= standardTtlMs. */
|
|
23
|
-
sensitiveTtlMs: number;
|
|
24
|
-
/** Optional: max artifacts to keep per (agent_id, session_key). Excess removed oldest-first. */
|
|
25
|
-
maxPerSession?: number;
|
|
26
|
-
}
|
|
27
|
-
export interface ToolArtifactRecord {
|
|
28
|
-
id: string;
|
|
29
|
-
contentHash: string;
|
|
30
|
-
agentId: string;
|
|
31
|
-
sessionKey: string;
|
|
32
|
-
conversationId: number | null;
|
|
33
|
-
messageId: number | null;
|
|
34
|
-
turnId: string | null;
|
|
35
|
-
toolCallId: string | null;
|
|
36
|
-
toolName: string;
|
|
37
|
-
isError: boolean;
|
|
38
|
-
contentType: string;
|
|
39
|
-
sizeBytes: number;
|
|
40
|
-
tokenEstimate: number;
|
|
41
|
-
payload: string;
|
|
42
|
-
summary: string | null;
|
|
43
|
-
createdAt: string;
|
|
44
|
-
lastUsedAt: string;
|
|
45
|
-
refCount: number;
|
|
46
|
-
isSensitive: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface PutToolArtifactInput {
|
|
49
|
-
agentId: string;
|
|
50
|
-
sessionKey: string;
|
|
51
|
-
conversationId?: number;
|
|
52
|
-
messageId?: number;
|
|
53
|
-
turnId?: string;
|
|
54
|
-
toolCallId?: string;
|
|
55
|
-
toolName: string;
|
|
56
|
-
isError?: boolean;
|
|
57
|
-
contentType?: string;
|
|
58
|
-
payload: string;
|
|
59
|
-
summary?: string;
|
|
60
|
-
isSensitive?: boolean;
|
|
61
|
-
}
|
|
62
|
-
export declare class ToolArtifactStore {
|
|
63
|
-
private readonly db;
|
|
64
|
-
constructor(db: DatabaseSync);
|
|
65
|
-
/**
|
|
66
|
-
* Insert a new artifact, or dedupe against an existing one in the same
|
|
67
|
-
* (agentId, sessionKey) scope. Dedupe is scoped to a session so distinct
|
|
68
|
-
* sessions can't leak artifact ids across each other even when payload
|
|
69
|
-
* content is identical.
|
|
70
|
-
*/
|
|
71
|
-
put(input: PutToolArtifactInput): ToolArtifactRecord;
|
|
72
|
-
/** Alias for get(id) — explicit name used by the compositor hydration pass. */
|
|
73
|
-
getById(id: string): ToolArtifactRecord | null;
|
|
74
|
-
get(id: string): ToolArtifactRecord | null;
|
|
75
|
-
getByHash(agentId: string, sessionKey: string, contentHash: string): ToolArtifactRecord | null;
|
|
76
|
-
listByTurn(sessionKey: string, turnId: string): ToolArtifactRecord[];
|
|
77
|
-
listByToolCall(toolCallId: string): ToolArtifactRecord[];
|
|
78
|
-
listRecent(agentId: string, sessionKey: string, limit?: number): ToolArtifactRecord[];
|
|
79
|
-
/** Update last_used_at — call this when hydration actually surfaces the payload. */
|
|
80
|
-
touch(id: string): void;
|
|
81
|
-
/**
|
|
82
|
-
* GC sweep: delete artifacts that exceed their TTL or per-session count cap.
|
|
83
|
-
* Returns total rows deleted.
|
|
84
|
-
*
|
|
85
|
-
* Sensitive artifacts use sensitiveTtlMs (shorter); standard artifacts use
|
|
86
|
-
* standardTtlMs. Optional maxPerSession bounds row count per (agent, session)
|
|
87
|
-
* using a ROW_NUMBER() window query — oldest last_used_at removed first.
|
|
88
|
-
*/
|
|
89
|
-
sweep(policy: ToolArtifactRetentionPolicy): number;
|
|
90
|
-
/**
|
|
91
|
-
* Delete artifacts whose last_used_at is older than the ISO cutoff.
|
|
92
|
-
* Returns the number of rows deleted. Phase 1: manual invocation only.
|
|
93
|
-
*/
|
|
94
|
-
deleteOlderThan(isoCutoff: string): number;
|
|
95
|
-
/** Debug / ops: row count across a session. */
|
|
96
|
-
count(agentId?: string, sessionKey?: string): number;
|
|
97
|
-
}
|
|
98
|
-
//# sourceMappingURL=tool-artifact-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-artifact-store.d.ts","sourceRoot":"","sources":["../src/tool-artifact-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA0BhD,MAAM,WAAW,2BAA2B;IAC1C,4EAA4E;IAC5E,aAAa,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC;IACvB,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA0BD,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,YAAY;IAE7C;;;;;OAKG;IACH,GAAG,CAAC,KAAK,EAAE,oBAAoB,GAAG,kBAAkB;IA+FpD,+EAA+E;IAC/E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI;IAI9C,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI;IAO1C,SAAS,CACP,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,kBAAkB,GAAG,IAAI;IAY5B,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAWpE,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAWxD,UAAU,CACR,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,KAAK,GAAE,MAAW,GACjB,kBAAkB,EAAE;IAYvB,oFAAoF;IACpF,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMvB;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,EAAE,2BAA2B,GAAG,MAAM;IAsClD;;;OAGG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAO1C,+CAA+C;IAC/C,KAAK,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM;CAcrD"}
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool Artifact Store
|
|
3
|
-
*
|
|
4
|
-
* Durable, addressable storage for full tool result payloads. Schema v9.
|
|
5
|
-
*
|
|
6
|
-
* Why: the wave-guard at ingest time replaces oversized tool result payloads
|
|
7
|
-
* with a small stub for pressure relief. Before this store existed, the full
|
|
8
|
-
* payload was discarded. Now the stub in the transcript carries an
|
|
9
|
-
* `artifactId` pointing at the durable copy here, and hydration is an
|
|
10
|
-
* explicit decision, not an automatic transcript rewrite.
|
|
11
|
-
*
|
|
12
|
-
* Retention is deliberately independent of transcript eviction. Artifacts
|
|
13
|
-
* outlive the messages that referenced them, and GC is a separate concern
|
|
14
|
-
* (Phase 2).
|
|
15
|
-
*
|
|
16
|
-
* See: specs/TOOL_ARTIFACT_STORE.md
|
|
17
|
-
*/
|
|
18
|
-
import { createHash, randomBytes } from 'node:crypto';
|
|
19
|
-
/**
|
|
20
|
-
* Simple char/4 heuristic matching src/compositor.ts estimateTokens().
|
|
21
|
-
* Kept local to avoid a cyclic import and keep the store self-contained.
|
|
22
|
-
*/
|
|
23
|
-
function estimateTokens(text) {
|
|
24
|
-
if (!text)
|
|
25
|
-
return 0;
|
|
26
|
-
return Math.ceil(text.length / 4);
|
|
27
|
-
}
|
|
28
|
-
function nowIso() {
|
|
29
|
-
return new Date().toISOString();
|
|
30
|
-
}
|
|
31
|
-
function newArtifactId() {
|
|
32
|
-
// 24-char lowercase id. Deliberately NOT a UUID — shorter, fits the stub
|
|
33
|
-
// length cap in src/degradation.ts (DEGRADATION_LIMITS.artifactId = 64).
|
|
34
|
-
return 'art_' + randomBytes(10).toString('hex');
|
|
35
|
-
}
|
|
36
|
-
function sha256Hex(s) {
|
|
37
|
-
return createHash('sha256').update(s).digest('hex');
|
|
38
|
-
}
|
|
39
|
-
function rowToRecord(row) {
|
|
40
|
-
return {
|
|
41
|
-
id: row.id,
|
|
42
|
-
contentHash: row.content_hash,
|
|
43
|
-
agentId: row.agent_id,
|
|
44
|
-
sessionKey: row.session_key,
|
|
45
|
-
conversationId: row.conversation_id ?? null,
|
|
46
|
-
messageId: row.message_id ?? null,
|
|
47
|
-
turnId: row.turn_id ?? null,
|
|
48
|
-
toolCallId: row.tool_call_id ?? null,
|
|
49
|
-
toolName: row.tool_name,
|
|
50
|
-
isError: row.is_error === 1,
|
|
51
|
-
contentType: row.content_type,
|
|
52
|
-
sizeBytes: row.size_bytes,
|
|
53
|
-
tokenEstimate: row.token_estimate,
|
|
54
|
-
payload: row.payload,
|
|
55
|
-
summary: row.summary ?? null,
|
|
56
|
-
createdAt: row.created_at,
|
|
57
|
-
lastUsedAt: row.last_used_at,
|
|
58
|
-
refCount: row.ref_count,
|
|
59
|
-
isSensitive: row.is_sensitive === 1,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export class ToolArtifactStore {
|
|
63
|
-
db;
|
|
64
|
-
constructor(db) {
|
|
65
|
-
this.db = db;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Insert a new artifact, or dedupe against an existing one in the same
|
|
69
|
-
* (agentId, sessionKey) scope. Dedupe is scoped to a session so distinct
|
|
70
|
-
* sessions can't leak artifact ids across each other even when payload
|
|
71
|
-
* content is identical.
|
|
72
|
-
*/
|
|
73
|
-
put(input) {
|
|
74
|
-
const payload = input.payload ?? '';
|
|
75
|
-
const contentHash = sha256Hex(payload);
|
|
76
|
-
const sizeBytes = Buffer.byteLength(payload, 'utf8');
|
|
77
|
-
const tokenEstimate = estimateTokens(payload);
|
|
78
|
-
const contentType = input.contentType ?? 'text/plain';
|
|
79
|
-
const isError = input.isError ? 1 : 0;
|
|
80
|
-
const isSensitive = input.isSensitive ? 1 : 0;
|
|
81
|
-
// Dedupe within (agentId, sessionKey) — same hash bumps ref_count and
|
|
82
|
-
// updates last_used_at, returning the existing record.
|
|
83
|
-
const existing = this.db
|
|
84
|
-
.prepare(`SELECT * FROM tool_artifacts
|
|
85
|
-
WHERE agent_id = ? AND session_key = ? AND content_hash = ?
|
|
86
|
-
LIMIT 1`)
|
|
87
|
-
.get(input.agentId, input.sessionKey, contentHash);
|
|
88
|
-
if (existing) {
|
|
89
|
-
const ts = nowIso();
|
|
90
|
-
this.db
|
|
91
|
-
.prepare(`UPDATE tool_artifacts
|
|
92
|
-
SET ref_count = ref_count + 1,
|
|
93
|
-
last_used_at = ?
|
|
94
|
-
WHERE id = ?`)
|
|
95
|
-
.run(ts, existing.id);
|
|
96
|
-
return rowToRecord({ ...existing, ref_count: existing.ref_count + 1, last_used_at: ts, is_sensitive: existing.is_sensitive ?? 0 });
|
|
97
|
-
}
|
|
98
|
-
const id = newArtifactId();
|
|
99
|
-
const ts = nowIso();
|
|
100
|
-
this.db
|
|
101
|
-
.prepare(`INSERT INTO tool_artifacts (
|
|
102
|
-
id, content_hash, agent_id, session_key,
|
|
103
|
-
conversation_id, message_id, turn_id, tool_call_id,
|
|
104
|
-
tool_name, is_error, content_type,
|
|
105
|
-
size_bytes, token_estimate, payload, summary,
|
|
106
|
-
created_at, last_used_at, ref_count, is_sensitive
|
|
107
|
-
) VALUES (?, ?, ?, ?,
|
|
108
|
-
?, ?, ?, ?,
|
|
109
|
-
?, ?, ?,
|
|
110
|
-
?, ?, ?, ?,
|
|
111
|
-
?, ?, 1, ?)`)
|
|
112
|
-
.run(id, contentHash, input.agentId, input.sessionKey, input.conversationId ?? null, input.messageId ?? null, input.turnId ?? null, input.toolCallId ?? null, input.toolName, isError, contentType, sizeBytes, tokenEstimate, payload, input.summary ?? null, ts, ts, isSensitive);
|
|
113
|
-
return {
|
|
114
|
-
id,
|
|
115
|
-
contentHash,
|
|
116
|
-
agentId: input.agentId,
|
|
117
|
-
sessionKey: input.sessionKey,
|
|
118
|
-
conversationId: input.conversationId ?? null,
|
|
119
|
-
messageId: input.messageId ?? null,
|
|
120
|
-
turnId: input.turnId ?? null,
|
|
121
|
-
toolCallId: input.toolCallId ?? null,
|
|
122
|
-
toolName: input.toolName,
|
|
123
|
-
isError: input.isError ?? false,
|
|
124
|
-
contentType,
|
|
125
|
-
sizeBytes,
|
|
126
|
-
tokenEstimate,
|
|
127
|
-
payload,
|
|
128
|
-
summary: input.summary ?? null,
|
|
129
|
-
createdAt: ts,
|
|
130
|
-
lastUsedAt: ts,
|
|
131
|
-
refCount: 1,
|
|
132
|
-
isSensitive: input.isSensitive ?? false,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
/** Alias for get(id) — explicit name used by the compositor hydration pass. */
|
|
136
|
-
getById(id) {
|
|
137
|
-
return this.get(id);
|
|
138
|
-
}
|
|
139
|
-
get(id) {
|
|
140
|
-
const row = this.db
|
|
141
|
-
.prepare('SELECT * FROM tool_artifacts WHERE id = ? LIMIT 1')
|
|
142
|
-
.get(id);
|
|
143
|
-
return row ? rowToRecord(row) : null;
|
|
144
|
-
}
|
|
145
|
-
getByHash(agentId, sessionKey, contentHash) {
|
|
146
|
-
const row = this.db
|
|
147
|
-
.prepare(`SELECT * FROM tool_artifacts
|
|
148
|
-
WHERE agent_id = ? AND session_key = ? AND content_hash = ?
|
|
149
|
-
ORDER BY created_at DESC
|
|
150
|
-
LIMIT 1`)
|
|
151
|
-
.get(agentId, sessionKey, contentHash);
|
|
152
|
-
return row ? rowToRecord(row) : null;
|
|
153
|
-
}
|
|
154
|
-
listByTurn(sessionKey, turnId) {
|
|
155
|
-
const rows = this.db
|
|
156
|
-
.prepare(`SELECT * FROM tool_artifacts
|
|
157
|
-
WHERE session_key = ? AND turn_id = ?
|
|
158
|
-
ORDER BY created_at ASC`)
|
|
159
|
-
.all(sessionKey, turnId);
|
|
160
|
-
return rows.map(rowToRecord);
|
|
161
|
-
}
|
|
162
|
-
listByToolCall(toolCallId) {
|
|
163
|
-
const rows = this.db
|
|
164
|
-
.prepare(`SELECT * FROM tool_artifacts
|
|
165
|
-
WHERE tool_call_id = ?
|
|
166
|
-
ORDER BY created_at ASC`)
|
|
167
|
-
.all(toolCallId);
|
|
168
|
-
return rows.map(rowToRecord);
|
|
169
|
-
}
|
|
170
|
-
listRecent(agentId, sessionKey, limit = 20) {
|
|
171
|
-
const rows = this.db
|
|
172
|
-
.prepare(`SELECT * FROM tool_artifacts
|
|
173
|
-
WHERE agent_id = ? AND session_key = ?
|
|
174
|
-
ORDER BY created_at DESC
|
|
175
|
-
LIMIT ?`)
|
|
176
|
-
.all(agentId, sessionKey, limit);
|
|
177
|
-
return rows.map(rowToRecord);
|
|
178
|
-
}
|
|
179
|
-
/** Update last_used_at — call this when hydration actually surfaces the payload. */
|
|
180
|
-
touch(id) {
|
|
181
|
-
this.db
|
|
182
|
-
.prepare('UPDATE tool_artifacts SET last_used_at = ? WHERE id = ?')
|
|
183
|
-
.run(nowIso(), id);
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* GC sweep: delete artifacts that exceed their TTL or per-session count cap.
|
|
187
|
-
* Returns total rows deleted.
|
|
188
|
-
*
|
|
189
|
-
* Sensitive artifacts use sensitiveTtlMs (shorter); standard artifacts use
|
|
190
|
-
* standardTtlMs. Optional maxPerSession bounds row count per (agent, session)
|
|
191
|
-
* using a ROW_NUMBER() window query — oldest last_used_at removed first.
|
|
192
|
-
*/
|
|
193
|
-
sweep(policy) {
|
|
194
|
-
const now = Date.now();
|
|
195
|
-
const standardCutoff = new Date(now - policy.standardTtlMs).toISOString();
|
|
196
|
-
const sensitiveCutoff = new Date(now - policy.sensitiveTtlMs).toISOString();
|
|
197
|
-
const ttlResult = this.db
|
|
198
|
-
.prepare(`DELETE FROM tool_artifacts
|
|
199
|
-
WHERE (is_sensitive = 0 AND last_used_at < ?)
|
|
200
|
-
OR (is_sensitive = 1 AND last_used_at < ?)`)
|
|
201
|
-
.run(standardCutoff, sensitiveCutoff);
|
|
202
|
-
let deleted = ttlResult.changes ?? 0;
|
|
203
|
-
if (policy.maxPerSession != null) {
|
|
204
|
-
const boundResult = this.db
|
|
205
|
-
.prepare(`DELETE FROM tool_artifacts
|
|
206
|
-
WHERE id IN (
|
|
207
|
-
SELECT id FROM (
|
|
208
|
-
SELECT id,
|
|
209
|
-
ROW_NUMBER() OVER (
|
|
210
|
-
PARTITION BY agent_id, session_key
|
|
211
|
-
ORDER BY last_used_at DESC
|
|
212
|
-
) AS rn
|
|
213
|
-
FROM tool_artifacts
|
|
214
|
-
)
|
|
215
|
-
WHERE rn > ?
|
|
216
|
-
)`)
|
|
217
|
-
.run(policy.maxPerSession);
|
|
218
|
-
deleted += boundResult.changes ?? 0;
|
|
219
|
-
}
|
|
220
|
-
return deleted;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Delete artifacts whose last_used_at is older than the ISO cutoff.
|
|
224
|
-
* Returns the number of rows deleted. Phase 1: manual invocation only.
|
|
225
|
-
*/
|
|
226
|
-
deleteOlderThan(isoCutoff) {
|
|
227
|
-
const result = this.db
|
|
228
|
-
.prepare('DELETE FROM tool_artifacts WHERE last_used_at < ?')
|
|
229
|
-
.run(isoCutoff);
|
|
230
|
-
return Number(result.changes ?? 0);
|
|
231
|
-
}
|
|
232
|
-
/** Debug / ops: row count across a session. */
|
|
233
|
-
count(agentId, sessionKey) {
|
|
234
|
-
if (agentId && sessionKey) {
|
|
235
|
-
const row = this.db
|
|
236
|
-
.prepare('SELECT COUNT(*) AS n FROM tool_artifacts WHERE agent_id = ? AND session_key = ?')
|
|
237
|
-
.get(agentId, sessionKey);
|
|
238
|
-
return row?.n ?? 0;
|
|
239
|
-
}
|
|
240
|
-
const row = this.db.prepare('SELECT COUNT(*) AS n FROM tool_artifacts').get();
|
|
241
|
-
return row?.n ?? 0;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
//# sourceMappingURL=tool-artifact-store.js.map
|
package/dist/topic-detector.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Topic Detector (P3.1)
|
|
3
|
-
*
|
|
4
|
-
* Heuristic-based topic shift detection. No model calls.
|
|
5
|
-
* Uses explicit markers, entity shift, conversation gap, and continuation signals.
|
|
6
|
-
*/
|
|
7
|
-
import type { NeutralMessage } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Strip inbound protocol metadata from message text before topic detection.
|
|
10
|
-
*
|
|
11
|
-
* Removes:
|
|
12
|
-
* - "Sender (untrusted metadata):" header blocks through next blank line
|
|
13
|
-
* - Pure timestamp lines: ISO 8601, bracket format, System YYYY-MM-DD
|
|
14
|
-
* - JSON code blocks containing "\"schema\": \"openclaw" or "inbound_meta"
|
|
15
|
-
* - Any ```json...``` block whose content contains those markers
|
|
16
|
-
*
|
|
17
|
-
* Called as the FIRST step in detectTopicShift() so that pattern matching
|
|
18
|
-
* operates on clean user content, not on injected transport headers.
|
|
19
|
-
*/
|
|
20
|
-
export declare function stripMessageMetadata(text: string): string;
|
|
21
|
-
export interface TopicSignal {
|
|
22
|
-
topicId: string | null;
|
|
23
|
-
isNewTopic: boolean;
|
|
24
|
-
confidence: number;
|
|
25
|
-
topicName: string | null;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Detect whether the incoming message starts a new conversation topic.
|
|
29
|
-
*
|
|
30
|
-
* @param incomingMessage The new user message to evaluate
|
|
31
|
-
* @param recentMessages Last N messages for context (any role)
|
|
32
|
-
* @param currentTopicId The active topic id, or null if none
|
|
33
|
-
*/
|
|
34
|
-
export declare function detectTopicShift(incomingMessage: NeutralMessage, recentMessages: NeutralMessage[], currentTopicId: string | null): TopicSignal;
|
|
35
|
-
//# sourceMappingURL=topic-detector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"topic-detector.d.ts","sourceRoot":"","sources":["../src/topic-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA6EzD;AAID,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AA6GD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,eAAe,EAAE,cAAc,EAC/B,cAAc,EAAE,cAAc,EAAE,EAChC,cAAc,EAAE,MAAM,GAAG,IAAI,GAC5B,WAAW,CAkEb"}
|
package/dist/topic-detector.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Topic Detector (P3.1)
|
|
3
|
-
*
|
|
4
|
-
* Heuristic-based topic shift detection. No model calls.
|
|
5
|
-
* Uses explicit markers, entity shift, conversation gap, and continuation signals.
|
|
6
|
-
*/
|
|
7
|
-
// ─── Metadata Stripping ───────────────────────────────────────────────────────
|
|
8
|
-
/**
|
|
9
|
-
* Strip inbound protocol metadata from message text before topic detection.
|
|
10
|
-
*
|
|
11
|
-
* Removes:
|
|
12
|
-
* - "Sender (untrusted metadata):" header blocks through next blank line
|
|
13
|
-
* - Pure timestamp lines: ISO 8601, bracket format, System YYYY-MM-DD
|
|
14
|
-
* - JSON code blocks containing "\"schema\": \"openclaw" or "inbound_meta"
|
|
15
|
-
* - Any ```json...``` block whose content contains those markers
|
|
16
|
-
*
|
|
17
|
-
* Called as the FIRST step in detectTopicShift() so that pattern matching
|
|
18
|
-
* operates on clean user content, not on injected transport headers.
|
|
19
|
-
*/
|
|
20
|
-
export function stripMessageMetadata(text) {
|
|
21
|
-
if (!text)
|
|
22
|
-
return text;
|
|
23
|
-
const lines = text.split('\n');
|
|
24
|
-
const result = [];
|
|
25
|
-
let i = 0;
|
|
26
|
-
while (i < lines.length) {
|
|
27
|
-
const line = lines[i];
|
|
28
|
-
// ── ```json blocks containing openclaw markers ──────────────────────────
|
|
29
|
-
if (/^```json\s*$/i.test(line)) {
|
|
30
|
-
// Peek ahead to collect the block
|
|
31
|
-
const blockLines = [line];
|
|
32
|
-
let j = i + 1;
|
|
33
|
-
let closed = false;
|
|
34
|
-
while (j < lines.length) {
|
|
35
|
-
blockLines.push(lines[j]);
|
|
36
|
-
if (lines[j].trim() === '```') {
|
|
37
|
-
closed = true;
|
|
38
|
-
j++;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
j++;
|
|
42
|
-
}
|
|
43
|
-
const blockContent = blockLines.join('\n');
|
|
44
|
-
if (blockContent.includes('"schema": "openclaw') ||
|
|
45
|
-
blockContent.includes('inbound_meta')) {
|
|
46
|
-
// Skip the whole block
|
|
47
|
-
i = j;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
// Not an openclaw block — keep as-is
|
|
51
|
-
result.push(...blockLines.slice(0, closed ? blockLines.length : blockLines.length));
|
|
52
|
-
i = j;
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
// ── Sender (untrusted metadata): block ──────────────────────────────────
|
|
56
|
-
if (/^Sender \(untrusted metadata\):/i.test(line)) {
|
|
57
|
-
// Skip through next blank line or closing ```
|
|
58
|
-
i++;
|
|
59
|
-
while (i < lines.length) {
|
|
60
|
-
const l = lines[i];
|
|
61
|
-
if (l.trim() === '' || l.trim() === '```') {
|
|
62
|
-
i++; // consume the blank/closing line too
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
i++;
|
|
66
|
-
}
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
// ── Pure timestamp lines ─────────────────────────────────────────────────
|
|
70
|
-
// ISO 8601: 2026-04-05T02:43:00Z / 2026-04-05T02:43:00.000Z
|
|
71
|
-
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:?\d{2})?$/.test(line.trim())) {
|
|
72
|
-
i++;
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
// Bracket format: [Mon 2026-04-05 02:43 MST]
|
|
76
|
-
if (/^\[\w{3}\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}\s+\w+\]$/.test(line.trim())) {
|
|
77
|
-
i++;
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
// System YYYY-MM-DD
|
|
81
|
-
if (/^System\s+\d{4}-\d{2}-\d{2}$/.test(line.trim())) {
|
|
82
|
-
i++;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
result.push(line);
|
|
86
|
-
i++;
|
|
87
|
-
}
|
|
88
|
-
return result.join('\n').trim();
|
|
89
|
-
}
|
|
90
|
-
// ─── Constants ────────────────────────────────────────────────────────────────
|
|
91
|
-
const GAP_MS = 30 * 60 * 1000; // 30 minutes
|
|
92
|
-
// Explicit topic-shift markers
|
|
93
|
-
const SHIFT_PATTERNS = [
|
|
94
|
-
/^(?:let'?s?|can we)\s+(?:talk|discuss|chat)\s+about\s+(.+)/i,
|
|
95
|
-
/^switching\s+to\s+(.+)/i,
|
|
96
|
-
/^new\s+topic\s*[:—-]\s*(.+)/i,
|
|
97
|
-
/^regarding\s+(.+)/i,
|
|
98
|
-
/^on\s+(?:the\s+)?(?:topic\s+of\s+)?(.+)/i,
|
|
99
|
-
/^(?:i\s+want\s+to\s+)?(?:talk|ask)\s+about\s+(.+)/i,
|
|
100
|
-
/^(?:change\s+of\s+)?subject\s*[:—-]\s*(.+)/i,
|
|
101
|
-
];
|
|
102
|
-
// Continuation markers — if any match, this is almost certainly same topic
|
|
103
|
-
const CONTINUATION_PATTERNS = [
|
|
104
|
-
/^\s*(?:also|and|additionally|furthermore|moreover|plus)\b/i,
|
|
105
|
-
/^\s*(?:what\s+about|how\s+about)\s+/i,
|
|
106
|
-
/^\s*(?:following\s+up|follow[- ]up|just\s+to\s+follow\s+up)\b/i,
|
|
107
|
-
/^\s*(?:actually|wait|oh)\s*[,—-]/i,
|
|
108
|
-
/^\s*(?:one\s+more\s+thing|another\s+thing|by\s+the\s+way)\b/i,
|
|
109
|
-
];
|
|
110
|
-
// Stop words for noun-phrase extraction
|
|
111
|
-
const STOP_WORDS = new Set([
|
|
112
|
-
'a', 'an', 'the', 'this', 'that', 'these', 'those', 'i', 'you', 'we', 'they',
|
|
113
|
-
'it', 'he', 'she', 'is', 'are', 'was', 'were', 'be', 'been', 'being',
|
|
114
|
-
'have', 'has', 'had', 'do', 'does', 'did', 'will', 'would', 'could', 'should',
|
|
115
|
-
'may', 'might', 'shall', 'can', 'to', 'of', 'in', 'on', 'at', 'for', 'with',
|
|
116
|
-
'by', 'from', 'up', 'about', 'into', 'through', 'and', 'or', 'but', 'not',
|
|
117
|
-
'so', 'yet', 'both', 'either', 'neither', 'nor', 'as', 'just', 'than',
|
|
118
|
-
'then', 'because', 'while', 'although', 'if', 'when', 'where', 'how', 'what',
|
|
119
|
-
'which', 'who', 'whom', 'whose',
|
|
120
|
-
]);
|
|
121
|
-
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
122
|
-
/**
|
|
123
|
-
* Extract a short heuristic topic name from message text (max 40 chars).
|
|
124
|
-
* Returns the first meaningful noun phrase or the first substantive clause.
|
|
125
|
-
*/
|
|
126
|
-
function extractTopicName(text) {
|
|
127
|
-
// First, check if any shift pattern captured a phrase
|
|
128
|
-
for (const pattern of SHIFT_PATTERNS) {
|
|
129
|
-
const m = text.match(pattern);
|
|
130
|
-
if (m?.[1]) {
|
|
131
|
-
const phrase = m[1].replace(/[?!.]+$/, '').trim();
|
|
132
|
-
return phrase.slice(0, 40);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Fall back: split into words, skip stop words, take first 5 content words
|
|
136
|
-
const words = text
|
|
137
|
-
.replace(/[^\w\s'-]/g, ' ')
|
|
138
|
-
.split(/\s+/)
|
|
139
|
-
.filter(w => w.length > 1 && !STOP_WORDS.has(w.toLowerCase()));
|
|
140
|
-
if (words.length === 0) {
|
|
141
|
-
// Last resort: first 40 chars
|
|
142
|
-
return text.slice(0, 40).trim();
|
|
143
|
-
}
|
|
144
|
-
return words.slice(0, 5).join(' ').slice(0, 40);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Naive named-entity heuristic: extract capitalized words (length ≥ 3) and
|
|
148
|
-
* quoted strings as "entities". Returns a Set<string> (lowercased).
|
|
149
|
-
*/
|
|
150
|
-
function extractEntities(text) {
|
|
151
|
-
const entities = new Set();
|
|
152
|
-
// Quoted strings
|
|
153
|
-
const quoted = text.match(/["']([^"']{2,30})["']/g);
|
|
154
|
-
if (quoted) {
|
|
155
|
-
for (const q of quoted)
|
|
156
|
-
entities.add(q.replace(/["']/g, '').toLowerCase());
|
|
157
|
-
}
|
|
158
|
-
// Capitalized words (simple NER proxy — excludes sentence-start)
|
|
159
|
-
const words = text.split(/\s+/);
|
|
160
|
-
for (let i = 1; i < words.length; i++) {
|
|
161
|
-
const w = words[i].replace(/[^a-zA-Z-]/g, '');
|
|
162
|
-
if (w.length >= 3 && /^[A-Z]/.test(w)) {
|
|
163
|
-
entities.add(w.toLowerCase());
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return entities;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Jaccard similarity between two entity sets (0 = no overlap, 1 = identical).
|
|
170
|
-
*/
|
|
171
|
-
function jaccardSimilarity(a, b) {
|
|
172
|
-
if (a.size === 0 && b.size === 0)
|
|
173
|
-
return 1;
|
|
174
|
-
if (a.size === 0 || b.size === 0)
|
|
175
|
-
return 0;
|
|
176
|
-
let intersect = 0;
|
|
177
|
-
for (const x of a) {
|
|
178
|
-
if (b.has(x))
|
|
179
|
-
intersect++;
|
|
180
|
-
}
|
|
181
|
-
const union = a.size + b.size - intersect;
|
|
182
|
-
return intersect / union;
|
|
183
|
-
}
|
|
184
|
-
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
185
|
-
/**
|
|
186
|
-
* Detect whether the incoming message starts a new conversation topic.
|
|
187
|
-
*
|
|
188
|
-
* @param incomingMessage The new user message to evaluate
|
|
189
|
-
* @param recentMessages Last N messages for context (any role)
|
|
190
|
-
* @param currentTopicId The active topic id, or null if none
|
|
191
|
-
*/
|
|
192
|
-
export function detectTopicShift(incomingMessage, recentMessages, currentTopicId) {
|
|
193
|
-
// Strip inbound protocol metadata FIRST — pattern matching must operate on
|
|
194
|
-
// clean user content, not on transport headers (timestamps, sender blocks, etc.)
|
|
195
|
-
const text = stripMessageMetadata(incomingMessage.textContent ?? '');
|
|
196
|
-
// Guard: if the message is entirely metadata with no real content, never
|
|
197
|
-
// create a new topic — there is nothing to name or classify.
|
|
198
|
-
if (!text) {
|
|
199
|
-
return { topicId: currentTopicId, isNewTopic: false, confidence: 0.9, topicName: null };
|
|
200
|
-
}
|
|
201
|
-
// ── 1. Continuation check (highest priority) ──────────────────────────────
|
|
202
|
-
for (const pat of CONTINUATION_PATTERNS) {
|
|
203
|
-
if (pat.test(text)) {
|
|
204
|
-
return { topicId: currentTopicId, isNewTopic: false, confidence: 0.85, topicName: null };
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
// ── 2. Explicit shift marker ───────────────────────────────────────────────
|
|
208
|
-
for (const pat of SHIFT_PATTERNS) {
|
|
209
|
-
if (pat.test(text)) {
|
|
210
|
-
const name = extractTopicName(text);
|
|
211
|
-
return { topicId: null, isNewTopic: true, confidence: 0.95, topicName: name };
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
// ── 3. Conversation gap (empty history or >30 min since last message) ──────
|
|
215
|
-
if (recentMessages.length === 0) {
|
|
216
|
-
const name = extractTopicName(text);
|
|
217
|
-
return { topicId: null, isNewTopic: true, confidence: 0.8, topicName: name };
|
|
218
|
-
}
|
|
219
|
-
// Find last message with a timestamp in metadata
|
|
220
|
-
const lastMsg = recentMessages[recentMessages.length - 1];
|
|
221
|
-
const lastTs = lastMsg.metadata?.createdAt
|
|
222
|
-
? new Date(lastMsg.metadata.createdAt).getTime()
|
|
223
|
-
: null;
|
|
224
|
-
if (lastTs !== null && !isNaN(lastTs)) {
|
|
225
|
-
const now = Date.now();
|
|
226
|
-
if (now - lastTs > GAP_MS) {
|
|
227
|
-
const name = extractTopicName(text);
|
|
228
|
-
return { topicId: null, isNewTopic: true, confidence: 0.75, topicName: name };
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
// ── 4. Entity shift (compare incoming to last 3 messages) ─────────────────
|
|
232
|
-
const incomingEntities = extractEntities(text);
|
|
233
|
-
const contextWindow = recentMessages.slice(-3);
|
|
234
|
-
const contextText = contextWindow
|
|
235
|
-
.map(m => m.textContent ?? '')
|
|
236
|
-
.join(' ');
|
|
237
|
-
if (incomingEntities.size >= 2 && contextText.length > 0) {
|
|
238
|
-
const contextEntities = extractEntities(contextText);
|
|
239
|
-
const similarity = jaccardSimilarity(incomingEntities, contextEntities);
|
|
240
|
-
// Low similarity + no continuation marker → likely a new topic
|
|
241
|
-
if (similarity < 0.15) {
|
|
242
|
-
const name = extractTopicName(text);
|
|
243
|
-
return { topicId: null, isNewTopic: true, confidence: 0.6, topicName: name };
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
// ── 5. Default: continue current topic ────────────────────────────────────
|
|
247
|
-
return { topicId: currentTopicId, isNewTopic: false, confidence: 0.7, topicName: null };
|
|
248
|
-
}
|
|
249
|
-
//# sourceMappingURL=topic-detector.js.map
|