@indigoai-us/hq-cli 5.345.231 → 5.345.233

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 (107) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -2
  3. package/assets/lanes-reconcile/hq-lanes-reconcile.service +1 -1
  4. package/assets/scaffold/core/scripts/pipeline-conductor.sh +14 -14
  5. package/assets/scaffold/core/scripts/pipeline-driver.sh +7 -7
  6. package/assets/scaffold/core/scripts/session-project.sh +19 -4
  7. package/dist/command-catalog.generated.d.ts +213 -177
  8. package/dist/command-catalog.generated.js +263 -212
  9. package/dist/command-registration-plan.d.ts +6 -24
  10. package/dist/command-registration-plan.js +4 -8
  11. package/dist/commands/auth.js +3 -2
  12. package/dist/commands/core-handoff.d.ts +1 -0
  13. package/dist/commands/core-handoff.js +2 -28
  14. package/dist/commands/core-pipeline-conductor-command.js +1 -1
  15. package/dist/commands/core-pipeline-conductor-native.js +5 -5
  16. package/dist/commands/core-pipeline-driver-native.js +5 -5
  17. package/dist/commands/daemon.js +7 -36
  18. package/dist/commands/deploy-access.js +6 -13
  19. package/dist/commands/deploy-comments.js +5 -13
  20. package/dist/commands/deploy-domains.js +6 -13
  21. package/dist/commands/deploy-list.js +25 -11
  22. package/dist/commands/deploy-mutations.d.ts +3 -0
  23. package/dist/commands/deploy-mutations.js +147 -0
  24. package/dist/commands/link.js +29 -0
  25. package/dist/commands/mcp-serve-gate.d.ts +22 -0
  26. package/dist/commands/mcp-serve-gate.js +37 -0
  27. package/dist/commands/mcp-serve.js +2 -8
  28. package/dist/commands/mesh.js +3 -1
  29. package/dist/commands/report.js +8 -9
  30. package/dist/data/command-states.json +10 -7
  31. package/dist/hq-cloud-sync-runner/bin/sync-runner.js +257 -214
  32. package/dist/hq-cloud-sync-runner/package.json +1 -1
  33. package/dist/index.js +6 -1
  34. package/dist/lib/bot/fleet-bots-update-pass.d.ts +8 -0
  35. package/dist/lib/bot/fleet-bots-update-pass.js +40 -0
  36. package/dist/lib/bot/fleet-bots-update-task.d.ts +12 -0
  37. package/dist/lib/bot/fleet-bots-update-task.js +52 -0
  38. package/dist/lib/bot/fleet-bots-update-worker-v1.d.ts +2 -0
  39. package/dist/lib/bot/fleet-bots-update-worker-v1.js +5 -0
  40. package/dist/lib/daemon/catalog.d.ts +8 -5
  41. package/dist/lib/daemon/catalog.js +15 -8
  42. package/dist/lib/daemon/flag.d.ts +2 -0
  43. package/dist/lib/daemon/flag.js +6 -4
  44. package/dist/lib/daemon/lock.js +33 -37
  45. package/dist/lib/daemon/ops/skill-command.d.ts +99 -0
  46. package/dist/lib/daemon/ops/skill-command.js +260 -0
  47. package/dist/lib/daemon/protocol.d.ts +1 -1
  48. package/dist/lib/daemon/protocol.js +1 -0
  49. package/dist/lib/daemon/run.js +10 -18
  50. package/dist/lib/daemon/server.js +7 -0
  51. package/dist/lib/daemon/shared-flag-reads.d.ts +70 -0
  52. package/dist/lib/daemon/shared-flag-reads.js +173 -0
  53. package/dist/lib/daemon/supervisor.d.ts +5 -0
  54. package/dist/lib/daemon/supervisor.js +17 -2
  55. package/dist/lib/db/app-ref.js +10 -15
  56. package/dist/lib/deploy-apps.d.ts +29 -0
  57. package/dist/lib/deploy-apps.js +37 -0
  58. package/dist/lib/doctor/checks/search-index.d.ts +16 -0
  59. package/dist/lib/doctor/checks/search-index.js +61 -0
  60. package/dist/lib/doctor/checks/stranded-lanes.js +1 -1
  61. package/dist/lib/doctor/registry.js +4 -0
  62. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  63. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  64. package/dist/lib/lanes/accounts.js +3 -3
  65. package/dist/lib/lanes/admission-host.js +1 -1
  66. package/dist/lib/lanes/admission.js +4 -4
  67. package/dist/lib/lanes/autopilot.js +2 -2
  68. package/dist/lib/lanes/blocker-freshness.js +1 -1
  69. package/dist/lib/lanes/compaction.js +5 -5
  70. package/dist/lib/lanes/delivery.js +1 -1
  71. package/dist/lib/lanes/depth-cap.js +1 -1
  72. package/dist/lib/lanes/disk-guard.js +1 -1
  73. package/dist/lib/lanes/dropbox.js +1 -1
  74. package/dist/lib/lanes/hooks-install.js +1 -1
  75. package/dist/lib/lanes/imported-question.js +1 -1
  76. package/dist/lib/lanes/keep-alive.d.ts +2 -2
  77. package/dist/lib/lanes/keep-alive.js +3 -3
  78. package/dist/lib/lanes/kr-freshness.js +1 -1
  79. package/dist/lib/lanes/links.js +4 -4
  80. package/dist/lib/lanes/loop.js +2 -2
  81. package/dist/lib/lanes/machine-identity.js +3 -3
  82. package/dist/lib/lanes/models.js +6 -6
  83. package/dist/lib/lanes/quota.js +1 -1
  84. package/dist/lib/lanes/reconcile-install.js +3 -3
  85. package/dist/lib/lanes/reconcile.js +16 -16
  86. package/dist/lib/lanes/remote-control-lane.js +6 -6
  87. package/dist/lib/lanes/reviews.js +2 -2
  88. package/dist/lib/lanes/spawn.js +24 -24
  89. package/dist/lib/lanes/status-fields.js +4 -4
  90. package/dist/lib/lanes/wait.js +4 -4
  91. package/dist/lib/lanes/watch.js +2 -2
  92. package/dist/lib/lanes/watcher-main.js +1 -1
  93. package/dist/lib/lanes/watcher.js +38 -38
  94. package/dist/lib/lanes/worker-process.js +5 -5
  95. package/dist/lib/mesh/live/daemon/pid-lock.d.ts +2 -4
  96. package/dist/lib/mesh/live/daemon/pid-lock.js +38 -55
  97. package/dist/utils/cognito-session.d.ts +2 -56
  98. package/dist/utils/cognito-session.js +6 -164
  99. package/dist/utils/exclusive-lock.d.ts +60 -0
  100. package/dist/utils/exclusive-lock.js +65 -0
  101. package/package.json +9 -8
  102. package/dist/commands/staff/listings.d.ts +0 -41
  103. package/dist/commands/staff/listings.js +0 -160
  104. package/dist/commands/staff/reset-test-account.d.ts +0 -121
  105. package/dist/commands/staff/reset-test-account.js +0 -285
  106. package/dist/commands/staff/test-account.d.ts +0 -51
  107. package/dist/commands/staff/test-account.js +0 -196
