@vxil/cli 0.5.2 → 0.6.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/README.md CHANGED
@@ -39,7 +39,7 @@ export default defineConfig({
39
39
  });
40
40
  ```
41
41
 
42
- Verbs: `init templates quickstart try login link plan push pull diff gen doctor architect versions rollback secrets env seed export import functions listen mcp cms dev payments migrate config users send deliveries api`.
42
+ Verbs: `init templates quickstart try login link keys plan push pull diff gen doctor architect versions rollback secrets env seed export import functions listen mcp cms dev payments migrate config users send deliveries api`.
43
43
 
44
44
  **Every verb names its target.** `--dev` selects the dev slot, `--target <name>` a named slot bound by `vxil link <slug> --as <name>` (which merges into the existing binding rather than replacing it). The selector is **fail-closed** — an unbound slot exits 1 telling you the fix, and never falls through to another tenant — and every write verb prints a target banner (slug + env, never a key) before it acts.
45
45
 
@@ -48,6 +48,7 @@ Verbs: `init templates quickstart try login link plan push pull diff gen doctor
48
48
  - `vxil diff [--against <target>] [--ignore <k,…>] [--strict-secrets]` — the CI drift gate; secrets compared by name only, and a referenced-but-unstored name is informational unless `--strict-secrets`.
49
49
  - `vxil doctor` — preflight: secrets referenced-vs-stored (advisory, names only) plus a served / published / local hash verdict per function. Under `--json` stdout is one JSON document; notices go to stderr.
50
50
  - `vxil link <slug>` — reuses the key already stored for the slug on this machine; `--mint` for a fresh one, `--key` to hand one in.
51
+ - `vxil keys mint --name <name> --scopes <a,b,c> [--env live|test] [--store]` — mint a **narrow** key for a server (scopes validated locally; `admin` refused); the key prints **once** to stdout (`--json` → `{ api_key, key_id, scopes }`) and is never stored unless `--store`. `vxil keys list` shows names, ids, scopes, created and last-used (never secrets); `vxil keys revoke <key_id> [--yes]` asks you to type the id, and refuses the key the CLI itself is using unless `--yes`. Needs a dashboard session (`vxil login`, or it prompts at a terminal; a piped / `--json` run fails with that remedy instead — pass `--email`/`--password` to script it, which never stores the session).
51
52
  - `vxil cms drop <collection> [--yes]` — remove one collection definition through the same guarded ack `push --allow-destructive` uses (rows are retained).
52
53
  - `vxil api <METHOD> <path> ['<json>' | --data '<json>']` — call any `/v1` route; bare JSON on stdout, banner on stderr.
53
54
  - `vxil secrets list --all-projects` — the names-and-metadata matrix across every bound project (values never come back).
@@ -1,6 +1,7 @@
1
1
  import { type Static, type TSchema } from '@sinclair/typebox';
2
2
  export * from './_vxil-feature-configs-hooks.js';
3
3
  export * from './readmodels.js';
4
+ export * from './apiState.js';
4
5
  export declare const RESERVED_CREDIT_TYPES: ReadonlySet<string>;
5
6
  /** True when a credit_type is a vxil-COGS reserved type (grant/consume/config
6
7
  * of which is restricted to internal platform machinery). */
