@substrat-run/kernel 0.136.0 → 0.137.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capability.d.ts +2 -0
- package/dist/capability.d.ts.map +1 -1
- package/dist/capability.js +2 -0
- package/dist/capability.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/invocation-log.d.ts +25 -1
- package/dist/invocation-log.d.ts.map +1 -1
- package/dist/invocation-log.js +45 -6
- package/dist/invocation-log.js.map +1 -1
- package/dist/job-run.d.ts +77 -15
- package/dist/job-run.d.ts.map +1 -1
- package/dist/job-run.js +107 -24
- package/dist/job-run.js.map +1 -1
- package/dist/lifecycle-flow.d.ts.map +1 -1
- package/dist/lifecycle-flow.js +2 -1
- package/dist/lifecycle-flow.js.map +1 -1
- package/dist/permission-eval.d.ts +9 -0
- package/dist/permission-eval.d.ts.map +1 -1
- package/dist/permission-eval.js +26 -0
- package/dist/permission-eval.js.map +1 -1
- package/dist/refusal-query.d.ts +4 -1
- package/dist/refusal-query.d.ts.map +1 -1
- package/dist/refusal-query.js +6 -4
- package/dist/refusal-query.js.map +1 -1
- package/dist/refusals.d.ts +80 -8
- package/dist/refusals.d.ts.map +1 -1
- package/dist/refusals.js +141 -22
- package/dist/refusals.js.map +1 -1
- package/dist/scope-host.d.ts +30 -6
- package/dist/scope-host.d.ts.map +1 -1
- package/dist/scope-host.js.map +1 -1
- package/dist/system-switch-record.d.ts +27 -11
- package/dist/system-switch-record.d.ts.map +1 -1
- package/dist/system-switch-record.js +59 -24
- package/dist/system-switch-record.js.map +1 -1
- package/dist/system-switch.d.ts +41 -11
- package/dist/system-switch.d.ts.map +1 -1
- package/dist/system-switch.js +48 -15
- package/dist/system-switch.js.map +1 -1
- package/package.json +2 -2
package/dist/system-switch.d.ts
CHANGED
|
@@ -19,19 +19,25 @@
|
|
|
19
19
|
* `scope:<id>` marker. The gate is OFF while that marker is live, whatever grants are
|
|
20
20
|
* live beside it. **Restore is the lever; a grant is not.** The marker is an ordinary
|
|
21
21
|
* K-21 tuple: switching back on tombstones it, so the row stays as evidence of when the
|
|
22
|
-
* switch was last pulled. The permission walk reads only `role:` and `granted:` relations
|
|
23
|
-
*
|
|
22
|
+
* switch was last pulled. The permission walk reads only `role:` and `granted:` relations,
|
|
23
|
+
* so the marker authorizes nothing; what it denies, it denies through the one question the
|
|
24
|
+
* evaluator asks before the walk (below).
|
|
24
25
|
*
|
|
25
26
|
* Switching off ALSO tombstones every live `granted:` tuple the module holds on the scope.
|
|
26
27
|
* That is what makes it a kill switch rather than a schedule pause: anything that acts
|
|
27
28
|
* with the module's system authority — a resumable job run (#1577), a `getSystemScope`
|
|
28
29
|
* invoke — is denied by its own `ctx.check` while the switch is off.
|
|
29
30
|
*
|
|
30
|
-
* **And
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* **And the checker reads the marker too** (#1823), which is what makes that denial hold
|
|
32
|
+
* against a grant OFF cannot tombstone. A TENANT-level `system:` grant lives in the directory
|
|
33
|
+
* (and in every scope's projection of it), not at `scope:<id>`, so OFF leaves it live. The
|
|
34
|
+
* permission evaluator asks the scope reader's `switchedOff` before it reads any tuple, and a
|
|
35
|
+
* live marker denies the subject on that scope whatever it holds (`permission-eval.ts`). The
|
|
36
|
+
* write side stays closed as well, so a switched-off scope does not accumulate grants that
|
|
37
|
+
* ON would then hand back:
|
|
33
38
|
* - `grantToSystem` refuses while the module is switched off on that scope (the adapters
|
|
34
|
-
* ask `systemSwitchedOff` in the same unit as the write)
|
|
39
|
+
* ask `systemSwitchedOff` in the same unit as the write), and a tenant-level grant while
|
|
40
|
+
* the directory records it off on any scope (#1743);
|
|
35
41
|
* - provisioning's seat (`seatScopeTuple`) seats nothing for a subject whose marker is
|
|
36
42
|
* live, so a reconcile cannot create a grant a newer version declares.
|
|
37
43
|
*
|
|
@@ -97,8 +103,15 @@ export interface SystemGrantsEntry {
|
|
|
97
103
|
export declare function systemGrantsStatus(db: SwitchSql, now: string): SystemGrantsEntry[];
|
|
98
104
|
/** Is this module switched off on the scope `db` is? What `grantToSystem` refuses on. */
|
|
99
105
|
export declare function systemSwitchedOff(db: SwitchSql, moduleId: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* `SYSTEM_SWITCH_OFF_PREDICATE` as a whole statement answering `off` (0/1), over the one bound
|
|
108
|
+
* subject — what `subjectSwitchedOff` runs, and what each adapter's permission reader prepares
|
|
109
|
+
* once and runs on every check of a switchable subject (#1823).
|
|
110
|
+
*/
|
|
111
|
+
export declare const SYSTEM_SWITCH_OFF_QUERY = "SELECT EXISTS (SELECT 1 FROM _substrat_tuples\n WHERE subject = ? AND relation = 'switch:off' AND revoked_at IS NULL) AS off";
|
|
100
112
|
/** Is this subject's OFF marker live on the scope `db` is? Any subject — see `switchSubjectGrants`. */
|
|
101
113
|
export declare function subjectSwitchedOff(db: SwitchSql, subject: string): boolean;
|
|
114
|
+
export declare const isSwitchableSubjectKind: (kind: string) => boolean;
|
|
102
115
|
/** The refusal `grantToSystem` throws while the switch is off — one wording, both adapters. */
|
|
103
116
|
export declare function systemSwitchedOffMessage(moduleId: string, scopeId: string): string;
|
|
104
117
|
/**
|
|
@@ -111,6 +124,15 @@ export interface SwitchOutcome {
|
|
|
111
124
|
held: boolean;
|
|
112
125
|
changed: boolean;
|
|
113
126
|
permissions: string[];
|
|
127
|
+
/**
|
|
128
|
+
* #1823: this code's evaluator denies a module on a scope whose marker is live, its
|
|
129
|
+
* TENANT-level grants included. Set by `switchSystemSchedules` on every answer, because it
|
|
130
|
+
* is a fact about the code that answered, not about the call: a deployment built before
|
|
131
|
+
* #1823 omits it, and its OFF leaves a tenant-level grant authorizing. The platform reads
|
|
132
|
+
* its absence on an OFF of a module it found tenant-held as "this deployment cannot hold
|
|
133
|
+
* that OFF", and refuses it rather than record a scope off that is not.
|
|
134
|
+
*/
|
|
135
|
+
deniesTenantGrants?: true;
|
|
114
136
|
}
|
|
115
137
|
/**
|
|
116
138
|
* Move one module's switch on one scope. Idempotent: a repeat changes nothing and says so.
|
|
@@ -121,9 +143,13 @@ export interface SwitchOutcome {
|
|
|
121
143
|
* marker. A repeated OFF re-asserts the whole position: a grant that became live meanwhile
|
|
122
144
|
* (only a raw write can do that now) is tombstoned and recorded too.
|
|
123
145
|
*
|
|
124
|
-
* `held: false`, with nothing written, when the
|
|
125
|
-
*
|
|
126
|
-
*
|
|
146
|
+
* `held: false`, with nothing written, when the module has no authority reaching the scope:
|
|
147
|
+
* no grant and no marker here, and no live TENANT-level grant (`tenantHeld`, which the caller
|
|
148
|
+
* reads from the directory, since the scope's storage cannot answer it). The caller named
|
|
149
|
+
* something this scope never ran, and turning "nothing" off must not write a marker that
|
|
150
|
+
* silently disables a module the day it is installed. A module whose only authority here is a
|
|
151
|
+
* tenant-level grant IS held (#1823): OFF writes the marker, which the evaluator then denies
|
|
152
|
+
* the module on, and tombstones nothing, because nothing of it is here to tombstone.
|
|
127
153
|
*
|
|
128
154
|
* Run it inside one transaction; the reads and writes here are meant to be one unit.
|
|
129
155
|
*/
|
|
@@ -132,6 +158,7 @@ export declare function switchSystemSchedules(db: SwitchSql, input: {
|
|
|
132
158
|
scopeId: string;
|
|
133
159
|
to: 'on' | 'off';
|
|
134
160
|
at: string;
|
|
161
|
+
tenantHeld?: boolean;
|
|
135
162
|
}): SwitchOutcome;
|
|
136
163
|
/** One module `switchRecordedOff` switched off — `SwitchedOffInUnit`'s shape. */
|
|
137
164
|
export interface SwitchedOff extends SwitchOutcome {
|
|
@@ -147,13 +174,15 @@ export interface SwitchedOff extends SwitchOutcome {
|
|
|
147
174
|
* `scopeId` is the scope `db` is, and the caller passes the one the request provisions or
|
|
148
175
|
* restores, never a second id: the list names modules, never scopes, so it can only reach
|
|
149
176
|
* the scope that unit is already writing. A module the scope holds nothing for answers
|
|
150
|
-
* `held: false` and writes nothing, as the switch always does
|
|
151
|
-
* a
|
|
177
|
+
* `held: false` and writes nothing, as the switch always does — unless it is in `tenantHeld`,
|
|
178
|
+
* the recorded-off modules the caller found a live tenant-level grant for (#1823). Off only:
|
|
179
|
+
* nothing here turns a module on.
|
|
152
180
|
*/
|
|
153
181
|
export declare function switchRecordedOff(db: SwitchSql, input: {
|
|
154
182
|
scopeId: string;
|
|
155
183
|
moduleIds: readonly string[];
|
|
156
184
|
at: string;
|
|
185
|
+
tenantHeld?: readonly string[];
|
|
157
186
|
}): SwitchedOff[];
|
|
158
187
|
/**
|
|
159
188
|
* The switch itself, for ANY non-person subject's scope-level grants — `switchSystemSchedules`
|
|
@@ -169,5 +198,6 @@ export declare function switchSubjectGrants(db: SwitchSql, input: {
|
|
|
169
198
|
scopeId: string;
|
|
170
199
|
to: 'on' | 'off';
|
|
171
200
|
at: string;
|
|
201
|
+
tenantHeld?: boolean;
|
|
172
202
|
}): SwitchOutcome;
|
|
173
203
|
//# sourceMappingURL=system-switch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-switch.d.ts","sourceRoot":"","sources":["../src/system-switch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"system-switch.d.ts","sourceRoot":"","sources":["../src/system-switch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,4FAA4F;AAC5F,eAAO,MAAM,0BAA0B,eAAe,CAAC;AAKvD,sFAAsF;AACtF,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACnF,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,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AAa;IAC5B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,SAAS,EACb,KAAK,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,IAAI,GAAG,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/F,aAAa,CASf;AAED,iFAAiF;AACjF,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,SAAS,EACb,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GACnG,WAAW,EAAE,CAYf;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,SAAS,EACb,KAAK,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,IAAI,GAAG,KAAK,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC9F,aAAa,CA4Ff"}
|
package/dist/system-switch.js
CHANGED
|
@@ -19,19 +19,25 @@
|
|
|
19
19
|
* `scope:<id>` marker. The gate is OFF while that marker is live, whatever grants are
|
|
20
20
|
* live beside it. **Restore is the lever; a grant is not.** The marker is an ordinary
|
|
21
21
|
* K-21 tuple: switching back on tombstones it, so the row stays as evidence of when the
|
|
22
|
-
* switch was last pulled. The permission walk reads only `role:` and `granted:` relations
|
|
23
|
-
*
|
|
22
|
+
* switch was last pulled. The permission walk reads only `role:` and `granted:` relations,
|
|
23
|
+
* so the marker authorizes nothing; what it denies, it denies through the one question the
|
|
24
|
+
* evaluator asks before the walk (below).
|
|
24
25
|
*
|
|
25
26
|
* Switching off ALSO tombstones every live `granted:` tuple the module holds on the scope.
|
|
26
27
|
* That is what makes it a kill switch rather than a schedule pause: anything that acts
|
|
27
28
|
* with the module's system authority — a resumable job run (#1577), a `getSystemScope`
|
|
28
29
|
* invoke — is denied by its own `ctx.check` while the switch is off.
|
|
29
30
|
*
|
|
30
|
-
* **And
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* **And the checker reads the marker too** (#1823), which is what makes that denial hold
|
|
32
|
+
* against a grant OFF cannot tombstone. A TENANT-level `system:` grant lives in the directory
|
|
33
|
+
* (and in every scope's projection of it), not at `scope:<id>`, so OFF leaves it live. The
|
|
34
|
+
* permission evaluator asks the scope reader's `switchedOff` before it reads any tuple, and a
|
|
35
|
+
* live marker denies the subject on that scope whatever it holds (`permission-eval.ts`). The
|
|
36
|
+
* write side stays closed as well, so a switched-off scope does not accumulate grants that
|
|
37
|
+
* ON would then hand back:
|
|
33
38
|
* - `grantToSystem` refuses while the module is switched off on that scope (the adapters
|
|
34
|
-
* ask `systemSwitchedOff` in the same unit as the write)
|
|
39
|
+
* ask `systemSwitchedOff` in the same unit as the write), and a tenant-level grant while
|
|
40
|
+
* the directory records it off on any scope (#1743);
|
|
35
41
|
* - provisioning's seat (`seatScopeTuple`) seats nothing for a subject whose marker is
|
|
36
42
|
* live, so a reconcile cannot create a grant a newer version declares.
|
|
37
43
|
*
|
|
@@ -101,11 +107,24 @@ export function systemGrantsStatus(db, now) {
|
|
|
101
107
|
export function systemSwitchedOff(db, moduleId) {
|
|
102
108
|
return subjectSwitchedOff(db, subjectOf(moduleId));
|
|
103
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* `SYSTEM_SWITCH_OFF_PREDICATE` as a whole statement answering `off` (0/1), over the one bound
|
|
112
|
+
* subject — what `subjectSwitchedOff` runs, and what each adapter's permission reader prepares
|
|
113
|
+
* once and runs on every check of a switchable subject (#1823).
|
|
114
|
+
*/
|
|
115
|
+
export const SYSTEM_SWITCH_OFF_QUERY = `SELECT ${SYSTEM_SWITCH_OFF_PREDICATE} AS off`;
|
|
104
116
|
/** Is this subject's OFF marker live on the scope `db` is? Any subject — see `switchSubjectGrants`. */
|
|
105
117
|
export function subjectSwitchedOff(db, subject) {
|
|
106
|
-
const row = db.all(
|
|
118
|
+
const row = db.all(SYSTEM_SWITCH_OFF_QUERY, subject)[0];
|
|
107
119
|
return Number(row?.off) === 1;
|
|
108
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* The subject kinds a kill switch can name: a module's system authority (#1666, `system:`) and
|
|
123
|
+
* a peer vertical's (#1706, `vertical:`). A principal, connection or capability never carries a
|
|
124
|
+
* marker, so the evaluator asks the switch only for these (#1823).
|
|
125
|
+
*/
|
|
126
|
+
const SWITCHABLE_KINDS = new Set(['system', 'vertical']);
|
|
127
|
+
export const isSwitchableSubjectKind = (kind) => SWITCHABLE_KINDS.has(kind);
|
|
109
128
|
/** How many scopes a tenant-level refusal names before it says "and N more". */
|
|
110
129
|
const NAMED_SCOPES = 5;
|
|
111
130
|
const switchedOffMessage = (moduleId, where, reach) => `module '${moduleId}' is switched off on ${where} (#1666) — restore it first ` +
|
|
@@ -134,19 +153,25 @@ export function tenantSystemSwitchedOffMessage(moduleId, scopeIds) {
|
|
|
134
153
|
* marker. A repeated OFF re-asserts the whole position: a grant that became live meanwhile
|
|
135
154
|
* (only a raw write can do that now) is tombstoned and recorded too.
|
|
136
155
|
*
|
|
137
|
-
* `held: false`, with nothing written, when the
|
|
138
|
-
*
|
|
139
|
-
*
|
|
156
|
+
* `held: false`, with nothing written, when the module has no authority reaching the scope:
|
|
157
|
+
* no grant and no marker here, and no live TENANT-level grant (`tenantHeld`, which the caller
|
|
158
|
+
* reads from the directory, since the scope's storage cannot answer it). The caller named
|
|
159
|
+
* something this scope never ran, and turning "nothing" off must not write a marker that
|
|
160
|
+
* silently disables a module the day it is installed. A module whose only authority here is a
|
|
161
|
+
* tenant-level grant IS held (#1823): OFF writes the marker, which the evaluator then denies
|
|
162
|
+
* the module on, and tombstones nothing, because nothing of it is here to tombstone.
|
|
140
163
|
*
|
|
141
164
|
* Run it inside one transaction; the reads and writes here are meant to be one unit.
|
|
142
165
|
*/
|
|
143
166
|
export function switchSystemSchedules(db, input) {
|
|
144
|
-
|
|
167
|
+
const outcome = switchSubjectGrants(db, {
|
|
145
168
|
subject: subjectOf(input.moduleId),
|
|
146
169
|
scopeId: input.scopeId,
|
|
147
170
|
to: input.to,
|
|
148
171
|
at: input.at,
|
|
172
|
+
tenantHeld: input.tenantHeld,
|
|
149
173
|
});
|
|
174
|
+
return { ...outcome, deniesTenantGrants: true };
|
|
150
175
|
}
|
|
151
176
|
/**
|
|
152
177
|
* Switch the directory's recorded-off modules off again, inside the unit that re-created the
|
|
@@ -158,13 +183,21 @@ export function switchSystemSchedules(db, input) {
|
|
|
158
183
|
* `scopeId` is the scope `db` is, and the caller passes the one the request provisions or
|
|
159
184
|
* restores, never a second id: the list names modules, never scopes, so it can only reach
|
|
160
185
|
* the scope that unit is already writing. A module the scope holds nothing for answers
|
|
161
|
-
* `held: false` and writes nothing, as the switch always does
|
|
162
|
-
* a
|
|
186
|
+
* `held: false` and writes nothing, as the switch always does — unless it is in `tenantHeld`,
|
|
187
|
+
* the recorded-off modules the caller found a live tenant-level grant for (#1823). Off only:
|
|
188
|
+
* nothing here turns a module on.
|
|
163
189
|
*/
|
|
164
190
|
export function switchRecordedOff(db, input) {
|
|
191
|
+
const tenantHeld = new Set(input.tenantHeld ?? []);
|
|
165
192
|
return [...new Set(input.moduleIds)].map((moduleId) => ({
|
|
166
193
|
moduleId,
|
|
167
|
-
...switchSystemSchedules(db, {
|
|
194
|
+
...switchSystemSchedules(db, {
|
|
195
|
+
moduleId,
|
|
196
|
+
scopeId: input.scopeId,
|
|
197
|
+
to: 'off',
|
|
198
|
+
at: input.at,
|
|
199
|
+
tenantHeld: tenantHeld.has(moduleId),
|
|
200
|
+
}),
|
|
168
201
|
}));
|
|
169
202
|
}
|
|
170
203
|
/**
|
|
@@ -183,7 +216,7 @@ export function switchSubjectGrants(db, input) {
|
|
|
183
216
|
WHERE subject = ? AND object = ? AND substr(relation, 1, 8) = 'granted:'
|
|
184
217
|
ORDER BY relation`, subject, object);
|
|
185
218
|
const marker = db.all(`SELECT revoked_at FROM _substrat_tuples WHERE subject = ? AND relation = ? AND object = ?`, subject, SYSTEM_SWITCH_OFF_RELATION, object)[0];
|
|
186
|
-
if (grants.length === 0 && !marker)
|
|
219
|
+
if (grants.length === 0 && !marker && !input.tenantHeld)
|
|
187
220
|
return { held: false, changed: false, permissions: [] };
|
|
188
221
|
const permissionOf = (relation) => relation.slice('granted:'.length);
|
|
189
222
|
if (input.to === 'off') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-switch.js","sourceRoot":"","sources":["../src/system-switch.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"system-switch.js","sourceRoot":"","sources":["../src/system-switch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,4FAA4F;AAC5F,MAAM,CAAC,MAAM,0BAA0B,GAAG,YAAY,CAAC;AAEvD,uFAAuF;AACvF,MAAM,eAAe,GAAG,WAAW,CAAC;AAqBpC,MAAM,SAAS,GAAG,CAAC,QAAgB,EAAU,EAAE,CAAC,UAAU,QAAQ,EAAE,CAAC;AAErE;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;sCACL,0BAA0B,2BAA2B,CAAC;A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AAI,WAAW,EAAE,CAAC;QAChB,EAAE,CAAC,GAAG,CACJ,8FAA8F,EAC9F,KAAK,CAAC,EAAE,EACR,OAAO,EACP,0BAA0B,EAC1B,MAAM,CACP,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;AAC5F,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@substrat-run/kernel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.137.0",
|
|
4
4
|
"description": "Substrat kernel contracts and services — pure TypeScript, no platform imports (D-14)",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@substrat-run/contracts": "^0.
|
|
25
|
+
"@substrat-run/contracts": "^0.137.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.20.4",
|