@kya-os/checkpoint-shared 1.2.0 → 1.2.1

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.
Files changed (33) hide show
  1. package/dist/deploy/index.d.mts +380 -0
  2. package/dist/deploy/index.d.ts +380 -0
  3. package/dist/deploy/index.js +221 -0
  4. package/dist/deploy/index.mjs +207 -0
  5. package/dist/gateway/index.d.mts +575 -0
  6. package/dist/gateway/index.d.ts +575 -0
  7. package/dist/gateway/index.js +98 -0
  8. package/dist/gateway/index.mjs +88 -0
  9. package/dist/index.d.mts +1370 -84
  10. package/dist/index.d.ts +1370 -84
  11. package/dist/index.js +2887 -2205
  12. package/dist/index.mjs +2844 -2204
  13. package/dist/mcpi/agentshield-api/index.d.mts +47 -0
  14. package/dist/mcpi/agentshield-api/index.d.ts +47 -0
  15. package/dist/mcpi/agentshield-api/index.js +2 -0
  16. package/dist/mcpi/agentshield-api/index.mjs +1 -0
  17. package/dist/mcpi/approval-grant/index.d.mts +79 -0
  18. package/dist/mcpi/approval-grant/index.d.ts +79 -0
  19. package/dist/mcpi/approval-grant/index.js +157 -0
  20. package/dist/mcpi/approval-grant/index.mjs +150 -0
  21. package/dist/mcpi/dashboard-config/index.d.mts +14075 -0
  22. package/dist/mcpi/dashboard-config/index.d.ts +14075 -0
  23. package/dist/mcpi/dashboard-config/index.js +517 -0
  24. package/dist/mcpi/dashboard-config/index.mjs +492 -0
  25. package/dist/test-fixtures/index.d.mts +17 -8
  26. package/dist/test-fixtures/index.d.ts +17 -8
  27. package/dist/test-fixtures/index.js +73 -7
  28. package/dist/test-fixtures/index.mjs +73 -8
  29. package/dist/tool-protection/index.d.mts +1120 -0
  30. package/dist/tool-protection/index.d.ts +1120 -0
  31. package/dist/tool-protection/index.js +370 -0
  32. package/dist/tool-protection/index.mjs +338 -0
  33. package/package.json +32 -1
