@tangle-network/agent-app 0.51.12 → 0.51.14
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/app-auth/index.js +1 -1
- package/dist/assistant/index.js +1 -1
- package/dist/chat-react/index.js +1 -1
- package/dist/chat-routes/index.js +2 -2
- package/dist/{chunk-TA5Q4I2K.js → chunk-7KKOFMLD.js} +4 -2
- package/dist/chunk-7KKOFMLD.js.map +1 -0
- package/dist/{chunk-YFGG722I.js → chunk-ELROJHE2.js} +2 -2
- package/dist/{chunk-BYAQQPLN.js → chunk-O3I7RQCB.js} +4 -4
- package/dist/chunk-O3I7RQCB.js.map +1 -0
- package/dist/{chunk-5P6TB74H.js → chunk-SMRF4UMN.js} +11 -13
- package/dist/chunk-SMRF4UMN.js.map +1 -0
- package/dist/{chunk-WWFE5EXY.js → chunk-TSZIYQAZ.js} +11 -4
- package/dist/chunk-TSZIYQAZ.js.map +1 -0
- package/dist/crypto/index.js +1 -1
- package/dist/interactions/index.js +3 -1
- package/dist/interactions/route.d.ts +2 -0
- package/dist/openui/index.js +8 -3
- package/dist/openui/index.js.map +1 -1
- package/dist/openui/route.d.ts +2 -0
- package/dist/platform/index.js +1 -1
- package/dist/preset-cloudflare/index.js +1 -1
- package/dist/public-consultation/index.js +2 -2
- package/dist/web-react/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-5P6TB74H.js.map +0 -1
- package/dist/chunk-BYAQQPLN.js.map +0 -1
- package/dist/chunk-TA5Q4I2K.js.map +0 -1
- package/dist/chunk-WWFE5EXY.js.map +0 -1
- /package/dist/{chunk-YFGG722I.js.map → chunk-ELROJHE2.js.map} +0 -0
package/dist/app-auth/index.js
CHANGED
package/dist/assistant/index.js
CHANGED
package/dist/chat-react/index.js
CHANGED
|
@@ -64,8 +64,8 @@ import {
|
|
|
64
64
|
rowIdOf,
|
|
65
65
|
storeSupportsDraftPersistence,
|
|
66
66
|
streamChatRouteAsSandboxEvents
|
|
67
|
-
} from "../chunk-
|
|
68
|
-
import "../chunk-
|
|
67
|
+
} from "../chunk-ELROJHE2.js";
|
|
68
|
+
import "../chunk-TSZIYQAZ.js";
|
|
69
69
|
import "../chunk-TZEEGDHS.js";
|
|
70
70
|
import "../chunk-3NCPXNBZ.js";
|
|
71
71
|
import {
|
|
@@ -3,7 +3,9 @@ var IV_LENGTH = 12;
|
|
|
3
3
|
var TAG_LENGTH = 16;
|
|
4
4
|
var ALGORITHM = "AES-GCM";
|
|
5
5
|
function decodeHexKey(keyHex) {
|
|
6
|
-
if (
|
|
6
|
+
if (!/^[0-9a-fA-F]{64}$/.test(keyHex)) {
|
|
7
|
+
throw new Error("encryption key must be a 64-char hex string (32 bytes)");
|
|
8
|
+
}
|
|
7
9
|
const bytes = new Uint8Array(32);
|
|
8
10
|
for (let i = 0; i < 64; i += 2) bytes[i / 2] = parseInt(keyHex.substring(i, i + 2), 16);
|
|
9
11
|
return bytes;
|
|
@@ -99,4 +101,4 @@ export {
|
|
|
99
101
|
encryptBytes,
|
|
100
102
|
decryptBytes
|
|
101
103
|
};
|
|
102
|
-
//# sourceMappingURL=chunk-
|
|
104
|
+
//# sourceMappingURL=chunk-7KKOFMLD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/crypto/index.ts"],"sourcesContent":["/**\n * AES-256-GCM field encryption (for PII at rest — SSN/EIN/ID numbers, secrets).\n * WebCrypto only — runs on Cloudflare Workers, Node, and the browser with no\n * Node `crypto` dependency. The 32-byte key is a PARAMETER (64-char hex); the\n * framework never reads env — the product binds its own `ENCRYPTION_KEY` (this\n * is the concrete impl behind the `KeyCrypto` seam in `../billing`).\n *\n * Wire format: base64(iv ‖ ciphertext ‖ tag) — the 12-byte IV is prepended; the\n * GCM auth tag is appended by WebCrypto inside the ciphertext.\n */\n\nconst IV_LENGTH = 12\nconst TAG_LENGTH = 16\nconst ALGORITHM = 'AES-GCM'\n\n/** Validate + decode a 64-char hex key to 32 bytes. Throws on the wrong shape so\n * a misconfigured key fails loud, never silently weakens encryption. */\nexport function decodeHexKey(keyHex: string): Uint8Array {\n // Charset-validated BEFORE decoding: `parseInt('zz', 16)` is NaN, and a NaN\n // assignment to a Uint8Array silently stores 0 — a 64-char non-hex string\n // would otherwise produce an all-zero key instead of throwing, contradicting\n // the fail-loud contract above (found in redteam review, issue #747).\n if (!/^[0-9a-fA-F]{64}$/.test(keyHex)) {\n throw new Error('encryption key must be a 64-char hex string (32 bytes)')\n }\n const bytes = new Uint8Array(32)\n for (let i = 0; i < 64; i += 2) bytes[i / 2] = parseInt(keyHex.substring(i, i + 2), 16)\n return bytes\n}\n\nasync function importKey(keyHex: string): Promise<CryptoKey> {\n const raw = decodeHexKey(keyHex)\n return crypto.subtle.importKey('raw', raw.buffer as ArrayBuffer, { name: ALGORITHM } as Algorithm, false, ['encrypt', 'decrypt'])\n}\n\nfunction toBase64(data: Uint8Array): string {\n let binary = ''\n for (let i = 0; i < data.length; i++) binary += String.fromCharCode(data[i]!)\n return btoa(binary)\n}\n\nfunction fromBase64(b64: string): Uint8Array {\n const binary = atob(b64)\n const bytes = new Uint8Array(binary.length)\n for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i)\n return bytes\n}\n\n/** Encrypt `plaintext` with AES-256-GCM under `keyHex`. Returns\n * base64(iv ‖ ciphertext ‖ tag). A fresh random IV per call. */\nexport async function encryptAesGcm(plaintext: string, keyHex: string): Promise<string> {\n const key = await importKey(keyHex)\n const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH))\n const ciphertext = await crypto.subtle.encrypt({ name: ALGORITHM, iv, tagLength: TAG_LENGTH * 8 }, key, new TextEncoder().encode(plaintext))\n const result = new Uint8Array(IV_LENGTH + ciphertext.byteLength)\n result.set(iv, 0)\n result.set(new Uint8Array(ciphertext), IV_LENGTH)\n return toBase64(result)\n}\n\n/** Decrypt a base64(iv ‖ ciphertext ‖ tag) string under `keyHex`. Throws if the\n * tag fails (tamper/wrong key). */\nexport async function decryptAesGcm(encrypted: string, keyHex: string): Promise<string> {\n const key = await importKey(keyHex)\n const data = fromBase64(encrypted)\n const iv = data.slice(0, IV_LENGTH)\n const ciphertext = data.slice(IV_LENGTH)\n const plain = await crypto.subtle.decrypt({ name: ALGORITHM, iv, tagLength: TAG_LENGTH * 8 }, key, ciphertext)\n return new TextDecoder().decode(plain)\n}\n\n/** Build a {@link import('../billing').KeyCrypto}-compatible pair bound to a key\n * (or a key-resolver, for env-backed keys resolved per call). */\nexport function createFieldCrypto(key: string | (() => string)): { encrypt(s: string): Promise<string>; decrypt(s: string): Promise<string> } {\n const resolve = typeof key === 'function' ? key : () => key\n return {\n encrypt: (s) => encryptAesGcm(s, resolve()),\n decrypt: (s) => decryptAesGcm(s, resolve()),\n }\n}\n\n/**\n * --- Passphrase-derived key path (PBKDF2 → AES-256-GCM CryptoKey) ---\n *\n * The `encryptAesGcm`/`decryptAesGcm` path takes a raw 64-char-hex key. Some\n * products instead bind a SECRET STRING (not a hex key) and derive the AES key\n * with PBKDF2 — and need a BINARY path (encrypting document bytes, not just\n * strings). Both are exposed here so a product never hand-rolls WebCrypto.\n *\n * The derivation parameters (salt, iterations) are PARAMETERS — a product pins\n * its own so the derived key bytes stay stable for data already at rest. The\n * defaults are a sensible baseline; any product supplies its own via\n * {@link DeriveKeyOptions}.\n */\n\nexport interface DeriveKeyOptions {\n /** PBKDF2 salt. A product MUST pin this — changing it changes the derived key\n * bytes and orphans every value already encrypted at rest. */\n salt: Uint8Array | string\n /** PBKDF2 iteration count. Pin it for the same reason as `salt`. */\n iterations: number\n /** PBKDF2 hash. Default `'SHA-256'`. */\n hash?: 'SHA-256' | 'SHA-384' | 'SHA-512'\n}\n\n/** Derive an AES-256-GCM `CryptoKey` from a secret string via PBKDF2. The key is\n * non-extractable and usable only for encrypt/decrypt. */\nexport async function deriveKey(secret: string, opts: DeriveKeyOptions): Promise<CryptoKey> {\n const salt = typeof opts.salt === 'string' ? new TextEncoder().encode(opts.salt) : opts.salt\n const keyMaterial = await crypto.subtle.importKey('raw', new TextEncoder().encode(secret), 'PBKDF2', false, ['deriveKey'])\n return crypto.subtle.deriveKey(\n { name: 'PBKDF2', salt: salt as BufferSource, iterations: opts.iterations, hash: opts.hash ?? 'SHA-256' },\n keyMaterial,\n { name: ALGORITHM, length: 256 },\n false,\n ['encrypt', 'decrypt'],\n )\n}\n\n/** Encrypt `plaintext` under a derived `CryptoKey`. Returns base64(iv ‖ ct ‖ tag). */\nexport async function encryptWithKey(plaintext: string, key: CryptoKey): Promise<string> {\n const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH))\n const ciphertext = await crypto.subtle.encrypt({ name: ALGORITHM, iv }, key, new TextEncoder().encode(plaintext))\n const out = new Uint8Array(IV_LENGTH + ciphertext.byteLength)\n out.set(iv, 0)\n out.set(new Uint8Array(ciphertext), IV_LENGTH)\n return toBase64(out)\n}\n\n/** Decrypt a base64(iv ‖ ct ‖ tag) string under a derived `CryptoKey`. */\nexport async function decryptWithKey(encoded: string, key: CryptoKey): Promise<string> {\n const raw = fromBase64(encoded)\n const iv = raw.slice(0, IV_LENGTH)\n const ciphertext = raw.slice(IV_LENGTH)\n const plain = await crypto.subtle.decrypt({ name: ALGORITHM, iv }, key, ciphertext)\n return new TextDecoder().decode(plain)\n}\n\n/** Encrypt binary data under a derived `CryptoKey`. Returns an ArrayBuffer:\n * 12-byte IV ‖ ciphertext ‖ 16-byte GCM tag (same wire layout as the string\n * path, raw bytes instead of base64). */\nexport async function encryptBytes(data: ArrayBuffer, key: CryptoKey): Promise<ArrayBuffer> {\n const iv = crypto.getRandomValues(new Uint8Array(IV_LENGTH))\n const ciphertext = await crypto.subtle.encrypt({ name: ALGORITHM, iv }, key, data)\n const out = new Uint8Array(IV_LENGTH + ciphertext.byteLength)\n out.set(iv, 0)\n out.set(new Uint8Array(ciphertext), IV_LENGTH)\n return out.buffer\n}\n\n/** Decrypt binary data (IV ‖ ciphertext ‖ tag) under a derived `CryptoKey`. */\nexport async function decryptBytes(data: ArrayBuffer, key: CryptoKey): Promise<ArrayBuffer> {\n const raw = new Uint8Array(data)\n const iv = raw.slice(0, IV_LENGTH)\n const ciphertext = raw.slice(IV_LENGTH)\n return crypto.subtle.decrypt({ name: ALGORITHM, iv }, key, ciphertext)\n}\n"],"mappings":";AAWA,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,YAAY;AAIX,SAAS,aAAa,QAA4B;AAKvD,MAAI,CAAC,oBAAoB,KAAK,MAAM,GAAG;AACrC,UAAM,IAAI,MAAM,wDAAwD;AAAA,EAC1E;AACA,QAAM,QAAQ,IAAI,WAAW,EAAE;AAC/B,WAAS,IAAI,GAAG,IAAI,IAAI,KAAK,EAAG,OAAM,IAAI,CAAC,IAAI,SAAS,OAAO,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE;AACtF,SAAO;AACT;AAEA,eAAe,UAAU,QAAoC;AAC3D,QAAM,MAAM,aAAa,MAAM;AAC/B,SAAO,OAAO,OAAO,UAAU,OAAO,IAAI,QAAuB,EAAE,MAAM,UAAU,GAAgB,OAAO,CAAC,WAAW,SAAS,CAAC;AAClI;AAEA,SAAS,SAAS,MAA0B;AAC1C,MAAI,SAAS;AACb,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,IAAK,WAAU,OAAO,aAAa,KAAK,CAAC,CAAE;AAC5E,SAAO,KAAK,MAAM;AACpB;AAEA,SAAS,WAAW,KAAyB;AAC3C,QAAM,SAAS,KAAK,GAAG;AACvB,QAAM,QAAQ,IAAI,WAAW,OAAO,MAAM;AAC1C,WAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,IAAK,OAAM,CAAC,IAAI,OAAO,WAAW,CAAC;AACtE,SAAO;AACT;AAIA,eAAsB,cAAc,WAAmB,QAAiC;AACtF,QAAM,MAAM,MAAM,UAAU,MAAM;AAClC,QAAM,KAAK,OAAO,gBAAgB,IAAI,WAAW,SAAS,CAAC;AAC3D,QAAM,aAAa,MAAM,OAAO,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U;AACvE;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createInteractionAnswerRoute
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TSZIYQAZ.js";
|
|
4
4
|
import {
|
|
5
5
|
parseJsonObjectBody
|
|
6
6
|
} from "./chunk-3NCPXNBZ.js";
|
|
@@ -1078,4 +1078,4 @@ export {
|
|
|
1078
1078
|
createChatTurnRoutes,
|
|
1079
1079
|
streamChatRouteAsSandboxEvents
|
|
1080
1080
|
};
|
|
1081
|
-
//# sourceMappingURL=chunk-
|
|
1081
|
+
//# sourceMappingURL=chunk-ELROJHE2.js.map
|
|
@@ -1170,7 +1170,7 @@ function ChatComposer({
|
|
|
1170
1170
|
]
|
|
1171
1171
|
}
|
|
1172
1172
|
),
|
|
1173
|
-
/* @__PURE__ */
|
|
1173
|
+
/* @__PURE__ */ jsx2(
|
|
1174
1174
|
PopoverSurface,
|
|
1175
1175
|
{
|
|
1176
1176
|
open: slashOpen,
|
|
@@ -1179,7 +1179,7 @@ function ChatComposer({
|
|
|
1179
1179
|
triggerRef: mention ? cardRef : textareaRef,
|
|
1180
1180
|
panelRef: slashPanelRef,
|
|
1181
1181
|
className: `w-80 overflow-y-auto rounded-xl border border-card-edge bg-popover p-1 ${OVERLAY_SHADOW}`,
|
|
1182
|
-
children: [
|
|
1182
|
+
children: /* @__PURE__ */ jsxs2("div", { className: "max-h-80 overflow-y-auto overscroll-contain", children: [
|
|
1183
1183
|
slashFiltered.length === 0 && /* @__PURE__ */ jsx2("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: skillQuery !== void 0 ? "No matching skills" : hasSkills ? "No matching commands or skills" : "No matching commands" }),
|
|
1184
1184
|
slashFiltered.map((item, index) => /* @__PURE__ */ jsxs2(
|
|
1185
1185
|
"button",
|
|
@@ -1199,7 +1199,7 @@ function ChatComposer({
|
|
|
1199
1199
|
},
|
|
1200
1200
|
item.id
|
|
1201
1201
|
))
|
|
1202
|
-
]
|
|
1202
|
+
] })
|
|
1203
1203
|
}
|
|
1204
1204
|
),
|
|
1205
1205
|
focusShortcut && /* @__PURE__ */ jsx2("div", { className: "mt-1.5 flex justify-end px-1", children: /* @__PURE__ */ jsxs2("span", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -1951,4 +1951,4 @@ export {
|
|
|
1951
1951
|
ComposerModeControls,
|
|
1952
1952
|
EntryComposer
|
|
1953
1953
|
};
|
|
1954
|
-
//# sourceMappingURL=chunk-
|
|
1954
|
+
//# sourceMappingURL=chunk-O3I7RQCB.js.map
|