Extract memind_adm admin server, add local dev tooling, and remove image-generation.

Split platform admin and ops APIs into standalone admin-server.mjs with network guards; simplify billing to RMB token pricing, refactor user auth, and add rsync deploy plus local-test scripts and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Your Name
2026-06-17 16:39:39 -07:00
parent ab0718938e
commit b0f5d6a51c
98 changed files with 5394 additions and 3010 deletions
+1 -42
View File
@@ -1,10 +1,6 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {
computeDeltaCostCents,
loadBillingConfig,
normalizeTokenState,
} from './billing.mjs';
import { computeDeltaCostCents, normalizeTokenState } from './billing.mjs';
const config = {
useBackendCost: false,
@@ -14,43 +10,6 @@ const config = {
minBillCents: 1,
};
test('loadBillingConfig defaults to DeepSeek Flash × 1 at USD/CNY 7.2', () => {
const savedInput = process.env.H5_BILL_INPUT_CENTS_PER_1K;
const savedOutput = process.env.H5_BILL_OUTPUT_CENTS_PER_1K;
const savedRate = process.env.H5_USD_CNY_RATE;
delete process.env.H5_BILL_INPUT_CENTS_PER_1K;
delete process.env.H5_BILL_OUTPUT_CENTS_PER_1K;
process.env.H5_USD_CNY_RATE = '7.2';
try {
const billing = loadBillingConfig();
assert.ok(Math.abs(billing.inputCentsPer1k - 0.1008) < 1e-9);
assert.ok(Math.abs(billing.outputCentsPer1k - 0.2016) < 1e-9);
} finally {
if (savedInput == null) delete process.env.H5_BILL_INPUT_CENTS_PER_1K;
else process.env.H5_BILL_INPUT_CENTS_PER_1K = savedInput;
if (savedOutput == null) delete process.env.H5_BILL_OUTPUT_CENTS_PER_1K;
else process.env.H5_BILL_OUTPUT_CENTS_PER_1K = savedOutput;
if (savedRate == null) delete process.env.H5_USD_CNY_RATE;
else process.env.H5_USD_CNY_RATE = savedRate;
}
});
test('computeDeltaCostCents bills DeepSeek Flash × 1 defaults with min charge', () => {
const billing = {
useBackendCost: false,
usdCnyRate: 7.2,
inputCentsPer1k: 0.1008,
outputCentsPer1k: 0.2016,
minBillCents: 1,
};
const previous = { lastInputTokens: 0, lastOutputTokens: 0 };
const current = normalizeTokenState({
accumulatedInputTokens: 1000,
accumulatedOutputTokens: 500,
});
assert.equal(computeDeltaCostCents(previous, current, billing), 1);
});
test('normalizeTokenState reads camelCase fields', () => {
const state = normalizeTokenState({
inputTokens: 10,