@camstack/server 1.2.784 → 1.2.786
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/CHANGELOG.md +13 -0
- package/dist/api/core/cap-providers.js +44 -7
- package/dist/api/trpc/generated-cap-routers.js +0 -9
- package/package.json +40 -15
- package/system/dist/addon-runner.js +11 -2
- package/system/dist/addon-runner.mjs +12 -3
- package/system/dist/{agent-https-Ds3-zbz-.mjs → agent-https-D779EYj3.mjs} +1 -1
- package/system/dist/{agent-https-BobAhSU6.js → agent-https-snFEmSqQ.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composed-device.d.ts +16 -0
- package/system/dist/builtins/composer/composer.addon.js +68 -18
- package/system/dist/builtins/composer/composer.addon.mjs +68 -18
- package/system/dist/builtins/composer/composition-evaluation.d.ts +2 -2
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/actions-service.d.ts +16 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +235 -37
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +235 -37
- package/system/dist/builtins/core-blocks/migrations/fountain-drink-drop.d.ts +21 -0
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +1 -0
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +2 -2
- package/system/dist/builtins/loki-logging/index.mjs +2 -2
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-7_Barr9F.mjs → capture-engine-DkTEWrRe.mjs} +1 -1
- package/system/dist/{capture-engine-cNrHuwWH.js → capture-engine-NZ11ORZS.js} +1 -1
- package/system/dist/{composition-sources-7wEQtB6b.js → composition-sources-B6GYTy_7.js} +1 -1
- package/system/dist/{composition-sources-QUbTSbQL.mjs → composition-sources-B9-lkIvO.mjs} +1 -1
- package/system/dist/{constants-BmX7aeHq.mjs → constants--9ui1LK0.mjs} +1 -1
- package/system/dist/{constants-_Zq5aGIs.js → constants-DR8hdi45.js} +1 -1
- package/system/dist/{device-ca-DqNfUZx4.mjs → device-ca-D-7tAHJ_.mjs} +1 -1
- package/system/dist/{device-ca-D9nNDHW_.js → device-ca-sIFmKkGM.js} +1 -1
- package/system/dist/{dist-W0Eyg7Fm.mjs → dist-D-iGSnX_.mjs} +1109 -843
- package/system/dist/{dist-CA672buZ.js → dist-h3Yla8gE.js} +1162 -842
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-DYD3STlf.js → hub-mdns-ciao-C5DkUEZF.js} +2 -2
- package/system/dist/{hub-mdns-ciao-VOfs7CqC.mjs → hub-mdns-ciao-DuEfM0fI.mjs} +2 -2
- package/system/dist/index.js +19 -10
- package/system/dist/index.mjs +20 -11
- package/system/dist/kernel/moleculer/migration-api-facade.d.ts +2 -0
- package/system/dist/kernel/transport/local-child-client.d.ts +9 -0
- package/system/dist/{legacy-integration-rows-door-CF_0_-U9.mjs → legacy-integration-rows-door-BTdhD-Yp.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-BzVepX_e.js → legacy-integration-rows-door-DTDD5wwC.js} +1 -1
- package/system/dist/{restore-archive-BCXQaw89.js → restore-archive-CkAD_-E9.js} +1 -1
- package/system/dist/{restore-archive-B2l00XlI.mjs → restore-archive-DQWz5Wp-.mjs} +1 -1
- package/system/dist/{wal-maintenance-Z4MNv6Vn.js → wal-maintenance-CB-O-GPP.js} +0 -0
- package/system/dist/{wal-maintenance-bvjbNKbx.mjs → wal-maintenance-DouX1XsY.mjs} +0 -0
- package/system/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.786] - 2026-11-06
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Pet fountain tRPC routes lose the drink counters and the Clear daily count call
|
|
15
|
+
- The integrations list shows the on/off state of the instance itself; integrations.update no longer switches ordinary integrations
|
|
16
|
+
|
|
17
|
+
## [1.2.785] - 2026-11-06
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Rebuilt against updated dependencies.
|
|
22
|
+
|
|
10
23
|
## [1.2.784] - 2026-11-06
|
|
11
24
|
|
|
12
25
|
### Changed
|
|
@@ -960,6 +960,35 @@ function wizardDiscoveryMode(described) {
|
|
|
960
960
|
function getInstancesProvider(ar, addonId) {
|
|
961
961
|
return (0, integration_instances_provider_js_1.findInstancesProvider)(ar.getCapabilityRegistry(), addonId);
|
|
962
962
|
}
|
|
963
|
+
/**
|
|
964
|
+
* An integration's `enabled` is a projection of its instance body (epic #440, step 3): the one
|
|
965
|
+
* switch is `setInstanceEnabled`, stored in the addon's record. One `listInstances` call per
|
|
966
|
+
* addon answers every row of it. An addon whose provider is not up, that keeps no instance for the
|
|
967
|
+
* row, or that fails to answer keeps the registry's stored flag for that row, and a failure is
|
|
968
|
+
* logged: a listing never fails because one addon did not answer.
|
|
969
|
+
*/
|
|
970
|
+
async function projectSwitches(ar, logger, integrations) {
|
|
971
|
+
const byAddon = new Map();
|
|
972
|
+
for (const addonId of new Set(integrations.map((i) => i.addonId))) {
|
|
973
|
+
const provider = getInstancesProvider(ar, addonId);
|
|
974
|
+
if (provider === null)
|
|
975
|
+
continue;
|
|
976
|
+
try {
|
|
977
|
+
const instances = await provider.listInstances();
|
|
978
|
+
byAddon.set(addonId, new Map(instances.map((i) => [i.id, i.enabled !== false])));
|
|
979
|
+
}
|
|
980
|
+
catch (err) {
|
|
981
|
+
logger.warn('integration switch not projected: the addon did not answer', {
|
|
982
|
+
tags: { addonId },
|
|
983
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
return integrations.map((i) => {
|
|
988
|
+
const enabled = byAddon.get(i.addonId)?.get(i.id);
|
|
989
|
+
return enabled === undefined ? i : { ...i, enabled };
|
|
990
|
+
});
|
|
991
|
+
}
|
|
963
992
|
function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
964
993
|
const logger = loggingService.createLogger('integrations');
|
|
965
994
|
const withProcessState = (i) => ({
|
|
@@ -973,15 +1002,23 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
973
1002
|
for (const addonId of new Set(integrations.map((i) => i.addonId))) {
|
|
974
1003
|
hidden.set(addonId, await hidesFromIntegrations(ar, addonId));
|
|
975
1004
|
}
|
|
976
|
-
|
|
1005
|
+
const visible = integrations.filter((i) => hidden.get(i.addonId) !== true);
|
|
1006
|
+
return (await projectSwitches(ar, logger, visible)).map(withProcessState);
|
|
977
1007
|
},
|
|
978
1008
|
get: async (input) => {
|
|
979
1009
|
const integration = await requireIntegrationRegistry(ar).getIntegration(input.id);
|
|
980
1010
|
if (!integration)
|
|
981
1011
|
throw new Error(`Integration "${input.id}" not found`);
|
|
982
|
-
|
|
1012
|
+
const [projected] = await projectSwitches(ar, logger, [integration]);
|
|
1013
|
+
return withProcessState(projected ?? integration);
|
|
1014
|
+
},
|
|
1015
|
+
getByAddonId: async (input) => {
|
|
1016
|
+
const integration = await requireIntegrationRegistry(ar).getIntegrationByAddonId(input.addonId);
|
|
1017
|
+
if (!integration)
|
|
1018
|
+
return integration;
|
|
1019
|
+
const [projected] = await projectSwitches(ar, logger, [integration]);
|
|
1020
|
+
return projected ?? integration;
|
|
983
1021
|
},
|
|
984
|
-
getByAddonId: async (input) => requireIntegrationRegistry(ar).getIntegrationByAddonId(input.addonId),
|
|
985
1022
|
create: async (input) => {
|
|
986
1023
|
const { settings, ...rest } = input;
|
|
987
1024
|
const payload = rest;
|
|
@@ -1118,6 +1155,9 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1118
1155
|
});
|
|
1119
1156
|
throw new Error(`Integration "${input.id}" not found`);
|
|
1120
1157
|
}
|
|
1158
|
+
if (input.enabled !== undefined && previous.info['fixed'] !== true) {
|
|
1159
|
+
throw new Error(`Integration "${input.id}" is switched through integration-instances.setInstanceEnabled, not integrations.update`);
|
|
1160
|
+
}
|
|
1121
1161
|
const { id, ...updates } = input;
|
|
1122
1162
|
const changedFields = Object.keys(updates).filter((k) => updates[k] !== undefined);
|
|
1123
1163
|
logger.info('request', {
|
|
@@ -1139,10 +1179,7 @@ function buildIntegrationsProvider(ar, eb, loggingService, capabilityRegistry) {
|
|
|
1139
1179
|
timestamp: new Date(),
|
|
1140
1180
|
source: { type: 'integration', id: result.id },
|
|
1141
1181
|
category,
|
|
1142
|
-
data: {
|
|
1143
|
-
integrationId: result.id,
|
|
1144
|
-
addonId: result.addonId,
|
|
1145
|
-
},
|
|
1182
|
+
data: { integrationId: result.id, addonId: result.addonId },
|
|
1146
1183
|
});
|
|
1147
1184
|
}
|
|
1148
1185
|
if (input.name !== undefined && input.name !== previous.name) {
|
|
@@ -8326,15 +8326,6 @@ function createCapRouter_petFountain(getProvider, createRemoteProxy) {
|
|
|
8326
8326
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
8327
8327
|
return p.setPump(methodInput);
|
|
8328
8328
|
}),
|
|
8329
|
-
resetDailyConsumption: trpc_middleware_js_1.protectedProcedure
|
|
8330
|
-
.input(types_112.petFountainCapability.methods.resetDailyConsumption.input.loose())
|
|
8331
|
-
.output(types_112.petFountainCapability.methods.resetDailyConsumption.output)
|
|
8332
|
-
.mutation(async ({ input, ctx }) => {
|
|
8333
|
-
const { nodeId, ...methodInput } = input;
|
|
8334
|
-
const p = resolveProvider('pet-fountain', nodeId, () => getProvider(ctx), createRemoteProxy);
|
|
8335
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
|
|
8336
|
-
return p.resetDailyConsumption(methodInput);
|
|
8337
|
-
}),
|
|
8338
8329
|
});
|
|
8339
8330
|
}
|
|
8340
8331
|
function createCapRouter_pipelineAnalytics(getProvider, createRemoteProxy) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.786",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,13 +66,38 @@
|
|
|
66
66
|
],
|
|
67
67
|
"requires": {
|
|
68
68
|
"addons": {
|
|
69
|
-
"@camstack/addon-admin-ui": ">=1.2.
|
|
70
|
-
"@camstack/addon-agent-ui": ">=1.2.
|
|
71
|
-
"@camstack/addon-
|
|
72
|
-
"@camstack/addon-
|
|
73
|
-
"@camstack/addon-
|
|
74
|
-
"@camstack/addon-
|
|
75
|
-
"@camstack/addon-
|
|
69
|
+
"@camstack/addon-admin-ui": ">=1.2.599",
|
|
70
|
+
"@camstack/addon-agent-ui": ">=1.2.334",
|
|
71
|
+
"@camstack/addon-export-alexa": ">=1.2.185",
|
|
72
|
+
"@camstack/addon-export-google": ">=0.1.128",
|
|
73
|
+
"@camstack/addon-import-alexa": ">=0.2.192",
|
|
74
|
+
"@camstack/addon-matter-broker": ">=0.2.161",
|
|
75
|
+
"@camstack/addon-mqtt-broker": ">=1.2.153",
|
|
76
|
+
"@camstack/addon-post-analysis": ">=1.2.674",
|
|
77
|
+
"@camstack/addon-provider-amcrest": ">=0.2.168",
|
|
78
|
+
"@camstack/addon-provider-bosch": ">=0.1.40",
|
|
79
|
+
"@camstack/addon-provider-dreame": ">=0.2.167",
|
|
80
|
+
"@camstack/addon-provider-dreo": ">=0.2.159",
|
|
81
|
+
"@camstack/addon-provider-ecowitt": ">=0.2.158",
|
|
82
|
+
"@camstack/addon-provider-enpal": ">=0.1.12",
|
|
83
|
+
"@camstack/addon-provider-esphome": ">=0.1.15",
|
|
84
|
+
"@camstack/addon-provider-gree": ">=0.2.154",
|
|
85
|
+
"@camstack/addon-provider-hikvision": ">=1.2.184",
|
|
86
|
+
"@camstack/addon-provider-homeassistant": ">=1.2.667",
|
|
87
|
+
"@camstack/addon-provider-homematic": ">=1.2.184",
|
|
88
|
+
"@camstack/addon-provider-mqtt-ha": ">=0.1.41",
|
|
89
|
+
"@camstack/addon-provider-onvif": ">=1.2.156",
|
|
90
|
+
"@camstack/addon-provider-petkit": ">=0.2.162",
|
|
91
|
+
"@camstack/addon-provider-rademacher": ">=0.2.161",
|
|
92
|
+
"@camstack/addon-provider-reolink": ">=1.2.231",
|
|
93
|
+
"@camstack/addon-provider-rtsp": ">=1.2.153",
|
|
94
|
+
"@camstack/addon-provider-tuya": ">=0.2.153",
|
|
95
|
+
"@camstack/addon-provider-unifi": ">=0.2.159",
|
|
96
|
+
"@camstack/addon-provider-unraid": ">=0.2.160",
|
|
97
|
+
"@camstack/addon-provider-velux": ">=0.2.161",
|
|
98
|
+
"@camstack/addon-provider-vesync": ">=0.2.152",
|
|
99
|
+
"@camstack/addon-provider-wyze": ">=0.2.166",
|
|
100
|
+
"@camstack/addon-smtp-nodemailer": ">=1.2.150"
|
|
76
101
|
},
|
|
77
102
|
"wrapper": {
|
|
78
103
|
"desktop": ">=0.0.1",
|
|
@@ -81,19 +106,19 @@
|
|
|
81
106
|
}
|
|
82
107
|
},
|
|
83
108
|
"dependencies": {
|
|
84
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
85
|
-
"@camstack/addon-agent-ui": "1.2.
|
|
109
|
+
"@camstack/addon-admin-ui": "1.2.599",
|
|
110
|
+
"@camstack/addon-agent-ui": "1.2.334",
|
|
86
111
|
"@camstack/addon-auth": "1.2.176",
|
|
87
112
|
"@camstack/addon-benchmark": "1.2.311",
|
|
88
113
|
"@camstack/addon-decoder-nodeav": "1.2.146",
|
|
89
114
|
"@camstack/addon-notifiers": "1.2.630",
|
|
90
115
|
"@camstack/addon-pipeline": "1.2.642",
|
|
91
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
92
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
93
|
-
"@camstack/develop": "0.1.
|
|
116
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.663",
|
|
117
|
+
"@camstack/addon-post-analysis": "1.2.674",
|
|
118
|
+
"@camstack/develop": "0.1.47",
|
|
94
119
|
"@camstack/sdk": "1.2.155",
|
|
95
|
-
"@camstack/types": "1.2.
|
|
96
|
-
"@camstack/ui-library": "1.2.
|
|
120
|
+
"@camstack/types": "1.2.512",
|
|
121
|
+
"@camstack/ui-library": "1.2.392",
|
|
97
122
|
"@fastify/compress": "^9.0.0",
|
|
98
123
|
"@fastify/cookie": "^11.0.2",
|
|
99
124
|
"@fastify/cors": "^11.2.0",
|
|
@@ -5237,7 +5237,10 @@ var LocalChildClient = class {
|
|
|
5237
5237
|
...Object.keys(hints).length > 0 ? { hints } : {},
|
|
5238
5238
|
...routing
|
|
5239
5239
|
};
|
|
5240
|
-
const reply = await this.channel.request(msg, {
|
|
5240
|
+
const reply = await this.channel.request(msg, {
|
|
5241
|
+
payload: packPayload(input.args),
|
|
5242
|
+
...this.outboundBound(input)
|
|
5243
|
+
});
|
|
5241
5244
|
return reply instanceof PayloadReply ? unpackPayload(reply.payload) : reply;
|
|
5242
5245
|
}
|
|
5243
5246
|
const msg = {
|
|
@@ -5247,7 +5250,12 @@ var LocalChildClient = class {
|
|
|
5247
5250
|
args: input.args,
|
|
5248
5251
|
...routing
|
|
5249
5252
|
};
|
|
5250
|
-
return this.channel.request(msg);
|
|
5253
|
+
return this.channel.request(msg, this.outboundBound(input));
|
|
5254
|
+
}
|
|
5255
|
+
/** The method's declared `timeoutMs`, as per-request options (none ⇒ the channel default). */
|
|
5256
|
+
outboundBound(input) {
|
|
5257
|
+
const declared = (this.options.capTimeoutMs ?? ((capName, method) => _camstack_types_addon.CAP_METHOD_TIMEOUTS_MS[capName]?.[method]))(input.capName, input.method);
|
|
5258
|
+
return typeof declared === "number" ? { timeoutMs: declared } : {};
|
|
5251
5259
|
}
|
|
5252
5260
|
/** Disconnect from the parent. Safe to call before `start()` (no-op) and idempotent. */
|
|
5253
5261
|
async close() {
|
|
@@ -5612,6 +5620,7 @@ function toIntegration(row) {
|
|
|
5612
5620
|
addonId: row.addonId,
|
|
5613
5621
|
name: row.name,
|
|
5614
5622
|
info: { ...row.info },
|
|
5623
|
+
...row.enabled === void 0 ? {} : { enabled: row.enabled },
|
|
5615
5624
|
...row.originStableId === void 0 ? {} : { originStableId: row.originStableId }
|
|
5616
5625
|
};
|
|
5617
5626
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { register } from "node:module";
|
|
2
|
-
import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, COLLECTION_ARRAY_METHODS, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry, ReadinessTimeoutError, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDebugEmitter, createDeviceProxy, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, describeCustomActions, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, findMigrationsBlocked, isCollectionArrayMethodName, isProviderOptionalMethodName, maskUrlCredentials, nodeIdOfScopedKey, normalizeAddonInitResult, readErrorI18n, readNodePin, resolveDeviceSettings, resolveSecretViewsIn, scopeKey, scrubKnownSecrets, withCapInputDefaults } from "@camstack/types/addon";
|
|
2
|
+
import { BOOT_RECOVERY_BACKOFF_MS, CALLER_STAMPED_CAPABILITIES, CAP_METHOD_TIMEOUTS_MS, COLLECTION_ARRAY_METHODS, DATAPLANE_SECRET_HEADER, DEVICE_CHILDREN_BATCH_MAX, DeviceType, DisposerChain, ErrorI18nPayloadSchema, EventCategory, MIGRATION_API_VERSION, PEER_BYTES_CHUNK_BYTES, PEER_BYTES_MAX_OUTSTANDING, PEER_BYTES_STALL_MS, PEER_BYTES_TICKET_TTL_MS, ReadinessRegistry, ReadinessTimeoutError, addonSliceHandleApi, asJsonObject, asString, collectZodSecretPaths, createDebugEmitter, createDeviceProxy, createEventBusSliceSource, createRecordsAccess, createSecretsAccess, describeCustomActions, deviceOpsCapability, emitReadiness, errMsg, expandCapMethods, findMigrationsBlocked, isCollectionArrayMethodName, isProviderOptionalMethodName, maskUrlCredentials, nodeIdOfScopedKey, normalizeAddonInitResult, readErrorI18n, readNodePin, resolveDeviceSettings, resolveSecretViewsIn, scopeKey, scrubKnownSecrets, withCapInputDefaults } from "@camstack/types/addon";
|
|
3
3
|
import * as fs$1 from "node:fs";
|
|
4
4
|
import fs, { createReadStream, createWriteStream, existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
5
|
import * as path from "node:path";
|
|
@@ -5182,7 +5182,10 @@ var LocalChildClient = class {
|
|
|
5182
5182
|
...Object.keys(hints).length > 0 ? { hints } : {},
|
|
5183
5183
|
...routing
|
|
5184
5184
|
};
|
|
5185
|
-
const reply = await this.channel.request(msg, {
|
|
5185
|
+
const reply = await this.channel.request(msg, {
|
|
5186
|
+
payload: packPayload(input.args),
|
|
5187
|
+
...this.outboundBound(input)
|
|
5188
|
+
});
|
|
5186
5189
|
return reply instanceof PayloadReply ? unpackPayload(reply.payload) : reply;
|
|
5187
5190
|
}
|
|
5188
5191
|
const msg = {
|
|
@@ -5192,7 +5195,12 @@ var LocalChildClient = class {
|
|
|
5192
5195
|
args: input.args,
|
|
5193
5196
|
...routing
|
|
5194
5197
|
};
|
|
5195
|
-
return this.channel.request(msg);
|
|
5198
|
+
return this.channel.request(msg, this.outboundBound(input));
|
|
5199
|
+
}
|
|
5200
|
+
/** The method's declared `timeoutMs`, as per-request options (none ⇒ the channel default). */
|
|
5201
|
+
outboundBound(input) {
|
|
5202
|
+
const declared = (this.options.capTimeoutMs ?? ((capName, method) => CAP_METHOD_TIMEOUTS_MS[capName]?.[method]))(input.capName, input.method);
|
|
5203
|
+
return typeof declared === "number" ? { timeoutMs: declared } : {};
|
|
5196
5204
|
}
|
|
5197
5205
|
/** Disconnect from the parent. Safe to call before `start()` (no-op) and idempotent. */
|
|
5198
5206
|
async close() {
|
|
@@ -5557,6 +5565,7 @@ function toIntegration(row) {
|
|
|
5557
5565
|
addonId: row.addonId,
|
|
5558
5566
|
name: row.name,
|
|
5559
5567
|
info: { ...row.info },
|
|
5568
|
+
...row.enabled === void 0 ? {} : { enabled: row.enabled },
|
|
5560
5569
|
...row.originStableId === void 0 ? {} : { originStableId: row.originStableId }
|
|
5561
5570
|
};
|
|
5562
5571
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ns as defineRecordKinds } from "./dist-D-iGSnX_.mjs";
|
|
2
2
|
import { C as backdatedNotBefore, S as withUtcTimeEncoding, _ as NameConstraints, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, g as GeneralSubtrees, h as GeneralSubtree, i as Extension, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension, v as GeneralName, x as AsnConvert } from "./x509.es-BRiJgOvu.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { X509Certificate, createHash, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-h3Yla8gE.js");
|
|
3
3
|
const require_x509_es = require("./x509.es-WtnRNyYS.js");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Lo as BaseAddon, Tc as errMsg, mn as addonPagesCapability } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Lo as BaseAddon, Tc as errMsg, gn as addonWidgetsCapability } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory$1, Lo as BaseAddon, Ns as defineRecordKinds, Os as createEvent$1, Tc as errMsg$1, Ur as isAlertEpisodeOpen, Wr as isAlertEpisodeSeverity, _n as alertEpisodeId, f as AlertSchema, vn as alertEpisodePayload, w as CORE_BLOCK_ADDON_PREFIX, yn as alertsCapability } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
3
|
import * as fs$1 from "node:fs";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
8
8
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
9
9
|
deadZoneFraction: .5,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Lo as BaseAddon, Tc as errMsg, Ws as isEvent, Xi as ptzAutotrackCapability, rt as FIRST_LEVEL_MACRO_CLASSES, wn as bareAddonId } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
3
3
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
4
4
|
deadZoneFraction: .5,
|
|
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
8
|
-
const require_restore_archive = require("../../restore-archive-
|
|
8
|
+
const require_restore_archive = require("../../restore-archive-CkAD_-E9.js");
|
|
9
9
|
let node_crypto = require("node:crypto");
|
|
10
10
|
let node_fs = require("node:fs");
|
|
11
11
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Cn as backupCapability, Ec as EventCategory, Lo as BaseAddon, Pa as storageOccupancyCapability, _c as toNodeId, gi as mayWriteToLocation, nc as nodePin } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
|
-
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-
|
|
3
|
+
import { _ as backupRecordStoresOf, a as BackupSnapshotRefusedError, d as ENCRYPTED_BACKUP_SUFFIX, f as generateBackupKeyPair, g as backupOrchestratorRecordKinds, i as BackupCancelledError, l as BackupKeyFormatError, m as parseBackupSecretKey, n as precheckRestoreKey, o as DEFAULT_BACKUP_DATABASES, p as parseBackupPublicKey, r as prepareRestoreArchive, s as SystemBackupService } from "../../restore-archive-DQWz5Wp-.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import * as fs$1 from "node:fs";
|
|
6
6
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let zod = require("zod");
|
|
9
9
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as CalendarPreferencesSchema, Lo as BaseAddon, Mn as calendarsCapability, Ns as defineRecordKinds } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/builtins/calendars/calendar-color.ts
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let _camstack_types_node = require("@camstack/types/node");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ec as EventCategory, Ia as streamCatalogCapability, J as DeclaredDevices, Lo as BaseAddon, Nn as cameraGridLayoutCapability, Os as createEvent, Sc as DeviceFeature, Tc as errMsg, Tt as MOTION_CLOSE_AFTER_MS, Vs as hydrateSchema, ar as declarationOwnerNodeId, fo as buildFfmpegArgs, h as BaseDevice, ka as snapshotCapability, wc as DeviceType, wi as motionCapability, wn as bareAddonId, yi as memoizePinnedFfmpeg, z as DERIVED_CAMERA_SILENCED_CAP_NAMES } from "../../dist-D-iGSnX_.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { FfmpegProcess } from "@camstack/types/node";
|
|
4
4
|
import { promises } from "node:fs";
|
|
@@ -11,6 +11,10 @@ export interface ComposedDeviceHandle extends ComposedWriteTarget {
|
|
|
11
11
|
export declare class ComposedDevice extends BaseDevice<typeof COMPOSED_DEVICE_CONFIG_SCHEMA> implements ComposedDeviceHandle {
|
|
12
12
|
private sharedFeatures;
|
|
13
13
|
private extraCaps;
|
|
14
|
+
/** Whether this device's tank is also a `water` consumable (derived, never bound). */
|
|
15
|
+
private readonly derivesWater;
|
|
16
|
+
/** The `consumables` items the composition last wrote — the derived water item is added to these. */
|
|
17
|
+
private composedItems;
|
|
14
18
|
get features(): readonly DeviceFeature[];
|
|
15
19
|
constructor(ctx: DeviceContext, type: DeviceType, caps: readonly CapabilityDefinition[]);
|
|
16
20
|
/**
|
|
@@ -39,6 +43,18 @@ export declare class ComposedDevice extends BaseDevice<typeof COMPOSED_DEVICE_CO
|
|
|
39
43
|
private dispatch;
|
|
40
44
|
seed(capName: string, slice: SlicePatch): WriteOutcome;
|
|
41
45
|
patch(capName: string, patch: SlicePatch): WriteOutcome;
|
|
46
|
+
private writeSlice;
|
|
47
|
+
private writeCap;
|
|
48
|
+
/**
|
|
49
|
+
* The ONE place a fountain's tank becomes a consumable: the composition's own
|
|
50
|
+
* `consumables` items plus a `water` item derived from the `pet-fountain` slice
|
|
51
|
+
* (`petFountainWaterItem`). A composition that names its own `water` item keeps it.
|
|
52
|
+
*/
|
|
53
|
+
private withWater;
|
|
54
|
+
private fountainTank;
|
|
55
|
+
private itemsWithWater;
|
|
56
|
+
/** The fountain slice moved: re-publish the consumables with the new water item. */
|
|
57
|
+
private refreshWater;
|
|
42
58
|
setAvailable(available: boolean): void;
|
|
43
59
|
/** The chart unit of a statistic or a meter is the source reading's quantity (D944). */
|
|
44
60
|
adoptQuantity(quantity: ReadingQuantity): Promise<void>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_composition_sources = require("../../composition-sources-
|
|
8
|
-
const require_capture_engine = require("../../capture-engine-
|
|
6
|
+
const require_dist = require("../../dist-h3Yla8gE.js");
|
|
7
|
+
const require_composition_sources = require("../../composition-sources-B6GYTy_7.js");
|
|
8
|
+
const require_capture_engine = require("../../capture-engine-NZ11ORZS.js");
|
|
9
9
|
const require_retention = require("../../retention-BNONb5X_.js");
|
|
10
10
|
let zod = require("zod");
|
|
11
11
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
@@ -127,6 +127,12 @@ var GROUP_COMMAND_TYPES = new Set([
|
|
|
127
127
|
function present(args) {
|
|
128
128
|
return Object.fromEntries(Object.entries(args).filter(([, value]) => value !== void 0));
|
|
129
129
|
}
|
|
130
|
+
/** What the derived water item reads from the `pet-fountain` slice, and the clock it is stamped with. */
|
|
131
|
+
var TANK_READING = require_dist.PetFountainStatusSchema.pick({
|
|
132
|
+
waterLevel: true,
|
|
133
|
+
empty: true,
|
|
134
|
+
lastFetchedAt: true
|
|
135
|
+
});
|
|
130
136
|
var COMPOSED_DEVICE_CONFIG_SCHEMA = zod.z.object({});
|
|
131
137
|
/** What a command carries: the caller's input without `deviceId` (the composed device is the dispatch key). */
|
|
132
138
|
function commandInput(input) {
|
|
@@ -154,11 +160,16 @@ function sliceBoolean(slice, field) {
|
|
|
154
160
|
var ComposedDevice = class extends require_dist.BaseDevice {
|
|
155
161
|
sharedFeatures = [];
|
|
156
162
|
extraCaps = /* @__PURE__ */ new Set();
|
|
163
|
+
/** Whether this device's tank is also a `water` consumable (derived, never bound). */
|
|
164
|
+
derivesWater;
|
|
165
|
+
/** The `consumables` items the composition last wrote — the derived water item is added to these. */
|
|
166
|
+
composedItems = [];
|
|
157
167
|
get features() {
|
|
158
168
|
return this.sharedFeatures;
|
|
159
169
|
}
|
|
160
170
|
constructor(ctx, type, caps) {
|
|
161
171
|
super(ctx, COMPOSED_DEVICE_CONFIG_SCHEMA, { type });
|
|
172
|
+
this.derivesWater = type === require_dist.DeviceType.PetFountain;
|
|
162
173
|
for (const cap of caps) {
|
|
163
174
|
if (cap.name === require_dist.motionCapability.name) {
|
|
164
175
|
const read = () => this.runtimeState.getCapState(require_dist.motionCapability.name);
|
|
@@ -174,6 +185,7 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
174
185
|
ctx.registerNativeCap(cap, this.commandProvider(cap));
|
|
175
186
|
}
|
|
176
187
|
if (GROUP_COMMAND_TYPES.has(type)) ctx.registerNativeCap(require_dist.groupCommandsCapability, {});
|
|
188
|
+
if (this.derivesWater && !caps.some((cap) => cap.name === require_dist.consumablesCapability.name)) ctx.registerNativeCap(require_dist.consumablesCapability, { reset: (input) => this.dispatch("consumables", "reset", commandInput(input)) });
|
|
177
189
|
this.markOnline(false);
|
|
178
190
|
}
|
|
179
191
|
/**
|
|
@@ -340,19 +352,20 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
340
352
|
});
|
|
341
353
|
}
|
|
342
354
|
seed(capName, slice) {
|
|
343
|
-
|
|
344
|
-
this.runtimeState.setCapState(capName, { ...slice });
|
|
345
|
-
return { ok: true };
|
|
346
|
-
} catch (err) {
|
|
347
|
-
return {
|
|
348
|
-
ok: false,
|
|
349
|
-
error: require_dist.errMsg(err)
|
|
350
|
-
};
|
|
351
|
-
}
|
|
355
|
+
return this.writeSlice("seed", capName, slice);
|
|
352
356
|
}
|
|
353
357
|
patch(capName, patch) {
|
|
358
|
+
return this.writeSlice("patch", capName, patch);
|
|
359
|
+
}
|
|
360
|
+
writeSlice(op, capName, slice) {
|
|
361
|
+
const own = this.writeCap(op, capName, this.derivesWater ? this.withWater(capName, slice) : slice);
|
|
362
|
+
if (!own.ok || !this.derivesWater || capName !== require_dist.petFountainCapability.name) return own;
|
|
363
|
+
return this.refreshWater();
|
|
364
|
+
}
|
|
365
|
+
writeCap(op, capName, slice) {
|
|
354
366
|
try {
|
|
355
|
-
this.runtimeState.
|
|
367
|
+
if (op === "seed") this.runtimeState.setCapState(capName, { ...slice });
|
|
368
|
+
else this.runtimeState.patchCapState(capName, { ...slice });
|
|
356
369
|
return { ok: true };
|
|
357
370
|
} catch (err) {
|
|
358
371
|
return {
|
|
@@ -361,6 +374,42 @@ var ComposedDevice = class extends require_dist.BaseDevice {
|
|
|
361
374
|
};
|
|
362
375
|
}
|
|
363
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* The ONE place a fountain's tank becomes a consumable: the composition's own
|
|
379
|
+
* `consumables` items plus a `water` item derived from the `pet-fountain` slice
|
|
380
|
+
* (`petFountainWaterItem`). A composition that names its own `water` item keeps it.
|
|
381
|
+
*/
|
|
382
|
+
withWater(capName, slice) {
|
|
383
|
+
if (capName !== require_dist.consumablesCapability.name) return slice;
|
|
384
|
+
const parsed = require_dist.ConsumableItemSchema.array().safeParse(slice["items"]);
|
|
385
|
+
if (parsed.success) this.composedItems = parsed.data;
|
|
386
|
+
return {
|
|
387
|
+
...slice,
|
|
388
|
+
items: this.itemsWithWater()
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
fountainTank() {
|
|
392
|
+
const tank = TANK_READING.safeParse(this.runtimeState.getCapState(require_dist.petFountainCapability.name));
|
|
393
|
+
return tank.success ? tank.data : null;
|
|
394
|
+
}
|
|
395
|
+
itemsWithWater() {
|
|
396
|
+
const tank = this.fountainTank();
|
|
397
|
+
if (tank === null || this.composedItems.some((item) => item.key === "water")) return this.composedItems;
|
|
398
|
+
return [...this.composedItems, require_dist.petFountainWaterItem(tank)];
|
|
399
|
+
}
|
|
400
|
+
/** The fountain slice moved: re-publish the consumables with the new water item. */
|
|
401
|
+
refreshWater() {
|
|
402
|
+
const tank = this.fountainTank();
|
|
403
|
+
if (tank === null) return { ok: true };
|
|
404
|
+
const known = this.runtimeState.getCapState(require_dist.consumablesCapability.name);
|
|
405
|
+
const items = this.itemsWithWater();
|
|
406
|
+
if (known !== void 0 && JSON.stringify(known["items"]) === JSON.stringify(items)) return { ok: true };
|
|
407
|
+
return this.writeCap(known === void 0 ? "seed" : "patch", require_dist.consumablesCapability.name, {
|
|
408
|
+
items,
|
|
409
|
+
lastChangedAt: tank.lastFetchedAt,
|
|
410
|
+
lastFetchedAt: tank.lastFetchedAt
|
|
411
|
+
});
|
|
412
|
+
}
|
|
364
413
|
setAvailable(available) {
|
|
365
414
|
this.markOnline(available);
|
|
366
415
|
}
|
|
@@ -2208,12 +2257,12 @@ function ownKeyOf(host, read) {
|
|
|
2208
2257
|
* the record count: the validator refuses a cycle, so a chain is at most that
|
|
2209
2258
|
* long (D6).
|
|
2210
2259
|
*/
|
|
2211
|
-
function evaluateWithOwnReaders(host, keys, now) {
|
|
2260
|
+
function evaluateWithOwnReaders(host, keys, now, timerDriven = false) {
|
|
2212
2261
|
const changed = /* @__PURE__ */ new Set();
|
|
2213
2262
|
const valueCaps = /* @__PURE__ */ new Set();
|
|
2214
2263
|
let round = orderForEvaluation(keys, host.records());
|
|
2215
2264
|
for (let hop = 0; round.length > 0 && hop <= host.records().size; hop++) {
|
|
2216
|
-
const delta = evaluateFields(host, round, now);
|
|
2265
|
+
const delta = evaluateFields(host, round, now, timerDriven);
|
|
2217
2266
|
for (const k of delta.keys) changed.add(k);
|
|
2218
2267
|
for (const c of delta.valueCaps) valueCaps.add(c);
|
|
2219
2268
|
round = orderForEvaluation([...host.records().values()].filter((r) => (r.plan.role === "derived" || r.plan.role === "accumulator") && r.plan.reads.some((read) => {
|
|
@@ -2227,7 +2276,7 @@ function evaluateWithOwnReaders(host, keys, now) {
|
|
|
2227
2276
|
};
|
|
2228
2277
|
}
|
|
2229
2278
|
/** Evaluate `keys` in order against the records in progress; commit whatever was evaluated, even on a throw. */
|
|
2230
|
-
function evaluateFields(host, keys, now) {
|
|
2279
|
+
function evaluateFields(host, keys, now, timerDriven = false) {
|
|
2231
2280
|
const changed = /* @__PURE__ */ new Set();
|
|
2232
2281
|
const valueCaps = /* @__PURE__ */ new Set();
|
|
2233
2282
|
const next = new Map(host.records());
|
|
@@ -2250,7 +2299,8 @@ function evaluateFields(host, keys, now) {
|
|
|
2250
2299
|
currentOutput: currentOutput(record),
|
|
2251
2300
|
expressionMemory: candidateMemory,
|
|
2252
2301
|
startedAtMs: host.startedAtMs,
|
|
2253
|
-
callPathPrefix: fieldKey(record.plan)
|
|
2302
|
+
callPathPrefix: fieldKey(record.plan),
|
|
2303
|
+
...timerDriven ? { timerDriven: true } : {}
|
|
2254
2304
|
}
|
|
2255
2305
|
});
|
|
2256
2306
|
const expressionSucceeded = evaluatedOutcome.state !== "unavailable";
|
|
@@ -2715,7 +2765,7 @@ var CompositionRuntime = class {
|
|
|
2715
2765
|
const calculated = evaluateWithOwnReaders(this.evaluation, keys.filter((k) => {
|
|
2716
2766
|
const role = this.records.get(k)?.plan.role;
|
|
2717
2767
|
return role === "derived" || role === "accumulator";
|
|
2718
|
-
}), now);
|
|
2768
|
+
}), now, trigger === "deadline");
|
|
2719
2769
|
const followers = [...this.records.values()].filter((r) => r.plan.role === "clock" ? initial || calculated.valueCaps.has(r.plan.cap) : r.plan.role === "constant" && initial).map((r) => fieldKey(r.plan));
|
|
2720
2770
|
const extra = evaluateFields(this.evaluation, followers, now);
|
|
2721
2771
|
const evaluatedCaps = new Set([...keys, ...followers].flatMap((k) => {
|