@@ -265,12 +266,35 @@ export type AuthSecurityConfig = NonNullable<Static<typeof AuthConfigSchema>['se
265
266
  /** The RB-2 generic OIDC / SSO issuer block (`providers.oidc`). */
266
267
  export type AuthOidcConfig = Static<typeof OidcProviderSchema>;
267
268
  export type AuthConfig = Static<typeof AuthConfigSchema>;
269
+ export declare const RL_POLICY_NAME_PATTERN = "^[a-zA-Z0-9_.:-]+$";
270
+ /** GET /v1/rate-limits/policies lists at most 100 with no cursor (core.ts
271
+ * listPolicies) — a declared set past that could never be reconciled. */
272
+ export declare const RL_MAX_DECLARED_POLICIES = 100;
273
+ /** rate-limits-v1 core.ts createPolicy: at most 8 distinct `{var}`s. */
274
+ export declare const RL_KEY_TEMPLATE_MAX_VARS = 8;
275
+ export declare const DeclaredRlPolicySchema: import("@sinclair/typebox").TObject<{
276
+ name: import("@sinclair/typebox").TString;
277
+ key_template: import("@sinclair/typebox").TString;
278
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
279
+ window_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
280
+ behavior: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"block">, import("@sinclair/typebox").TLiteral<"shape">]>>;
281
+ algorithm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"sliding_window">, import("@sinclair/typebox").TLiteral<"token_bucket">]>>;
282
+ }>;
283
+ export type DeclaredRlPolicy = Static<typeof DeclaredRlPolicySchema>;
268
284
  export declare const RateLimitsConfigSchema: import("@sinclair/typebox").TObject<{
269
285
  enabled: import("@sinclair/typebox").TBoolean;
270
286
  defaults: import("@sinclair/typebox").TObject<{
271
287
  perTenantSec: import("@sinclair/typebox").TInteger;
272
288
  burstSize: import("@sinclair/typebox").TInteger;
273
289
  }>;
290
+ policies: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
291
+ name: import("@sinclair/typebox").TString;
292
+ key_template: import("@sinclair/typebox").TString;
293
+ limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
294
+ window_seconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
295
+ behavior: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"block">, import("@sinclair/typebox").TLiteral<"shape">]>>;
296
+ algorithm: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"sliding_window">, import("@sinclair/typebox").TLiteral<"token_bucket">]>>;
297
+ }>>>;
274
298
  }>;
275
299
  export type RateLimitsConfig = Static<typeof RateLimitsConfigSchema>;
276
300
  export declare const FilesConfigSchema: import("@sinclair/typebox").TObject<{
@@ -301,6 +325,11 @@ export declare const FilesConfigSchema: import("@sinclair/typebox").TObject<{
301
325
  }>>;
302
326
  }>;
303
327
  export type FilesConfig = Static<typeof FilesConfigSchema>;
328
+ export declare const DeclaredWebhookSubscriptionSchema: import("@sinclair/typebox").TObject<{
329
+ target_url: import("@sinclair/typebox").TString;
330
+ event_prefixes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
331
+ }>;
332
+ export type DeclaredWebhookSubscription = Static<typeof DeclaredWebhookSubscriptionSchema>;
304
333
  export declare const WebhooksConfigSchema: import("@sinclair/typebox").TObject<{
305
334
  enabled: import("@sinclair/typebox").TBoolean;
306
335
  maxSubscriptions: import("@sinclair/typebox").TInteger;
@@ -310,6 +339,10 @@ export declare const WebhooksConfigSchema: import("@sinclair/typebox").TObject<{
310
339
  minLevel: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"warn">, import("@sinclair/typebox").TLiteral<"error">]>;
311
340
  digestMinutes: import("@sinclair/typebox").TInteger;
312
341
  }>>;
342
+ subscriptions: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
343
+ target_url: import("@sinclair/typebox").TString;
344
+ event_prefixes: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
345
+ }>>>;
313
346
  }>;
314
347
  export type WebhooksConfig = Static<typeof WebhooksConfigSchema>;
315
348
  export declare const CommentsConfigSchema: import("@sinclair/typebox").TObject<{
@@ -476,6 +509,15 @@ export declare const VectorSearchConfigSchema: import("@sinclair/typebox").TObje
476
509
  }>>>;
477
510
  }>;
478
511
  export type VectorSearchConfig = Static<typeof VectorSearchConfigSchema>;
