- Profiles pin each environment: POC (branch poc) and Fanyu (branch dev, 180.76.138.88, droboticflow-fanyu), with their Deployments by UID - Releases expect every Deployment of their profile; Fanyu's api image also runs its annotation processor and validator, each rolled back to its own image - Bindings may list several projects; each Runner has its own settings - fanyu-access: least-privilege identity and build-Pod admission policy in Fanyu's cluster, its token only in the executor and Fanyu's Runner - projects --replace: delete every project with all it holds, then create the POC and Fanyu projects, their environments and Runners - Ship the Runner's public keys in the ConfigMap, not a Mac path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.9 KiB
TypeScript
42 lines
1.9 KiB
TypeScript
/** Explicit local operator quota configuration; does not run a model or purchase credits. */
|
|
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import { PILOT_PLAN } from '../apps/api/src/domain/entitlements.js';
|
|
import { runTenantAdmin } from './tenant-admin.js';
|
|
import { readLocalPocBindings } from '../packages/runtime/src/local-poc-binding.js';
|
|
|
|
process.loadEnvFile('.env.local');
|
|
const tokens = Number(process.argv[2]);
|
|
if (
|
|
process.env.WF_DEPLOYMENT_MODE !== 'development' ||
|
|
!Number.isSafeInteger(tokens) ||
|
|
tokens < 2000000 ||
|
|
tokens > 100000000
|
|
)
|
|
throw Error('Usage: configure-local-poc-plan <monthly-token-limit 2000000..100000000>; local development only');
|
|
const binding = readLocalPocBindings(process.env.WF_LOCAL_POC_BINDING_FILE)[0]!;
|
|
if (!binding) throw Error('Configure the operator-bound POC project first');
|
|
const file = path.resolve('.wishforge/local-poc/plans.json');
|
|
const plan = {
|
|
...structuredClone(PILOT_PLAN),
|
|
id: 'local-poc',
|
|
version: 'local-poc-v1',
|
|
name: '本机 Claude POC 实验',
|
|
limits: { ...PILOT_PLAN.limits, maxConcurrentRuns: 1, monthlyModelTokens: tokens },
|
|
};
|
|
await mkdir(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
await writeFile(file, JSON.stringify({ schemaVersion: 1, plans: [PILOT_PLAN, plan] }, null, 2) + '\n', { mode: 0o600 });
|
|
const subject = '11111111-1111-4111-8111-111111111111';
|
|
const result = await runTenantAdmin('plan', [binding.tenantId, plan.id, subject], {
|
|
...process.env,
|
|
WF_PLAN_CATALOG_FILE: file,
|
|
WF_OPERATOR_SUBJECTS: subject,
|
|
});
|
|
const env = await readFile('.env.local', 'utf8');
|
|
const lines = env.split('\n').filter(line => !line.startsWith('WF_PLAN_CATALOG_FILE='));
|
|
lines.push(`WF_PLAN_CATALOG_FILE=${file}`);
|
|
await writeFile('.env.local', lines.join('\n') + '\n', { mode: 0o600 });
|
|
console.log(
|
|
JSON.stringify({ result, monthlyModelTokens: tokens, maxConcurrentRuns: 1, modelCalls: 0, purchasedCredits: false }),
|
|
);
|