@indigoai-us/hq-cli 5.345.152 → 5.345.153

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 (77) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/dist/bin/hq-auth-refresh.d.ts +4 -0
  3. package/dist/bin/hq-auth-refresh.js +9 -1
  4. package/dist/command-catalog.generated.d.ts +185 -0
  5. package/dist/command-catalog.generated.js +227 -0
  6. package/dist/command-registration-plan.d.ts +6 -0
  7. package/dist/command-registration-plan.js +1 -0
  8. package/dist/commands/agent-enroll.d.ts +12 -0
  9. package/dist/commands/agent-enroll.js +37 -4
  10. package/dist/commands/core-policy.js +4 -4
  11. package/dist/commands/core-session-project-native.js +19 -4
  12. package/dist/commands/decide.d.ts +13 -0
  13. package/dist/commands/decide.js +74 -0
  14. package/dist/commands/integrations-connect.js +24 -1
  15. package/dist/commands/integrations-core.d.ts +14 -0
  16. package/dist/commands/integrations-core.js +19 -1
  17. package/dist/commands/integrations-import.js +22 -1
  18. package/dist/commands/integrations.js +43 -2
  19. package/dist/commands/lanes-message.js +4 -11
  20. package/dist/commands/lanes-questions.js +3 -0
  21. package/dist/commands/lanes-resume.js +4 -11
  22. package/dist/commands/lanes-stories.js +3 -0
  23. package/dist/commands/run.js +14 -5
  24. package/dist/lib/agent-kit/adopt-identity.d.ts +7 -1
  25. package/dist/lib/agent-kit/adopt-identity.js +18 -3
  26. package/dist/lib/agent-kit/services.d.ts +3 -1
  27. package/dist/lib/agent-kit/services.js +5 -1
  28. package/dist/lib/daemon/ops/policy.d.ts +9 -1
  29. package/dist/lib/daemon/ops/policy.js +37 -2
  30. package/dist/lib/decisions/client.d.ts +67 -0
  31. package/dist/lib/decisions/client.js +120 -0
  32. package/dist/lib/decisions/expiry.d.ts +2 -0
  33. package/dist/lib/decisions/expiry.js +12 -0
  34. package/dist/lib/decisions/fixtures/us001.d.ts +137 -0
  35. package/dist/lib/decisions/fixtures/us001.js +21 -0
  36. package/dist/lib/decisions/import-lanes.d.ts +16 -0
  37. package/dist/lib/decisions/import-lanes.js +152 -0
  38. package/dist/lib/decisions/principal.d.ts +11 -0
  39. package/dist/lib/decisions/principal.js +52 -0
  40. package/dist/lib/doctor/checks/claude-wiring.d.ts +2 -2
  41. package/dist/lib/doctor/checks/claude-wiring.js +21 -10
  42. package/dist/lib/doctor/checks/work-context.js +7 -2
  43. package/dist/lib/doctor/fix/apply.d.ts +3 -2
  44. package/dist/lib/doctor/fix/apply.js +19 -15
  45. package/dist/lib/doctor/fix/refresh-sync-progress.d.ts +14 -0
  46. package/dist/lib/doctor/fix/refresh-sync-progress.js +30 -2
  47. package/dist/lib/doctor/fix/remediation.js +4 -2
  48. package/dist/lib/doctor/hook-gate-profiles.d.ts +19 -0
  49. package/dist/lib/doctor/hook-gate-profiles.js +34 -0
  50. package/dist/lib/doctor/types.d.ts +5 -0
  51. package/dist/lib/install/provider-wrappers.js +5 -1
  52. package/dist/lib/lanes/autopilot.js +4 -1
  53. package/dist/lib/lanes/imported-question.d.ts +5 -0
  54. package/dist/lib/lanes/imported-question.js +17 -0
  55. package/dist/lib/lanes/questions.d.ts +0 -5
  56. package/dist/lib/lanes/questions.js +2 -0
  57. package/dist/lib/lanes/reconcile.js +21 -10
  58. package/dist/lib/lanes/store.d.ts +0 -8
  59. package/dist/lib/lanes/store.js +2 -1
  60. package/dist/lib/lanes/stories.d.ts +15 -0
  61. package/dist/lib/lanes/stories.js +25 -0
  62. package/dist/lib/mesh/client.d.ts +8 -0
  63. package/dist/lib/mesh/client.js +44 -3
  64. package/dist/lib/mesh/denial-codes.js +1 -1
  65. package/dist/lib/mesh/live/daemon/run.d.ts +9 -1
  66. package/dist/lib/mesh/live/daemon/run.js +30 -1
  67. package/dist/lib/mesh/live/flush.d.ts +7 -0
  68. package/dist/lib/mesh/live/flush.js +53 -10
  69. package/dist/lib/registry/registry.js +6 -0
  70. package/dist/lib/scan-packages/index.js +7 -3
  71. package/dist/lib/work-context/organize.d.ts +2 -0
  72. package/dist/lib/work-context/organize.js +22 -4
  73. package/dist/lib/workers-registry/index.d.ts +12 -1
  74. package/dist/lib/workers-registry/index.js +39 -1
  75. package/dist/utils/cognito-session.d.ts +4 -1
  76. package/dist/utils/cognito-session.js +11 -1
  77. package/package.json +7 -7
