@mneme-ai/core 1.85.0 → 1.87.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/dist/agent_manifest.d.ts +1 -1
- package/dist/agent_manifest.d.ts.map +1 -1
- package/dist/agent_manifest.js +6 -1
- package/dist/agent_manifest.js.map +1 -1
- package/dist/chameleon/chameleon.test.d.ts +2 -0
- package/dist/chameleon/chameleon.test.d.ts.map +1 -0
- package/dist/chameleon/chameleon.test.js +143 -0
- package/dist/chameleon/chameleon.test.js.map +1 -0
- package/dist/chameleon/env_probe.d.ts +50 -0
- package/dist/chameleon/env_probe.d.ts.map +1 -0
- package/dist/chameleon/env_probe.js +125 -0
- package/dist/chameleon/env_probe.js.map +1 -0
- package/dist/chameleon/index.d.ts +16 -0
- package/dist/chameleon/index.d.ts.map +1 -0
- package/dist/chameleon/index.js +16 -0
- package/dist/chameleon/index.js.map +1 -0
- package/dist/chameleon/spore_gate.d.ts +42 -0
- package/dist/chameleon/spore_gate.d.ts.map +1 -0
- package/dist/chameleon/spore_gate.js +86 -0
- package/dist/chameleon/spore_gate.js.map +1 -0
- package/dist/chameleon/transport_select.d.ts +19 -0
- package/dist/chameleon/transport_select.d.ts.map +1 -0
- package/dist/chameleon/transport_select.js +61 -0
- package/dist/chameleon/transport_select.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lattice/intent_atoms.d.ts.map +1 -1
- package/dist/lattice/intent_atoms.js +66 -1
- package/dist/lattice/intent_atoms.js.map +1 -1
- package/dist/lineage/spore.d.ts +4 -1
- package/dist/lineage/spore.d.ts.map +1 -1
- package/dist/lineage/spore.js +14 -1
- package/dist/lineage/spore.js.map +1 -1
- package/dist/lineage/spore.test.js +11 -0
- package/dist/lineage/spore.test.js.map +1 -1
- package/dist/neuron/triage.d.ts.map +1 -1
- package/dist/neuron/triage.js +4 -1
- package/dist/neuron/triage.js.map +1 -1
- package/dist/relay/deep_link.d.ts +41 -0
- package/dist/relay/deep_link.d.ts.map +1 -0
- package/dist/relay/deep_link.js +51 -0
- package/dist/relay/deep_link.js.map +1 -0
- package/dist/relay/handoff_artifact.d.ts +53 -0
- package/dist/relay/handoff_artifact.d.ts.map +1 -0
- package/dist/relay/handoff_artifact.js +38 -0
- package/dist/relay/handoff_artifact.js.map +1 -0
- package/dist/relay/index.d.ts +2 -0
- package/dist/relay/index.d.ts.map +1 -1
- package/dist/relay/index.js +2 -0
- package/dist/relay/index.js.map +1 -1
- package/dist/relay/mobile_recipe.d.ts +6 -0
- package/dist/relay/mobile_recipe.d.ts.map +1 -1
- package/dist/relay/mobile_recipe.js +6 -1
- package/dist/relay/mobile_recipe.js.map +1 -1
- package/dist/synapse/qr_real.d.ts +37 -0
- package/dist/synapse/qr_real.d.ts.map +1 -0
- package/dist/synapse/qr_real.js +397 -0
- package/dist/synapse/qr_real.js.map +1 -0
- package/dist/synapse/token_compression.d.ts.map +1 -1
- package/dist/synapse/token_compression.js +27 -0
- package/dist/synapse/token_compression.js.map +1 -1
- package/package.json +1 -1
package/dist/neuron/triage.js
CHANGED
|
@@ -22,7 +22,10 @@ import { routeIntent, INTENT_ATOMS } from "../lattice/intent_atoms.js";
|
|
|
22
22
|
import { rankByFuzzy } from "./fuzzy.js";
|
|
23
23
|
import { deriveAtomsFromCatalog, mergeAtoms } from "./auto_atoms.js";
|
|
24
24
|
const MNEME_KEYWORD_RE = /\b(mneme|soul prompt|ส่งสมอง)\b/i;
|
|
25
|
-
|
|
25
|
+
// v1.86: lowered from 0.20 to 0.13 so multi-typo phrases like
|
|
26
|
+
// "sned brian to lap top" still surface a candidate (it scored 0.16
|
|
27
|
+
// against "send brain to" before this change).
|
|
28
|
+
const FUZZY_THRESHOLD = 0.13;
|
|
26
29
|
/** Run the full 4-strategy triage. */
|
|
27
30
|
export function telepathicTriage(userPrompt, toolCatalog = []) {
|
|
28
31
|
if (!user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,QAAQ,EAAE;QAC9G,CAAC,CAAC,gBAAgB,CAAC;IAErB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.87.0 -- RELAY: vendor-specific deep links.
|
|
3
|
+
*
|
|
4
|
+
* Modern AI apps + web AIs accept a query parameter that pre-fills
|
|
5
|
+
* the chat input. Combine that with a paste URL + decryption code
|
|
6
|
+
* → user scans QR → AI app opens with the full instruction ready
|
|
7
|
+
* to send. ONE TAP cross-device handover.
|
|
8
|
+
*
|
|
9
|
+
* Verified URL params (May 2026):
|
|
10
|
+
* - Gemini web: gemini.google.com/?q=<urlenc>
|
|
11
|
+
* - ChatGPT web: chat.openai.com/?q=<urlenc>
|
|
12
|
+
* - Claude web: claude.ai/new?q=<urlenc>
|
|
13
|
+
* - Generic fallback: any text the user copies manually
|
|
14
|
+
*
|
|
15
|
+
* QR encoding limit: ~250 bytes for v10. We keep the URL compact:
|
|
16
|
+
* `https://gemini.google.com/?q=Fetch%20<URL>%20with%20code%20<CODE>%20and%20resume`
|
|
17
|
+
* ~ 150 chars → fits in v6 QR easily.
|
|
18
|
+
*/
|
|
19
|
+
export type DeepLinkVendor = "gemini" | "chatgpt" | "claude" | "any";
|
|
20
|
+
export interface DeepLinkInput {
|
|
21
|
+
pasteUrl: string;
|
|
22
|
+
nexusCode: string;
|
|
23
|
+
vendor?: DeepLinkVendor;
|
|
24
|
+
}
|
|
25
|
+
/** Compose a single-line instruction the destination AI will receive
|
|
26
|
+
* as its first message. Kept SHORT so URL+query fits in a QR. */
|
|
27
|
+
export declare function composePrompt(pasteUrl: string, nexusCode: string): string;
|
|
28
|
+
export interface DeepLink {
|
|
29
|
+
vendor: DeepLinkVendor;
|
|
30
|
+
/** Final URL the user opens (or QR scans into). */
|
|
31
|
+
url: string;
|
|
32
|
+
/** Just the prompt portion, in case the URL is too long. */
|
|
33
|
+
prompt: string;
|
|
34
|
+
/** Whether the URL fits in a typical v10 QR payload (< 270 bytes). */
|
|
35
|
+
fitsInQR: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare function buildDeepLink(input: DeepLinkInput): DeepLink;
|
|
38
|
+
/** Pick the deep link with the SHORTEST URL that still fits in a QR.
|
|
39
|
+
* Best for "I don't know which AI app the user has" scenarios. */
|
|
40
|
+
export declare function bestDeepLink(input: DeepLinkInput): DeepLink;
|
|
41
|
+
//# sourceMappingURL=deep_link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep_link.d.ts","sourceRoot":"","sources":["../../src/relay/deep_link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AASD;kEACkE;AAClE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,cAAc,CAAC;IACvB,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CAM5D;AAED;mEACmE;AACnE,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CAS3D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.87.0 -- RELAY: vendor-specific deep links.
|
|
3
|
+
*
|
|
4
|
+
* Modern AI apps + web AIs accept a query parameter that pre-fills
|
|
5
|
+
* the chat input. Combine that with a paste URL + decryption code
|
|
6
|
+
* → user scans QR → AI app opens with the full instruction ready
|
|
7
|
+
* to send. ONE TAP cross-device handover.
|
|
8
|
+
*
|
|
9
|
+
* Verified URL params (May 2026):
|
|
10
|
+
* - Gemini web: gemini.google.com/?q=<urlenc>
|
|
11
|
+
* - ChatGPT web: chat.openai.com/?q=<urlenc>
|
|
12
|
+
* - Claude web: claude.ai/new?q=<urlenc>
|
|
13
|
+
* - Generic fallback: any text the user copies manually
|
|
14
|
+
*
|
|
15
|
+
* QR encoding limit: ~250 bytes for v10. We keep the URL compact:
|
|
16
|
+
* `https://gemini.google.com/?q=Fetch%20<URL>%20with%20code%20<CODE>%20and%20resume`
|
|
17
|
+
* ~ 150 chars → fits in v6 QR easily.
|
|
18
|
+
*/
|
|
19
|
+
const TEMPLATES = {
|
|
20
|
+
gemini: "https://gemini.google.com/?q=",
|
|
21
|
+
chatgpt: "https://chat.openai.com/?q=",
|
|
22
|
+
claude: "https://claude.ai/new?q=",
|
|
23
|
+
any: "", // copy-only fallback
|
|
24
|
+
};
|
|
25
|
+
/** Compose a single-line instruction the destination AI will receive
|
|
26
|
+
* as its first message. Kept SHORT so URL+query fits in a QR. */
|
|
27
|
+
export function composePrompt(pasteUrl, nexusCode) {
|
|
28
|
+
return `Fetch ${pasteUrl} . AES-256-GCM decrypt with PBKDF2-SHA256 (200k iters, salt+iv+tag prefixed) using NEXUS code ${nexusCode}. The plaintext is a Mneme soul prompt -- resume the conversation.`;
|
|
29
|
+
}
|
|
30
|
+
export function buildDeepLink(input) {
|
|
31
|
+
const vendor = input.vendor ?? "any";
|
|
32
|
+
const prompt = composePrompt(input.pasteUrl, input.nexusCode);
|
|
33
|
+
const tmpl = TEMPLATES[vendor];
|
|
34
|
+
const url = tmpl ? `${tmpl}${encodeURIComponent(prompt)}` : prompt;
|
|
35
|
+
return { vendor, url, prompt, fitsInQR: new TextEncoder().encode(url).length < 270 };
|
|
36
|
+
}
|
|
37
|
+
/** Pick the deep link with the SHORTEST URL that still fits in a QR.
|
|
38
|
+
* Best for "I don't know which AI app the user has" scenarios. */
|
|
39
|
+
export function bestDeepLink(input) {
|
|
40
|
+
const candidates = ["gemini", "chatgpt", "claude", "any"];
|
|
41
|
+
let best = null;
|
|
42
|
+
for (const vendor of candidates) {
|
|
43
|
+
const dl = buildDeepLink({ ...input, vendor });
|
|
44
|
+
if (!dl.fitsInQR)
|
|
45
|
+
continue;
|
|
46
|
+
if (!best || dl.url.length < best.url.length)
|
|
47
|
+
best = dl;
|
|
48
|
+
}
|
|
49
|
+
return best ?? buildDeepLink({ ...input, vendor: "any" });
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=deep_link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deep_link.js","sourceRoot":"","sources":["../../src/relay/deep_link.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAUH,MAAM,SAAS,GAAmC;IAChD,MAAM,EAAE,+BAA+B;IACvC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,0BAA0B;IAClC,GAAG,EAAE,EAAE,EAAE,qBAAqB;CAC/B,CAAC;AAEF;kEACkE;AAClE,MAAM,UAAU,aAAa,CAAC,QAAgB,EAAE,SAAiB;IAC/D,OAAO,SAAS,QAAQ,iGAAiG,SAAS,oEAAoE,CAAC;AACzM,CAAC;AAYD,MAAM,UAAU,aAAa,CAAC,KAAoB;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC;IACrC,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IACnE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;AACvF,CAAC;AAED;mEACmE;AACnE,MAAM,UAAU,YAAY,CAAC,KAAoB;IAC/C,MAAM,UAAU,GAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC5E,IAAI,IAAI,GAAoB,IAAI,CAAC;IACjC,KAAK,MAAM,MAAM,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,EAAE,GAAG,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,EAAE,CAAC,QAAQ;YAAE,SAAS;QAC3B,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,IAAI,GAAG,EAAE,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,IAAI,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.87.0 -- RELAY: HANDOFF ARTIFACT.
|
|
3
|
+
*
|
|
4
|
+
* Combines (paste URL + NEXUS code + deep link + REAL scannable QR)
|
|
5
|
+
* into one bundle the source AI hands to the user. The user has
|
|
6
|
+
* THREE ways to use it -- any one works:
|
|
7
|
+
*
|
|
8
|
+
* 1. Scan the QR with phone camera → AI app opens with the
|
|
9
|
+
* prompt pre-filled → tap send → resume. ZERO typing.
|
|
10
|
+
* 2. Tap the deep link on a clickable device → same flow.
|
|
11
|
+
* 3. Copy the long prompt manually (fallback for cases without
|
|
12
|
+
* camera / clickable link).
|
|
13
|
+
*
|
|
14
|
+
* This closes the UX gap user surfaced: previously the only path was
|
|
15
|
+
* "copy 200 chars from PC to phone" which is hostile across devices.
|
|
16
|
+
* Now phone-camera-scan is the canonical path.
|
|
17
|
+
*/
|
|
18
|
+
import { type DeepLinkVendor } from "./deep_link.js";
|
|
19
|
+
export interface HandoffInput {
|
|
20
|
+
pasteUrl: string;
|
|
21
|
+
nexusCode: string;
|
|
22
|
+
/** Optional vendor hint. When omitted, AI picks the shortest fit. */
|
|
23
|
+
vendor?: DeepLinkVendor;
|
|
24
|
+
/** SVG module size (pixels). Default 8. */
|
|
25
|
+
moduleSize?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface HandoffArtifact {
|
|
28
|
+
pasteUrl: string;
|
|
29
|
+
nexusCode: string;
|
|
30
|
+
/** The deep link that gets QR-encoded. */
|
|
31
|
+
deepLink: {
|
|
32
|
+
vendor: DeepLinkVendor;
|
|
33
|
+
url: string;
|
|
34
|
+
prompt: string;
|
|
35
|
+
};
|
|
36
|
+
/** Real scannable QR (zero-dep encoder). */
|
|
37
|
+
qr: {
|
|
38
|
+
svg: string;
|
|
39
|
+
size: number;
|
|
40
|
+
version: number;
|
|
41
|
+
mask: number;
|
|
42
|
+
};
|
|
43
|
+
/** Plain-text fallback the user can copy if QR/deep-link unavailable. */
|
|
44
|
+
copyFallback: string;
|
|
45
|
+
/** One-line instructions per surface. */
|
|
46
|
+
instructions: {
|
|
47
|
+
qrScan: string;
|
|
48
|
+
tapLink: string;
|
|
49
|
+
manualCopy: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export declare function renderHandoff(input: HandoffInput): HandoffArtifact;
|
|
53
|
+
//# sourceMappingURL=handoff_artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff_artifact.d.ts","sourceRoot":"","sources":["../../src/relay/handoff_artifact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAA+B,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,QAAQ,EAAE;QAAE,MAAM,EAAE,cAAc,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,4CAA4C;IAC5C,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,yCAAyC;IACzC,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAiBlE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.87.0 -- RELAY: HANDOFF ARTIFACT.
|
|
3
|
+
*
|
|
4
|
+
* Combines (paste URL + NEXUS code + deep link + REAL scannable QR)
|
|
5
|
+
* into one bundle the source AI hands to the user. The user has
|
|
6
|
+
* THREE ways to use it -- any one works:
|
|
7
|
+
*
|
|
8
|
+
* 1. Scan the QR with phone camera → AI app opens with the
|
|
9
|
+
* prompt pre-filled → tap send → resume. ZERO typing.
|
|
10
|
+
* 2. Tap the deep link on a clickable device → same flow.
|
|
11
|
+
* 3. Copy the long prompt manually (fallback for cases without
|
|
12
|
+
* camera / clickable link).
|
|
13
|
+
*
|
|
14
|
+
* This closes the UX gap user surfaced: previously the only path was
|
|
15
|
+
* "copy 200 chars from PC to phone" which is hostile across devices.
|
|
16
|
+
* Now phone-camera-scan is the canonical path.
|
|
17
|
+
*/
|
|
18
|
+
import { encodeQRReal } from "../synapse/qr_real.js";
|
|
19
|
+
import { bestDeepLink, buildDeepLink } from "./deep_link.js";
|
|
20
|
+
export function renderHandoff(input) {
|
|
21
|
+
const link = input.vendor
|
|
22
|
+
? buildDeepLink({ pasteUrl: input.pasteUrl, nexusCode: input.nexusCode, vendor: input.vendor })
|
|
23
|
+
: bestDeepLink({ pasteUrl: input.pasteUrl, nexusCode: input.nexusCode });
|
|
24
|
+
const qr = encodeQRReal(link.url, { moduleSize: input.moduleSize ?? 8 });
|
|
25
|
+
return {
|
|
26
|
+
pasteUrl: input.pasteUrl,
|
|
27
|
+
nexusCode: input.nexusCode,
|
|
28
|
+
deepLink: { vendor: link.vendor, url: link.url, prompt: link.prompt },
|
|
29
|
+
qr: { svg: qr.svg, size: qr.size, version: qr.version, mask: qr.mask },
|
|
30
|
+
copyFallback: link.prompt,
|
|
31
|
+
instructions: {
|
|
32
|
+
qrScan: `Point your phone camera at the QR code. The AI app opens with the prompt pre-filled -- tap send and the conversation resumes.`,
|
|
33
|
+
tapLink: `Tap (or paste into your browser) this link: ${link.url}`,
|
|
34
|
+
manualCopy: `If neither scan nor tap works, copy this single line into any AI:\n\n${link.prompt}`,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=handoff_artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handoff_artifact.js","sourceRoot":"","sources":["../../src/relay/handoff_artifact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,Y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
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
package/dist/relay/index.js
CHANGED
package/dist/relay/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/relay/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
|
|
@@ -31,5 +31,11 @@ export interface MobileRecipe {
|
|
|
31
31
|
webAi: string;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
+
/** v1.87 API fix: accept object args (consistent with mintNexusCode).
|
|
35
|
+
* Positional form is kept as an overload for backwards compatibility. */
|
|
36
|
+
export declare function renderMobileRecipe(args: {
|
|
37
|
+
url: string;
|
|
38
|
+
code: string;
|
|
39
|
+
}): MobileRecipe;
|
|
34
40
|
export declare function renderMobileRecipe(url: string, code: string): MobileRecipe;
|
|
35
41
|
//# sourceMappingURL=mobile_recipe.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile_recipe.d.ts","sourceRoot":"","sources":["../../src/relay/mobile_recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,YAAY,EAAE;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"mobile_recipe.d.ts","sourceRoot":"","sources":["../../src/relay/mobile_recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,uEAAuE;IACvE,YAAY,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,YAAY,EAAE;QACZ,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;0EAC0E;AAC1E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,YAAY,CAAC;AACtF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC"}
|
|
@@ -15,7 +15,12 @@
|
|
|
15
15
|
*
|
|
16
16
|
* Returns the recipe + a QR-friendly payload combining URL + code.
|
|
17
17
|
*/
|
|
18
|
-
export function renderMobileRecipe(
|
|
18
|
+
export function renderMobileRecipe(a, b) {
|
|
19
|
+
const url = typeof a === "string" ? a : a.url;
|
|
20
|
+
const code = typeof a === "string" ? (b ?? "") : a.code;
|
|
21
|
+
return renderMobileRecipeImpl(url, code);
|
|
22
|
+
}
|
|
23
|
+
function renderMobileRecipeImpl(url, code) {
|
|
19
24
|
const mobilePrompt = `Fetch the URL ${url}. The text is encrypted with this NEXUS code: ${code}. ` +
|
|
20
25
|
`Decrypt it (AES-256-GCM with PBKDF2-SHA256 200k iterations, salt+iv+tag prefixed). ` +
|
|
21
26
|
`The plaintext is a Mneme soul prompt -- resume the conversation from there.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobile_recipe.js","sourceRoot":"","sources":["../../src/relay/mobile_recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"mobile_recipe.js","sourceRoot":"","sources":["../../src/relay/mobile_recipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAuBH,MAAM,UAAU,kBAAkB,CAAC,CAAyC,EAAE,CAAU;IACtF,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,OAAO,sBAAsB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAW,EAAE,IAAY;IACvD,MAAM,YAAY,GAChB,iBAAiB,GAAG,iDAAiD,IAAI,IAAI;QAC7E,qFAAqF;QACrF,6EAA6E,CAAC;IAChF,MAAM,SAAS,GAAG,SAAS,IAAI,IAAI,GAAG,EAAE,CAAC;IACzC,OAAO;QACL,GAAG;QACH,IAAI;QACJ,YAAY;QACZ,SAAS;QACT,YAAY,EAAE;YACZ,WAAW,EACT,iFAAiF,YAAY,mEAAmE;YAClK,gBAAgB,EACd,8FAA8F,IAAI,SAAS,GAAG,uEAAuE;YACvL,KAAK,EACH,4EAA4E,YAAY,sDAAsD;SACjJ;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.87.0 -- SYNAPSE: REAL QR code encoder (zero dependencies).
|
|
3
|
+
*
|
|
4
|
+
* Pure TypeScript / pure ESM implementation of QR Code Model 2 in
|
|
5
|
+
* byte mode at error-correction level L (low). Auto-selects version
|
|
6
|
+
* 1..10 based on payload size (max ~270 bytes). Output is an SVG
|
|
7
|
+
* that's actually scannable by any phone camera.
|
|
8
|
+
*
|
|
9
|
+
* No npm dependency. No remote QR-rendering service. No cloud.
|
|
10
|
+
*
|
|
11
|
+
* Algorithm reference: ISO/IEC 18004:2015 + Project Nayuki's
|
|
12
|
+
* public-domain reference (re-implemented from spec, not copied).
|
|
13
|
+
*
|
|
14
|
+
* Why this matters: the previous `qr_anchor.ts` was a deterministic
|
|
15
|
+
* stipple-art that LOOKED like a QR but wasn't scannable. User
|
|
16
|
+
* surfaced the bug directly: "นึกว่าจะมี qr code ที่ใช้ได้ 100%
|
|
17
|
+
* ถูกต้องให้สแกนแทน". v1.87 fixes that with REAL QR.
|
|
18
|
+
*/
|
|
19
|
+
export interface QRRealResult {
|
|
20
|
+
/** Final dark/light matrix. */
|
|
21
|
+
matrix: Uint8Array[];
|
|
22
|
+
/** Module dimension. */
|
|
23
|
+
size: number;
|
|
24
|
+
/** QR version (1..10). */
|
|
25
|
+
version: number;
|
|
26
|
+
/** Mask index 0..7 chosen. */
|
|
27
|
+
mask: number;
|
|
28
|
+
/** SVG render. */
|
|
29
|
+
svg: string;
|
|
30
|
+
}
|
|
31
|
+
/** Encode `payload` (a string -- UTF-8 encoded internally) as a real
|
|
32
|
+
* QR code. Returns the matrix + an SVG render. */
|
|
33
|
+
export declare function encodeQRReal(payload: string, opts?: {
|
|
34
|
+
moduleSize?: number;
|
|
35
|
+
quietZone?: number;
|
|
36
|
+
}): QRRealResult;
|
|
37
|
+
//# sourceMappingURL=qr_real.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qr_real.d.ts","sourceRoot":"","sources":["../../src/synapse/qr_real.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA2UH,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;mDACmD;AACnD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,CA8ClH"}
|