@cleocode/core 2026.9.26 → 2026.10.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 (52) hide show
  1. package/dist/build-provenance.json +2 -2
  2. package/dist/cloud/nexus-attach.d.ts +94 -0
  3. package/dist/cloud/nexus-attach.d.ts.map +1 -0
  4. package/dist/cloud/nexus-attach.js +192 -0
  5. package/dist/cloud/nexus-attach.js.map +1 -0
  6. package/dist/cloud/nexus-auth.d.ts +15 -3
  7. package/dist/cloud/nexus-auth.d.ts.map +1 -1
  8. package/dist/cloud/nexus-auth.js +90 -6
  9. package/dist/cloud/nexus-auth.js.map +1 -1
  10. package/dist/cloud/nexus-cloud-status.d.ts +132 -0
  11. package/dist/cloud/nexus-cloud-status.d.ts.map +1 -0
  12. package/dist/cloud/nexus-cloud-status.js +440 -0
  13. package/dist/cloud/nexus-cloud-status.js.map +1 -0
  14. package/dist/cloud/nexus-cloud.d.ts +179 -0
  15. package/dist/cloud/nexus-cloud.d.ts.map +1 -0
  16. package/dist/cloud/nexus-cloud.js +296 -0
  17. package/dist/cloud/nexus-cloud.js.map +1 -0
  18. package/dist/cloud/nexus-device.d.ts +31 -6
  19. package/dist/cloud/nexus-device.d.ts.map +1 -1
  20. package/dist/cloud/nexus-device.js +54 -7
  21. package/dist/cloud/nexus-device.js.map +1 -1
  22. package/dist/cloud/nexus-enrol.d.ts +35 -4
  23. package/dist/cloud/nexus-enrol.d.ts.map +1 -1
  24. package/dist/cloud/nexus-enrol.js +187 -47
  25. package/dist/cloud/nexus-enrol.js.map +1 -1
  26. package/dist/cloud/nexus-link.d.ts +8 -1
  27. package/dist/cloud/nexus-link.d.ts.map +1 -1
  28. package/dist/cloud/nexus-link.js +138 -11
  29. package/dist/cloud/nexus-link.js.map +1 -1
  30. package/dist/cloud/nexus-logout.d.ts +114 -0
  31. package/dist/cloud/nexus-logout.d.ts.map +1 -0
  32. package/dist/cloud/nexus-logout.js +429 -0
  33. package/dist/cloud/nexus-logout.js.map +1 -0
  34. package/dist/docs/export-document.js +242 -37
  35. package/dist/docs/export-document.js.map +3 -3
  36. package/dist/llm/plugin-facade.js +343 -138
  37. package/dist/llm/plugin-facade.js.map +3 -3
  38. package/dist/selfimprove/fix-gen.js +347 -142
  39. package/dist/selfimprove/fix-gen.js.map +3 -3
  40. package/dist/setup/sections/nexus-account.d.ts +8 -6
  41. package/dist/setup/sections/nexus-account.d.ts.map +1 -1
  42. package/dist/setup/sections/nexus-account.js +53 -9
  43. package/dist/setup/sections/nexus-account.js.map +1 -1
  44. package/dist/store/sync/replica.d.ts +34 -3
  45. package/dist/store/sync/replica.d.ts.map +1 -1
  46. package/dist/store/sync/replica.js +39 -2
  47. package/dist/store/sync/replica.js.map +1 -1
  48. package/dist/store/sync/schema.d.ts +6 -3
  49. package/dist/store/sync/schema.d.ts.map +1 -1
  50. package/dist/store/sync/schema.js +6 -3
  51. package/dist/store/sync/schema.js.map +1 -1
  52. package/package.json +13 -13
@@ -17366,6 +17366,210 @@ var init_nexus_account = __esm({
17366
17366
  }
17367
17367
  });
17368
17368
 
