@indigoai-us/hq-cli 5.345.154 → 5.345.156
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 +138 -0
- package/dist/command-catalog.generated.d.ts +59 -7
- package/dist/command-catalog.generated.js +75 -7
- package/dist/commands/agent-inbox.js +2 -2
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +92 -3
- package/dist/commands/core.js +1 -1
- package/dist/commands/files-browse.d.ts +16 -0
- package/dist/commands/files-browse.js +52 -1
- package/dist/commands/integrations-core.d.ts +13 -1
- package/dist/commands/integrations-core.js +49 -4
- package/dist/commands/integrations.js +4 -2
- package/dist/commands/library-add.d.ts +6 -2
- package/dist/commands/library-add.js +45 -6
- package/dist/commands/library-caption.d.ts +38 -1
- package/dist/commands/library-caption.js +304 -3
- package/dist/commands/library-link.d.ts +7 -3
- package/dist/commands/library-link.js +10 -4
- package/dist/commands/library-remove.d.ts +122 -0
- package/dist/commands/library-remove.js +681 -0
- package/dist/commands/library.d.ts +26 -1
- package/dist/commands/library.js +101 -14
- package/dist/commands/secrets.d.ts +16 -0
- package/dist/commands/secrets.js +144 -8
- package/dist/commands/storage-offload.d.ts +22 -4
- package/dist/commands/storage-offload.js +196 -2
- package/dist/commands/storage.js +5 -0
- package/dist/lib/agent-kit/inbox-state.d.ts +7 -0
- package/dist/lib/agent-kit/inbox-state.js +5 -1
- package/dist/lib/agent-kit/mcp/tools.js +2 -1
- package/dist/lib/daemon/machine-login.d.ts +20 -0
- package/dist/lib/daemon/machine-login.js +53 -8
- package/dist/lib/daemon/machine-token-identity.d.ts +34 -0
- package/dist/lib/daemon/machine-token-identity.js +123 -0
- package/dist/lib/doctor/checks/sync-health.d.ts +9 -0
- package/dist/lib/doctor/checks/sync-health.js +66 -1
- package/dist/lib/doctor/company-resolution-state.d.ts +30 -0
- package/dist/lib/doctor/company-resolution-state.js +89 -0
- package/dist/lib/doctor/fix/apply.d.ts +36 -6
- package/dist/lib/doctor/fix/apply.js +128 -12
- package/dist/lib/doctor/types.d.ts +1 -1
- package/dist/lib/doctor/types.js +1 -0
- package/dist/lib/hook-engine/resolve.js +6 -2
- package/dist/lib/index-render/company-knowledge.d.ts +1 -1
- package/dist/lib/index-render/company-knowledge.js +3 -2
- package/dist/lib/index-render/index.js +44 -3
- package/dist/lib/index-render/projects.d.ts +1 -1
- package/dist/lib/index-render/projects.js +4 -2
- package/dist/lib/lanes/registry-flag.d.ts +23 -2
- package/dist/lib/lanes/registry-flag.js +256 -36
- package/dist/lib/personal-secrets-audit.d.ts +31 -0
- package/dist/lib/personal-secrets-audit.js +45 -0
- package/dist/sentry-before-send.js +1 -0
- package/dist/utils/access-denied-hint.js +6 -0
- package/dist/utils/client-health.d.ts +34 -0
- package/dist/utils/client-health.js +96 -3
- package/package.json +7 -7
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* Runs on a Cognito session or on an `HQ_API_KEY` with `files:read` (the
|
|
7
7
|
* library-agent preset). Under a key, vaultApiFetch rewrites /v1/files/presign
|
|
8
8
|
* to /v1/keys/files/presign; the key is company-bound, so the company comes
|
|
9
|
-
* from --company
|
|
9
|
+
* from --company (a cmp_ uid, or a slug mapped through companies/manifest.yaml),
|
|
10
|
+
* HQ_COMPANY_UID, or the placeholder's companies/<slug>/ via the manifest.
|
|
10
11
|
*
|
|
11
12
|
* Wire contract (hq-pro files-presign):
|
|
12
13
|
* POST /v1/files/presign
|
|
@@ -44,6 +45,7 @@ export async function runLibraryLink(target, options, deps) {
|
|
|
44
45
|
let key;
|
|
45
46
|
let placeholderPath;
|
|
46
47
|
let companyRef = options.company;
|
|
48
|
+
let placeholderSlug;
|
|
47
49
|
if (isVaultKey(target)) {
|
|
48
50
|
key = target;
|
|
49
51
|
}
|
|
@@ -63,14 +65,18 @@ export async function runLibraryLink(target, options, deps) {
|
|
|
63
65
|
}
|
|
64
66
|
key = placeholder.key;
|
|
65
67
|
// On a session the placeholder's companies/<slug>/ names the company. A
|
|
66
|
-
// key is company-bound
|
|
68
|
+
// key is company-bound: its resolver prefers HQ_COMPANY_UID and gets the
|
|
69
|
+
// slug only as a fallback.
|
|
70
|
+
placeholderSlug = /^companies\/([^/]+)\//.exec(placeholderPath)?.[1];
|
|
67
71
|
if (companyRef === undefined && !deps.apiKey) {
|
|
68
|
-
companyRef =
|
|
72
|
+
companyRef = placeholderSlug;
|
|
69
73
|
if (!companyRef)
|
|
70
74
|
throw new Error(`'${placeholderPath}' is not inside companies/<slug>/; pass --company.`);
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
|
-
const company =
|
|
77
|
+
const company = deps.apiKey && placeholderSlug !== undefined
|
|
78
|
+
? await deps.resolveCompany(companyRef, placeholderSlug)
|
|
79
|
+
: await deps.resolveCompany(companyRef);
|
|
74
80
|
const res = await deps.presign({ company, key, op: "get", expiresIn });
|
|
75
81
|
const body = (await res.json().catch(() => ({})));
|
|
76
82
|
if (!res.ok) {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
export interface LibraryRemoveOptions {
|
|
3
|
+
/** Company slug (or cmp_ uid); every target must be in this company. */
|
|
4
|
+
company?: string;
|
|
5
|
+
purge?: boolean;
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
yes?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Server reply for POST /v1/files/delete (the fields rm reads). */
|
|
10
|
+
export interface VaultDeleteReply {
|
|
11
|
+
matched: number;
|
|
12
|
+
deleted: number;
|
|
13
|
+
}
|
|
14
|
+
export interface LibraryRemoveDeps {
|
|
15
|
+
hqRoot: string;
|
|
16
|
+
/** Company slug → cmp_ uid. */
|
|
17
|
+
resolveCompany: (slug: string) => Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* POST /v1/files/delete for one exact key. Throws an Error whose message is
|
|
20
|
+
* ready to show (permission and auth errors included).
|
|
21
|
+
*/
|
|
22
|
+
deleteKey: (companyUid: string, key: string, dryRun: boolean) => Promise<VaultDeleteReply>;
|
|
23
|
+
/** POST /v1/search. Only called for `--purge`. */
|
|
24
|
+
searchAssets: (body: Record<string, unknown>) => Promise<Response>;
|
|
25
|
+
/** Every key in the company vault (company-relative). Only called for `--purge`. */
|
|
26
|
+
listVaultKeys: (companyUid: string) => Promise<string[]>;
|
|
27
|
+
/** Text of small vault objects; null for one that cannot be read. Only called for `--purge`. */
|
|
28
|
+
readVaultObjects: (companyUid: string, keys: readonly string[]) => Promise<Map<string, string | null>>;
|
|
29
|
+
/** Ask a yes/no question. Only called without --yes and --dry-run. */
|
|
30
|
+
confirm: (message: string) => Promise<boolean>;
|
|
31
|
+
/** Preview and progress lines. */
|
|
32
|
+
log: (line: string) => void;
|
|
33
|
+
/** sha256 of a local file. */
|
|
34
|
+
hashFile?: (file: string) => Promise<string>;
|
|
35
|
+
/** Delete one local file. */
|
|
36
|
+
removeFile?: (file: string) => Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export type StepState = "removed" | "would-remove" | "absent" | "kept" | "failed" | "not-run";
|
|
39
|
+
export interface LibraryRemoveItem {
|
|
40
|
+
/** HQ-relative placeholder path. */
|
|
41
|
+
placeholderPath: string;
|
|
42
|
+
/** HQ-relative original path (the file the placeholder stands in for). */
|
|
43
|
+
originalPath: string;
|
|
44
|
+
/** Company-relative vault key of the synced placeholder. */
|
|
45
|
+
vaultKey: string;
|
|
46
|
+
/** The blob the placeholder points at. */
|
|
47
|
+
blobKey: string;
|
|
48
|
+
original: StepState;
|
|
49
|
+
placeholder: StepState;
|
|
50
|
+
vault: StepState;
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface LibraryRemoveBlob {
|
|
54
|
+
key: string;
|
|
55
|
+
state: StepState;
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface LibraryRemoveResult {
|
|
59
|
+
company: string;
|
|
60
|
+
companyUid: string;
|
|
61
|
+
dryRun: boolean;
|
|
62
|
+
purge: boolean;
|
|
63
|
+
/** False when the confirmation was declined. */
|
|
64
|
+
confirmed: boolean;
|
|
65
|
+
items: LibraryRemoveItem[];
|
|
66
|
+
blobs: LibraryRemoveBlob[];
|
|
67
|
+
/** Commands that undo the vault side. */
|
|
68
|
+
undo: string[];
|
|
69
|
+
}
|
|
70
|
+
/** Local company placeholders, other than `exclude`, that point at `blobKey`. */
|
|
71
|
+
export declare function localBlobReferences(hqRoot: string, slug: string, blobKey: string, exclude: ReadonlySet<string>): string[];
|
|
72
|
+
/**
|
|
73
|
+
* Placeholders in the company vault, other than `exclude` (company-relative
|
|
74
|
+
* keys), that point at any of `blobKeys`. Returns blob key → placeholder keys.
|
|
75
|
+
*
|
|
76
|
+
* Two passes:
|
|
77
|
+
* 1. a quick asset search (`kind: "asset"`, query "hqcloud", which every
|
|
78
|
+
* placeholder path carries). Each hit returns its vaultKey, so a shared
|
|
79
|
+
* blob is usually found in one call. This pass cannot prove a blob is
|
|
80
|
+
* unused: hq-pro does not index the hashes and keys in a placeholder,
|
|
81
|
+
* caps a search at 50 hits with no paging, and may lag a fresh upload.
|
|
82
|
+
* Its errors are ignored; pass 2 decides.
|
|
83
|
+
* 2. when pass 1 finds nothing, every `.hqcloud` key the caller can list
|
|
84
|
+
* (GET /v1/files/list, as `hq files search` does), read in one batched
|
|
85
|
+
* presign and parsed. This lists the whole company vault, so it can take
|
|
86
|
+
* minutes on a large one. Any listing or read failure throws: a purge
|
|
87
|
+
* must not go ahead on a guess.
|
|
88
|
+
*/
|
|
89
|
+
export declare function cloudBlobReferences(blobKeys: readonly string[], slug: string, companyUid: string, exclude: ReadonlySet<string>, deps: Pick<LibraryRemoveDeps, "searchAssets" | "listVaultKeys" | "readVaultObjects" | "log">): Promise<Map<string, string[]>>;
|
|
90
|
+
/** GET /v1/files/list for every key in the company vault, following the cursor. */
|
|
91
|
+
export declare function listAllVaultKeys(companyUid: string, list: (query: Record<string, string>) => Promise<Response>): Promise<string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Read small vault objects: one batched presign (op "get") per 1000 keys, then
|
|
94
|
+
* a GET per URL. A key that cannot be presigned or read maps to null. Errors
|
|
95
|
+
* never include a URL, which carries a signature.
|
|
96
|
+
*/
|
|
97
|
+
export declare function readSmallVaultObjects(companyUid: string, keys: readonly string[], presign: (body: Record<string, unknown>) => Promise<Response>, get?: (url: string) => Promise<Response>): Promise<Map<string, string | null>>;
|
|
98
|
+
/**
|
|
99
|
+
* Testable core. Checks every target, previews, confirms, then removes in the
|
|
100
|
+
* order described at the top of this file.
|
|
101
|
+
*/
|
|
102
|
+
export declare function runLibraryRemove(targets: readonly string[], options: LibraryRemoveOptions, deps: LibraryRemoveDeps): Promise<LibraryRemoveResult>;
|
|
103
|
+
export declare function formatLibraryRemoveResult(result: LibraryRemoveResult): string;
|
|
104
|
+
/**
|
|
105
|
+
* User-facing message for a failed POST /v1/files/delete. `err` is duck-typed
|
|
106
|
+
* on `status` (files.ts's FilesDeleteHttpError) so this module does not load
|
|
107
|
+
* files.ts at startup.
|
|
108
|
+
*/
|
|
109
|
+
export declare function vaultDeleteErrorMessage(err: unknown, key: string, apiKey: boolean, format: (err: never, key: string) => string): string;
|
|
110
|
+
/**
|
|
111
|
+
* Company resolver for rm. A session resolves slugs through the API. An
|
|
112
|
+
* HQ_API_KEY cannot (hq-pro serves no keyed membership lookup), so it maps the
|
|
113
|
+
* placeholder folder's slug, or an explicit `--company` slug or uid, through
|
|
114
|
+
* companies/manifest.yaml with library.ts's libraryCompanyForApiKey; hq-pro
|
|
115
|
+
* still checks the uid against the key on every delete.
|
|
116
|
+
*/
|
|
117
|
+
export declare function removeCompanyResolver(credential: {
|
|
118
|
+
kind: "api-key" | "cognito";
|
|
119
|
+
token: string;
|
|
120
|
+
}, hqRoot: string, explicit: string | undefined): Promise<(slug: string) => Promise<string>>;
|
|
121
|
+
export declare function registerLibraryRemoveCommand(library: Command): void;
|
|
122
|
+
//# sourceMappingURL=library-remove.d.ts.map
|