@open-tomato/rafa 0.34.1 → 0.35.0

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.
@@ -1,11 +1,11 @@
1
1
  // @bun
2
2
  import {
3
- CONFIDENCE_MAX,
4
- CONFIDENCE_MIN,
5
- GAP,
6
- SOURCE_STEP,
7
- triggerKey
8
- } from "./index-wp8c28fd.js";
3
+ GAP2,
4
+ SOURCE_STEP2,
5
+ CONFIDENCE_MIN2,
6
+ CONFIDENCE_MAX2,
7
+ triggerKey2
8
+ } from "./index-21jcfatr.js";
9
9
 
10
10
  // src/learning/bless.ts
11
11
  import { createHash } from "crypto";
@@ -32,19 +32,19 @@ function blessedRecords(held, minConfidence) {
32
32
  function versionOf(instincts) {
33
33
  return createHash("sha256").update(JSON.stringify(instincts)).digest("hex");
34
34
  }
35
- function bless(held, options) {
35
+ function bless2(held, options) {
36
36
  const instincts = blessedRecords(held, options.minConfidence);
37
37
  return { version: versionOf(instincts), instincts };
38
38
  }
39
- function promotable(held, options) {
39
+ function promotable2(held, options) {
40
40
  return blessedRecords(held, options.minConfidence).filter((each) => each.usage_count >= options.after);
41
41
  }
42
42
  // src/learning/merge.ts
43
43
  var HUNDREDTHS2 = 100;
44
- var GAP_H = Math.round(GAP * HUNDREDTHS2);
45
- var STEP_H = Math.round(SOURCE_STEP * HUNDREDTHS2);
46
- var MIN_H = Math.round(CONFIDENCE_MIN * HUNDREDTHS2);
47
- var MAX_H = Math.round(CONFIDENCE_MAX * HUNDREDTHS2);
44
+ var GAP_H = Math.round(GAP2 * HUNDREDTHS2);
45
+ var STEP_H = Math.round(SOURCE_STEP2 * HUNDREDTHS2);
46
+ var MIN_H = Math.round(CONFIDENCE_MIN2 * HUNDREDTHS2);
47
+ var MAX_H = Math.round(CONFIDENCE_MAX2 * HUNDREDTHS2);
48
48
  function hundredths2(confidence) {
49
49
  return Math.round(confidence * HUNDREDTHS2);
50
50
  }
@@ -194,16 +194,16 @@ function settleTrigger(held, incoming, now) {
194
194
  }
195
195
  return settleMany(collapsed, held, now);
196
196
  }
197
- function merge(held, payload, now) {
197
+ function merge2(held, payload, now) {
198
198
  const incoming = payload.instincts.map((record) => withSource(record, payload.source_id));
199
- const keys = [...new Set(incoming.map((record) => triggerKey(record.trigger)))];
199
+ const keys = [...new Set(incoming.map((record) => triggerKey2(record.trigger)))];
200
200
  const outcomes = new Map;
201
201
  for (const key of keys) {
202
- const onKey = (record) => triggerKey(record.trigger) === key;
202
+ const onKey = (record) => triggerKey2(record.trigger) === key;
203
203
  outcomes.set(key, settleTrigger(held.filter(onKey), incoming.filter(onKey), now));
204
204
  }
205
205
  const decisions = payload.instincts.map((record) => {
206
- const outcome = outcomes.get(triggerKey(record.trigger));
206
+ const outcome = outcomes.get(triggerKey2(record.trigger));
207
207
  return {
208
208
  incoming: record,
209
209
  rule: outcome.rules.get(record.action_hash),
@@ -215,4 +215,4 @@ function merge(held, payload, now) {
215
215
  discarded: keys.flatMap((key) => outcomes.get(key).discarded)
216
216
  };
217
217
  }
218
- export { bless, promotable, merge };
218
+ export { bless2, promotable2, merge2 };