512
+ export declare const AI_TEMPLATE_NAME_PATTERN = "^[a-zA-Z0-9_.\\-]+$";
513
+ export declare const AI_MAX_DECLARED_TEMPLATES = 50;
514
+ export declare const DeclaredAiTemplateSchema: import("@sinclair/typebox").TObject<{
515
+ template: import("@sinclair/typebox").TString;
516
+ user: import("@sinclair/typebox").TString;
517
+ system: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
518
+ schema: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
519
+ }>;
520
+ export type DeclaredAiTemplate = Static<typeof DeclaredAiTemplateSchema>;
479
521
  export declare const AiConfigSchema: import("@sinclair/typebox").TObject<{
480
522
  enabled: import("@sinclair/typebox").TBoolean;
481
523
  defaultProvider: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"mock">, import("@sinclair/typebox").TLiteral<"openai">, import("@sinclair/typebox").TLiteral<"anthropic">, import("@sinclair/typebox").TLiteral<"gemini">, import("@sinclair/typebox").TLiteral<"azure">, import("@sinclair/typebox").TLiteral<"openrouter">]>;
@@ -500,11 +542,17 @@ export declare const AiConfigSchema: import("@sinclair/typebox").TObject<{
500
542
  tokensPerUserPerDay: import("@sinclair/typebox").TInteger;
501
543
  consumeCredits: import("@sinclair/typebox").TBoolean;
502
544
  }>;
503
- streaming: import("@sinclair/typebox").TObject<{
545
+ streaming: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TObject<{
504
546
  enabled: import("@sinclair/typebox").TBoolean;
505
547
  replayBufferFrames: import("@sinclair/typebox").TInteger;
506
548
  flushMs: import("@sinclair/typebox").TInteger;
507
- }>;
549
+ }>>;
550
+ templates: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
551
+ template: import("@sinclair/typebox").TString;
552
+ user: import("@sinclair/typebox").TString;
553
+ system: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
554
+ schema: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
555
+ }>>>;
508
556
  }>;
509
557
  export type AiConfig = Static<typeof AiConfigSchema>;
510
558
  export declare const RagConfigSchema: import("@sinclair/typebox").TObject<{
@@ -713,6 +761,18 @@ export declare const MCP_MAX_PROMPTS = 32;
713
761
  * stays ALLOWED (fn→fn composition). Source of truth for both the config-write
714
762
  * validation below and the control-plane deploy clamp. */
715
763
  export declare const DENY_FUNCTION_SCOPES: Set<string>;
764
+ /** `{var}` names of a rate-limit key template (rate-limits-v1 core.ts
765
+ * templateVars parity). */
766
+ export declare function rlTemplateVars(template: string): string[];
767
+ export declare function validateDeclaredRlPolicies(policies: readonly DeclaredRlPolicy[] | undefined): string[];
768
+ export declare function validateDeclaredWebhookSubscriptions(subscriptions: readonly DeclaredWebhookSubscription[] | undefined, maxSubscriptions: number | undefined): string[];
769
+ /** The stored-template `schema` bounds — MIRRORED from @vxil/runtime
770
+ * (AI_TEMPLATE_SCHEMA_MAX_BYTES / AI_TEMPLATE_SCHEMA_MAX_DEPTH; this package is
771
+ * typebox-only). ai-v1 putTemplate refuses the same numbers at the route, so a
772
+ * declared entry that passes here is never a 422 at converge. */
773
+ export declare const AI_TEMPLATE_SCHEMA_MAX_BYTES = 32000;
774
+ export declare const AI_TEMPLATE_SCHEMA_MAX_DEPTH = 64;
775
+ export declare function validateDeclaredAiTemplates(templates: readonly DeclaredAiTemplate[] | undefined): string[];
716
776
  export declare function validateFeatureConfig(feature: string, raw: unknown): ConfigValidation;
717
777
  export declare const FEATURE_KEYS: readonly ["notifications", "jobs", "auth", "rate-limits", "files", "webhooks", "comments", "cms", "mcp", "realtime", "presence", "orgs", "activity-feed", "vector-search", "ai", "rag", "payments", "functions", "copilot"];
718
778
  export type FeatureKey = (typeof FEATURE_KEYS)[number];