@framers/agentos 0.1.111 → 0.1.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/api/strategies/debate.d.ts +12 -1
  2. package/dist/api/strategies/debate.d.ts.map +1 -1
  3. package/dist/api/strategies/debate.js +41 -5
  4. package/dist/api/strategies/debate.js.map +1 -1
  5. package/dist/api/strategies/hierarchical.d.ts +15 -1
  6. package/dist/api/strategies/hierarchical.d.ts.map +1 -1
  7. package/dist/api/strategies/hierarchical.js +51 -7
  8. package/dist/api/strategies/hierarchical.js.map +1 -1
  9. package/dist/api/strategies/index.d.ts +26 -4
  10. package/dist/api/strategies/index.d.ts.map +1 -1
  11. package/dist/api/strategies/index.js +26 -4
  12. package/dist/api/strategies/index.js.map +1 -1
  13. package/dist/api/strategies/parallel.d.ts +15 -4
  14. package/dist/api/strategies/parallel.d.ts.map +1 -1
  15. package/dist/api/strategies/parallel.js +53 -16
  16. package/dist/api/strategies/parallel.js.map +1 -1
  17. package/dist/api/strategies/review-loop.d.ts +15 -1
  18. package/dist/api/strategies/review-loop.d.ts.map +1 -1
  19. package/dist/api/strategies/review-loop.js +36 -10
  20. package/dist/api/strategies/review-loop.js.map +1 -1
  21. package/dist/api/strategies/sequential.d.ts +11 -1
  22. package/dist/api/strategies/sequential.d.ts.map +1 -1
  23. package/dist/api/strategies/sequential.js +39 -8
  24. package/dist/api/strategies/sequential.js.map +1 -1
  25. package/dist/api/strategies/shared.d.ts +71 -7
  26. package/dist/api/strategies/shared.d.ts.map +1 -1
  27. package/dist/api/strategies/shared.js +89 -10
  28. package/dist/api/strategies/shared.js.map +1 -1
  29. package/dist/api/types.d.ts +54 -1
  30. package/dist/api/types.d.ts.map +1 -1
  31. package/dist/api/types.js.map +1 -1
  32. package/dist/memory/facade/Memory.d.ts.map +1 -1
  33. package/dist/memory/facade/Memory.js +8 -0
  34. package/dist/memory/facade/Memory.js.map +1 -1
  35. package/dist/memory/facade/types.d.ts +10 -0
  36. package/dist/memory/facade/types.d.ts.map +1 -1
  37. package/dist/memory/index.d.ts +6 -0
  38. package/dist/memory/index.d.ts.map +1 -1
  39. package/dist/memory/index.js +5 -0
  40. package/dist/memory/index.js.map +1 -1
  41. package/dist/memory/observation/MemoryObserver.d.ts +63 -1
  42. package/dist/memory/observation/MemoryObserver.d.ts.map +1 -1
  43. package/dist/memory/observation/MemoryObserver.js +115 -4
  44. package/dist/memory/observation/MemoryObserver.js.map +1 -1
  45. package/dist/memory/observation/ObservationCompressor.d.ts +88 -0
  46. package/dist/memory/observation/ObservationCompressor.d.ts.map +1 -0
  47. package/dist/memory/observation/ObservationCompressor.js +207 -0
  48. package/dist/memory/observation/ObservationCompressor.js.map +1 -0
  49. package/dist/memory/observation/ObservationReflector.d.ts +82 -0
  50. package/dist/memory/observation/ObservationReflector.d.ts.map +1 -0
  51. package/dist/memory/observation/ObservationReflector.js +212 -0
  52. package/dist/memory/observation/ObservationReflector.js.map +1 -0
  53. package/dist/memory/observation/temporal.d.ts +54 -0
  54. package/dist/memory/observation/temporal.d.ts.map +1 -0
  55. package/dist/memory/observation/temporal.js +115 -0
  56. package/dist/memory/observation/temporal.js.map +1 -0
  57. package/dist/orchestration/builders/VoiceNodeBuilder.d.ts +82 -25
  58. package/dist/orchestration/builders/VoiceNodeBuilder.d.ts.map +1 -1
  59. package/dist/orchestration/builders/VoiceNodeBuilder.js +86 -26
  60. package/dist/orchestration/builders/VoiceNodeBuilder.js.map +1 -1
  61. package/dist/orchestration/events/GraphEvent.d.ts +67 -5
  62. package/dist/orchestration/events/GraphEvent.d.ts.map +1 -1
  63. package/dist/orchestration/events/GraphEvent.js.map +1 -1
  64. package/dist/orchestration/runtime/VoiceNodeExecutor.d.ts +102 -25
  65. package/dist/orchestration/runtime/VoiceNodeExecutor.d.ts.map +1 -1
  66. package/dist/orchestration/runtime/VoiceNodeExecutor.js +133 -38
  67. package/dist/orchestration/runtime/VoiceNodeExecutor.js.map +1 -1
  68. package/dist/orchestration/runtime/VoiceTransportAdapter.d.ts +94 -32
  69. package/dist/orchestration/runtime/VoiceTransportAdapter.d.ts.map +1 -1
  70. package/dist/orchestration/runtime/VoiceTransportAdapter.js +82 -28
  71. package/dist/orchestration/runtime/VoiceTransportAdapter.js.map +1 -1
  72. package/dist/orchestration/runtime/VoiceTurnCollector.d.ts +73 -20
  73. package/dist/orchestration/runtime/VoiceTurnCollector.d.ts.map +1 -1
  74. package/dist/orchestration/runtime/VoiceTurnCollector.js +84 -23
  75. package/dist/orchestration/runtime/VoiceTurnCollector.js.map +1 -1
  76. package/dist/voice/CallManager.d.ts.map +1 -1
  77. package/dist/voice/CallManager.js +9 -1
  78. package/dist/voice/CallManager.js.map +1 -1
  79. package/dist/voice/MediaStreamParser.d.ts +115 -6
  80. package/dist/voice/MediaStreamParser.d.ts.map +1 -1
  81. package/dist/voice/MediaStreamParser.js +44 -0
  82. package/dist/voice/MediaStreamParser.js.map +1 -1
  83. package/dist/voice/TelephonyStreamTransport.d.ts +112 -20
  84. package/dist/voice/TelephonyStreamTransport.d.ts.map +1 -1
  85. package/dist/voice/TelephonyStreamTransport.js +136 -30
  86. package/dist/voice/TelephonyStreamTransport.js.map +1 -1
  87. package/dist/voice/parsers/PlivoMediaStreamParser.d.ts +64 -6
  88. package/dist/voice/parsers/PlivoMediaStreamParser.d.ts.map +1 -1
  89. package/dist/voice/parsers/PlivoMediaStreamParser.js +67 -6
  90. package/dist/voice/parsers/PlivoMediaStreamParser.js.map +1 -1
  91. package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts +55 -8
  92. package/dist/voice/parsers/TelnyxMediaStreamParser.d.ts.map +1 -1
  93. package/dist/voice/parsers/TelnyxMediaStreamParser.js +60 -9
  94. package/dist/voice/parsers/TelnyxMediaStreamParser.js.map +1 -1
  95. package/dist/voice/parsers/TwilioMediaStreamParser.d.ts +73 -11
  96. package/dist/voice/parsers/TwilioMediaStreamParser.d.ts.map +1 -1
  97. package/dist/voice/parsers/TwilioMediaStreamParser.js +81 -12
  98. package/dist/voice/parsers/TwilioMediaStreamParser.js.map +1 -1
  99. package/dist/voice/providers/plivo.d.ts +108 -12
  100. package/dist/voice/providers/plivo.d.ts.map +1 -1
  101. package/dist/voice/providers/plivo.js +106 -9
  102. package/dist/voice/providers/plivo.js.map +1 -1
  103. package/dist/voice/providers/telnyx.d.ts +110 -20
  104. package/dist/voice/providers/telnyx.d.ts.map +1 -1
  105. package/dist/voice/providers/telnyx.js +111 -20
  106. package/dist/voice/providers/telnyx.js.map +1 -1
  107. package/dist/voice/providers/twilio.d.ts +91 -13
  108. package/dist/voice/providers/twilio.d.ts.map +1 -1
  109. package/dist/voice/providers/twilio.js +94 -14
  110. package/dist/voice/providers/twilio.js.map +1 -1
  111. package/dist/voice/twiml.d.ts +70 -12
  112. package/dist/voice/twiml.d.ts.map +1 -1
  113. package/dist/voice/twiml.js +70 -12
  114. package/dist/voice/twiml.js.map +1 -1
  115. package/dist/voice/types.d.ts +142 -15
  116. package/dist/voice/types.d.ts.map +1 -1
  117. package/dist/voice/types.js +34 -3
  118. package/dist/voice/types.js.map +1 -1
  119. package/package.json +1 -1
