@aspectlylabs/mikka 0.0.702 → 0.0.704

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/client.js CHANGED
@@ -3136,6 +3136,15 @@ var daemonStatusSchema = z15.object({
3136
3136
  /** Holds a device credential (it may still be refused by the server). */
3137
3137
  signedIn: z15.boolean(),
3138
3138
  server: z15.enum(["online", "offline", "unregistered"]),
3139
+ /**
3140
+ * The device session (decision 2026-11-17-2215). `update_required`: the
3141
+ * server refused this daemon version; it does nothing until it is updated.
3142
+ * `gateway_required`: the server has no device gateway, so it has no devices.
3143
+ * Absent from older daemons.
3144
+ */
3145
+ session: z15.enum(["signed_out", "connecting", "open", "update_required", "gateway_required"]).optional(),
3146
+ /** With `update_required`: the oldest version the server accepts, if it said. */
3147
+ requiredVersion: z15.string().max(40).nullable().optional(),
3139
3148
  harnesses: z15.array(harnessInfoSchema),
3140
3149
  runs: z15.array(runSummarySchema),
3141
3150
  /** Bytes used by run worktrees under the daemon's data dir. */
@@ -4199,69 +4208,46 @@ var deviceRegistered = z24.object({
4199
4208
  environment: z24.enum(["production", "preview", "dev"]).optional()
4200
4209
  }).optional().catch(void 0)
4201
4210
  });
4202
- var heartbeatRunSchema = z24.object({
4203
- runId: id3,
4204
- /** Last tool call, turn boundary or file change (not raw output). */
4205
- lastProgressAt: isoTime,
4206
- /** Opaque third-party capabilities, refreshed only with the existing run lease. */
4207
- secretCapabilities: taskSecretRenewalSchema.optional()
4208
- });
4211
+ var SESSION_LEASE_MS = 7 * 24 * 60 * 60 * 1e3;
4212
+ var deviceSessionReportSchema = z24.object({
4213
+ state: z24.enum(["connected", "disconnected"]),
4214
+ /** When the socket opened, or closed (or last answered a ping). */
4215
+ at: isoTime,
4216
+ /** One value per socket; a report for an older socket never overrides a newer one. */
4217
+ socketId: z24.string().regex(/^[A-Za-z0-9_-]{8,64}$/)
4218
+ }).strict();
4209
4219
  var stableVersion = z24.string().regex(/^(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})\.(0|[1-9]\d{0,8})$/);
4210
4220
  var daemonVersionsSchema = z24.object({ min: stableVersion, latest: stableVersion.optional() });
4211
4221
  var daemonUpdateFailureSchema = z24.object({ version: stableVersion, code: z24.enum(["install_failed", "restart_failed"]), at: isoTime });
4212
4222
  var deviceManagementCommand = z24.object({ id: z24.uuid(), kind: z24.enum(["redetect", "restart", "update", "uninstall"]) });
