@indigoai-us/hq-cli 5.345.214 → 5.345.215-beta.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/command-catalog.generated.d.ts +134 -7
  3. package/dist/command-catalog.generated.js +168 -7
  4. package/dist/commands/agents.d.ts +51 -1
  5. package/dist/commands/agents.js +154 -2
  6. package/dist/commands/bot-jobs.d.ts +2 -15
  7. package/dist/commands/bot-jobs.js +2 -94
  8. package/dist/commands/bot-runtime.d.ts +46 -5
  9. package/dist/commands/bot-runtime.js +228 -18
  10. package/dist/commands/bot.d.ts +16 -9
  11. package/dist/commands/bot.js +169 -51
  12. package/dist/commands/cloud.d.ts +66 -13
  13. package/dist/commands/cloud.js +120 -39
  14. package/dist/commands/company-restore.d.ts +23 -0
  15. package/dist/commands/company-restore.js +128 -0
  16. package/dist/commands/company.js +2 -0
  17. package/dist/commands/integrations-connect.d.ts +10 -3
  18. package/dist/commands/integrations-connect.js +87 -13
  19. package/dist/commands/lanes.js +26 -9
  20. package/dist/commands/sources.js +6 -0
  21. package/dist/commands/storage-offload.d.ts +12 -0
  22. package/dist/commands/storage-offload.js +41 -3
  23. package/dist/commands/sync-mode.js +5 -0
  24. package/dist/commands/whoami.js +4 -0
  25. package/dist/lib/bot/config.d.ts +1 -0
  26. package/dist/lib/bot/config.js +10 -0
  27. package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
  28. package/dist/lib/bot/eventbridge-cron.js +104 -0
  29. package/dist/lib/bot/fleet-local.d.ts +33 -1
  30. package/dist/lib/bot/fleet-local.js +215 -31
  31. package/dist/lib/bot/fleet-python.d.ts +3 -0
  32. package/dist/lib/bot/fleet-python.js +34 -4
  33. package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
  34. package/dist/lib/bot/fleet-runtime-sources.js +30 -0
  35. package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
  36. package/dist/lib/bot/legacy-provider-login.js +19 -2
  37. package/dist/lib/bot/prompt.js +1 -1
  38. package/dist/lib/bot/readiness.d.ts +8 -0
  39. package/dist/lib/bot/readiness.js +17 -3
  40. package/dist/lib/bot/runtime-auth.d.ts +30 -0
  41. package/dist/lib/bot/runtime-auth.js +94 -3
  42. package/dist/lib/bot/status.d.ts +2 -0
  43. package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
  44. package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
  45. package/dist/lib/capacity/collectors/grok.d.ts +5 -0
  46. package/dist/lib/capacity/collectors/grok.js +56 -5
  47. package/dist/lib/daemon/catalog.js +11 -1
  48. package/dist/lib/db/sqlite-binding.d.ts +1 -0
  49. package/dist/lib/db/sqlite-binding.js +1 -1
  50. package/dist/lib/delivery/artifacts.d.ts +99 -0
  51. package/dist/lib/delivery/artifacts.js +548 -0
  52. package/dist/lib/delivery/backup.d.ts +78 -0
  53. package/dist/lib/delivery/backup.js +343 -0
  54. package/dist/lib/delivery/cache.d.ts +29 -0
  55. package/dist/lib/delivery/cache.js +33 -0
  56. package/dist/lib/delivery/contracts.d.ts +142 -0
  57. package/dist/lib/delivery/contracts.js +289 -0
  58. package/dist/lib/delivery/credentials.d.ts +54 -0
  59. package/dist/lib/delivery/credentials.js +119 -0
  60. package/dist/lib/delivery/enrollment.d.ts +142 -0
  61. package/dist/lib/delivery/enrollment.js +382 -0
  62. package/dist/lib/delivery/identity.d.ts +25 -0
  63. package/dist/lib/delivery/identity.js +82 -0
  64. package/dist/lib/delivery/inbox.d.ts +116 -0
  65. package/dist/lib/delivery/inbox.js +260 -0
  66. package/dist/lib/delivery/migrations.d.ts +139 -0
  67. package/dist/lib/delivery/migrations.js +623 -0
  68. package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
  69. package/dist/lib/delivery/mqtt-adapter.js +242 -0
  70. package/dist/lib/delivery/mqtt.d.ts +61 -0
  71. package/dist/lib/delivery/mqtt.js +112 -0
  72. package/dist/lib/delivery/outbox.d.ts +95 -0
  73. package/dist/lib/delivery/outbox.js +187 -0
  74. package/dist/lib/delivery/provenance.d.ts +129 -0
  75. package/dist/lib/delivery/provenance.js +93 -0
  76. package/dist/lib/delivery/reconciler.d.ts +151 -0
  77. package/dist/lib/delivery/reconciler.js +492 -0
  78. package/dist/lib/delivery/restore.d.ts +35 -0
  79. package/dist/lib/delivery/restore.js +134 -0
  80. package/dist/lib/delivery/store.d.ts +161 -0
  81. package/dist/lib/delivery/store.js +940 -0
  82. package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
  83. package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
  84. package/dist/lib/delivery/workers/macos.d.ts +176 -0
  85. package/dist/lib/delivery/workers/macos.js +901 -0
  86. package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
  87. package/dist/lib/delivery/workers/windows-boundary.js +693 -0
  88. package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
  89. package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
  90. package/dist/lib/delivery/workers/windows.d.ts +241 -0
  91. package/dist/lib/delivery/workers/windows.js +608 -0
  92. package/dist/lib/install/provider-wrappers.d.ts +2 -0
  93. package/dist/lib/install/provider-wrappers.js +68 -3
  94. package/dist/utils/cognito-callback-port.d.ts +14 -0
  95. package/dist/utils/cognito-callback-port.js +24 -0
  96. package/dist/utils/cognito-session.js +3 -3
  97. package/dist/utils/deleted-company-notice.d.ts +59 -0
  98. package/dist/utils/deleted-company-notice.js +156 -0
  99. package/dist/utils/login-browser.d.ts +1 -1
  100. package/dist/utils/login-browser.js +7 -5
  101. package/dist/utils/resident-package-preload.js +30 -15
  102. package/dist/utils/vault-api.js +7 -0
  103. package/package.json +7 -7
