@camstack/core 0.1.35 → 0.1.37

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/index.mjs CHANGED
@@ -31,7 +31,7 @@ import { promisify } from "node:util";
31
31
  import { errMsg, parseJsonObject } from "@camstack/types";
32
32
  import * as vm from "node:vm";
33
33
  import * as os from "node:os";
34
- //#region ../types/dist/index-BBVUwOlZ.mjs
34
+ //#region ../types/dist/index-Ce7RZWP4.mjs
35
35
  var MODEL_FORMATS = [
36
36
  "onnx",
37
37
  "coreml",
@@ -2648,10 +2648,30 @@ var LinkStateSchema = z.enum([
2648
2648
  "linked",
2649
2649
  "error"
2650
2650
  ]);
2651
+ var ExportSetupFieldSchema = z.object({
2652
+ label: z.string(),
2653
+ value: z.string(),
2654
+ /** Mask the value by default + render a reveal toggle (client id, secrets). */
2655
+ secret: z.boolean().optional()
2656
+ });
2657
+ var ExportSetupSchema = z.object({
2658
+ /** A string to render as a scannable QR — HAP `X-HM://…` URI, a pairing URL, etc. Omitted when there's nothing to scan. */
2659
+ qr: z.string().optional(),
2660
+ /** Label/value rows shown with a copy button (HAP setup code, OAuth URLs, client id, linked-account count, …). */
2661
+ fields: z.array(ExportSetupFieldSchema).readonly().optional(),
2662
+ /** Free-form operator instructions rendered above the fields. */
2663
+ note: z.string().optional()
2664
+ });
2651
2665
  var DeviceExportStatusSchema = z.object({
2652
2666
  linkState: LinkStateSchema,
2653
2667
  exposedDeviceCount: z.number(),
2654
- error: z.string().optional()
2668
+ error: z.string().optional(),
2669
+ /**
2670
+ * Optional pairing/account info the panel renders in a generic
2671
+ * "Setup" section. Addon-agnostic — the addon id identifies the
2672
+ * export target, never an `ecosystem` key here.
2673
+ */
2674
+ setup: ExportSetupSchema.optional()
2655
2675
  });
2656
2676
  var DeviceKindSchema = z.string();
2657
2677
  var ExposedDeviceSchema = z.object({
@@ -4808,7 +4828,9 @@ var MeshPeerSchema = z.object({
4808
4828
  id: z.string(),
4809
4829
  /** Hostname / device name as shown in the mesh dashboard. */
4810
4830
  hostname: z.string(),
4811
- /** Mesh IP(s). Multiple when the peer is dual-stacked. */
4831
+ /** MagicDNS / mesh DNS name (e.g. `peer-foo.tail-abc.ts.net`). Empty when the provider doesn't support DNS or peer-side resolution is disabled. */
4832
+ magicDns: z.string(),
4833
+ /** Mesh IPv4 / IPv6 addresses combined. Multiple when dual-stacked. */
4812
4834
  addresses: z.array(z.string()).readonly(),
4813
4835
  /** Operating system reported by the peer (informational). */
4814
4836
  os: z.string().optional(),
@@ -4817,7 +4839,36 @@ var MeshPeerSchema = z.object({
4817
4839
  /** Last-seen timestamp (epoch ms). 0 when never seen. */
4818
4840
  lastSeenMs: z.number(),
4819
4841
  /** True for the row representing the current host. */
4820
- isSelf: z.boolean()
4842
+ isSelf: z.boolean(),
4843
+ /**
4844
+ * Connection mode to this peer:
4845
+ * - `direct`: NAT-traversed P2P (UDP punched)
4846
+ * - `relay`: traffic relayed through provider edge (Tailscale DERP)
4847
+ * - `idle`: peer reachable but no recent traffic / handshake
4848
+ */
4849
+ connection: z.enum([
4850
+ "direct",
4851
+ "relay",
4852
+ "idle"
4853
+ ]),
4854
+ /** DERP region / relay node identifier when `connection: relay`. Null otherwise. */
4855
+ relay: z.string().nullable(),
4856
+ /** Last successful handshake timestamp (epoch ms). 0 when never. */
4857
+ lastHandshakeMs: z.number(),
4858
+ /** Bytes received from this peer since the daemon started. */
4859
+ rxBytes: z.number(),
4860
+ /** Bytes transmitted to this peer since the daemon started. */
4861
+ txBytes: z.number(),
4862
+ /** ACL tags this peer carries (e.g. `["tag:server"]`). Empty when human-owned. */
4863
+ tags: z.array(z.string()).readonly(),
4864
+ /** True when the peer advertises itself as an exit-node candidate. */
4865
+ exitNodeOption: z.boolean(),
4866
+ /** Subnet routes the peer advertises (e.g. `["192.168.1.0/24"]`). */
4867
+ advertisedRoutes: z.array(z.string()).readonly(),
4868
+ /** Owner account login (e.g. `foo@example.com`). Null for tagged peers. */
4869
+ userLogin: z.string().nullable(),
4870
+ /** Pre-auth key / machine-key expiry (epoch ms). Null when keys don't expire. */
4871
+ keyExpiry: z.number().nullable()
4821
4872
  });
4822
4873
  var MeshStatusSchema = z.object({
4823
4874
  /** True when the host is joined and the daemon reports healthy. */
@@ -4831,7 +4882,54 @@ var MeshStatusSchema = z.object({
4831
4882
  /** Every endpoint this provider exposes for the current host. */
4832
4883
  endpoints: z.array(MeshEndpointSchema$1).readonly(),
4833
4884
  /** Last error from the daemon, when not joined. */
4834
- error: z.string().optional()
4885
+ error: z.string().optional(),
4886
+ /**
4887
+ * Tenant / tailnet / network display name (Tailscale = tailnet
4888
+ * domain, Headscale = namespace, ZeroTier = network name). Empty
4889
+ * pre-join. Per-provider semantics, common slot.
4890
+ */
4891
+ tenantName: z.string(),
4892
+ /**
4893
+ * Mesh DNS suffix when the provider exposes peer-resolvable DNS
4894
+ * (Tailscale MagicDNS, Headscale MagicDNS, …). Empty when the
4895
+ * provider doesn't ship DNS (e.g. ZeroTier).
4896
+ */
4897
+ magicDnsSuffix: z.string(),
4898
+ /**
4899
+ * Authenticated user / account login bound to this host. Null when
4900
+ * the provider authenticates with a long-lived network token rather
4901
+ * than a user account (e.g. ZeroTier API token).
4902
+ */
4903
+ userLogin: z.string().nullable(),
4904
+ /**
4905
+ * Provider control-plane URL (Tailscale SaaS `https://login.tailscale.com`,
4906
+ * self-hosted Headscale, ZeroTier Central, …). Empty when not
4907
+ * applicable (rare).
4908
+ */
4909
+ controlPlaneUrl: z.string(),
4910
+ /**
4911
+ * Machine-key / node-key expiry (epoch ms). Null when the provider
4912
+ * doesn't rotate keys for the bound host. Operator-facing surface
4913
+ * for "your access expires on …" banners.
4914
+ */
4915
+ keyExpiry: z.number().nullable(),
4916
+ /**
4917
+ * When the provider runs its OWN mesh daemon (e.g. the Tailscale
4918
+ * client addon in `onboard` mode spawns a private `tailscaled`),
4919
+ * this carries the local control-socket path. Companion addons that
4920
+ * must drive the SAME daemon — chiefly `tailscale-ingress` for
4921
+ * Serve/Funnel — read it to point their CLI at the right socket
4922
+ * instead of the system default. Empty when the provider uses the
4923
+ * host's system daemon (or doesn't have the concept).
4924
+ */
4925
+ daemonSocket: z.string().optional(),
4926
+ /**
4927
+ * Path to the mesh CLI binary the provider downloaded for onboard
4928
+ * mode. Companion addons reuse it so they don't need a system
4929
+ * install when the operator chose a fully self-contained mesh.
4930
+ * Empty in host mode.
4931
+ */
4932
+ daemonCliPath: z.string().optional()
4835
4933
  });
4836
4934
  method(z.void(), MeshStatusSchema), method(z.object({
4837
4935
  /** Provider-specific auth key. For Tailscale this is the
@@ -4843,7 +4941,7 @@ method(z.void(), MeshStatusSchema), method(z.object({
4843
4941
  /** Optional hostname override the host should advertise once joined. */
4844
4942
  hostname: z.string().optional() }), z.object({
4845
4943
  /** Authentication URL the operator should open in a browser. */
4846
- loginUrl: z.string() }), { kind: "mutation" }), method(z.void(), z.object({ left: z.literal(true) }), { kind: "mutation" }), method(z.void(), z.object({ peers: z.array(MeshPeerSchema).readonly() })), method(z.object({
4944
+ loginUrl: z.string() }), { kind: "mutation" }), method(z.void(), z.object({ left: z.literal(true) }), { kind: "mutation" }), method(z.void(), z.object({ loggedOut: z.literal(true) }), { kind: "mutation" }), method(z.void(), z.object({ peers: z.array(MeshPeerSchema).readonly() })), method(z.object({
4847
4945
  /** Optional auth key — when provided, probes the key validity
4848
4946
  * against the provider's API. Omit when already joined to
4849
4947
  * just ping the daemon. */
@@ -4882,13 +4980,26 @@ var MeshProviderInfoSchema = z.object({
4882
4980
  /** Active endpoints (mesh IP + MagicDNS + optional public Funnel). */
4883
4981
  endpoints: z.array(MeshEndpointSchema).readonly(),
4884
4982
  /** Last error reported by the provider. */
4885
- error: z.string().optional()
4983
+ error: z.string().optional(),
4984
+ /** Tenant / tailnet / network display name. Empty pre-join. */
4985
+ tenantName: z.string(),
4986
+ /** Mesh DNS suffix (e.g. tailXXXX.ts.net). Empty when not configured. */
4987
+ magicDnsSuffix: z.string(),
4988
+ /** Authenticated user / account login. Null for token-only providers. */
4989
+ userLogin: z.string().nullable(),
4990
+ /** Provider control-plane URL. */
4991
+ controlPlaneUrl: z.string(),
4992
+ /** Machine-key expiry (epoch ms). Null when keys don't rotate. */
4993
+ keyExpiry: z.number().nullable()
4886
4994
  });
4887
4995
  method(z.void(), z.array(MeshProviderInfoSchema).readonly()), method(z.object({
4888
4996
  addonId: z.string(),
4889
4997
  authKey: z.string().min(8),
4890
4998
  hostname: z.string().optional()
4891
- }), z.object({ joined: z.literal(true) }), { kind: "mutation" }), method(z.object({ addonId: z.string() }), z.object({ success: z.literal(true) }), { kind: "mutation" });
4999
+ }), z.object({ joined: z.literal(true) }), { kind: "mutation" }), method(z.object({ addonId: z.string() }), z.object({ success: z.literal(true) }), { kind: "mutation" }), method(z.object({
5000
+ addonId: z.string(),
5001
+ hostname: z.string().optional()
5002
+ }), z.object({ loginUrl: z.string() }), { kind: "mutation" }), method(z.object({ addonId: z.string() }), z.object({ loggedOut: z.literal(true) }), { kind: "mutation" }), method(z.object({ addonId: z.string() }), z.object({ peers: z.array(MeshPeerSchema).readonly() }));
4892
5003
  var MethodAccessSchema = z.enum([
4893
5004
  "view",
4894
5005
  "create",
@@ -4975,6 +5086,13 @@ var UserSummarySchema = z.object({
4975
5086
  allowedProviders: z.union([z.array(z.string()), z.literal("*")]),
4976
5087
  allowedDevices: z.record(z.string(), z.union([z.array(z.string()), z.literal("*")])),
4977
5088
  scopes: z.array(TokenScopeSchema).default([]),
5089
+ /**
5090
+ * True iff this user has a CONFIRMED TOTP enrollment. Surfaced on
5091
+ * `listUsers` so the admin Users page can render the "Remove 2FA"
5092
+ * action conditionally without firing one `getTotpStatus` query per
5093
+ * row. Self-service enrollment lives on the user's profile page.
5094
+ */
5095
+ totpEnabled: z.boolean().default(false),
4978
5096
  createdAt: z.number(),
4979
5097
  updatedAt: z.number()
4980
5098
  });
@@ -5237,6 +5355,12 @@ var NodeAddonInputSchema = z.object({
5237
5355
  nodeId: z.string(),
5238
5356
  addonId: z.string()
5239
5357
  });
5358
+ var NodeAddonEntrySchema = z.object({
5359
+ id: z.string(),
5360
+ status: z.string(),
5361
+ version: z.string().optional(),
5362
+ packageName: z.string().optional()
5363
+ });
5240
5364
  var SuccessSchema = z.object({ success: z.boolean() });
5241
5365
  var RestartProcessResultSchema = z.object({
5242
5366
  success: z.boolean(),
@@ -5277,7 +5401,7 @@ method(z.void(), z.array(TopologyNodeSchema).readonly(), { auth: "admin" }), met
5277
5401
  }), RenameNodeResultSchema, {
5278
5402
  kind: "mutation",
5279
5403
  auth: "admin"
5280
- }), method(z.void(), z.record(z.string(), ClusterAddonStatusEntrySchema), { auth: "admin" }), method(z.object({
5404
+ }), method(z.void(), z.record(z.string(), ClusterAddonStatusEntrySchema), { auth: "admin" }), method(z.object({ nodeId: z.string() }), z.array(NodeAddonEntrySchema).readonly(), { auth: "admin" }), method(z.object({
5281
5405
  nodeId: z.string(),
5282
5406
  level: z.string()
5283
5407
  }), SuccessSchema, {
@@ -5487,6 +5611,21 @@ var AddonAutoUpdateSchema = ChannelWithInheritSchema;
5487
5611
  var RestartAddonResultSchema = z.unknown();
5488
5612
  var InstallPackageResultSchema = z.unknown();
5489
5613
  var ReloadPackagesResultSchema = z.unknown();
5614
+ var UpdateFrameworkPackageResultSchema = z.object({
5615
+ packageName: z.string(),
5616
+ fromVersion: z.string(),
5617
+ toVersion: z.string(),
5618
+ /** Ms-epoch the server scheduled its self-restart. */
5619
+ restartingAt: z.number()
5620
+ });
5621
+ var FrameworkPackageStatusSchema = z.object({
5622
+ packageName: z.string(),
5623
+ currentVersion: z.string(),
5624
+ latestVersion: z.string().nullable(),
5625
+ hasUpdate: z.boolean(),
5626
+ /** Optional manifest description for the row tooltip. */
5627
+ description: z.string().optional()
5628
+ });
5490
5629
  var LogStreamEntrySchema = z.object({
5491
5630
  timestamp: z.string(),
5492
5631
  level: z.string(),
@@ -5518,21 +5657,43 @@ method(z.void(), z.array(AddonListItemSchema).readonly()), method(z.object({
5518
5657
  }), method(z.void(), ReloadPackagesResultSchema, {
5519
5658
  kind: "mutation",
5520
5659
  auth: "admin"
5521
- }), method(z.object({ query: z.string().optional() }), z.array(SearchResultSchema)), method(z.void(), z.array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(z.object({
5660
+ }), method(z.object({ query: z.string().optional() }), z.array(SearchResultSchema)), method(z.object({ nodeId: z.string().optional() }), z.array(PackageUpdateSchema).readonly(), { auth: "admin" }), method(z.object({
5522
5661
  name: z.string().min(1),
5523
- version: z.string().optional()
5662
+ version: z.string().optional(),
5663
+ nodeId: z.string().optional()
5524
5664
  }), z.unknown(), {
5525
5665
  kind: "mutation",
5526
5666
  auth: "admin"
5527
5667
  }), method(z.object({ name: z.string().min(1) }), z.object({ rolledBackTo: z.string().nullable() }), {
5528
5668
  kind: "mutation",
5529
5669
  auth: "admin"
5530
- }), method(z.void(), z.unknown(), {
5670
+ }), method(z.object({ nodeId: z.string().optional() }), z.unknown(), {
5531
5671
  kind: "mutation",
5532
5672
  auth: "admin"
5533
5673
  }), method(z.object({ confirm: z.literal(true) }), z.unknown(), {
5534
5674
  kind: "mutation",
5535
5675
  auth: "admin"
5676
+ }), method(z.void(), z.object({
5677
+ kind: z.enum([
5678
+ "framework-update",
5679
+ "manual",
5680
+ "system"
5681
+ ]),
5682
+ packageName: z.string().optional(),
5683
+ fromVersion: z.string().optional(),
5684
+ toVersion: z.string().optional(),
5685
+ requestedBy: z.string().optional(),
5686
+ requestedAt: z.number()
5687
+ }).nullable(), { auth: "admin" }), method(z.void(), z.array(FrameworkPackageStatusSchema).readonly(), { auth: "admin" }), method(z.object({ capName: z.string().min(1) }), z.array(z.object({
5688
+ addonId: z.string(),
5689
+ mode: z.enum(["singleton", "collection"]),
5690
+ isActive: z.boolean()
5691
+ })).readonly()), method(z.object({
5692
+ packageName: z.string().min(1),
5693
+ version: z.string().optional()
5694
+ }), UpdateFrameworkPackageResultSchema, {
5695
+ kind: "mutation",
5696
+ auth: "admin"
5536
5697
  }), method(z.object({ name: z.string() }), z.array(PackageVersionInfoSchema).readonly()), method(z.object({ addonId: z.string() }), RestartAddonResultSchema, {
5537
5698
  kind: "mutation",
5538
5699
  auth: "admin"