@camstack/server 1.2.791 → 1.2.792
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 +6 -0
- package/package.json +14 -13
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/local-network/address-book.d.ts +2 -0
- package/system/dist/builtins/local-network/local-network.addon.d.ts +7 -0
- package/system/dist/builtins/local-network/local-network.addon.js +25 -7
- package/system/dist/builtins/local-network/local-network.addon.mjs +25 -7
- package/system/dist/builtins/loki-logging/index.js +52 -82
- package/system/dist/builtins/loki-logging/index.mjs +52 -82
- package/system/dist/builtins/loki-logging/loki-logging.addon.d.ts +1 -4
- package/system/dist/builtins/loki-logging/migrations/index.d.ts +4 -1
- package/system/dist/builtins/loki-logging/migrations/retired-enabled-flag.d.ts +22 -0
- package/system/dist/builtins/system-config/system-config.addon.mjs +281 -281
- package/system/dist/index.mjs +1 -1
- package/system/dist/{restore-archive-Dh3XnCR1.mjs → restore-archive-DWS1l6ac.mjs} +81 -81
- package/system/package.json +1 -1
- package/system/dist/builtins/loki-logging/retire-enabled-flag.d.ts +0 -33
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.792] - 2026-11-07
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Loki logging retires its old enabled flag through a one-time ledger migration; local-network keeps its allowlist and address book through durable state handles.
|
|
15
|
+
|
|
10
16
|
## [1.2.791] - 2026-11-07
|
|
11
17
|
|
|
12
18
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.792",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -66,14 +66,15 @@
|
|
|
66
66
|
],
|
|
67
67
|
"requires": {
|
|
68
68
|
"addons": {
|
|
69
|
-
"@camstack/addon-admin-ui": ">=1.2.
|
|
70
|
-
"@camstack/addon-
|
|
71
|
-
"@camstack/addon-
|
|
72
|
-
"@camstack/addon-
|
|
73
|
-
"@camstack/addon-
|
|
74
|
-
"@camstack/addon-
|
|
75
|
-
"@camstack/addon-
|
|
76
|
-
"@camstack/addon-
|
|
69
|
+
"@camstack/addon-admin-ui": ">=1.2.604",
|
|
70
|
+
"@camstack/addon-cloudflare": ">=1.2.159",
|
|
71
|
+
"@camstack/addon-model-studio": ">=1.1.344",
|
|
72
|
+
"@camstack/addon-pipeline": ">=1.2.646",
|
|
73
|
+
"@camstack/addon-pipeline-orchestrator": ">=1.2.665",
|
|
74
|
+
"@camstack/addon-post-analysis": ">=1.2.679",
|
|
75
|
+
"@camstack/addon-tailscale": ">=1.2.154",
|
|
76
|
+
"@camstack/addon-training": ">=0.1.134",
|
|
77
|
+
"@camstack/addon-waste-collections": ">=0.1.38"
|
|
77
78
|
},
|
|
78
79
|
"wrapper": {
|
|
79
80
|
"desktop": ">=0.0.1",
|
|
@@ -82,15 +83,15 @@
|
|
|
82
83
|
}
|
|
83
84
|
},
|
|
84
85
|
"dependencies": {
|
|
85
|
-
"@camstack/addon-admin-ui": "1.2.
|
|
86
|
+
"@camstack/addon-admin-ui": "1.2.604",
|
|
86
87
|
"@camstack/addon-agent-ui": "1.2.338",
|
|
87
88
|
"@camstack/addon-auth": "1.2.178",
|
|
88
89
|
"@camstack/addon-benchmark": "1.2.312",
|
|
89
90
|
"@camstack/addon-decoder-nodeav": "1.2.148",
|
|
90
91
|
"@camstack/addon-notifiers": "1.2.633",
|
|
91
|
-
"@camstack/addon-pipeline": "1.2.
|
|
92
|
-
"@camstack/addon-pipeline-orchestrator": "1.2.
|
|
93
|
-
"@camstack/addon-post-analysis": "1.2.
|
|
92
|
+
"@camstack/addon-pipeline": "1.2.646",
|
|
93
|
+
"@camstack/addon-pipeline-orchestrator": "1.2.665",
|
|
94
|
+
"@camstack/addon-post-analysis": "1.2.679",
|
|
94
95
|
"@camstack/develop": "0.1.48",
|
|
95
96
|
"@camstack/sdk": "1.2.156",
|
|
96
97
|
"@camstack/types": "1.2.516",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bo as BaseAddon, Ia as storageOccupancyCapability, _i as mayWriteToLocation, ac as nodePin, bc as toNodeId, kc as EventCategory, wn as backupCapability } from "../../dist-CPUbgRkb.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-DWS1l6ac.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";
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
* the result — so the address shows as a custom row instead of vanishing.
|
|
25
25
|
*/
|
|
26
26
|
import { type ConnectionEndpoint, type HubAddressBook, type HubAddressFlags, type HubAddressRole } from "@camstack/types";
|
|
27
|
+
import { z } from "zod";
|
|
27
28
|
export interface CustomAddress {
|
|
28
29
|
readonly baseUrl: string;
|
|
29
30
|
readonly label: string;
|
|
30
31
|
}
|
|
32
|
+
export declare const CustomAddressListSchema: z.ZodType<readonly CustomAddress[]>;
|
|
31
33
|
/** The address-book keys of the addon's stored settings. */
|
|
32
34
|
export interface StoredAddressSettings {
|
|
33
35
|
readonly customAddresses: unknown;
|
|
@@ -114,6 +114,13 @@ export declare class LocalNetworkAddon extends BaseAddon<LocalNetworkConfig> {
|
|
|
114
114
|
/** `getAddresses`: the Addresses table and every role's answer. */
|
|
115
115
|
private addressBook;
|
|
116
116
|
/**
|
|
117
|
+
* Persist the keys this addon keeps for itself (the allowlist, the first-boot flag, the saved
|
|
118
|
+
* subnets, the address book): bare keys of the addon store, none of them a declared setting, so
|
|
119
|
+
* each goes through its own durable handle. The config is read again so the next read sees it,
|
|
120
|
+
* and the mDNS advert is re-synced.
|
|
121
|
+
*/
|
|
122
|
+
private saveStored;
|
|
123
|
+
/**
|
|
117
124
|
* Apply one change to the address book and persist it, normalised (a flag
|
|
118
125
|
* naming an address in no row becomes a custom address in the same write).
|
|
119
126
|
*/
|
|
@@ -1619,6 +1619,7 @@ var nodeScanIo = {
|
|
|
1619
1619
|
* via `NetworkTunnelStarted/Stopped` events on the bus, so the cap
|
|
1620
1620
|
* stays free of cross-addon dependencies.
|
|
1621
1621
|
*/
|
|
1622
|
+
var StringListSchema = zod.z.array(zod.z.string());
|
|
1622
1623
|
/**
|
|
1623
1624
|
* Forked `mesh-network` provider addon ids `local-network` pull-reconciles
|
|
1624
1625
|
* against. `mesh-network` is a COLLECTION cap, so a hub builtin's local
|
|
@@ -1713,6 +1714,24 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
1713
1714
|
});
|
|
1714
1715
|
}
|
|
1715
1716
|
/**
|
|
1717
|
+
* Persist the keys this addon keeps for itself (the allowlist, the first-boot flag, the saved
|
|
1718
|
+
* subnets, the address book): bare keys of the addon store, none of them a declared setting, so
|
|
1719
|
+
* each goes through its own durable handle. The config is read again so the next read sees it,
|
|
1720
|
+
* and the mDNS advert is re-synced.
|
|
1721
|
+
*/
|
|
1722
|
+
async saveStored(patch) {
|
|
1723
|
+
if (patch.allowedAddresses !== void 0) await this.state("allowedAddresses", StringListSchema, []).set([...patch.allowedAddresses]);
|
|
1724
|
+
if (patch.bootSeeded !== void 0) await this.state("bootSeeded", zod.z.boolean(), false).set(patch.bootSeeded);
|
|
1725
|
+
if (patch.scanSubnets !== void 0) await this.state("scanSubnets", StringListSchema, []).set([...patch.scanSubnets]);
|
|
1726
|
+
if (patch.customAddresses !== void 0) await this.state("customAddresses", CustomAddressListSchema, []).set([...patch.customAddresses]);
|
|
1727
|
+
if (patch.appConnectionUrls !== void 0) await this.state("appConnectionUrls", StringListSchema, []).set([...patch.appConnectionUrls]);
|
|
1728
|
+
if (patch.notificationTapUrl !== void 0) await this.state("notificationTapUrl", zod.z.string(), "").set(patch.notificationTapUrl);
|
|
1729
|
+
if (patch.publicEndpointUrl !== void 0) await this.state("publicEndpointUrl", zod.z.string(), "").set(patch.publicEndpointUrl);
|
|
1730
|
+
if (patch.internalUrl !== void 0) await this.state("internalUrl", zod.z.string(), "").set(patch.internalUrl);
|
|
1731
|
+
await this.resolveConfig();
|
|
1732
|
+
await this.mdns?.sync();
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1716
1735
|
* Apply one change to the address book and persist it, normalised (a flag
|
|
1717
1736
|
* naming an address in no row becomes a custom address in the same write).
|
|
1718
1737
|
*/
|
|
@@ -1728,8 +1747,7 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
1728
1747
|
...addressBookPatch(changed),
|
|
1729
1748
|
customAddresses: changed.custom
|
|
1730
1749
|
}, detectedUrls);
|
|
1731
|
-
await this.
|
|
1732
|
-
await this.mdns?.sync();
|
|
1750
|
+
await this.saveStored(addressBookPatch(after));
|
|
1733
1751
|
}
|
|
1734
1752
|
/** The deprecated `getHubAddresses` shape, from the role resolvers. */
|
|
1735
1753
|
async snapshotHubAddresses() {
|
|
@@ -1839,7 +1857,7 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
1839
1857
|
await this.migrateNodeFields();
|
|
1840
1858
|
if (!this.config.bootSeeded) {
|
|
1841
1859
|
const seed = autoSeedAllowlist(this.enumerate());
|
|
1842
|
-
await this.
|
|
1860
|
+
await this.saveStored({
|
|
1843
1861
|
allowedAddresses: seed,
|
|
1844
1862
|
bootSeeded: true
|
|
1845
1863
|
});
|
|
@@ -1916,7 +1934,7 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
1916
1934
|
getAllowedAddresses: async () => ({ addresses: this.config.allowedAddresses }),
|
|
1917
1935
|
resetAllowlistToBestMatch: async () => {
|
|
1918
1936
|
const seed = autoSeedAllowlist(this.enumerate());
|
|
1919
|
-
await this.
|
|
1937
|
+
await this.saveStored({
|
|
1920
1938
|
allowedAddresses: seed,
|
|
1921
1939
|
bootSeeded: true
|
|
1922
1940
|
});
|
|
@@ -1926,7 +1944,7 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
1926
1944
|
setAllowedAddresses: async ({ addresses }) => {
|
|
1927
1945
|
const known = new Set(this.enumerate().map((i) => i.address));
|
|
1928
1946
|
const cleaned = [...new Set(addresses)].filter((a) => known.has(a));
|
|
1929
|
-
await this.
|
|
1947
|
+
await this.saveStored({ allowedAddresses: cleaned });
|
|
1930
1948
|
this.ctx.logger.info("local-network: allowlist updated", { meta: {
|
|
1931
1949
|
count: cleaned.length,
|
|
1932
1950
|
dropped: addresses.length - cleaned.length
|
|
@@ -1942,7 +1960,7 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
1942
1960
|
getScanSubnets: async () => ({ subnets: [...this.config.scanSubnets] }),
|
|
1943
1961
|
setScanSubnets: async ({ subnets }) => {
|
|
1944
1962
|
const cleaned = [...validateSavedSubnets(subnets)];
|
|
1945
|
-
await this.
|
|
1963
|
+
await this.saveStored({ scanSubnets: cleaned });
|
|
1946
1964
|
this.ctx.logger.info("local-network: scan subnets updated", { meta: {
|
|
1947
1965
|
count: cleaned.length,
|
|
1948
1966
|
subnets: cleaned
|
|
@@ -2371,7 +2389,7 @@ var LocalNetworkAddon = class extends require_dist.BaseAddon {
|
|
|
2371
2389
|
try {
|
|
2372
2390
|
const next = reconcileAllowlist(this.config.allowedAddresses, interfaces);
|
|
2373
2391
|
if (sameAddressSet(this.config.allowedAddresses, next)) return;
|
|
2374
|
-
await this.
|
|
2392
|
+
await this.saveStored({
|
|
2375
2393
|
allowedAddresses: next,
|
|
2376
2394
|
bootSeeded: true
|
|
2377
2395
|
});
|
|
@@ -1614,6 +1614,7 @@ var nodeScanIo = {
|
|
|
1614
1614
|
* via `NetworkTunnelStarted/Stopped` events on the bus, so the cap
|
|
1615
1615
|
* stays free of cross-addon dependencies.
|
|
1616
1616
|
*/
|
|
1617
|
+
var StringListSchema = z.array(z.string());
|
|
1617
1618
|
/**
|
|
1618
1619
|
* Forked `mesh-network` provider addon ids `local-network` pull-reconciles
|
|
1619
1620
|
* against. `mesh-network` is a COLLECTION cap, so a hub builtin's local
|
|
@@ -1708,6 +1709,24 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
1708
1709
|
});
|
|
1709
1710
|
}
|
|
1710
1711
|
/**
|
|
1712
|
+
* Persist the keys this addon keeps for itself (the allowlist, the first-boot flag, the saved
|
|
1713
|
+
* subnets, the address book): bare keys of the addon store, none of them a declared setting, so
|
|
1714
|
+
* each goes through its own durable handle. The config is read again so the next read sees it,
|
|
1715
|
+
* and the mDNS advert is re-synced.
|
|
1716
|
+
*/
|
|
1717
|
+
async saveStored(patch) {
|
|
1718
|
+
if (patch.allowedAddresses !== void 0) await this.state("allowedAddresses", StringListSchema, []).set([...patch.allowedAddresses]);
|
|
1719
|
+
if (patch.bootSeeded !== void 0) await this.state("bootSeeded", z.boolean(), false).set(patch.bootSeeded);
|
|
1720
|
+
if (patch.scanSubnets !== void 0) await this.state("scanSubnets", StringListSchema, []).set([...patch.scanSubnets]);
|
|
1721
|
+
if (patch.customAddresses !== void 0) await this.state("customAddresses", CustomAddressListSchema, []).set([...patch.customAddresses]);
|
|
1722
|
+
if (patch.appConnectionUrls !== void 0) await this.state("appConnectionUrls", StringListSchema, []).set([...patch.appConnectionUrls]);
|
|
1723
|
+
if (patch.notificationTapUrl !== void 0) await this.state("notificationTapUrl", z.string(), "").set(patch.notificationTapUrl);
|
|
1724
|
+
if (patch.publicEndpointUrl !== void 0) await this.state("publicEndpointUrl", z.string(), "").set(patch.publicEndpointUrl);
|
|
1725
|
+
if (patch.internalUrl !== void 0) await this.state("internalUrl", z.string(), "").set(patch.internalUrl);
|
|
1726
|
+
await this.resolveConfig();
|
|
1727
|
+
await this.mdns?.sync();
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1711
1730
|
* Apply one change to the address book and persist it, normalised (a flag
|
|
1712
1731
|
* naming an address in no row becomes a custom address in the same write).
|
|
1713
1732
|
*/
|
|
@@ -1723,8 +1742,7 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
1723
1742
|
...addressBookPatch(changed),
|
|
1724
1743
|
customAddresses: changed.custom
|
|
1725
1744
|
}, detectedUrls);
|
|
1726
|
-
await this.
|
|
1727
|
-
await this.mdns?.sync();
|
|
1745
|
+
await this.saveStored(addressBookPatch(after));
|
|
1728
1746
|
}
|
|
1729
1747
|
/** The deprecated `getHubAddresses` shape, from the role resolvers. */
|
|
1730
1748
|
async snapshotHubAddresses() {
|
|
@@ -1834,7 +1852,7 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
1834
1852
|
await this.migrateNodeFields();
|
|
1835
1853
|
if (!this.config.bootSeeded) {
|
|
1836
1854
|
const seed = autoSeedAllowlist(this.enumerate());
|
|
1837
|
-
await this.
|
|
1855
|
+
await this.saveStored({
|
|
1838
1856
|
allowedAddresses: seed,
|
|
1839
1857
|
bootSeeded: true
|
|
1840
1858
|
});
|
|
@@ -1911,7 +1929,7 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
1911
1929
|
getAllowedAddresses: async () => ({ addresses: this.config.allowedAddresses }),
|
|
1912
1930
|
resetAllowlistToBestMatch: async () => {
|
|
1913
1931
|
const seed = autoSeedAllowlist(this.enumerate());
|
|
1914
|
-
await this.
|
|
1932
|
+
await this.saveStored({
|
|
1915
1933
|
allowedAddresses: seed,
|
|
1916
1934
|
bootSeeded: true
|
|
1917
1935
|
});
|
|
@@ -1921,7 +1939,7 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
1921
1939
|
setAllowedAddresses: async ({ addresses }) => {
|
|
1922
1940
|
const known = new Set(this.enumerate().map((i) => i.address));
|
|
1923
1941
|
const cleaned = [...new Set(addresses)].filter((a) => known.has(a));
|
|
1924
|
-
await this.
|
|
1942
|
+
await this.saveStored({ allowedAddresses: cleaned });
|
|
1925
1943
|
this.ctx.logger.info("local-network: allowlist updated", { meta: {
|
|
1926
1944
|
count: cleaned.length,
|
|
1927
1945
|
dropped: addresses.length - cleaned.length
|
|
@@ -1937,7 +1955,7 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
1937
1955
|
getScanSubnets: async () => ({ subnets: [...this.config.scanSubnets] }),
|
|
1938
1956
|
setScanSubnets: async ({ subnets }) => {
|
|
1939
1957
|
const cleaned = [...validateSavedSubnets(subnets)];
|
|
1940
|
-
await this.
|
|
1958
|
+
await this.saveStored({ scanSubnets: cleaned });
|
|
1941
1959
|
this.ctx.logger.info("local-network: scan subnets updated", { meta: {
|
|
1942
1960
|
count: cleaned.length,
|
|
1943
1961
|
subnets: cleaned
|
|
@@ -2366,7 +2384,7 @@ var LocalNetworkAddon = class extends BaseAddon {
|
|
|
2366
2384
|
try {
|
|
2367
2385
|
const next = reconcileAllowlist(this.config.allowedAddresses, interfaces);
|
|
2368
2386
|
if (sameAddressSet(this.config.allowedAddresses, next)) return;
|
|
2369
|
-
await this.
|
|
2387
|
+
await this.saveStored({
|
|
2370
2388
|
allowedAddresses: next,
|
|
2371
2389
|
bootSeeded: true
|
|
2372
2390
|
});
|
|
@@ -906,6 +906,39 @@ async function confirmRecordHoldsLegacy(ports, stored) {
|
|
|
906
906
|
if (legacyPassword && !record.hasPassword) return refuse("the record holds no password");
|
|
907
907
|
}
|
|
908
908
|
//#endregion
|
|
909
|
+
//#region src/builtins/loki-logging/migrations/retired-enabled-flag.ts
|
|
910
|
+
/**
|
|
911
|
+
* Loki's private `enabled` setting is gone (D777, D986, D987).
|
|
912
|
+
*
|
|
913
|
+
* The per-destination toggle is the only enable, and the legacy flag has not gated shipping since
|
|
914
|
+
* D777. A stored `enabled: false` therefore describes NOTHING in effect: carrying it over would
|
|
915
|
+
* switch off a destination that has been shipping for months, so this migration disables nothing.
|
|
916
|
+
* It deletes the dead key, and the marker the earlier boot-time carry-over left beside it, in ONE
|
|
917
|
+
* plan the engine applies under a precondition. Absence of the keys is the marker; a rerun finds
|
|
918
|
+
* nothing and writes nothing. A read that fails throws and nothing is written.
|
|
919
|
+
*/
|
|
920
|
+
/** The retired settings key. */
|
|
921
|
+
var RETIRED_ENABLED_KEY = "enabled";
|
|
922
|
+
var RETIRED_KEYS = [RETIRED_ENABLED_KEY, "migratedEnabled"];
|
|
923
|
+
async function planDropRetiredEnabledFlag(ports) {
|
|
924
|
+
const stored = await ports.readRawStored();
|
|
925
|
+
const present = RETIRED_KEYS.filter((key) => key in stored);
|
|
926
|
+
if (present.length === 0) return { edits: [] };
|
|
927
|
+
const flag = stored[RETIRED_ENABLED_KEY];
|
|
928
|
+
if (typeof flag === "boolean") ports.info(`Loki logging: the retired \`enabled: ${String(flag)}\` setting was removed; it has not gated shipping since D777, so nothing was switched. The per-destination toggle is the only enable.`);
|
|
929
|
+
const rowId = (key) => `${LOKI_ADDON_ID}.${key}`;
|
|
930
|
+
return { edits: [{
|
|
931
|
+
op: "deleteKeys",
|
|
932
|
+
scope: ADDON_SETTINGS_TABLE,
|
|
933
|
+
keys: present.map(rowId),
|
|
934
|
+
precondition: require_dist.preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
935
|
+
addonId: LOKI_ADDON_ID,
|
|
936
|
+
key,
|
|
937
|
+
value: stored[key]
|
|
938
|
+
}])))
|
|
939
|
+
}] };
|
|
940
|
+
}
|
|
941
|
+
//#endregion
|
|
909
942
|
//#region src/builtins/loki-logging/migrations/registry-toggle-to-record.ts
|
|
910
943
|
async function moveRegistryToggleToRecord(ports) {
|
|
911
944
|
const state = await ports.readRegistryState();
|
|
@@ -982,6 +1015,22 @@ var ADDON_MIGRATIONS = [
|
|
|
982
1015
|
fixtureMark: "a destinations record field the migration does not know (the job)"
|
|
983
1016
|
},
|
|
984
1017
|
procedure: moveRegistryToggleToRecord
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
meta: {
|
|
1021
|
+
id: "loki-logging/2026-11-07-drop-retired-enabled-flag",
|
|
1022
|
+
owner: "loki-logging",
|
|
1023
|
+
level: "addon-state",
|
|
1024
|
+
seq: 4,
|
|
1025
|
+
dependsOn: [],
|
|
1026
|
+
store: "settings",
|
|
1027
|
+
scope: "cluster",
|
|
1028
|
+
onFailure: "tolerate",
|
|
1029
|
+
bodyKind: "plan",
|
|
1030
|
+
description: "Delete the retired `enabled` setting (it gates nothing any more) and the marker its boot-time carry-over left",
|
|
1031
|
+
fixtureMark: "a setting key the migration does not know"
|
|
1032
|
+
},
|
|
1033
|
+
plan: planDropRetiredEnabledFlag
|
|
985
1034
|
}
|
|
986
1035
|
];
|
|
987
1036
|
/**
|
|
@@ -992,46 +1041,7 @@ var ADDON_MIGRATIONS = [
|
|
|
992
1041
|
*/
|
|
993
1042
|
var INITIALIZE_MIGRATIONS = ADDON_MIGRATIONS.filter((m) => m.meta.id !== REGISTRY_TOGGLE_TO_RECORD_ID);
|
|
994
1043
|
//#endregion
|
|
995
|
-
//#region src/builtins/loki-logging/retire-enabled-flag.ts
|
|
996
|
-
/** The retired settings key. */
|
|
997
|
-
var RETIRED_ENABLED_KEY = "enabled";
|
|
998
|
-
/** Store key marking the retirement as done. Not a schema field. Pre-D777 name kept. */
|
|
999
|
-
var RETIREMENT_MARKER_KEY = "migratedEnabled";
|
|
1000
|
-
function deferred(reason) {
|
|
1001
|
-
return {
|
|
1002
|
-
kind: "deferred",
|
|
1003
|
-
reason
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
function isMarked(read) {
|
|
1007
|
-
return read.kind === "present" && read.value === true;
|
|
1008
|
-
}
|
|
1009
|
-
async function retireEnabledFlag(deps) {
|
|
1010
|
-
const marker = await deps.readStoredKey(RETIREMENT_MARKER_KEY);
|
|
1011
|
-
if (marker.kind === "unreadable") return deferred("settings store unreadable (marker)");
|
|
1012
|
-
if (isMarked(marker)) return { kind: "already-retired" };
|
|
1013
|
-
const flag = await deps.readStoredKey(RETIRED_ENABLED_KEY);
|
|
1014
|
-
if (flag.kind === "unreadable") return deferred("settings store unreadable (enabled)");
|
|
1015
|
-
const strippedValue = flag.kind === "present" && typeof flag.value === "boolean" ? flag.value : null;
|
|
1016
|
-
await deps.commit();
|
|
1017
|
-
if (!isMarked(await deps.readStoredKey("migratedEnabled"))) return deferred("retirement write did not land");
|
|
1018
|
-
return {
|
|
1019
|
-
kind: "retired",
|
|
1020
|
-
strippedValue
|
|
1021
|
-
};
|
|
1022
|
-
}
|
|
1023
|
-
//#endregion
|
|
1024
1044
|
//#region src/builtins/loki-logging/loki-logging.addon.ts
|
|
1025
|
-
/** Backoff between retirement attempts — the first ones are refused until the
|
|
1026
|
-
* provider registration reaches the hub. After the last, the next boot retries. */
|
|
1027
|
-
var RETIREMENT_RETRY_DELAYS_MS = [
|
|
1028
|
-
1e3,
|
|
1029
|
-
2e3,
|
|
1030
|
-
5e3,
|
|
1031
|
-
1e4,
|
|
1032
|
-
3e4,
|
|
1033
|
-
6e4
|
|
1034
|
-
];
|
|
1035
1045
|
/** An agent re-reads the record on this period; the hub applies a change at once (`onChanged`). */
|
|
1036
1046
|
var AGENT_REFRESH_MS = 3e4;
|
|
1037
1047
|
/** The headers the destination itself sends: tenant and basic auth. */
|
|
@@ -1056,7 +1066,6 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1056
1066
|
destination = null;
|
|
1057
1067
|
instances = null;
|
|
1058
1068
|
refreshTimer = null;
|
|
1059
|
-
retirementTimer = null;
|
|
1060
1069
|
shuttingDown = false;
|
|
1061
1070
|
declared = false;
|
|
1062
1071
|
/** Instances whose keychain lock was already warned about — once per lock, per instance. */
|
|
@@ -1112,7 +1121,6 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1112
1121
|
await this.destination.initialize();
|
|
1113
1122
|
const urls = this.destination.getStatuses().filter((status) => status.configured).map((status) => status.instanceId);
|
|
1114
1123
|
this.ctx.logger.info(urls.length > 0 ? `Loki logging initialized with ${String(urls.length)} destination(s): ${urls.join(", ")}` : "Loki logging registered but inactive (no destination configured)");
|
|
1115
|
-
this.attemptEnabledFlagRetirement(0);
|
|
1116
1124
|
return registrations;
|
|
1117
1125
|
}
|
|
1118
1126
|
async ensureDeclared() {
|
|
@@ -1188,6 +1196,9 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1188
1196
|
return stored;
|
|
1189
1197
|
},
|
|
1190
1198
|
readRawStored: async () => this.resolveGlobalStore(),
|
|
1199
|
+
info: (message) => {
|
|
1200
|
+
this.ctx.logger.info(message);
|
|
1201
|
+
},
|
|
1191
1202
|
warn: (message) => {
|
|
1192
1203
|
this.ctx.logger.warn(message);
|
|
1193
1204
|
},
|
|
@@ -1294,45 +1305,6 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1294
1305
|
};
|
|
1295
1306
|
}
|
|
1296
1307
|
}
|
|
1297
|
-
/** One attempt of the D777 carry-over; reschedules itself while deferred. */
|
|
1298
|
-
async attemptEnabledFlagRetirement(attempt) {
|
|
1299
|
-
if (this.shuttingDown) return;
|
|
1300
|
-
let outcome;
|
|
1301
|
-
try {
|
|
1302
|
-
outcome = await retireEnabledFlag({
|
|
1303
|
-
readStoredKey: (key) => this.readStoredGlobalKey(key),
|
|
1304
|
-
commit: async () => {
|
|
1305
|
-
const patch = {
|
|
1306
|
-
[RETIRED_ENABLED_KEY]: void 0,
|
|
1307
|
-
[RETIREMENT_MARKER_KEY]: true
|
|
1308
|
-
};
|
|
1309
|
-
await this.updateGlobalSettings(patch);
|
|
1310
|
-
}
|
|
1311
|
-
});
|
|
1312
|
-
} catch (err) {
|
|
1313
|
-
outcome = {
|
|
1314
|
-
kind: "deferred",
|
|
1315
|
-
reason: err instanceof Error ? err.message : String(err)
|
|
1316
|
-
};
|
|
1317
|
-
}
|
|
1318
|
-
if (outcome.kind === "retired" && outcome.strippedValue !== null) this.ctx.logger.info(`Loki logging: the retired \`enabled: ${String(outcome.strippedValue)}\` setting was removed; it has not gated shipping since D777, so nothing was switched. The per-destination toggle is the only enable.`);
|
|
1319
|
-
if (outcome.kind !== "deferred") return;
|
|
1320
|
-
const delay = RETIREMENT_RETRY_DELAYS_MS[attempt];
|
|
1321
|
-
if (delay === void 0) {
|
|
1322
|
-
this.ctx.logger.warn("Loki logging: enablement carry-over deferred to next boot", { meta: { reason: outcome.reason } });
|
|
1323
|
-
return;
|
|
1324
|
-
}
|
|
1325
|
-
this.ctx.logger.debug("Loki logging: enablement carry-over deferred", { meta: {
|
|
1326
|
-
reason: outcome.reason,
|
|
1327
|
-
attempt,
|
|
1328
|
-
retryInMs: delay
|
|
1329
|
-
} });
|
|
1330
|
-
this.retirementTimer = setTimeout(() => {
|
|
1331
|
-
this.retirementTimer = null;
|
|
1332
|
-
this.attemptEnabledFlagRetirement(attempt + 1);
|
|
1333
|
-
}, delay);
|
|
1334
|
-
this.retirementTimer.unref?.();
|
|
1335
|
-
}
|
|
1336
1308
|
/**
|
|
1337
1309
|
* Registration is done: the hub calls this after the providers are registered, so
|
|
1338
1310
|
* `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
|
|
@@ -1357,8 +1329,6 @@ var LokiLoggingAddon = class extends require_dist.BaseAddon {
|
|
|
1357
1329
|
}
|
|
1358
1330
|
async onShutdown() {
|
|
1359
1331
|
this.shuttingDown = true;
|
|
1360
|
-
if (this.retirementTimer !== null) clearTimeout(this.retirementTimer);
|
|
1361
|
-
this.retirementTimer = null;
|
|
1362
1332
|
if (this.refreshTimer !== null) clearInterval(this.refreshTimer);
|
|
1363
1333
|
this.refreshTimer = null;
|
|
1364
1334
|
await this.destination?.shutdown();
|
|
@@ -899,6 +899,39 @@ async function confirmRecordHoldsLegacy(ports, stored) {
|
|
|
899
899
|
if (legacyPassword && !record.hasPassword) return refuse("the record holds no password");
|
|
900
900
|
}
|
|
901
901
|
//#endregion
|
|
902
|
+
//#region src/builtins/loki-logging/migrations/retired-enabled-flag.ts
|
|
903
|
+
/**
|
|
904
|
+
* Loki's private `enabled` setting is gone (D777, D986, D987).
|
|
905
|
+
*
|
|
906
|
+
* The per-destination toggle is the only enable, and the legacy flag has not gated shipping since
|
|
907
|
+
* D777. A stored `enabled: false` therefore describes NOTHING in effect: carrying it over would
|
|
908
|
+
* switch off a destination that has been shipping for months, so this migration disables nothing.
|
|
909
|
+
* It deletes the dead key, and the marker the earlier boot-time carry-over left beside it, in ONE
|
|
910
|
+
* plan the engine applies under a precondition. Absence of the keys is the marker; a rerun finds
|
|
911
|
+
* nothing and writes nothing. A read that fails throws and nothing is written.
|
|
912
|
+
*/
|
|
913
|
+
/** The retired settings key. */
|
|
914
|
+
var RETIRED_ENABLED_KEY = "enabled";
|
|
915
|
+
var RETIRED_KEYS = [RETIRED_ENABLED_KEY, "migratedEnabled"];
|
|
916
|
+
async function planDropRetiredEnabledFlag(ports) {
|
|
917
|
+
const stored = await ports.readRawStored();
|
|
918
|
+
const present = RETIRED_KEYS.filter((key) => key in stored);
|
|
919
|
+
if (present.length === 0) return { edits: [] };
|
|
920
|
+
const flag = stored[RETIRED_ENABLED_KEY];
|
|
921
|
+
if (typeof flag === "boolean") ports.info(`Loki logging: the retired \`enabled: ${String(flag)}\` setting was removed; it has not gated shipping since D777, so nothing was switched. The per-destination toggle is the only enable.`);
|
|
922
|
+
const rowId = (key) => `${LOKI_ADDON_ID}.${key}`;
|
|
923
|
+
return { edits: [{
|
|
924
|
+
op: "deleteKeys",
|
|
925
|
+
scope: ADDON_SETTINGS_TABLE,
|
|
926
|
+
keys: present.map(rowId),
|
|
927
|
+
precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
928
|
+
addonId: LOKI_ADDON_ID,
|
|
929
|
+
key,
|
|
930
|
+
value: stored[key]
|
|
931
|
+
}])))
|
|
932
|
+
}] };
|
|
933
|
+
}
|
|
934
|
+
//#endregion
|
|
902
935
|
//#region src/builtins/loki-logging/migrations/registry-toggle-to-record.ts
|
|
903
936
|
async function moveRegistryToggleToRecord(ports) {
|
|
904
937
|
const state = await ports.readRegistryState();
|
|
@@ -975,6 +1008,22 @@ var ADDON_MIGRATIONS = [
|
|
|
975
1008
|
fixtureMark: "a destinations record field the migration does not know (the job)"
|
|
976
1009
|
},
|
|
977
1010
|
procedure: moveRegistryToggleToRecord
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
meta: {
|
|
1014
|
+
id: "loki-logging/2026-11-07-drop-retired-enabled-flag",
|
|
1015
|
+
owner: "loki-logging",
|
|
1016
|
+
level: "addon-state",
|
|
1017
|
+
seq: 4,
|
|
1018
|
+
dependsOn: [],
|
|
1019
|
+
store: "settings",
|
|
1020
|
+
scope: "cluster",
|
|
1021
|
+
onFailure: "tolerate",
|
|
1022
|
+
bodyKind: "plan",
|
|
1023
|
+
description: "Delete the retired `enabled` setting (it gates nothing any more) and the marker its boot-time carry-over left",
|
|
1024
|
+
fixtureMark: "a setting key the migration does not know"
|
|
1025
|
+
},
|
|
1026
|
+
plan: planDropRetiredEnabledFlag
|
|
978
1027
|
}
|
|
979
1028
|
];
|
|
980
1029
|
/**
|
|
@@ -985,46 +1034,7 @@ var ADDON_MIGRATIONS = [
|
|
|
985
1034
|
*/
|
|
986
1035
|
var INITIALIZE_MIGRATIONS = ADDON_MIGRATIONS.filter((m) => m.meta.id !== REGISTRY_TOGGLE_TO_RECORD_ID);
|
|
987
1036
|
//#endregion
|
|
988
|
-
//#region src/builtins/loki-logging/retire-enabled-flag.ts
|
|
989
|
-
/** The retired settings key. */
|
|
990
|
-
var RETIRED_ENABLED_KEY = "enabled";
|
|
991
|
-
/** Store key marking the retirement as done. Not a schema field. Pre-D777 name kept. */
|
|
992
|
-
var RETIREMENT_MARKER_KEY = "migratedEnabled";
|
|
993
|
-
function deferred(reason) {
|
|
994
|
-
return {
|
|
995
|
-
kind: "deferred",
|
|
996
|
-
reason
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
function isMarked(read) {
|
|
1000
|
-
return read.kind === "present" && read.value === true;
|
|
1001
|
-
}
|
|
1002
|
-
async function retireEnabledFlag(deps) {
|
|
1003
|
-
const marker = await deps.readStoredKey(RETIREMENT_MARKER_KEY);
|
|
1004
|
-
if (marker.kind === "unreadable") return deferred("settings store unreadable (marker)");
|
|
1005
|
-
if (isMarked(marker)) return { kind: "already-retired" };
|
|
1006
|
-
const flag = await deps.readStoredKey(RETIRED_ENABLED_KEY);
|
|
1007
|
-
if (flag.kind === "unreadable") return deferred("settings store unreadable (enabled)");
|
|
1008
|
-
const strippedValue = flag.kind === "present" && typeof flag.value === "boolean" ? flag.value : null;
|
|
1009
|
-
await deps.commit();
|
|
1010
|
-
if (!isMarked(await deps.readStoredKey("migratedEnabled"))) return deferred("retirement write did not land");
|
|
1011
|
-
return {
|
|
1012
|
-
kind: "retired",
|
|
1013
|
-
strippedValue
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
//#endregion
|
|
1017
1037
|
//#region src/builtins/loki-logging/loki-logging.addon.ts
|
|
1018
|
-
/** Backoff between retirement attempts — the first ones are refused until the
|
|
1019
|
-
* provider registration reaches the hub. After the last, the next boot retries. */
|
|
1020
|
-
var RETIREMENT_RETRY_DELAYS_MS = [
|
|
1021
|
-
1e3,
|
|
1022
|
-
2e3,
|
|
1023
|
-
5e3,
|
|
1024
|
-
1e4,
|
|
1025
|
-
3e4,
|
|
1026
|
-
6e4
|
|
1027
|
-
];
|
|
1028
1038
|
/** An agent re-reads the record on this period; the hub applies a change at once (`onChanged`). */
|
|
1029
1039
|
var AGENT_REFRESH_MS = 3e4;
|
|
1030
1040
|
/** The headers the destination itself sends: tenant and basic auth. */
|
|
@@ -1049,7 +1059,6 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1049
1059
|
destination = null;
|
|
1050
1060
|
instances = null;
|
|
1051
1061
|
refreshTimer = null;
|
|
1052
|
-
retirementTimer = null;
|
|
1053
1062
|
shuttingDown = false;
|
|
1054
1063
|
declared = false;
|
|
1055
1064
|
/** Instances whose keychain lock was already warned about — once per lock, per instance. */
|
|
@@ -1105,7 +1114,6 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1105
1114
|
await this.destination.initialize();
|
|
1106
1115
|
const urls = this.destination.getStatuses().filter((status) => status.configured).map((status) => status.instanceId);
|
|
1107
1116
|
this.ctx.logger.info(urls.length > 0 ? `Loki logging initialized with ${String(urls.length)} destination(s): ${urls.join(", ")}` : "Loki logging registered but inactive (no destination configured)");
|
|
1108
|
-
this.attemptEnabledFlagRetirement(0);
|
|
1109
1117
|
return registrations;
|
|
1110
1118
|
}
|
|
1111
1119
|
async ensureDeclared() {
|
|
@@ -1181,6 +1189,9 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1181
1189
|
return stored;
|
|
1182
1190
|
},
|
|
1183
1191
|
readRawStored: async () => this.resolveGlobalStore(),
|
|
1192
|
+
info: (message) => {
|
|
1193
|
+
this.ctx.logger.info(message);
|
|
1194
|
+
},
|
|
1184
1195
|
warn: (message) => {
|
|
1185
1196
|
this.ctx.logger.warn(message);
|
|
1186
1197
|
},
|
|
@@ -1287,45 +1298,6 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1287
1298
|
};
|
|
1288
1299
|
}
|
|
1289
1300
|
}
|
|
1290
|
-
/** One attempt of the D777 carry-over; reschedules itself while deferred. */
|
|
1291
|
-
async attemptEnabledFlagRetirement(attempt) {
|
|
1292
|
-
if (this.shuttingDown) return;
|
|
1293
|
-
let outcome;
|
|
1294
|
-
try {
|
|
1295
|
-
outcome = await retireEnabledFlag({
|
|
1296
|
-
readStoredKey: (key) => this.readStoredGlobalKey(key),
|
|
1297
|
-
commit: async () => {
|
|
1298
|
-
const patch = {
|
|
1299
|
-
[RETIRED_ENABLED_KEY]: void 0,
|
|
1300
|
-
[RETIREMENT_MARKER_KEY]: true
|
|
1301
|
-
};
|
|
1302
|
-
await this.updateGlobalSettings(patch);
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
} catch (err) {
|
|
1306
|
-
outcome = {
|
|
1307
|
-
kind: "deferred",
|
|
1308
|
-
reason: err instanceof Error ? err.message : String(err)
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
if (outcome.kind === "retired" && outcome.strippedValue !== null) this.ctx.logger.info(`Loki logging: the retired \`enabled: ${String(outcome.strippedValue)}\` setting was removed; it has not gated shipping since D777, so nothing was switched. The per-destination toggle is the only enable.`);
|
|
1312
|
-
if (outcome.kind !== "deferred") return;
|
|
1313
|
-
const delay = RETIREMENT_RETRY_DELAYS_MS[attempt];
|
|
1314
|
-
if (delay === void 0) {
|
|
1315
|
-
this.ctx.logger.warn("Loki logging: enablement carry-over deferred to next boot", { meta: { reason: outcome.reason } });
|
|
1316
|
-
return;
|
|
1317
|
-
}
|
|
1318
|
-
this.ctx.logger.debug("Loki logging: enablement carry-over deferred", { meta: {
|
|
1319
|
-
reason: outcome.reason,
|
|
1320
|
-
attempt,
|
|
1321
|
-
retryInMs: delay
|
|
1322
|
-
} });
|
|
1323
|
-
this.retirementTimer = setTimeout(() => {
|
|
1324
|
-
this.retirementTimer = null;
|
|
1325
|
-
this.attemptEnabledFlagRetirement(attempt + 1);
|
|
1326
|
-
}, delay);
|
|
1327
|
-
this.retirementTimer.unref?.();
|
|
1328
|
-
}
|
|
1329
1301
|
/**
|
|
1330
1302
|
* Registration is done: the hub calls this after the providers are registered, so
|
|
1331
1303
|
* `listCapabilityProviders` now sees Loki. The registry-toggle migration cannot decide before
|
|
@@ -1350,8 +1322,6 @@ var LokiLoggingAddon = class extends BaseAddon {
|
|
|
1350
1322
|
}
|
|
1351
1323
|
async onShutdown() {
|
|
1352
1324
|
this.shuttingDown = true;
|
|
1353
|
-
if (this.retirementTimer !== null) clearTimeout(this.retirementTimer);
|
|
1354
|
-
this.retirementTimer = null;
|
|
1355
1325
|
if (this.refreshTimer !== null) clearInterval(this.refreshTimer);
|
|
1356
1326
|
this.refreshTimer = null;
|
|
1357
1327
|
await this.destination?.shutdown();
|