@mneme-ai/core 1.72.0 → 1.74.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/genesplice/genesplice.test.d.ts +5 -0
- package/dist/genesplice/genesplice.test.d.ts.map +1 -0
- package/dist/genesplice/genesplice.test.js +222 -0
- package/dist/genesplice/genesplice.test.js.map +1 -0
- package/dist/genesplice/genome_recombine.d.ts +61 -0
- package/dist/genesplice/genome_recombine.d.ts.map +1 -0
- package/dist/genesplice/genome_recombine.js +135 -0
- package/dist/genesplice/genome_recombine.js.map +1 -0
- package/dist/genesplice/gist_transmit.d.ts +57 -0
- package/dist/genesplice/gist_transmit.d.ts.map +1 -0
- package/dist/genesplice/gist_transmit.js +87 -0
- package/dist/genesplice/gist_transmit.js.map +1 -0
- package/dist/genesplice/index.d.ts +26 -0
- package/dist/genesplice/index.d.ts.map +1 -0
- package/dist/genesplice/index.js +26 -0
- package/dist/genesplice/index.js.map +1 -0
- package/dist/genesplice/phenotype.d.ts +33 -0
- package/dist/genesplice/phenotype.d.ts.map +1 -0
- package/dist/genesplice/phenotype.js +73 -0
- package/dist/genesplice/phenotype.js.map +1 -0
- package/dist/genesplice/soul_prompt.d.ts +87 -0
- package/dist/genesplice/soul_prompt.d.ts.map +1 -0
- package/dist/genesplice/soul_prompt.js +162 -0
- package/dist/genesplice/soul_prompt.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/dist/permeate/bookmarklet_generator.d.ts +26 -0
- package/dist/permeate/bookmarklet_generator.d.ts.map +1 -0
- package/dist/permeate/bookmarklet_generator.js +56 -0
- package/dist/permeate/bookmarklet_generator.js.map +1 -0
- package/dist/permeate/editor_integration_map.d.ts +43 -0
- package/dist/permeate/editor_integration_map.d.ts.map +1 -0
- package/dist/permeate/editor_integration_map.js +180 -0
- package/dist/permeate/editor_integration_map.js.map +1 -0
- package/dist/permeate/index.d.ts +25 -0
- package/dist/permeate/index.d.ts.map +1 -0
- package/dist/permeate/index.js +25 -0
- package/dist/permeate/index.js.map +1 -0
- package/dist/permeate/permeate.test.d.ts +5 -0
- package/dist/permeate/permeate.test.d.ts.map +1 -0
- package/dist/permeate/permeate.test.js +141 -0
- package/dist/permeate/permeate.test.js.map +1 -0
- package/dist/permeate/transport_menu.d.ts +35 -0
- package/dist/permeate/transport_menu.d.ts.map +1 -0
- package/dist/permeate/transport_menu.js +96 -0
- package/dist/permeate/transport_menu.js.map +1 -0
- package/dist/permeate/userscript_generator.d.ts +42 -0
- package/dist/permeate/userscript_generator.d.ts.map +1 -0
- package/dist/permeate/userscript_generator.js +170 -0
- package/dist/permeate/userscript_generator.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.74.0 -- PERMEATE P4: CROSS-MACHINE TRANSPORT MENU.
|
|
3
|
+
*
|
|
4
|
+
* Answers the user's question: "How do I move a soul prompt across
|
|
5
|
+
* two computers?" Returns 4 ranked options with concrete steps.
|
|
6
|
+
*/
|
|
7
|
+
export const TRANSPORT_OPTIONS = [
|
|
8
|
+
{
|
|
9
|
+
method: "clipboard-relay",
|
|
10
|
+
title: "Copy-paste via clipboard (messenger / email / Slack)",
|
|
11
|
+
whatItDoes: "Move soul prompt as plain text from machine A to machine B using any chat / email / Slack DM.",
|
|
12
|
+
steps: [
|
|
13
|
+
"Machine A: AI runs mneme.genesplice.transmit -> outputs ~500-token soul prompt",
|
|
14
|
+
"Machine A: highlight + copy the soul prompt",
|
|
15
|
+
"Machine A: paste into your messenger of choice (Telegram / Slack / Email to yourself)",
|
|
16
|
+
"Machine B: open the message, copy the soul prompt",
|
|
17
|
+
"Machine B: paste into ChatGPT / Gemini / Claude.ai chat input",
|
|
18
|
+
"Receiving AI replies: 'Resumed from claude-opus-4-7...' — context transferred",
|
|
19
|
+
],
|
|
20
|
+
pros: ["Works on every OS", "No accounts needed", "Plain text, future-proof"],
|
|
21
|
+
friction: 1,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
method: "gist",
|
|
25
|
+
title: "GitHub Gist (user-owned cloud)",
|
|
26
|
+
whatItDoes: "Upload soul prompt to your own GitHub Gist; share URL with yourself; receiving AI fetches it.",
|
|
27
|
+
steps: [
|
|
28
|
+
"Machine A: AI runs mneme.genesplice.transmit with includeGistPackage=true",
|
|
29
|
+
"Machine A: copy the wrapped content; open https://gist.github.com/new",
|
|
30
|
+
"Machine A: paste content, set visibility to 'secret', click Create gist",
|
|
31
|
+
"Machine A: copy the gist URL",
|
|
32
|
+
"Machine B: tell the AI: 'Resume Mneme soul from this gist: <URL>'",
|
|
33
|
+
"Receiving AI fetches the URL, ingests the soul, continues",
|
|
34
|
+
],
|
|
35
|
+
pros: ["Persistent URL works across all your machines", "Secret gist is private but accessible by you", "Version history if you create new gist revisions"],
|
|
36
|
+
friction: 2,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
method: "wanderer-mwt",
|
|
40
|
+
title: "Wanderer .mwt portable bundle (USB / email attachment)",
|
|
41
|
+
whatItDoes: "Pack entire Mneme state (capsules, vaccines, genome) into a single signed .mwt file; transport via USB / email attachment / cloud storage.",
|
|
42
|
+
steps: [
|
|
43
|
+
"Machine A: AI runs mneme wanderer pack -> .mwt file",
|
|
44
|
+
"Move the .mwt to machine B (USB / email / Dropbox / WhatsApp file)",
|
|
45
|
+
"Machine B: AI runs mneme wanderer unpack <file>.mwt",
|
|
46
|
+
"Machine B: Mneme state restored; capsules + vaccines + genome merged",
|
|
47
|
+
"Both machines now share full Mneme history; cross-vendor handover works locally on each",
|
|
48
|
+
],
|
|
49
|
+
pros: ["Full state transfer (not just current session)", "HMAC-signed = tamper-evident", "Works offline"],
|
|
50
|
+
friction: 3,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
method: "qr-code-svg",
|
|
54
|
+
title: "QR code (laptop -> phone -> any AI app)",
|
|
55
|
+
whatItDoes: "Encode the soul prompt as a QR code; scan with phone; paste into a mobile AI app or share back.",
|
|
56
|
+
steps: [
|
|
57
|
+
"Machine A: AI runs mneme.permeate.qr-encode <soul-prompt>",
|
|
58
|
+
"Machine A: display the SVG QR code on screen",
|
|
59
|
+
"Machine B (phone): scan QR with camera app",
|
|
60
|
+
"Phone: copy the decoded text",
|
|
61
|
+
"Phone: paste into ChatGPT mobile app / Gemini app",
|
|
62
|
+
"Receiving AI replies with resumed context",
|
|
63
|
+
],
|
|
64
|
+
pros: ["No accounts needed", "Works between laptop + phone instantly", "No cloud / network needed"],
|
|
65
|
+
friction: 2,
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
export function recommendTransport(opts = {}) {
|
|
69
|
+
if (opts.laptopToPhone) {
|
|
70
|
+
return {
|
|
71
|
+
recommended: "qr-code-svg",
|
|
72
|
+
rationale: "Laptop->phone transfer; QR is instant + no accounts needed.",
|
|
73
|
+
rankedOptions: [...TRANSPORT_OPTIONS].sort((a, b) => a.friction - b.friction),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (opts.preferOffline) {
|
|
77
|
+
return {
|
|
78
|
+
recommended: "wanderer-mwt",
|
|
79
|
+
rationale: "Offline preference; .mwt bundle works over USB without any network.",
|
|
80
|
+
rankedOptions: [...TRANSPORT_OPTIONS].sort((a, b) => a.friction - b.friction),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (opts.hasGithubAccount) {
|
|
84
|
+
return {
|
|
85
|
+
recommended: "gist",
|
|
86
|
+
rationale: "GitHub account present; Gist gives persistent URL across all machines.",
|
|
87
|
+
rankedOptions: [...TRANSPORT_OPTIONS].sort((a, b) => a.friction - b.friction),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
recommended: "clipboard-relay",
|
|
92
|
+
rationale: "No account / setup required. Works for everyone via any messenger.",
|
|
93
|
+
rankedOptions: [...TRANSPORT_OPTIONS].sort((a, b) => a.friction - b.friction),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=transport_menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport_menu.js","sourceRoot":"","sources":["../../src/permeate/transport_menu.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.74.0 -- PERMEATE P1: USERSCRIPT GENERATOR.
|
|
3
|
+
*
|
|
4
|
+
* Routes around Chrome Web Store / Firefox Addons / Safari approval
|
|
5
|
+
* by emitting a Tampermonkey/Greasemonkey/Violentmonkey-compatible
|
|
6
|
+
* userscript. User installs the userscript manager once (free,
|
|
7
|
+
* single click) and the Mneme userscript adds a floating "💉
|
|
8
|
+
* Inject Mneme Soul" button to ChatGPT / Gemini / Claude.ai /
|
|
9
|
+
* Copilot / DeepSeek chats.
|
|
10
|
+
*
|
|
11
|
+
* The userscript is PURE BROWSER JS -- no Node, no HTTP, no
|
|
12
|
+
* backend. Reads soul prompt from clipboard, finds the chat input
|
|
13
|
+
* element via known selectors, injects + submits.
|
|
14
|
+
*
|
|
15
|
+
* Selectors per site (kept conservative; fallbacks included):
|
|
16
|
+
* ChatGPT div#prompt-textarea / textarea
|
|
17
|
+
* Gemini rich-textarea / textarea
|
|
18
|
+
* Claude.ai div[contenteditable="true"]
|
|
19
|
+
* Copilot textarea[aria-label]
|
|
20
|
+
* DeepSeek textarea#chat-input
|
|
21
|
+
*/
|
|
22
|
+
export interface UserscriptOptions {
|
|
23
|
+
/** Mneme version stamped into the script header. */
|
|
24
|
+
mnemeVersion: string;
|
|
25
|
+
/** Optional Mneme HTTP bridge URL for auto-fetch (v1.72 D4). When
|
|
26
|
+
* set, the userscript also adds a "Fetch from local Mneme" button
|
|
27
|
+
* that hits the bridge instead of requiring clipboard paste. */
|
|
28
|
+
bridgeUrl?: string;
|
|
29
|
+
/** Bearer token for the bridge (only used when bridgeUrl is set). */
|
|
30
|
+
bridgeToken?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface UserscriptArtifact {
|
|
33
|
+
/** Full .user.js file content. User saves this and Tampermonkey
|
|
34
|
+
* asks to install. */
|
|
35
|
+
content: string;
|
|
36
|
+
/** Filename suggestion. */
|
|
37
|
+
filename: string;
|
|
38
|
+
/** Direct-install URL guidance (raw file from gist, etc). */
|
|
39
|
+
installNote: string;
|
|
40
|
+
}
|
|
41
|
+
export declare function generateUserscript(opts: UserscriptOptions): UserscriptArtifact;
|
|
42
|
+
//# sourceMappingURL=userscript_generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userscript_generator.d.ts","sourceRoot":"","sources":["../../src/permeate/userscript_generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB;;qEAEiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC;2BACuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,kBAAkB,CAsJ9E"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v1.74.0 -- PERMEATE P1: USERSCRIPT GENERATOR.
|
|
3
|
+
*
|
|
4
|
+
* Routes around Chrome Web Store / Firefox Addons / Safari approval
|
|
5
|
+
* by emitting a Tampermonkey/Greasemonkey/Violentmonkey-compatible
|
|
6
|
+
* userscript. User installs the userscript manager once (free,
|
|
7
|
+
* single click) and the Mneme userscript adds a floating "💉
|
|
8
|
+
* Inject Mneme Soul" button to ChatGPT / Gemini / Claude.ai /
|
|
9
|
+
* Copilot / DeepSeek chats.
|
|
10
|
+
*
|
|
11
|
+
* The userscript is PURE BROWSER JS -- no Node, no HTTP, no
|
|
12
|
+
* backend. Reads soul prompt from clipboard, finds the chat input
|
|
13
|
+
* element via known selectors, injects + submits.
|
|
14
|
+
*
|
|
15
|
+
* Selectors per site (kept conservative; fallbacks included):
|
|
16
|
+
* ChatGPT div#prompt-textarea / textarea
|
|
17
|
+
* Gemini rich-textarea / textarea
|
|
18
|
+
* Claude.ai div[contenteditable="true"]
|
|
19
|
+
* Copilot textarea[aria-label]
|
|
20
|
+
* DeepSeek textarea#chat-input
|
|
21
|
+
*/
|
|
22
|
+
export function generateUserscript(opts) {
|
|
23
|
+
const header = [
|
|
24
|
+
"// ==UserScript==",
|
|
25
|
+
"// @name Mneme Soul Injector",
|
|
26
|
+
"// @namespace https://github.com/patsa2561-art/mneme-ai",
|
|
27
|
+
`// @version ${opts.mnemeVersion}`,
|
|
28
|
+
"// @description Inject Mneme cross-vendor brain (soul prompt) into ChatGPT, Gemini, Claude.ai, Copilot, DeepSeek. No store approval needed.",
|
|
29
|
+
"// @author Mneme",
|
|
30
|
+
"// @match https://chatgpt.com/*",
|
|
31
|
+
"// @match https://chat.openai.com/*",
|
|
32
|
+
"// @match https://gemini.google.com/*",
|
|
33
|
+
"// @match https://aistudio.google.com/*",
|
|
34
|
+
"// @match https://claude.ai/*",
|
|
35
|
+
"// @match https://copilot.microsoft.com/*",
|
|
36
|
+
"// @match https://chat.deepseek.com/*",
|
|
37
|
+
"// @match https://chat.qwenlm.ai/*",
|
|
38
|
+
"// @grant GM_setClipboard",
|
|
39
|
+
"// @grant GM_xmlhttpRequest",
|
|
40
|
+
"// @run-at document-idle",
|
|
41
|
+
"// ==/UserScript==",
|
|
42
|
+
].join("\n");
|
|
43
|
+
const bridgeBlock = opts.bridgeUrl
|
|
44
|
+
? `
|
|
45
|
+
// ── BRIDGE FETCH (when local Mneme HTTP bridge is reachable) ─────
|
|
46
|
+
const BRIDGE_URL = ${JSON.stringify(opts.bridgeUrl)};
|
|
47
|
+
const BRIDGE_TOKEN = ${JSON.stringify(opts.bridgeToken ?? "")};
|
|
48
|
+
async function fetchSoulFromBridge() {
|
|
49
|
+
try {
|
|
50
|
+
const res = await fetch(BRIDGE_URL + "/v1/health", {
|
|
51
|
+
headers: BRIDGE_TOKEN ? { Authorization: "Bearer " + BRIDGE_TOKEN } : {}
|
|
52
|
+
});
|
|
53
|
+
if (!res.ok) return null;
|
|
54
|
+
// The user must transmit the soul prompt server-side; bridge
|
|
55
|
+
// doesn't yet have a /v1/soul GET. Future: add endpoint.
|
|
56
|
+
return null;
|
|
57
|
+
} catch { return null; }
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
: "";
|
|
61
|
+
const body = `
|
|
62
|
+
(function() {
|
|
63
|
+
'use strict';
|
|
64
|
+
|
|
65
|
+
const SITE = (() => {
|
|
66
|
+
const h = location.hostname;
|
|
67
|
+
if (h.includes('chatgpt.com') || h.includes('openai.com')) return 'chatgpt';
|
|
68
|
+
if (h.includes('gemini.google.com') || h.includes('aistudio.google.com')) return 'gemini';
|
|
69
|
+
if (h.includes('claude.ai')) return 'claude-ai';
|
|
70
|
+
if (h.includes('copilot.microsoft.com')) return 'copilot';
|
|
71
|
+
if (h.includes('deepseek.com')) return 'deepseek';
|
|
72
|
+
if (h.includes('qwenlm.ai')) return 'qwen';
|
|
73
|
+
return 'unknown';
|
|
74
|
+
})();
|
|
75
|
+
|
|
76
|
+
// Selector ladder per site -- try each, use the first that matches.
|
|
77
|
+
const SELECTORS = {
|
|
78
|
+
chatgpt: ['div#prompt-textarea', 'textarea[data-id="root"]', 'textarea#prompt-textarea', 'div[contenteditable="true"]'],
|
|
79
|
+
gemini: ['rich-textarea div[contenteditable="true"]', 'rich-textarea', 'textarea'],
|
|
80
|
+
'claude-ai':['div[contenteditable="true"]', 'div[data-placeholder]'],
|
|
81
|
+
copilot: ['textarea[aria-label*="Ask"]', 'textarea'],
|
|
82
|
+
deepseek: ['textarea#chat-input', 'textarea'],
|
|
83
|
+
qwen: ['textarea', 'div[contenteditable="true"]'],
|
|
84
|
+
unknown: ['textarea', 'div[contenteditable="true"]'],
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function findInput() {
|
|
88
|
+
const candidates = SELECTORS[SITE] || SELECTORS.unknown;
|
|
89
|
+
for (const sel of candidates) {
|
|
90
|
+
const el = document.querySelector(sel);
|
|
91
|
+
if (el) return el;
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function injectText(el, text) {
|
|
97
|
+
if (el.tagName === 'TEXTAREA' || el.tagName === 'INPUT') {
|
|
98
|
+
const setter = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')?.set
|
|
99
|
+
|| Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;
|
|
100
|
+
if (setter) setter.call(el, text);
|
|
101
|
+
else el.value = text;
|
|
102
|
+
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
103
|
+
} else {
|
|
104
|
+
// contenteditable -- use execCommand for compat with React-controlled fields
|
|
105
|
+
el.focus();
|
|
106
|
+
try {
|
|
107
|
+
document.execCommand('selectAll', false);
|
|
108
|
+
document.execCommand('insertText', false, text);
|
|
109
|
+
} catch {
|
|
110
|
+
el.textContent = text;
|
|
111
|
+
el.dispatchEvent(new Event('input', { bubbles: true }));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function makeButton() {
|
|
117
|
+
const btn = document.createElement('button');
|
|
118
|
+
btn.textContent = '💉 Inject Mneme Soul';
|
|
119
|
+
btn.style.cssText = \`
|
|
120
|
+
position: fixed; top: 12px; right: 12px; z-index: 99999;
|
|
121
|
+
background: linear-gradient(135deg,#7c3aed,#ec4899);
|
|
122
|
+
color: #fff; font-weight: 600; border: 0; border-radius: 8px;
|
|
123
|
+
padding: 8px 14px; cursor: pointer;
|
|
124
|
+
font-family: ui-sans-serif, system-ui, sans-serif;
|
|
125
|
+
box-shadow: 0 4px 14px rgba(124,58,237,0.4);
|
|
126
|
+
font-size: 13px;
|
|
127
|
+
\`;
|
|
128
|
+
btn.title = 'Paste a Mneme soul prompt to inject into the chat input';
|
|
129
|
+
btn.onclick = async () => {
|
|
130
|
+
let soul;
|
|
131
|
+
try { soul = await navigator.clipboard.readText(); }
|
|
132
|
+
catch { soul = prompt('Paste your Mneme soul prompt:'); }
|
|
133
|
+
if (!soul || !soul.includes('MNEME SOUL PROMPT')) {
|
|
134
|
+
alert('That does not look like a Mneme soul prompt. Copy the full text starting with "# 🧬 MNEME SOUL PROMPT".');
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const el = findInput();
|
|
138
|
+
if (!el) {
|
|
139
|
+
alert('Could not find the chat input on this page. The site UI may have changed.');
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
injectText(el, soul);
|
|
143
|
+
btn.textContent = '✓ Soul injected';
|
|
144
|
+
setTimeout(() => { btn.textContent = '💉 Inject Mneme Soul'; }, 2500);
|
|
145
|
+
};
|
|
146
|
+
return btn;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function ensureButton() {
|
|
150
|
+
if (document.getElementById('mneme-inject-btn')) return;
|
|
151
|
+
const btn = makeButton();
|
|
152
|
+
btn.id = 'mneme-inject-btn';
|
|
153
|
+
document.body.appendChild(btn);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// React-rendered sites re-mount; observe DOM and re-attach if needed.
|
|
157
|
+
const obs = new MutationObserver(() => ensureButton());
|
|
158
|
+
obs.observe(document.body, { childList: true, subtree: false });
|
|
159
|
+
ensureButton();
|
|
160
|
+
console.log('[Mneme] Soul injector ready -- site=' + SITE);
|
|
161
|
+
})();
|
|
162
|
+
`.trim();
|
|
163
|
+
const content = `${header}\n\n${bridgeBlock}${body}\n`;
|
|
164
|
+
return {
|
|
165
|
+
content,
|
|
166
|
+
filename: `mneme-soul-injector-${opts.mnemeVersion}.user.js`,
|
|
167
|
+
installNote: `Install: (1) Add the Tampermonkey/Violentmonkey extension to your browser. (2) Click the .user.js file -- Tampermonkey will prompt to install. (3) Open ChatGPT/Gemini/Claude.ai -- the 💉 button appears top-right. (4) Copy a Mneme soul prompt, click the button, soul is injected into the chat.`,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=userscript_generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userscript_generator.js","sourceRoot":"","sources":["../../src/permeate/userscript_generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAuBH,MAAM,UAAU,kBAAkB,CAAC,IAAuB;IACxD,MAAM,MAAM,GAAG;QACb,mBAAmB;QACnB,sCAAsC;QACtC,4DAA4D;QAC5D,oBAAoB,IAAI,CAAC,YAAY,EAAE;QACvC,8IAA8I;QAC9I,wBAAwB;QACxB,wCAAwC;QACxC,4CAA4C;QAC5C,8CAA8C;QAC9C,gDAAgD;QAChD,sCAAsC;QACtC,kDAAkD;QAClD,8CAA8C;QAC9C,2CAA2C;QAC3C,kCAAkC;QAClC,oCAAoC;QACpC,gCAAgC;QAChC,oBAAoB;KACrB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEb,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS;QAChC,CAAC,CAAC;;qBAEe,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;uBAC5B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;;;;;;;;;;;;CAY5D;QACG,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqGd,CAAC,IAAI,EAAE,CAAC;IAEP,MAAM,OAAO,GAAG,GAAG,MAAM,OAAO,WAAW,GAAG,IAAI,IAAI,CAAC;IACvD,OAAO;QACL,OAAO;QACP,QAAQ,EAAE,uBAAuB,IAAI,CAAC,YAAY,UAAU;QAC5D,WAAW,EAAE,sSAAsS;KACpT,CAAC;AACJ,CAAC"}
|