@indigoai-us/hq-cli 5.345.238 → 5.345.242
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/CHANGELOG.md +74 -0
- package/assets/scaffold/core/scripts/hq-delegate-grant.sh +170 -8
- package/assets/scaffold/core/scripts/hq-delegate-publish.sh +21 -1
- package/assets/scaffold/core/scripts/hq-delegate-repo.sh +7 -1
- package/assets/scaffold/core/scripts/hq-delegate-secrets.sh +95 -20
- package/assets/scaffold/core/scripts/hq-delegate-transfer.sh +57 -9
- package/assets/scaffold/core/scripts/lib/delegate-engine.sh +77 -0
- package/dist/command-catalog.generated.d.ts +212 -10
- package/dist/command-catalog.generated.js +260 -10
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/cloud-off-gate.d.ts +9 -8
- package/dist/commands/cloud-off-gate.js +41 -40
- package/dist/commands/cloud.d.ts +17 -2
- package/dist/commands/cloud.js +126 -24
- package/dist/commands/core-delegate-w1b.js +333 -27
- package/dist/commands/core-delegate.d.ts +2 -1
- package/dist/commands/core-delegate.js +209 -48
- package/dist/commands/core-handoff.js +1 -1
- package/dist/commands/core-job-model-auth.d.ts +95 -0
- package/dist/commands/core-job-model-auth.js +247 -0
- package/dist/commands/core-job-run-native.js +280 -12
- package/dist/commands/core.js +1 -0
- package/dist/commands/deploy-comments.js +8 -2
- package/dist/commands/deploy-events.d.ts +40 -0
- package/dist/commands/deploy-events.js +300 -0
- package/dist/commands/doctor.d.ts +4 -4
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/feedback.js +2 -3
- package/dist/commands/files-browse.js +2 -0
- package/dist/commands/files.js +4 -0
- package/dist/commands/integrations-core.d.ts +11 -0
- package/dist/commands/integrations-core.js +15 -1
- package/dist/commands/keyed-sync-pull.d.ts +12 -0
- package/dist/commands/keyed-sync-pull.js +151 -0
- package/dist/commands/lanes-link.js +2 -2
- package/dist/commands/lanes-loop.d.ts +2 -2
- package/dist/commands/lanes-loop.js +5 -5
- package/dist/commands/lanes-questions.js +1 -1
- package/dist/commands/lanes-stories.js +1 -1
- package/dist/commands/lanes.js +80 -14
- package/dist/commands/library-add.d.ts +5 -2
- package/dist/commands/library-add.js +22 -9
- package/dist/commands/mcp-registration.d.ts +4 -18
- package/dist/commands/mcp-registration.js +9 -29
- package/dist/commands/mesh.d.ts +4 -0
- package/dist/commands/mesh.js +25 -5
- package/dist/commands/pack-install.d.ts +2 -3
- package/dist/commands/pack-install.js +6 -8
- package/dist/commands/rescue.d.ts +3 -2
- package/dist/commands/rescue.js +48 -34
- package/dist/commands/search.d.ts +6 -0
- package/dist/commands/search.js +24 -4
- package/dist/commands/secrets.d.ts +3 -4
- package/dist/commands/secrets.js +3 -20
- package/dist/commands/sources.js +6 -2
- package/dist/commands/sync-core.d.ts +8 -0
- package/dist/commands/sync-core.js +43 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +1830 -1468
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/bot/api.d.ts +2 -1
- package/dist/lib/bot/api.js +2 -15
- package/dist/lib/capacity/accounts.d.ts +1 -1
- package/dist/lib/capacity/accounts.js +1 -1
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +0 -2
- package/dist/lib/capacity/collectors/claude-oauth.js +0 -5
- package/dist/lib/capacity/freshness.d.ts +1 -1
- package/dist/lib/capacity/freshness.js +1 -1
- package/dist/lib/capacity/route.js +1 -1
- package/dist/lib/core-utils/delegate-helper-paths.d.ts +26 -0
- package/dist/lib/core-utils/delegate-helper-paths.js +33 -0
- package/dist/lib/daemon/catalog.d.ts +3 -0
- package/dist/lib/daemon/hook-requests.d.ts +1 -1
- package/dist/lib/daemon/hook-requests.js +4 -2
- package/dist/lib/daemon/jq-provision.d.ts +63 -0
- package/dist/lib/daemon/jq-provision.js +155 -0
- package/dist/lib/daemon/lanes-reconcile-guard.d.ts +4 -3
- package/dist/lib/daemon/lanes-reconcile-guard.js +4 -4
- package/dist/lib/daemon/mesh-owner.d.ts +4 -0
- package/dist/lib/daemon/mesh-owner.js +20 -0
- package/dist/lib/daemon/ops/policy.d.ts +3 -0
- package/dist/lib/daemon/ops/policy.js +32 -4
- package/dist/lib/daemon/run.js +17 -22
- package/dist/lib/daemon/server.d.ts +6 -0
- package/dist/lib/daemon/server.js +5 -0
- package/dist/lib/daemon/verified-jq.d.ts +96 -0
- package/dist/lib/daemon/verified-jq.js +337 -0
- package/dist/lib/doctor/checks/jq.js +16 -0
- package/dist/lib/doctor/deep/executor.d.ts +7 -0
- package/dist/lib/doctor/deep/executor.js +1 -1
- package/dist/lib/doctor/deep/parity.js +1 -27
- package/dist/lib/doctor/deep/sandbox.d.ts +2 -2
- package/dist/lib/doctor/deep/sandbox.js +3 -19
- package/dist/lib/doctor/fix/refresh-sync-handoff.js +52 -21
- package/dist/lib/doctor/fixtures/discover.d.ts +2 -0
- package/dist/lib/doctor/fixtures/discover.js +1 -1
- package/dist/lib/doctor/json-output.d.ts +1 -1
- package/dist/lib/doctor/registry.d.ts +6 -7
- package/dist/lib/doctor/registry.js +6 -7
- package/dist/lib/doctor/report.d.ts +9 -10
- package/dist/lib/doctor/report.js +4 -4
- package/dist/lib/environment/work-requirements.d.ts +1 -1
- package/dist/lib/environment/work-requirements.js +1 -1
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hook-engine/coverage.js +11 -3
- package/dist/lib/hook-engine/git-stop-config.json +510 -510
- package/dist/lib/hook-engine/native-precompact-compatibility.json +443 -443
- package/dist/lib/hook-engine/native-stop-compatibility.json +359 -359
- package/dist/lib/hot-channels/adapters/meetings.d.ts +1 -16
- package/dist/lib/hot-channels/adapters/meetings.js +3 -28
- package/dist/lib/hot-channels/adapters/slack.d.ts +3 -1
- package/dist/lib/hot-channels/adapters/slack.js +4 -1
- package/dist/lib/hot-channels/contract.d.ts +14 -0
- package/dist/lib/hot-channels/fleet-complete.d.ts +18 -2
- package/dist/lib/hot-channels/fleet-complete.js +29 -4
- package/dist/lib/hot-channels/meeting-source-ref.d.ts +17 -0
- package/dist/lib/hot-channels/meeting-source-ref.js +32 -0
- package/dist/lib/hot-channels/prompts/signals-pass.md +6 -1
- package/dist/lib/hot-channels/run.d.ts +10 -0
- package/dist/lib/hot-channels/run.js +34 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +27 -0
- package/dist/lib/hot-channels/signals-pass.js +57 -2
- package/dist/lib/hot-channels/signals-runtime.js +3 -2
- package/dist/lib/jq/install.d.ts +27 -0
- package/dist/lib/jq/install.js +156 -0
- package/dist/lib/lanes/accounts.js +2 -2
- package/dist/lib/lanes/claude-balance.d.ts +6 -0
- package/dist/lib/lanes/claude-balance.js +124 -0
- package/dist/lib/lanes/grants.js +15 -2
- package/dist/lib/lanes/hq-root.d.ts +1 -1
- package/dist/lib/lanes/hq-root.js +1 -1
- package/dist/lib/lanes/links.d.ts +1 -1
- package/dist/lib/lanes/liveness.d.ts +3 -0
- package/dist/lib/lanes/liveness.js +61 -7
- package/dist/lib/lanes/models.d.ts +1 -1
- package/dist/lib/lanes/models.js +1 -1
- package/dist/lib/lanes/outpost-dispatch.d.ts +1 -1
- package/dist/lib/lanes/outpost-dispatch.js +13 -13
- package/dist/lib/lanes/outpost-pruner-install.js +1 -1
- package/dist/lib/lanes/questions.d.ts +1 -1
- package/dist/lib/lanes/questions.js +2 -2
- package/dist/lib/lanes/spawn.js +4 -6
- package/dist/lib/lanes/store.d.ts +13 -2
- package/dist/lib/lanes/store.js +13 -5
- package/dist/lib/lanes/types.d.ts +7 -7
- package/dist/lib/lanes/types.js +1 -1
- package/dist/lib/lanes/watcher-main.js +1 -1
- package/dist/lib/lanes/watcher.d.ts +1 -1
- package/dist/lib/lanes/watcher.js +1 -1
- package/dist/lib/mesh/live/daemon/doctor.js +7 -1
- package/dist/lib/mesh/live/daemon/install.d.ts +4 -0
- package/dist/lib/mesh/live/daemon/install.js +10 -0
- package/dist/lib/mesh/live/daemon/run.js +17 -0
- package/dist/lib/mesh/live/emit-retry.d.ts +20 -2
- package/dist/lib/mesh/live/emit-retry.js +57 -4
- package/dist/lib/mesh/live/emit.js +25 -4
- package/dist/lib/mesh/live/flush.d.ts +2 -0
- package/dist/lib/mesh/live/flush.js +21 -8
- package/dist/lib/mesh/live/spool.d.ts +9 -1
- package/dist/lib/mesh/live/spool.js +41 -29
- package/dist/lib/onboarding/cli/onboard.js +5 -0
- package/dist/lib/signals/sanitize.d.ts +19 -0
- package/dist/lib/signals/sanitize.js +103 -7
- package/dist/lib/signals/steps/upload.d.ts +40 -1
- package/dist/lib/signals/steps/upload.js +122 -6
- package/dist/lib/sync-core/access-refresh.d.ts +29 -0
- package/dist/lib/sync-core/access-refresh.js +97 -0
- package/dist/lib/sync-core/company-adoption.d.ts +33 -0
- package/dist/lib/sync-core/company-adoption.js +223 -0
- package/dist/lib/sync-core/engine-home.d.ts +1 -0
- package/dist/lib/sync-core/engine-owned.d.ts +13 -0
- package/dist/lib/sync-core/engine-owned.js +38 -0
- package/dist/lib/sync-core/hand-back.d.ts +17 -0
- package/dist/lib/sync-core/hand-back.js +23 -0
- package/dist/lib/sync-core/post-apply-reindex.d.ts +33 -0
- package/dist/lib/sync-core/post-apply-reindex.js +149 -0
- package/dist/lib/sync-core/reconcile.d.ts +10 -0
- package/dist/lib/sync-core/reconcile.js +117 -12
- package/dist/lib/sync-core/rollout-state.d.ts +11 -1
- package/dist/lib/sync-core/rollout-state.js +40 -4
- package/dist/lib/vault-sync-switches.d.ts +14 -0
- package/dist/lib/vault-sync-switches.js +22 -0
- package/dist/lib/windows/jq.d.ts +4 -0
- package/dist/lib/windows/jq.js +10 -39
- package/dist/lib/workers-registry/index.d.ts +1 -1
- package/dist/lib/workers-registry/index.js +8 -12
- package/dist/utils/callback-port-busy.d.ts +2 -2
- package/dist/utils/callback-port-busy.js +2 -2
- package/dist/utils/cli-network-lifecycle.js +1 -0
- package/dist/utils/client-health-contract.d.ts +2 -0
- package/dist/utils/client-health-contract.js +1 -1
- package/dist/utils/client-health.js +1 -9
- package/dist/utils/cognito-config.js +5 -0
- package/dist/utils/cognito-session.d.ts +4 -6
- package/dist/utils/cognito-session.js +4 -24
- package/dist/utils/github-tag-fallback.d.ts +16 -0
- package/dist/utils/github-tag-fallback.js +126 -0
- package/dist/utils/incomplete-install-error.js +1 -11
- package/dist/utils/install-tree-torn.d.ts +11 -0
- package/dist/utils/install-tree-torn.js +1 -1
- package/dist/utils/resident-package-preload.js +2 -1
- package/dist/utils/version-report.d.ts +2 -1
- package/dist/utils/version-report.js +40 -27
- package/docs/anywhere-runtime.md +8 -0
- package/package.json +9 -9
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Defaults point at the shared vault-indigo-hq-prod Cognito pool (canonical
|
|
10
10
|
* post-2026-04-25 cutover; hq-dev remains the staging fallback via env
|
|
11
|
-
* overrides)
|
|
12
|
-
* CLI and the in-tree demo script stay drift-free. Override any of them via
|
|
13
|
-
* env:
|
|
11
|
+
* overrides), defined in cognito-config.ts. Override any of them via env:
|
|
14
12
|
*
|
|
15
13
|
* AWS_REGION — e.g. us-east-1
|
|
16
14
|
* HQ_COGNITO_DOMAIN — Cognito User Pool domain prefix
|
|
@@ -31,7 +29,8 @@ import { HQ_MACHINE_TOKEN_STATE_DIR_ENV, loadMachineCachedTokens, machineTokenCa
|
|
|
31
29
|
export { HQ_MACHINE_TOKEN_STATE_DIR_ENV, loadMachineCachedTokens, machineTokenCacheFile, machineTokenStateDir };
|
|
32
30
|
import { resolveDefaultHqRoot } from "./hq-root-resolver.js";
|
|
33
31
|
import { acquireLockFileExclusively } from "./exclusive-lock.js";
|
|
34
|
-
import { interactiveLoginConfig
|
|
32
|
+
import { interactiveLoginConfig } from "./cognito-callback-port.js";
|
|
33
|
+
import { DEFAULT_COGNITO, DEFAULT_VAULT_API_URL } from "./cognito-config.js";
|
|
35
34
|
import { HQ_NO_BROWSER_LOGIN_ENV, NON_INTERACTIVE_LOGIN_MESSAGE, isInteractiveCaller, } from "./interactive-caller.js";
|
|
36
35
|
import { reportNoninteractivePersonRefreshRejection } from "./cognito-refresh-sentry.js";
|
|
37
36
|
import { decodeJwtPayload, loadCachedTokens, personTokenCacheFile, readPersonTokenFile, readTokenFile, } from "./person-token-cache.js";
|
|
@@ -45,26 +44,7 @@ export { hasPersonCachedSession, isMachineCredsFileEnvSet, wantsMachineCognitoTo
|
|
|
45
44
|
* Default: the work-mesh daemon state dir (`~/.hq/work-mesh/daemon`), so a
|
|
46
45
|
* machine mint never overwrites a person's `~/.hq/cognito-tokens.json`.
|
|
47
46
|
*/
|
|
48
|
-
export
|
|
49
|
-
region: process.env.AWS_REGION ?? "us-east-1",
|
|
50
|
-
userPoolDomain: process.env.HQ_COGNITO_DOMAIN ?? "vault-indigo-hq-prod",
|
|
51
|
-
clientId: process.env.HQ_COGNITO_CLIENT_ID ?? "7acei2c8v870enheptb1j5foln",
|
|
52
|
-
// Resolved on read, not at module load: main.ts imports this for every
|
|
53
|
-
// command, and a stray HQ_COGNITO_CALLBACK_PORT should warn only when a
|
|
54
|
-
// sign-in actually reads the port.
|
|
55
|
-
get port() {
|
|
56
|
-
return resolveCognitoCallbackPort(process.env.HQ_COGNITO_CALLBACK_PORT);
|
|
57
|
-
},
|
|
58
|
-
// Skip Cognito's Hosted UI — go straight to Google OAuth. The Cognito
|
|
59
|
-
// /oauth2/authorize endpoint honors `identity_provider` and performs an
|
|
60
|
-
// internal redirect, so the user never sees the (un-styleable) Hosted UI.
|
|
61
|
-
// Set HQ_COGNITO_IDENTITY_PROVIDER="" to fall back to the IdP picker for
|
|
62
|
-
// accounts that use email+password (admin-created users without Google).
|
|
63
|
-
identityProvider: process.env.HQ_COGNITO_IDENTITY_PROVIDER !== undefined
|
|
64
|
-
? process.env.HQ_COGNITO_IDENTITY_PROVIDER || undefined
|
|
65
|
-
: "Google",
|
|
66
|
-
};
|
|
67
|
-
export const DEFAULT_VAULT_API_URL = process.env.HQ_VAULT_API_URL ?? "https://hqapi.hq.computer";
|
|
47
|
+
export { DEFAULT_COGNITO, DEFAULT_VAULT_API_URL };
|
|
68
48
|
// HQ-root resolution (HQ_ROOT, cwd walk with the core.yaml + companies/
|
|
69
49
|
// check, installer records, known locations, then ~/hq or a throw) has one
|
|
70
50
|
// implementation, in hq-root-resolver.ts (US-030 c2). Re-exported here for
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GitHubLookupDeps {
|
|
2
|
+
fetchImpl?: typeof fetch;
|
|
3
|
+
lsRemote?: (repo: string, refsOnly: boolean) => Promise<string>;
|
|
4
|
+
warn?: (message: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class GitHubApiUnavailable extends Error {
|
|
7
|
+
}
|
|
8
|
+
export declare function isTransientGitHubStatus(status: number): boolean;
|
|
9
|
+
/** No shell: git.exe is resolved from PATH on Windows, just as git is on Unix. */
|
|
10
|
+
export declare function readRemoteTags(repo: string, refsOnly: boolean): Promise<string>;
|
|
11
|
+
export declare function highestReleaseTag(output: string): string;
|
|
12
|
+
/** One scope per command; latest and floor lookups must share this callback. */
|
|
13
|
+
export declare function onceWarning(warn?: (message: string) => void): (message: string) => void;
|
|
14
|
+
export declare function remoteTagSha(output: string, tag: string): string;
|
|
15
|
+
export declare function withGitTagFallback<T>(api: () => Promise<T>, repo: string, tag: string | undefined, select: (output: string) => T, deps: GitHubLookupDeps): Promise<T>;
|
|
16
|
+
//# sourceMappingURL=github-tag-fallback.d.ts.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
export class GitHubApiUnavailable extends Error {
|
|
3
|
+
}
|
|
4
|
+
export function isTransientGitHubStatus(status) {
|
|
5
|
+
return status === 403 || status === 429 || (status >= 500 && status <= 599);
|
|
6
|
+
}
|
|
7
|
+
/** No shell: git.exe is resolved from PATH on Windows, just as git is on Unix. */
|
|
8
|
+
export function readRemoteTags(repo, refsOnly) {
|
|
9
|
+
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo)) {
|
|
10
|
+
return Promise.reject(new Error('expected a GitHub owner/repository'));
|
|
11
|
+
}
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
execFile('git', ['ls-remote', '--tags', ...(refsOnly ? ['--refs'] : []),
|
|
14
|
+
'https://github.com/' + repo + '.git'], {
|
|
15
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0', GCM_INTERACTIVE: 'Never' },
|
|
16
|
+
timeout: 30_000, maxBuffer: 16 * 1024 * 1024, windowsHide: true,
|
|
17
|
+
encoding: 'utf8',
|
|
18
|
+
}, (error, stdout) => {
|
|
19
|
+
// Credential helpers can include sensitive values in stderr.
|
|
20
|
+
if (error)
|
|
21
|
+
reject(new Error('git could not read remote tags (exit ' + String(error.code ?? 'unknown') + ')'));
|
|
22
|
+
else
|
|
23
|
+
resolve(stdout);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function parseRefs(output) {
|
|
28
|
+
const refs = new Map();
|
|
29
|
+
for (const line of output.split(/\r?\n/)) {
|
|
30
|
+
const match = /^([0-9a-f]{40})\s+refs\/tags\/(\S+)$/.exec(line.trim());
|
|
31
|
+
if (match)
|
|
32
|
+
refs.set(match[2], match[1]);
|
|
33
|
+
}
|
|
34
|
+
return refs;
|
|
35
|
+
}
|
|
36
|
+
const STRICT_RELEASE_TAG = /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
|
|
37
|
+
function sortedReleaseTags(output) {
|
|
38
|
+
const tags = [...parseRefs(output).keys()].filter(tag => STRICT_RELEASE_TAG.test(tag));
|
|
39
|
+
tags.sort((a, b) => {
|
|
40
|
+
const left = a.slice(1).split('.').map(BigInt);
|
|
41
|
+
const right = b.slice(1).split('.').map(BigInt);
|
|
42
|
+
for (let i = 0; i < 3; i++) {
|
|
43
|
+
if (left[i] !== right[i])
|
|
44
|
+
return left[i] > right[i] ? -1 : 1;
|
|
45
|
+
}
|
|
46
|
+
return 0;
|
|
47
|
+
});
|
|
48
|
+
return tags;
|
|
49
|
+
}
|
|
50
|
+
export function highestReleaseTag(output) {
|
|
51
|
+
const tag = sortedReleaseTags(output)[0];
|
|
52
|
+
if (!tag)
|
|
53
|
+
throw new Error('no strict vMAJOR.MINOR.PATCH tags found');
|
|
54
|
+
return tag;
|
|
55
|
+
}
|
|
56
|
+
/** One scope per command; latest and floor lookups must share this callback. */
|
|
57
|
+
export function onceWarning(warn = console.warn) {
|
|
58
|
+
let warned = false;
|
|
59
|
+
return message => {
|
|
60
|
+
if (!warned) {
|
|
61
|
+
warned = true;
|
|
62
|
+
warn(message);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async function publishedReleaseTag(repo, deps) {
|
|
67
|
+
if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo))
|
|
68
|
+
throw new Error('expected a GitHub owner/repository');
|
|
69
|
+
const base = `https://github.com/${repo}`;
|
|
70
|
+
const request = (url, method) => (deps.fetchImpl ?? fetch)(url, {
|
|
71
|
+
method, redirect: 'manual', signal: AbortSignal.timeout(3_000),
|
|
72
|
+
});
|
|
73
|
+
try {
|
|
74
|
+
const response = await request(`${base}/releases/latest`, 'GET');
|
|
75
|
+
const location = response.headers.get('location');
|
|
76
|
+
if (response.status === 302 && location) {
|
|
77
|
+
const target = new URL(location, base);
|
|
78
|
+
const prefix = `/${repo}/releases/tag/`;
|
|
79
|
+
const tag = target.pathname.slice(prefix.length);
|
|
80
|
+
if (target.origin === 'https://github.com' && target.pathname.startsWith(prefix)
|
|
81
|
+
&& !target.search && !target.hash && STRICT_RELEASE_TAG.test(tag))
|
|
82
|
+
return tag;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch { /* Try bounded publication checks when the web pointer is unavailable. */ }
|
|
86
|
+
const tags = sortedReleaseTags(await (deps.lsRemote ?? readRemoteTags)(repo, true));
|
|
87
|
+
// A tag alone is not evidence of publication: release validation runs after tagging.
|
|
88
|
+
for (const tag of tags.slice(0, 5)) {
|
|
89
|
+
try {
|
|
90
|
+
const response = await request(`${base}/releases/download/${tag}/hq-core-${tag}.tar.gz`, 'HEAD');
|
|
91
|
+
if (response.status === 200 || response.status === 302)
|
|
92
|
+
return tag;
|
|
93
|
+
}
|
|
94
|
+
catch { /* A timeout/network failure cannot establish publication. */ }
|
|
95
|
+
}
|
|
96
|
+
throw new Error('no published release found among the five newest stable tags');
|
|
97
|
+
}
|
|
98
|
+
export function remoteTagSha(output, tag) {
|
|
99
|
+
const refs = parseRefs(output);
|
|
100
|
+
const sha = refs.get(tag + '^{}') ?? refs.get(tag);
|
|
101
|
+
if (!sha)
|
|
102
|
+
throw new Error('tag ' + tag + ' not found in remote tags');
|
|
103
|
+
return sha;
|
|
104
|
+
}
|
|
105
|
+
export async function withGitTagFallback(api, repo, tag, select, deps) {
|
|
106
|
+
try {
|
|
107
|
+
return await api();
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (!(error instanceof GitHubApiUnavailable))
|
|
111
|
+
throw error;
|
|
112
|
+
let result;
|
|
113
|
+
try {
|
|
114
|
+
result = select(tag === undefined
|
|
115
|
+
? await publishedReleaseTag(repo, deps)
|
|
116
|
+
: await (deps.lsRemote ?? readRemoteTags)(repo, false));
|
|
117
|
+
}
|
|
118
|
+
catch (gitError) {
|
|
119
|
+
throw new Error(error.message + '; git ls-remote fallback failed: ' +
|
|
120
|
+
(gitError instanceof Error ? gitError.message : 'unknown error'));
|
|
121
|
+
}
|
|
122
|
+
(deps.warn ?? console.warn)('GitHub API is unavailable; using the published release fallback.');
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=github-tag-fallback.js.map
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
import * as fs from "fs";
|
|
76
76
|
import * as path from "path";
|
|
77
77
|
import { packageRoot, stringDerivedPackageRoot } from "./hq-roots.js";
|
|
78
|
-
import { evalThrowShape, hasCjsLoaderSourceReadFrame, packageNameOf } from "./install-tree-torn.js";
|
|
78
|
+
import { evalThrowShape, hasCjsLoaderSourceReadFrame, packageNameOf, RESOLVER_FRAME, } from "./install-tree-torn.js";
|
|
79
79
|
import { boundedDiagnosticValue } from "./package-root-diagnostics.js";
|
|
80
80
|
/**
|
|
81
81
|
* The actionable remedy shown to the operator. Input-free — nothing from the
|
|
@@ -106,16 +106,6 @@ const RELATIVE_SPECIFIER = /^\.\.?[\\/]/;
|
|
|
106
106
|
* `esm/loader` module.
|
|
107
107
|
*/
|
|
108
108
|
const ESM_LOADER_FRAME = /node:internal[\\/]modules[\\/]esm[\\/]load\b/;
|
|
109
|
-
/**
|
|
110
|
-
* The Node module RESOLVER frame — `finalizeResolution` in
|
|
111
|
-
* `node:internal/modules/esm/resolve`, or the CJS `Module._findPath → toRealPath`
|
|
112
|
-
* route in `node:internal/modules/cjs/loader`. Alongside `syscall === 'lstat'`
|
|
113
|
-
* this proves a resolve-time ENOENT (HQ-CLI-1S) — a path component that vanished
|
|
114
|
-
* between the resolver's stat and its realpathSync lstat — so an ordinary
|
|
115
|
-
* `fs.lstatSync` ENOENT from hq's own code stays captured. Mirrors the frame
|
|
116
|
-
* matcher in install-tree-torn.ts (duplicated exactly as ESM_LOADER_FRAME is).
|
|
117
|
-
*/
|
|
118
|
-
const RESOLVER_FRAME = /node:internal[\\/]modules[\\/](?:esm[\\/]resolve|cjs[\\/]loader)\b/;
|
|
119
109
|
const ROOT_DIAGNOSTIC_BYTES = 256;
|
|
120
110
|
const CODE_DIAGNOSTIC_BYTES = 32;
|
|
121
111
|
// Package names live inside hq-cli's own dependency graph, so their universe is
|
|
@@ -132,6 +132,17 @@ export interface ClassifiedModuleError {
|
|
|
132
132
|
/** The thrown error's `name` for the eval-throw dialect (HQ-CLI-1T), else absent. */
|
|
133
133
|
errorName?: string;
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* The Node module RESOLVER frame — `finalizeResolution` in
|
|
137
|
+
* `node:internal/modules/esm/resolve` (the observed HQ-CLI-1S route, where
|
|
138
|
+
* realpathSync lstat's a component that vanished after the earlier stat), or the
|
|
139
|
+
* CJS `Module._findPath → toRealPath` route in `node:internal/modules/cjs/loader`
|
|
140
|
+
* (the same stat-then-lstat TOCTOU, accepted for symmetry). Requiring a resolver
|
|
141
|
+
* frame — alongside `syscall === 'lstat'` — is what proves the ENOENT came from
|
|
142
|
+
* the resolver's realpath step, so an ordinary `fs.lstatSync` ENOENT written by
|
|
143
|
+
* hq's own code (no resolver frame) is NOT misclassified as a torn install.
|
|
144
|
+
*/
|
|
145
|
+
export declare const RESOLVER_FRAME: RegExp;
|
|
135
146
|
export declare function hasCjsLoaderSourceReadFrame(stack: string): boolean;
|
|
136
147
|
/**
|
|
137
148
|
* Reduce a bare specifier to its PACKAGE name: `@scope/name/sub` → `@scope/name`,
|
|
@@ -87,7 +87,7 @@ function hasEsmLoaderSourceReadFrame(stack) {
|
|
|
87
87
|
* the resolver's realpath step, so an ordinary `fs.lstatSync` ENOENT written by
|
|
88
88
|
* hq's own code (no resolver frame) is NOT misclassified as a torn install.
|
|
89
89
|
*/
|
|
90
|
-
const RESOLVER_FRAME = /node:internal[\\/]modules[\\/](?:esm[\\/]resolve|cjs[\\/]loader)\b/;
|
|
90
|
+
export const RESOLVER_FRAME = /node:internal[\\/]modules[\\/](?:esm[\\/]resolve|cjs[\\/]loader)\b/;
|
|
91
91
|
/** The closed set of error `name`s the eval-throw dialect accepts (HQ-CLI-1T). */
|
|
92
92
|
const EVAL_THROW_NAMES = new Set(["TypeError", "ReferenceError", "SyntaxError"]);
|
|
93
93
|
/**
|
|
@@ -2,7 +2,7 @@ import { releaseCurrentPackageUseLease, releasePackageUseLeaseAfterResidentPrelo
|
|
|
2
2
|
/** Runtime modules that resident commands may need after a wait starts. */
|
|
3
3
|
export const RESIDENT_PACKAGE_MODULES = {
|
|
4
4
|
"agent-kit": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
|
|
5
|
-
"agent-mcp": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "../commands/access.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "../utils/local-files-overview.js", "@indigoai-us/hq-cloud"],
|
|
5
|
+
"agent-mcp": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "../commands/access.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "../utils/local-files-overview.js", "@indigoai-us/hq-cloud", "../commands/files-browse.js"],
|
|
6
6
|
login: [
|
|
7
7
|
"../lib/mesh/api.js",
|
|
8
8
|
"../lib/work-context/config.js",
|
|
@@ -153,6 +153,7 @@ const LOADERS = {
|
|
|
153
153
|
() => import("../lib/first-sync-next-step.js"),
|
|
154
154
|
() => import("../utils/local-files-overview.js"),
|
|
155
155
|
() => import("@indigoai-us/hq-cloud"),
|
|
156
|
+
() => import("../commands/files-browse.js"),
|
|
156
157
|
],
|
|
157
158
|
login: [
|
|
158
159
|
() => import("../lib/mesh/api.js"),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GitHubLookupDeps } from "./github-tag-fallback.js";
|
|
1
2
|
export declare const HQ_CORE_LATEST_URL = "https://api.github.com/repos/indigoai-us/hq-core/releases/latest";
|
|
2
3
|
export declare const LATEST_FETCH_TIMEOUT_MS = 3000;
|
|
3
4
|
export type LatestLookup = "ok" | "network-error";
|
|
@@ -16,7 +17,7 @@ export interface VersionReportDeps {
|
|
|
16
17
|
printUpdateNudge?: (stderr: Pick<NodeJS.WriteStream, "write">) => Promise<void>;
|
|
17
18
|
}
|
|
18
19
|
export declare function normalizeHqCoreTag(tag: string): string | null;
|
|
19
|
-
export declare function fetchLatestHqCoreRelease(fetchImpl?: typeof fetch, timeoutMs?: number, token?: string | undefined): Promise<string | null>;
|
|
20
|
+
export declare function fetchLatestHqCoreRelease(fetchImpl?: typeof fetch, timeoutMs?: number, token?: string | undefined, deps?: GitHubLookupDeps): Promise<string | null>;
|
|
20
21
|
export declare function collectVersionReport(deps?: VersionReportDeps): Promise<VersionReport>;
|
|
21
22
|
export declare function formatVersionReport(report: VersionReport): string;
|
|
22
23
|
export declare function versionReportJson(report: VersionReport): string;
|
|
@@ -14,40 +14,53 @@ import { wantsJson } from "../version-request.js";
|
|
|
14
14
|
import { findHqRoot } from "./manifest.js";
|
|
15
15
|
import { readHqVersion } from "./hq-core-yaml.js";
|
|
16
16
|
import { resolveGhToken } from "./shipped-codex-hooks.js";
|
|
17
|
+
import { GitHubApiUnavailable, isTransientGitHubStatus, withGitTagFallback } from "./github-tag-fallback.js";
|
|
17
18
|
export const HQ_CORE_LATEST_URL = "https://api.github.com/repos/indigoai-us/hq-core/releases/latest";
|
|
18
19
|
export const LATEST_FETCH_TIMEOUT_MS = 3_000;
|
|
19
20
|
export function normalizeHqCoreTag(tag) {
|
|
20
21
|
const version = tag.trim().replace(/^v/i, "");
|
|
21
22
|
return semver.valid(version) ? version : null;
|
|
22
23
|
}
|
|
23
|
-
export async function fetchLatestHqCoreRelease(fetchImpl = fetch, timeoutMs = LATEST_FETCH_TIMEOUT_MS, token = resolveGhToken()) {
|
|
24
|
+
export async function fetchLatestHqCoreRelease(fetchImpl = fetch, timeoutMs = LATEST_FETCH_TIMEOUT_MS, token = resolveGhToken(), deps = {}) {
|
|
24
25
|
try {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
26
|
+
return await withGitTagFallback(async () => {
|
|
27
|
+
try {
|
|
28
|
+
const headers = {
|
|
29
|
+
Accept: "application/vnd.github+json",
|
|
30
|
+
"User-Agent": "hq-cli-version",
|
|
31
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
32
|
+
};
|
|
33
|
+
if (token)
|
|
34
|
+
headers.Authorization = `Bearer ${token}`;
|
|
35
|
+
let res = await fetchImpl(HQ_CORE_LATEST_URL, {
|
|
36
|
+
headers,
|
|
37
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
38
|
+
});
|
|
39
|
+
// hq-core is public. A stale GH_TOKEN 401/403 should not hide the anonymous
|
|
40
|
+
// lookup that used to work.
|
|
41
|
+
if (token && (res.status === 401 || res.status === 403)) {
|
|
42
|
+
const { Authorization: _drop, ...anonHeaders } = headers;
|
|
43
|
+
res = await fetchImpl(HQ_CORE_LATEST_URL, {
|
|
44
|
+
headers: anonHeaders,
|
|
45
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (isTransientGitHubStatus(res.status)) {
|
|
49
|
+
throw new GitHubApiUnavailable(`GitHub releases/latest for indigoai-us/hq-core: HTTP ${res.status}`);
|
|
50
|
+
}
|
|
51
|
+
if (!res.ok)
|
|
52
|
+
return null;
|
|
53
|
+
const body = (await res.json());
|
|
54
|
+
if (typeof body.tag_name !== "string")
|
|
55
|
+
return null;
|
|
56
|
+
return normalizeHqCoreTag(body.tag_name);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (error instanceof GitHubApiUnavailable)
|
|
60
|
+
throw error;
|
|
61
|
+
throw new GitHubApiUnavailable('GitHub release request failed on the network or timed out', { cause: error });
|
|
62
|
+
}
|
|
63
|
+
}, 'indigoai-us/hq-core', undefined, normalizeHqCoreTag, { ...deps, fetchImpl });
|
|
51
64
|
}
|
|
52
65
|
catch {
|
|
53
66
|
return null;
|
package/docs/anywhere-runtime.md
CHANGED
|
@@ -62,6 +62,14 @@ current-user-only DACL, or another process already owns the pipe name, hqd
|
|
|
62
62
|
refuses to start. The flag's missing-row fallback is on across platforms; an
|
|
63
63
|
explicit false remains the operator kill switch.
|
|
64
64
|
|
|
65
|
+
For policy checks, the daemon verifies jq before running the hook scripts.
|
|
66
|
+
On Windows its managed copy is `%USERPROFILE%\.local\bin\jq.exe`, matching
|
|
67
|
+
the global installer. When `USERPROFILE` is set, a managed copy under a
|
|
68
|
+
different Git Bash `HOME` is not tried as a managed fallback, even if the
|
|
69
|
+
profile fails its safety checks. A jq on PATH is still a candidate, subject
|
|
70
|
+
to the same safety and behavior checks. Repair the refused profile path or
|
|
71
|
+
install a system jq outside it; otherwise policy checks fail closed.
|
|
72
|
+
|
|
65
73
|
On macOS and Linux, hqd checks the socket directory and socket path with
|
|
66
74
|
`lstat` before serving. It refuses symlinked, shared, or foreign-owned paths.
|
|
67
75
|
The default socket is under `~/.hq/daemon/`, separate from the registry directory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.242",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"scripts/bench-core-compare.mjs"
|
|
35
35
|
],
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build": "node scripts/generate-dsn.mjs && node scripts/build-flag-registry-worker.mjs && tsc && node scripts/generate-command-catalog.mjs --check && node scripts/copy-schemas.mjs && node scripts/chmod-bins.mjs && node scripts/bundle-sync-runner.mjs",
|
|
37
|
+
"build": "node scripts/generate-dsn.mjs && node scripts/build-flag-registry-worker.mjs && tsc && node scripts/generate-command-catalog.mjs --check && node scripts/copy-schemas.mjs && node scripts/chmod-bins.mjs && node scripts/bundle-sync-runner.mjs && node scripts/stamp-test-build.mjs",
|
|
38
38
|
"release:preflight": "node scripts/check-fleet-local-pin-published.mjs",
|
|
39
39
|
"release:tag": "node scripts/check-fleet-local-pin-published.mjs --release-tag",
|
|
40
40
|
"prepublishOnly": "npm run build",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@aws-sdk/client-iot-data-plane": "^3.1096.0",
|
|
64
64
|
"@aws-sdk/client-s3": "^3.1049.0",
|
|
65
65
|
"@aws-sdk/dsql-signer": "^3.1146.0",
|
|
66
|
-
"@indigoai-us/hq-cloud": "6.18.
|
|
66
|
+
"@indigoai-us/hq-cloud": "6.18.118",
|
|
67
67
|
"@indigoai-us/hq-flags-client": "^0.2.0",
|
|
68
68
|
"@modelcontextprotocol/sdk": "1.32.2",
|
|
69
69
|
"@sentry/node": "^10.49.0",
|
|
@@ -126,11 +126,11 @@
|
|
|
126
126
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
127
127
|
},
|
|
128
128
|
"optionalDependencies": {
|
|
129
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
130
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
131
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
132
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
133
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
134
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
129
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.242",
|
|
130
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.242",
|
|
131
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.242",
|
|
132
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.242",
|
|
133
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.242",
|
|
134
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.242"
|
|
135
135
|
}
|
|
136
136
|
}
|