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