@maximem/synap-js-sdk 0.5.6 → 0.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -374,6 +374,16 @@ interface RawContextItem {
374
374
  extracted_at?: string | null;
375
375
  metadata?: Json;
376
376
  event_date?: string | null;
377
+ /**
378
+ * The day the words were SAID, which is not the day the event happened.
379
+ *
380
+ * `event_date` is empty unless somebody stated when the event took place, so
381
+ * without this field beside it an item whose turn stated no event date
382
+ * arrives with no machine-readable date at all. Empty when the client never
383
+ * told the server when the conversation happened; it is never the server's
384
+ * own ingest or extraction clock.
385
+ */
386
+ said_at?: string | null;
377
387
  valid_until?: string | null;
378
388
  temporal_category?: string | null;
379
389
  temporal_confidence?: number;
@@ -383,6 +393,15 @@ interface RawContextItem {
383
393
  * served from the prefetch cache.
384
394
  */
385
395
  matched_queries?: string[];
396
+ /**
397
+ * Anything the server sends that this SDK version has no named field for.
398
+ *
399
+ * This index signature already made unknown keys reachable in the TYPE; what
400
+ * dropped them was the normaliser, which built each item from a hand-picked
401
+ * list of keys. So `event_end` and `event_precision` were computed by the
402
+ * server, dropped by its own payload, and dropped a third time here, and a
403
+ * caller could not read "sometime in April" even once the server sent it.
404
+ */
386
405
  [key: string]: unknown;
387
406
  }
388
407
  interface RawConversationContext {
@@ -409,6 +428,27 @@ interface RawContext {
409
428
  }
410
429
  interface TemporalFields {
411
430
  eventDate: string | null;
431
+ /**
432
+ * The rest of the event window. `eventDate` is its START.
433
+ *
434
+ * "last month" is stored as 2023-04-01 to 2023-04-30 at precision "month",
435
+ * and reading only the start makes it look like the 1st, so arithmetic from
436
+ * it is wrong by up to the width of the window. `eventPrecision` carries the
437
+ * one distinction nothing else does: "approximate" has no end, so "around
438
+ * November 20" and "on November 20" differ only by this label.
439
+ */
440
+ eventEnd: string | null;
441
+ eventPrecision: string | null;
442
+ /**
443
+ * The day the words were SAID, which is not the day the event happened.
444
+ *
445
+ * `event_date` is empty unless somebody stated when the event took place, so
446
+ * without this field beside it an item whose turn stated no event date
447
+ * arrives with no machine-readable date at all. Empty when the client never
448
+ * told the server when the conversation happened; it is never the server's
449
+ * own ingest or extraction clock.
450
+ */
451
+ saidAt: string | null;
412
452
  validUntil: string | null;
413
453
  temporalCategory: string | null;
414
454
  temporalConfidence: number;
@@ -458,6 +498,11 @@ interface TemporalEvent extends QueryAttribution {
458
498
  id: string;
459
499
  content: string;
460
500
  eventDate: string | null;
501
+ /** The rest of the window. See the note on `TemporalFields.eventEnd`. */
502
+ eventEnd: string | null;
503
+ eventPrecision: string | null;
504
+ /** See the note on `TemporalFields.saidAt`. */
505
+ saidAt: string | null;
461
506
  validUntil: string | null;
462
507
  /**
463
508
  * Nullable despite the `''` default in the normaliser: `pickDefined` skips
@@ -595,6 +640,8 @@ interface FlatMemory {
595
640
  metadata: Json;
596
641
  context_type: 'fact' | 'preference' | 'episode' | 'emotion' | 'temporal_event';
597
642
  event_date: string | null;
643
+ /** See `TemporalFields.saidAt` in ./types. */
644
+ said_at: string | null;
598
645
  valid_until: string | null;
599
646
  temporal_category: string | null;
600
647
  temporal_confidence: number;
@@ -1654,7 +1701,7 @@ declare class SynapClient {
1654
1701
  * build when the two disagree, which is the only thing that makes a manual
1655
1702
  * publish safe.
1656
1703
  */
1657
- declare const SDK_VERSION = "0.5.6";
1704
+ declare const SDK_VERSION = "0.5.8";
1658
1705
 
1659
1706
  /**
1660
1707
  * BM25 scorer for the anticipation cache.
package/dist/index.d.ts CHANGED
@@ -374,6 +374,16 @@ interface RawContextItem {
374
374
  extracted_at?: string | null;
375
375
  metadata?: Json;
376
376
  event_date?: string | null;
377
+ /**
378
+ * The day the words were SAID, which is not the day the event happened.
379
+ *
380
+ * `event_date` is empty unless somebody stated when the event took place, so
381
+ * without this field beside it an item whose turn stated no event date
382
+ * arrives with no machine-readable date at all. Empty when the client never
383
+ * told the server when the conversation happened; it is never the server's
384
+ * own ingest or extraction clock.
385
+ */
386
+ said_at?: string | null;
377
387
  valid_until?: string | null;
378
388
  temporal_category?: string | null;
379
389
  temporal_confidence?: number;
@@ -383,6 +393,15 @@ interface RawContextItem {
383
393
  * served from the prefetch cache.
384
394
  */
385
395
  matched_queries?: string[];
396
+ /**
397
+ * Anything the server sends that this SDK version has no named field for.
398
+ *
399
+ * This index signature already made unknown keys reachable in the TYPE; what
400
+ * dropped them was the normaliser, which built each item from a hand-picked
401
+ * list of keys. So `event_end` and `event_precision` were computed by the
402
+ * server, dropped by its own payload, and dropped a third time here, and a
403
+ * caller could not read "sometime in April" even once the server sent it.
404
+ */
386
405
  [key: string]: unknown;
387
406
  }
388
407
  interface RawConversationContext {
@@ -409,6 +428,27 @@ interface RawContext {
409
428
  }
410
429
  interface TemporalFields {
411
430
  eventDate: string | null;
431
+ /**
432
+ * The rest of the event window. `eventDate` is its START.
433
+ *
434
+ * "last month" is stored as 2023-04-01 to 2023-04-30 at precision "month",
435
+ * and reading only the start makes it look like the 1st, so arithmetic from
436
+ * it is wrong by up to the width of the window. `eventPrecision` carries the
437
+ * one distinction nothing else does: "approximate" has no end, so "around
438
+ * November 20" and "on November 20" differ only by this label.
439
+ */
440
+ eventEnd: string | null;
441
+ eventPrecision: string | null;
442
+ /**
443
+ * The day the words were SAID, which is not the day the event happened.
444
+ *
445
+ * `event_date` is empty unless somebody stated when the event took place, so
446
+ * without this field beside it an item whose turn stated no event date
447
+ * arrives with no machine-readable date at all. Empty when the client never
448
+ * told the server when the conversation happened; it is never the server's
449
+ * own ingest or extraction clock.
450
+ */
451
+ saidAt: string | null;
412
452
  validUntil: string | null;
413
453
  temporalCategory: string | null;
414
454
  temporalConfidence: number;
@@ -458,6 +498,11 @@ interface TemporalEvent extends QueryAttribution {
458
498
  id: string;
459
499
  content: string;
460
500
  eventDate: string | null;
501
+ /** The rest of the window. See the note on `TemporalFields.eventEnd`. */
502
+ eventEnd: string | null;
503
+ eventPrecision: string | null;
504
+ /** See the note on `TemporalFields.saidAt`. */
505
+ saidAt: string | null;
461
506
  validUntil: string | null;
462
507
  /**
463
508
  * Nullable despite the `''` default in the normaliser: `pickDefined` skips
@@ -595,6 +640,8 @@ interface FlatMemory {
595
640
  metadata: Json;
596
641
  context_type: 'fact' | 'preference' | 'episode' | 'emotion' | 'temporal_event';
597
642
  event_date: string | null;
643
+ /** See `TemporalFields.saidAt` in ./types. */
644
+ said_at: string | null;
598
645
  valid_until: string | null;
599
646
  temporal_category: string | null;
600
647
  temporal_confidence: number;
@@ -1654,7 +1701,7 @@ declare class SynapClient {
1654
1701
  * build when the two disagree, which is the only thing that makes a manual
1655
1702
  * publish safe.
1656
1703
  */
1657
- declare const SDK_VERSION = "0.5.6";
1704
+ declare const SDK_VERSION = "0.5.8";
1658
1705
 
1659
1706
  /**
1660
1707
  * BM25 scorer for the anticipation cache.
package/dist/index.js CHANGED
@@ -638,6 +638,9 @@ function matchedQueries(item = {}) {
638
638
  function normalizeTemporalFields(item = {}) {
639
639
  return {
640
640
  eventDate: pick(item["eventDate"], item.event_date, null),
641
+ eventEnd: pick(item["eventEnd"], item.event_end, null),
642
+ eventPrecision: pick(item["eventPrecision"], item.event_precision, null),
643
+ saidAt: pick(item["saidAt"], item.said_at, null),
641
644
  validUntil: pick(item["validUntil"], item.valid_until, null),
642
645
  temporalCategory: pick(item["temporalCategory"], item.temporal_category, null),
643
646
  temporalConfidence: pick(item["temporalConfidence"], item.temporal_confidence, 0)
@@ -697,6 +700,9 @@ function normalizeTemporalEvent(item = {}) {
697
700
  id: item.id || "",
698
701
  content: item.content || "",
699
702
  eventDate: pick(item["eventDate"], item.event_date, null),
703
+ eventEnd: pick(item["eventEnd"], item.event_end, null),
704
+ eventPrecision: pick(item["eventPrecision"], item.event_precision, null),
705
+ saidAt: pick(item["saidAt"], item.said_at, null),
700
706
  validUntil: pick(item["validUntil"], item.valid_until, null),
701
707
  temporalCategory: pick(item["temporalCategory"], item.temporal_category, ""),
702
708
  temporalConfidence: pick(item["temporalConfidence"], item.temporal_confidence, 0),
@@ -760,6 +766,7 @@ var dt = (v) => v ? String(v) : null;
760
766
  function temporal(item) {
761
767
  return {
762
768
  event_date: dt(item["event_date"]),
769
+ said_at: dt(item["said_at"]),
763
770
  valid_until: dt(item["valid_until"]),
764
771
  temporal_category: item["temporal_category"] ?? null,
765
772
  temporal_confidence: n(item["temporal_confidence"], 0)
@@ -1511,7 +1518,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1511
1518
  if (client !== null) {
1512
1519
  throw new ListeningAlreadyActiveError("Listening is already active on this instance");
1513
1520
  }
1514
- const { GrpcStreamClient } = await import("./stream-client-Y5NFAMIH.js");
1521
+ const { GrpcStreamClient } = await import("./stream-client-VWKINE47.js");
1515
1522
  const onContext = options.on_context ?? options.onContext;
1516
1523
  const onDisconnect = options.on_disconnect ?? options.onDisconnect;
1517
1524
  const onReconnect = options.on_reconnect ?? options.onReconnect;
@@ -1683,7 +1690,7 @@ function createInstanceNamespace(credentials, cache, onTurn) {
1683
1690
  }
1684
1691
 
1685
1692
  // src/version.ts
1686
- var SDK_VERSION = "0.5.6";
1693
+ var SDK_VERSION = "0.5.8";
1687
1694
 
1688
1695
  // src/registry.ts
1689
1696
  var instances = /* @__PURE__ */ new Map();
@@ -2112,6 +2119,7 @@ function normalise(item) {
2112
2119
  detected_at: pick2(item, "detected_at", "extracted_at", "created_at") ?? null,
2113
2120
  metadata: pick2(item, "metadata") ?? {},
2114
2121
  event_date: pick2(item, "event_date") ?? null,
2122
+ said_at: pick2(item, "said_at") ?? null,
2115
2123
  valid_until: pick2(item, "valid_until") ?? null,
2116
2124
  temporal_category: pick2(item, "temporal_category") ?? null,
2117
2125
  temporal_confidence: Number(pick2(item, "temporal_confidence") ?? 0)