@kya-os/checkpoint-shared 1.4.0 → 1.5.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/CHANGELOG.md +32 -0
- package/dist/beacon-types/index.d.mts +441 -432
- package/dist/beacon-types/index.d.mts.map +1 -0
- package/dist/beacon-types/index.d.ts +441 -432
- package/dist/beacon-types/index.d.ts.map +1 -0
- package/dist/beacon-types/index.js +198 -182
- package/dist/beacon-types/index.mjs +197 -179
- package/dist/beacon-types/index.mjs.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts.map +1 -0
- package/dist/browser-posture-cookie.d.mts +2 -0
- package/dist/browser-posture-cookie.d.ts +2 -0
- package/dist/browser-posture-cookie.js +1 -0
- package/dist/browser-posture-cookie.mjs +2 -0
- package/dist/browser-posture-cookie.mjs.map +1 -0
- package/dist/browser-posture-report.d.mts +48 -44
- package/dist/browser-posture-report.d.mts.map +1 -0
- package/dist/browser-posture-report.d.ts +48 -44
- package/dist/browser-posture-report.d.ts.map +1 -0
- package/dist/browser-posture-report.js +1 -1
- package/dist/browser-posture-report.mjs +2 -1
- package/dist/browser-posture-report.mjs.map +1 -0
- package/dist/browser-posture.d.mts +80 -75
- package/dist/browser-posture.d.mts.map +1 -0
- package/dist/browser-posture.d.ts +80 -75
- package/dist/browser-posture.d.ts.map +1 -0
- package/dist/browser-posture.js +159 -18993
- package/dist/browser-posture.mjs +158 -18990
- package/dist/browser-posture.mjs.map +1 -0
- package/dist/browser.d.mts +323 -316
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.d.ts +323 -316
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +2 -1
- package/dist/browser.mjs.map +1 -0
- package/dist/canonical-signer/index.d.mts +38 -33
- package/dist/canonical-signer/index.d.mts.map +1 -0
- package/dist/canonical-signer/index.d.ts +38 -33
- package/dist/canonical-signer/index.d.ts.map +1 -0
- package/dist/canonical-signer/index.js +411 -181
- package/dist/canonical-signer/index.mjs +383 -175
- package/dist/canonical-signer/index.mjs.map +1 -0
- package/dist/clearance.d.mts +30 -0
- package/dist/clearance.d.mts.map +1 -0
- package/dist/clearance.d.ts +30 -0
- package/dist/clearance.d.ts.map +1 -0
- package/dist/clearance.js +120 -0
- package/dist/clearance.mjs +112 -0
- package/dist/clearance.mjs.map +1 -0
- package/dist/client-ip-1y2iXAYW.js +237 -0
- package/dist/client-ip-HOfe6ucV.mjs +215 -0
- package/dist/client-ip-HOfe6ucV.mjs.map +1 -0
- package/dist/deploy/index.d.mts +339 -339
- package/dist/deploy/index.d.mts.map +1 -0
- package/dist/deploy/index.d.ts +339 -339
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +505 -413
- package/dist/deploy/index.mjs +504 -410
- package/dist/deploy/index.mjs.map +1 -0
- package/dist/errors/index.d.mts +101 -101
- package/dist/errors/index.d.mts.map +1 -0
- package/dist/errors/index.d.ts +101 -101
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +341 -314
- package/dist/errors/index.mjs +340 -311
- package/dist/errors/index.mjs.map +1 -0
- package/dist/external-jr_S4iSS.d.mts +4187 -0
- package/dist/external-jr_S4iSS.d.mts.map +1 -0
- package/dist/external-jr_S4iSS.d.ts +4187 -0
- package/dist/external-jr_S4iSS.d.ts.map +1 -0
- package/dist/gateway/index.d.mts +138 -132
- package/dist/gateway/index.d.mts.map +1 -0
- package/dist/gateway/index.d.ts +138 -132
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +117 -81
- package/dist/gateway/index.mjs +116 -78
- package/dist/gateway/index.mjs.map +1 -0
- package/dist/gateway-client-ip.d.mts +59 -0
- package/dist/gateway-client-ip.d.mts.map +1 -0
- package/dist/gateway-client-ip.d.ts +59 -0
- package/dist/gateway-client-ip.d.ts.map +1 -0
- package/dist/gateway-client-ip.js +149 -0
- package/dist/gateway-client-ip.mjs +139 -0
- package/dist/gateway-client-ip.mjs.map +1 -0
- package/dist/index.d.mts +14895 -14240
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +14895 -14240
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15180 -31025
- package/dist/index.mjs +15065 -30942
- package/dist/index.mjs.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.mts +45 -44
- package/dist/mcpi/agentshield-api/index.d.mts.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.ts +45 -44
- package/dist/mcpi/agentshield-api/index.d.ts.map +1 -0
- package/dist/mcpi/agentshield-api/index.js +0 -2
- package/dist/mcpi/agentshield-api/index.mjs +1 -1
- package/dist/mcpi/approval-grant/index.d.mts +63 -61
- package/dist/mcpi/approval-grant/index.d.mts.map +1 -0
- package/dist/mcpi/approval-grant/index.d.ts +63 -61
- package/dist/mcpi/approval-grant/index.d.ts.map +1 -0
- package/dist/mcpi/approval-grant/index.js +220 -140
- package/dist/mcpi/approval-grant/index.mjs +219 -137
- package/dist/mcpi/approval-grant/index.mjs.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.mts +2323 -2318
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.ts +2323 -2318
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -0
- package/dist/mcpi/dashboard-config/index.js +605 -458
- package/dist/mcpi/dashboard-config/index.mjs +604 -455
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.mts +10 -8
- package/dist/mcpi/multibase-ed25519.d.mts.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.ts +10 -8
- package/dist/mcpi/multibase-ed25519.d.ts.map +1 -0
- package/dist/mcpi/multibase-ed25519.js +182 -106
- package/dist/mcpi/multibase-ed25519.mjs +181 -103
- package/dist/mcpi/multibase-ed25519.mjs.map +1 -0
- package/dist/patterns-CkRVOdtV.js +243 -0
- package/dist/patterns-DzkGy_qk.mjs +173 -0
- package/dist/patterns-DzkGy_qk.mjs.map +1 -0
- package/dist/project-verification-key-C3L5rd8a.js +41 -0
- package/dist/project-verification-key-CgSVX9_m.mjs +37 -0
- package/dist/project-verification-key-CgSVX9_m.mjs.map +1 -0
- package/dist/rolldown-runtime-iY2fYEqi.mjs +19 -0
- package/dist/schemas-BmjNLAE7.js +5677 -0
- package/dist/schemas-DxY-dk9y.mjs +5511 -0
- package/dist/schemas-DxY-dk9y.mjs.map +1 -0
- package/dist/signals/index.d.mts +125 -115
- package/dist/signals/index.d.mts.map +1 -0
- package/dist/signals/index.d.ts +125 -115
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/index.js +1693 -1536
- package/dist/signals/index.mjs +1692 -1533
- package/dist/signals/index.mjs.map +1 -0
- package/dist/test-fixtures/index.d.mts +124 -119
- package/dist/test-fixtures/index.d.mts.map +1 -0
- package/dist/test-fixtures/index.d.ts +124 -119
- package/dist/test-fixtures/index.d.ts.map +1 -0
- package/dist/test-fixtures/index.js +460 -228
- package/dist/test-fixtures/index.mjs +459 -225
- package/dist/test-fixtures/index.mjs.map +1 -0
- package/dist/tool-protection/index.d.mts +343 -343
- package/dist/tool-protection/index.d.mts.map +1 -0
- package/dist/tool-protection/index.d.ts +343 -343
- package/dist/tool-protection/index.d.ts.map +1 -0
- package/dist/tool-protection/index.js +366 -285
- package/dist/tool-protection/index.mjs +365 -282
- package/dist/tool-protection/index.mjs.map +1 -0
- package/fixtures/bot-signal-resolution.json +142 -0
- package/fixtures/browser-posture-claims.json +421 -0
- package/fixtures/browser-posture-headers.json +46 -0
- package/fixtures/detection/reason-codes.json +10 -1
- package/fixtures/kya-http/challenge.delegation.fetcher-200.json +9 -3
- package/fixtures/kya-http/challenge.delegation.full.json +9 -3
- package/fixtures/kya-http/challenge.delegation.minimal.json +9 -3
- package/fixtures/kya-http/error-codes.json +7 -2
- package/package.json +20 -6
package/dist/deploy/index.js
CHANGED
|
@@ -1,437 +1,529 @@
|
|
|
1
|
-
'
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let zod = require("zod");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
4
|
+
//#region src/deploy/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Managed Agent Deployment + Compute Process Contracts (checkpoint-owned subset)
|
|
7
|
+
*
|
|
8
|
+
* Schemas for the managed hosting tier (agents on Fly.io) and the
|
|
9
|
+
* `@kya-os/compute` ⇄ Checkpoint heartbeat/config/control protocol.
|
|
10
|
+
*
|
|
11
|
+
* Ported into checkpoint-shared from `@kya-os/contracts/agent-deployment` +
|
|
12
|
+
* `@kya-os/contracts/compute` as part of the E6 / C-series decommission
|
|
13
|
+
* (#2914 / #2917). Only the symbols re-exported by
|
|
14
|
+
* `apps/web/lib/types/molti-deploy-contracts.ts` (plus their transitive deps —
|
|
15
|
+
* `DidStringSchema`, the compute command sub-schemas) are ported.
|
|
16
|
+
*
|
|
17
|
+
* @module @kya-os/checkpoint-shared/deploy
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The KYA-OS activity-events ingest path (SPEC-EVENTS v0.1 batch endpoint).
|
|
21
|
+
*
|
|
22
|
+
* This is a CROSS-REPO CONTRACT. The Tier 2 worker runtime
|
|
23
|
+
* (`@kya-os/mcp-i-cloudflare`) POSTs `tool.invoked` (and the other SPEC-EVENTS
|
|
24
|
+
* types) to `${AGENTSHIELD_API_URL}${KYA_OS_EVENTS_PATH}`, authenticated by the
|
|
25
|
+
* project API key. Checkpoint serves the batch ingest at this exact path
|
|
26
|
+
* (`apps/web/app${KYA_OS_EVENTS_PATH}/route.ts`) and fans events out into the
|
|
27
|
+
* `detections` table behind `/activity`.
|
|
28
|
+
*
|
|
29
|
+
* Managed deploy deliberately injects NO `KYA_OS_EVENTS_*` secret and relies on
|
|
30
|
+
* this derivation instead, so the two sides agree only by matching this literal.
|
|
31
|
+
* Changing it on either side silently drops all managed activity — it is pinned
|
|
32
|
+
* by a contract test. Keep this value and the worker's derivation in sync.
|
|
33
|
+
*/
|
|
34
|
+
const KYA_OS_EVENTS_PATH = "/api/v1/kya-os/events";
|
|
35
|
+
/**
|
|
36
|
+
* Validated DID string schema.
|
|
37
|
+
* Reusable across all contract files that reference agent DIDs.
|
|
38
|
+
*
|
|
39
|
+
* Format: `did:<method>:<method-specific-id>`
|
|
40
|
+
* - method: 1+ lowercase alphanumeric chars
|
|
41
|
+
* - method-specific-id: 1+ non-whitespace chars
|
|
42
|
+
*
|
|
43
|
+
* Examples: `did:key:z6Mk...`, `did:web:example.com`
|
|
44
|
+
*/
|
|
45
|
+
const DidStringSchema = zod.z.string().min(8, "DID must be at least 8 characters").regex(/^did:[a-z0-9]+:\S+$/, "DID must match format did:<method>:<method-specific-id>");
|
|
46
|
+
/**
|
|
47
|
+
* Fly.io deployment regions.
|
|
48
|
+
* Enumerated to prevent arbitrary strings from being accepted.
|
|
49
|
+
* @see https://fly.io/docs/reference/regions/
|
|
50
|
+
*/
|
|
51
|
+
const FlyRegionSchema = zod.z.enum([
|
|
52
|
+
"ams",
|
|
53
|
+
"arn",
|
|
54
|
+
"atl",
|
|
55
|
+
"bog",
|
|
56
|
+
"bos",
|
|
57
|
+
"cdg",
|
|
58
|
+
"den",
|
|
59
|
+
"dfw",
|
|
60
|
+
"ewr",
|
|
61
|
+
"eze",
|
|
62
|
+
"fra",
|
|
63
|
+
"gdl",
|
|
64
|
+
"gig",
|
|
65
|
+
"gru",
|
|
66
|
+
"hkg",
|
|
67
|
+
"iad",
|
|
68
|
+
"jnb",
|
|
69
|
+
"lax",
|
|
70
|
+
"lhr",
|
|
71
|
+
"mad",
|
|
72
|
+
"mia",
|
|
73
|
+
"nrt",
|
|
74
|
+
"ord",
|
|
75
|
+
"otp",
|
|
76
|
+
"phx",
|
|
77
|
+
"qro",
|
|
78
|
+
"scl",
|
|
79
|
+
"sea",
|
|
80
|
+
"sin",
|
|
81
|
+
"sjc",
|
|
82
|
+
"syd",
|
|
83
|
+
"waw",
|
|
84
|
+
"yul",
|
|
85
|
+
"yyz"
|
|
86
|
+
]);
|
|
87
|
+
/**
|
|
88
|
+
* Hosting mode discriminator — differentiates between deploy backends:
|
|
89
|
+
* - `byok`: self-managed deploy in the customer's own Cloudflare account
|
|
90
|
+
* (customer runs the deploy themselves).
|
|
91
|
+
* - `managed`: platform-managed deploy in our Cloudflare account via Workers
|
|
92
|
+
* for Platforms (dispatch namespace).
|
|
93
|
+
* - `managed-byoa`: platform-managed deploy that lands in the customer's own
|
|
94
|
+
* ("bring your own account") Cloudflare account via the standard Workers API,
|
|
95
|
+
* after the org connects Cloudflare over OAuth/token (KYA-906-C).
|
|
96
|
+
*/
|
|
97
|
+
const HostingModeSchema = zod.z.enum([
|
|
98
|
+
"byok",
|
|
99
|
+
"managed",
|
|
100
|
+
"managed-byoa"
|
|
101
|
+
]);
|
|
102
|
+
const AuditAssuranceProfileSchema = zod.z.enum([
|
|
103
|
+
"AAP-0",
|
|
104
|
+
"AAP-1",
|
|
105
|
+
"AAP-2",
|
|
106
|
+
"AAP-3",
|
|
107
|
+
"AAP-4"
|
|
108
|
+
]);
|
|
109
|
+
const AuditDeliveryModeSchema = zod.z.enum([
|
|
110
|
+
"best-effort",
|
|
111
|
+
"buffered",
|
|
112
|
+
"required"
|
|
77
113
|
]);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Serializable request contract shared by the wizard and every deploy lane.
|
|
116
|
+
* `requestedProfile` is intent, never an assurance claim. Only readiness
|
|
117
|
+
* evaluation against observed runtime capabilities yields `effectiveProfile`.
|
|
118
|
+
*/
|
|
119
|
+
const AuditDeploymentConfigSchema = zod.z.object({
|
|
120
|
+
enabled: zod.z.boolean(),
|
|
121
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
122
|
+
delivery: AuditDeliveryModeSchema,
|
|
123
|
+
evidenceMode: zod.z.enum([
|
|
124
|
+
"none",
|
|
125
|
+
"encrypted-separate",
|
|
126
|
+
"encrypted-inline"
|
|
127
|
+
]),
|
|
128
|
+
retentionClass: zod.z.string().min(1).max(128),
|
|
129
|
+
retentionDays: zod.z.number().int().min(0).max(3650),
|
|
130
|
+
residency: zod.z.enum([
|
|
131
|
+
"inherit-project",
|
|
132
|
+
"us",
|
|
133
|
+
"eu",
|
|
134
|
+
"global"
|
|
135
|
+
]),
|
|
136
|
+
keyCustody: zod.z.enum([
|
|
137
|
+
"none",
|
|
138
|
+
"checkpoint-managed",
|
|
139
|
+
"customer-managed-kms"
|
|
140
|
+
]),
|
|
141
|
+
recorderTopology: zod.z.enum([
|
|
142
|
+
"none",
|
|
143
|
+
"self-hosted",
|
|
144
|
+
"managed",
|
|
145
|
+
"verified-mirror"
|
|
146
|
+
])
|
|
91
147
|
}).strict().superRefine((value, context) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
if (!value.enabled && (value.keyCustody !== "none" || value.recorderTopology !== "none")) {
|
|
114
|
-
context.addIssue({
|
|
115
|
-
code: zod.z.ZodIssueCode.custom,
|
|
116
|
-
message: "Disabled audit configuration cannot claim key custody or recorder topology"
|
|
117
|
-
});
|
|
118
|
-
}
|
|
148
|
+
if (!value.enabled && value.requestedProfile !== "AAP-0") context.addIssue({
|
|
149
|
+
code: zod.z.ZodIssueCode.custom,
|
|
150
|
+
path: ["requestedProfile"],
|
|
151
|
+
message: "Disabled audit configuration must request AAP-0"
|
|
152
|
+
});
|
|
153
|
+
if (value.enabled && value.requestedProfile === "AAP-0") context.addIssue({
|
|
154
|
+
code: zod.z.ZodIssueCode.custom,
|
|
155
|
+
path: ["requestedProfile"],
|
|
156
|
+
message: "Enabled audit configuration must request AAP-1 or higher"
|
|
157
|
+
});
|
|
158
|
+
if (Number(value.requestedProfile.slice(-1)) >= 2 && value.delivery === "best-effort") context.addIssue({
|
|
159
|
+
code: zod.z.ZodIssueCode.custom,
|
|
160
|
+
path: ["delivery"],
|
|
161
|
+
message: "AAP-2 or higher cannot use best-effort delivery"
|
|
162
|
+
});
|
|
163
|
+
if (!value.enabled && (value.keyCustody !== "none" || value.recorderTopology !== "none")) context.addIssue({
|
|
164
|
+
code: zod.z.ZodIssueCode.custom,
|
|
165
|
+
message: "Disabled audit configuration cannot claim key custody or recorder topology"
|
|
166
|
+
});
|
|
119
167
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
168
|
+
/** Applied only when a user starts a new platform-managed deployment. */
|
|
169
|
+
const NEW_MANAGED_AUDIT_DEPLOYMENT_DEFAULT = Object.freeze({
|
|
170
|
+
enabled: true,
|
|
171
|
+
requestedProfile: "AAP-2",
|
|
172
|
+
delivery: "buffered",
|
|
173
|
+
evidenceMode: "encrypted-separate",
|
|
174
|
+
retentionClass: "integrity-ledger",
|
|
175
|
+
retentionDays: 365,
|
|
176
|
+
residency: "inherit-project",
|
|
177
|
+
keyCustody: "checkpoint-managed",
|
|
178
|
+
recorderTopology: "managed"
|
|
130
179
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Missing audit config in an already persisted manifest is always AAP-0.
|
|
182
|
+
* This prevents a dashboard or redeploy from silently upgrading old workers.
|
|
183
|
+
*/
|
|
184
|
+
const ABSENT_AUDIT_DEPLOYMENT_CONFIG = Object.freeze({
|
|
185
|
+
enabled: false,
|
|
186
|
+
requestedProfile: "AAP-0",
|
|
187
|
+
delivery: "best-effort",
|
|
188
|
+
evidenceMode: "none",
|
|
189
|
+
retentionClass: "none",
|
|
190
|
+
retentionDays: 0,
|
|
191
|
+
residency: "inherit-project",
|
|
192
|
+
keyCustody: "none",
|
|
193
|
+
recorderTopology: "none"
|
|
141
194
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
195
|
+
const AuditRuntimeCapabilitiesSchema = zod.z.object({
|
|
196
|
+
recorderTopology: zod.z.enum([
|
|
197
|
+
"none",
|
|
198
|
+
"self-hosted",
|
|
199
|
+
"managed",
|
|
200
|
+
"verified-mirror"
|
|
201
|
+
]),
|
|
202
|
+
delivery: AuditDeliveryModeSchema,
|
|
203
|
+
journalDurability: zod.z.enum([
|
|
204
|
+
"none",
|
|
205
|
+
"ephemeral",
|
|
206
|
+
"durable"
|
|
207
|
+
]),
|
|
208
|
+
atomicAppend: zod.z.boolean(),
|
|
209
|
+
sourceHighWater: zod.z.boolean(),
|
|
210
|
+
merkleCheckpoints: zod.z.boolean(),
|
|
211
|
+
independentObservation: zod.z.boolean(),
|
|
212
|
+
supportingAnchors: zod.z.array(zod.z.enum([
|
|
213
|
+
"worm",
|
|
214
|
+
"rfc3161",
|
|
215
|
+
"scitt"
|
|
216
|
+
])),
|
|
217
|
+
evidenceRetention: zod.z.enum([
|
|
218
|
+
"none",
|
|
219
|
+
"inline",
|
|
220
|
+
"separate"
|
|
221
|
+
])
|
|
152
222
|
}).strict();
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
).min(1),
|
|
163
|
-
bundleHash: zod.z.string().min(1).max(256).optional()
|
|
223
|
+
const AuditRuntimeCanaryResultSchema = zod.z.object({
|
|
224
|
+
passed: zod.z.boolean(),
|
|
225
|
+
observedAt: zod.z.number().int().nonnegative(),
|
|
226
|
+
capabilities: AuditRuntimeCapabilitiesSchema,
|
|
227
|
+
checks: zod.z.array(zod.z.object({
|
|
228
|
+
id: zod.z.string().min(1).max(128),
|
|
229
|
+
passed: zod.z.boolean()
|
|
230
|
+
}).strict()).min(1),
|
|
231
|
+
bundleHash: zod.z.string().min(1).max(256).optional()
|
|
164
232
|
}).strict().superRefine((value, context) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
});
|
|
171
|
-
}
|
|
233
|
+
if (value.passed !== value.checks.every((check) => check.passed)) context.addIssue({
|
|
234
|
+
code: zod.z.ZodIssueCode.custom,
|
|
235
|
+
path: ["passed"],
|
|
236
|
+
message: "Canary result must equal the aggregate of its mechanical checks"
|
|
237
|
+
});
|
|
172
238
|
});
|
|
173
239
|
function requiredAuditRuntimeCanaryChecks(capabilities) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
240
|
+
const checks = [
|
|
241
|
+
"recorder_round_trip",
|
|
242
|
+
"verified_receipt",
|
|
243
|
+
"idempotent_retry",
|
|
244
|
+
"event_identity_conflict",
|
|
245
|
+
"source_state"
|
|
246
|
+
];
|
|
247
|
+
if (capabilities.delivery === "buffered") checks.push("buffered_outbox");
|
|
248
|
+
if (capabilities.evidenceRetention !== "none") checks.push("evidence_write_verified");
|
|
249
|
+
return checks;
|
|
184
250
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
251
|
+
const AuditDeploymentReadinessSchema = zod.z.object({
|
|
252
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
253
|
+
effectiveProfile: AuditAssuranceProfileSchema,
|
|
254
|
+
status: zod.z.enum([
|
|
255
|
+
"disabled",
|
|
256
|
+
"ready",
|
|
257
|
+
"degraded"
|
|
258
|
+
]),
|
|
259
|
+
capabilities: AuditRuntimeCapabilitiesSchema.nullable(),
|
|
260
|
+
canary: AuditRuntimeCanaryResultSchema.nullable(),
|
|
261
|
+
reasonCodes: zod.z.array(zod.z.string().min(1).max(128))
|
|
192
262
|
}).strict();
|
|
193
|
-
|
|
263
|
+
const PROFILE_BY_LEVEL = [
|
|
264
|
+
"AAP-0",
|
|
265
|
+
"AAP-1",
|
|
266
|
+
"AAP-2",
|
|
267
|
+
"AAP-3",
|
|
268
|
+
"AAP-4"
|
|
269
|
+
];
|
|
194
270
|
function resolveAuditDeploymentReadiness(config, capabilities, canary) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
if (observed.recorderTopology !== "none" && observed.journalDurability !== "none") maximum = 1;
|
|
278
|
-
else reasons.push("recorder_or_journal_unavailable");
|
|
279
|
-
if (maximum >= 1 && observed.journalDurability === "durable" && observed.atomicAppend && observed.delivery !== "best-effort") {
|
|
280
|
-
maximum = 2;
|
|
281
|
-
} else if (Number(requested.requestedProfile.slice(-1)) >= 2) {
|
|
282
|
-
reasons.push("durable_atomic_buffered_append_unavailable");
|
|
283
|
-
}
|
|
284
|
-
if (maximum >= 2 && observed.merkleCheckpoints && observed.sourceHighWater) maximum = 3;
|
|
285
|
-
else if (Number(requested.requestedProfile.slice(-1)) >= 3) {
|
|
286
|
-
reasons.push("checkpoint_or_source_high_water_unavailable");
|
|
287
|
-
}
|
|
288
|
-
if (maximum >= 3 && observed.independentObservation && observed.supportingAnchors.length > 0) {
|
|
289
|
-
maximum = 4;
|
|
290
|
-
} else if (Number(requested.requestedProfile.slice(-1)) >= 4) {
|
|
291
|
-
reasons.push("independent_observation_or_anchor_unavailable");
|
|
292
|
-
}
|
|
293
|
-
const requestedLevel = Number(requested.requestedProfile.slice(-1));
|
|
294
|
-
const effectiveLevel = Math.min(requestedLevel, maximum);
|
|
295
|
-
return {
|
|
296
|
-
requestedProfile: requested.requestedProfile,
|
|
297
|
-
effectiveProfile: PROFILE_BY_LEVEL[effectiveLevel],
|
|
298
|
-
status: effectiveLevel === requestedLevel && reasons.length === 0 ? "ready" : "degraded",
|
|
299
|
-
capabilities: observed,
|
|
300
|
-
canary: observedCanary,
|
|
301
|
-
reasonCodes: reasons
|
|
302
|
-
};
|
|
271
|
+
const requested = AuditDeploymentConfigSchema.parse(config ?? ABSENT_AUDIT_DEPLOYMENT_CONFIG);
|
|
272
|
+
const observedCanary = canary ? AuditRuntimeCanaryResultSchema.parse(canary) : null;
|
|
273
|
+
if (!requested.enabled) return {
|
|
274
|
+
requestedProfile: "AAP-0",
|
|
275
|
+
effectiveProfile: "AAP-0",
|
|
276
|
+
status: "disabled",
|
|
277
|
+
capabilities: capabilities ?? null,
|
|
278
|
+
canary: observedCanary,
|
|
279
|
+
reasonCodes: ["audit_not_configured"]
|
|
280
|
+
};
|
|
281
|
+
const observedCapabilities = capabilities ?? observedCanary?.capabilities;
|
|
282
|
+
if (!observedCapabilities) return {
|
|
283
|
+
requestedProfile: requested.requestedProfile,
|
|
284
|
+
effectiveProfile: "AAP-0",
|
|
285
|
+
status: "degraded",
|
|
286
|
+
capabilities: null,
|
|
287
|
+
canary: observedCanary,
|
|
288
|
+
reasonCodes: ["runtime_capabilities_unavailable"]
|
|
289
|
+
};
|
|
290
|
+
const observed = AuditRuntimeCapabilitiesSchema.parse(observedCapabilities);
|
|
291
|
+
if (!observedCanary) return {
|
|
292
|
+
requestedProfile: requested.requestedProfile,
|
|
293
|
+
effectiveProfile: "AAP-0",
|
|
294
|
+
status: "degraded",
|
|
295
|
+
capabilities: observed,
|
|
296
|
+
canary: null,
|
|
297
|
+
reasonCodes: ["runtime_canary_required"]
|
|
298
|
+
};
|
|
299
|
+
if (!observedCanary.passed || JSON.stringify(observedCanary.capabilities) !== JSON.stringify(observed)) return {
|
|
300
|
+
requestedProfile: requested.requestedProfile,
|
|
301
|
+
effectiveProfile: "AAP-0",
|
|
302
|
+
status: "degraded",
|
|
303
|
+
capabilities: observed,
|
|
304
|
+
canary: observedCanary,
|
|
305
|
+
reasonCodes: [observedCanary.passed ? "runtime_canary_capability_mismatch" : "runtime_canary_failed"]
|
|
306
|
+
};
|
|
307
|
+
const passedChecks = new Set(observedCanary.checks.filter((check) => check.passed).map((check) => check.id));
|
|
308
|
+
if (requiredAuditRuntimeCanaryChecks(observed).some((check) => !passedChecks.has(check))) return {
|
|
309
|
+
requestedProfile: requested.requestedProfile,
|
|
310
|
+
effectiveProfile: "AAP-0",
|
|
311
|
+
status: "degraded",
|
|
312
|
+
capabilities: observed,
|
|
313
|
+
canary: observedCanary,
|
|
314
|
+
reasonCodes: ["runtime_canary_incomplete"]
|
|
315
|
+
};
|
|
316
|
+
let maximum = 0;
|
|
317
|
+
const reasons = [];
|
|
318
|
+
if (observed.recorderTopology !== requested.recorderTopology) reasons.push("recorder_topology_mismatch");
|
|
319
|
+
const deliveryRank = {
|
|
320
|
+
"best-effort": 0,
|
|
321
|
+
buffered: 1,
|
|
322
|
+
required: 2
|
|
323
|
+
};
|
|
324
|
+
if (deliveryRank[observed.delivery] < deliveryRank[requested.delivery]) reasons.push("delivery_mode_mismatch");
|
|
325
|
+
if ((requested.evidenceMode === "none" ? "none" : requested.evidenceMode === "encrypted-inline" ? "inline" : "separate") !== observed.evidenceRetention) reasons.push("evidence_retention_mismatch");
|
|
326
|
+
if (reasons.length > 0) return {
|
|
327
|
+
requestedProfile: requested.requestedProfile,
|
|
328
|
+
effectiveProfile: "AAP-0",
|
|
329
|
+
status: "degraded",
|
|
330
|
+
capabilities: observed,
|
|
331
|
+
canary: observedCanary,
|
|
332
|
+
reasonCodes: reasons
|
|
333
|
+
};
|
|
334
|
+
if (observed.recorderTopology !== "none" && observed.journalDurability !== "none") maximum = 1;
|
|
335
|
+
else reasons.push("recorder_or_journal_unavailable");
|
|
336
|
+
if (maximum >= 1 && observed.journalDurability === "durable" && observed.atomicAppend && observed.delivery !== "best-effort") maximum = 2;
|
|
337
|
+
else if (Number(requested.requestedProfile.slice(-1)) >= 2) reasons.push("durable_atomic_buffered_append_unavailable");
|
|
338
|
+
if (maximum >= 2 && observed.merkleCheckpoints && observed.sourceHighWater) maximum = 3;
|
|
339
|
+
else if (Number(requested.requestedProfile.slice(-1)) >= 3) reasons.push("checkpoint_or_source_high_water_unavailable");
|
|
340
|
+
if (maximum >= 3 && observed.independentObservation && observed.supportingAnchors.length > 0) maximum = 4;
|
|
341
|
+
else if (Number(requested.requestedProfile.slice(-1)) >= 4) reasons.push("independent_observation_or_anchor_unavailable");
|
|
342
|
+
const requestedLevel = Number(requested.requestedProfile.slice(-1));
|
|
343
|
+
const effectiveLevel = Math.min(requestedLevel, maximum);
|
|
344
|
+
return {
|
|
345
|
+
requestedProfile: requested.requestedProfile,
|
|
346
|
+
effectiveProfile: PROFILE_BY_LEVEL[effectiveLevel],
|
|
347
|
+
status: effectiveLevel === requestedLevel && reasons.length === 0 ? "ready" : "degraded",
|
|
348
|
+
capabilities: observed,
|
|
349
|
+
canary: observedCanary,
|
|
350
|
+
reasonCodes: reasons
|
|
351
|
+
};
|
|
303
352
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
353
|
+
/**
|
|
354
|
+
* Deploy step status — reuses same status enum as BYOK.
|
|
355
|
+
*/
|
|
356
|
+
const ManagedDeployStepStatusSchema = zod.z.enum([
|
|
357
|
+
"pending",
|
|
358
|
+
"in_progress",
|
|
359
|
+
"completed",
|
|
360
|
+
"failed",
|
|
361
|
+
"skipped"
|
|
310
362
|
]);
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Heartbeat request body.
|
|
365
|
+
* Sent by compute process: POST /api/v1/molti/agents/{did}/heartbeat
|
|
366
|
+
* Auth: X-Heartbeat-Token header
|
|
367
|
+
*/
|
|
368
|
+
const HeartbeatRequestSchema = zod.z.object({
|
|
369
|
+
/** Agent DID this heartbeat is for */
|
|
370
|
+
agentDid: DidStringSchema,
|
|
371
|
+
/** Current compute process status */
|
|
372
|
+
status: zod.z.enum([
|
|
373
|
+
"starting",
|
|
374
|
+
"running",
|
|
375
|
+
"error",
|
|
376
|
+
"stopping"
|
|
377
|
+
]),
|
|
378
|
+
/** @kya-os/compute package version (from package.json) */
|
|
379
|
+
computeVersion: zod.z.string().min(1).max(50),
|
|
380
|
+
/** Installed OpenClaw version (from npm ls) */
|
|
381
|
+
openclawVersion: zod.z.string().max(50).optional(),
|
|
382
|
+
/** Fly machine ID (from FLY_MACHINE_ID env var) */
|
|
383
|
+
machineId: zod.z.string().max(255).optional(),
|
|
384
|
+
/** Seconds since compute process started */
|
|
385
|
+
uptimeSeconds: zod.z.number().nonnegative().optional(),
|
|
386
|
+
/** Current RSS memory in MB */
|
|
387
|
+
memoryMb: zod.z.number().nonnegative().optional()
|
|
326
388
|
});
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Stop command — graceful shutdown, no payload accepted.
|
|
391
|
+
*/
|
|
392
|
+
const StopCommandSchema = zod.z.object({ type: zod.z.literal("stop") }).strict();
|
|
393
|
+
/**
|
|
394
|
+
* Restart command — restart the compute process, no payload accepted.
|
|
395
|
+
*/
|
|
396
|
+
const RestartCommandSchema = zod.z.object({ type: zod.z.literal("restart") }).strict();
|
|
397
|
+
/**
|
|
398
|
+
* Update config command — triggers config re-fetch, no payload accepted.
|
|
399
|
+
*/
|
|
400
|
+
const UpdateConfigCommandSchema = zod.z.object({ type: zod.z.literal("update_config") }).strict();
|
|
401
|
+
/**
|
|
402
|
+
* Update version command — requires target version in payload.
|
|
403
|
+
*/
|
|
404
|
+
const UpdateVersionCommandSchema = zod.z.object({
|
|
405
|
+
type: zod.z.literal("update_version"),
|
|
406
|
+
payload: zod.z.object({
|
|
407
|
+
/** Target OpenClaw version to install */
|
|
408
|
+
version: zod.z.string().min(1).max(50) })
|
|
342
409
|
}).strict();
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Command that Agent Shield can send to the compute process
|
|
412
|
+
* via the heartbeat response.
|
|
413
|
+
*
|
|
414
|
+
* Discriminated union by `type` field:
|
|
415
|
+
* - `stop` / `restart` / `update_config` — no payload
|
|
416
|
+
* - `update_version` — requires `{ version: string }` payload
|
|
417
|
+
*/
|
|
418
|
+
const ComputeCommandSchema = zod.z.discriminatedUnion("type", [
|
|
419
|
+
StopCommandSchema,
|
|
420
|
+
RestartCommandSchema,
|
|
421
|
+
UpdateConfigCommandSchema,
|
|
422
|
+
UpdateVersionCommandSchema
|
|
348
423
|
]);
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
424
|
+
/**
|
|
425
|
+
* Heartbeat response from Agent Shield.
|
|
426
|
+
* Returned by: POST /api/v1/molti/agents/{did}/heartbeat
|
|
427
|
+
*/
|
|
428
|
+
const HeartbeatResponseSchema = zod.z.object({
|
|
429
|
+
/** Always true for successful heartbeats */
|
|
430
|
+
ack: zod.z.literal(true),
|
|
431
|
+
/** Pending commands for the compute process to execute */
|
|
432
|
+
commands: zod.z.array(ComputeCommandSchema).default([]),
|
|
433
|
+
/** ISO timestamp of last config change (compute compares to detect updates) */
|
|
434
|
+
configUpdatedAt: zod.z.string().datetime().optional()
|
|
356
435
|
});
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
436
|
+
/**
|
|
437
|
+
* Config bundle returned by Agent Shield to the compute process.
|
|
438
|
+
* Fetched on boot: GET /api/v1/molti/deployments/{did}/config-bundle
|
|
439
|
+
* Auth: X-Heartbeat-Token header (for managed) or X-API-Key (for BYOK)
|
|
440
|
+
*
|
|
441
|
+
* **Private Key Delivery**: The agent's private key is NOT included in the config bundle.
|
|
442
|
+
* It is delivered as the `AGENT_PRIVATE_KEY` environment variable at Fly machine creation
|
|
443
|
+
* time and persists in the machine's env. This avoids transmitting the key on every
|
|
444
|
+
* config fetch and keeps it out of the config-bundle response surface.
|
|
445
|
+
*/
|
|
446
|
+
const ConfigBundleSchema = zod.z.object({
|
|
447
|
+
/** Schema version — 2 for managed bundles */
|
|
448
|
+
version: zod.z.number().int().positive(),
|
|
449
|
+
/** Kill switch — if true, compute must exit immediately */
|
|
450
|
+
killed: zod.z.boolean(),
|
|
451
|
+
/** Target OpenClaw version to install */
|
|
452
|
+
openclawVersion: zod.z.string().min(1).max(50),
|
|
453
|
+
/** Agent personality/system prompt file contents (max 100KB) */
|
|
454
|
+
soulFile: zod.z.string().max(1e5).nullable(),
|
|
455
|
+
/** Gateway auth token for OpenClaw */
|
|
456
|
+
gatewayToken: zod.z.string().min(1).max(500),
|
|
457
|
+
/** Channel configurations */
|
|
458
|
+
channels: zod.z.object({
|
|
459
|
+
telegram: zod.z.object({
|
|
460
|
+
enabled: zod.z.boolean(),
|
|
461
|
+
token: zod.z.string().optional()
|
|
462
|
+
}).optional(),
|
|
463
|
+
discord: zod.z.object({
|
|
464
|
+
enabled: zod.z.boolean(),
|
|
465
|
+
token: zod.z.string().optional()
|
|
466
|
+
}).optional(),
|
|
467
|
+
slack: zod.z.object({
|
|
468
|
+
enabled: zod.z.boolean(),
|
|
469
|
+
token: zod.z.string().optional(),
|
|
470
|
+
appToken: zod.z.string().optional()
|
|
471
|
+
}).optional(),
|
|
472
|
+
whatsapp: zod.z.object({ enabled: zod.z.boolean() }).strict().optional()
|
|
473
|
+
}),
|
|
474
|
+
/** AI provider configuration — key is decrypted, sent over TLS */
|
|
475
|
+
aiProvider: zod.z.object({
|
|
476
|
+
type: zod.z.enum(["anthropic", "openai"]),
|
|
477
|
+
apiKey: zod.z.string().min(1).max(500),
|
|
478
|
+
/**
|
|
479
|
+
* Optional base URL override. When set, OpenClaw routes all provider
|
|
480
|
+
* traffic through this URL instead of the provider's default endpoint.
|
|
481
|
+
* Used by managed deployments where AgentShield issues a per-deployment
|
|
482
|
+
* gateway token and proxies to the upstream provider with budget tracking.
|
|
483
|
+
*/
|
|
484
|
+
baseUrl: zod.z.string().url().optional()
|
|
485
|
+
}),
|
|
486
|
+
/**
|
|
487
|
+
* Optional OpenClaw heartbeat interval (`agents.defaults.heartbeat.every`).
|
|
488
|
+
* Drives how often OpenClaw wakes the agent for HEARTBEAT.md processing —
|
|
489
|
+
* the primary token-cost lever. Examples: "30m" (active), "6h" (idle),
|
|
490
|
+
* "off" (dormant — heartbeat disabled entirely). When absent, the patcher
|
|
491
|
+
* preserves whatever value already lives in openclaw.json (OpenClaw's
|
|
492
|
+
* built-in default of "30m").
|
|
493
|
+
*/
|
|
494
|
+
heartbeatEvery: zod.z.string().min(1).max(20).optional(),
|
|
495
|
+
/**
|
|
496
|
+
* Optional override for `agents.defaults.model.primary` (e.g.
|
|
497
|
+
* "anthropic/claude-haiku-4-5" for idle agents). When absent, the patcher
|
|
498
|
+
* derives the model from `aiProvider.type` as before. Format must be
|
|
499
|
+
* "<provider>/<model-id>".
|
|
500
|
+
*/
|
|
501
|
+
modelOverride: zod.z.string().min(1).max(100).optional(),
|
|
502
|
+
/** ISO timestamp of last config modification */
|
|
503
|
+
updatedAt: zod.z.string().datetime()
|
|
417
504
|
});
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
505
|
+
/**
|
|
506
|
+
* Status frame pushed from compute control server to dashboard.
|
|
507
|
+
* Sent on connect + every 5 seconds.
|
|
508
|
+
*/
|
|
509
|
+
const ControlStatusSchema = zod.z.object({
|
|
510
|
+
/** Whether the agent runtime is healthy */
|
|
511
|
+
healthy: zod.z.boolean(),
|
|
512
|
+
/** Seconds since compute process started */
|
|
513
|
+
uptimeSeconds: zod.z.number().nonnegative(),
|
|
514
|
+
/** Installed OpenClaw version */
|
|
515
|
+
openclawVersion: zod.z.string().min(1).max(50),
|
|
516
|
+
/** @kya-os/compute version */
|
|
517
|
+
computeVersion: zod.z.string().min(1).max(50),
|
|
518
|
+
/** Number of active WS connections to control server */
|
|
519
|
+
activeConnections: zod.z.number().int().nonnegative(),
|
|
520
|
+
/** Current RSS memory in MB */
|
|
521
|
+
memoryMb: zod.z.number().nonnegative(),
|
|
522
|
+
/** CPU usage percentage (0-100) */
|
|
523
|
+
cpuPercent: zod.z.number().nonnegative().max(100)
|
|
433
524
|
});
|
|
434
525
|
|
|
526
|
+
//#endregion
|
|
435
527
|
exports.ABSENT_AUDIT_DEPLOYMENT_CONFIG = ABSENT_AUDIT_DEPLOYMENT_CONFIG;
|
|
436
528
|
exports.AuditAssuranceProfileSchema = AuditAssuranceProfileSchema;
|
|
437
529
|
exports.AuditDeliveryModeSchema = AuditDeliveryModeSchema;
|
|
@@ -455,4 +547,4 @@ exports.StopCommandSchema = StopCommandSchema;
|
|
|
455
547
|
exports.UpdateConfigCommandSchema = UpdateConfigCommandSchema;
|
|
456
548
|
exports.UpdateVersionCommandSchema = UpdateVersionCommandSchema;
|
|
457
549
|
exports.requiredAuditRuntimeCanaryChecks = requiredAuditRuntimeCanaryChecks;
|
|
458
|
-
exports.resolveAuditDeploymentReadiness = resolveAuditDeploymentReadiness;
|
|
550
|
+
exports.resolveAuditDeploymentReadiness = resolveAuditDeploymentReadiness;
|