@data-club/ai-hub-server 0.0.9 → 0.0.10
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/auth/encryption.d.ts +5 -5
- package/dist/auth/encryption.js +5 -5
- package/dist/auth/userView.d.ts +8 -15
- package/dist/auth/userView.d.ts.map +1 -1
- package/dist/auth/userView.js +10 -23
- package/dist/auth/userView.js.map +1 -1
- package/dist/bootstrap.d.ts +2 -8
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +2 -35
- package/dist/bootstrap.js.map +1 -1
- package/dist/db/migrate.js +0 -17
- package/dist/db/migrate.js.map +1 -1
- package/dist/db/schema.d.ts +0 -263
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +0 -57
- package/dist/db/schema.js.map +1 -1
- package/dist/db/seed.d.ts +4 -19
- package/dist/db/seed.d.ts.map +1 -1
- package/dist/db/seed.js +6 -33
- package/dist/db/seed.js.map +1 -1
- package/dist/handlers/fetch.d.ts +6 -7
- package/dist/handlers/fetch.d.ts.map +1 -1
- package/dist/handlers/fetch.js +0 -2
- package/dist/handlers/fetch.js.map +1 -1
- package/dist/handlers/types.d.ts +5 -6
- package/dist/handlers/types.d.ts.map +1 -1
- package/dist/letta/client.d.ts +86 -263
- package/dist/letta/client.d.ts.map +1 -1
- package/dist/letta/client.js +99 -404
- package/dist/letta/client.js.map +1 -1
- package/dist/letta/index.d.ts +6 -8
- package/dist/letta/index.d.ts.map +1 -1
- package/dist/letta/index.js +5 -7
- package/dist/letta/index.js.map +1 -1
- package/dist/letta/sandbox.d.ts +45 -9
- package/dist/letta/sandbox.d.ts.map +1 -1
- package/dist/letta/sandbox.js +123 -11
- package/dist/letta/sandbox.js.map +1 -1
- package/dist/letta/types.d.ts +6 -49
- package/dist/letta/types.d.ts.map +1 -1
- package/dist/letta/types.js +5 -10
- package/dist/letta/types.js.map +1 -1
- package/dist/observability/logger.d.ts.map +1 -1
- package/dist/observability/logger.js +0 -2
- package/dist/observability/logger.js.map +1 -1
- package/dist/routes/admin/agents.d.ts.map +1 -1
- package/dist/routes/admin/agents.js +0 -40
- package/dist/routes/admin/agents.js.map +1 -1
- package/dist/routes/admin/settings.d.ts +6 -15
- package/dist/routes/admin/settings.d.ts.map +1 -1
- package/dist/routes/admin/settings.js +9 -107
- package/dist/routes/admin/settings.js.map +1 -1
- package/dist/routes/auth.d.ts +0 -4
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/auth.js +1 -5
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/sessions.d.ts.map +1 -1
- package/dist/routes/sessions.js +9 -30
- package/dist/routes/sessions.js.map +1 -1
- package/dist/state/turnRunner.d.ts.map +1 -1
- package/dist/state/turnRunner.js +1 -75
- package/dist/state/turnRunner.js.map +1 -1
- package/package.json +4 -4
- package/src/auth/encryption.ts +5 -5
- package/src/auth/userView.ts +9 -22
- package/src/bootstrap.ts +4 -43
- package/src/db/migrate.ts +0 -17
- package/src/db/schema.ts +0 -68
- package/src/db/seed.ts +6 -47
- package/src/handlers/fetch.ts +6 -9
- package/src/handlers/types.ts +5 -6
- package/src/letta/client.ts +170 -634
- package/src/letta/index.ts +8 -21
- package/src/letta/sandbox.ts +151 -11
- package/src/letta/types.ts +9 -60
- package/src/observability/logger.ts +0 -2
- package/src/routes/admin/agents.ts +0 -49
- package/src/routes/admin/settings.ts +9 -113
- package/src/routes/auth.ts +1 -5
- package/src/routes/sessions.ts +11 -32
- package/src/state/turnRunner.ts +1 -77
- package/src/letta/lettaCliShim.mjs +0 -40
- package/src/letta/settingsFileSeed.ts +0 -254
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AES-256-GCM helpers for encrypting
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* AES-256-GCM helpers for encrypting secrets at rest in the DB (§6.8).
|
|
3
|
+
* The key (`AI_HUB_ENCRYPTION_KEY`) lives in env only — separating the
|
|
4
|
+
* key-encrypting key from the encrypted blob is the entire point.
|
|
5
5
|
*
|
|
6
6
|
* Output layout (a single Buffer): `<12-byte IV><16-byte auth tag><ciphertext>`.
|
|
7
7
|
* Reading code slices the same offsets back out before calling `decipher`.
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
* `IV(12) || tag(16) || ciphertext` as a single Buffer.
|
|
21
21
|
*
|
|
22
22
|
* @param key - 32-byte encryption key.
|
|
23
|
-
* @param plaintext - utf-8 string
|
|
24
|
-
* @returns the binary blob to store in
|
|
23
|
+
* @param plaintext - utf-8 string to encrypt.
|
|
24
|
+
* @returns the binary blob to store in the DB.
|
|
25
25
|
*/
|
|
26
26
|
export declare function encryptString(key: Buffer, plaintext: string): Buffer;
|
|
27
27
|
/**
|
package/dist/auth/encryption.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AES-256-GCM helpers for encrypting
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* AES-256-GCM helpers for encrypting secrets at rest in the DB (§6.8).
|
|
3
|
+
* The key (`AI_HUB_ENCRYPTION_KEY`) lives in env only — separating the
|
|
4
|
+
* key-encrypting key from the encrypted blob is the entire point.
|
|
5
5
|
*
|
|
6
6
|
* Output layout (a single Buffer): `<12-byte IV><16-byte auth tag><ciphertext>`.
|
|
7
7
|
* Reading code slices the same offsets back out before calling `decipher`.
|
|
@@ -25,8 +25,8 @@ const TAG_BYTES = 16;
|
|
|
25
25
|
* `IV(12) || tag(16) || ciphertext` as a single Buffer.
|
|
26
26
|
*
|
|
27
27
|
* @param key - 32-byte encryption key.
|
|
28
|
-
* @param plaintext - utf-8 string
|
|
29
|
-
* @returns the binary blob to store in
|
|
28
|
+
* @param plaintext - utf-8 string to encrypt.
|
|
29
|
+
* @returns the binary blob to store in the DB.
|
|
30
30
|
*/
|
|
31
31
|
export function encryptString(key, plaintext) {
|
|
32
32
|
if (key.length !== KEY_BYTES) {
|
package/dist/auth/userView.d.ts
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
* Builds the `{ user, deployment }` envelope returned by `/auth/me`,
|
|
3
3
|
* `/auth/me/preferences`, and embedded in `/auth/login`'s response.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* The non-obvious concern this module owns:
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 2. **Role-gated `letta_ade_url`.** The URL is only included for callers
|
|
13
|
-
* with role `power_user` or higher (§6.3.4). For `user`-role callers it's
|
|
14
|
-
* omitted entirely (not set to null) so the React client cannot render
|
|
15
|
-
* a link element it shouldn't see.
|
|
7
|
+
* **Per-user vs. per-deployment split.** `user` carries strictly per-user
|
|
8
|
+
* fields (id, username, role, theme_preference, …); `deployment` carries
|
|
9
|
+
* strictly per-deployment fields (theme_default, theme_switcher_enabled, …).
|
|
10
|
+
* The split makes it impossible for a client to confuse "this is my
|
|
11
|
+
* preference" with "this is how the deployment is configured."
|
|
16
12
|
*
|
|
17
13
|
* The resolved theme is **not** computed here — the client does the simple
|
|
18
14
|
* precedence calculation client-side from `user.theme_preference +
|
|
@@ -31,17 +27,14 @@ import type { AdminSettingRow, UserRow } from "../db/schema.js";
|
|
|
31
27
|
*/
|
|
32
28
|
export declare function buildUserView(row: UserRow): AIHubUser;
|
|
33
29
|
/**
|
|
34
|
-
* Builds the per-deployment context payload.
|
|
35
|
-
* gated by `callerRole >= power_user` (§6.3.4).
|
|
30
|
+
* Builds the per-deployment context payload.
|
|
36
31
|
*
|
|
37
32
|
* @param settings - the `admin_setting` singleton row (pass null only when
|
|
38
33
|
* the row genuinely doesn't exist — first-boot before the seed has run,
|
|
39
34
|
* which shouldn't happen in practice).
|
|
40
|
-
* @param callerRole - role from the JWT's claim, used to gate
|
|
41
|
-
* `letta_ade_url`.
|
|
42
35
|
* @returns the wire-format `AIHubDeployment`.
|
|
43
36
|
*/
|
|
44
|
-
export declare function buildDeploymentView(settings: AdminSettingRow | null
|
|
37
|
+
export declare function buildDeploymentView(settings: AdminSettingRow | null): AIHubDeployment;
|
|
45
38
|
/**
|
|
46
39
|
* Convenience: builds both halves and returns them as the
|
|
47
40
|
* `AIHubAuthContext` envelope `/auth/me` (and `/auth/login` post-change)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userView.d.ts","sourceRoot":"","sources":["../../src/auth/userView.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"userView.d.ts","sourceRoot":"","sources":["../../src/auth/userView.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAQrD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,GAAG,IAAI,GAC/B,eAAe,CASjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,eAAe,GAAG,IAAI,GAC/B,gBAAgB,CAKlB"}
|
package/dist/auth/userView.js
CHANGED
|
@@ -2,17 +2,13 @@
|
|
|
2
2
|
* Builds the `{ user, deployment }` envelope returned by `/auth/me`,
|
|
3
3
|
* `/auth/me/preferences`, and embedded in `/auth/login`'s response.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* The non-obvious concern this module owns:
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* 2. **Role-gated `letta_ade_url`.** The URL is only included for callers
|
|
13
|
-
* with role `power_user` or higher (§6.3.4). For `user`-role callers it's
|
|
14
|
-
* omitted entirely (not set to null) so the React client cannot render
|
|
15
|
-
* a link element it shouldn't see.
|
|
7
|
+
* **Per-user vs. per-deployment split.** `user` carries strictly per-user
|
|
8
|
+
* fields (id, username, role, theme_preference, …); `deployment` carries
|
|
9
|
+
* strictly per-deployment fields (theme_default, theme_switcher_enabled, …).
|
|
10
|
+
* The split makes it impossible for a client to confuse "this is my
|
|
11
|
+
* preference" with "this is how the deployment is configured."
|
|
16
12
|
*
|
|
17
13
|
* The resolved theme is **not** computed here — the client does the simple
|
|
18
14
|
* precedence calculation client-side from `user.theme_preference +
|
|
@@ -37,18 +33,15 @@ export function buildUserView(row) {
|
|
|
37
33
|
};
|
|
38
34
|
}
|
|
39
35
|
/**
|
|
40
|
-
* Builds the per-deployment context payload.
|
|
41
|
-
* gated by `callerRole >= power_user` (§6.3.4).
|
|
36
|
+
* Builds the per-deployment context payload.
|
|
42
37
|
*
|
|
43
38
|
* @param settings - the `admin_setting` singleton row (pass null only when
|
|
44
39
|
* the row genuinely doesn't exist — first-boot before the seed has run,
|
|
45
40
|
* which shouldn't happen in practice).
|
|
46
|
-
* @param callerRole - role from the JWT's claim, used to gate
|
|
47
|
-
* `letta_ade_url`.
|
|
48
41
|
* @returns the wire-format `AIHubDeployment`.
|
|
49
42
|
*/
|
|
50
|
-
export function buildDeploymentView(settings
|
|
51
|
-
|
|
43
|
+
export function buildDeploymentView(settings) {
|
|
44
|
+
return {
|
|
52
45
|
theme_default: settings?.themeDefault ?? "light",
|
|
53
46
|
theme_switcher_enabled: settings?.themeSwitcherEnabled ?? true,
|
|
54
47
|
language_default: settings?.languageDefault ?? "en",
|
|
@@ -56,12 +49,6 @@ export function buildDeploymentView(settings, callerRole) {
|
|
|
56
49
|
default_agent_id: settings?.defaultAgentId ?? null,
|
|
57
50
|
agent_switcher_enabled: settings?.agentSwitcherEnabled ?? true,
|
|
58
51
|
};
|
|
59
|
-
if (callerRole !== "user") {
|
|
60
|
-
const ade = settings?.lettaAdeUrl ?? null;
|
|
61
|
-
if (ade)
|
|
62
|
-
out.letta_ade_url = ade;
|
|
63
|
-
}
|
|
64
|
-
return out;
|
|
65
52
|
}
|
|
66
53
|
/**
|
|
67
54
|
* Convenience: builds both halves and returns them as the
|
|
@@ -75,7 +62,7 @@ export function buildDeploymentView(settings, callerRole) {
|
|
|
75
62
|
export function buildAuthContext(row, settings) {
|
|
76
63
|
return {
|
|
77
64
|
user: buildUserView(row),
|
|
78
|
-
deployment: buildDeploymentView(settings
|
|
65
|
+
deployment: buildDeploymentView(settings),
|
|
79
66
|
};
|
|
80
67
|
}
|
|
81
68
|
//# sourceMappingURL=userView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userView.js","sourceRoot":"","sources":["../../src/auth/userView.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"userView.js","sourceRoot":"","sources":["../../src/auth/userView.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,YAAY,EAAE,GAAG,CAAC,WAAW,IAAI,IAAI;QACrC,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,gBAAgB,EAAE,GAAG,CAAC,eAAe,IAAI,IAAI;KAC9C,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAgC;IAEhC,OAAO;QACL,aAAa,EAAE,QAAQ,EAAE,YAAY,IAAI,OAAO;QAChD,sBAAsB,EAAE,QAAQ,EAAE,oBAAoB,IAAI,IAAI;QAC9D,gBAAgB,EAAE,QAAQ,EAAE,eAAe,IAAI,IAAI;QACnD,oBAAoB,EAAE,QAAQ,EAAE,kBAAkB,IAAI,KAAK;QAC3D,gBAAgB,EAAE,QAAQ,EAAE,cAAc,IAAI,IAAI;QAClD,sBAAsB,EAAE,QAAQ,EAAE,oBAAoB,IAAI,IAAI;KAC/D,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAAY,EACZ,QAAgC;IAEhC,OAAO;QACL,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC;QACxB,UAAU,EAAE,mBAAmB,CAAC,QAAQ,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
package/dist/bootstrap.d.ts
CHANGED
|
@@ -34,12 +34,6 @@ export interface EnvConfig {
|
|
|
34
34
|
signingKeyFromEnv: Buffer | undefined;
|
|
35
35
|
/** Bootstrap-only metrics scrape token (env value). */
|
|
36
36
|
metricsScrapeTokenFromEnv: string | undefined;
|
|
37
|
-
/** Letta API key from env. */
|
|
38
|
-
lettaApiKey: string | undefined;
|
|
39
|
-
/** Letta base URL from env. */
|
|
40
|
-
lettaBaseUrl: string | undefined;
|
|
41
|
-
/** Letta ADE URL override from env. */
|
|
42
|
-
lettaAdeUrl: string | undefined;
|
|
43
37
|
/** Pino log level. */
|
|
44
38
|
logLevel: string;
|
|
45
39
|
/** CORS origins (comma-separated). */
|
|
@@ -84,8 +78,8 @@ export interface BootServerOptions {
|
|
|
84
78
|
databaseUrl?: string;
|
|
85
79
|
/**
|
|
86
80
|
* Override the Letta client (§6.4). Tests pass a mock so the server
|
|
87
|
-
* never reaches a real Letta. Production omits this — the
|
|
88
|
-
*
|
|
81
|
+
* never reaches a real Letta Code runtime. Production omits this — the
|
|
82
|
+
* default drives Letta Code's server-less local backend.
|
|
89
83
|
*/
|
|
90
84
|
lettaClient?: LettaClient;
|
|
91
85
|
}
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,K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CAAC,CA0CvB"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -40,18 +40,6 @@ export function parseEnvConfig(env) {
|
|
|
40
40
|
encryptionKey,
|
|
41
41
|
signingKeyFromEnv: parseSigningKey(env.SERVICE_TOKEN_SIGNING_KEY),
|
|
42
42
|
metricsScrapeTokenFromEnv: env.METRICS_SCRAPE_TOKEN || undefined,
|
|
43
|
-
lettaApiKey: env.LETTA_API_KEY || undefined,
|
|
44
|
-
// Letta Code's CLI reads `LETTA_BASE_URL` from process.env and
|
|
45
|
-
// appends `/v1/...` to it. Operators who set the env value
|
|
46
|
-
// matching the Letta Client SDK's expectation (`http://host/v1`)
|
|
47
|
-
// would otherwise get double-v1 URLs in the spawned CLI subprocess.
|
|
48
|
-
// Strip the trailing /v1 once at boot so both ai-hub-server's own
|
|
49
|
-
// direct API calls (already strip defensively in `letta/client.ts`)
|
|
50
|
-
// and Letta Code subprocess spawns see the bare host:port form.
|
|
51
|
-
// Mutating process.env here propagates to every later subprocess
|
|
52
|
-
// spawn — Letta Code SDK forwards `{...process.env}` verbatim.
|
|
53
|
-
lettaBaseUrl: normalizeLettaBaseUrl(env.LETTA_BASE_URL),
|
|
54
|
-
lettaAdeUrl: env.LETTA_ADE_URL || undefined,
|
|
55
43
|
logLevel: env.LOG_LEVEL ?? "info",
|
|
56
44
|
corsAllowedOrigins: env.CORS_ALLOWED_ORIGINS ?? "",
|
|
57
45
|
};
|
|
@@ -67,24 +55,6 @@ export function parseEnvConfig(env) {
|
|
|
67
55
|
* @param raw - the raw env value, if present.
|
|
68
56
|
* @returns the decoded key, or undefined.
|
|
69
57
|
*/
|
|
70
|
-
/**
|
|
71
|
-
* Strips a trailing `/v1` from `LETTA_BASE_URL` and writes the cleaned
|
|
72
|
-
* value back to `process.env` so subprocess spawns inherit the normalized
|
|
73
|
-
* form. Idempotent — bare-host inputs pass through unchanged. Returns
|
|
74
|
-
* the normalized value (or `undefined` when the env var is unset).
|
|
75
|
-
*
|
|
76
|
-
* @param raw - the raw `process.env.LETTA_BASE_URL`, possibly undefined.
|
|
77
|
-
* @returns the normalized base URL, or undefined when unset.
|
|
78
|
-
*/
|
|
79
|
-
function normalizeLettaBaseUrl(raw) {
|
|
80
|
-
if (!raw)
|
|
81
|
-
return undefined;
|
|
82
|
-
const stripped = raw.replace(/\/v1\/?$/i, "");
|
|
83
|
-
if (stripped !== raw) {
|
|
84
|
-
process.env.LETTA_BASE_URL = stripped;
|
|
85
|
-
}
|
|
86
|
-
return stripped;
|
|
87
|
-
}
|
|
88
58
|
function parseSigningKey(raw) {
|
|
89
59
|
if (!raw)
|
|
90
60
|
return undefined;
|
|
@@ -130,9 +100,6 @@ export async function bootServer(opts = {}) {
|
|
|
130
100
|
encryptionKey: config.encryptionKey,
|
|
131
101
|
signingKeyFromEnv: config.signingKeyFromEnv,
|
|
132
102
|
metricsScrapeTokenFromEnv: config.metricsScrapeTokenFromEnv,
|
|
133
|
-
lettaApiKey: config.lettaApiKey,
|
|
134
|
-
lettaBaseUrl: config.lettaBaseUrl,
|
|
135
|
-
lettaAdeUrl: config.lettaAdeUrl,
|
|
136
103
|
}, logger);
|
|
137
104
|
const fetchHandler = createFetchHandler({
|
|
138
105
|
db: handle.db,
|
|
@@ -142,8 +109,8 @@ export async function bootServer(opts = {}) {
|
|
|
142
109
|
// Pass the booted env through as the runtime fallback source. Tests
|
|
143
110
|
// synthesize an env record; production uses process.env (the default
|
|
144
111
|
// inside createFetchHandler). Threading it explicitly here means
|
|
145
|
-
// bootTestServer's `env:` parameter actually reaches
|
|
146
|
-
//
|
|
112
|
+
// bootTestServer's `env:` parameter actually reaches the runtime
|
|
113
|
+
// env consumers (letta/client.ts config, resolveFilesDir).
|
|
147
114
|
envSource: env,
|
|
148
115
|
...(opts.lettaClient !== undefined ? { lettaClient: opts.lettaClient } : {}),
|
|
149
116
|
});
|
package/dist/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"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,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC,CAAC;IAEH,OAAO;QACL,YAAY;QACZ,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,MAAM,EAAE,MAAM,CAAC,GAAG;QAClB,MAAM;QACN,MAAM;QACN,UAAU;QACV,KAAK,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE;KAChC,CAAC;AACJ,CAAC"}
|
package/dist/db/migrate.js
CHANGED
|
@@ -129,9 +129,6 @@ const MIGRATIONS = [
|
|
|
129
129
|
|
|
130
130
|
CREATE TABLE admin_setting (
|
|
131
131
|
id INTEGER NOT NULL PRIMARY KEY,
|
|
132
|
-
letta_api_key_encrypted BLOB,
|
|
133
|
-
letta_base_url TEXT,
|
|
134
|
-
letta_ade_url TEXT,
|
|
135
132
|
feature_toggles TEXT NOT NULL DEFAULT '{}',
|
|
136
133
|
theme_switcher_enabled INTEGER NOT NULL DEFAULT 1,
|
|
137
134
|
theme_default TEXT NOT NULL DEFAULT 'light',
|
|
@@ -153,20 +150,6 @@ const MIGRATIONS = [
|
|
|
153
150
|
CHECK (system_override IS NOT NULL OR user_override IS NOT NULL)
|
|
154
151
|
);
|
|
155
152
|
|
|
156
|
-
CREATE TABLE message_usage (
|
|
157
|
-
letta_message_id TEXT NOT NULL PRIMARY KEY,
|
|
158
|
-
session_id TEXT NOT NULL REFERENCES session(id) ON DELETE CASCADE,
|
|
159
|
-
prompt_tokens INTEGER,
|
|
160
|
-
completion_tokens INTEGER,
|
|
161
|
-
total_tokens INTEGER,
|
|
162
|
-
cached_input_tokens INTEGER,
|
|
163
|
-
cache_write_tokens INTEGER,
|
|
164
|
-
reasoning_tokens INTEGER,
|
|
165
|
-
context_tokens INTEGER,
|
|
166
|
-
run_id TEXT,
|
|
167
|
-
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
168
|
-
);
|
|
169
|
-
CREATE INDEX message_usage_session_idx ON message_usage(session_id);
|
|
170
153
|
`,
|
|
171
154
|
},
|
|
172
155
|
{
|
package/dist/db/migrate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/db/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAgB;IAC5C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEvB,GAAG,CAAC,IAAI,CAAC;;;;;;GAMR,CAAC,CAAC;IAEH,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,GAAG;aAChB,OAAO,CAAC,iDAAiD,CAAC;aAC1D,GAAG,CAAC,CAAC,CAAC,IAAI,CAA8B,CAAC;QAC5C,IAAI,OAAO;YAAE,SAAS;QACtB,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE;YACjC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAChB,GAAG;iBACA,OAAO,CAAC,kDAAkD,CAAC;iBAC3D,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,KAAK,EAAE,CAAC;IACV,CAAC;AACH,CAAC;AAaD;;;;GAIG;AACH,MAAM,UAAU,GAA6B;IAC3C;QACE,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/db/migrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAgB;IAC5C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEvB,GAAG,CAAC,IAAI,CAAC;;;;;;GAMR,CAAC,CAAC;IAEH,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,GAAG;aAChB,OAAO,CAAC,iDAAiD,CAAC;aAC1D,GAAG,CAAC,CAAC,CAAC,IAAI,CAA8B,CAAC;QAC5C,IAAI,OAAO;YAAE,SAAS;QACtB,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,EAAE;YACjC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YAChB,GAAG;iBACA,OAAO,CAAC,kDAAkD,CAAC;iBAC3D,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,KAAK,EAAE,CAAC;IACV,CAAC;AACH,CAAC;AAaD;;;;GAIG;AACH,MAAM,UAAU,GAA6B;IAC3C;QACE,IAAI,EAAE,WAAW;QACjB,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4FJ;KACF;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;KAoBJ;KACF;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,GAAG,EAAE;;;KAGJ;KACF;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,GAAG,EAAE;;;KAGJ;KACF;IACD;QACE,IAAI,EAAE,+BAA+B;QACrC,GAAG,EAAE;;;;KAIJ;KACF;CACF,CAAC"}
|
package/dist/db/schema.d.ts
CHANGED
|
@@ -1013,57 +1013,6 @@ export declare const adminSetting: import("drizzle-orm/sqlite-core").SQLiteTable
|
|
|
1013
1013
|
identity: undefined;
|
|
1014
1014
|
generated: undefined;
|
|
1015
1015
|
}, object>;
|
|
1016
|
-
lettaApiKeyEncrypted: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1017
|
-
name: "letta_api_key_encrypted";
|
|
1018
|
-
tableName: "admin_setting";
|
|
1019
|
-
dataType: "buffer";
|
|
1020
|
-
columnType: "SQLiteBlobBuffer";
|
|
1021
|
-
data: Buffer<ArrayBufferLike>;
|
|
1022
|
-
driverParam: Buffer<ArrayBufferLike>;
|
|
1023
|
-
notNull: false;
|
|
1024
|
-
hasDefault: false;
|
|
1025
|
-
isPrimaryKey: false;
|
|
1026
|
-
isAutoincrement: false;
|
|
1027
|
-
hasRuntimeDefault: false;
|
|
1028
|
-
enumValues: undefined;
|
|
1029
|
-
baseColumn: never;
|
|
1030
|
-
identity: undefined;
|
|
1031
|
-
generated: undefined;
|
|
1032
|
-
}, object>;
|
|
1033
|
-
lettaBaseUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1034
|
-
name: "letta_base_url";
|
|
1035
|
-
tableName: "admin_setting";
|
|
1036
|
-
dataType: "string";
|
|
1037
|
-
columnType: "SQLiteText";
|
|
1038
|
-
data: string;
|
|
1039
|
-
driverParam: string;
|
|
1040
|
-
notNull: false;
|
|
1041
|
-
hasDefault: false;
|
|
1042
|
-
isPrimaryKey: false;
|
|
1043
|
-
isAutoincrement: false;
|
|
1044
|
-
hasRuntimeDefault: false;
|
|
1045
|
-
enumValues: [string, ...string[]];
|
|
1046
|
-
baseColumn: never;
|
|
1047
|
-
identity: undefined;
|
|
1048
|
-
generated: undefined;
|
|
1049
|
-
}, object>;
|
|
1050
|
-
lettaAdeUrl: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1051
|
-
name: "letta_ade_url";
|
|
1052
|
-
tableName: "admin_setting";
|
|
1053
|
-
dataType: "string";
|
|
1054
|
-
columnType: "SQLiteText";
|
|
1055
|
-
data: string;
|
|
1056
|
-
driverParam: string;
|
|
1057
|
-
notNull: false;
|
|
1058
|
-
hasDefault: false;
|
|
1059
|
-
isPrimaryKey: false;
|
|
1060
|
-
isAutoincrement: false;
|
|
1061
|
-
hasRuntimeDefault: false;
|
|
1062
|
-
enumValues: [string, ...string[]];
|
|
1063
|
-
baseColumn: never;
|
|
1064
|
-
identity: undefined;
|
|
1065
|
-
generated: undefined;
|
|
1066
|
-
}, object>;
|
|
1067
1016
|
featureToggles: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1068
1017
|
name: "feature_toggles";
|
|
1069
1018
|
tableName: "admin_setting";
|
|
@@ -1456,218 +1405,6 @@ export type AdminSettingInsert = typeof adminSetting.$inferInsert;
|
|
|
1456
1405
|
export type MessageOverrideRow = typeof messageOverride.$inferSelect;
|
|
1457
1406
|
/** Insert shape for the `message_override` table. */
|
|
1458
1407
|
export type MessageOverrideInsert = typeof messageOverride.$inferInsert;
|
|
1459
|
-
/**
|
|
1460
|
-
* Provider-reported per-turn token usage, stamped on the LAST assistant
|
|
1461
|
-
* message of each turn. Surfaced to the chat UI via a hover badge so
|
|
1462
|
-
* users can see (a) total tokens consumed and (b) prompt-cache
|
|
1463
|
-
* hit/miss split (Anthropic + OpenAI + Gemini all report
|
|
1464
|
-
* `cached_input_tokens`; Anthropic also reports `cache_write_tokens`).
|
|
1465
|
-
*
|
|
1466
|
-
* The runner fetches Letta's `GET /v1/runs/{run_id}/messages` after
|
|
1467
|
-
* the turn ends, finds the `usage_statistics`-typed message, and
|
|
1468
|
-
* inserts one row here keyed by the last assistant message's Letta id.
|
|
1469
|
-
*
|
|
1470
|
-
* @see SPECIFICATIONS.md §9 — `usage` SSE event
|
|
1471
|
-
* @see docs/server/chat-sse.md — wire protocol
|
|
1472
|
-
*/
|
|
1473
|
-
export declare const messageUsage: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
|
|
1474
|
-
name: "message_usage";
|
|
1475
|
-
schema: undefined;
|
|
1476
|
-
columns: {
|
|
1477
|
-
lettaMessageId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1478
|
-
name: "letta_message_id";
|
|
1479
|
-
tableName: "message_usage";
|
|
1480
|
-
dataType: "string";
|
|
1481
|
-
columnType: "SQLiteText";
|
|
1482
|
-
data: string;
|
|
1483
|
-
driverParam: string;
|
|
1484
|
-
notNull: true;
|
|
1485
|
-
hasDefault: false;
|
|
1486
|
-
isPrimaryKey: true;
|
|
1487
|
-
isAutoincrement: false;
|
|
1488
|
-
hasRuntimeDefault: false;
|
|
1489
|
-
enumValues: [string, ...string[]];
|
|
1490
|
-
baseColumn: never;
|
|
1491
|
-
identity: undefined;
|
|
1492
|
-
generated: undefined;
|
|
1493
|
-
}, object>;
|
|
1494
|
-
sessionId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1495
|
-
name: "session_id";
|
|
1496
|
-
tableName: "message_usage";
|
|
1497
|
-
dataType: "string";
|
|
1498
|
-
columnType: "SQLiteText";
|
|
1499
|
-
data: string;
|
|
1500
|
-
driverParam: string;
|
|
1501
|
-
notNull: true;
|
|
1502
|
-
hasDefault: false;
|
|
1503
|
-
isPrimaryKey: false;
|
|
1504
|
-
isAutoincrement: false;
|
|
1505
|
-
hasRuntimeDefault: false;
|
|
1506
|
-
enumValues: [string, ...string[]];
|
|
1507
|
-
baseColumn: never;
|
|
1508
|
-
identity: undefined;
|
|
1509
|
-
generated: undefined;
|
|
1510
|
-
}, object>;
|
|
1511
|
-
promptTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1512
|
-
name: "prompt_tokens";
|
|
1513
|
-
tableName: "message_usage";
|
|
1514
|
-
dataType: "number";
|
|
1515
|
-
columnType: "SQLiteInteger";
|
|
1516
|
-
data: number;
|
|
1517
|
-
driverParam: number;
|
|
1518
|
-
notNull: false;
|
|
1519
|
-
hasDefault: false;
|
|
1520
|
-
isPrimaryKey: false;
|
|
1521
|
-
isAutoincrement: false;
|
|
1522
|
-
hasRuntimeDefault: false;
|
|
1523
|
-
enumValues: undefined;
|
|
1524
|
-
baseColumn: never;
|
|
1525
|
-
identity: undefined;
|
|
1526
|
-
generated: undefined;
|
|
1527
|
-
}, object>;
|
|
1528
|
-
completionTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1529
|
-
name: "completion_tokens";
|
|
1530
|
-
tableName: "message_usage";
|
|
1531
|
-
dataType: "number";
|
|
1532
|
-
columnType: "SQLiteInteger";
|
|
1533
|
-
data: number;
|
|
1534
|
-
driverParam: number;
|
|
1535
|
-
notNull: false;
|
|
1536
|
-
hasDefault: false;
|
|
1537
|
-
isPrimaryKey: false;
|
|
1538
|
-
isAutoincrement: false;
|
|
1539
|
-
hasRuntimeDefault: false;
|
|
1540
|
-
enumValues: undefined;
|
|
1541
|
-
baseColumn: never;
|
|
1542
|
-
identity: undefined;
|
|
1543
|
-
generated: undefined;
|
|
1544
|
-
}, object>;
|
|
1545
|
-
totalTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1546
|
-
name: "total_tokens";
|
|
1547
|
-
tableName: "message_usage";
|
|
1548
|
-
dataType: "number";
|
|
1549
|
-
columnType: "SQLiteInteger";
|
|
1550
|
-
data: number;
|
|
1551
|
-
driverParam: number;
|
|
1552
|
-
notNull: false;
|
|
1553
|
-
hasDefault: false;
|
|
1554
|
-
isPrimaryKey: false;
|
|
1555
|
-
isAutoincrement: false;
|
|
1556
|
-
hasRuntimeDefault: false;
|
|
1557
|
-
enumValues: undefined;
|
|
1558
|
-
baseColumn: never;
|
|
1559
|
-
identity: undefined;
|
|
1560
|
-
generated: undefined;
|
|
1561
|
-
}, object>;
|
|
1562
|
-
cachedInputTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1563
|
-
name: "cached_input_tokens";
|
|
1564
|
-
tableName: "message_usage";
|
|
1565
|
-
dataType: "number";
|
|
1566
|
-
columnType: "SQLiteInteger";
|
|
1567
|
-
data: number;
|
|
1568
|
-
driverParam: number;
|
|
1569
|
-
notNull: false;
|
|
1570
|
-
hasDefault: false;
|
|
1571
|
-
isPrimaryKey: false;
|
|
1572
|
-
isAutoincrement: false;
|
|
1573
|
-
hasRuntimeDefault: false;
|
|
1574
|
-
enumValues: undefined;
|
|
1575
|
-
baseColumn: never;
|
|
1576
|
-
identity: undefined;
|
|
1577
|
-
generated: undefined;
|
|
1578
|
-
}, object>;
|
|
1579
|
-
cacheWriteTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1580
|
-
name: "cache_write_tokens";
|
|
1581
|
-
tableName: "message_usage";
|
|
1582
|
-
dataType: "number";
|
|
1583
|
-
columnType: "SQLiteInteger";
|
|
1584
|
-
data: number;
|
|
1585
|
-
driverParam: number;
|
|
1586
|
-
notNull: false;
|
|
1587
|
-
hasDefault: false;
|
|
1588
|
-
isPrimaryKey: false;
|
|
1589
|
-
isAutoincrement: false;
|
|
1590
|
-
hasRuntimeDefault: false;
|
|
1591
|
-
enumValues: undefined;
|
|
1592
|
-
baseColumn: never;
|
|
1593
|
-
identity: undefined;
|
|
1594
|
-
generated: undefined;
|
|
1595
|
-
}, object>;
|
|
1596
|
-
reasoningTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1597
|
-
name: "reasoning_tokens";
|
|
1598
|
-
tableName: "message_usage";
|
|
1599
|
-
dataType: "number";
|
|
1600
|
-
columnType: "SQLiteInteger";
|
|
1601
|
-
data: number;
|
|
1602
|
-
driverParam: number;
|
|
1603
|
-
notNull: false;
|
|
1604
|
-
hasDefault: false;
|
|
1605
|
-
isPrimaryKey: false;
|
|
1606
|
-
isAutoincrement: false;
|
|
1607
|
-
hasRuntimeDefault: false;
|
|
1608
|
-
enumValues: undefined;
|
|
1609
|
-
baseColumn: never;
|
|
1610
|
-
identity: undefined;
|
|
1611
|
-
generated: undefined;
|
|
1612
|
-
}, object>;
|
|
1613
|
-
contextTokens: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1614
|
-
name: "context_tokens";
|
|
1615
|
-
tableName: "message_usage";
|
|
1616
|
-
dataType: "number";
|
|
1617
|
-
columnType: "SQLiteInteger";
|
|
1618
|
-
data: number;
|
|
1619
|
-
driverParam: number;
|
|
1620
|
-
notNull: false;
|
|
1621
|
-
hasDefault: false;
|
|
1622
|
-
isPrimaryKey: false;
|
|
1623
|
-
isAutoincrement: false;
|
|
1624
|
-
hasRuntimeDefault: false;
|
|
1625
|
-
enumValues: undefined;
|
|
1626
|
-
baseColumn: never;
|
|
1627
|
-
identity: undefined;
|
|
1628
|
-
generated: undefined;
|
|
1629
|
-
}, object>;
|
|
1630
|
-
runId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1631
|
-
name: "run_id";
|
|
1632
|
-
tableName: "message_usage";
|
|
1633
|
-
dataType: "string";
|
|
1634
|
-
columnType: "SQLiteText";
|
|
1635
|
-
data: string;
|
|
1636
|
-
driverParam: string;
|
|
1637
|
-
notNull: false;
|
|
1638
|
-
hasDefault: false;
|
|
1639
|
-
isPrimaryKey: false;
|
|
1640
|
-
isAutoincrement: false;
|
|
1641
|
-
hasRuntimeDefault: false;
|
|
1642
|
-
enumValues: [string, ...string[]];
|
|
1643
|
-
baseColumn: never;
|
|
1644
|
-
identity: undefined;
|
|
1645
|
-
generated: undefined;
|
|
1646
|
-
}, object>;
|
|
1647
|
-
createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
|
|
1648
|
-
name: "created_at";
|
|
1649
|
-
tableName: "message_usage";
|
|
1650
|
-
dataType: "string";
|
|
1651
|
-
columnType: "SQLiteText";
|
|
1652
|
-
data: string;
|
|
1653
|
-
driverParam: string;
|
|
1654
|
-
notNull: true;
|
|
1655
|
-
hasDefault: true;
|
|
1656
|
-
isPrimaryKey: false;
|
|
1657
|
-
isAutoincrement: false;
|
|
1658
|
-
hasRuntimeDefault: false;
|
|
1659
|
-
enumValues: [string, ...string[]];
|
|
1660
|
-
baseColumn: never;
|
|
1661
|
-
identity: undefined;
|
|
1662
|
-
generated: undefined;
|
|
1663
|
-
}, object>;
|
|
1664
|
-
};
|
|
1665
|
-
dialect: "sqlite";
|
|
1666
|
-
}>;
|
|
1667
|
-
/** Row shape for the `message_usage` table. */
|
|
1668
|
-
export type MessageUsageRow = typeof messageUsage.$inferSelect;
|
|
1669
|
-
/** Insert shape for the `message_usage` table. */
|
|
1670
|
-
export type MessageUsageInsert = typeof messageUsage.$inferInsert;
|
|
1671
1408
|
/**
|
|
1672
1409
|
* Admin-curated **rotating starting message** — a prompt that ai-hub runs
|
|
1673
1410
|
* against a Letta agent on a schedule, capturing the agent's reply as a
|
package/dist/db/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAgBH;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuEhB,CAAC;AAMF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6EhB,CAAC;AAMH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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