@@ -0,0 +1,82 @@
1
+ /**
2
+ * @fileoverview Higher-level reflector that condenses compressed observations
3
+ * into reflections — long-lived insights about user patterns, preferences,
4
+ * capabilities, relationships, and goals.
5
+ *
6
+ * This is the "Reflector" agent in Mastra's agentic memory model. It runs
7
+ * when compressed observations exceed a configurable token threshold
8
+ * (default: 40,000 tokens) and extracts higher-level patterns that transcend
9
+ * individual conversation turns.
10
+ *
11
+ * Each {@link Reflection} carries a pattern type classifier, confidence score,
12
+ * source provenance, and temporal span metadata.
13
+ *
14
+ * @module agentos/memory/observation/ObservationReflector
15
+ */
16
+ import type { CompressedObservation } from './ObservationCompressor.js';
17
+ /** The kind of pattern identified by the reflector. */
18
+ export type ReflectionPatternType = 'preference' | 'behavior' | 'capability' | 'relationship' | 'goal';
19
+ /**
20
+ * A high-level insight derived from multiple compressed observations.
21
+ * Reflections are the highest tier in the observation hierarchy:
22
+ * raw notes → compressed observations → reflections.
23
+ */
24
+ export interface Reflection {
25
+ /** Unique identifier for this reflection. */
26
+ id: string;
27
+ /** High-level insight text (1-3 sentences). */
28
+ insight: string;
29
+ /** Pattern type classifier. */
30
+ patternType: ReflectionPatternType;
31
+ /** Confidence in this reflection (0-1). */
32
+ confidence: number;
33
+ /** IDs of the source compressed observations. */
34
+ sourceIds: string[];
35
+ /** Temporal span covered by this reflection. */
36
+ temporal: {
37
+ /** When this reflection was produced (Unix ms). */
38
+ reflectedAt: number;
39
+ /** Earliest source timestamp in the compressed observations (Unix ms). */
40
+ spanStart: number;
41
+ /** Latest source timestamp in the compressed observations (Unix ms). */
42
+ spanEnd: number;
43
+ /** Human-friendly label for the temporal span. */
44
+ relativeLabel: string;
45
+ };
46
+ }
47
+ /**
48
+ * Condenses compressed observations into higher-level reflections.
49
+ *
50
+ * Runs when accumulated compressed observations exceed 40,000 tokens
51
+ * (configurable). Each reflection captures a long-lived pattern such as
52
+ * a user preference, behavioral habit, capability, relationship dynamic,
53
+ * or goal.
54
+ */
55
+ export declare class ObservationReflector {
56
+ private llmInvoker;
57
+ /**
58
+ * @param llmInvoker - Function that calls an LLM with (system, user) prompts.
59
+ */
60
+ constructor(llmInvoker: (system: string, user: string) => Promise<string>);
61
+ /**
62
+ * Reflect on compressed observations to extract higher-level patterns.
63
+ *
64
+ * @param observations - Compressed observations to reflect on.
65
+ * @returns Array of reflections. Returns empty array on LLM failure.
66
+ */
67
+ reflect(observations: CompressedObservation[]): Promise<Reflection[]>;
68
+ /**
69
+ * Parse the LLM response into Reflection objects.
70
+ */
71
+ private parseReflections;
72
+ /**
73
+ * Build a human-friendly label describing a temporal span.
74
+ *
75
+ * @param start - Earliest timestamp in the span (Unix ms).
76
+ * @param end - Latest timestamp in the span (Unix ms).
77
+ * @param now - Current reference time (Unix ms).
78
+ * @returns Label such as "over the past week" or "over the past 3 days".
79
+ */
80
+ private buildSpanLabel;
81
+ }
82
+ //# sourceMappingURL=ObservationReflector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObservationReflector.d.ts","sourceRoot":"","sources":["../../../src/memory/observation/ObservationReflector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAOxE,uDAAuD;AACvD,MAAM,MAAM,qBAAqB,GAC7B,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,cAAc,GACd,MAAM,CAAC;AAEX;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,WAAW,EAAE,qBAAqB,CAAC;IACnC,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gDAAgD;IAChD,QAAQ,EAAE;QACR,mDAAmD;QACnD,WAAW,EAAE,MAAM,CAAC;QACpB,0EAA0E;QAC1E,SAAS,EAAE,MAAM,CAAC;QAClB,wEAAwE;QACxE,OAAO,EAAE,MAAM,CAAC;QAChB,kDAAkD;QAClD,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAsCD;;;;;;;GAOG;AACH,qBAAa,oBAAoB;IAK7B,OAAO,CAAC,UAAU;IAJpB;;OAEG;gBAEO,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;IAGvE;;;;;OAKG;IACG,OAAO,CAAC,YAAY,EAAE,qBAAqB,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAwB3E;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAgGxB;;;;;;;OAOG;IACH,OAAO,CAAC,cAAc;CA2BvB"}
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @fileoverview Higher-level reflector that condenses compressed observations
3
+ * into reflections — long-lived insights about user patterns, preferences,
4
+ * capabilities, relationships, and goals.
5
+ *
6
+ * This is the "Reflector" agent in Mastra's agentic memory model. It runs
7
+ * when compressed observations exceed a configurable token threshold
8
+ * (default: 40,000 tokens) and extracts higher-level patterns that transcend
9
+ * individual conversation turns.
10
+ *
11
+ * Each {@link Reflection} carries a pattern type classifier, confidence score,
12
+ * source provenance, and temporal span metadata.
13
+ *
14
+ * @module agentos/memory/observation/ObservationReflector
15
+ */
16
+ import { relativeTimeLabel } from './temporal.js';
17
+ // ---------------------------------------------------------------------------
18
+ // System prompt
19
+ // ---------------------------------------------------------------------------
20
+ function buildReflectorSystemPrompt() {
21
+ return `You are a memory reflector. Your task is to analyze compressed observation summaries and extract higher-level patterns and insights.
22
+
23
+ Rules:
24
+ 1. Look for recurring themes, preferences, behavioral patterns, capabilities, relationships, and goals.
25
+ 2. Each reflection should be a high-level insight that transcends individual observations (1-3 sentences).
26
+ 3. Assign a pattern type: "preference" (likes/dislikes, style choices), "behavior" (recurring actions, habits), "capability" (skills, knowledge domains), "relationship" (interpersonal dynamics), or "goal" (objectives, intentions, aspirations).
27
+ 4. Assign a confidence score 0.0-1.0 (how confident are you in this pattern?).
28
+ 5. Include the IDs of the compressed observations that support each reflection.
29
+ 6. Aim for high-value insights that would be useful for future interactions.
30
+
31
+ Output a JSON array of objects:
32
+ {
33
+ "insight": "high-level insight text",
34
+ "patternType": "preference|behavior|capability|relationship|goal",
35
+ "confidence": 0.0-1.0,
36
+ "sourceIds": ["cobs_id_1", "cobs_id_2"]
37
+ }
38
+
39
+ Output ONLY a valid JSON array. No markdown, no explanation.`;
40
+ }
41
+ // ---------------------------------------------------------------------------
42
+ // Counter for unique IDs
43
+ // ---------------------------------------------------------------------------
44
+ let reflectionIdCounter = 0;
45
+ // ---------------------------------------------------------------------------
46
+ // ObservationReflector
47
+ // ---------------------------------------------------------------------------
48
+ /**
49
+ * Condenses compressed observations into higher-level reflections.
50
+ *
51
+ * Runs when accumulated compressed observations exceed 40,000 tokens
52
+ * (configurable). Each reflection captures a long-lived pattern such as
53
+ * a user preference, behavioral habit, capability, relationship dynamic,
54
+ * or goal.
55
+ */
56
+ export class ObservationReflector {
57
+ /**
58
+ * @param llmInvoker - Function that calls an LLM with (system, user) prompts.
59
+ */
60
+ constructor(llmInvoker) {
61
+ this.llmInvoker = llmInvoker;
62
+ }
63
+ /**
64
+ * Reflect on compressed observations to extract higher-level patterns.
65
+ *
66
+ * @param observations - Compressed observations to reflect on.
67
+ * @returns Array of reflections. Returns empty array on LLM failure.
68
+ */
69
+ async reflect(observations) {
70
+ if (observations.length === 0)
71
+ return [];
72
+ const systemPrompt = buildReflectorSystemPrompt();
73
+ // Format compressed observations for the LLM.
74
+ const userPrompt = observations
75
+ .map((o) => `[${o.id}] (priority=${o.priority}, importance=${o.importance.toFixed(2)}, ref=${o.temporal.relativeLabel}) ${o.summary}`)
76
+ .join('\n');
77
+ try {
78
+ const response = await this.llmInvoker(systemPrompt, userPrompt);
79
+ return this.parseReflections(response, observations);
80
+ }
81
+ catch {
82
+ return [];
83
+ }
84
+ }
85
+ // -------------------------------------------------------------------------
86
+ // Internal parsing
87
+ // -------------------------------------------------------------------------
88
+ /**
89
+ * Parse the LLM response into Reflection objects.
90
+ */
91
+ parseReflections(llmResponse, sourceObservations) {
92
+ const now = Date.now();
93
+ const obsMap = new Map(sourceObservations.map((o) => [o.id, o]));
94
+ const results = [];
95
+ // Try parsing as a JSON array first.
96
+ let parsed;
97
+ try {
98
+ const cleaned = llmResponse
99
+ .replace(/^```json\s*/i, '')
100
+ .replace(/```\s*$/, '')
101
+ .trim();
102
+ parsed = JSON.parse(cleaned);
103
+ if (!Array.isArray(parsed)) {
104
+ parsed = [parsed];
105
+ }
106
+ }
107
+ catch {
108
+ // Fallback: try parsing line by line.
109
+ parsed = [];
110
+ for (const line of llmResponse.split('\n')) {
111
+ const trimmed = line.trim();
112
+ if (!trimmed || trimmed === '[' || trimmed === ']')
113
+ continue;
114
+ try {
115
+ const clean = trimmed.endsWith(',') ? trimmed.slice(0, -1) : trimmed;
116
+ parsed.push(JSON.parse(clean));
117
+ }
118
+ catch {
119
+ // Skip malformed lines.
120
+ }
121
+ }
122
+ }
123
+ for (const item of parsed) {
124
+ if (typeof item !== 'object' || item === null)
125
+ continue;
126
+ const obj = item;
127
+ if (typeof obj.insight !== 'string' || !obj.insight)
128
+ continue;
129
+ const validPatternTypes = [
130
+ 'preference', 'behavior', 'capability', 'relationship', 'goal',
131
+ ];
132
+ const patternType = validPatternTypes.includes(obj.patternType)
133
+ ? obj.patternType
134
+ : 'behavior';
135
+ const confidence = typeof obj.confidence === 'number'
136
+ ? Math.max(0, Math.min(1, obj.confidence))
137
+ : 0.5;
138
+ const sourceIds = Array.isArray(obj.sourceIds)
139
+ ? obj.sourceIds.filter((id) => typeof id === 'string')
140
+ : [];
141
+ // Compute temporal span from source compressed observations.
142
+ const sourceTimes = [];
143
+ for (const id of sourceIds) {
144
+ const obs = obsMap.get(id);
145
+ if (obs) {
146
+ sourceTimes.push(obs.temporal.referencedAt);
147
+ sourceTimes.push(obs.temporal.observedAt);
148
+ }
149
+ }
150
+ // Fallback: use all observations if no specific sources matched.
151
+ if (sourceTimes.length === 0) {
152
+ for (const obs of sourceObservations) {
153
+ sourceTimes.push(obs.temporal.referencedAt);
154
+ sourceTimes.push(obs.temporal.observedAt);
155
+ }
156
+ }
157
+ const spanStart = sourceTimes.length > 0 ? Math.min(...sourceTimes) : now;
158
+ const spanEnd = sourceTimes.length > 0 ? Math.max(...sourceTimes) : now;
159
+ // Build a human-friendly span label.
160
+ const spanLabel = this.buildSpanLabel(spanStart, spanEnd, now);
161
+ results.push({
162
+ id: `refl_${Date.now()}_${++reflectionIdCounter}`,
163
+ insight: obj.insight,
164
+ patternType,
165
+ confidence,
166
+ sourceIds,
167
+ temporal: {
168
+ reflectedAt: now,
169
+ spanStart,
170
+ spanEnd,
171
+ relativeLabel: spanLabel,
172
+ },
173
+ });
174
+ }
175
+ return results;
176
+ }
177
+ /**
178
+ * Build a human-friendly label describing a temporal span.
179
+ *
180
+ * @param start - Earliest timestamp in the span (Unix ms).
181
+ * @param end - Latest timestamp in the span (Unix ms).
182
+ * @param now - Current reference time (Unix ms).
183
+ * @returns Label such as "over the past week" or "over the past 3 days".
184
+ */
185
+ buildSpanLabel(start, end, now) {
186
+ const spanMs = end - start;
187
+ const ageMs = now - start;
188
+ const DAY = 24 * 60 * 60 * 1000;
189
+ const WEEK = 7 * DAY;
190
+ // If the span is very short (< 1 day), use the relative label for start.
191
+ if (spanMs < DAY) {
192
+ return relativeTimeLabel(start, now);
193
+ }
194
+ const ageDays = Math.floor(ageMs / DAY);
195
+ if (ageDays <= 1)
196
+ return 'over the past day';
197
+ if (ageDays <= 7)
198
+ return `over the past ${ageDays} days`;
199
+ if (ageDays <= 14)
200
+ return 'over the past week';
201
+ const ageWeeks = Math.floor(ageMs / WEEK);
202
+ if (ageWeeks <= 4)
203
+ return `over the past ${ageWeeks} weeks`;
204
+ const ageMonths = Math.floor(ageDays / 30);
205
+ if (ageMonths <= 1)
206
+ return 'over the past month';
207
+ if (ageMonths <= 12)
208
+ return `over the past ${ageMonths} months`;
209
+ return `over the past ${Math.floor(ageDays / 365)} years`;
210
+ }
211
+ }
212
+ //# sourceMappingURL=ObservationReflector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObservationReflector.js","sourceRoot":"","sources":["../../../src/memory/observation/ObservationReflector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2ClD,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E,SAAS,0BAA0B;IACjC,OAAO;;;;;;;;;;;;;;;;;;6DAkBoD,CAAC;AAC9D,CAAC;AAED,8EAA8E;AAC9E,yBAAyB;AACzB,8EAA8E;AAE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G,CAAC;QAErB,yEAAyE;QACzE,IAAI,MAAM,GAAG,GAAG,EAAE,CAAC;YACjB,OAAO,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACvC,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;QAExC,IAAI,OAAO,IAAI,CAAC;YAAE,OAAO,mBAAmB,CAAC;QAC7C,IAAI,OAAO,IAAI,CAAC;YAAE,OAAO,iBAAiB,OAAO,OAAO,CAAC;QACzD,IAAI,OAAO,IAAI,EAAE;YAAE,OAAO,oBAAoB,CAAC;QAE/C,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC1C,IAAI,QAAQ,IAAI,CAAC;YAAE,OAAO,iBAAiB,QAAQ,QAAQ,CAAC;QAE5D,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;QAC3C,IAAI,SAAS,IAAI,CAAC;YAAE,OAAO,qBAAqB,CAAC;QACjD,IAAI,SAAS,IAAI,EAAE;YAAE,OAAO,iBAAiB,SAAS,SAAS,CAAC;QAEhE,OAAO,iBAAiB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC5D,CAAC;CACF"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @fileoverview Temporal reasoning utilities for the observation system.
3
+ *
4
+ * Provides a three-date model (observedAt, referencedAt, relativeLabel) and a
5
+ * human-friendly `relativeTimeLabel()` function that converts Unix-ms timestamps
6
+ * into natural-language labels such as "just now", "earlier today", "last Tuesday",
7
+ * "3 days ago", "last week", etc.
8
+ *
9
+ * @module agentos/memory/observation/temporal
10
+ */
11
+ /**
12
+ * Three-date temporal model attached to memory traces.
13
+ *
14
+ * - `referencedAt` — when the event the memory refers to actually occurred.
15
+ * - `relativeLabel` — human-friendly relative time description.
16
+ * - `span` — optional time range if the memory covers a period.
17
+ */
18
+ export interface TemporalMetadata {
19
+ /** When the event this memory refers to actually happened (Unix ms). */
20
+ referencedAt?: number;
21
+ /** Human-friendly relative time label, e.g. "last Tuesday". */
22
+ relativeLabel?: string;
23
+ /** Time span if this covers a period: [startMs, endMs]. */
24
+ span?: [number, number];
25
+ }
26
+ /**
27
+ * Produce a human-friendly label describing how long ago `timestamp` was
28
+ * relative to `now` (defaults to `Date.now()`).
29
+ *
30
+ * Examples:
31
+ * - "just now" (< 60 s)
32
+ * - "5 minutes ago" (< 1 h)
33
+ * - "2 hours ago" (< today boundary, but > 1 h)
34
+ * - "earlier today" (same calendar day, > 1 h)
35
+ * - "yesterday" (previous calendar day)
36
+ * - "last Tuesday" (2-6 days ago, uses day name)
37
+ * - "3 days ago" (2-6 days ago, alternative when day name would be confusing)
38
+ * - "last week" (7-13 days)
39
+ * - "2 weeks ago" (14-20 days)
40
+ * - "3 weeks ago" (21-27 days)
41
+ * - "last month" (28-59 days)
42
+ * - "2 months ago" (60-89 days)
43
+ * - "N months ago" (90-364 days)
44
+ * - "last year" (365-729 days)
45
+ * - "N years ago" (730+ days)
46
+ *
47
+ * Future timestamps return "in the future".
48
+ *
49
+ * @param timestamp - Unix ms timestamp to describe.
50
+ * @param now - Reference timestamp (defaults to Date.now()).
51
+ * @returns Human-friendly relative time string.
52
+ */
53
+ export declare function relativeTimeLabel(timestamp: number, now?: number): string;
54
+ //# sourceMappingURL=temporal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal.d.ts","sourceRoot":"","sources":["../../../src/memory/observation/temporal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wEAAwE;IACxE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzB;AAeD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CA8EzE"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * @fileoverview Temporal reasoning utilities for the observation system.
3
+ *
4
+ * Provides a three-date model (observedAt, referencedAt, relativeLabel) and a
5
+ * human-friendly `relativeTimeLabel()` function that converts Unix-ms timestamps
6
+ * into natural-language labels such as "just now", "earlier today", "last Tuesday",
7
+ * "3 days ago", "last week", etc.
8
+ *
9
+ * @module agentos/memory/observation/temporal
10
+ */
11
+ // ---------------------------------------------------------------------------
12
+ // Day-of-week names
13
+ // ---------------------------------------------------------------------------
14
+ const DAY_NAMES = [
15
+ 'Sunday', 'Monday', 'Tuesday', 'Wednesday',
16
+ 'Thursday', 'Friday', 'Saturday',
17
+ ];
18
+ // ---------------------------------------------------------------------------
19
+ // relativeTimeLabel
20
+ // ---------------------------------------------------------------------------
21
+ /**
22
+ * Produce a human-friendly label describing how long ago `timestamp` was
23
+ * relative to `now` (defaults to `Date.now()`).
24
+ *
25
+ * Examples:
26
+ * - "just now" (< 60 s)
27
+ * - "5 minutes ago" (< 1 h)
28
+ * - "2 hours ago" (< today boundary, but > 1 h)
29
+ * - "earlier today" (same calendar day, > 1 h)
30
+ * - "yesterday" (previous calendar day)
31
+ * - "last Tuesday" (2-6 days ago, uses day name)
32
+ * - "3 days ago" (2-6 days ago, alternative when day name would be confusing)
33
+ * - "last week" (7-13 days)
34
+ * - "2 weeks ago" (14-20 days)
35
+ * - "3 weeks ago" (21-27 days)
36
+ * - "last month" (28-59 days)
37
+ * - "2 months ago" (60-89 days)
38
+ * - "N months ago" (90-364 days)
39
+ * - "last year" (365-729 days)
40
+ * - "N years ago" (730+ days)
41
+ *
42
+ * Future timestamps return "in the future".
43
+ *
44
+ * @param timestamp - Unix ms timestamp to describe.
45
+ * @param now - Reference timestamp (defaults to Date.now()).
46
+ * @returns Human-friendly relative time string.
47
+ */
48
+ export function relativeTimeLabel(timestamp, now) {
49
+ const reference = now ?? Date.now();
50
+ const diffMs = reference - timestamp;
51
+ // Future timestamps
52
+ if (diffMs < 0)
53
+ return 'in the future';
54
+ const SECOND = 1000;
55
+ const MINUTE = 60 * SECOND;
56
+ const HOUR = 60 * MINUTE;
57
+ const DAY = 24 * HOUR;
58
+ // Just now (< 60 seconds)
59
+ if (diffMs < MINUTE)
60
+ return 'just now';
61
+ // Minutes ago (< 1 hour)
62
+ if (diffMs < HOUR) {
63
+ const mins = Math.floor(diffMs / MINUTE);
64
+ return mins === 1 ? '1 minute ago' : `${mins} minutes ago`;
65
+ }
66
+ // Check calendar-day boundaries for "earlier today" / "yesterday"
67
+ const nowDate = new Date(reference);
68
+ const tsDate = new Date(timestamp);
69
+ const isSameDay = nowDate.getFullYear() === tsDate.getFullYear() &&
70
+ nowDate.getMonth() === tsDate.getMonth() &&
71
+ nowDate.getDate() === tsDate.getDate();
72
+ if (isSameDay) {
73
+ const hours = Math.floor(diffMs / HOUR);
74
+ if (hours < 2)
75
+ return '1 hour ago';
76
+ return 'earlier today';
77
+ }
78
+ // Yesterday check (previous calendar day)
79
+ const yesterday = new Date(reference);
80
+ yesterday.setDate(yesterday.getDate() - 1);
81
+ const isYesterday = yesterday.getFullYear() === tsDate.getFullYear() &&
82
+ yesterday.getMonth() === tsDate.getMonth() &&
83
+ yesterday.getDate() === tsDate.getDate();
84
+ if (isYesterday)
85
+ return 'yesterday';
86
+ const diffDays = Math.floor(diffMs / DAY);
87
+ // 2-6 days ago — use day name ("last Tuesday")
88
+ if (diffDays >= 2 && diffDays <= 6) {
89
+ const dayName = DAY_NAMES[tsDate.getDay()];
90
+ return `last ${dayName}`;
91
+ }
92
+ // 7-13 days — "last week"
93
+ if (diffDays >= 7 && diffDays <= 13)
94
+ return 'last week';
95
+ // 14-27 days — "N weeks ago"
96
+ if (diffDays >= 14 && diffDays <= 27) {
97
+ const weeks = Math.floor(diffDays / 7);
98
+ return `${weeks} weeks ago`;
99
+ }
100
+ // 28-59 days — "last month"
101
+ if (diffDays >= 28 && diffDays <= 59)
102
+ return 'last month';
103
+ // 60-364 days — "N months ago"
104
+ if (diffDays >= 60 && diffDays <= 364) {
105
+ const months = Math.floor(diffDays / 30);
106
+ return months === 1 ? '1 month ago' : `${months} months ago`;
107
+ }
108
+ // 365-729 days — "last year"
109
+ if (diffDays >= 365 && diffDays <= 729)
110
+ return 'last year';
111
+ // 730+ days — "N years ago"
112
+ const years = Math.floor(diffDays / 365);
113
+ return `${years} years ago`;
114
+ }
115
+ //# sourceMappingURL=temporal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"temporal.js","sourceRoot":"","sources":["../../../src/memory/observation/temporal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAsBH,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E,MAAM,SAAS,GAAG;IAChB,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW;IAC1C,UAAU,EAAE,QAAQ,EAAE,UAAU;CACxB,CAAC;AAEX,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,GAAY;IAC/D,MAAM,SAAS,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;IACpC,MAAM,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAErC,oBAAoB;IACpB,IAAI,MAAM,GAAG,CAAC;QAAE,OAAO,eAAe,CAAC;IAEvC,MAAM,MAAM,GAAG,IAAK,CAAC;IACrB,MAAM,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC;IAC3B,MAAM,IAAI,GAAG,EAAE,GAAG,MAAM,CAAC;IACzB,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC;IAEtB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