17369
+ // packages/contracts/src/nexus-cloud.ts
17370
+ import { z as z26 } from "zod";
17371
+ var NEXUS_DEVICE_STATES, NEXUS_CLOUD_PROFILES, NEXUS_DEVICE_STATE_UNKNOWN, isoTime, profile, deviceState, nexusCloudCredentialSchema, nexusCloudDeviceSchema, nexusCloudOrganizationSchema, nexusCloudUserSchema, nexusCloudWhoamiSchema, nexusCloudDevicePageSchema, nexusCloudPresenceSchema, nexusCloudReplicaSchema, nexusCloudDeviceCountsSchema, projectFields, nexusCloudProjectListItemSchema, nexusCloudProjectPageSchema, nexusCloudProjectDetailSchema, nexusCloudReplicaPageSchema, NEXUS_STATUS_CHECK_IDS, NEXUS_STATUS_VERDICTS, CLOUD_STATUS_VERDICTS, knownCheckId, nexusCloudStatusCheckSchema, nexusCloudStatusSchema;
17372
+ var init_nexus_cloud = __esm({
17373
+ "packages/contracts/src/nexus-cloud.ts"() {
17374
+ "use strict";
17375
+ NEXUS_DEVICE_STATES = ["active", "signed-out", "revoked"];
17376
+ NEXUS_CLOUD_PROFILES = ["device", "read-only"];
17377
+ NEXUS_DEVICE_STATE_UNKNOWN = "unknown";
17378
+ isoTime = z26.iso.datetime({ offset: true });
17379
+ profile = z26.enum(NEXUS_CLOUD_PROFILES).nullable().catch(null);
17380
+ deviceState = z26.enum([...NEXUS_DEVICE_STATES, NEXUS_DEVICE_STATE_UNKNOWN]).catch(NEXUS_DEVICE_STATE_UNKNOWN);
17381
+ nexusCloudCredentialSchema = z26.object({
17382
+ kind: z26.enum(["device", "session"]),
17383
+ credentialId: z26.string().nullable().optional(),
17384
+ profile: profile.optional(),
17385
+ scopes: z26.array(z26.string()).default([]),
17386
+ createdAt: isoTime.nullable().optional(),
17387
+ lastUsedAt: isoTime.nullable().optional(),
17388
+ /** When the credential expires if it is not used again; null for sessions. */
17389
+ idleExpiresAt: isoTime.nullable().optional()
17390
+ });
17391
+ nexusCloudDeviceSchema = z26.object({
17392
+ deviceId: z26.string(),
17393
+ name: z26.string(),
17394
+ platform: z26.string().optional(),
17395
+ arch: z26.string().nullable().optional(),
17396
+ cliVersion: z26.string().nullable().optional(),
17397
+ createdAt: isoTime.optional(),
17398
+ lastSeenAt: isoTime.nullable().optional(),
17399
+ state: deviceState,
17400
+ signedOutAt: isoTime.nullable().optional(),
17401
+ /** Base64 device certificate; null until the device holds a key grant. */
17402
+ certificate: z26.string().nullable().optional(),
17403
+ /** The current credential's profile, or null with none (signed out or revoked). */
17404
+ profile: profile.optional(),
17405
+ /** True for the device whose credential made this request. */
17406
+ current: z26.boolean().default(false),
17407
+ projects: z26.number().int().nonnegative().optional(),
17408
+ replicas: z26.number().int().nonnegative().optional(),
17409
+ lastSyncAt: isoTime.nullable().optional(),
17410
+ lastPresenceAt: isoTime.nullable().optional()
17411
+ });
17412
+ nexusCloudOrganizationSchema = z26.object({
17413
+ id: z26.string(),
17414
+ name: z26.string(),
17415
+ slug: z26.string().nullable().optional(),
17416
+ role: z26.string().optional(),
17417
+ personal: z26.boolean().optional()
17418
+ });
17419
+ nexusCloudUserSchema = z26.object({
17420
+ id: z26.string(),
17421
+ email: z26.string(),
17422
+ name: z26.string().nullable().optional()
17423
+ });
17424
+ nexusCloudWhoamiSchema = z26.object({
17425
+ serverTime: isoTime.optional(),
17426
+ user: nexusCloudUserSchema,
17427
+ organizations: z26.array(nexusCloudOrganizationSchema).default([]),
17428
+ credential: nexusCloudCredentialSchema,
17429
+ /** The calling device; null for a session caller. */
17430
+ device: nexusCloudDeviceSchema.nullable()
17431
+ });
17432
+ nexusCloudDevicePageSchema = z26.object({
17433
+ devices: z26.array(nexusCloudDeviceSchema),
17434
+ nextCursor: z26.string().max(512).nullable().default(null),
17435
+ truncated: z26.boolean().default(false)
17436
+ });
17437
+ nexusCloudPresenceSchema = z26.looseObject({
17438
+ observedAt: isoTime.optional(),
17439
+ sync: z26.object({ enabled: z26.boolean() }).optional()
17440
+ });
17441
+ nexusCloudReplicaSchema = z26.object({
17442
+ projectId: z26.string(),
17443
+ replicaId: z26.string(),
17444
+ deviceId: z26.string(),
17445
+ deviceName: z26.string(),
17446
+ deviceState: deviceState.optional(),
17447
+ attachedAt: isoTime.optional(),
17448
+ lastSyncAt: isoTime.nullable(),
17449
+ presence: nexusCloudPresenceSchema.nullable(),
17450
+ presenceAt: isoTime.nullable()
17451
+ });
17452
+ nexusCloudDeviceCountsSchema = z26.object({
17453
+ active: z26.number().int().nonnegative(),
17454
+ total: z26.number().int().nonnegative()
17455
+ });
17456
+ projectFields = {
17457
+ projectId: z26.string(),
17458
+ label: z26.string().nullable(),
17459
+ organizationId: z26.string(),
17460
+ organizationName: z26.string().optional(),
17461
+ remoteUrl: z26.string().nullable().optional(),
17462
+ createdAt: isoTime.optional()
17463
+ };
17464
+ nexusCloudProjectListItemSchema = z26.object({
17465
+ ...projectFields,
17466
+ role: z26.string(),
17467
+ streamId: z26.string().optional(),
17468
+ headSeq: z26.number().int().nonnegative().nullable().optional(),
17469
+ openConflicts: z26.number().int().nonnegative().optional(),
17470
+ replicas: z26.array(nexusCloudReplicaSchema).default([]),
17471
+ devices: nexusCloudDeviceCountsSchema.optional(),
17472
+ replicaCount: z26.number().int().nonnegative().optional(),
17473
+ lastSyncAt: isoTime.nullable().optional(),
17474
+ lastPresenceAt: isoTime.nullable().optional(),
17475
+ /** This project's replica list was cut at 50 (T12858). */
17476
+ replicasTruncated: z26.boolean().default(false)
17477
+ });
17478
+ nexusCloudProjectPageSchema = z26.object({
17479
+ projects: z26.array(nexusCloudProjectListItemSchema),
17480
+ nextCursor: z26.string().max(512).nullable().default(null),
17481
+ /** Anything in the page was cut (the project list or a replica list). */
17482
+ truncated: z26.boolean().default(false),
17483
+ /** The project list itself was cut at 1000 (T12858). */
17484
+ projectsTruncated: z26.boolean().default(false)
17485
+ });
17486
+ nexusCloudProjectDetailSchema = z26.object({
17487
+ project: z26.object({ ...projectFields, deletedAt: isoTime.nullable().optional() }),
17488
+ role: z26.string(),
17489
+ canTrash: z26.boolean().optional(),
17490
+ openConflicts: z26.number().int().nonnegative(),
17491
+ /** At most 50, oldest attachment first. */
17492
+ replicas: z26.array(nexusCloudReplicaSchema),
17493
+ devices: nexusCloudDeviceCountsSchema,
17494
+ replicaCount: z26.number().int().nonnegative().optional(),
17495
+ lastSyncAt: isoTime.nullable().optional(),
17496
+ /** `replicas` was cut at 50. */
17497
+ truncated: z26.boolean().default(false),
17498
+ stream: z26.object({
17499
+ streamId: z26.string(),
17500
+ headSeq: z26.number().int().nonnegative(),
17501
+ headCheckpointId: z26.string().nullable()
17502
+ }).nullable()
17503
+ });
17504
+ nexusCloudReplicaPageSchema = z26.object({
17505
+ replicas: z26.array(nexusCloudReplicaSchema),
17506
+ devices: nexusCloudDeviceCountsSchema.optional(),
17507
+ nextCursor: z26.string().max(512).nullable().default(null),
17508
+ truncated: z26.boolean().default(false)
17509
+ });
17510
+ NEXUS_STATUS_CHECK_IDS = [
17511
+ "credential.valid",
17512
+ "device.registered",
17513
+ "device.active",
17514
+ "device.certified",
17515
+ "project.registered",
17516
+ "project.writable",
17517
+ "replica.attached",
17518
+ "presence.fresh",
17519
+ "replica.synced",
17520
+ "conflicts.none"
17521
+ ];
17522
+ NEXUS_STATUS_VERDICTS = ["ok", "attention", "not-linked", "not-registered"];
17523
+ CLOUD_STATUS_VERDICTS = [...NEXUS_STATUS_VERDICTS, "not-signed-in"];
17524
+ knownCheckId = z26.enum(NEXUS_STATUS_CHECK_IDS);
17525
+ nexusCloudStatusCheckSchema = z26.object({
17526
+ id: z26.enum(NEXUS_STATUS_CHECK_IDS),
17527
+ ok: z26.boolean(),
17528
+ required: z26.boolean(),
17529
+ detail: z26.string()
17530
+ });
17531
+ nexusCloudStatusSchema = z26.object({
17532
+ serverTime: isoTime.optional(),
17533
+ apiVersion: z26.string().optional(),
17534
+ user: nexusCloudUserSchema,
17535
+ credential: nexusCloudCredentialSchema,
17536
+ device: nexusCloudDeviceSchema.nullable(),
17537
+ project: z26.object({
17538
+ projectId: z26.string(),
17539
+ registered: z26.boolean(),
17540
+ organizationId: z26.string().nullable(),
17541
+ organizationName: z26.string().nullable(),
17542
+ role: z26.string().nullable()
17543
+ }).nullable(),
17544
+ replica: z26.object({
17545
+ replicaId: z26.string(),
17546
+ attached: z26.boolean(),
17547
+ attachedElsewhere: z26.boolean(),
17548
+ attachedAt: isoTime.nullable(),
17549
+ lastSyncAt: isoTime.nullable(),
17550
+ presenceAt: isoTime.nullable(),
17551
+ lastReplicaSeq: z26.number().int().nonnegative().nullable().optional()
17552
+ }).nullable(),
17553
+ stream: z26.object({
17554
+ streamId: z26.string(),
17555
+ headSeq: z26.number().int().nonnegative(),
17556
+ headCheckpointId: z26.string().nullable(),
17557
+ openConflicts: z26.number().int().nonnegative(),
17558
+ devices: nexusCloudDeviceCountsSchema
17559
+ }).nullable(),
17560
+ /** Check ids added by a newer server are dropped, never a parse failure. */
17561
+ checks: z26.array(nexusCloudStatusCheckSchema.extend({ id: z26.string() })).transform(
17562
+ (list) => list.flatMap((c) => {
17563
+ const id = knownCheckId.safeParse(c.id);
17564
+ return id.success ? [{ ...c, id: id.data }] : [];
17565
+ })
17566
+ ),
17567
+ /** A verdict added by a newer server reads as `attention`: never `ok` by accident. */
17568
+ verdict: z26.enum(NEXUS_STATUS_VERDICTS).catch("attention")
17569
+ });
17570
+ }
17571
+ });
17572
+
17369
17573
  // packages/contracts/src/task-id.ts