4213
- var deviceHeartbeatSchema = z24.object({
4223
+ var deviceReportSchema = z24.object({
4214
4224
  completedDeviceCommands: z24.array(z24.uuid()).max(100).optional(),
4215
4225
  failedDeviceCommands: z24.array(z24.object({ id: z24.uuid(), error: z24.string().max(500) })).max(100).optional(),
4216
- harnesses: z24.array(harnessInfoSchema).max(20),
4226
+ harnesses: z24.array(harnessInfoSchema).max(20).optional(),
4217
4227
  computerUse: deviceComputerCapability.optional(),
4218
4228
  runner: deviceRunnerCapability.optional(),
4219
4229
  deviceType: z24.enum(["laptop", "server"]).optional(),
4220
- runs: z24.array(heartbeatRunSchema).max(500),
4221
- worktreeDiskBytes: z24.number().int().nonnegative(),
4222
- /**
4223
- * Subscription windows read on this device. Absent when the daemon is not
4224
- * polling. Numbers only, never a vendor credential (ADR 0027).
4225
- */
4230
+ worktreeDiskBytes: z24.number().int().nonnegative().optional(),
4231
+ /** Subscription windows read on this device. Numbers only, never a vendor credential (ADR 0027). */
4226
4232
  quotas: z24.array(quotaSnapshotSchema).max(6).optional(),
4227
4233
  /** Null once no automatic update has failed since the last success. */
4228
- updateFailure: daemonUpdateFailureSchema.nullable().optional()
4234
+ updateFailure: daemonUpdateFailureSchema.nullable().optional(),
4235
+ /** A cloud worker asks for its next token once, an hour before the current one expires. */
4236
+ rotateCloudCredential: z24.literal(true).optional()
4229
4237
  });
4230
- var heartbeatResultSchema = z24.object({
4238
+ var deviceReportResultSchema = z24.object({
4231
4239
  deviceCommands: z24.array(deviceManagementCommand).max(1).optional(),
4232
- /** Renewed lease expiry per run id; a run missing here is not renewed. */
4233
- leases: z24.record(z24.string(), isoTime),
4234
- /** No plaintext: only grants for current owner/device/run/claim bindings. */
4235
- taskSecrets: z24.record(z24.string(), taskSecretAccessSchema).optional(),
4236
- /**
4237
- * Runs the device reported that it no longer holds: they ended on the
4238
- * server, or went to another attempt after the lease ran out. The daemon
4239
- * stops them now instead of when their lease runs out.
4240
- */
4241
- revoked: z24.array(id3).max(500).optional(),
4242
- /** Subset of revoked caused by an explicit cancel on an otherwise current claim. */
4243
- cancelled: z24.array(id3).max(500).optional(),
4244
4240
  /** Short-lived cloud device token, returned only over its authenticated link. */
4245
4241
  cloudCredential: z24.string().regex(/^orv_[A-Za-z0-9_-]{43}$/).optional(),
4246
- /** A malformed value is dropped, never a failed heartbeat. */
4242
+ cloudCredentialExpiresAt: isoTime.optional(),
4243
+ /** A malformed value is dropped, never a failed report. */
4247
4244
  daemonVersions: daemonVersionsSchema.optional().catch(void 0)
4248
4245
  });
4249
4246
  var deviceGatewaySchema = z24.object({
4250
- url: z24.string().url().nullable(),
4251
- protocol: z24.string().regex(/^mikka-ticket-[0-9]+-[a-f0-9]{64}$/).nullable(),
4252
- /** This server wakes the device after every write that can end, pause or
4253
- * revoke one of its runs (stop, lease, credential, policy, membership), so a
4254
- * connected daemon needs no periodic run-control check (#1212). Absent from
4255
- * older servers: the daemon then keeps its one-second check. */
4256
- runControl: z24.literal("push").optional(),
4257
- /** This server wakes the device when a person decides a computer review in
4258
- * the web, so a connected daemon syncs pending reviews only on a change or a
4259
- * push, plus a presence refresh (#1212). Absent from older servers: the
4260
- * daemon then keeps syncing every second while a review is pending. */
4261
- computerReviews: z24.literal("push").optional(),
4262
- /** This server wakes the device when it writes a native Coordinator tool
4263
- * result, so the waiting tool asks once per push, not every 500 ms. */
4264
- coordinatorResults: z24.literal("push").optional()
4247
+ url: z24.string().url(),
4248
+ protocol: z24.string().regex(/^mikka-ticket-[0-9]+-[a-f0-9]{64}$/),
4249
+ /** Cloud workers only: when the current device token expires. */
4250
+ cloudCredentialExpiresAt: isoTime.optional()
4265
4251
  });
4266
4252
  var RUN_CHECKPOINT_MAX_BYTES = 8 * 1024 * 1024;
4267
4253
  var RUN_CHECKPOINT_RECOVERY_MAX_AGE_MS = 30 * 6e4;
@@ -4414,7 +4400,7 @@ var runAssignmentSchema = z24.object({
4414
4400
  /** Host-owned Factory check mode; the model cannot grant a check or skip verification. */
4415
4401
  factoryCheck: z24.object({ stage: z24.enum(["review", "verify"]), inferCommand: z24.boolean(), reportOnly: z24.boolean() }).strict().optional(),
4416
4402
  factoryExecuteKind: z24.enum(["repository", "report", "deliverable"]).optional(),
4417
- /** Run lease; renewed through the device heartbeat. */
4403
+ /** Run lease in the database: it lasts as long as the device session that claimed the run. */
4418
4404
  leaseExpiresAt: isoTime.optional(),
4419
4405
  /**
4420
4406
  * The Mikka MCP server for the agent inside this run: `report`, `ask` and
@@ -4567,14 +4553,13 @@ var runCommandsResponse = z24.object({
4567
4553
  /** Owner-scoped reads, delivered only to a daemon advertising protocol v1. */
4568
4554
  workspaceRequests: z24.array(workspaceReadCommand).max(4).optional(),
4569
4555
  /**
4570
- * Runs queued for this device (outside `skip`), so it claims them now
4571
- * instead of on its next heartbeat. A queued run also ends the long-poll.
4572
- * Absent from older servers; the heartbeat still claims either way.
4556
+ * Runs queued for this device (outside `skip`), so it claims them as soon
4557
+ * as the gateway signals work.
4573
4558
  */
4574
4559
  queuedRuns: z24.array(id3).max(100).optional(),
4575
4560
  /** Only for a daemon that sent `COMMANDS_DAEMON_LATEST_PARAM`; a malformed value is dropped. */
4576
4561
  daemonVersions: daemonVersionsSchema.optional().catch(void 0),
4577
- /** The oldest pending device command (as the heartbeat's), so a person's update reaches the device now. */
4562
+ /** The oldest pending device command, so a person's update reaches the device now. */
4578
4563
  deviceCommands: z24.array(deviceManagementCommand).max(1).optional().catch(void 0)
4579
4564
  });
4580
4565
  var runCommandsAck = z24.object({
@@ -5112,7 +5097,7 @@ import { join } from "node:path";
5112
5097
  // package.json
5113
5098
  var package_default = {
5114
5099
  name: "@mikka/daemon",
5115
- version: "0.0.702",
5100
+ version: "0.0.704",
5116
5101
  description: "Local Mikka daemon: runs agents through the user's own CLIs",
5117
5102
  type: "module",
5118
5103
  private: true,
@@ -5180,7 +5165,7 @@ var package_default = {
5180
5165
  engines: {
5181
5166
  node: ">=22"
5182
5167
  },
5183
- gitHead: "510757b2cbb43beaadeb284abcc4f36a262ea371"
5168
+ gitHead: "a5c45e4d686a337f5dd0ea0acbac2e1e70aa9e03"
5184
5169
  };
5185
5170
 
5186
5171
  // src/paths.ts