@harny/sdk 0.0.1-alpha.1 → 0.1.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.
- package/LICENSE +202 -0
- package/README.md +54 -42
- package/dist/cjs/agent/adapters.d.ts +167 -0
- package/dist/cjs/agent/adapters.js +557 -0
- package/dist/cjs/agent/adapters.js.map +1 -0
- package/dist/cjs/agent/hooks.d.ts +52 -0
- package/dist/cjs/agent/hooks.js +41 -0
- package/dist/cjs/agent/hooks.js.map +1 -0
- package/dist/cjs/agent/index.d.ts +34 -0
- package/dist/cjs/agent/index.js +62 -0
- package/dist/cjs/agent/index.js.map +1 -0
- package/dist/cjs/agent/loop.d.ts +401 -0
- package/dist/cjs/agent/loop.js +1252 -0
- package/dist/cjs/agent/loop.js.map +1 -0
- package/dist/cjs/agent/roster.d.ts +62 -0
- package/dist/cjs/agent/roster.js +149 -0
- package/dist/cjs/agent/roster.js.map +1 -0
- package/dist/cjs/agent/session.d.ts +106 -0
- package/dist/cjs/agent/session.js +261 -0
- package/dist/cjs/agent/session.js.map +1 -0
- package/dist/cjs/agent/spend.d.ts +39 -0
- package/dist/cjs/agent/spend.js +70 -0
- package/dist/cjs/agent/spend.js.map +1 -0
- package/dist/cjs/agent/tools.d.ts +83 -0
- package/dist/cjs/agent/tools.js +212 -0
- package/dist/cjs/agent/tools.js.map +1 -0
- package/dist/cjs/agent/tracing.d.ts +72 -0
- package/dist/cjs/agent/tracing.js +128 -0
- package/dist/cjs/agent/tracing.js.map +1 -0
- package/dist/cjs/agent/util.d.ts +60 -0
- package/dist/cjs/agent/util.js +188 -0
- package/dist/cjs/agent/util.js.map +1 -0
- package/dist/cjs/conflictQuestion.d.ts +137 -0
- package/dist/cjs/conflictQuestion.js +356 -0
- package/dist/cjs/conflictQuestion.js.map +1 -0
- package/dist/cjs/index.d.ts +950 -0
- package/dist/cjs/index.js +1118 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/memoryV1.d.ts +121 -0
- package/dist/cjs/memoryV1.js +132 -0
- package/dist/cjs/memoryV1.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/agent/adapters.d.ts +167 -0
- package/dist/esm/agent/adapters.js +543 -0
- package/dist/esm/agent/adapters.js.map +1 -0
- package/dist/esm/agent/hooks.d.ts +52 -0
- package/dist/esm/agent/hooks.js +36 -0
- package/dist/esm/agent/hooks.js.map +1 -0
- package/dist/esm/agent/index.d.ts +34 -0
- package/dist/esm/agent/index.js +28 -0
- package/dist/esm/agent/index.js.map +1 -0
- package/dist/esm/agent/loop.d.ts +401 -0
- package/dist/esm/agent/loop.js +1243 -0
- package/dist/esm/agent/loop.js.map +1 -0
- package/dist/esm/agent/roster.d.ts +62 -0
- package/dist/esm/agent/roster.js +143 -0
- package/dist/esm/agent/roster.js.map +1 -0
- package/dist/esm/agent/session.d.ts +106 -0
- package/dist/esm/agent/session.js +221 -0
- package/dist/esm/agent/session.js.map +1 -0
- package/dist/esm/agent/spend.d.ts +39 -0
- package/dist/esm/agent/spend.js +65 -0
- package/dist/esm/agent/spend.js.map +1 -0
- package/dist/esm/agent/tools.d.ts +83 -0
- package/dist/esm/agent/tools.js +205 -0
- package/dist/esm/agent/tools.js.map +1 -0
- package/dist/esm/agent/tracing.d.ts +72 -0
- package/dist/esm/agent/tracing.js +119 -0
- package/dist/esm/agent/tracing.js.map +1 -0
- package/dist/esm/agent/util.d.ts +60 -0
- package/dist/esm/agent/util.js +168 -0
- package/dist/esm/agent/util.js.map +1 -0
- package/dist/esm/conflictQuestion.d.ts +137 -0
- package/dist/esm/conflictQuestion.js +346 -0
- package/dist/esm/conflictQuestion.js.map +1 -0
- package/dist/esm/index.d.ts +950 -0
- package/dist/esm/index.js +1066 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/memoryV1.d.ts +121 -0
- package/dist/esm/memoryV1.js +124 -0
- package/dist/esm/memoryV1.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/package.json +41 -15
- package/index.js +0 -270
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* What to ask a person whose notes conflict, and the rule for when. Pure: no network, no model call, no clock.
|
|
4
|
+
*
|
|
5
|
+
* A person can say two things that cannot both be true ("Maya prefers email", weeks later "Maya prefers phone").
|
|
6
|
+
* Harny keeps both and picks neither; the context response returns them in
|
|
7
|
+
* `conflicts`. Harny adds no pause of its own. The question is YOUR confirm step's: call
|
|
8
|
+
* `decideConflictQuestion` before an action, show `text` if it says `ask`, tell Harny you asked
|
|
9
|
+
* (`client.markConflictAsked`), and send the person's answer (`client.answerConflict`). The answer is saved as
|
|
10
|
+
* something the person said, and the conflict stops being returned.
|
|
11
|
+
*
|
|
12
|
+
* const result = await client.assembleContext("send Maya the update", undefined, { user });
|
|
13
|
+
* const decision = decideConflictQuestion({
|
|
14
|
+
* conflicts: result.conflicts,
|
|
15
|
+
* dependsOn: conflictsTheSendDependsOn.map((c) => c.record_id_1), // the ones whose answer changes what is sent
|
|
16
|
+
* actionKinds: ["others_affected"], // the kinds of action this is
|
|
17
|
+
* mode: result.conflict_question_mode, // the app's "When notes conflict" setting
|
|
18
|
+
* phrases: new QuestionPhrases({ action: "send", question: "Does Maya prefer email or phone?" }),
|
|
19
|
+
* });
|
|
20
|
+
* if (decision.ask) {
|
|
21
|
+
* const claim = await client.markConflictAsked(decision, { user }); // claim the question FIRST
|
|
22
|
+
* if (claim.first_time) show(decision.text); // only the first claim shows it
|
|
23
|
+
* // (in your own confirm card or chat)
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* Report before you show, and show only when `first_time` is true: the first report wins, so a second action in the same
|
|
27
|
+
* turn, a retry or a second process cannot put the question twice. (A decision by itself changes nothing: `ledger` and
|
|
28
|
+
* `record` only help a host that keeps its own memory.)
|
|
29
|
+
*
|
|
30
|
+
* THE RULE (all six must hold, checked in this order; the first that fails names itself in `reason`):
|
|
31
|
+
*
|
|
32
|
+
* 1. the action is of the "others affected" or "irreversible" kind (`ASKING_KINDS`): an action that only touches
|
|
33
|
+
* the person's own things never asks;
|
|
34
|
+
* 2. a conflict exists for a note the action depends on. `dependsOn` lists the `record_id_1` / `record_id_2` of each
|
|
35
|
+
* conflict whose answer changes what the action does; you (or your agent) decide that from the two statements;
|
|
36
|
+
* 3. the question is on (`mode` is not null or undefined). The response names the app's mode only while Harny has
|
|
37
|
+
* the question on, so no mode with a conflict in hand means do not ask;
|
|
38
|
+
* 4. the person did not say both in one conversation (`same_conversation` is false): they have just said it, so
|
|
39
|
+
* they are never asked about it there;
|
|
40
|
+
* 5. that conflict has not been asked about before: at most once per conflict. It counts as asked when the
|
|
41
|
+
* response marked it `asked` or your `ledger` has it;
|
|
42
|
+
* 6. the wording the question needs was supplied FOR THAT CONFLICT (a lone `QuestionPhrases` is accepted only while
|
|
43
|
+
* one conflict can be asked; with several, pass a function of the conflict or a map by `conflictKey`).
|
|
44
|
+
*
|
|
45
|
+
* THE WORDS depend on the app's "When notes conflict" setting: `simple` (the default, no dates), `precise` (both
|
|
46
|
+
* statements with the day each was said) and `handoff` (a short question that offers the detail, which your own
|
|
47
|
+
* interface shows from the `conflicts` data). The sentences carry natural-language phrases ("Maya prefers email") that the stored statements do not, so YOU supply them in `QuestionPhrases`; this module never writes
|
|
48
|
+
* wording of its own: a missing phrase is a `missing_phrases` refusal, not a guess.
|
|
49
|
+
*/
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.InMemoryConflictAskLedger = exports.QuestionPhrases = exports.ASKING_KINDS = exports.DEFAULT_CONFLICT_QUESTION_MODE = exports.CONFLICT_QUESTION_MODES = void 0;
|
|
52
|
+
exports.normaliseMode = normaliseMode;
|
|
53
|
+
exports.formatDay = formatDay;
|
|
54
|
+
exports.questionText = questionText;
|
|
55
|
+
exports.conflictKey = conflictKey;
|
|
56
|
+
exports.decideConflictQuestion = decideConflictQuestion;
|
|
57
|
+
/** The closed set the app's "When notes conflict" setting takes. */
|
|
58
|
+
exports.CONFLICT_QUESTION_MODES = ["simple", "precise", "handoff"];
|
|
59
|
+
exports.DEFAULT_CONFLICT_QUESTION_MODE = "simple";
|
|
60
|
+
/** The action kinds that may ask. `money` and `nobody_else` do not. */
|
|
61
|
+
exports.ASKING_KINDS = new Set(["others_affected", "irreversible"]);
|
|
62
|
+
// the three question sentences a person sees (in your confirm card or chat), and the month names they print.
|
|
63
|
+
const SIMPLE = "Before I {action} this: my notes conflict. {question}";
|
|
64
|
+
const PRECISE = "Before I {action} this: my notes conflict. On {day_1} you said {claim_1}, and on {day_2} that {claim_2}. Which is right?";
|
|
65
|
+
const HANDOFF = "Before I {action} this: my notes conflict about {topic}. Want to see both?";
|
|
66
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
|
|
67
|
+
const PHRASE_NAMES = ["action", "question", "claim_1", "claim_2", "topic"];
|
|
68
|
+
/**
|
|
69
|
+
* The natural-language pieces YOU write about THIS conflict.
|
|
70
|
+
*
|
|
71
|
+
* `action`: the verb of what is about to happen ("send", "reply", "share"); all three modes. `question`: a complete
|
|
72
|
+
* yes/no question about the fact, for `simple` ("Does Maya prefer email or phone?"). `claim_1` /
|
|
73
|
+
* `claim_2`: the two statements as they read after "you said" and "that", for `precise` ("Maya prefers email", "she prefers phone"). `topic`: what the notes conflict about, for `handoff` ("Maya's contact preference").
|
|
74
|
+
*/
|
|
75
|
+
class QuestionPhrases {
|
|
76
|
+
constructor(init = {}) {
|
|
77
|
+
this.action = init.action ?? "";
|
|
78
|
+
this.question = init.question ?? "";
|
|
79
|
+
this.claim_1 = init.claim_1 ?? "";
|
|
80
|
+
this.claim_2 = init.claim_2 ?? "";
|
|
81
|
+
this.topic = init.topic ?? "";
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.QuestionPhrases = QuestionPhrases;
|
|
85
|
+
/** A ledger held in memory: for tests and for a first draft. */
|
|
86
|
+
class InMemoryConflictAskLedger {
|
|
87
|
+
constructor(asked = []) {
|
|
88
|
+
this.asked = new Set(asked);
|
|
89
|
+
}
|
|
90
|
+
has(key) {
|
|
91
|
+
return this.asked.has(key);
|
|
92
|
+
}
|
|
93
|
+
add(key) {
|
|
94
|
+
this.asked.add(key);
|
|
95
|
+
}
|
|
96
|
+
get size() {
|
|
97
|
+
return this.asked.size;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.InMemoryConflictAskLedger = InMemoryConflictAskLedger;
|
|
101
|
+
/** One of `CONFLICT_QUESTION_MODES`; anything else is the default (the plain, no-dates question). */
|
|
102
|
+
function normaliseMode(value) {
|
|
103
|
+
const text = pyStr(value).trim().toLowerCase();
|
|
104
|
+
return exports.CONFLICT_QUESTION_MODES.includes(text)
|
|
105
|
+
? text
|
|
106
|
+
: exports.DEFAULT_CONFLICT_QUESTION_MODE;
|
|
107
|
+
}
|
|
108
|
+
/** `2024-09-22` -> `Sept 22`. An empty string when the value is not an ISO day. */
|
|
109
|
+
function formatDay(isoDay) {
|
|
110
|
+
const s = pyStr(isoDay).trim();
|
|
111
|
+
if (s.length < 10 || s[4] !== "-" || s[7] !== "-")
|
|
112
|
+
return "";
|
|
113
|
+
const digits = (part) => (/^[0-9]+$/.test(part) ? Number(part) : null);
|
|
114
|
+
const year = digits(s.slice(0, 4));
|
|
115
|
+
const month = digits(s.slice(5, 7));
|
|
116
|
+
const day = digits(s.slice(8, 10));
|
|
117
|
+
if (year === null || month === null || day === null)
|
|
118
|
+
return "";
|
|
119
|
+
if (year < 1 || month < 1 || month > 12 || day < 1)
|
|
120
|
+
return "";
|
|
121
|
+
// A real calendar day: 2024-02-31 is not one.
|
|
122
|
+
const daysInMonth = [31, isLeap(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month - 1];
|
|
123
|
+
if (day > daysInMonth)
|
|
124
|
+
return "";
|
|
125
|
+
return `${MONTHS[month - 1]} ${day}`;
|
|
126
|
+
}
|
|
127
|
+
function isLeap(year) {
|
|
128
|
+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
129
|
+
}
|
|
130
|
+
/** The question for `mode`. Throws on a missing phrase or an unreadable said-day (`precise` only). */
|
|
131
|
+
function questionText(mode, conflict, phrases) {
|
|
132
|
+
const m = normaliseMode(mode);
|
|
133
|
+
const missing = missingPhrases(m, phrases);
|
|
134
|
+
if (missing.length > 0)
|
|
135
|
+
throw new Error("missing phrases: " + missing.join(", "));
|
|
136
|
+
const action = phrases.action.trim();
|
|
137
|
+
if (m === "simple")
|
|
138
|
+
return fill(SIMPLE, { action, question: phrases.question.trim() });
|
|
139
|
+
if (m === "handoff")
|
|
140
|
+
return fill(HANDOFF, { action, topic: phrases.topic.trim() });
|
|
141
|
+
const day1 = formatDay(conflict["said_1"]);
|
|
142
|
+
const day2 = formatDay(conflict["said_2"]);
|
|
143
|
+
if (!day1 || !day2)
|
|
144
|
+
throw new Error("unreadable said day");
|
|
145
|
+
return fill(PRECISE, {
|
|
146
|
+
action,
|
|
147
|
+
day_1: day1,
|
|
148
|
+
claim_1: phrases.claim_1.trim(),
|
|
149
|
+
day_2: day2,
|
|
150
|
+
claim_2: phrases.claim_2.trim(),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** One pass over the template: a value that itself looks like a placeholder is never filled in again. */
|
|
154
|
+
function fill(template, values) {
|
|
155
|
+
return template.replace(/\{(\w+)\}/g, (whole, name) => values[name] ?? whole);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The identity of one conflict: the two stored notes behind it, in either order. The same value Harny puts in
|
|
159
|
+
* `conflicts[].conflict_key`, stable across responses, so "asked once" holds however the list is ordered.
|
|
160
|
+
*/
|
|
161
|
+
function conflictKey(conflict) {
|
|
162
|
+
const pair = [pyStr(conflict["record_id_1"]), pyStr(conflict["record_id_2"])].sort(compareCodePoints);
|
|
163
|
+
return sha256Hex(new TextEncoder().encode(pair.join("\u001f"))).slice(0, 16);
|
|
164
|
+
}
|
|
165
|
+
/** Whether to ask now, and what to say. See the module comment for the rule. */
|
|
166
|
+
function decideConflictQuestion(options) {
|
|
167
|
+
const ledger = options.ledger ?? new InMemoryConflictAskLedger();
|
|
168
|
+
const refuse = (reason, conflict, key) => ({
|
|
169
|
+
ask: false,
|
|
170
|
+
reason,
|
|
171
|
+
text: null,
|
|
172
|
+
key: key ?? null,
|
|
173
|
+
conflict: conflict ?? null,
|
|
174
|
+
});
|
|
175
|
+
const kinds = asSet(options.actionKinds);
|
|
176
|
+
if (![...kinds].some((k) => exports.ASKING_KINDS.has(k)))
|
|
177
|
+
return refuse("kind_not_eligible");
|
|
178
|
+
const relied = asSet(options.dependsOn);
|
|
179
|
+
const relevant = (options.conflicts ?? [])
|
|
180
|
+
.map((c) => ({ ...c }))
|
|
181
|
+
.filter((c) => relied.has(pyStr(c["record_id_1"])) || relied.has(pyStr(c["record_id_2"])));
|
|
182
|
+
if (relevant.length === 0)
|
|
183
|
+
return refuse("no_conflict");
|
|
184
|
+
relevant.sort((a, b) => {
|
|
185
|
+
const byDay = compareCodePoints(pyStr(a["said_2"]), pyStr(b["said_2"]));
|
|
186
|
+
return byDay !== 0 ? byDay : compareCodePoints(conflictKey(a), conflictKey(b));
|
|
187
|
+
});
|
|
188
|
+
if (options.mode === null || options.mode === undefined) {
|
|
189
|
+
const c = relevant[0];
|
|
190
|
+
return refuse("rule_dark", c, conflictKey(c));
|
|
191
|
+
}
|
|
192
|
+
const askable = relevant.filter((c) => !isTruthy(c["same_conversation"]));
|
|
193
|
+
if (askable.length === 0) {
|
|
194
|
+
const c = relevant[0];
|
|
195
|
+
return refuse("same_conversation", c, conflictKey(c));
|
|
196
|
+
}
|
|
197
|
+
const fresh = askable.filter((c) => !(c["asked"] === true || ledger.has(conflictKey(c))));
|
|
198
|
+
if (fresh.length === 0) {
|
|
199
|
+
const c = askable[0];
|
|
200
|
+
return refuse("already_asked", c, conflictKey(c));
|
|
201
|
+
}
|
|
202
|
+
const chosen = fresh[0];
|
|
203
|
+
const key = conflictKey(chosen);
|
|
204
|
+
if (isLonePhrases(options.phrases) && fresh.length > 1) {
|
|
205
|
+
// One set of words, several conflicts that could be asked: the function would pick one and the words
|
|
206
|
+
// (and the days) would not be about the same conflict. Refuse; nothing is recorded.
|
|
207
|
+
return refuse("ambiguous_phrases", chosen, key);
|
|
208
|
+
}
|
|
209
|
+
let text;
|
|
210
|
+
try {
|
|
211
|
+
text = questionText(options.mode, chosen, phrasesFor(options.phrases, chosen, key));
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
return refuse("missing_phrases", chosen, key);
|
|
215
|
+
}
|
|
216
|
+
if (options.record)
|
|
217
|
+
ledger.add(key);
|
|
218
|
+
return { ask: true, reason: "asked", text, key, conflict: chosen };
|
|
219
|
+
}
|
|
220
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
221
|
+
// internals
|
|
222
|
+
// ---------------------------------------------------------------------------------------------------------------
|
|
223
|
+
/** What the Python helper's `str(x or "")` gives: empty for null, undefined and other falsy values. */
|
|
224
|
+
function pyStr(value) {
|
|
225
|
+
if (value === null || value === undefined || value === false || value === 0 || value === "")
|
|
226
|
+
return "";
|
|
227
|
+
return String(value);
|
|
228
|
+
}
|
|
229
|
+
function isTruthy(value) {
|
|
230
|
+
if (Array.isArray(value))
|
|
231
|
+
return value.length > 0;
|
|
232
|
+
return Boolean(value);
|
|
233
|
+
}
|
|
234
|
+
/** A set of non-empty strings from an iterable or ONE bare string (a lone string is one item, not its letters). */
|
|
235
|
+
function asSet(value) {
|
|
236
|
+
if (value === null || value === undefined)
|
|
237
|
+
return new Set();
|
|
238
|
+
if (typeof value === "string")
|
|
239
|
+
return value ? new Set([value]) : new Set();
|
|
240
|
+
return new Set([...value].map((v) => String(v)).filter((v) => v !== ""));
|
|
241
|
+
}
|
|
242
|
+
/** Code-point order, the order Python sorts strings in (UTF-16 order differs for characters beyond the BMP). */
|
|
243
|
+
function compareCodePoints(a, b) {
|
|
244
|
+
const x = Array.from(a);
|
|
245
|
+
const y = Array.from(b);
|
|
246
|
+
const n = Math.min(x.length, y.length);
|
|
247
|
+
for (let i = 0; i < n; i++) {
|
|
248
|
+
const d = x[i].codePointAt(0) - y[i].codePointAt(0);
|
|
249
|
+
if (d !== 0)
|
|
250
|
+
return d;
|
|
251
|
+
}
|
|
252
|
+
return x.length - y.length;
|
|
253
|
+
}
|
|
254
|
+
function missingPhrases(mode, phrases) {
|
|
255
|
+
const need = {
|
|
256
|
+
simple: ["action", "question"],
|
|
257
|
+
precise: ["action", "claim_1", "claim_2"],
|
|
258
|
+
handoff: ["action", "topic"],
|
|
259
|
+
};
|
|
260
|
+
return need[mode].filter((name) => pyStr(phrases[name]).trim() === "");
|
|
261
|
+
}
|
|
262
|
+
function isLonePhrases(source) {
|
|
263
|
+
if (source instanceof QuestionPhrases)
|
|
264
|
+
return true;
|
|
265
|
+
if (typeof source === "function" || source instanceof Map)
|
|
266
|
+
return false;
|
|
267
|
+
return typeof source === "object" && source !== null && PHRASE_NAMES.some((name) => name in source);
|
|
268
|
+
}
|
|
269
|
+
function phrasesFor(source, conflict, key) {
|
|
270
|
+
let found;
|
|
271
|
+
if (source instanceof QuestionPhrases) {
|
|
272
|
+
found = source;
|
|
273
|
+
}
|
|
274
|
+
else if (typeof source === "function") {
|
|
275
|
+
found = source(conflict);
|
|
276
|
+
}
|
|
277
|
+
else if (source instanceof Map) {
|
|
278
|
+
found = source.get(key);
|
|
279
|
+
}
|
|
280
|
+
else if (isLonePhrases(source)) {
|
|
281
|
+
found = new QuestionPhrases(source);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
found = source[key];
|
|
285
|
+
}
|
|
286
|
+
if (!(found instanceof QuestionPhrases)) {
|
|
287
|
+
if (found && typeof found === "object")
|
|
288
|
+
return new QuestionPhrases(found);
|
|
289
|
+
throw new Error("no phrases for this conflict");
|
|
290
|
+
}
|
|
291
|
+
return found;
|
|
292
|
+
}
|
|
293
|
+
// SHA-256 (FIPS 180-4), synchronous and dependency-free: the SDK also runs where `crypto.subtle` is async-only.
|
|
294
|
+
const K = new Uint32Array([
|
|
295
|
+
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
|
296
|
+
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
|
297
|
+
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
|
298
|
+
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
|
299
|
+
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
|
300
|
+
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
|
301
|
+
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
|
302
|
+
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
|
|
303
|
+
]);
|
|
304
|
+
function rotr(x, n) {
|
|
305
|
+
return (x >>> n) | (x << (32 - n));
|
|
306
|
+
}
|
|
307
|
+
function sha256Hex(message) {
|
|
308
|
+
const h = new Uint32Array([
|
|
309
|
+
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
|
|
310
|
+
]);
|
|
311
|
+
const length = message.length;
|
|
312
|
+
const padded = Math.ceil((length + 9) / 64) * 64;
|
|
313
|
+
const buffer = new Uint8Array(padded);
|
|
314
|
+
buffer.set(message);
|
|
315
|
+
buffer[length] = 0x80;
|
|
316
|
+
const view = new DataView(buffer.buffer);
|
|
317
|
+
view.setUint32(padded - 8, Math.floor(length / 0x20000000), false);
|
|
318
|
+
view.setUint32(padded - 4, (length << 3) >>> 0, false);
|
|
319
|
+
const w = new Uint32Array(64);
|
|
320
|
+
for (let offset = 0; offset < padded; offset += 64) {
|
|
321
|
+
for (let i = 0; i < 16; i++)
|
|
322
|
+
w[i] = view.getUint32(offset + i * 4, false);
|
|
323
|
+
for (let i = 16; i < 64; i++) {
|
|
324
|
+
const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >>> 3);
|
|
325
|
+
const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >>> 10);
|
|
326
|
+
w[i] = (w[i - 16] + s0 + w[i - 7] + s1) | 0;
|
|
327
|
+
}
|
|
328
|
+
let [a, b, c, d, e, f, g, hh] = [h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7]];
|
|
329
|
+
for (let i = 0; i < 64; i++) {
|
|
330
|
+
const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
|
|
331
|
+
const ch = (e & f) ^ (~e & g);
|
|
332
|
+
const t1 = (hh + s1 + ch + K[i] + w[i]) | 0;
|
|
333
|
+
const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
|
|
334
|
+
const maj = (a & b) ^ (a & c) ^ (b & c);
|
|
335
|
+
const t2 = (s0 + maj) | 0;
|
|
336
|
+
hh = g;
|
|
337
|
+
g = f;
|
|
338
|
+
f = e;
|
|
339
|
+
e = (d + t1) | 0;
|
|
340
|
+
d = c;
|
|
341
|
+
c = b;
|
|
342
|
+
b = a;
|
|
343
|
+
a = (t1 + t2) | 0;
|
|
344
|
+
}
|
|
345
|
+
h[0] = (h[0] + a) | 0;
|
|
346
|
+
h[1] = (h[1] + b) | 0;
|
|
347
|
+
h[2] = (h[2] + c) | 0;
|
|
348
|
+
h[3] = (h[3] + d) | 0;
|
|
349
|
+
h[4] = (h[4] + e) | 0;
|
|
350
|
+
h[5] = (h[5] + f) | 0;
|
|
351
|
+
h[6] = (h[6] + g) | 0;
|
|
352
|
+
h[7] = (h[7] + hh) | 0;
|
|
353
|
+
}
|
|
354
|
+
return Array.from(h, (word) => (word >>> 0).toString(16).padStart(8, "0")).join("");
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=conflictQuestion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflictQuestion.js","sourceRoot":"","sources":["../../src/conflictQuestion.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;;;AA2HH,sCAKC;AAGD,8BAaC;AAOD,oCAiBC;AAWD,kCAGC;AAGD,wDAiDC;AAxOD,oEAAoE;AACvD,QAAA,uBAAuB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAEpE,QAAA,8BAA8B,GAAyB,QAAQ,CAAC;AAE7E,uEAAuE;AAC1D,QAAA,YAAY,GAAwB,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;AAE9F,6GAA6G;AAC7G,MAAM,MAAM,GAAG,uDAAuD,CAAC;AACvE,MAAM,OAAO,GACT,0HAA0H,CAAC;AAC/H,MAAM,OAAO,GAAG,4EAA4E,CAAC;AAE7F,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AAKvG,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,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