@adhdev/mesh-shared 1.0.56-rc.11 → 1.0.56-rc.13

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.
@@ -79,6 +79,23 @@ export interface MeshNodeFactsProviderQuota {
79
79
  };
80
80
  [extra: string]: unknown;
81
81
  }
82
+ /**
83
+ * One provider's enablement state on the reporting machine — see
84
+ * `MeshNodeFacts.providerEnablement`.
85
+ *
86
+ * Both fields are REQUIRED booleans on the wire even though the underlying
87
+ * config defaults are asymmetric (`enabled` defaults false, `quotaEnabled`
88
+ * defaults true). The producer resolves those defaults before stamping, so a
89
+ * reader never re-derives them — a second copy of the default rules is exactly
90
+ * the drift this shape avoids. Absence is expressed by omitting the whole
91
+ * provider entry (or the whole bundle field), never by a missing sub-field.
92
+ */
93
+ export interface MeshNodeFactsProviderEnablement {
94
+ /** "This machine uses provider X" — gates launching and mesh claims. */
95
+ enabled: boolean;
96
+ /** "...and its quota is probed here" — an independent user opt-out. */
97
+ quotaEnabled: boolean;
98
+ }
82
99
  export interface MeshNodeFacts {
83
100
  schemaVersion: number;
84
101
  reportedAt: number;
@@ -118,6 +135,31 @@ export interface MeshNodeFacts {
118
135
  * rule: quotaSnapshotAgeMs in daemon-core mesh-quota-routing.ts).
119
136
  */
120
137
  quota?: Record<string, MeshNodeFactsProviderQuota>;
138
+ /**
139
+ * Per-provider ENABLEMENT state on the reporting machine, keyed the same
140
+ * way as `quota`. Exists because `quota` alone cannot answer "why is there
141
+ * no snapshot": a provider that is disabled — on either axis — is pruned
142
+ * from the quota cache entirely (daemon-core quota/refresh.ts drops it and
143
+ * refuses to restore it from disk), so a deliberate opt-out and a
144
+ * never-yet-measured provider both arrive as the SAME absent entry. On the
145
+ * node that owns the config that ambiguity is resolvable by reading the
146
+ * config; for every OTHER node in the mesh it was not resolvable at all,
147
+ * which is what this field fixes.
148
+ *
149
+ * The two axes mirror ProviderLoader exactly and are INDEPENDENT:
150
+ * `enabled` is "this machine uses provider X" (gates launching and mesh
151
+ * claims), `quotaEnabled` gates ONLY the quota probe — a machine can use a
152
+ * provider and still opt out of having its usage read.
153
+ *
154
+ * ★An ABSENT bundle field means "this node did not tell us" — a daemon too
155
+ * old to send it — and must NEVER be read as "disabled". The consumer
156
+ * (daemon-core mesh-quota-routing.ts classifyAbsentQuotaReason) keeps its
157
+ * unclassified fallback for exactly that case; treating absence as
158
+ * disabled would invent a fail-closed verdict out of a missing field.
159
+ *
160
+ * Booleans keyed by provider type only — no free text, no credentials.
161
+ */
162
+ providerEnablement?: Record<string, MeshNodeFactsProviderEnablement>;
121
163
  /** Future fields ride through opaquely — do not enumerate them in relays. */
122
164
  [extra: string]: unknown;
123
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/mesh-shared",
3
- "version": "1.0.56-rc.11",
3
+ "version": "1.0.56-rc.13",
4
4
  "description": "ADHDev mesh-shared — pure mesh/git status normalizers shared by daemon-core and web-core",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/node-facts.ts CHANGED
@@ -83,6 +83,24 @@ export interface MeshNodeFactsProviderQuota {
83
83
  [extra: string]: unknown
84
84
  }
85
85
 
86
+ /**
87
+ * One provider's enablement state on the reporting machine — see
88
+ * `MeshNodeFacts.providerEnablement`.
89
+ *
90
+ * Both fields are REQUIRED booleans on the wire even though the underlying
91
+ * config defaults are asymmetric (`enabled` defaults false, `quotaEnabled`
92
+ * defaults true). The producer resolves those defaults before stamping, so a
93
+ * reader never re-derives them — a second copy of the default rules is exactly
94
+ * the drift this shape avoids. Absence is expressed by omitting the whole
95
+ * provider entry (or the whole bundle field), never by a missing sub-field.
96
+ */
97
+ export interface MeshNodeFactsProviderEnablement {
98
+ /** "This machine uses provider X" — gates launching and mesh claims. */
99
+ enabled: boolean
100
+ /** "...and its quota is probed here" — an independent user opt-out. */
101
+ quotaEnabled: boolean
102
+ }
103
+
86
104
  export interface MeshNodeFacts {
87
105
  schemaVersion: number
88
106
  reportedAt: number
@@ -122,6 +140,31 @@ export interface MeshNodeFacts {
122
140
  * rule: quotaSnapshotAgeMs in daemon-core mesh-quota-routing.ts).
123
141
  */
124
142
  quota?: Record<string, MeshNodeFactsProviderQuota>
143
+ /**
144
+ * Per-provider ENABLEMENT state on the reporting machine, keyed the same
145
+ * way as `quota`. Exists because `quota` alone cannot answer "why is there
146
+ * no snapshot": a provider that is disabled — on either axis — is pruned
147
+ * from the quota cache entirely (daemon-core quota/refresh.ts drops it and
148
+ * refuses to restore it from disk), so a deliberate opt-out and a
149
+ * never-yet-measured provider both arrive as the SAME absent entry. On the
150
+ * node that owns the config that ambiguity is resolvable by reading the
151
+ * config; for every OTHER node in the mesh it was not resolvable at all,
152
+ * which is what this field fixes.
153
+ *
154
+ * The two axes mirror ProviderLoader exactly and are INDEPENDENT:
155
+ * `enabled` is "this machine uses provider X" (gates launching and mesh
156
+ * claims), `quotaEnabled` gates ONLY the quota probe — a machine can use a
157
+ * provider and still opt out of having its usage read.
158
+ *
159
+ * ★An ABSENT bundle field means "this node did not tell us" — a daemon too
160
+ * old to send it — and must NEVER be read as "disabled". The consumer
161
+ * (daemon-core mesh-quota-routing.ts classifyAbsentQuotaReason) keeps its
162
+ * unclassified fallback for exactly that case; treating absence as
163
+ * disabled would invent a fail-closed verdict out of a missing field.
164
+ *
165
+ * Booleans keyed by provider type only — no free text, no credentials.
166
+ */
167
+ providerEnablement?: Record<string, MeshNodeFactsProviderEnablement>
125
168
  /** Future fields ride through opaquely — do not enumerate them in relays. */
126
169
  [extra: string]: unknown
127
170
  }