@camstack/types 1.2.310 → 1.2.312
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/capabilities/hub-address.d.ts +60 -51
- package/dist/capabilities/index.d.ts +1 -1
- package/dist/capabilities/local-network.cap.d.ts +149 -147
- package/dist/capabilities/notification-rules.cap.d.ts +12 -0
- package/dist/client.js +15 -3
- package/dist/client.mjs +15 -3
- package/dist/index.js +124 -106
- package/dist/index.mjs +118 -100
- package/dist/notification/alarm-settings.d.ts +6 -3
- package/package.json +1 -1
|
@@ -8,44 +8,48 @@
|
|
|
8
8
|
* and knows its tunnel and mesh names — every input the automatic answer
|
|
9
9
|
* needs. A variable that restated it could only drift from it.
|
|
10
10
|
*
|
|
11
|
-
* ## Roles
|
|
11
|
+
* ## Roles (D734)
|
|
12
12
|
*
|
|
13
13
|
* An address — a DETECTED endpoint or an operator-entered CUSTOM address —
|
|
14
14
|
* carries role flags, the same way for both:
|
|
15
15
|
*
|
|
16
|
-
* - `
|
|
17
|
-
* LAN IPv4 address plus the public tunnel.
|
|
18
|
-
* - `
|
|
19
|
-
* Automatic: the CamStack app link (D709).
|
|
20
|
-
* - `
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
16
|
+
* - `appConnections` (many) — what the CamStack apps try when connecting.
|
|
17
|
+
* Automatic: every LAN IPv4 address plus the public tunnel.
|
|
18
|
+
* - `notificationTaps` (one) — ONLY where tapping a notification opens.
|
|
19
|
+
* Automatic: the CamStack app link (D709); a hub address may be flagged.
|
|
20
|
+
* - `publicEndpoint` (one) — every URL that must work from OUTSIDE the home
|
|
21
|
+
* network: sign-in links, OIDC / OAuth2 callbacks, the passkey relying
|
|
22
|
+
* party, account linking, and the notification centre's action buttons,
|
|
23
|
+
* attachment / media links and admin links. Automatic: the public tunnel,
|
|
24
|
+
* then the mesh, then the LAN. Never the app link.
|
|
25
|
+
* - `internal` (one) — what agents and LAN devices download from (addon
|
|
26
|
+
* bundles, models, a camera relay's broker host, Home Assistant media).
|
|
27
|
+
* Automatic: a LAN IPv4 literal, then any plausible LAN address, then the
|
|
28
|
+
* mesh. Never a public tunnel: it is a detour off the LAN for traffic that
|
|
29
|
+
* never left it.
|
|
27
30
|
*
|
|
28
31
|
* A single-valued role is stored as ONE URL, so "at most one address carries
|
|
29
32
|
* it" holds by construction, not by a check. A flag wins outright; no flag is
|
|
30
33
|
* automatic. Automatic picks only among DETECTED endpoints — a custom address
|
|
31
34
|
* serves exactly the roles it is flagged with. Loopback and the app link are
|
|
32
|
-
* never an
|
|
33
|
-
* app link is not a hub address. `null` means nothing qualifies —
|
|
34
|
-
* must say so rather than substitute `127.0.0.1`.
|
|
35
|
+
* never an internal or public-endpoint answer: loopback names whoever dials
|
|
36
|
+
* it, and the app link is not a hub address. `null` means nothing qualifies —
|
|
37
|
+
* the caller must say so rather than substitute `127.0.0.1`.
|
|
35
38
|
*/
|
|
36
|
-
import type {
|
|
37
|
-
|
|
38
|
-
export
|
|
39
|
+
import type { z } from 'zod';
|
|
40
|
+
import type { ConnectionEndpoint, HubAddressRoleSchema } from './local-network.cap.js';
|
|
41
|
+
export declare const HUB_ADDRESS_ROLES: readonly ["appConnections", "notificationTaps", "internal", "publicEndpoint"];
|
|
42
|
+
export type HubAddressRole = z.infer<typeof HubAddressRoleSchema>;
|
|
39
43
|
/** The roles at most one address carries. */
|
|
40
|
-
export type SingleHubAddressRole = Exclude<HubAddressRole, '
|
|
44
|
+
export type SingleHubAddressRole = Exclude<HubAddressRole, 'appConnections'>;
|
|
41
45
|
export declare const SINGLE_HUB_ADDRESS_ROLES: readonly SingleHubAddressRole[];
|
|
42
46
|
export declare function isSingleHubAddressRole(role: HubAddressRole): role is SingleHubAddressRole;
|
|
43
47
|
/** The operator's role flags, as stored. `null` / `[]` = automatic. */
|
|
44
48
|
export interface HubAddressFlags {
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
+
readonly appConnections: readonly string[];
|
|
50
|
+
readonly notificationTaps: string | null;
|
|
51
|
+
readonly internal: string | null;
|
|
52
|
+
readonly publicEndpoint: string | null;
|
|
49
53
|
}
|
|
50
54
|
export declare const AUTOMATIC_HUB_ADDRESS_FLAGS: HubAddressFlags;
|
|
51
55
|
export type HubAddressCheck = {
|
|
@@ -61,14 +65,14 @@ export type HubAddressCheck = {
|
|
|
61
65
|
* Answers the normalised origin (`scheme://host[:port]`).
|
|
62
66
|
*/
|
|
63
67
|
export declare function validateCustomAddress(raw: string): HubAddressCheck;
|
|
64
|
-
/** The reason a plain-http
|
|
65
|
-
export declare const
|
|
68
|
+
/** The reason a plain-http public endpoint is refused unless accepted. */
|
|
69
|
+
export declare const PUBLIC_ENDPOINT_HTTP_REASON = "The public endpoint needs an https:// address: passkeys and most identity providers refuse a plain-http origin. Accept http only when sign-in and notification links never leave your own network.";
|
|
66
70
|
/**
|
|
67
71
|
* May `baseUrl` carry `role`? The address check above, plus two role rules:
|
|
68
|
-
* the app link carries `
|
|
69
|
-
* plain-http address carries `
|
|
70
|
-
* accepted it (`acceptInsecureHttp`) — a LAN-only password or
|
|
71
|
-
* sign-in works over http, a passkey or an OIDC callback does not.
|
|
72
|
+
* the app link carries `notificationTaps` only (it is not a hub address), and
|
|
73
|
+
* a plain-http address carries `publicEndpoint` only when the operator
|
|
74
|
+
* explicitly accepted it (`acceptInsecureHttp`) — a LAN-only password or
|
|
75
|
+
* magic-link sign-in works over http, a passkey or an OIDC callback does not.
|
|
72
76
|
*/
|
|
73
77
|
export declare function checkRoleAddress(role: HubAddressRole, baseUrl: string, options?: {
|
|
74
78
|
readonly acceptInsecureHttp?: boolean;
|
|
@@ -82,42 +86,47 @@ export interface HubAddressRoleResolution {
|
|
|
82
86
|
readonly resolved: string | null;
|
|
83
87
|
readonly source: HubAddressSource;
|
|
84
88
|
}
|
|
85
|
-
export interface
|
|
86
|
-
/** The addresses flagged `
|
|
89
|
+
export interface HubAppConnectionsResolution {
|
|
90
|
+
/** The addresses flagged `appConnections`, or empty for automatic. */
|
|
87
91
|
readonly flagged: readonly string[];
|
|
88
92
|
/** What the apps race right now (may be empty when nothing is up). */
|
|
89
93
|
readonly resolved: readonly string[];
|
|
90
94
|
readonly source: HubAddressSource;
|
|
91
95
|
}
|
|
92
|
-
/** `
|
|
93
|
-
export declare function
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
export declare function
|
|
96
|
+
/** `internal`: what agents and LAN devices download from. */
|
|
97
|
+
export declare function resolveInternalAddress(endpoints: readonly ConnectionEndpoint[], flags: HubAddressFlags): HubAddressRoleResolution;
|
|
98
|
+
/**
|
|
99
|
+
* `publicEndpoint`: every URL that must work off the LAN — sign-in links, OIDC
|
|
100
|
+
* / OAuth2 callbacks, the relying party, and notification buttons,
|
|
101
|
+
* attachments, media and admin links.
|
|
102
|
+
*/
|
|
103
|
+
export declare function resolvePublicEndpoint(endpoints: readonly ConnectionEndpoint[], flags: HubAddressFlags): HubAddressRoleResolution;
|
|
104
|
+
/** `notificationTaps`: the flagged address, else the CamStack app link (D709). */
|
|
105
|
+
export declare function resolveNotificationTapAddress(flags: HubAddressFlags): HubAddressRoleResolution;
|
|
106
|
+
/** AUTO app connections: LAN IPv4 + the public tunnel. Never IPv6, mesh, loopback or custom. */
|
|
107
|
+
export declare function isDefaultAppConnectionEndpoint(endpoint: ConnectionEndpoint): boolean;
|
|
100
108
|
/**
|
|
101
109
|
* The endpoints the apps race: the flagged ones that are in `endpoints`
|
|
102
|
-
* (which carries the custom addresses flagged `
|
|
110
|
+
* (which carries the custom addresses flagged `appConnections`), else AUTO. A flagged
|
|
103
111
|
* set none of which is currently up falls back to AUTO rather than racing
|
|
104
112
|
* nothing.
|
|
105
113
|
*/
|
|
106
|
-
export declare function
|
|
107
|
-
/** `
|
|
108
|
-
export declare function
|
|
114
|
+
export declare function selectAppConnectionEndpoints(endpoints: readonly ConnectionEndpoint[], flags: HubAddressFlags): ConnectionEndpoint[];
|
|
115
|
+
/** `appConnections`: what the apps try when connecting. */
|
|
116
|
+
export declare function resolveAppConnections(endpoints: readonly ConnectionEndpoint[], flags: HubAddressFlags): HubAppConnectionsResolution;
|
|
109
117
|
/** Every role's answer. */
|
|
110
118
|
export interface HubAddressRoles {
|
|
111
|
-
readonly
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
readonly
|
|
119
|
+
readonly appConnections: HubAppConnectionsResolution;
|
|
120
|
+
readonly notificationTaps: HubAddressRoleResolution;
|
|
121
|
+
readonly internal: HubAddressRoleResolution;
|
|
122
|
+
readonly publicEndpoint: HubAddressRoleResolution;
|
|
115
123
|
}
|
|
116
124
|
/**
|
|
117
|
-
* Every role at once, each through its own resolver. `
|
|
118
|
-
* the apps race (it carries the custom addresses flagged `
|
|
119
|
-
* `hubPalette` is the detected HTTPS palette
|
|
125
|
+
* Every role at once, each through its own resolver. `appPalette` is what
|
|
126
|
+
* the apps race (it carries the custom addresses flagged `appConnections`);
|
|
127
|
+
* `hubPalette` is the detected HTTPS palette `internal` and `publicEndpoint`
|
|
128
|
+
* resolve over.
|
|
120
129
|
*/
|
|
121
|
-
export declare function resolveHubAddressRoles(
|
|
130
|
+
export declare function resolveHubAddressRoles(appPalette: readonly ConnectionEndpoint[], hubPalette: readonly ConnectionEndpoint[], flags: HubAddressFlags): HubAddressRoles;
|
|
122
131
|
/** The bare hostname of a base URL, or `null` when it does not parse. */
|
|
123
132
|
export declare function hubAddressHostname(baseUrl: string | null): string | null;
|
|
@@ -64,7 +64,7 @@ export { EMBEDDING_MODEL_FAILED, EMBEDDING_REQUIREMENTS_FAILED, EMBEDDING_REQUIR
|
|
|
64
64
|
export type { FailureContribution, IFailureContributionProvider, } from './failure-contribution.cap.js';
|
|
65
65
|
export { FailureContributionSchema, FailureReasonCountSchema, failureContributionCapability, } from './failure-contribution.cap.js';
|
|
66
66
|
export { filesystemBrowseCapability, type IFilesystemBrowseProvider, } from './filesystem-browse.cap.js';
|
|
67
|
-
export { AUTOMATIC_HUB_ADDRESS_FLAGS, checkRoleAddress, HUB_ADDRESS_ROLES, type HubAddressCheck, type HubAddressFlags, type HubAddressRole, type HubAddressRoleResolution, type HubAddressRoles, type HubAddressSource, type
|
|
67
|
+
export { AUTOMATIC_HUB_ADDRESS_FLAGS, checkRoleAddress, HUB_ADDRESS_ROLES, type HubAddressCheck, type HubAddressFlags, type HubAddressRole, type HubAddressRoleResolution, type HubAddressRoles, type HubAddressSource, type HubAppConnectionsResolution, hubAddressHostname, isDefaultAppConnectionEndpoint, isSingleHubAddressRole, PUBLIC_ENDPOINT_HTTP_REASON, resolveAppConnections, resolveHubAddressRoles, resolveInternalAddress, resolveNotificationTapAddress, resolvePublicEndpoint, SINGLE_HUB_ADDRESS_ROLES, type SingleHubAddressRole, selectAppConnectionEndpoints, validateCustomAddress, } from './hub-address.js';
|
|
68
68
|
export { type HfModelResolution, HfModelResolutionSchema, type ILlmProvider, type LlmDefault, LlmDefaultSchema, type LlmDefaultSelector, LlmDefaultSelectorSchema, type LlmProfile, type LlmProfileKind, type LlmProfileKindDescriptor, LlmProfileKindDescriptorSchema, LlmProfileKindSchema, LlmProfileSchema, type LlmRuntimeNode, LlmRuntimeNodeSchema, type LlmUsageRollup, LlmUsageRollupSchema, llmCapability, type ManagedModelCatalogEntry, ManagedModelCatalogEntrySchema, } from './llm.cap.js';
|
|
69
69
|
export { type AppleFmAvailability, AppleFmAvailabilitySchema, type AppleFmUnavailableReason, AppleFmUnavailableReasonSchema, type ILlmRuntimeProvider, type LlmDownloadProgress, LlmDownloadProgressSchema, type LlmNodeModel, LlmNodeModelSchema, type LlmRuntimeAppleCompleteInput, LlmRuntimeAppleCompleteInputSchema, type LlmRuntimeCancelInput, LlmRuntimeCancelInputSchema, type LlmRuntimeCompleteInput, LlmRuntimeCompleteInputSchema, type LlmRuntimeDiskUsage, LlmRuntimeDiskUsageSchema, type LlmRuntimeStatus, LlmRuntimeStatusSchema, llmRuntimeCapability, type ManagedModelExtraFile, ManagedModelExtraFileSchema, type ManagedModelRef, ManagedModelRefSchema, type ManagedRuntimeConfig, ManagedRuntimeConfigSchema, } from './llm-runtime.cap.js';
|
|
70
70
|
export { type LlmErrorCode, LlmErrorCodeSchema, type LlmGenerateBaseInput, LlmGenerateBaseInputSchema, type LlmGenerateErr, LlmGenerateErrSchema, type LlmGenerateOk, LlmGenerateOkSchema, type LlmGenerateResult, LlmGenerateResultSchema, type LlmImage, LlmImageSchema, type LlmRefusalSource, LlmRefusalSourceSchema, type LlmRetryPolicy, LlmRetryPolicySchema, LlmTimeoutDefaults, type LlmUsage, LlmUsageSchema, } from './llm-shared.js';
|