@@ -0,0 +1,161 @@
1
+ import { type StoreState, type TakeoverReason } from "./migrations.js";
2
+ export { DeliveryStoreError } from "./migrations.js";
3
+ export type { DeliveryStoreErrorCode } from "./migrations.js";
4
+ export declare const STATE_FILE = "state.json";
5
+ export declare const LOCK_FILE = "owner.lock";
6
+ /**
7
+ * SQLite control database; a write transaction on it is the store's serialization lock.
8
+ * Never open, read or close owner.db in this process except through the better-sqlite3
9
+ * connection in withStoreLock: closing any file descriptor on it drops every fcntl lock
10
+ * this process holds on it, which would silently end the store lock.
11
+ */
12
+ export declare const CONTROL_DB_FILE = "owner.db";
13
+ /**
14
+ * US-010: written into a store that a restored controller replaced. Its
15
+ * presence refuses every later open, so the old controller cannot regain
16
+ * authority (including by stale-pid takeover).
17
+ */
18
+ export declare const RETIRED_FILE = "retired.json";
19
+ /** US-010: written by restore; the store refuses to open until activateRestore removes it. */
20
+ export declare const RESTORE_PENDING_FILE = "restore.pending.json";
21
+ /**
22
+ * Points where a test can simulate a crash. Every commit passes temp-partial
23
+ * and temp-written before the rename and renamed after it. Open passes
24
+ * claimed after the lock is installed and before the first commit.
25
+ */
26
+ export type CommitStep = "claimed" | "temp-partial" | "temp-written" | "renamed";
27
+ export interface OwnerLock {
28
+ controllerId: string;
29
+ host: string;
30
+ pid: number;
31
+ /** Always a number in locks this build writes; null is accepted from older builds. */
32
+ epoch: number | null;
33
+ acquiredAt: string;
34
+ }
35
+ export interface StoreOpenOptions {
36
+ dir: string;
37
+ controllerId: string;
38
+ /** Milliseconds since the Unix epoch. Default Date.now. */
39
+ clock?: () => number;
40
+ /** Default os.hostname(). */
41
+ host?: string;
42
+ /** Default process.pid. */
43
+ pid?: number;
44
+ /** Liveness probe for a lock holder on this host. Default pidIsAlive. */
45
+ isPidAlive?: (pid: number) => boolean;
46
+ /** Explicit operator override: take the lock from a live or ambiguous owner. That owner is fenced. */
47
+ operatorOverride?: {
48
+ reason: string;
49
+ };
50
+ /** Test hook called at each commit step; throwing simulates a crash at that point. */
51
+ crashPoint?: (step: CommitStep) => void;
52
+ /** How long to wait for another controller holding the store lock (owner.db), in real milliseconds. Default 2000. */
53
+ gateWaitMs?: number;
54
+ }
55
+ export interface Takeover {
56
+ reason: TakeoverReason;
57
+ /** The previous lock file text. */
58
+ previousOwner: string;
59
+ supersededLockPath: string;
60
+ }
61
+ export interface OpenReport {
62
+ epoch: number;
63
+ /** Store schema version migrated from on this open, or null. */
64
+ migratedFrom: string | null;
65
+ /** Copy of the pre-migration file, written before the migrated state. */
66
+ backupPath: string | null;
67
+ takeover: Takeover | null;
68
+ /** Uncommitted temp files left by a crash and removed on open. */
69
+ removedTempFiles: string[];
70
+ }
71
+ /** True if a process with this pid exists (EPERM counts as alive). */
72
+ export declare function pidIsAlive(pid: number): boolean;
73
+ /** Parse a lock file. null when it is not exactly an OwnerLock. */
74
+ export declare function parseLock(text: string): OwnerLock | null;
75
+ /**
76
+ * Run `fn` with the committed state.json text while holding the store lock,
77
+ * so no commit lands during `fn` (US-010 backups). Read only; does not need
78
+ * or touch ownership. Refuses a retired store.
79
+ */
80
+ export declare function withStoreSnapshot<T>(dir: string, waitMs: number, fn: (stateText: string) => T): T;
81
+ export interface RetireRecord {
82
+ successorDir: string;
83
+ backupId: string;
84
+ /** Highest epoch the retired store had reached (its state and its lock). */
85
+ observedEpoch: number;
86
+ retiredAt: string;
87
+ }
88
+ /**
89
+ * US-010: retire a store whose authority moves to a restored controller.
90
+ * Under the store lock: record the highest epoch it reached in retired.json
91
+ * (created exclusively), then move owner.lock to a superseded record. The
92
+ * old owner's next commit finds no lock naming it and is FENCED; every later
93
+ * open is refused with STORE_RETIRED. Idempotent for the same successor.
94
+ */
95
+ export declare function retireStore(dir: string, input: {
96
+ successorDir: string;
97
+ backupId: string;
98
+ now: string;
99
+ waitMs?: number;
100
+ }): RetireRecord;
101
+ /**
102
+ * A single-writer handle on a store directory. Obtain with DeliveryStore.open;
103
+ * most callers want openDeliveryController in reconciler.ts instead.
104
+ */
105
+ export declare class DeliveryStore {
106
+ readonly dir: string;
107
+ readonly epoch: number;
108
+ readonly report: OpenReport;
109
+ private readonly lock;
110
+ private readonly clock;
111
+ private readonly crashPoint;
112
+ private readonly lockWaitMs;
113
+ private current;
114
+ private status;
115
+ private seq;
116
+ private constructor();
117
+ /**
118
+ * Acquire ownership, load and validate the store (migrating a known older
119
+ * version), and commit the new epoch. A refusal leaves the store unchanged;
120
+ * see the header for what a failure after the claim leaves on disk.
121
+ */
122
+ static open(opts: StoreOpenOptions): DeliveryStore;
123
+ /** The committed state. Read only: change it through commit(). */
124
+ get state(): StoreState;
125
+ /** ISO timestamp from the injected clock. */
126
+ now(): string;
127
+ /**
128
+ * Apply `mutate` to a copy of the state, validate the result and commit it
129
+ * atomically. `epoch` is the caller's fencing epoch; a write from any epoch
130
+ * other than the current owner's is rejected with FENCED. When mutate
131
+ * throws, nothing is written. Success means the write is in every later
132
+ * owner's base. STORE_IO and CONTROLLER_AMBIGUOUS mean nothing was written
133
+ * and the handle stays usable, so the commit can be retried.
134
+ */
135
+ commit(epoch: number, mutate: (draft: StoreState) => void): void;
136
+ /**
137
+ * Release ownership. Idempotent. A fenced handle leaves the new owner's
138
+ * lock alone. If the release cannot run (the store lock is busy), the handle stays
139
+ * as it was and close can be retried.
140
+ */
141
+ close(): void;
142
+ /**
143
+ * Throw unless this handle is open and owner.lock still names it: STORE_CLOSED
144
+ * for a closed or failed handle, FENCED (and the handle is fenced) when
145
+ * another controller owns the store. Read only.
146
+ */
147
+ assertOwner(): void;
148
+ private fence;
149
+ /** Fence unless owner.lock still names exactly this handle. */
150
+ private assertLockMine;
151
+ private assertWritable;
152
+ /**
153
+ * The temp file is gone, so a takeover removed it. Fence if ownership
154
+ * moved; otherwise something else touched the store.
155
+ */
156
+ private tempVanished;
157
+ private writeAtomic;
158
+ }
159
+ /** True if `dir` holds a store file. */
160
+ export declare function storeExists(dir: string): boolean;
161
+ //# sourceMappingURL=store.d.ts.map