@theronap/cortex-mcp 0.9.144 → 0.9.145

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.
@@ -173,6 +173,9 @@ const OBLIGATIONS_FRAGMENT =
173
173
  '"due_at" (a DATE, YYYY-MM-DD, when only a day is stated; a date-time, YYYY-MM-DDTHH:MM, ONLY when a ' +
174
174
  'time of day is actually said; otherwise null — do NOT invent or infer a date or a time that was not ' +
175
175
  'said. A day with no time is kept as a bare date and treated as all-day), ' +
176
+ '"due_phrase" (the exact words that say WHEN it is due — "on the 15th", "by Tuesday the 22nd", ' +
177
+ '"Saturday", "by 5 pm tomorrow" — copied VERBATIM from the evidence sentence; null if the evidence ' +
178
+ 'names no time. The date itself is worked out from these words, so copy them, do not rephrase), ' +
176
179
  '"evidence" (the sentence from the session that says so, copied EXACTLY and VERBATIM — it is ' +
177
180
  'checked against the transcript and the whole item is discarded if it does not match), ' +
178
181
  '"obligated_party" (exactly one of: "self" if the person whose session this is must do it; ' +
@@ -180,6 +183,9 @@ const OBLIGATIONS_FRAGMENT =
180
183
  'The hard part is "none", so read it carefully: a real date about a real person is still "none" ' +
181
184
  'when nobody owes anything — "so-and-so\'s birthday is today" has every surface feature of a ' +
182
185
  'deadline and is not one. Historical and course-content dates are "none" too. ' +
186
+ 'If the SAME item is given a deadline more than once, or its deadline is changed later ("due ' +
187
+ 'Saturday", then later "actually, plan on Tuesday the 22nd"), report it ONCE, using the LAST statement ' +
188
+ 'for its evidence, due_phrase and due_at. ' +
183
189
  'Include an item when the session genuinely states an obligation, and do not stretch to find one; ' +
184
190
  'an empty array is correct for a session that contains no deadlines.)'
185
191
 
@@ -279,6 +285,8 @@ export function verbatimIn(needle, haystack) {
279
285
  * `obligated_party` outside the preset is malformed and goes — the server's CHECK constraint would
280
286
  * reject it anyway, and failing here means the record still lands with its other keys intact.
281
287
  */
288
+ const normWs = (x) => x.toLowerCase().replace(/[’']/g, '').replace(/\s+/g, ' ').trim()
289
+
282
290
  export function keepVerifiableObligations(items, shown) {
283
291
  if (!Array.isArray(items)) return []
284
292
  const out = []
@@ -290,7 +298,17 @@ export function keepVerifiableObligations(items, shown) {
290
298
  if (!subject || !evidence || !OBLIGATION_PARTIES.has(party)) continue
291
299
  if (!verbatimIn(evidence, shown)) continue
292
300
  const due = typeof it.due_at === 'string' && it.due_at.trim() ? it.due_at.trim() : null
293
- out.push({ subject: subject.slice(0, 200), due_at: due, evidence: evidence.slice(0, 500), obligated_party: party })
301
+ // ADR-0059 §5.2: the WHEN words, which the server resolves into a date in code. Kept only if they
302
+ // appear inside the evidence sentence — the check that stops a paraphrase ("Sept 22" for "the
303
+ // 22nd") or a phrase from some other sentence from deciding the date. Dropped otherwise: the server
304
+ // then falls back to due_at, exactly as it did before phrases existed.
305
+ const phraseRaw = typeof it.due_phrase === 'string' ? it.due_phrase.trim() : ''
306
+ const due_phrase = phraseRaw && normWs(evidence).includes(normWs(phraseRaw)) ? phraseRaw.slice(0, 120) : null
307
+ out.push({
308
+ subject: subject.slice(0, 200), due_at: due,
309
+ ...(due_phrase ? { due_phrase } : {}),
310
+ evidence: evidence.slice(0, 500), obligated_party: party,
311
+ })
294
312
  if (out.length >= MAX_OBLIGATIONS) break
295
313
  }
296
314
  return out
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.144",
3
+ "version": "0.9.145",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {