@camstack/types 1.2.72 → 1.2.73

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.
@@ -39,6 +39,69 @@ declare const NetworkAddressSchema: z.ZodObject<{
39
39
  family: z.ZodString;
40
40
  internal: z.ZodBoolean;
41
41
  }, z.core.$strip>;
42
+ /**
43
+ * Provenance of the site coordinates, and the whole reason this is not just two
44
+ * numbers.
45
+ *
46
+ * - `operator-set` — a human typed it, or accepted a detection. Authoritative;
47
+ * nothing overwrites it.
48
+ * - `derived-from-ip` — the hub geolocated its own public IP once, because a
49
+ * default that is right to a few kilometres beats the coarse UTC clock split
50
+ * the sun-times consumers otherwise fall back to.
51
+ *
52
+ * The UI shows which one it is. An operator who cannot tell a guess from their
53
+ * own input will eventually trust the guess.
54
+ */
55
+ declare const SiteLocationSourceSchema: z.ZodEnum<{
56
+ "operator-set": "operator-set";
57
+ "derived-from-ip": "derived-from-ip";
58
+ }>;
59
+ /**
60
+ * Where the installation physically is — a fact of the SITE, not of any addon.
61
+ *
62
+ * It used to live in `pipeline-analytics`' global settings, which made a
63
+ * property of the building a property of one analytics addon. Anything that
64
+ * needs sun-times (scene condition variants today; anything solar tomorrow)
65
+ * reads it from here.
66
+ */
67
+ declare const SiteLocationSchema: z.ZodObject<{
68
+ latitude: z.ZodNumber;
69
+ longitude: z.ZodNumber;
70
+ source: z.ZodEnum<{
71
+ "operator-set": "operator-set";
72
+ "derived-from-ip": "derived-from-ip";
73
+ }>;
74
+ updatedAt: z.ZodNumber;
75
+ label: z.ZodOptional<z.ZodString>;
76
+ }, z.core.$strip>;
77
+ /**
78
+ * The read shape: the location plus the honest state of the one-shot derivation.
79
+ *
80
+ * `derivationAttemptedAt` is what makes the "one call, ever" contract
81
+ * inspectable. When it is set and `location` is null, the geo-IP lookup ran and
82
+ * failed; the hub will NOT try again on its own — the fallback is declared
83
+ * (consumers degrade to their own last resort) and the operator either types the
84
+ * coordinates or presses detect.
85
+ */
86
+ declare const SiteLocationStatusSchema: z.ZodObject<{
87
+ location: z.ZodNullable<z.ZodObject<{
88
+ latitude: z.ZodNumber;
89
+ longitude: z.ZodNumber;
90
+ source: z.ZodEnum<{
91
+ "operator-set": "operator-set";
92
+ "derived-from-ip": "derived-from-ip";
93
+ }>;
94
+ updatedAt: z.ZodNumber;
95
+ label: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strip>>;
97
+ derivationAttemptedAt: z.ZodNullable<z.ZodNumber>;
98
+ derivationError: z.ZodNullable<z.ZodString>;
99
+ }, z.core.$strip>;
100
+ /** `null` clears the location and re-arms nothing — the derivation stays spent. */
101
+ declare const SetSiteLocationInputSchema: z.ZodNullable<z.ZodObject<{
102
+ latitude: z.ZodNumber;
103
+ longitude: z.ZodNumber;
104
+ }, z.core.$strip>>;
42
105
  export declare const systemCapability: {
43
106
  readonly name: "system";
44
107
  readonly scope: "system";
@@ -79,6 +142,68 @@ export declare const systemCapability: {
79
142
  readonly getRetentionConfig: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodNullable<z.ZodUnknown>, import("./capability-definition.js").CapabilityMethodKind>;
80
143
  readonly setRetentionConfig: import("./capability-definition.js").CapabilityMethodSchema<z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodNull, "mutation">;
81
144
  readonly forceRetentionCleanup: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodVoid, "mutation">;
145
+ /**
146
+ * The site coordinates, deriving a default from the hub's public IP on the
147
+ * FIRST read that finds nothing stored.
148
+ *
149
+ * The derivation is one-shot and bounded: one outbound request, a few
150
+ * seconds, its outcome persisted either way. A hub with no internet pays it
151
+ * once and never again, and neither boot nor any consumer is blocked on it —
152
+ * the caller gets `location: null` and degrades exactly as it did before this
153
+ * method existed.
154
+ */
155
+ readonly getSiteLocation: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
156
+ location: z.ZodNullable<z.ZodObject<{
157
+ latitude: z.ZodNumber;
158
+ longitude: z.ZodNumber;
159
+ source: z.ZodEnum<{
160
+ "operator-set": "operator-set";
161
+ "derived-from-ip": "derived-from-ip";
162
+ }>;
163
+ updatedAt: z.ZodNumber;
164
+ label: z.ZodOptional<z.ZodString>;
165
+ }, z.core.$strip>>;
166
+ derivationAttemptedAt: z.ZodNullable<z.ZodNumber>;
167
+ derivationError: z.ZodNullable<z.ZodString>;
168
+ }, z.core.$strip>, import("./capability-definition.js").CapabilityMethodKind>;
169
+ /** Operator input. Always lands as `source: 'operator-set'`. */
170
+ readonly setSiteLocation: import("./capability-definition.js").CapabilityMethodSchema<z.ZodNullable<z.ZodObject<{
171
+ latitude: z.ZodNumber;
172
+ longitude: z.ZodNumber;
173
+ }, z.core.$strip>>, z.ZodObject<{
174
+ location: z.ZodNullable<z.ZodObject<{
175
+ latitude: z.ZodNumber;
176
+ longitude: z.ZodNumber;
177
+ source: z.ZodEnum<{
178
+ "operator-set": "operator-set";
179
+ "derived-from-ip": "derived-from-ip";
180
+ }>;
181
+ updatedAt: z.ZodNumber;
182
+ label: z.ZodOptional<z.ZodString>;
183
+ }, z.core.$strip>>;
184
+ derivationAttemptedAt: z.ZodNullable<z.ZodNumber>;
185
+ derivationError: z.ZodNullable<z.ZodString>;
186
+ }, z.core.$strip>, "mutation">;
187
+ /**
188
+ * Re-run the geo-IP derivation now. The ONLY way a spent or failed
189
+ * derivation is retried — there is no timer, and no read path retries.
190
+ * Overwrites an existing `derived-from-ip` value; refuses to clobber an
191
+ * `operator-set` one.
192
+ */
193
+ readonly detectSiteLocation: import("./capability-definition.js").CapabilityMethodSchema<z.ZodVoid, z.ZodObject<{
194
+ location: z.ZodNullable<z.ZodObject<{
195
+ latitude: z.ZodNumber;
196
+ longitude: z.ZodNumber;
197
+ source: z.ZodEnum<{
198
+ "operator-set": "operator-set";
199
+ "derived-from-ip": "derived-from-ip";
200
+ }>;
201
+ updatedAt: z.ZodNumber;
202
+ label: z.ZodOptional<z.ZodString>;
203
+ }, z.core.$strip>>;
204
+ derivationAttemptedAt: z.ZodNullable<z.ZodNumber>;
205
+ derivationError: z.ZodNullable<z.ZodString>;
206
+ }, z.core.$strip>, "mutation">;
82
207
  };
83
208
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
84
209
  readonly mount: {
@@ -86,4 +211,8 @@ export declare const systemCapability: {
86
211
  };
87
212
  };
88
213
  export type ISystemProvider = InferProvider<typeof systemCapability>;
89
- export { FeatureManifestSchema, HealthStatusSchema, NetworkAddressSchema };
214
+ export type SiteLocation = z.infer<typeof SiteLocationSchema>;
215
+ export type SiteLocationSource = z.infer<typeof SiteLocationSourceSchema>;
216
+ export type SiteLocationStatus = z.infer<typeof SiteLocationStatusSchema>;
217
+ export type SetSiteLocationInput = z.infer<typeof SetSiteLocationInputSchema>;
218
+ export { FeatureManifestSchema, HealthStatusSchema, NetworkAddressSchema, SetSiteLocationInputSchema, SiteLocationSchema, SiteLocationSourceSchema, SiteLocationStatusSchema, };
@@ -3354,6 +3354,13 @@ export type AppRouter = TrpcCoreRouter<{
3354
3354
  output: z.infer<typeof llmCapability.methods.generateVision.output>;
3355
3355
  meta: object;
3356
3356
  }>;
3357
+ cancel: TRPCMutationProcedure<{
3358
+ input: {
3359
+ [x: string]: unknown;
3360
+ } & z.input<typeof llmCapability.methods.cancel.input>;
3361
+ output: z.infer<typeof llmCapability.methods.cancel.output>;
3362
+ meta: object;
3363
+ }>;
3357
3364
  listProfileKinds: TRPCQueryProcedure<{
3358
3365
  input: {
3359
3366
  [x: string]: unknown;
@@ -7494,6 +7501,25 @@ export type AppRouter = TrpcCoreRouter<{
7494
7501
  output: z.infer<typeof systemCapability.methods.forceRetentionCleanup.output>;
7495
7502
  meta: object;
7496
7503
  }>;
7504
+ getSiteLocation: TRPCQueryProcedure<{
7505
+ input: {
7506
+ nodeId?: string | undefined;
7507
+ } | undefined;
7508
+ output: z.infer<typeof systemCapability.methods.getSiteLocation.output>;
7509
+ meta: object;
7510
+ }>;
7511
+ setSiteLocation: TRPCMutationProcedure<{
7512
+ input: z.input<typeof systemCapability.methods.setSiteLocation.input>;
7513
+ output: z.infer<typeof systemCapability.methods.setSiteLocation.output>;
7514
+ meta: object;
7515
+ }>;
7516
+ detectSiteLocation: TRPCMutationProcedure<{
7517
+ input: {
7518
+ nodeId?: string | undefined;
7519
+ } | undefined;
7520
+ output: z.infer<typeof systemCapability.methods.detectSiteLocation.output>;
7521
+ meta: object;
7522
+ }>;
7497
7523
  }>>;
7498
7524
  tamper: TRPCBuiltRouter<{
7499
7525
  ctx: TrpcContext;
@@ -6,7 +6,7 @@
6
6
  * scope+access check inside `protectedProcedure` (see
7
7
  * `server/backend/src/api/trpc/trpc.middleware.ts`).
8
8
  *
9
- * Coverage: 934 method paths across 123 capabilities.
9
+ * Coverage: 938 method paths across 123 capabilities.
10
10
  */
11
11
  import type { CapabilityMethodAccess } from '../capabilities/capability-definition.js';
12
12
  export interface MethodAccessRecord {
@@ -73,7 +73,7 @@ export interface SystemProxy {
73
73
  readonly deviceState: Pick<InferProvider<typeof deviceStateCapability>, 'getAllSnapshots'>;
74
74
  readonly faceGallery: Pick<InferProvider<typeof faceGalleryCapability>, 'listIdentities' | 'createIdentity' | 'renameIdentity' | 'deleteIdentity' | 'listIdentitySamples' | 'removeSample' | 'getFaceMedia' | 'assignFace' | 'unassignFace' | 'deleteFace' | 'assignFaces' | 'unassignFaces' | 'suggestFaceClusters'>;
75
75
  readonly integrations: Pick<InferProvider<typeof integrationsCapability>, 'list' | 'get' | 'getByAddonId' | 'create' | 'update' | 'delete' | 'getSettings' | 'setSettings' | 'getAvailableTypes' | 'testConnection'>;
76
- readonly llm: Pick<InferProvider<typeof llmCapability>, 'generate' | 'generateVision' | 'listProfileKinds' | 'listProfiles' | 'upsertProfile' | 'deleteProfile' | 'testProfile' | 'listModels' | 'getDefaults' | 'setDefault' | 'getUsage' | 'listModelCatalog' | 'listRuntimeNodes' | 'listNodeModels' | 'installModel' | 'deleteModel' | 'getRuntimeStatus' | 'startRuntime' | 'stopRuntime'>;
76
+ readonly llm: Pick<InferProvider<typeof llmCapability>, 'generate' | 'generateVision' | 'cancel' | 'listProfileKinds' | 'listProfiles' | 'upsertProfile' | 'deleteProfile' | 'testProfile' | 'listModels' | 'getDefaults' | 'setDefault' | 'getUsage' | 'listModelCatalog' | 'listRuntimeNodes' | 'listNodeModels' | 'installModel' | 'deleteModel' | 'getRuntimeStatus' | 'startRuntime' | 'stopRuntime'>;
77
77
  readonly localNetwork: Pick<InferProvider<typeof localNetworkCapability>, 'list' | 'getPreferred' | 'getConnectionEndpoints' | 'getNotificationEndpoint' | 'setNotificationEndpoint' | 'getAllowedAddresses' | 'setAllowedAddresses' | 'resetAllowlistToBestMatch'>;
78
78
  readonly meshNetwork: Pick<InferProvider<typeof meshNetworkCapability>, 'getStatus' | 'join' | 'startLogin' | 'leave' | 'logout' | 'listPeers' | 'testConnection'>;
79
79
  readonly metricsProvider: Pick<InferProvider<typeof metricsProviderCapability>, 'collectSnapshot' | 'getCached' | 'getCurrent' | 'getDiskSpace' | 'getGpuInfo' | 'getCpuTemperature' | 'getProcessStats' | 'listAddonInstances' | 'getAddonStats' | 'listNodeProcesses' | 'killProcess' | 'dumpHeapSnapshot'>;
@@ -94,7 +94,7 @@ export interface SystemProxy {
94
94
  readonly storage: Pick<InferProvider<typeof storageCapability>, 'resolve' | 'write' | 'read' | 'exists' | 'list' | 'delete' | 'getAvailableSpace' | 'beginUpload' | 'writeChunk' | 'finalizeUpload' | 'abortUpload' | 'beginDownload' | 'readChunk' | 'endDownload' | 'listLocations' | 'getDefaultLocation' | 'listLocationDeclarations' | 'upsertLocation' | 'deleteLocation' | 'testLocation' | 'listProviders' | 'testConfig'>;
95
95
  readonly storageMigration: Pick<InferProvider<typeof storageMigrationCapability>, 'plan' | 'start' | 'status' | 'cancel'>;
96
96
  readonly streamBroker: Pick<InferProvider<typeof streamBrokerCapability>, 'fetchEventMedia' | 'listAllCameraStreams' | 'listAllProfileSlots' | 'getBrokerStats' | 'probeStream' | 'listClients' | 'killClient' | 'getStreamUrl' | 'getStreamWithCodec' | 'releaseStreamWithCodec' | 'acquireEgressTranscode' | 'releaseEgressTranscode' | 'subscribeAudioChunks' | 'pullAudioChunks' | 'unsubscribeAudioChunks' | 'subscribeFrames' | 'pullFrameHandles' | 'unsubscribeFrames' | 'setPreBufferDuration' | 'getPreBufferInfo' | 'getRtspPort' | 'getAllRtspEntries' | 'getRtspEntry' | 'regenerateRtspToken' | 'setRtspEnabled' | 'isRtspEnabled'>;
97
- readonly system: Pick<InferProvider<typeof systemCapability>, 'info' | 'health' | 'featureFlags' | 'networkAddresses' | 'getRetentionConfig' | 'setRetentionConfig' | 'forceRetentionCleanup'>;
97
+ readonly system: Pick<InferProvider<typeof systemCapability>, 'info' | 'health' | 'featureFlags' | 'networkAddresses' | 'getRetentionConfig' | 'setRetentionConfig' | 'forceRetentionCleanup' | 'getSiteLocation' | 'setSiteLocation' | 'detectSiteLocation'>;
98
98
  readonly terminalSession: Pick<InferProvider<typeof terminalSessionCapability>, 'listProfiles' | 'listInstances' | 'createInstance' | 'deleteInstance' | 'setInstanceEnabled' | 'listLegacyCameras' | 'adoptLegacyMonitor' | 'listSessions' | 'openSession' | 'resize' | 'pullOutput' | 'writeInput' | 'close'>;
99
99
  readonly toast: Pick<InferProvider<typeof toastCapability>, 'onToast'>;
100
100
  readonly turnProvider: Pick<InferProvider<typeof turnProviderCapability>, 'getTurnServers'>;
package/dist/index.d.ts CHANGED
@@ -188,7 +188,7 @@ export type { AudioCodecInfo, AudioDecodeSessionConfig, AudioEncodedChunk, Audio
188
188
  export type { StreamQuality } from './interfaces/device-capabilities/camera.js';
189
189
  export { STREAM_QUALITY_LABELS, streamQualityLabel, } from './interfaces/device-capabilities/camera.js';
190
190
  export * from './lifecycle/index.js';
191
- export { audioIsFailClosed, audioLabelChoices, audioOrDefaults, isAudioLabelSelected, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, type NcAudioLabelChoice, type NcAudioPatch, normalizeAudioLabel, patchAudio, toggleAudioLabel, } from './notification/audio-condition.js';
191
+ export { audioIsFailClosed, audioLabelChoices, audioModeOf, audioOrDefaults, isAudioLabelSelected, NC_AUDIO_DB_MAX, NC_AUDIO_DB_MIN, NC_AUDIO_DB_OFFERED, NC_AUDIO_DB_STEP, NC_AUDIO_DEFAULTS, NC_AUDIO_HIT_PERCENT_MAX, NC_AUDIO_HIT_PERCENT_MIN, NC_AUDIO_SAMPLING_MAX_SEC, NC_AUDIO_SAMPLING_MIN_SEC, type NcAudioLabelChoice, type NcAudioMode, type NcAudioPatch, normalizeAudioLabel, patchAudio, toggleAudioLabel, } from './notification/audio-condition.js';
192
192
  export { isBaseConditionKey, knownValues, NC_BASE_CONDITION_KEYS, type NcBaseConditionKey, pickerForCondition, type TaxonomyGroup, type TaxonomyOption, type TaxonomyPicker, } from './notification/condition-taxonomy.js';
193
193
  export { type PreparedAction, type PreparedAttachment, type PreparedNotification, prepareNotification, type ResolvedLevel, } from './notification/degrade-engine.js';
194
194
  export { htmlToText, markdownToHtmlLite, markdownToText, type NotificationFormat as NotificationBodyFormat, resolveFormat, textToHtml, transcodeBody, } from './notification/format-transcode.js';
@@ -197,8 +197,8 @@ export type { TimelapseCadencePair, TimelapsePreviewMode, TimelapseRule, Timelap
197
197
  export { assertTimelapseCadences, DEFAULT_TIMELAPSE_PREVIEW_TEXT, readTimelapseGeneratedAt, TIMELAPSE_DENSE_FLOOR_SEC, TimelapseRuleInputSchema, TimelapseRulePatchSchema, TimelapseRuleSchema, TimelapseTemplateSchema, } from './notification/timelapse-rule.js';
198
198
  export { DEFAULT_DETAIL_CROP_CONVENTION, DETAIL_CROP_PADDING_FIELD, DETAIL_CROP_PADDING_KEY, DETAIL_CROP_SECTION_ID, DETAIL_CROP_SQUARE_KEY, type DetailCropConvention, DetailCropConventionSchema, type DetailCropRect, deriveDetailCropRect, type HydratedSettingsSection, type HydratedSettingsView, pickDetailCropConvention, readDetailCropConvention, } from './pipeline/detail-crop.js';
199
199
  export { DEFAULT_NATIVE_LEASE_SETTINGS, NATIVE_LEASE_ACTIVITY_FIELD, NATIVE_LEASE_ACTIVITY_KEY, NATIVE_LEASE_ADMISSION_FIELD, NATIVE_LEASE_ADMISSION_KEY, NATIVE_LEASE_BUDGET_FIELD, NATIVE_LEASE_BUDGET_KEY, NATIVE_LEASE_HOLD_FIELD, NATIVE_LEASE_HOLD_KEY, NATIVE_LEASE_SECTION_ID, NATIVE_LEASE_TILE_BUDGET_FIELD, NATIVE_LEASE_TILE_BUDGET_KEY, type NativeLeaseAdmission, NativeLeaseAdmissionSchema, type NativeLeaseKnob, type NativeLeaseNumberKnob, type NativeLeaseSettings, type NativeLeaseSettingsOverride, NativeLeaseSettingsSchema, pickNativeLeaseOverride, readNativeLeaseOverride, } from './pipeline/native-lease.js';
200
- export { type ApiKeyRecord, ApiKeyRecordSchema, type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
201
200
  export { ACCESS_ROLES, type AccessRoleAssignment, type AccessRoleId, type AccessRoleSpec, buildRoleScopes, detectAccessRole, roleSpec, } from './schemas/access-roles.js';
201
+ export { type ApiKeyRecord, ApiKeyRecordSchema, type CapScope, CapScopeSchema, type DeviceSelector, DeviceSelectorSchema, type DeviceTokenScope, type MethodAccess, MethodAccessSchema, type ScopedToken, ScopedTokenSchema, type TokenScope, TokenScopeSchema, type UserRecord, UserRecordSchema, } from './schemas/auth-records.js';
202
202
  export { type DeviceMetaLike, type DeviceReachSummary, deviceSelectorMatches, type EffectiveScope, normalizeTokenScopes, resolveViewableDeviceIds, type ScopeGrantSummary, scopeInherits, summarizeEffectiveScope, } from './schemas/device-selector.js';
203
203
  export type { CameraDetectionCapabilities, CameraMotionConfig, CameraNativeDetectionConfig, } from './types/camera-detection.js';
204
204
  export { DEVICE_TYPE_INFO, type DeviceTypeInfo } from './types/device-type.js';