17370
17574
  var init_task_id = __esm({
17371
17575
  "packages/contracts/src/task-id.ts"() {
@@ -17450,6 +17654,7 @@ var init_src = __esm({
17450
17654
  init_decide();
17451
17655
  init_decide_sites();
17452
17656
  init_nexus_account();
17657
+ init_nexus_cloud();
17453
17658
  init_task_id();
17454
17659
  }
17455
17660
  });
@@ -33198,7 +33403,7 @@ var init_task_claim = __esm({
33198
33403
  });
33199
33404
 
33200
33405
  // packages/core/src/store/converters.ts
33201
- import { z as z26 } from "zod";
33406
+ import { z as z27 } from "zod";
33202
33407
  function readStoredAcceptance(row) {
33203
33408
  if (row.acceptanceJson === null || row.acceptanceJson === void 0) return void 0;
33204
33409
  try {
@@ -33356,7 +33561,7 @@ var init_converters = __esm({
33356
33561
  init_src();
33357
33562
  init_parsers();
33358
33563
  init_task_claim();
33359
- storedAcceptanceSchema = z26.custom(
33564
+ storedAcceptanceSchema = z27.custom(
33360
33565
  (value) => Array.isArray(value) && value.every((item) => acceptanceItemSchema.safeParse(item).success)
33361
33566
  );
33362
33567
  }
@@ -36019,7 +36224,7 @@ import {
36019
36224
  } from "node:fs";
36020
36225
  import { createRequire as createRequire5 } from "node:module";
36021
36226
  import { basename as basename7, dirname as dirname12, join as join13 } from "node:path";
36022
- import { z as z27 } from "zod";
36227
+ import { z as z28 } from "zod";
36023
36228
  function formatBackupTimestamp(d) {
36024
36229
  const pad = (n, len = 2) => String(n).padStart(len, "0");
36025
36230
  return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
@@ -36156,16 +36361,16 @@ var init_backup_sidecar = __esm({
36156
36361
  init_logger2();
36157
36362
  PRE_COLLAPSE_BACKUP_TYPE = "migration";
36158
36363
  MARKER_PREFIX = "twin_collapse:";
36159
- backupSidecarSchema = z27.object({
36160
- backupId: z27.string().min(1),
36161
- type: z27.string().min(1),
36162
- timestamp: z27.string().min(1),
36163
- note: z27.string().optional(),
36164
- files: z27.array(z27.string()),
36165
- pinned: z27.boolean().optional(),
36166
- pinnedReason: z27.string().optional(),
36167
- releasedAt: z27.string().optional(),
36168
- releasedReason: z27.string().optional()
36364
+ backupSidecarSchema = z28.object({
36365
+ backupId: z28.string().min(1),
36366
+ type: z28.string().min(1),
36367
+ timestamp: z28.string().min(1),
36368
+ note: z28.string().optional(),
36369
+ files: z28.array(z28.string()),
36370
+ pinned: z28.boolean().optional(),
36371
+ pinnedReason: z28.string().optional(),
36372
+ releasedAt: z28.string().optional(),
36373
+ releasedReason: z28.string().optional()
36169
36374
  }).passthrough();
36170
36375
  }
36171
36376
  });
@@ -36337,7 +36542,7 @@ var init_pre_repair_snapshot = __esm({
36337
36542
  import { createHash as createHash5 } from "node:crypto";
36338
36543
  import { basename as basename8, dirname as dirname15 } from "node:path";
36339
36544
  import { fileURLToPath as fileURLToPath4 } from "node:url";
36340
- import { z as z28 } from "zod";
36545
+ import { z as z29 } from "zod";
36341
36546
  function hasMainTable(db, name2) {
36342
36547
  return db.prepare("SELECT 1 FROM main.sqlite_master WHERE type = 'table' AND name = ?").get(name2) !== void 0;
36343
36548
  }
@@ -37470,20 +37675,20 @@ var init_twin_collapse = __esm({
37470
37675
  SHADOW_WRITE_REFUSED = "E_TWIN_COLLAPSE_FAILED: store is read-only until the twin collapse succeeds; run cleo doctor twin-collapse";
37471
37676
  SHADOW_WRITE_OPS = ["INSERT", "UPDATE", "DELETE"];
37472
37677
  STICKY_ARCHIVE_KEY = `${TWIN_COLLAPSE_ARCHIVE_PREFIX}sticky_tags`;
37473
- FocusNotesShape = z28.object({ sessionNotes: z28.array(z28.unknown()) }).passthrough();
37474
- StickyArchiveShape = z28.array(z28.string());
37475
- RecoveryReceiptShape = z28.object({
37476
- task: z28.literal("T12727"),
37477
- id: z28.string(),
37478
- recoveredAt: z28.string(),
37479
- snapshot: z28.string().nullable(),
37480
- archived: z28.array(z28.object({ key: z28.string(), archiveKey: z28.string(), sha: z28.string() })),
37481
- focusNotesAdded: z28.number(),
37482
- stickyArchived: z28.array(z28.string()),
37483
- stickyArchiveKey: z28.string(),
37484
- before: z28.object({ focusState: z28.string().nullable(), stickyArchive: z28.string().nullable() }),
37485
- after: z28.object({ focusState: z28.string().nullable(), stickyArchive: z28.string().nullable() }),
37486
- rolledBackAt: z28.string().nullable()
37678
+ FocusNotesShape = z29.object({ sessionNotes: z29.array(z29.unknown()) }).passthrough();
37679
+ StickyArchiveShape = z29.array(z29.string());
37680
+ RecoveryReceiptShape = z29.object({
37681
+ task: z29.literal("T12727"),
37682
+ id: z29.string(),
37683
+ recoveredAt: z29.string(),
37684
+ snapshot: z29.string().nullable(),
37685
+ archived: z29.array(z29.object({ key: z29.string(), archiveKey: z29.string(), sha: z29.string() })),
37686
+ focusNotesAdded: z29.number(),
37687
+ stickyArchived: z29.array(z29.string()),
37688
+ stickyArchiveKey: z29.string(),
37689
+ before: z29.object({ focusState: z29.string().nullable(), stickyArchive: z29.string().nullable() }),
37690
+ after: z29.object({ focusState: z29.string().nullable(), stickyArchive: z29.string().nullable() }),
37691
+ rolledBackAt: z29.string().nullable()
37487
37692
  });
37488
37693
  }
37489
37694
  });
@@ -45207,7 +45412,7 @@ var init_governor = __esm({
45207
45412
  // packages/core/src/store/exodus/recovery.ts
45208
45413
  import { randomUUID as randomUUID2 } from "node:crypto";
45209
45414
  import { constants } from "node:sqlite";
45210
- import { z as z29 } from "zod";
45415
+ import { z as z30 } from "zod";
45211
45416
  function identityValues(encoded) {
45212
45417
  return identitySchema.parse(JSON.parse(encoded)).map(([kind, value]) => {
45213
45418
  if (kind === "null") return null;
@@ -45543,8 +45748,8 @@ var init_recovery = __esm({
45543
45748
  "use strict";
45544
45749
  init_row_identity_registry();
45545
45750
  RECEIPTS = "_exodus_recovery_rows";
45546
- identitySchema = z29.array(
45547
- z29.tuple([z29.enum(["null", "integer", "real", "text", "blob"]), z29.string()])
45751
+ identitySchema = z30.array(
45752
+ z30.tuple([z30.enum(["null", "integer", "real", "text", "blob"]), z30.string()])
45548
45753
  );
45549
45754
  ExodusRecoveryError = class extends Error {
45550
45755
  };
@@ -45562,7 +45767,7 @@ import {
45562
45767
  writeFileSync as writeFileSync6
45563
45768
  } from "node:fs";
45564
45769
  import { basename as basename9, dirname as dirname19, join as join26, resolve as resolve12 } from "node:path";
45565
- import { z as z30 } from "zod";
45770
+ import { z as z31 } from "zod";
45566
45771
  function scopeBaseDir(scope, cwd, targetDbPath) {
45567
45772
  if (targetDbPath !== void 0) return dirname19(targetDbPath);
45568
45773
  return scope === "project" ? resolveCleoDir(cwd) : getCleoHome();
@@ -45705,11 +45910,11 @@ var init_archive2 = __esm({
45705
45910
  init_ensure_config();
45706
45911
  init_recovery();
45707
45912
  log8 = getLogger("exodus-archive");
45708
- markerIdentity = z30.object({
45709
- version: z30.literal(1),
45710
- scope: z30.enum(["project", "global"]),
45711
- targetDbPath: z30.string().optional(),
45712
- databaseIdentity: z30.string().optional()
45913
+ markerIdentity = z31.object({
45914
+ version: z31.literal(1),
45915
+ scope: z31.enum(["project", "global"]),
45916
+ targetDbPath: z31.string().optional(),
45917
+ databaseIdentity: z31.string().optional()
45713
45918
  });
45714
45919
  ARCHIVE_DIR_NAME = "_archive";
45715
45920
  MARKER_FILENAME_BY_SCOPE = {