@@ -0,0 +1,207 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/deploy/index.ts
4
+ var 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>");
5
+ var FlyRegionSchema = z.enum([
6
+ "ams",
7
+ // Amsterdam, Netherlands
8
+ "arn",
9
+ // Stockholm, Sweden
10
+ "atl",
11
+ // Atlanta, Georgia (US)
12
+ "bog",
13
+ // Bogotá, Colombia
14
+ "bos",
15
+ // Boston, Massachusetts (US)
16
+ "cdg",
17
+ // Paris, France
18
+ "den",
19
+ // Denver, Colorado (US)
20
+ "dfw",
21
+ // Dallas, Texas (US)
22
+ "ewr",
23
+ // Secaucus, NJ (US)
24
+ "eze",
25
+ // Ezeiza, Argentina
26
+ "fra",
27
+ // Frankfurt, Germany
28
+ "gdl",
29
+ // Guadalajara, Mexico
30
+ "gig",
31
+ // Rio de Janeiro, Brazil
32
+ "gru",
33
+ // São Paulo, Brazil
34
+ "hkg",
35
+ // Hong Kong
36
+ "iad",
37
+ // Ashburn, Virginia (US)
38
+ "jnb",
39
+ // Johannesburg, South Africa
40
+ "lax",
41
+ // Los Angeles, California (US)
42
+ "lhr",
43
+ // London, United Kingdom
44
+ "mad",
45
+ // Madrid, Spain
46
+ "mia",
47
+ // Miami, Florida (US)
48
+ "nrt",
49
+ // Tokyo, Japan
50
+ "ord",
51
+ // Chicago, Illinois (US)
52
+ "otp",
53
+ // Bucharest, Romania
54
+ "phx",
55
+ // Phoenix, Arizona (US)
56
+ "qro",
57
+ // Querétaro, Mexico
58
+ "scl",
59
+ // Santiago, Chile
60
+ "sea",
61
+ // Seattle, Washington (US)
62
+ "sin",
63
+ // Singapore
64
+ "sjc",
65
+ // San Jose, California (US)
66
+ "syd",
67
+ // Sydney, Australia
68
+ "waw",
69
+ // Warsaw, Poland
70
+ "yul",
71
+ // Montreal, Canada
72
+ "yyz"
73
+ // Toronto, Canada
74
+ ]);
75
+ var HostingModeSchema = z.enum(["byok", "managed"]);
76
+ var ManagedDeployStepStatusSchema = z.enum([
77
+ "pending",
78
+ "in_progress",
79
+ "completed",
80
+ "failed",
81
+ "skipped"
82
+ ]);
83
+ var HeartbeatRequestSchema = z.object({
84
+ /** Agent DID this heartbeat is for */
85
+ agentDid: DidStringSchema,
86
+ /** Current compute process status */
87
+ status: z.enum(["starting", "running", "error", "stopping"]),
88
+ /** @kya-os/compute package version (from package.json) */
89
+ computeVersion: z.string().min(1).max(50),
90
+ /** Installed OpenClaw version (from npm ls) */
91
+ openclawVersion: z.string().max(50).optional(),
92
+ /** Fly machine ID (from FLY_MACHINE_ID env var) */
93
+ machineId: z.string().max(255).optional(),
94
+ /** Seconds since compute process started */
95
+ uptimeSeconds: z.number().nonnegative().optional(),
96
+ /** Current RSS memory in MB */
97
+ memoryMb: z.number().nonnegative().optional()
98
+ });
99
+ var StopCommandSchema = z.object({
100
+ type: z.literal("stop")
101
+ }).strict();
102
+ var RestartCommandSchema = z.object({
103
+ type: z.literal("restart")
104
+ }).strict();
105
+ var UpdateConfigCommandSchema = z.object({
106
+ type: z.literal("update_config")
107
+ }).strict();
108
+ var UpdateVersionCommandSchema = z.object({
109
+ type: z.literal("update_version"),
110
+ payload: z.object({
111
+ /** Target OpenClaw version to install */
112
+ version: z.string().min(1).max(50)
113
+ })
114
+ }).strict();
115
+ var ComputeCommandSchema = z.discriminatedUnion("type", [
116
+ StopCommandSchema,
117
+ RestartCommandSchema,
118
+ UpdateConfigCommandSchema,
119
+ UpdateVersionCommandSchema
120
+ ]);
121
+ var HeartbeatResponseSchema = z.object({
122
+ /** Always true for successful heartbeats */
123
+ ack: z.literal(true),
124
+ /** Pending commands for the compute process to execute */
125
+ commands: z.array(ComputeCommandSchema).default([]),
126
+ /** ISO timestamp of last config change (compute compares to detect updates) */
127
+ configUpdatedAt: z.string().datetime().optional()
128
+ });
129
+ var ConfigBundleSchema = z.object({
130
+ /** Schema version — 2 for managed bundles */
131
+ version: z.number().int().positive(),
132
+ /** Kill switch — if true, compute must exit immediately */
133
+ killed: z.boolean(),
134
+ /** Target OpenClaw version to install */
135
+ openclawVersion: z.string().min(1).max(50),
136
+ /** Agent personality/system prompt file contents (max 100KB) */
137
+ soulFile: z.string().max(1e5).nullable(),
138
+ /** Gateway auth token for OpenClaw */
139
+ gatewayToken: z.string().min(1).max(500),
140
+ /** Channel configurations */
141
+ channels: z.object({
142
+ telegram: z.object({
143
+ enabled: z.boolean(),
144
+ token: z.string().optional()
145
+ }).optional(),
146
+ discord: z.object({
147
+ enabled: z.boolean(),
148
+ token: z.string().optional()
149
+ }).optional(),
150
+ slack: z.object({
151
+ enabled: z.boolean(),
152
+ token: z.string().optional(),
153
+ appToken: z.string().optional()
154
+ }).optional(),
155
+ whatsapp: z.object({
156
+ enabled: z.boolean()
157
+ }).strict().optional()
158
+ }),
159
+ /** AI provider configuration — key is decrypted, sent over TLS */
160
+ aiProvider: z.object({
161
+ type: z.enum(["anthropic", "openai"]),
162
+ apiKey: z.string().min(1).max(500),
163
+ /**
164
+ * Optional base URL override. When set, OpenClaw routes all provider
165
+ * traffic through this URL instead of the provider's default endpoint.
166
+ * Used by managed deployments where AgentShield issues a per-deployment
167
+ * gateway token and proxies to the upstream provider with budget tracking.
168
+ */
169
+ baseUrl: z.string().url().optional()
170
+ }),
171
+ /**
172
+ * Optional OpenClaw heartbeat interval (`agents.defaults.heartbeat.every`).
173
+ * Drives how often OpenClaw wakes the agent for HEARTBEAT.md processing —
174
+ * the primary token-cost lever. Examples: "30m" (active), "6h" (idle),
175
+ * "off" (dormant — heartbeat disabled entirely). When absent, the patcher
176
+ * preserves whatever value already lives in openclaw.json (OpenClaw's
177
+ * built-in default of "30m").
178
+ */
179
+ heartbeatEvery: z.string().min(1).max(20).optional(),
180
+ /**
181
+ * Optional override for `agents.defaults.model.primary` (e.g.
182
+ * "anthropic/claude-haiku-4-5" for idle agents). When absent, the patcher
183
+ * derives the model from `aiProvider.type` as before. Format must be
184
+ * "<provider>/<model-id>".
185
+ */
186
+ modelOverride: z.string().min(1).max(100).optional(),
187
+ /** ISO timestamp of last config modification */
188
+ updatedAt: z.string().datetime()
189
+ });
190
+ var ControlStatusSchema = z.object({
191
+ /** Whether the agent runtime is healthy */
192
+ healthy: z.boolean(),
193
+ /** Seconds since compute process started */
194
+ uptimeSeconds: z.number().nonnegative(),
195
+ /** Installed OpenClaw version */
196
+ openclawVersion: z.string().min(1).max(50),
197
+ /** @kya-os/compute version */
198
+ computeVersion: z.string().min(1).max(50),
199
+ /** Number of active WS connections to control server */
200
+ activeConnections: z.number().int().nonnegative(),
201
+ /** Current RSS memory in MB */
202
+ memoryMb: z.number().nonnegative(),
203
+ /** CPU usage percentage (0-100) */
204
+ cpuPercent: z.number().nonnegative().max(100)
205
+ });
206
+
207
+ export { ComputeCommandSchema, ConfigBundleSchema, ControlStatusSchema, DidStringSchema, FlyRegionSchema, HeartbeatRequestSchema, HeartbeatResponseSchema, HostingModeSchema, ManagedDeployStepStatusSchema, RestartCommandSchema, StopCommandSchema, UpdateConfigCommandSchema, UpdateVersionCommandSchema };