@@ -59,7 +59,13 @@ function workerYamlFiles(root, relativeRoot) {
59
59
  return;
60
60
  }
61
61
  entries.sort((left, right) => (left.name < right.name ? -1 : left.name > right.name ? 1 : 0));
62
+ // A `.git` file (linked worktree) or folder (clone) below the scan root marks
63
+ // a separate checkout. Its worker.yaml files belong to that checkout, so the
64
+ // walk stops there. A checkout that is itself one worker keeps its own entry.
65
+ const isNestedCheckout = isNestedWorkerCheckout(relativeRoot, relative, entries.map((entry) => entry.name));
62
66
  for (const entry of entries) {
67
+ if (isNestedCheckout && entry.name !== 'worker.yaml')
68
+ continue;
63
69
  const childRelative = path.join(relative, entry.name);
64
70
  const child = path.join(root, childRelative);
65
71
  if (entry.name === 'worker.yaml' && (entry.isFile() || isFile(child))) {
@@ -162,12 +168,21 @@ function withoutTimestamp(content) {
162
168
  * (`.codex/worktrees/<name>/`) are the same trap in a different folder: a
163
169
  * nested HQ root under a company project. Those copies land in the registry as
164
170
  * `companies/<slug>/…/.claude/worktrees/…` or `.codex/worktrees/…` paths, so
165
- * `hq lanes create` then fails with `worker_tenancy_unresolved`.
171
+ * `hq lanes create` then fails with `worker_tenancy_unresolved`. HQ's own
172
+ * `workspace/worktrees/<name>/` is the same shape.
173
+ *
174
+ * `node_modules` and `.git` never hold workers and are large, so they are
175
+ * skipped wherever they appear. Any other checkout (a directory holding `.git`)
176
+ * is caught by the walk itself, because only the filesystem can tell.
166
177
  */
167
178
  export function isExcludedWorkerDirectory(relativeDirectory) {
168
179
  const normalized = relativeDirectory.replaceAll('\\', '/');
169
180
  if (/(?:^|\/)\.(?:claude|codex)\/worktrees(?:\/|$)/.test(normalized))
170
181
  return true;
182
+ if (/(?:^|\/)workspace\/worktrees(?:\/|$)/.test(normalized))
183
+ return true;
184
+ if (/(?:^|\/)(?:node_modules|\.git)(?:\/|$)/.test(normalized))
185
+ return true;
171
186
  const [root, tenant, nested] = normalized.split('/');
172
187
  if (root !== 'companies')
173
188
  return /(?:^|\/)_overrides(?:\/|$)/.test(normalized);
@@ -177,6 +192,29 @@ export function isExcludedWorkerDirectory(relativeDirectory) {
177
192
  return true;
178
193
  return /(?:^|\/)_overrides(?:\/|$)/.test(normalized);
179
194
  }
195
+ /**
196
+ * Directories that may be git repositories without being a nested checkout.
197
+ *
198
+ * An operator can keep a whole tenant (`companies/<slug>`) or a tenant's
199
+ * `workers` folder in its own repository. Treating either as a checkout would
200
+ * drop every real worker in that tenant.
201
+ */
202
+ function isCheckoutBoundaryExempt(relativeDirectory) {
203
+ const parts = relativeDirectory.replaceAll('\\', '/').split('/');
204
+ if (parts[0] !== 'companies')
205
+ return false;
206
+ return parts.length === 2 || (parts.length === 3 && parts[2] === 'workers');
207
+ }
208
+ /**
209
+ * True when `relativeDirectory`, found while walking `scanRoot`, is a separate
210
+ * git checkout (its listing `names` holds `.git`). The caller may still take a
211
+ * `worker.yaml` directly inside it, but must not descend any further.
212
+ */
213
+ export function isNestedWorkerCheckout(scanRoot, relativeDirectory, names) {
214
+ return relativeDirectory !== scanRoot
215
+ && !isCheckoutBoundaryExempt(relativeDirectory)
216
+ && names.includes('.git');
217
+ }
180
218
  /**
181
219
  * Every exclusion is a property of the directory holding the `worker.yaml`, so
182
220
  * the file rule is the directory rule applied to its parent. Deriving it keeps
@@ -294,7 +294,10 @@ export declare function buildVaultConfig(authToken: string): VaultServiceConfig;
294
294
  * means no valid session could be ensured non-interactively; the caller gets a
295
295
  * reason string and can decide what to do next. Never opens a browser.
296
296
  */
297
- type MachineRefreshOptions = Pick<EnsureCognitoTokenOptions, "tokenSource"> & MachineTokenValidityOptions;
297
+ type MachineRefreshOptions = Pick<EnsureCognitoTokenOptions, "tokenSource"> & MachineTokenValidityOptions & {
298
+ /** Refresh the person session even when the cached token is still valid. */
299
+ force?: boolean;
300
+ };
298
301
  export declare function refreshCachedSession(options?: MachineRefreshOptions): Promise<{
299
302
  refreshed: boolean;
300
303
  reason?: string;
@@ -1158,6 +1158,15 @@ export function buildVaultConfig(authToken) {
1158
1158
  clientInfo: CLI_CLIENT_INFO,
1159
1159
  };
1160
1160
  }
1161
+ /** Person sessions renew below this many seconds of validity by default. */
1162
+ const PERSON_REFRESH_DEFAULT_SECONDS = 120;
1163
+ /** Person tokens last one hour; a caller minimum above this would always refresh. */
1164
+ const MAX_PERSON_MIN_VALIDITY_SECONDS = 1800;
1165
+ function personRefreshThresholdSeconds(minValiditySeconds) {
1166
+ if (minValiditySeconds === undefined)
1167
+ return PERSON_REFRESH_DEFAULT_SECONDS;
1168
+ return Math.max(PERSON_REFRESH_DEFAULT_SECONDS, Math.min(minValiditySeconds, MAX_PERSON_MIN_VALIDITY_SECONDS));
1169
+ }
1161
1170
  export async function refreshCachedSession(options = {}) {
1162
1171
  if (wantsMachineCognitoTokens(options))
1163
1172
  return refreshCachedSessionUnserialized(options);
@@ -1198,7 +1207,8 @@ async function refreshCachedSessionUnserialized(options) {
1198
1207
  }
1199
1208
  return { refreshed: false, reason: "no cached session" };
1200
1209
  }
1201
- if (!isExpiring(cached, 120)) {
1210
+ if (!options.force &&
1211
+ !isExpiring(cached, personRefreshThresholdSeconds(options.minValiditySeconds))) {
1202
1212
  return { refreshed: true };
1203
1213
  }
1204
1214
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.152",
3
+ "version": "5.345.153",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -114,11 +114,11 @@
114
114
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
115
115
  },
116
116
  "optionalDependencies": {
117
- "@indigoai-us/hq-hook-win32-x64": "5.345.152",
118
- "@indigoai-us/hq-hook-win32-arm64": "5.345.152",
119
- "@indigoai-us/hq-hook-darwin-x64": "5.345.152",
120
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.152",
121
- "@indigoai-us/hq-hook-linux-x64": "5.345.152",
122
- "@indigoai-us/hq-hook-linux-arm64": "5.345.152"
117
+ "@indigoai-us/hq-hook-win32-x64": "5.345.153",
118
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.153",
119
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.153",
120
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.153",
121
+ "@indigoai-us/hq-hook-linux-x64": "5.345.153",
122
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.153"
123
123
  }
124
124
  }