@kici-dev/engine 0.1.26 → 0.2.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/approval/types.d.ts +11 -4
- package/dist/approval/types.js +11 -4
- package/dist/artifacts/name.d.ts +60 -0
- package/dist/artifacts/name.js +71 -0
- package/dist/audit/access-log-policy.d.ts +1 -1
- package/dist/audit/access-log-policy.js +20 -11
- package/dist/audit/activity.d.ts +12 -12
- package/dist/audit/retention-policy.js +40 -22
- package/dist/billing/plan-type.d.ts +53 -0
- package/dist/billing/plan-type.js +70 -0
- package/dist/bundler/rolldown-config.d.ts +3 -3
- package/dist/check-mode.d.ts +1 -1
- package/dist/context/concurrency-strategy.d.ts +34 -0
- package/dist/context/concurrency-strategy.js +35 -0
- package/dist/context/held-run-job-id.d.ts +45 -0
- package/dist/context/held-run-job-id.js +56 -0
- package/dist/context/held-run-status.d.ts +33 -0
- package/dist/context/held-run-status.js +37 -0
- package/dist/context/hold-expiry.d.ts +20 -0
- package/dist/context/hold-expiry.js +25 -0
- package/dist/context/hold-reason.d.ts +33 -0
- package/dist/context/hold-reason.js +23 -0
- package/dist/context/hold-type.d.ts +40 -0
- package/dist/context/hold-type.js +61 -0
- package/dist/{environment → context}/host-match.js +1 -1
- package/dist/context/index.d.ts +14 -0
- package/dist/context/index.js +12 -0
- package/dist/context/multi-context.d.ts +30 -0
- package/dist/context/multi-context.js +38 -0
- package/dist/context/scope-name.d.ts +29 -0
- package/dist/context/scope-name.js +49 -0
- package/dist/context/scope-resolver.d.ts +79 -0
- package/dist/{environment → context}/scope-resolver.js +47 -17
- package/dist/{environment → context}/scope-template.js +1 -1
- package/dist/{environment → context}/types.d.ts +25 -22
- package/dist/{environment → context}/types.js +3 -3
- package/dist/dev-ops/operations.d.ts +9 -1
- package/dist/dev-ops/operations.js +37 -20
- package/dist/diagnostics/infra-alert.d.ts +71 -0
- package/dist/diagnostics/infra-alert.js +60 -0
- package/dist/env/environment-allowlist.d.ts +26 -3
- package/dist/env/environment-allowlist.js +35 -1
- package/dist/fanout/materialize.d.ts +16 -0
- package/dist/fanout/materialize.js +34 -5
- package/dist/index.d.ts +16 -7
- package/dist/index.js +38 -23
- package/dist/inputs/descriptor.d.ts +9 -9
- package/dist/inventory.d.ts +4 -4
- package/dist/labels.d.ts +82 -2
- package/dist/labels.js +119 -1
- package/dist/matrix/expand.d.ts +49 -2
- package/dist/matrix/expand.js +102 -13
- package/dist/matrix/format.d.ts +6 -1
- package/dist/matrix/format.js +6 -1
- package/dist/mcp/held-run-resolve.d.ts +7 -10
- package/dist/mcp/held-run-resolve.js +33 -7
- package/dist/metrics/catalog-policy.js +4 -4
- package/dist/metrics/metric-catalog.generated.d.ts +954 -734
- package/dist/metrics/metric-catalog.generated.js +296 -32
- package/dist/metrics/metric-kind-compat.d.ts +26 -0
- package/dist/metrics/metric-kind-compat.js +33 -0
- package/dist/protocol/analytics-events.d.ts +6 -6
- package/dist/protocol/dashboard-api-errors.d.ts +13 -0
- package/dist/protocol/dashboard-api-errors.js +17 -0
- package/dist/protocol/dashboard-write-operations.d.ts +143 -86
- package/dist/protocol/dashboard-write-operations.js +143 -69
- package/dist/protocol/messages/access-log.d.ts +438 -388
- package/dist/protocol/messages/access-log.js +24 -14
- package/dist/protocol/messages/actor.d.ts +2 -2
- package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
- package/dist/protocol/messages/agent-dev-ops.js +2 -5
- package/dist/protocol/messages/agent-run-result.d.ts +74 -64
- package/dist/protocol/messages/agent-run-result.js +1 -1
- package/dist/protocol/messages/auth.d.ts +35 -23
- package/dist/protocol/messages/browser.d.ts +81 -5
- package/dist/protocol/messages/browser.js +53 -2
- package/dist/protocol/messages/capabilities.d.ts +106 -31
- package/dist/protocol/messages/capabilities.js +94 -10
- package/dist/protocol/messages/common.d.ts +45 -2
- package/dist/protocol/messages/common.js +64 -3
- package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
- package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
- package/dist/protocol/messages/dashboard.d.ts +1232 -706
- package/dist/protocol/messages/dashboard.js +387 -220
- package/dist/protocol/messages/deployment-identity.d.ts +37 -10
- package/dist/protocol/messages/deployment-identity.js +30 -3
- package/dist/protocol/messages/event-log.d.ts +5 -5
- package/dist/protocol/messages/execution-status.d.ts +198 -62
- package/dist/protocol/messages/execution-status.js +114 -46
- package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
- package/dist/protocol/messages/heartbeat-health.js +87 -0
- package/dist/protocol/messages/log-stream.d.ts +18 -0
- package/dist/protocol/messages/log-stream.js +19 -0
- package/dist/protocol/messages/oidc-mint.d.ts +7 -0
- package/dist/protocol/messages/oidc-mint.js +7 -0
- package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
- package/dist/protocol/messages/orchestrator-agent.js +170 -5
- package/dist/protocol/messages/pat-kind.d.ts +1 -1
- package/dist/protocol/messages/peer.d.ts +122 -58
- package/dist/protocol/messages/peer.js +37 -2
- package/dist/protocol/messages/platform-orchestrator.d.ts +603 -258
- package/dist/protocol/messages/platform-orchestrator.js +131 -21
- package/dist/protocol/messages/run-events.d.ts +5 -5
- package/dist/protocol/messages/scaler-event.d.ts +3 -3
- package/dist/protocol/messages/source-registration.d.ts +56 -13
- package/dist/protocol/messages/source-registration.js +49 -6
- package/dist/protocol/session-policy.d.ts +20 -0
- package/dist/protocol/session-policy.js +25 -0
- package/dist/protocol/source-origin.d.ts +1 -1
- package/dist/provenance/attestation-origin.d.ts +1 -1
- package/dist/provenance/schema.d.ts +11 -11
- package/dist/provenance/verify.js +2 -1
- package/dist/provider/changed-files-fetcher.d.ts +21 -2
- package/dist/provider/check-run-conclusion.d.ts +2 -2
- package/dist/provider/check-status-poster.d.ts +23 -0
- package/dist/provider/index.d.ts +2 -2
- package/dist/registration/registerable-trigger-type.d.ts +14 -13
- package/dist/registration/registerable-trigger-type.js +1 -0
- package/dist/sandbox/capabilities.d.ts +6 -0
- package/dist/sandbox/capabilities.js +57 -0
- package/dist/scaler/scaler-backend-type.d.ts +1 -1
- package/dist/status/presentation.d.ts +89 -0
- package/dist/status/presentation.js +163 -0
- package/dist/trigger/compiled-matchers.d.ts +13 -0
- package/dist/trigger/compiled-matchers.js +44 -0
- package/dist/trigger/event-buckets.d.ts +44 -0
- package/dist/trigger/event-buckets.js +93 -0
- package/dist/trigger/matcher.d.ts +7 -3
- package/dist/trigger/matcher.js +53 -15
- package/dist/trigger/schedule-key.d.ts +14 -0
- package/dist/trigger/schedule-key.js +21 -0
- package/dist/trigger/trigger-event-type.d.ts +1 -1
- package/dist/trigger/trigger-event-type.js +2 -0
- package/dist/trigger/types.d.ts +178 -47
- package/dist/trigger/types.js +82 -24
- package/dist/webhook/event-types.d.ts +56 -0
- package/dist/webhook/event-types.js +59 -0
- package/dist/ws/ws-like.d.ts +13 -0
- package/package.json +26 -10
- package/sbom.spdx.json +10 -10
- package/dist/environment/index.d.ts +0 -6
- package/dist/environment/index.js +0 -5
- package/dist/environment/multi-env.d.ts +0 -30
- package/dist/environment/multi-env.js +0 -38
- package/dist/environment/scope-resolver.d.ts +0 -46
- package/dist/package-manager.d.ts +0 -20
- package/dist/protocol/messages/observe.d.ts +0 -76
- package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
- package/dist/protocol/messages/test-run.d.ts +0 -59
- package/dist/state-machine/index.d.ts +0 -2
- package/dist/state-machine/index.js +0 -3
- package/dist/state-machine/machine.d.ts +0 -34
- package/dist/state-machine/machine.js +0 -103
- package/dist/state-machine/types.d.ts +0 -34
- package/dist/state-machine/types.js +0 -15
- /package/dist/{environment → context}/host-match.d.ts +0 -0
- /package/dist/{environment → context}/scope-template.d.ts +0 -0
|
@@ -29,13 +29,13 @@ const DashboardWriteOperation = z.enum([
|
|
|
29
29
|
"secrets.scope.delete",
|
|
30
30
|
"variables.set",
|
|
31
31
|
"variables.delete",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
32
|
+
"contexts.create",
|
|
33
|
+
"contexts.update",
|
|
34
|
+
"contexts.test_access.set",
|
|
35
|
+
"contexts.delete",
|
|
36
|
+
"contexts.bindings.set",
|
|
37
|
+
"contexts.source_overrides.set",
|
|
38
|
+
"contexts.source_overrides.delete",
|
|
39
39
|
"held_runs.approve",
|
|
40
40
|
"held_runs.reject",
|
|
41
41
|
"event_dlq.retry",
|
|
@@ -59,13 +59,13 @@ const DASHBOARD_WRITE_OPERATION_VALUES = Object.freeze([
|
|
|
59
59
|
"secrets.scope.delete",
|
|
60
60
|
"variables.set",
|
|
61
61
|
"variables.delete",
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
62
|
+
"contexts.create",
|
|
63
|
+
"contexts.update",
|
|
64
|
+
"contexts.test_access.set",
|
|
65
|
+
"contexts.delete",
|
|
66
|
+
"contexts.bindings.set",
|
|
67
|
+
"contexts.source_overrides.set",
|
|
68
|
+
"contexts.source_overrides.delete",
|
|
69
69
|
"held_runs.approve",
|
|
70
70
|
"held_runs.reject",
|
|
71
71
|
"event_dlq.retry",
|
|
@@ -83,7 +83,7 @@ const DASHBOARD_WRITE_OPERATION_VALUES = Object.freeze([
|
|
|
83
83
|
const DashboardWriteCategory = z.enum([
|
|
84
84
|
"Secrets",
|
|
85
85
|
"Variables",
|
|
86
|
-
"
|
|
86
|
+
"Contexts",
|
|
87
87
|
"Bindings",
|
|
88
88
|
"Held runs",
|
|
89
89
|
"DLQ",
|
|
@@ -100,7 +100,7 @@ const DashboardWriteSensitivity = z.enum([
|
|
|
100
100
|
const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
101
101
|
{
|
|
102
102
|
name: "secrets.set",
|
|
103
|
-
wireMessageType: "dashboard.
|
|
103
|
+
wireMessageType: "dashboard.contexts.secrets.set",
|
|
104
104
|
category: "Secrets",
|
|
105
105
|
label: "Set secret value",
|
|
106
106
|
sensitivity: "plaintext",
|
|
@@ -108,7 +108,7 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
name: "secrets.delete",
|
|
111
|
-
wireMessageType: "dashboard.
|
|
111
|
+
wireMessageType: "dashboard.contexts.secrets.delete",
|
|
112
112
|
category: "Secrets",
|
|
113
113
|
label: "Delete secret",
|
|
114
114
|
sensitivity: "authority",
|
|
@@ -116,7 +116,7 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
name: "secrets.scope.create",
|
|
119
|
-
wireMessageType: "dashboard.
|
|
119
|
+
wireMessageType: "dashboard.contexts.secrets.scope.create",
|
|
120
120
|
category: "Secrets",
|
|
121
121
|
label: "Create secret scope",
|
|
122
122
|
sensitivity: "authority",
|
|
@@ -124,7 +124,7 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
|
124
124
|
},
|
|
125
125
|
{
|
|
126
126
|
name: "secrets.scope.rename",
|
|
127
|
-
wireMessageType: "dashboard.
|
|
127
|
+
wireMessageType: "dashboard.contexts.secrets.scope.rename",
|
|
128
128
|
category: "Secrets",
|
|
129
129
|
label: "Rename secret scope",
|
|
130
130
|
sensitivity: "authority",
|
|
@@ -132,7 +132,7 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
134
|
name: "secrets.scope.delete",
|
|
135
|
-
wireMessageType: "dashboard.
|
|
135
|
+
wireMessageType: "dashboard.contexts.secrets.scope.delete",
|
|
136
136
|
category: "Secrets",
|
|
137
137
|
label: "Delete secret scope",
|
|
138
138
|
sensitivity: "authority",
|
|
@@ -140,7 +140,7 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
name: "variables.set",
|
|
143
|
-
wireMessageType: "dashboard.
|
|
143
|
+
wireMessageType: "dashboard.contexts.variables.set",
|
|
144
144
|
category: "Variables",
|
|
145
145
|
label: "Set variable value",
|
|
146
146
|
sensitivity: "plaintext",
|
|
@@ -148,67 +148,67 @@ const DASHBOARD_WRITE_OPERATIONS = Object.freeze([
|
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
150
|
name: "variables.delete",
|
|
151
|
-
wireMessageType: "dashboard.
|
|
151
|
+
wireMessageType: "dashboard.contexts.variables.delete",
|
|
152
152
|
category: "Variables",
|
|
153
153
|
label: "Delete variable",
|
|
154
154
|
sensitivity: "authority",
|
|
155
155
|
cliEquivalent: "kici-admin variable delete"
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
name: "
|
|
159
|
-
wireMessageType: "dashboard.
|
|
160
|
-
category: "
|
|
161
|
-
label: "Create
|
|
158
|
+
name: "contexts.create",
|
|
159
|
+
wireMessageType: "dashboard.contexts.create",
|
|
160
|
+
category: "Contexts",
|
|
161
|
+
label: "Create context",
|
|
162
162
|
sensitivity: "authority",
|
|
163
|
-
cliEquivalent: "kici-admin
|
|
163
|
+
cliEquivalent: "kici-admin context create"
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
|
-
name: "
|
|
167
|
-
wireMessageType: "dashboard.
|
|
168
|
-
category: "
|
|
169
|
-
label: "Update
|
|
166
|
+
name: "contexts.update",
|
|
167
|
+
wireMessageType: "dashboard.contexts.update",
|
|
168
|
+
category: "Contexts",
|
|
169
|
+
label: "Update context",
|
|
170
170
|
sensitivity: "authority",
|
|
171
|
-
cliEquivalent: "kici-admin
|
|
171
|
+
cliEquivalent: "kici-admin context set-policy"
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
|
-
name: "
|
|
175
|
-
wireMessageType: "dashboard.
|
|
176
|
-
category: "
|
|
177
|
-
label: "Set
|
|
174
|
+
name: "contexts.test_access.set",
|
|
175
|
+
wireMessageType: "dashboard.contexts.test_access.set",
|
|
176
|
+
category: "Contexts",
|
|
177
|
+
label: "Set context test access",
|
|
178
178
|
sensitivity: "authority",
|
|
179
|
-
cliEquivalent: "kici-admin
|
|
179
|
+
cliEquivalent: "kici-admin context set-policy --allow-local-execution"
|
|
180
180
|
},
|
|
181
181
|
{
|
|
182
|
-
name: "
|
|
183
|
-
wireMessageType: "dashboard.
|
|
184
|
-
category: "
|
|
185
|
-
label: "Delete
|
|
182
|
+
name: "contexts.delete",
|
|
183
|
+
wireMessageType: "dashboard.contexts.delete",
|
|
184
|
+
category: "Contexts",
|
|
185
|
+
label: "Delete context",
|
|
186
186
|
sensitivity: "authority",
|
|
187
|
-
cliEquivalent: "kici-admin
|
|
187
|
+
cliEquivalent: "kici-admin context delete"
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
|
-
name: "
|
|
191
|
-
wireMessageType: "dashboard.
|
|
190
|
+
name: "contexts.bindings.set",
|
|
191
|
+
wireMessageType: "dashboard.contexts.bindings.set",
|
|
192
192
|
category: "Bindings",
|
|
193
|
-
label: "Set
|
|
193
|
+
label: "Set context binding",
|
|
194
194
|
sensitivity: "authority",
|
|
195
|
-
cliEquivalent: "kici-admin
|
|
195
|
+
cliEquivalent: "kici-admin context bind"
|
|
196
196
|
},
|
|
197
197
|
{
|
|
198
|
-
name: "
|
|
199
|
-
wireMessageType: "dashboard.
|
|
198
|
+
name: "contexts.source_overrides.set",
|
|
199
|
+
wireMessageType: "dashboard.contexts.source-overrides.set",
|
|
200
200
|
category: "Bindings",
|
|
201
201
|
label: "Set source override",
|
|
202
202
|
sensitivity: "authority",
|
|
203
|
-
cliEquivalent: "kici-admin
|
|
203
|
+
cliEquivalent: "kici-admin context source-override set"
|
|
204
204
|
},
|
|
205
205
|
{
|
|
206
|
-
name: "
|
|
207
|
-
wireMessageType: "dashboard.
|
|
206
|
+
name: "contexts.source_overrides.delete",
|
|
207
|
+
wireMessageType: "dashboard.contexts.source-overrides.delete",
|
|
208
208
|
category: "Bindings",
|
|
209
209
|
label: "Delete source override",
|
|
210
210
|
sensitivity: "authority",
|
|
211
|
-
cliEquivalent: "kici-admin
|
|
211
|
+
cliEquivalent: "kici-admin context source-override delete"
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
name: "held_runs.approve",
|
|
@@ -331,36 +331,110 @@ function getDashboardWriteOperationsBySensitivity(sensitivity) {
|
|
|
331
331
|
return DASHBOARD_WRITE_OPERATIONS.filter((d) => d.sensitivity === sensitivity);
|
|
332
332
|
}
|
|
333
333
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
334
|
+
* Per-operation dashboard-write posture.
|
|
335
|
+
*
|
|
336
|
+
* - `permissive` — the write is accepted and its plaintext value transits
|
|
337
|
+
* the hosted Platform process (today's default; the absent-key default).
|
|
338
|
+
* - `encrypted` — the write is accepted but the value is sealed in the
|
|
339
|
+
* browser to the orchestrator's published X25519 key, so the Platform
|
|
340
|
+
* relays only opaque ciphertext. Valid ONLY for `plaintext`-sensitivity
|
|
341
|
+
* operations (`secrets.set`, `variables.set`) — an operation with no
|
|
342
|
+
* plaintext payload has nothing to seal.
|
|
343
|
+
* - `disabled` — the write is refused; the operator must use the CLI.
|
|
344
|
+
*
|
|
345
|
+
* Absent from the sparse map ⇒ `permissive`.
|
|
346
|
+
*/
|
|
347
|
+
const DashboardWritePolicyState = z.enum([
|
|
348
|
+
"permissive",
|
|
349
|
+
"encrypted",
|
|
350
|
+
"disabled"
|
|
351
|
+
]);
|
|
352
|
+
/**
|
|
353
|
+
* Coerce a single stored / on-the-wire policy value to a
|
|
354
|
+
* {@link DashboardWritePolicyState}. Older orchestrators (and pre-migration
|
|
355
|
+
* JSONB rows) carry the legacy boolean shape: `true` (enabled/permissive) and
|
|
356
|
+
* `false` (disabled). New peers carry the enum string directly. This keeps the
|
|
357
|
+
* protected wire + storage surfaces backward-compatible during the deprecation
|
|
358
|
+
* window — a boolean is never rejected, it is translated.
|
|
339
359
|
*/
|
|
340
|
-
|
|
360
|
+
function coerceDashboardWritePolicyValue(value) {
|
|
361
|
+
if (value === true) return "permissive";
|
|
362
|
+
if (value === false) return "disabled";
|
|
363
|
+
const parsed = DashboardWritePolicyState.safeParse(value);
|
|
364
|
+
return parsed.success ? parsed.data : "permissive";
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Validates a sparse policy map. Accepts BOTH the enum-string shape and the
|
|
368
|
+
* legacy boolean shape (coerced), so an older orchestrator's boolean map and a
|
|
369
|
+
* pre-migration JSONB row both parse. `encrypted` is rejected for any operation
|
|
370
|
+
* whose sensitivity is not `plaintext` (nothing to seal without a plaintext
|
|
371
|
+
* payload; the signing half that would cover authority/dispatch ops is a
|
|
372
|
+
* separate feature). Use this where the value is required but may be empty
|
|
373
|
+
* (e.g. the JSONB column on the orch). For optional fields on outer schemas,
|
|
374
|
+
* embed `dashboardWritePolicyMap` directly with `.optional()` so omission stays
|
|
375
|
+
* as `undefined` rather than being coerced to `{}`.
|
|
376
|
+
*/
|
|
377
|
+
const dashboardWritePolicyMap = z.partialRecord(DashboardWriteOperation, z.union([z.boolean(), DashboardWritePolicyState])).transform((map) => {
|
|
378
|
+
const out = {};
|
|
379
|
+
for (const [op, value] of Object.entries(map)) out[op] = coerceDashboardWritePolicyValue(value);
|
|
380
|
+
return out;
|
|
381
|
+
}).superRefine((map, ctx) => {
|
|
382
|
+
for (const [op, state] of Object.entries(map)) {
|
|
383
|
+
if (state !== "encrypted") continue;
|
|
384
|
+
if (DASHBOARD_WRITE_OPERATIONS_BY_NAME.get(op)?.sensitivity !== "plaintext") ctx.addIssue({
|
|
385
|
+
code: "custom",
|
|
386
|
+
message: `"encrypted" is only valid for plaintext operations, not "${op}"`,
|
|
387
|
+
path: [op]
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
});
|
|
341
391
|
const dashboardWritePolicyMapSchema = dashboardWritePolicyMap.default({});
|
|
342
392
|
/**
|
|
343
|
-
* Resolve the effective
|
|
344
|
-
* policy map. Treats `undefined` as
|
|
393
|
+
* Resolve the effective posture of an operation given a (possibly sparse)
|
|
394
|
+
* policy map. Treats `undefined` as the permissive default.
|
|
395
|
+
*/
|
|
396
|
+
function resolvePolicyState(policy, op) {
|
|
397
|
+
const raw = policy?.[op];
|
|
398
|
+
if (raw === void 0) return "permissive";
|
|
399
|
+
return coerceDashboardWritePolicyValue(raw);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Resolve the effective enabled state of an operation. `true` unless the
|
|
403
|
+
* posture is `disabled`. Convenience for the many read-only "may this write
|
|
404
|
+
* proceed at all?" call sites.
|
|
345
405
|
*/
|
|
346
406
|
function isDashboardWriteOperationEnabled(policy, op) {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
407
|
+
return resolvePolicyState(policy, op) !== "disabled";
|
|
408
|
+
}
|
|
409
|
+
/** True only when the operation's posture is `encrypted`. */
|
|
410
|
+
function isEncryptedState(policy, op) {
|
|
411
|
+
return resolvePolicyState(policy, op) === "encrypted";
|
|
350
412
|
}
|
|
351
413
|
/**
|
|
352
|
-
* Expand a (possibly sparse) policy map into the full effective
|
|
353
|
-
* for all 27 operations. Operations the policy doesn't mention come
|
|
354
|
-
* back as `true` (permissive).
|
|
355
|
-
* the
|
|
356
|
-
*
|
|
414
|
+
* Expand a (possibly sparse) policy map into the full effective enabled
|
|
415
|
+
* boolean for all 27 operations. Operations the policy doesn't mention come
|
|
416
|
+
* back as `true` (permissive). Retained for existing consumers that only need
|
|
417
|
+
* the enabled/disabled bit; {@link resolveFullPolicyStateView} exposes the
|
|
418
|
+
* richer tri-state.
|
|
357
419
|
*/
|
|
358
420
|
function resolveFullPolicyView(policy) {
|
|
359
421
|
const out = {};
|
|
360
422
|
for (const descriptor of DASHBOARD_WRITE_OPERATIONS) out[descriptor.name] = isDashboardWriteOperationEnabled(policy, descriptor.name);
|
|
361
423
|
return out;
|
|
362
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Expand a (possibly sparse) policy map into the full tri-state posture for
|
|
427
|
+
* all 27 operations. Used by the orch HTTP admin response, the WS
|
|
428
|
+
* `orch.capabilities` broadcast, and the dashboard's policy page so consumers
|
|
429
|
+
* see the full picture (including which plaintext ops are `encrypted`), not the
|
|
430
|
+
* sparse storage shape.
|
|
431
|
+
*/
|
|
432
|
+
function resolveFullPolicyStateView(policy) {
|
|
433
|
+
const out = {};
|
|
434
|
+
for (const descriptor of DASHBOARD_WRITE_OPERATIONS) out[descriptor.name] = resolvePolicyState(policy, descriptor.name);
|
|
435
|
+
return out;
|
|
436
|
+
}
|
|
363
437
|
//#endregion
|
|
364
|
-
export { DASHBOARD_WRITE_OPERATIONS, DASHBOARD_WRITE_OPERATIONS_BY_NAME, DASHBOARD_WRITE_OPERATIONS_BY_WIRE_TYPE, DASHBOARD_WRITE_OPERATION_VALUES, DashboardWriteCategory, DashboardWriteOperation, DashboardWriteSensitivity, dashboardWritePolicyMap, dashboardWritePolicyMapSchema, getDashboardWriteOperationDescriptor, getDashboardWriteOperationsByCategory, getDashboardWriteOperationsBySensitivity, isDashboardWriteOperationEnabled, resolveFullPolicyView };
|
|
438
|
+
export { DASHBOARD_WRITE_OPERATIONS, DASHBOARD_WRITE_OPERATIONS_BY_NAME, DASHBOARD_WRITE_OPERATIONS_BY_WIRE_TYPE, DASHBOARD_WRITE_OPERATION_VALUES, DashboardWriteCategory, DashboardWriteOperation, DashboardWritePolicyState, DashboardWriteSensitivity, coerceDashboardWritePolicyValue, dashboardWritePolicyMap, dashboardWritePolicyMapSchema, getDashboardWriteOperationDescriptor, getDashboardWriteOperationsByCategory, getDashboardWriteOperationsBySensitivity, isDashboardWriteOperationEnabled, isEncryptedState, resolveFullPolicyStateView, resolveFullPolicyView, resolvePolicyState };
|
|
365
439
|
|
|
366
440
|
//# sourceMappingURL=dashboard-write-operations.js.map
|