@@ -1,196 +0,0 @@
1
- import chalk from "chalk";
2
- import { ensureCognitoToken } from "../../utils/cognito-session.js";
3
- import { vaultApiFetch } from "../../utils/vault-api.js";
4
- import { callerEmailFromToken, isStaffEmail } from "./reset-test-account.js";
5
- // ── URL-safe base64 encode for the DELETE path parameter ────────────────────
6
- /**
7
- * Encode an email as the base64url path segment the DELETE route expects. The
8
- * server decodes and normalizes (`decodeRegistryEmailKey` → `normalizeRegistryEmail`),
9
- * so the operator can type `Bohemian.HW@gmail.com` and hit the same row as
10
- * `bohemianhw@gmail.com`. Local encoding is a pure transform on the raw input;
11
- * we never persist or print a locally normalized value.
12
- */
13
- export function encodeEmailForPath(email) {
14
- return Buffer.from(email.trim(), "utf8")
15
- .toString("base64")
16
- .replace(/\+/g, "-")
17
- .replace(/\//g, "_")
18
- .replace(/=+$/, "");
19
- }
20
- // ── Rendering ───────────────────────────────────────────────────────────────
21
- function renderEntryLine(entry) {
22
- const flag = entry.active ? chalk.green("active") : chalk.dim("inactive");
23
- const note = entry.note ? ` ${chalk.dim(entry.note)}` : "";
24
- return ` ${entry.email.padEnd(40)} ${flag} added ${entry.addedAt} by ${entry.addedBy}${note}`;
25
- }
26
- export function renderEntry(entry) {
27
- const lines = [];
28
- lines.push(chalk.bold(`\nRegistry entry for ${entry.email}`));
29
- lines.push(` active: ${entry.active ? chalk.green("yes") : chalk.dim("no")}`);
30
- lines.push(` added by: ${entry.addedBy}`);
31
- lines.push(` added at: ${entry.addedAt}`);
32
- lines.push(` note: ${entry.note ?? chalk.dim("(none)")}`);
33
- if (entry.removedBy !== undefined) {
34
- lines.push(` removed by: ${entry.removedBy}`);
35
- }
36
- if (entry.removedAt !== undefined) {
37
- lines.push(` removed at: ${entry.removedAt}`);
38
- }
39
- return lines.join("\n");
40
- }
41
- export function renderList(entries) {
42
- if (entries.length === 0) {
43
- return chalk.dim("\n(no registry entries)");
44
- }
45
- const lines = [];
46
- lines.push(chalk.bold(`\nTest-account registry (${entries.length})`));
47
- for (const entry of entries) {
48
- lines.push(renderEntryLine(entry));
49
- }
50
- return lines.join("\n");
51
- }
52
- // ── Shared HTTP helpers ─────────────────────────────────────────────────────
53
- async function readBody(res) {
54
- try {
55
- return (await res.json());
56
- }
57
- catch {
58
- return {};
59
- }
60
- }
61
- function renderApiError(status, body) {
62
- const code = typeof body.code === "string" ? body.code : undefined;
63
- const message = typeof body.error === "string" ? body.error : `request failed (${status})`;
64
- return code ? `${code}: ${message}` : message;
65
- }
66
- /**
67
- * Same local preflight the reset command runs. Duplicated in shape (not code)
68
- * so both commands surface the same message without a circular import; the
69
- * server remains the authorization boundary.
70
- */
71
- async function requireStaffToken() {
72
- const token = await ensureCognitoToken();
73
- const callerEmail = callerEmailFromToken(token);
74
- if (!callerEmail || !isStaffEmail(callerEmail)) {
75
- throw new Error("hq staff test-account requires a super-admin (staff) HQ session. " +
76
- "Sign in with an @getindigo.ai account and retry.");
77
- }
78
- return token;
79
- }
80
- export async function runAddTestAccount(params) {
81
- const email = params.email.trim();
82
- if (email.length === 0) {
83
- throw new Error("email argument is required");
84
- }
85
- const token = await requireStaffToken();
86
- const body = { email };
87
- if (params.note !== undefined)
88
- body.note = params.note;
89
- const res = await vaultApiFetch({
90
- token,
91
- path: "/v1/admin/test-account-registry",
92
- method: "POST",
93
- body,
94
- });
95
- const parsed = await readBody(res);
96
- if (!res.ok) {
97
- throw new Error(renderApiError(res.status, parsed));
98
- }
99
- const entry = parsed.entry;
100
- if (!entry) {
101
- throw new Error("server did not return the registry entry");
102
- }
103
- console.log(renderEntry(entry));
104
- console.log(chalk.dim("\n(entry added — reset command will now accept this email.)"));
105
- }
106
- export async function runRemoveTestAccount(params) {
107
- const email = params.email.trim();
108
- if (email.length === 0) {
109
- throw new Error("email argument is required");
110
- }
111
- const token = await requireStaffToken();
112
- const emailB64 = encodeEmailForPath(email);
113
- const res = await vaultApiFetch({
114
- token,
115
- path: `/v1/admin/test-account-registry/${emailB64}`,
116
- method: "DELETE",
117
- });
118
- const parsed = await readBody(res);
119
- if (!res.ok) {
120
- throw new Error(renderApiError(res.status, parsed));
121
- }
122
- const entry = parsed.entry;
123
- if (!entry) {
124
- throw new Error("server did not return the registry entry");
125
- }
126
- console.log(renderEntry(entry));
127
- console.log(chalk.dim("\n(entry soft-deleted — row stays with active: false.)"));
128
- }
129
- export async function runListTestAccounts(params = {}) {
130
- const token = await requireStaffToken();
131
- const res = await vaultApiFetch({
132
- token,
133
- path: "/v1/admin/test-account-registry",
134
- method: "GET",
135
- query: params.includeInactive ? { includeInactive: "true" } : undefined,
136
- });
137
- const parsed = await readBody(res);
138
- if (!res.ok) {
139
- throw new Error(renderApiError(res.status, parsed));
140
- }
141
- const entries = parsed.entries;
142
- if (!Array.isArray(entries)) {
143
- throw new Error("server did not return a list of entries");
144
- }
145
- console.log(renderList(entries));
146
- }
147
- // ── Commander wiring ────────────────────────────────────────────────────────
148
- function fail(err) {
149
- console.error(chalk.red(err instanceof Error ? err.message : String(err)));
150
- process.exit(1);
151
- }
152
- export function registerTestAccountCommand(staff) {
153
- const group = staff
154
- .command("test-account")
155
- .description("Manage the designated test-account registry (super-admin only). " +
156
- "Wraps /v1/admin/test-account-registry.");
157
- group
158
- .command("add")
159
- .description("Add an email to the registry so `hq staff reset-test-account` will sweep it.")
160
- .argument("<email>", "Designated test-account email")
161
- .option("--note <text>", "Short reason recorded on the row")
162
- .action(async (email, opts) => {
163
- try {
164
- await runAddTestAccount({ email, note: opts.note });
165
- }
166
- catch (err) {
167
- fail(err);
168
- }
169
- });
170
- group
171
- .command("remove")
172
- .description("Soft-delete a registry entry (row stays with active: false).")
173
- .argument("<email>", "Registered test-account email")
174
- .action(async (email) => {
175
- try {
176
- await runRemoveTestAccount({ email });
177
- }
178
- catch (err) {
179
- fail(err);
180
- }
181
- });
182
- group
183
- .command("list")
184
- .description("List active registry entries.")
185
- .option("--include-inactive", "Also list soft-deleted rows (active: false).")
186
- .action(async (opts) => {
187
- try {
188
- await runListTestAccounts({ includeInactive: opts.includeInactive === true });
189
- }
190
- catch (err) {
191
- fail(err);
192
- }
193
- });
194
- return group;
195
- }
196
- //# sourceMappingURL=test-account.js.map