@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
package/dist/commands/rescue.js
CHANGED
|
@@ -8,6 +8,7 @@ import { selfUpdateAndReexec } from '../utils/self-update.js';
|
|
|
8
8
|
import { retrustCodexHooksAfterRescue } from '../utils/hook-trust.js';
|
|
9
9
|
import { repairDanglingReleaseLinks } from '../lib/doctor/checks/release-links.js';
|
|
10
10
|
import { PROD_SOURCE, STAGING_SOURCE, resolveGhToken } from '../utils/shipped-codex-hooks.js';
|
|
11
|
+
import { GitHubApiUnavailable, onceWarning, isTransientGitHubStatus, remoteTagSha, withGitTagFallback } from '../utils/github-tag-fallback.js';
|
|
11
12
|
/**
|
|
12
13
|
* Resolve the source repo + ref from the user's flags. Pure + exported for
|
|
13
14
|
* tests. `latestTag` is the resolved latest release tag (prod only); ignored
|
|
@@ -104,48 +105,57 @@ function ghHeaders(token) {
|
|
|
104
105
|
}
|
|
105
106
|
// Thirty seconds gives GitHub time to respond while keeping the recovery command bounded.
|
|
106
107
|
const GITHUB_REQUEST_TIMEOUT_MS = 30_000;
|
|
107
|
-
async function githubJsonRequest(url, token) {
|
|
108
|
+
async function githubJsonRequest(url, token, fetchImpl = fetch) {
|
|
108
109
|
const signal = AbortSignal.timeout(GITHUB_REQUEST_TIMEOUT_MS);
|
|
109
110
|
try {
|
|
110
|
-
const response = await
|
|
111
|
+
const response = await fetchImpl(url, { headers: ghHeaders(token), signal });
|
|
112
|
+
if (isTransientGitHubStatus(response.status)) {
|
|
113
|
+
throw new GitHubApiUnavailable(`GitHub API for ${url}: HTTP ${response.status}`);
|
|
114
|
+
}
|
|
111
115
|
if (!response.ok)
|
|
112
116
|
return { response };
|
|
113
117
|
const body = (await response.json());
|
|
114
118
|
return { response, body };
|
|
115
119
|
}
|
|
116
120
|
catch (error) {
|
|
121
|
+
if (error instanceof GitHubApiUnavailable)
|
|
122
|
+
throw error;
|
|
117
123
|
if (signal.aborted)
|
|
118
|
-
throw new
|
|
119
|
-
throw error;
|
|
124
|
+
throw new GitHubApiUnavailable('GitHub request timed out', { cause: error });
|
|
125
|
+
throw new GitHubApiUnavailable('GitHub request failed on the network', { cause: error });
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
/** Latest release tag for a repo, e.g. `v12.3.0`. Throws on failure. */
|
|
123
|
-
export async function getLatestReleaseTag(repo, token) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
export async function getLatestReleaseTag(repo, token, deps = {}) {
|
|
130
|
+
return withGitTagFallback(async () => {
|
|
131
|
+
const { response, body } = await githubJsonRequest(`https://api.github.com/repos/${repo}/releases/latest`, token, deps.fetchImpl);
|
|
132
|
+
if (!response.ok) {
|
|
133
|
+
throw new Error(`GitHub releases/latest for ${repo}: HTTP ${response.status}`);
|
|
134
|
+
}
|
|
135
|
+
if (!body?.tag_name)
|
|
136
|
+
throw new Error(`no tag_name in latest release for ${repo}`);
|
|
137
|
+
return body.tag_name;
|
|
138
|
+
}, repo, undefined, tag => tag, deps);
|
|
131
139
|
}
|
|
132
140
|
/** Resolve a tag to its commit SHA, dereferencing annotated tags. */
|
|
133
|
-
export async function resolveTagSha(repo, tag, token) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
141
|
+
export async function resolveTagSha(repo, tag, token, deps = {}) {
|
|
142
|
+
return withGitTagFallback(async () => {
|
|
143
|
+
const { response: refRes, body: ref } = await githubJsonRequest(`https://api.github.com/repos/${repo}/git/ref/tags/${encodeURIComponent(tag)}`, token, deps.fetchImpl);
|
|
144
|
+
if (!refRes.ok)
|
|
145
|
+
throw new Error(`git/ref/tags/${tag} for ${repo}: HTTP ${refRes.status}`);
|
|
146
|
+
const obj = ref?.object;
|
|
147
|
+
if (!obj?.sha)
|
|
148
|
+
throw new Error(`no object.sha for tag ${tag} in ${repo}`);
|
|
149
|
+
if (obj.type !== 'tag')
|
|
150
|
+
return obj.sha; // lightweight tag → already a commit
|
|
151
|
+
// Annotated tag → dereference to the commit it points at.
|
|
152
|
+
const { response: tagRes, body: annotated } = await githubJsonRequest(`https://api.github.com/repos/${repo}/git/tags/${obj.sha}`, token, deps.fetchImpl);
|
|
153
|
+
if (!tagRes.ok)
|
|
154
|
+
throw new Error(`git/tags/${obj.sha} for ${repo}: HTTP ${tagRes.status}`);
|
|
155
|
+
if (!annotated?.object?.sha)
|
|
156
|
+
throw new Error(`annotated tag ${tag} has no target sha`);
|
|
157
|
+
return annotated.object.sha;
|
|
158
|
+
}, repo, tag, output => remoteTagSha(output, tag), deps);
|
|
149
159
|
}
|
|
150
160
|
/** Read the installed HQ core version from `{hqRoot}/core/core.yaml`. */
|
|
151
161
|
function readInstalledVersion(hqRoot) {
|
|
@@ -176,6 +186,7 @@ export function registerRescueCommand(program) {
|
|
|
176
186
|
.option('--no-backup', 'Skip the pre-op safety snapshot under ~/.hq/backups')
|
|
177
187
|
.option('--no-self-update', 'Skip updating hq-cli itself to the latest version first')
|
|
178
188
|
.option('--cloud-update', 'Cloud-update mode')
|
|
189
|
+
.option('--verbose', 'Show diagnostic details when recovery fails')
|
|
179
190
|
.action(async (opts) => {
|
|
180
191
|
try {
|
|
181
192
|
// Bring the CLI itself to latest first: the rescue script is bundled
|
|
@@ -190,24 +201,25 @@ export function registerRescueCommand(program) {
|
|
|
190
201
|
}
|
|
191
202
|
const hqRoot = opts.hqRoot ?? findHqRoot();
|
|
192
203
|
const token = resolveGhToken();
|
|
204
|
+
const lookupDeps = { warn: onceWarning() };
|
|
193
205
|
let { source, ref } = resolveRescueTarget(opts);
|
|
194
206
|
let floorSha = opts.floorSha;
|
|
195
207
|
if (!opts.staging) {
|
|
196
208
|
// Prod: resolve the latest release tag when no explicit ref, and
|
|
197
209
|
// pin the floor to the installed version's commit when possible.
|
|
198
210
|
if (!ref) {
|
|
199
|
-
ref = await getLatestReleaseTag(source, token);
|
|
211
|
+
ref = await getLatestReleaseTag(source, token, lookupDeps);
|
|
200
212
|
}
|
|
201
213
|
if (!floorSha) {
|
|
202
214
|
const installed = readInstalledVersion(hqRoot);
|
|
203
215
|
if (installed) {
|
|
204
216
|
try {
|
|
205
|
-
floorSha = await resolveTagSha(source, `v${installed}`, token);
|
|
217
|
+
floorSha = await resolveTagSha(source, `v${installed}`, token, lookupDeps);
|
|
206
218
|
}
|
|
207
219
|
catch (err) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
220
|
+
if (opts.verbose)
|
|
221
|
+
console.error(err);
|
|
222
|
+
console.warn(chalk.yellow('Could not check the installed version; using the saved sync history.'));
|
|
211
223
|
}
|
|
212
224
|
}
|
|
213
225
|
}
|
|
@@ -234,7 +246,9 @@ export function registerRescueCommand(program) {
|
|
|
234
246
|
process.exit(status);
|
|
235
247
|
}
|
|
236
248
|
catch (error) {
|
|
237
|
-
|
|
249
|
+
if (opts.verbose)
|
|
250
|
+
console.error(error);
|
|
251
|
+
console.error('Could not complete HQ recovery; check your connection and try again.');
|
|
238
252
|
process.exit(1);
|
|
239
253
|
}
|
|
240
254
|
});
|
|
@@ -30,6 +30,12 @@ export type SearchOptions = {
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function normalizeQueryForQmd(query: string): string;
|
|
32
32
|
export declare function buildSearchArgs(query: string, options?: SearchOptions): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a `--mode` value to a canonical mode, or throw a usage error. Matching
|
|
35
|
+
* ignores case and surrounding whitespace. Aliases live in a Map so inherited
|
|
36
|
+
* object keys such as `constructor` or `__proto__` are never treated as modes.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveSearchMode(mode: string | undefined): SearchMode;
|
|
33
39
|
export declare function buildGetArgs(document: string, options?: Pick<SearchOptions, 'collection'>): string[];
|
|
34
40
|
export declare function registerSearchCommand(program: Command): void;
|
|
35
41
|
export {};
|
package/dist/commands/search.js
CHANGED
|
@@ -51,6 +51,28 @@ export function buildSearchArgs(query, options = {}) {
|
|
|
51
51
|
args.push('--json');
|
|
52
52
|
return args;
|
|
53
53
|
}
|
|
54
|
+
const SEARCH_MODES = ['keyword', 'semantic', 'hybrid'];
|
|
55
|
+
/**
|
|
56
|
+
* Accepted spellings that are not canonical mode names. qmd describes its BM25
|
|
57
|
+
* pass as "lexical" (and its query documents use a `lex:` prefix), so callers
|
|
58
|
+
* that learned the vocabulary from qmd ask for `--mode lexical`. That is the
|
|
59
|
+
* keyword (BM25) search, so it maps there instead of failing (Sentry HQ-CLI-J2).
|
|
60
|
+
*/
|
|
61
|
+
const SEARCH_MODE_ALIASES = new Map([['lexical', 'keyword']]);
|
|
62
|
+
/**
|
|
63
|
+
* Resolve a `--mode` value to a canonical mode, or throw a usage error. Matching
|
|
64
|
+
* ignores case and surrounding whitespace. Aliases live in a Map so inherited
|
|
65
|
+
* object keys such as `constructor` or `__proto__` are never treated as modes.
|
|
66
|
+
*/
|
|
67
|
+
export function resolveSearchMode(mode) {
|
|
68
|
+
const value = (mode ?? 'keyword').trim().toLowerCase();
|
|
69
|
+
if (SEARCH_MODES.includes(value))
|
|
70
|
+
return value;
|
|
71
|
+
const alias = SEARCH_MODE_ALIASES.get(value);
|
|
72
|
+
if (alias)
|
|
73
|
+
return alias;
|
|
74
|
+
throw new Error(`Unknown search mode '${mode}'. Expected keyword, semantic, or hybrid.`);
|
|
75
|
+
}
|
|
54
76
|
export function buildGetArgs(document, options = {}) {
|
|
55
77
|
const args = ['get', document];
|
|
56
78
|
if (options.collection)
|
|
@@ -85,10 +107,8 @@ export function registerSearchCommand(program) {
|
|
|
85
107
|
process.exitCode = 1;
|
|
86
108
|
return;
|
|
87
109
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
relay(runQmd(buildSearchArgs(query, options)));
|
|
110
|
+
const mode = resolveSearchMode(options.mode);
|
|
111
|
+
relay(runQmd(buildSearchArgs(query, { ...options, mode })));
|
|
92
112
|
});
|
|
93
113
|
search
|
|
94
114
|
.command('get <document>')
|
|
@@ -25,11 +25,10 @@ import { vaultApiFetch, getCompanyUid, getEntityUid } from "../utils/vault-api.j
|
|
|
25
25
|
export type { VaultApiOptions } from "../utils/vault-api.js";
|
|
26
26
|
export { vaultApiFetch, getCompanyUid, getEntityUid };
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
|
-
* `src/journey/limited-resource-telemetry.ts
|
|
30
|
-
*
|
|
28
|
+
* Telemetry surface sent with `hq secrets set`. hq-pro accepts it because it is
|
|
29
|
+
* listed in `RESOURCE_SURFACES` in `src/journey/limited-resource-telemetry.ts`;
|
|
30
|
+
* an unlisted surface falls back to the server default.
|
|
31
31
|
*/
|
|
32
|
-
export declare const HQ_PRO_RESOURCE_SURFACES: readonly ["api", "bot_invite", "bot_join_now", "calendar_auto_schedule", "calendar_preferences", "cli_secrets_set", "console_secrets_form", "deploy_precheck", "external_connection", "factory_install", "integrations_connect", "oauth_callback", "plan_limit_check", "secrets_input_link", "web"];
|
|
33
32
|
export declare const CLI_SECRETS_SET_SURFACE = "cli_secrets_set";
|
|
34
33
|
/**
|
|
35
34
|
* Shown when `secrets share` / `unshare` gets a 403. Changing a secret's
|
package/dist/commands/secrets.js
CHANGED
|
@@ -107,27 +107,10 @@ import { runSandboxJobAfterSubmission } from "../utils/secrets-sandbox-resident.
|
|
|
107
107
|
import { renderSecretInputLink, SECRET_LINK_FORMATS, } from "../lib/secret-input-link.js";
|
|
108
108
|
export { vaultApiFetch, getCompanyUid, getEntityUid };
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
111
|
-
* `src/journey/limited-resource-telemetry.ts
|
|
112
|
-
*
|
|
110
|
+
* Telemetry surface sent with `hq secrets set`. hq-pro accepts it because it is
|
|
111
|
+
* listed in `RESOURCE_SURFACES` in `src/journey/limited-resource-telemetry.ts`;
|
|
112
|
+
* an unlisted surface falls back to the server default.
|
|
113
113
|
*/
|
|
114
|
-
export const HQ_PRO_RESOURCE_SURFACES = [
|
|
115
|
-
"api",
|
|
116
|
-
"bot_invite",
|
|
117
|
-
"bot_join_now",
|
|
118
|
-
"calendar_auto_schedule",
|
|
119
|
-
"calendar_preferences",
|
|
120
|
-
"cli_secrets_set",
|
|
121
|
-
"console_secrets_form",
|
|
122
|
-
"deploy_precheck",
|
|
123
|
-
"external_connection",
|
|
124
|
-
"factory_install",
|
|
125
|
-
"integrations_connect",
|
|
126
|
-
"oauth_callback",
|
|
127
|
-
"plan_limit_check",
|
|
128
|
-
"secrets_input_link",
|
|
129
|
-
"web",
|
|
130
|
-
];
|
|
131
114
|
export const CLI_SECRETS_SET_SURFACE = "cli_secrets_set";
|
|
132
115
|
/**
|
|
133
116
|
* Cognito session for secrets surfaces hq-pro serves on the JWT routes only —
|
package/dist/commands/sources.js
CHANGED
|
@@ -30,7 +30,7 @@ import { SOURCE_CHANNELS, assertSourceChannel, resolveEntity, listAvailableEntit
|
|
|
30
30
|
import { ensureCognitoToken, ensureCognitoIdToken, buildVaultConfig, DEFAULT_COGNITO, DEFAULT_HQ_ROOT, } from "../utils/cognito-session.js";
|
|
31
31
|
import { getCompanyUid, vaultApiFetch } from "../utils/vault-api.js";
|
|
32
32
|
import { isAuthError } from "../utils/auth-error.js";
|
|
33
|
-
import { IntegrationsCliError, callGateway,
|
|
33
|
+
import { IntegrationsCliError, callGateway, fetchIntegrationsSummary, gatewayResultIsError, isBuiltInGatewayProvider, raiseForResponse, toolPrefixForProvider, unwrapGatewayResult, } from "./integrations-core.js";
|
|
34
34
|
import { Sentry } from "../sentry.js";
|
|
35
35
|
import { resolveUploadAuthor } from "../utils/upload-author.js";
|
|
36
36
|
import { createSignalsAlertChannelPoster, raiseSignalsFailureAlerts } from "../lib/hot-channels/alert.js";
|
|
@@ -342,9 +342,13 @@ async function fetchHotChannels(token, companyUid) {
|
|
|
342
342
|
* the gateway routes each call by connection id.
|
|
343
343
|
*/
|
|
344
344
|
export function gatewaySyncDeps(token, companyUid) {
|
|
345
|
+
// One summary read per sync serves both the usable apps and the known connections.
|
|
346
|
+
let summary;
|
|
347
|
+
const readSummary = () => (summary ??= fetchIntegrationsSummary(token, companyUid));
|
|
345
348
|
return {
|
|
346
349
|
fetchHotChannels: () => fetchHotChannels(token, companyUid),
|
|
347
|
-
fetchUsableApps: async () => (await
|
|
350
|
+
fetchUsableApps: async () => (await readSummary()).apps,
|
|
351
|
+
fetchKnownConnections: async () => (await readSummary()).knownConnections,
|
|
348
352
|
async callTool(app, tool, args) {
|
|
349
353
|
const idempotencyKey = `hq-sources-sync-${randomUUID()}`;
|
|
350
354
|
const params = isBuiltInGatewayProvider(app.provider)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import { type SyncCoreReconcileResult } from "../lib/sync-core/reconcile.js";
|
|
3
3
|
import { type EngineManifestScope } from "../lib/sync-core/manifest-scopes.js";
|
|
4
|
+
import { type RolloutVault } from "../lib/sync-core/rollout-state.js";
|
|
4
5
|
import type { RunSyncManifestOptions, RunSyncManifestOutcome, SyncManifestDeps } from "./sync-manifest.js";
|
|
5
6
|
export interface SyncCoreReconcileCommandOptions {
|
|
6
7
|
hqRoot?: string;
|
|
@@ -23,7 +24,14 @@ export interface SyncCoreCommandDeps {
|
|
|
23
24
|
out: (line: string) => void;
|
|
24
25
|
err: (line: string) => void;
|
|
25
26
|
now?: () => Date;
|
|
27
|
+
/** Runs the hq-cloud reindex against the HQ folder (tests replace it). */
|
|
28
|
+
reindex?: (hqRoot: string) => {
|
|
29
|
+
status: number;
|
|
30
|
+
} | Promise<{
|
|
31
|
+
status: number;
|
|
32
|
+
}>;
|
|
26
33
|
}
|
|
34
|
+
export declare function runPostApplyReindex(hqRoot: string, vaults: readonly RolloutVault[], d: SyncCoreCommandDeps, log: (line: string) => void): Promise<void>;
|
|
27
35
|
export declare function runSyncCoreReconcile(opts: SyncCoreReconcileCommandOptions, d?: SyncCoreCommandDeps): Promise<SyncCoreReconcileResult>;
|
|
28
36
|
export interface SyncCoreManifestCommandOptions {
|
|
29
37
|
hqRoot?: string;
|
|
@@ -10,9 +10,35 @@ import { readCompanyDownloadStreams, readCompanyRolloutFlag } from "../lib/sync-
|
|
|
10
10
|
import { reconcileSyncCore } from "../lib/sync-core/reconcile.js";
|
|
11
11
|
import { engineOwnedManifestScopes, manifestScopeArg } from "../lib/sync-core/manifest-scopes.js";
|
|
12
12
|
import { readSyncCoreRolloutState, syncCoreRolloutStatePath } from "../lib/sync-core/rollout-state.js";
|
|
13
|
+
import { reindexAfterEngineChanges } from "../lib/sync-core/post-apply-reindex.js";
|
|
13
14
|
import { readVaultSyncSwitches } from "../lib/vault-sync-switches.js";
|
|
14
15
|
import { isSyncCoreVaultUid } from "../lib/sync-core/vault-uid.js";
|
|
15
16
|
import { effectiveEngineSettings, readSyncCoreVaultSettings, setSyncCoreVaultSetting, SyncCoreVaultSettingError, } from "../lib/sync-core/vault-settings.js";
|
|
17
|
+
const SESSION_LOG_CAPTURE_QUIET_FOR_MS = 10 * 60_000;
|
|
18
|
+
const SESSION_LOG_CAPTURE_MAX_STALENESS_MS = 60 * 60_000;
|
|
19
|
+
export async function runPostApplyReindex(hqRoot, vaults, d, log) {
|
|
20
|
+
try {
|
|
21
|
+
await reindexAfterEngineChanges({
|
|
22
|
+
home: d.home,
|
|
23
|
+
hqRoot,
|
|
24
|
+
vaults,
|
|
25
|
+
reindex: d.reindex ?? (async (root) => {
|
|
26
|
+
const { reindex } = await import("@indigoai-us/hq-cloud");
|
|
27
|
+
return reindex({
|
|
28
|
+
repoRoot: root,
|
|
29
|
+
lockTimeoutSec: 0,
|
|
30
|
+
sessionLogQuietForMs: SESSION_LOG_CAPTURE_QUIET_FOR_MS,
|
|
31
|
+
sessionLogMaxStalenessMs: SESSION_LOG_CAPTURE_MAX_STALENESS_MS,
|
|
32
|
+
});
|
|
33
|
+
}),
|
|
34
|
+
now: d.now,
|
|
35
|
+
log,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
d.err(`warning: could not check whether the new sync engine changed skills or workers: ${error instanceof Error ? error.message : String(error)}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
16
42
|
function defaultDeps() {
|
|
17
43
|
return {
|
|
18
44
|
home: os.homedir(),
|
|
@@ -42,6 +68,20 @@ async function resolveHqRoot(flag, env) {
|
|
|
42
68
|
return fallback;
|
|
43
69
|
throw new Error("no HQ folder found; pass --hq-root <path>");
|
|
44
70
|
}
|
|
71
|
+
async function machineTypeHere(d) {
|
|
72
|
+
const [{ detectMachineType }, { readDaemonConfig }] = await Promise.all([
|
|
73
|
+
import("../lib/daemon/machine-type.js"),
|
|
74
|
+
import("../lib/daemon/config.js"),
|
|
75
|
+
]);
|
|
76
|
+
return detectMachineType(undefined, {
|
|
77
|
+
platform: d.platform,
|
|
78
|
+
env: d.env,
|
|
79
|
+
home: d.home,
|
|
80
|
+
savedType: readDaemonConfig(daemonPaths(d.home, d.env).configPath).machineType,
|
|
81
|
+
existsSync: fs.existsSync,
|
|
82
|
+
readFileSync: (p) => fs.readFileSync(p, "utf8"),
|
|
83
|
+
}).type;
|
|
84
|
+
}
|
|
45
85
|
export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
|
|
46
86
|
const hqRoot = await resolveHqRoot(opts.hqRoot, d.env);
|
|
47
87
|
const [{ VaultClient }, { buildVaultConfig, ensureCognitoIdToken, machineTokenCacheFile, wantsMachineCognitoTokens }] = await Promise.all([import("@indigoai-us/hq-cloud"), import("../utils/cognito-session.js")]);
|
|
@@ -64,6 +104,8 @@ export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
|
|
|
64
104
|
getEntity: async () => null,
|
|
65
105
|
}),
|
|
66
106
|
readRolloutFlag: (companyUid) => readCompanyRolloutFlag(companyUid, token, { env: d.env }),
|
|
107
|
+
resolveCompany: (companyUid) => client.entity.get(companyUid),
|
|
108
|
+
machineType: await machineTypeHere(d),
|
|
67
109
|
readDownloadStreams: (companyUid) => readCompanyDownloadStreams(companyUid, token, { env: d.env }),
|
|
68
110
|
ensureBinary: (release) => ensureSyncCoreBinary({ home: d.home, platform: d.platform, arch: d.arch, release, env: d.env }),
|
|
69
111
|
platform: d.platform,
|
|
@@ -71,6 +113,7 @@ export async function runSyncCoreReconcile(opts, d = defaultDeps()) {
|
|
|
71
113
|
readPin: () => readSyncCorePin({ env: d.env }),
|
|
72
114
|
log: opts.json ? () => { } : d.out,
|
|
73
115
|
});
|
|
116
|
+
await runPostApplyReindex(hqRoot, result.state.vaults, d, opts.json ? () => { } : d.out);
|
|
74
117
|
if (opts.json)
|
|
75
118
|
d.out(JSON.stringify(result.state, null, 2));
|
|
76
119
|
else if (result.state.vaults.length === 0)
|