@mastra/server 1.15.0-alpha.3 → 1.15.0-alpha.4
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/CHANGELOG.md +7 -0
- package/dist/{chunk-IPQTQESA.cjs → chunk-26DWGZNJ.cjs} +434 -13
- package/dist/chunk-26DWGZNJ.cjs.map +1 -0
- package/dist/{chunk-OV64H74M.js → chunk-DVOXGNVI.js} +433 -12
- package/dist/chunk-DVOXGNVI.js.map +1 -0
- package/dist/{chunk-KH7BZQVQ.cjs → chunk-MJTEQGJT.cjs} +327 -25
- package/dist/chunk-MJTEQGJT.cjs.map +1 -0
- package/dist/{chunk-HPJ2CRVK.js → chunk-OVXPDSMT.js} +315 -27
- package/dist/chunk-OVXPDSMT.js.map +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/observational-memory-3XFCO6MX-WHVD3JTT.js +3 -0
- package/dist/{observational-memory-5NFPG6M3-MG2OMRFW.js.map → observational-memory-3XFCO6MX-WHVD3JTT.js.map} +1 -1
- package/dist/observational-memory-3XFCO6MX-WVUSRO35.cjs +108 -0
- package/dist/{observational-memory-5NFPG6M3-L7EU4ABW.cjs.map → observational-memory-3XFCO6MX-WVUSRO35.cjs.map} +1 -1
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers.cjs +2 -2
- package/dist/server/handlers.js +1 -1
- package/dist/server/server-adapter/index.cjs +16 -16
- package/dist/server/server-adapter/index.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-HPJ2CRVK.js.map +0 -1
- package/dist/chunk-IPQTQESA.cjs.map +0 -1
- package/dist/chunk-KH7BZQVQ.cjs.map +0 -1
- package/dist/chunk-OV64H74M.js.map +0 -1
- package/dist/observational-memory-5NFPG6M3-L7EU4ABW.cjs +0 -68
- package/dist/observational-memory-5NFPG6M3-MG2OMRFW.js +0 -3
|
@@ -5,10 +5,10 @@ import { coreFeatures } from '@mastra/core/features';
|
|
|
5
5
|
import { resolveModelConfig } from '@mastra/core/llm';
|
|
6
6
|
import { setThreadOMMetadata, getThreadOMMetadata, parseMemoryRequestContext } from '@mastra/core/memory';
|
|
7
7
|
import { MessageHistory } from '@mastra/core/processors';
|
|
8
|
-
import { createHash, randomUUID } from 'crypto';
|
|
8
|
+
import { randomBytes, createHash, randomUUID } from 'crypto';
|
|
9
9
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
10
10
|
|
|
11
|
-
// ../memory/dist/chunk-
|
|
11
|
+
// ../memory/dist/chunk-JJBSFPC5.js
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/xxhash-wasm@1.1.0/node_modules/xxhash-wasm/esm/xxhash-wasm.js
|
|
14
14
|
var t = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 48, 8, 96, 3, 127, 127, 127, 1, 127, 96, 3, 127, 127, 127, 0, 96, 2, 127, 127, 0, 96, 1, 127, 1, 127, 96, 3, 127, 127, 126, 1, 126, 96, 3, 126, 127, 127, 1, 126, 96, 2, 127, 126, 0, 96, 1, 127, 1, 126, 3, 11, 10, 0, 0, 2, 1, 3, 4, 5, 6, 1, 7, 5, 3, 1, 0, 1, 7, 85, 9, 3, 109, 101, 109, 2, 0, 5, 120, 120, 104, 51, 50, 0, 0, 6, 105, 110, 105, 116, 51, 50, 0, 2, 8, 117, 112, 100, 97, 116, 101, 51, 50, 0, 3, 8, 100, 105, 103, 101, 115, 116, 51, 50, 0, 4, 5, 120, 120, 104, 54, 52, 0, 5, 6, 105, 110, 105, 116, 54, 52, 0, 7, 8, 117, 112, 100, 97, 116, 101, 54, 52, 0, 8, 8, 100, 105, 103, 101, 115, 116, 54, 52, 0, 9, 10, 251, 22, 10, 242, 1, 1, 4, 127, 32, 0, 32, 1, 106, 33, 3, 32, 1, 65, 16, 79, 4, 127, 32, 3, 65, 16, 107, 33, 6, 32, 2, 65, 168, 136, 141, 161, 2, 106, 33, 3, 32, 2, 65, 137, 235, 208, 208, 7, 107, 33, 4, 32, 2, 65, 207, 140, 162, 142, 6, 106, 33, 5, 3, 64, 32, 3, 32, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 3, 32, 4, 32, 0, 65, 4, 106, 34, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 4, 32, 2, 32, 0, 65, 4, 106, 34, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 2, 32, 5, 32, 0, 65, 4, 106, 34, 0, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 5, 32, 6, 32, 0, 65, 4, 106, 34, 0, 79, 13, 0, 11, 32, 2, 65, 12, 119, 32, 5, 65, 18, 119, 106, 32, 4, 65, 7, 119, 106, 32, 3, 65, 1, 119, 106, 5, 32, 2, 65, 177, 207, 217, 178, 1, 106, 11, 32, 1, 106, 32, 0, 32, 1, 65, 15, 113, 16, 1, 11, 146, 1, 0, 32, 1, 32, 2, 106, 33, 2, 3, 64, 32, 1, 65, 4, 106, 32, 2, 75, 69, 4, 64, 32, 0, 32, 1, 40, 2, 0, 65, 189, 220, 202, 149, 124, 108, 106, 65, 17, 119, 65, 175, 214, 211, 190, 2, 108, 33, 0, 32, 1, 65, 4, 106, 33, 1, 12, 1, 11, 11, 3, 64, 32, 1, 32, 2, 79, 69, 4, 64, 32, 0, 32, 1, 45, 0, 0, 65, 177, 207, 217, 178, 1, 108, 106, 65, 11, 119, 65, 177, 243, 221, 241, 121, 108, 33, 0, 32, 1, 65, 1, 106, 33, 1, 12, 1, 11, 11, 32, 0, 32, 0, 65, 15, 118, 115, 65, 247, 148, 175, 175, 120, 108, 34, 0, 65, 13, 118, 32, 0, 115, 65, 189, 220, 202, 149, 124, 108, 34, 0, 65, 16, 118, 32, 0, 115, 11, 63, 0, 32, 0, 65, 8, 106, 32, 1, 65, 168, 136, 141, 161, 2, 106, 54, 2, 0, 32, 0, 65, 12, 106, 32, 1, 65, 137, 235, 208, 208, 7, 107, 54, 2, 0, 32, 0, 65, 16, 106, 32, 1, 54, 2, 0, 32, 0, 65, 20, 106, 32, 1, 65, 207, 140, 162, 142, 6, 106, 54, 2, 0, 11, 195, 4, 1, 6, 127, 32, 1, 32, 2, 106, 33, 6, 32, 0, 65, 24, 106, 33, 4, 32, 0, 65, 40, 106, 40, 2, 0, 33, 3, 32, 0, 32, 0, 40, 2, 0, 32, 2, 106, 54, 2, 0, 32, 0, 65, 4, 106, 34, 5, 32, 5, 40, 2, 0, 32, 2, 65, 16, 79, 32, 0, 40, 2, 0, 65, 16, 79, 114, 114, 54, 2, 0, 32, 2, 32, 3, 106, 65, 16, 73, 4, 64, 32, 3, 32, 4, 106, 32, 1, 32, 2, 252, 10, 0, 0, 32, 0, 65, 40, 106, 32, 2, 32, 3, 106, 54, 2, 0, 15, 11, 32, 3, 4, 64, 32, 3, 32, 4, 106, 32, 1, 65, 16, 32, 3, 107, 34, 2, 252, 10, 0, 0, 32, 0, 65, 8, 106, 34, 3, 32, 3, 40, 2, 0, 32, 4, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 54, 2, 0, 32, 0, 65, 12, 106, 34, 3, 32, 3, 40, 2, 0, 32, 4, 65, 4, 106, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 54, 2, 0, 32, 0, 65, 16, 106, 34, 3, 32, 3, 40, 2, 0, 32, 4, 65, 8, 106, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 54, 2, 0, 32, 0, 65, 20, 106, 34, 3, 32, 3, 40, 2, 0, 32, 4, 65, 12, 106, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 54, 2, 0, 32, 0, 65, 40, 106, 65, 0, 54, 2, 0, 32, 1, 32, 2, 106, 33, 1, 11, 32, 1, 32, 6, 65, 16, 107, 77, 4, 64, 32, 6, 65, 16, 107, 33, 8, 32, 0, 65, 8, 106, 40, 2, 0, 33, 2, 32, 0, 65, 12, 106, 40, 2, 0, 33, 3, 32, 0, 65, 16, 106, 40, 2, 0, 33, 5, 32, 0, 65, 20, 106, 40, 2, 0, 33, 7, 3, 64, 32, 2, 32, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 2, 32, 3, 32, 1, 65, 4, 106, 34, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 3, 32, 5, 32, 1, 65, 4, 106, 34, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 5, 32, 7, 32, 1, 65, 4, 106, 34, 1, 40, 2, 0, 65, 247, 148, 175, 175, 120, 108, 106, 65, 13, 119, 65, 177, 243, 221, 241, 121, 108, 33, 7, 32, 8, 32, 1, 65, 4, 106, 34, 1, 79, 13, 0, 11, 32, 0, 65, 8, 106, 32, 2, 54, 2, 0, 32, 0, 65, 12, 106, 32, 3, 54, 2, 0, 32, 0, 65, 16, 106, 32, 5, 54, 2, 0, 32, 0, 65, 20, 106, 32, 7, 54, 2, 0, 11, 32, 1, 32, 6, 73, 4, 64, 32, 4, 32, 1, 32, 6, 32, 1, 107, 34, 1, 252, 10, 0, 0, 32, 0, 65, 40, 106, 32, 1, 54, 2, 0, 11, 11, 97, 1, 1, 127, 32, 0, 65, 16, 106, 40, 2, 0, 33, 1, 32, 0, 65, 4, 106, 40, 2, 0, 4, 127, 32, 1, 65, 12, 119, 32, 0, 65, 20, 106, 40, 2, 0, 65, 18, 119, 106, 32, 0, 65, 12, 106, 40, 2, 0, 65, 7, 119, 106, 32, 0, 65, 8, 106, 40, 2, 0, 65, 1, 119, 106, 5, 32, 1, 65, 177, 207, 217, 178, 1, 106, 11, 32, 0, 40, 2, 0, 106, 32, 0, 65, 24, 106, 32, 0, 65, 40, 106, 40, 2, 0, 16, 1, 11, 255, 3, 2, 3, 126, 1, 127, 32, 0, 32, 1, 106, 33, 6, 32, 1, 65, 32, 79, 4, 126, 32, 6, 65, 32, 107, 33, 6, 32, 2, 66, 214, 235, 130, 238, 234, 253, 137, 245, 224, 0, 124, 33, 3, 32, 2, 66, 177, 169, 172, 193, 173, 184, 212, 166, 61, 125, 33, 4, 32, 2, 66, 249, 234, 208, 208, 231, 201, 161, 228, 225, 0, 124, 33, 5, 3, 64, 32, 3, 32, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 3, 32, 4, 32, 0, 65, 8, 106, 34, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 4, 32, 2, 32, 0, 65, 8, 106, 34, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 2, 32, 5, 32, 0, 65, 8, 106, 34, 0, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 5, 32, 6, 32, 0, 65, 8, 106, 34, 0, 79, 13, 0, 11, 32, 2, 66, 12, 137, 32, 5, 66, 18, 137, 124, 32, 4, 66, 7, 137, 124, 32, 3, 66, 1, 137, 124, 32, 3, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 32, 4, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 32, 2, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 32, 5, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 5, 32, 2, 66, 197, 207, 217, 178, 241, 229, 186, 234, 39, 124, 11, 32, 1, 173, 124, 32, 0, 32, 1, 65, 31, 113, 16, 6, 11, 134, 2, 0, 32, 1, 32, 2, 106, 33, 2, 3, 64, 32, 2, 32, 1, 65, 8, 106, 79, 4, 64, 32, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 32, 0, 133, 66, 27, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 33, 0, 32, 1, 65, 8, 106, 33, 1, 12, 1, 11, 11, 32, 1, 65, 4, 106, 32, 2, 77, 4, 64, 32, 0, 32, 1, 53, 2, 0, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 23, 137, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 249, 243, 221, 241, 153, 246, 153, 171, 22, 124, 33, 0, 32, 1, 65, 4, 106, 33, 1, 11, 3, 64, 32, 1, 32, 2, 73, 4, 64, 32, 0, 32, 1, 49, 0, 0, 66, 197, 207, 217, 178, 241, 229, 186, 234, 39, 126, 133, 66, 11, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 0, 32, 1, 65, 1, 106, 33, 1, 12, 1, 11, 11, 32, 0, 32, 0, 66, 33, 136, 133, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 34, 0, 32, 0, 66, 29, 136, 133, 66, 249, 243, 221, 241, 153, 246, 153, 171, 22, 126, 34, 0, 32, 0, 66, 32, 136, 133, 11, 77, 0, 32, 0, 65, 8, 106, 32, 1, 66, 214, 235, 130, 238, 234, 253, 137, 245, 224, 0, 124, 55, 3, 0, 32, 0, 65, 16, 106, 32, 1, 66, 177, 169, 172, 193, 173, 184, 212, 166, 61, 125, 55, 3, 0, 32, 0, 65, 24, 106, 32, 1, 55, 3, 0, 32, 0, 65, 32, 106, 32, 1, 66, 249, 234, 208, 208, 231, 201, 161, 228, 225, 0, 124, 55, 3, 0, 11, 244, 4, 2, 3, 127, 4, 126, 32, 1, 32, 2, 106, 33, 5, 32, 0, 65, 40, 106, 33, 4, 32, 0, 65, 200, 0, 106, 40, 2, 0, 33, 3, 32, 0, 32, 0, 41, 3, 0, 32, 2, 173, 124, 55, 3, 0, 32, 2, 32, 3, 106, 65, 32, 73, 4, 64, 32, 3, 32, 4, 106, 32, 1, 32, 2, 252, 10, 0, 0, 32, 0, 65, 200, 0, 106, 32, 2, 32, 3, 106, 54, 2, 0, 15, 11, 32, 3, 4, 64, 32, 3, 32, 4, 106, 32, 1, 65, 32, 32, 3, 107, 34, 2, 252, 10, 0, 0, 32, 0, 65, 8, 106, 34, 3, 32, 3, 41, 3, 0, 32, 4, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 55, 3, 0, 32, 0, 65, 16, 106, 34, 3, 32, 3, 41, 3, 0, 32, 4, 65, 8, 106, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 55, 3, 0, 32, 0, 65, 24, 106, 34, 3, 32, 3, 41, 3, 0, 32, 4, 65, 16, 106, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 55, 3, 0, 32, 0, 65, 32, 106, 34, 3, 32, 3, 41, 3, 0, 32, 4, 65, 24, 106, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 55, 3, 0, 32, 0, 65, 200, 0, 106, 65, 0, 54, 2, 0, 32, 1, 32, 2, 106, 33, 1, 11, 32, 1, 65, 32, 106, 32, 5, 77, 4, 64, 32, 5, 65, 32, 107, 33, 2, 32, 0, 65, 8, 106, 41, 3, 0, 33, 6, 32, 0, 65, 16, 106, 41, 3, 0, 33, 7, 32, 0, 65, 24, 106, 41, 3, 0, 33, 8, 32, 0, 65, 32, 106, 41, 3, 0, 33, 9, 3, 64, 32, 6, 32, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 6, 32, 7, 32, 1, 65, 8, 106, 34, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 7, 32, 8, 32, 1, 65, 8, 106, 34, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 8, 32, 9, 32, 1, 65, 8, 106, 34, 1, 41, 3, 0, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 124, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 33, 9, 32, 2, 32, 1, 65, 8, 106, 34, 1, 79, 13, 0, 11, 32, 0, 65, 8, 106, 32, 6, 55, 3, 0, 32, 0, 65, 16, 106, 32, 7, 55, 3, 0, 32, 0, 65, 24, 106, 32, 8, 55, 3, 0, 32, 0, 65, 32, 106, 32, 9, 55, 3, 0, 11, 32, 1, 32, 5, 73, 4, 64, 32, 4, 32, 1, 32, 5, 32, 1, 107, 34, 1, 252, 10, 0, 0, 32, 0, 65, 200, 0, 106, 32, 1, 54, 2, 0, 11, 11, 188, 2, 1, 5, 126, 32, 0, 65, 24, 106, 41, 3, 0, 33, 1, 32, 0, 41, 3, 0, 34, 2, 66, 32, 90, 4, 126, 32, 0, 65, 8, 106, 41, 3, 0, 34, 3, 66, 1, 137, 32, 0, 65, 16, 106, 41, 3, 0, 34, 4, 66, 7, 137, 124, 32, 1, 66, 12, 137, 32, 0, 65, 32, 106, 41, 3, 0, 34, 5, 66, 18, 137, 124, 124, 32, 3, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 32, 4, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 32, 1, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 32, 5, 66, 207, 214, 211, 190, 210, 199, 171, 217, 66, 126, 66, 31, 137, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 133, 66, 135, 149, 175, 175, 152, 182, 222, 155, 158, 127, 126, 66, 157, 163, 181, 234, 131, 177, 141, 138, 250, 0, 125, 5, 32, 1, 66, 197, 207, 217, 178, 241, 229, 186, 234, 39, 124, 11, 32, 2, 124, 32, 0, 65, 40, 106, 32, 2, 66, 31, 131, 167, 16, 6, 11]);
|
|
@@ -1039,7 +1039,7 @@ function imageSize(input) {
|
|
|
1039
1039
|
throw new TypeError(`unsupported file type: ${type}`);
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
|
-
// ../memory/dist/chunk-
|
|
1042
|
+
// ../memory/dist/chunk-JJBSFPC5.js
|
|
1043
1043
|
function formatRelativeTime(date, currentDate) {
|
|
1044
1044
|
const diffMs = currentDate.getTime() - date.getTime();
|
|
1045
1045
|
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
@@ -1336,6 +1336,220 @@ function createThreadUpdateMarker(params) {
|
|
|
1336
1336
|
}
|
|
1337
1337
|
};
|
|
1338
1338
|
}
|
|
1339
|
+
var OBSERVATION_GROUP_PATTERN = /<observation-group\s([^>]*)>([\s\S]*?)<\/observation-group>/g;
|
|
1340
|
+
var ATTRIBUTE_PATTERN = /([\w][\w-]*)="([^"]*)"/g;
|
|
1341
|
+
var REFLECTION_GROUP_SPLIT_PATTERN = /^##\s+Group\s+/m;
|
|
1342
|
+
function parseObservationGroupAttributes(attributeString) {
|
|
1343
|
+
const attributes = {};
|
|
1344
|
+
for (const match of attributeString.matchAll(ATTRIBUTE_PATTERN)) {
|
|
1345
|
+
const [, key, value] = match;
|
|
1346
|
+
if (key && value !== void 0) {
|
|
1347
|
+
attributes[key] = value;
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
return attributes;
|
|
1351
|
+
}
|
|
1352
|
+
function parseReflectionObservationGroupSections(content) {
|
|
1353
|
+
const normalizedContent = content.trim();
|
|
1354
|
+
if (!normalizedContent || !REFLECTION_GROUP_SPLIT_PATTERN.test(normalizedContent)) {
|
|
1355
|
+
return [];
|
|
1356
|
+
}
|
|
1357
|
+
return normalizedContent.split(REFLECTION_GROUP_SPLIT_PATTERN).map((section) => section.trim()).filter(Boolean).map((section) => {
|
|
1358
|
+
const newlineIndex = section.indexOf("\n");
|
|
1359
|
+
const heading = (newlineIndex >= 0 ? section.slice(0, newlineIndex) : section).trim();
|
|
1360
|
+
const body = (newlineIndex >= 0 ? section.slice(newlineIndex + 1) : "").trim();
|
|
1361
|
+
return {
|
|
1362
|
+
heading,
|
|
1363
|
+
body: stripReflectionGroupMetadata(body)
|
|
1364
|
+
};
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
function stripReflectionGroupMetadata(body) {
|
|
1368
|
+
return body.replace(/^_range:\s*`[^`]*`_\s*\n?/m, "").trim();
|
|
1369
|
+
}
|
|
1370
|
+
function generateAnchorId() {
|
|
1371
|
+
return randomBytes(8).toString("hex");
|
|
1372
|
+
}
|
|
1373
|
+
function wrapInObservationGroup(observations, range, id = generateAnchorId(), sourceGroupIds) {
|
|
1374
|
+
const content = observations.trim();
|
|
1375
|
+
const sourceGroupIdsAttr = sourceGroupIds?.length ? ` source-group-ids="${sourceGroupIds.join(",")}"` : "";
|
|
1376
|
+
return `<observation-group id="${id}" range="${range}"${sourceGroupIdsAttr}>
|
|
1377
|
+
${content}
|
|
1378
|
+
</observation-group>`;
|
|
1379
|
+
}
|
|
1380
|
+
function parseObservationGroups(observations) {
|
|
1381
|
+
if (!observations) {
|
|
1382
|
+
return [];
|
|
1383
|
+
}
|
|
1384
|
+
const groups = [];
|
|
1385
|
+
let match;
|
|
1386
|
+
while ((match = OBSERVATION_GROUP_PATTERN.exec(observations)) !== null) {
|
|
1387
|
+
const attributes = parseObservationGroupAttributes(match[1] ?? "");
|
|
1388
|
+
const id = attributes.id;
|
|
1389
|
+
const range = attributes.range;
|
|
1390
|
+
if (!id || !range) {
|
|
1391
|
+
continue;
|
|
1392
|
+
}
|
|
1393
|
+
groups.push({
|
|
1394
|
+
id,
|
|
1395
|
+
range,
|
|
1396
|
+
content: match[2].trim(),
|
|
1397
|
+
sourceGroupIds: attributes["source-group-ids"]?.split(",").map((part) => part.trim()).filter(Boolean)
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
return groups;
|
|
1401
|
+
}
|
|
1402
|
+
function stripObservationGroups(observations) {
|
|
1403
|
+
if (!observations) {
|
|
1404
|
+
return observations;
|
|
1405
|
+
}
|
|
1406
|
+
return observations.replace(OBSERVATION_GROUP_PATTERN, (_match, _attributes, content) => content.trim()).replace(/\n{3,}/g, "\n\n").trim();
|
|
1407
|
+
}
|
|
1408
|
+
function combineObservationGroupRanges(groups) {
|
|
1409
|
+
return Array.from(
|
|
1410
|
+
new Set(
|
|
1411
|
+
groups.flatMap((group) => group.range.split(",")).map((range) => range.trim()).filter(Boolean)
|
|
1412
|
+
)
|
|
1413
|
+
).join(",");
|
|
1414
|
+
}
|
|
1415
|
+
function renderObservationGroupsForReflection(observations) {
|
|
1416
|
+
const groups = parseObservationGroups(observations);
|
|
1417
|
+
if (groups.length === 0) {
|
|
1418
|
+
return null;
|
|
1419
|
+
}
|
|
1420
|
+
const groupsByContent = new Map(groups.map((g) => [g.content.trim(), g]));
|
|
1421
|
+
const result = observations.replace(OBSERVATION_GROUP_PATTERN, (_match, _attrs, content) => {
|
|
1422
|
+
const group = groupsByContent.get(content.trim());
|
|
1423
|
+
if (!group) return content.trim();
|
|
1424
|
+
return `## Group \`${group.id}\`
|
|
1425
|
+
_range: \`${group.range}\`_
|
|
1426
|
+
|
|
1427
|
+
${group.content}`;
|
|
1428
|
+
});
|
|
1429
|
+
return result.replace(/\n{3,}/g, "\n\n").trim();
|
|
1430
|
+
}
|
|
1431
|
+
function getCanonicalGroupId(sectionHeading, fallbackIndex) {
|
|
1432
|
+
const match = sectionHeading.match(/`([^`]+)`/);
|
|
1433
|
+
return match?.[1]?.trim() || `derived-group-${fallbackIndex + 1}`;
|
|
1434
|
+
}
|
|
1435
|
+
function deriveObservationGroupProvenance(content, groups) {
|
|
1436
|
+
const sections = parseReflectionObservationGroupSections(content);
|
|
1437
|
+
if (sections.length === 0 || groups.length === 0) {
|
|
1438
|
+
return [];
|
|
1439
|
+
}
|
|
1440
|
+
return sections.map((section, index) => {
|
|
1441
|
+
const bodyLines = new Set(
|
|
1442
|
+
section.body.split("\n").map((line) => line.trim()).filter(Boolean)
|
|
1443
|
+
);
|
|
1444
|
+
const matchingGroups = groups.filter((group) => {
|
|
1445
|
+
const groupLines = group.content.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
1446
|
+
return groupLines.some((line) => bodyLines.has(line));
|
|
1447
|
+
});
|
|
1448
|
+
const fallbackGroup = groups[Math.min(index, groups.length - 1)];
|
|
1449
|
+
const resolvedGroups = matchingGroups.length > 0 ? matchingGroups : fallbackGroup ? [fallbackGroup] : [];
|
|
1450
|
+
const sourceGroupIds = Array.from(
|
|
1451
|
+
new Set(resolvedGroups.flatMap((group) => [group.id, ...group.sourceGroupIds ?? []]))
|
|
1452
|
+
);
|
|
1453
|
+
const canonicalGroupId = getCanonicalGroupId(section.heading, index);
|
|
1454
|
+
return {
|
|
1455
|
+
id: canonicalGroupId,
|
|
1456
|
+
range: combineObservationGroupRanges(resolvedGroups),
|
|
1457
|
+
content: section.body,
|
|
1458
|
+
sourceGroupIds
|
|
1459
|
+
};
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
function reconcileObservationGroupsFromReflection(content, sourceObservations) {
|
|
1463
|
+
const sourceGroups = parseObservationGroups(sourceObservations);
|
|
1464
|
+
if (sourceGroups.length === 0) {
|
|
1465
|
+
return null;
|
|
1466
|
+
}
|
|
1467
|
+
const normalizedContent = content.trim();
|
|
1468
|
+
if (!normalizedContent) {
|
|
1469
|
+
return "";
|
|
1470
|
+
}
|
|
1471
|
+
const derivedGroups = deriveObservationGroupProvenance(normalizedContent, sourceGroups);
|
|
1472
|
+
if (derivedGroups.length > 0) {
|
|
1473
|
+
return derivedGroups.map((group) => wrapInObservationGroup(group.content, group.range, group.id, group.sourceGroupIds)).join("\n\n");
|
|
1474
|
+
}
|
|
1475
|
+
return wrapInObservationGroup(
|
|
1476
|
+
normalizedContent,
|
|
1477
|
+
combineObservationGroupRanges(sourceGroups),
|
|
1478
|
+
generateAnchorId(),
|
|
1479
|
+
Array.from(new Set(sourceGroups.flatMap((group) => [group.id, ...group.sourceGroupIds ?? []])))
|
|
1480
|
+
);
|
|
1481
|
+
}
|
|
1482
|
+
var ANCHOR_ID_PATTERN = /^\[(O\d+(?:-N\d+)?)\]\s*/;
|
|
1483
|
+
var OBSERVATION_DATE_HEADER_PATTERN = /^\s*Date:\s+/;
|
|
1484
|
+
var XML_TAG_PATTERN = /^\s*<\/?[a-z][^>]*>\s*$/i;
|
|
1485
|
+
var MARKDOWN_GROUP_HEADING_PATTERN = /^\s*##\s+Group\s+`[^`]+`\s*$/;
|
|
1486
|
+
var MARKDOWN_GROUP_METADATA_PATTERN = /^\s*_range:\s*`[^`]*`_\s*$/;
|
|
1487
|
+
function buildEphemeralAnchorId(topLevelCounter, nestedCounter) {
|
|
1488
|
+
return nestedCounter === 0 ? `O${topLevelCounter}` : `O${topLevelCounter}-N${nestedCounter}`;
|
|
1489
|
+
}
|
|
1490
|
+
function parseAnchorId(line) {
|
|
1491
|
+
const match = line.match(ANCHOR_ID_PATTERN);
|
|
1492
|
+
return match?.[1] ?? null;
|
|
1493
|
+
}
|
|
1494
|
+
function shouldAnchorLine(line) {
|
|
1495
|
+
const trimmed = line.trim();
|
|
1496
|
+
if (!trimmed) {
|
|
1497
|
+
return false;
|
|
1498
|
+
}
|
|
1499
|
+
if (parseAnchorId(trimmed)) {
|
|
1500
|
+
return false;
|
|
1501
|
+
}
|
|
1502
|
+
if (OBSERVATION_DATE_HEADER_PATTERN.test(trimmed)) {
|
|
1503
|
+
return false;
|
|
1504
|
+
}
|
|
1505
|
+
if (XML_TAG_PATTERN.test(trimmed)) {
|
|
1506
|
+
return false;
|
|
1507
|
+
}
|
|
1508
|
+
if (MARKDOWN_GROUP_HEADING_PATTERN.test(trimmed) || MARKDOWN_GROUP_METADATA_PATTERN.test(trimmed)) {
|
|
1509
|
+
return false;
|
|
1510
|
+
}
|
|
1511
|
+
return true;
|
|
1512
|
+
}
|
|
1513
|
+
function getIndentationDepth(line) {
|
|
1514
|
+
const leadingWhitespace = line.match(/^\s*/)?.[0] ?? "";
|
|
1515
|
+
return Math.floor(leadingWhitespace.replace(/\t/g, " ").length / 2);
|
|
1516
|
+
}
|
|
1517
|
+
function injectAnchorIds(observations) {
|
|
1518
|
+
if (!observations) {
|
|
1519
|
+
return observations;
|
|
1520
|
+
}
|
|
1521
|
+
const lines = observations.split("\n");
|
|
1522
|
+
let topLevelCounter = 0;
|
|
1523
|
+
let nestedCounter = 0;
|
|
1524
|
+
let changed = false;
|
|
1525
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1526
|
+
const line = lines[i];
|
|
1527
|
+
if (!shouldAnchorLine(line)) {
|
|
1528
|
+
continue;
|
|
1529
|
+
}
|
|
1530
|
+
const indentationDepth = getIndentationDepth(line);
|
|
1531
|
+
if (indentationDepth === 0) {
|
|
1532
|
+
topLevelCounter += 1;
|
|
1533
|
+
nestedCounter = 0;
|
|
1534
|
+
} else {
|
|
1535
|
+
if (topLevelCounter === 0) {
|
|
1536
|
+
topLevelCounter = 1;
|
|
1537
|
+
}
|
|
1538
|
+
nestedCounter += 1;
|
|
1539
|
+
}
|
|
1540
|
+
const anchorId = buildEphemeralAnchorId(topLevelCounter, nestedCounter);
|
|
1541
|
+
const leadingWhitespace = line.match(/^\s*/)?.[0] ?? "";
|
|
1542
|
+
lines[i] = `${leadingWhitespace}[${anchorId}] ${line.slice(leadingWhitespace.length)}`;
|
|
1543
|
+
changed = true;
|
|
1544
|
+
}
|
|
1545
|
+
return changed ? lines.join("\n") : observations;
|
|
1546
|
+
}
|
|
1547
|
+
function stripEphemeralAnchorIds(observations) {
|
|
1548
|
+
if (!observations) {
|
|
1549
|
+
return observations;
|
|
1550
|
+
}
|
|
1551
|
+
return observations.replace(/(^|\n)([^\S\n]*)\[(O\d+(?:-N\d+)?)\][^\S\n]*/g, "$1$2");
|
|
1552
|
+
}
|
|
1339
1553
|
var ENCRYPTED_CONTENT_KEY = "encryptedContent";
|
|
1340
1554
|
var ENCRYPTED_CONTENT_REDACTION_THRESHOLD = 256;
|
|
1341
1555
|
var DEFAULT_OBSERVER_TOOL_RESULT_MAX_TOKENS = 1e4;
|
|
@@ -1402,9 +1616,8 @@ function truncateStringByTokens(text, maxTokens) {
|
|
|
1402
1616
|
}
|
|
1403
1617
|
const buildCandidate = (sliceEnd) => {
|
|
1404
1618
|
const visible = text.slice(0, sliceEnd);
|
|
1405
|
-
const omittedChars = text.length - sliceEnd;
|
|
1406
1619
|
return `${visible}
|
|
1407
|
-
... [truncated ~${totalTokens - estimateTokenCount(visible)} tokens
|
|
1620
|
+
... [truncated ~${totalTokens - estimateTokenCount(visible)} tokens]`;
|
|
1408
1621
|
};
|
|
1409
1622
|
let low = 0;
|
|
1410
1623
|
let high = text.length;
|
|
@@ -2401,7 +2614,7 @@ function extractCurrentTask(observations) {
|
|
|
2401
2614
|
return content || null;
|
|
2402
2615
|
}
|
|
2403
2616
|
function optimizeObservationsForContext(observations) {
|
|
2404
|
-
let optimized = observations;
|
|
2617
|
+
let optimized = stripEphemeralAnchorIds(observations);
|
|
2405
2618
|
optimized = optimized.replace(/🟡\s*/g, "");
|
|
2406
2619
|
optimized = optimized.replace(/🟢\s*/g, "");
|
|
2407
2620
|
optimized = optimized.replace(/\[(?![\d\s]*items collapsed)[^\]]+\]/g, "");
|
|
@@ -2587,9 +2800,11 @@ Your current detail level was a 10/10, lets aim for a 4/10 detail level.
|
|
|
2587
2800
|
};
|
|
2588
2801
|
function buildReflectorPrompt(observations, manualPrompt, compressionLevel, skipContinuationHints) {
|
|
2589
2802
|
const level = typeof compressionLevel === "number" ? compressionLevel : compressionLevel ? 1 : 0;
|
|
2803
|
+
const reflectionView = renderObservationGroupsForReflection(observations) ?? observations;
|
|
2804
|
+
const anchoredObservations = injectAnchorIds(reflectionView);
|
|
2590
2805
|
let prompt = `## OBSERVATIONS TO REFLECT ON
|
|
2591
2806
|
|
|
2592
|
-
${
|
|
2807
|
+
${anchoredObservations}
|
|
2593
2808
|
|
|
2594
2809
|
---
|
|
2595
2810
|
|
|
@@ -2614,7 +2829,7 @@ IMPORTANT: Do NOT include <current-task> or <suggested-response> sections in you
|
|
|
2614
2829
|
}
|
|
2615
2830
|
return prompt;
|
|
2616
2831
|
}
|
|
2617
|
-
function parseReflectorOutput(output) {
|
|
2832
|
+
function parseReflectorOutput(output, sourceObservations) {
|
|
2618
2833
|
if (detectDegenerateRepetition(output)) {
|
|
2619
2834
|
return {
|
|
2620
2835
|
observations: "",
|
|
@@ -2622,9 +2837,10 @@ function parseReflectorOutput(output) {
|
|
|
2622
2837
|
};
|
|
2623
2838
|
}
|
|
2624
2839
|
const parsed = parseReflectorSectionXml(output);
|
|
2625
|
-
const
|
|
2840
|
+
const sanitizedObservations = sanitizeObservationLines(stripEphemeralAnchorIds(parsed.observations || ""));
|
|
2841
|
+
const reconciledObservations = sourceObservations ? reconcileObservationGroupsFromReflection(sanitizedObservations, sourceObservations) : null;
|
|
2626
2842
|
return {
|
|
2627
|
-
observations,
|
|
2843
|
+
observations: reconciledObservations ?? sanitizedObservations,
|
|
2628
2844
|
suggestedContinuation: parsed.suggestedResponse || void 0
|
|
2629
2845
|
// Note: Reflector's currentTask is not used - thread metadata preserves per-thread tasks
|
|
2630
2846
|
};
|
|
@@ -4116,7 +4332,24 @@ if (OM_DEBUG_LOG) {
|
|
|
4116
4332
|
_origConsoleError.apply(console, args);
|
|
4117
4333
|
};
|
|
4118
4334
|
}
|
|
4335
|
+
function messageHasVisibleContent(msg) {
|
|
4336
|
+
const content = msg.content;
|
|
4337
|
+
if (content?.parts && Array.isArray(content.parts)) {
|
|
4338
|
+
return content.parts.some((p) => {
|
|
4339
|
+
const t2 = p?.type;
|
|
4340
|
+
return t2 && !t2.startsWith("data-") && t2 !== "step-start";
|
|
4341
|
+
});
|
|
4342
|
+
}
|
|
4343
|
+
if (content?.content) return true;
|
|
4344
|
+
return false;
|
|
4345
|
+
}
|
|
4346
|
+
function buildMessageRange(messages) {
|
|
4347
|
+
const first = messages.find(messageHasVisibleContent) ?? messages[0];
|
|
4348
|
+
const last = [...messages].reverse().find(messageHasVisibleContent) ?? messages[messages.length - 1];
|
|
4349
|
+
return `${first.id}:${last.id}`;
|
|
4350
|
+
}
|
|
4119
4351
|
var OBSERVATIONAL_MEMORY_DEFAULTS = {
|
|
4352
|
+
retrieval: false,
|
|
4120
4353
|
observation: {
|
|
4121
4354
|
model: "google/gemini-2.5-flash",
|
|
4122
4355
|
messageTokens: 3e4,
|
|
@@ -4171,12 +4404,54 @@ KNOWLEDGE UPDATES: When asked about current state (e.g., "where do I currently..
|
|
|
4171
4404
|
PLANNED ACTIONS: If the user stated they planned to do something (e.g., "I'm going to...", "I'm looking forward to...", "I will...") and the date they planned to do it is now in the past (check the relative time like "3 weeks ago"), assume they completed the action unless there's evidence they didn't. For example, if someone said "I'll start my new diet on Monday" and that was 2 weeks ago, assume they started the diet.
|
|
4172
4405
|
|
|
4173
4406
|
MOST RECENT USER INPUT: Treat the most recent user message as the highest-priority signal for what to do next. Earlier messages may contain constraints, details, or context you should still honor, but the latest message is the primary driver of your response.`;
|
|
4407
|
+
var OBSERVATION_RETRIEVAL_INSTRUCTIONS = `## Recall \u2014 looking up source messages
|
|
4408
|
+
|
|
4409
|
+
Your memory is comprised of observations which are sometimes wrapped in <observation-group> xml tags containing ranges like <observation-group range="startId:endId">. These ranges point back to the raw messages that each observation group was derived from. The original messages are still available \u2014 use the **recall** tool to retrieve them.
|
|
4410
|
+
|
|
4411
|
+
### When to use recall
|
|
4412
|
+
- The user asks you to **repeat, show, or reproduce** something from a past conversation
|
|
4413
|
+
- The user asks for **exact content** \u2014 code, text, quotes, error messages, URLs, file paths, specific numbers
|
|
4414
|
+
- Your observations mention something but your memory lacks the detail needed to fully answer (e.g. you know a blog post was shared but only have a summary of it)
|
|
4415
|
+
- You want to **verify or expand on** an observation before responding
|
|
4416
|
+
|
|
4417
|
+
**Default to using recall when the user references specific past content.** Your observations capture the gist, not the details. If there's any doubt whether your memory is complete enough, use recall.
|
|
4418
|
+
|
|
4419
|
+
### How to use recall
|
|
4420
|
+
Each range has the format \`startId:endId\` where both are message IDs separated by a colon.
|
|
4421
|
+
|
|
4422
|
+
1. Find the observation group relevant to the user's question and extract the start or end ID from its range.
|
|
4423
|
+
2. Call \`recall\` with that ID as the \`cursor\`.
|
|
4424
|
+
3. Use \`page: 1\` (or omit) to read forward from the cursor, \`page: -1\` to read backward.
|
|
4425
|
+
4. If the first page doesn't have what you need, increment the page number to keep paginating.
|
|
4426
|
+
5. Check \`hasNextPage\`/\`hasPrevPage\` in the result to know if more pages exist in each direction.
|
|
4427
|
+
|
|
4428
|
+
### Detail levels
|
|
4429
|
+
By default recall returns **low** detail: truncated text and tool names only. Each message shows its ID and each part has a positional index like \`[p0]\`, \`[p1]\`, etc.
|
|
4430
|
+
|
|
4431
|
+
- Use \`detail: "high"\` to get full message content including tool arguments and results. This will only return the high detail version of a single message part at a time.
|
|
4432
|
+
- Use \`partIndex\` with a cursor to fetch a single part at full detail \u2014 for example, to read one specific tool result or code block without loading every part.
|
|
4433
|
+
|
|
4434
|
+
If the result says \`truncated: true\`, the output was cut to fit the token budget. You can paginate or use \`partIndex\` to target specific content.
|
|
4435
|
+
|
|
4436
|
+
### Following up on truncated parts
|
|
4437
|
+
Low-detail results may include truncation hints like:
|
|
4438
|
+
\`[truncated \u2014 call recall cursor="..." partIndex=N detail="high" for full content]\`
|
|
4439
|
+
|
|
4440
|
+
**When you see these hints and need the full content, make the exact call described in the hint.** This is the normal workflow: first recall at low detail to scan, then drill into specific parts at high detail. Do not stop at the low-detail result if the user asked for exact content.
|
|
4441
|
+
|
|
4442
|
+
### When recall is NOT needed
|
|
4443
|
+
- The user is asking for a high-level summary and your observations already cover it
|
|
4444
|
+
- The question is about general preferences or facts that don't require source text
|
|
4445
|
+
- There is no relevant range in your observations for the topic
|
|
4446
|
+
|
|
4447
|
+
Observation groups with range IDs and your recall tool allows you to think back and remember details you're fuzzy on.`;
|
|
4174
4448
|
var ObservationalMemory = class _ObservationalMemory {
|
|
4175
4449
|
id = "observational-memory";
|
|
4176
4450
|
name = "Observational Memory";
|
|
4177
4451
|
storage;
|
|
4178
4452
|
tokenCounter;
|
|
4179
4453
|
scope;
|
|
4454
|
+
retrieval = false;
|
|
4180
4455
|
observationConfig;
|
|
4181
4456
|
reflectionConfig;
|
|
4182
4457
|
onDebugEvent;
|
|
@@ -4489,6 +4764,7 @@ var ObservationalMemory = class _ObservationalMemory {
|
|
|
4489
4764
|
this.shouldObscureThreadIds = config.obscureThreadIds || false;
|
|
4490
4765
|
this.storage = config.storage;
|
|
4491
4766
|
this.scope = config.scope ?? "thread";
|
|
4767
|
+
this.retrieval = this.scope === "thread" && (config.retrieval ?? OBSERVATIONAL_MEMORY_DEFAULTS.retrieval);
|
|
4492
4768
|
const resolveModel = (m) => m === "default" ? OBSERVATIONAL_MEMORY_DEFAULTS.observation.model : m;
|
|
4493
4769
|
const observationModel = resolveModel(config.model) ?? resolveModel(config.observation?.model) ?? resolveModel(config.reflection?.model);
|
|
4494
4770
|
const reflectionModel = resolveModel(config.model) ?? resolveModel(config.reflection?.model) ?? resolveModel(config.observation?.model);
|
|
@@ -4592,6 +4868,7 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
|
|
|
4592
4868
|
get config() {
|
|
4593
4869
|
return {
|
|
4594
4870
|
scope: this.scope,
|
|
4871
|
+
retrieval: this.retrieval,
|
|
4595
4872
|
observation: {
|
|
4596
4873
|
messageTokens: this.observationConfig.messageTokens,
|
|
4597
4874
|
previousObserverTokens: this.observationConfig.previousObserverTokens
|
|
@@ -4848,7 +5125,8 @@ Async buffering is enabled by default \u2014 this opt-out is only needed when us
|
|
|
4848
5125
|
config: {
|
|
4849
5126
|
observation: this.observationConfig,
|
|
4850
5127
|
reflection: this.reflectionConfig,
|
|
4851
|
-
scope: this.scope
|
|
5128
|
+
scope: this.scope,
|
|
5129
|
+
retrieval: this.retrieval
|
|
4852
5130
|
},
|
|
4853
5131
|
observedTimezone
|
|
4854
5132
|
});
|
|
@@ -5489,7 +5767,7 @@ ${unreflectedContent}` : bufferedReflection;
|
|
|
5489
5767
|
totalUsage.outputTokens += usage.outputTokens ?? 0;
|
|
5490
5768
|
totalUsage.totalTokens += usage.totalTokens ?? 0;
|
|
5491
5769
|
}
|
|
5492
|
-
parsed = parseReflectorOutput(result.text);
|
|
5770
|
+
parsed = parseReflectorOutput(result.text, observations);
|
|
5493
5771
|
if (parsed.degenerate) {
|
|
5494
5772
|
omDebug(
|
|
5495
5773
|
`[OM:callReflector] attempt #${attemptNumber}: degenerate repetition detected, treating as compression failure`
|
|
@@ -5556,14 +5834,18 @@ ${unreflectedContent}` : bufferedReflection;
|
|
|
5556
5834
|
* @param suggestedResponse - Thread-specific suggested response (from thread metadata)
|
|
5557
5835
|
* @param unobservedContextBlocks - Formatted <unobserved-context> blocks from other threads
|
|
5558
5836
|
*/
|
|
5559
|
-
formatObservationsForContext(observations, currentTask, suggestedResponse, unobservedContextBlocks, currentDate) {
|
|
5560
|
-
let optimized = optimizeObservationsForContext(observations);
|
|
5837
|
+
formatObservationsForContext(observations, currentTask, suggestedResponse, unobservedContextBlocks, currentDate, retrieval = false) {
|
|
5838
|
+
let optimized = retrieval ? renderObservationGroupsForReflection(observations) ?? observations : optimizeObservationsForContext(observations);
|
|
5561
5839
|
if (currentDate) {
|
|
5562
5840
|
optimized = addRelativeTimeToObservations(optimized, currentDate);
|
|
5563
5841
|
}
|
|
5564
|
-
const messages = [
|
|
5842
|
+
const messages = [
|
|
5843
|
+
`${OBSERVATION_CONTEXT_PROMPT}
|
|
5565
5844
|
|
|
5566
|
-
${OBSERVATION_CONTEXT_INSTRUCTIONS}`
|
|
5845
|
+
${OBSERVATION_CONTEXT_INSTRUCTIONS}${retrieval ? `
|
|
5846
|
+
|
|
5847
|
+
${OBSERVATION_RETRIEVAL_INSTRUCTIONS}` : ""}`
|
|
5848
|
+
];
|
|
5567
5849
|
if (unobservedContextBlocks) {
|
|
5568
5850
|
messages.push(
|
|
5569
5851
|
`The following content is from OTHER conversations different from the current conversation, they're here for reference, but they're not necessarily your focus:
|
|
@@ -6048,7 +6330,8 @@ ${suggestedResponse}
|
|
|
6048
6330
|
currentTask,
|
|
6049
6331
|
suggestedResponse,
|
|
6050
6332
|
unobservedContextBlocks,
|
|
6051
|
-
currentDate
|
|
6333
|
+
currentDate,
|
|
6334
|
+
this.retrieval
|
|
6052
6335
|
);
|
|
6053
6336
|
messageList.clearSystemMessages("observational-memory");
|
|
6054
6337
|
messageList.addSystem(observationSystemMessages, "observational-memory");
|
|
@@ -6716,11 +6999,12 @@ ${formattedMessages}
|
|
|
6716
6999
|
* Wrap observations in a thread attribution tag.
|
|
6717
7000
|
* Used in resource scope to track which thread observations came from.
|
|
6718
7001
|
*/
|
|
6719
|
-
async wrapWithThreadTag(threadId, observations) {
|
|
7002
|
+
async wrapWithThreadTag(threadId, observations, messageRange) {
|
|
6720
7003
|
const cleanObservations = this.stripThreadTags(observations);
|
|
7004
|
+
const groupedObservations = this.retrieval && messageRange ? wrapInObservationGroup(cleanObservations, messageRange) : cleanObservations;
|
|
6721
7005
|
const obscuredId = await this.representThreadIDInContext(threadId);
|
|
6722
7006
|
return `<thread id="${obscuredId}">
|
|
6723
|
-
${
|
|
7007
|
+
${groupedObservations}
|
|
6724
7008
|
</thread>`;
|
|
6725
7009
|
}
|
|
6726
7010
|
/**
|
|
@@ -6857,9 +7141,10 @@ ${threadClose}`;
|
|
|
6857
7141
|
});
|
|
6858
7142
|
const lastObservedAt = this.getMaxMessageTimestamp(messagesToObserve);
|
|
6859
7143
|
const existingObservations = freshRecord?.activeObservations ?? record.activeObservations ?? "";
|
|
7144
|
+
const messageRange = this.retrieval ? buildMessageRange(messagesToObserve) : void 0;
|
|
6860
7145
|
let newObservations;
|
|
6861
7146
|
if (this.scope === "resource") {
|
|
6862
|
-
const threadSection = await this.wrapWithThreadTag(threadId, result.observations);
|
|
7147
|
+
const threadSection = await this.wrapWithThreadTag(threadId, result.observations, messageRange);
|
|
6863
7148
|
newObservations = this.replaceOrAppendThreadSection(
|
|
6864
7149
|
existingObservations,
|
|
6865
7150
|
threadId,
|
|
@@ -6867,7 +7152,8 @@ ${threadClose}`;
|
|
|
6867
7152
|
lastObservedAt
|
|
6868
7153
|
);
|
|
6869
7154
|
} else {
|
|
6870
|
-
|
|
7155
|
+
const groupedObservations = this.retrieval && messageRange ? wrapInObservationGroup(result.observations, messageRange) : result.observations;
|
|
7156
|
+
newObservations = existingObservations ? `${existingObservations}${_ObservationalMemory.createMessageBoundary(lastObservedAt)}${groupedObservations}` : groupedObservations;
|
|
6871
7157
|
}
|
|
6872
7158
|
let totalTokenCount = this.tokenCounter.countObservations(newObservations);
|
|
6873
7159
|
const cycleObservationTokens = this.tokenCounter.countObservations(result.observations);
|
|
@@ -7175,11 +7461,12 @@ ${threadClose}`;
|
|
|
7175
7461
|
}
|
|
7176
7462
|
}
|
|
7177
7463
|
}
|
|
7464
|
+
const messageRange = this.retrieval ? buildMessageRange(messagesToBuffer) : void 0;
|
|
7178
7465
|
let newObservations;
|
|
7179
7466
|
if (this.scope === "resource") {
|
|
7180
|
-
newObservations = await this.wrapWithThreadTag(threadId, result.observations);
|
|
7467
|
+
newObservations = await this.wrapWithThreadTag(threadId, result.observations, messageRange);
|
|
7181
7468
|
} else {
|
|
7182
|
-
newObservations = result.observations;
|
|
7469
|
+
newObservations = this.retrieval && messageRange ? wrapInObservationGroup(result.observations, messageRange) : result.observations;
|
|
7183
7470
|
}
|
|
7184
7471
|
const newTokenCount = this.tokenCounter.countObservations(newObservations);
|
|
7185
7472
|
const newMessageIds = messagesToBuffer.map((m) => m.id);
|
|
@@ -7805,7 +8092,8 @@ ${unreflectedContent}` : freshRecord.bufferedReflection;
|
|
|
7805
8092
|
const { threadId, threadMessages, result } = obsResult;
|
|
7806
8093
|
cycleObservationTokens += this.tokenCounter.countObservations(result.observations);
|
|
7807
8094
|
const threadLastObservedAt = this.getMaxMessageTimestamp(threadMessages);
|
|
7808
|
-
const
|
|
8095
|
+
const messageRange = this.retrieval ? buildMessageRange(threadMessages) : void 0;
|
|
8096
|
+
const threadSection = await this.wrapWithThreadTag(threadId, result.observations, messageRange);
|
|
7809
8097
|
currentObservations = this.replaceOrAppendThreadSection(
|
|
7810
8098
|
currentObservations,
|
|
7811
8099
|
threadId,
|
|
@@ -8285,6 +8573,6 @@ function getObservationsAsOf(activeObservations, asOf) {
|
|
|
8285
8573
|
return chunks.join("\n\n");
|
|
8286
8574
|
}
|
|
8287
8575
|
|
|
8288
|
-
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, e, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, optimizeObservationsForContext, parseObserverOutput };
|
|
8289
|
-
//# sourceMappingURL=chunk-
|
|
8290
|
-
//# sourceMappingURL=chunk-
|
|
8576
|
+
export { OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, TokenCounter, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, e, estimateTokenCount, extractCurrentTask, formatMessagesForObserver, formatToolResultForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, resolveToolResultValue, stripEphemeralAnchorIds, stripObservationGroups, truncateStringByTokens, wrapInObservationGroup };
|
|
8577
|
+
//# sourceMappingURL=chunk-OVXPDSMT.js.map
|
|
8578
|
+
//# sourceMappingURL=chunk-OVXPDSMT.js.map
|