@indigoai-us/hq-cli 5.345.218 → 5.345.220

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 (138) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/dist/command-catalog.generated.d.ts +94 -1
  3. package/dist/command-catalog.generated.js +114 -1
  4. package/dist/commands/agents.d.ts +22 -0
  5. package/dist/commands/agents.js +92 -1
  6. package/dist/commands/bot.d.ts +48 -0
  7. package/dist/commands/bot.js +108 -8
  8. package/dist/commands/cloud.d.ts +16 -0
  9. package/dist/commands/cloud.js +112 -102
  10. package/dist/commands/core-checkpoint-native.d.ts +13 -0
  11. package/dist/commands/core-checkpoint-native.js +167 -52
  12. package/dist/commands/core-hook-registration-plan.d.ts +8 -0
  13. package/dist/commands/core-hook-registration-plan.js +22 -0
  14. package/dist/commands/core.js +9 -0
  15. package/dist/commands/daemon.js +21 -2
  16. package/dist/commands/doctor.js +4 -0
  17. package/dist/commands/integrations.js +84 -3
  18. package/dist/commands/lanes-shared.d.ts +2 -0
  19. package/dist/commands/lanes-watch.js +28 -1
  20. package/dist/commands/lanes.d.ts +2 -0
  21. package/dist/commands/lanes.js +99 -9
  22. package/dist/commands/packs.js +23 -0
  23. package/dist/commands/pkg-update.d.ts +6 -0
  24. package/dist/commands/pkg-update.js +15 -7
  25. package/dist/commands/reindex.js +6 -0
  26. package/dist/commands/run.js +55 -45
  27. package/dist/commands/sources.js +3 -2
  28. package/dist/index.js +8 -0
  29. package/dist/lib/anywhere-person-setting.d.ts +2 -2
  30. package/dist/lib/anywhere-person-setting.js +2 -2
  31. package/dist/lib/bot/fleet-cron.js +5 -2
  32. package/dist/lib/bot/inflight.d.ts +9 -0
  33. package/dist/lib/bot/jobs/hot-signal-sync.d.ts +51 -0
  34. package/dist/lib/bot/jobs/hot-signal-sync.js +90 -9
  35. package/dist/lib/bot/run.d.ts +29 -5
  36. package/dist/lib/bot/run.js +203 -1
  37. package/dist/lib/bot/signals-try-now.d.ts +76 -0
  38. package/dist/lib/bot/signals-try-now.js +111 -0
  39. package/dist/lib/capacity/collectors/claude-oauth.d.ts +22 -3
  40. package/dist/lib/capacity/collectors/claude-oauth.js +78 -22
  41. package/dist/lib/capacity/scheduler.d.ts +8 -0
  42. package/dist/lib/capacity/scheduler.js +5 -2
  43. package/dist/lib/daemon/anywhere-listener.d.ts +33 -1
  44. package/dist/lib/daemon/anywhere-listener.js +86 -4
  45. package/dist/lib/daemon/machine-check-owner.d.ts +21 -0
  46. package/dist/lib/daemon/machine-check-owner.js +95 -0
  47. package/dist/lib/daemon/machine-check-registration.d.ts +4 -0
  48. package/dist/lib/daemon/machine-check-registration.js +64 -0
  49. package/dist/lib/daemon/machine-checks.d.ts +144 -0
  50. package/dist/lib/daemon/machine-checks.js +412 -0
  51. package/dist/lib/daemon/run.js +35 -4
  52. package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
  53. package/dist/lib/daemon/runtime-notifications.js +50 -0
  54. package/dist/lib/daemon/server.d.ts +2 -0
  55. package/dist/lib/daemon/server.js +6 -0
  56. package/dist/lib/daemon/state-file.d.ts +12 -1
  57. package/dist/lib/daemon/state-file.js +23 -1
  58. package/dist/lib/doctor/checks/fleet-hook-core.d.ts +12 -0
  59. package/dist/lib/doctor/checks/fleet-hook-core.js +127 -0
  60. package/dist/lib/doctor/checks/host-core.js +3 -1
  61. package/dist/lib/doctor/checks/machine-checks.d.ts +16 -0
  62. package/dist/lib/doctor/checks/machine-checks.js +103 -0
  63. package/dist/lib/doctor/registry.js +4 -0
  64. package/dist/lib/doctor/types.d.ts +4 -0
  65. package/dist/lib/hook-engine/canary-gate.d.ts +64 -0
  66. package/dist/lib/hook-engine/canary-gate.js +147 -0
  67. package/dist/lib/hook-engine/coverage.d.ts +3 -1
  68. package/dist/lib/hook-engine/coverage.js +8 -2
  69. package/dist/lib/hook-engine/fleet-registration.d.ts +42 -0
  70. package/dist/lib/hook-engine/fleet-registration.js +168 -0
  71. package/dist/lib/hook-engine/reconcile.js +3 -2
  72. package/dist/lib/hook-engine/registration-identity.d.ts +33 -0
  73. package/dist/lib/hook-engine/registration-identity.js +97 -0
  74. package/dist/lib/hook-engine/registration.d.ts +1 -30
  75. package/dist/lib/hook-engine/registration.js +1 -88
  76. package/dist/lib/hook-engine/resolve.d.ts +2 -0
  77. package/dist/lib/hook-engine/resolve.js +7 -3
  78. package/dist/lib/hot-channels/alert.d.ts +10 -1
  79. package/dist/lib/hot-channels/alert.js +34 -7
  80. package/dist/lib/hot-channels/signals-claude-login.d.ts +53 -0
  81. package/dist/lib/hot-channels/signals-claude-login.js +96 -0
  82. package/dist/lib/hot-channels/signals-pass.d.ts +17 -0
  83. package/dist/lib/hot-channels/signals-pass.js +31 -3
  84. package/dist/lib/lanes/canonical-host.d.ts +8 -1
  85. package/dist/lib/lanes/canonical-host.js +9 -3
  86. package/dist/lib/lanes/machine-identity.d.ts +15 -0
  87. package/dist/lib/lanes/machine-identity.js +26 -0
  88. package/dist/lib/lanes/spawn.js +17 -3
  89. package/dist/lib/search-index/index.js +11 -1
  90. package/dist/lib/signals/engine.d.ts +1 -0
  91. package/dist/lib/signals/engine.js +7 -0
  92. package/dist/lib/signals/reply.d.ts +48 -0
  93. package/dist/lib/signals/reply.js +72 -11
  94. package/dist/lib/signals/steps/adapters.js +6 -0
  95. package/dist/lib/signals/steps/extract.d.ts +50 -3
  96. package/dist/lib/signals/steps/extract.js +100 -17
  97. package/dist/lib/signals/steps/types.d.ts +19 -0
  98. package/dist/lib/sync-core/engine-home.d.ts +6 -1
  99. package/dist/lib/sync-core/engine-home.js +13 -3
  100. package/dist/lib/sync-core/reconcile.js +1 -1
  101. package/dist/lib/sync-core/release-compare.d.ts +7 -0
  102. package/dist/lib/sync-core/release-compare.js +16 -0
  103. package/dist/lib/sync-core/release.d.ts +2 -1
  104. package/dist/lib/sync-core/release.js +2 -10
  105. package/dist/run/schema-env-overrides.d.ts +24 -0
  106. package/dist/run/schema-env-overrides.js +72 -0
  107. package/dist/utils/core-next-flag.d.ts +4 -0
  108. package/dist/utils/core-next-flag.js +22 -0
  109. package/dist/utils/core-next-kill.d.ts +16 -0
  110. package/dist/utils/core-next-kill.js +35 -0
  111. package/dist/utils/host-registration.d.ts +33 -23
  112. package/dist/utils/host-registration.js +90 -66
  113. package/package.json +14 -10
  114. package/scripts/check-function-manifest.mjs +5 -4
  115. package/dist/commands/__fixtures__/access-vault.d.ts +0 -95
  116. package/dist/commands/__fixtures__/access-vault.js +0 -166
  117. package/dist/commands/__fixtures__/make-tar.d.ts +0 -38
  118. package/dist/commands/__fixtures__/make-tar.js +0 -102
  119. package/dist/commands/secrets-public-types.test-d.d.ts +0 -2
  120. package/dist/commands/secrets-public-types.test-d.js +0 -18
  121. package/dist/lib/decisions/fixtures/us001.d.ts +0 -137
  122. package/dist/lib/decisions/fixtures/us001.js +0 -21
  123. package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +0 -226
  124. package/dist/lib/doctor/__testing__/fake-hq-tree.js +0 -408
  125. package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
  126. package/dist/lib/doctor/__testing__/run-doctor.js +0 -69
  127. package/dist/lib/fingerprint/fixtures.d.ts +0 -19
  128. package/dist/lib/fingerprint/fixtures.js +0 -61
  129. package/dist/lib/hot-channels/adapters/__fixtures__/dummy.d.ts +0 -33
  130. package/dist/lib/hot-channels/adapters/__fixtures__/dummy.js +0 -53
  131. package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.d.ts +0 -38
  132. package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.js +0 -64
  133. package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
  134. package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
  135. package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
  136. package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
  137. package/scripts/hook-engine-manifest.mjs +0 -22
  138. package/scripts/mesh-daemon-if-stale.mjs +0 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.345.218",
3
+ "version": "5.345.220",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -10,6 +10,12 @@
10
10
  "files": [
11
11
  "dist",
12
12
  "!dist/**/*.map",
13
+ "!dist/**/__fixtures__",
14
+ "!dist/**/__testing__",
15
+ "!dist/**/*.test-d.*",
16
+ "!dist/lib/test-utils",
17
+ "!dist/lib/decisions/fixtures",
18
+ "!dist/lib/fingerprint/fixtures.*",
13
19
  "assets/scaffold",
14
20
  "assets/bot-workers",
15
21
  "assets/mesh-daemon",
@@ -21,9 +27,7 @@
21
27
  "CHANGELOG.md",
22
28
  "README.md",
23
29
  "contracts",
24
- "scripts/mesh-daemon-if-stale.mjs",
25
30
  "scripts/install-hook-engine.mjs",
26
- "scripts/hook-engine-manifest.mjs",
27
31
  "scripts/check-function-manifest.mjs",
28
32
  "scripts/bench-core.mjs"
29
33
  ],
@@ -42,7 +46,7 @@
42
46
  "gen:hq-mcp-tools": "node scripts/generate-hq-mcp-tools.mjs",
43
47
  "test:db": "vitest run src/lib/db test/commands/db.test.ts test/commands/db-tenant-isolation.test.ts",
44
48
  "test:e2e": "vitest run --config vitest.e2e.config.ts",
45
- "coverage": "vitest run --coverage --coverage.reporter=text-summary --coverage.reporter=json-summary",
49
+ "coverage": "vitest run --coverage --coverage.reporter=text-summary --coverage.reporter=json-summary --reporter=default --reporter=./scripts/ci/coverage-timing-reporter.mjs",
46
50
  "check:lanes-module-cycles": "node scripts/check-lanes-module-cycles.mjs",
47
51
  "vitest": "vitest",
48
52
  "clean": "rm -rf dist",
@@ -119,11 +123,11 @@
119
123
  "*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
120
124
  },
121
125
  "optionalDependencies": {
122
- "@indigoai-us/hq-hook-win32-x64": "5.345.218",
123
- "@indigoai-us/hq-hook-win32-arm64": "5.345.218",
124
- "@indigoai-us/hq-hook-darwin-x64": "5.345.218",
125
- "@indigoai-us/hq-hook-darwin-arm64": "5.345.218",
126
- "@indigoai-us/hq-hook-linux-x64": "5.345.218",
127
- "@indigoai-us/hq-hook-linux-arm64": "5.345.218"
126
+ "@indigoai-us/hq-hook-win32-x64": "5.345.220",
127
+ "@indigoai-us/hq-hook-win32-arm64": "5.345.220",
128
+ "@indigoai-us/hq-hook-darwin-x64": "5.345.220",
129
+ "@indigoai-us/hq-hook-darwin-arm64": "5.345.220",
130
+ "@indigoai-us/hq-hook-linux-x64": "5.345.220",
131
+ "@indigoai-us/hq-hook-linux-arm64": "5.345.220"
128
132
  }
129
133
  }
@@ -456,10 +456,11 @@ function refExcluded(file) {
456
456
  }
457
457
 
458
458
  /** Lines in the tree that name a retiring or removed function. */
459
- export function findReferences(targets, root, { allFiles } = {}) {
459
+ export function findReferences(targets, root, { allFiles, manifest } = {}) {
460
460
  const problems = [];
461
461
  if (!targets.length) return { problems, files: 0 };
462
- const files = (allFiles || listFiles(root, ["."])).filter((f) => !refExcluded(f));
462
+ const files = (allFiles || listFiles(root, ["."])).filter((f) => !refExcluded(f)
463
+ && (!manifest || path.resolve(root, f) !== path.resolve(manifest)));
463
464
  let scanned = 0;
464
465
  for (const file of files) {
465
466
  let stat;
@@ -628,14 +629,14 @@ export async function run(argv) {
628
629
  if (opt.coreRoot) {
629
630
  const tree = checkCoreTree(entries, opt.coreRoot);
630
631
  problems.push(...tree.problems);
631
- const refs = findReferences(targets, opt.coreRoot);
632
+ const refs = findReferences(targets, opt.coreRoot, { manifest: opt.manifest });
632
633
  problems.push(...refs.problems);
633
634
  checked.push(`core tree ${opt.coreRoot}: ${tree.files} hook and script files; references searched in ${refs.files} files`);
634
635
  } else notices.push("no --core-root: hooks and scripts on disk were not compared with the manifest");
635
636
  if (opt.cliRoot) {
636
637
  const tree = checkCliTree(entries, opt.cliRoot, catalog);
637
638
  problems.push(...tree.problems);
638
- const refs = findReferences(targets, opt.cliRoot);
639
+ const refs = findReferences(targets, opt.cliRoot, { manifest: opt.manifest });
639
640
  problems.push(...refs.problems);
640
641
  checked.push(`hq-cli source ${opt.cliRoot}: ${tree.commands} commands, ${tree.daemonFiles} daemon files; references searched in ${refs.files} files`);
641
642
  } else if (opt.cliPackage) {
@@ -1,95 +0,0 @@
1
- /**
2
- * In-memory vault / ACL / DM harness for the `hq access` command.
3
- * No network I/O — listings, GetObject, STS vend, and DMs stay in process
4
- * (or under a tmp hqRoot the caller supplies).
5
- */
6
- import { vi } from "vitest";
7
- import type { CompanyBrowseClientFactory, FilesBrowseVaultClient } from "../files-browse.js";
8
- export type AccessVaultState = "missing" | "present-local" | "present-not-local" | "present-denied";
9
- export interface FakeDmMessage {
10
- recipient: string;
11
- message: string;
12
- prompt?: string;
13
- details?: string;
14
- }
15
- export interface FakeDmTransport {
16
- sent: FakeDmMessage[];
17
- send(msg: FakeDmMessage): Promise<{
18
- eventId: string;
19
- }>;
20
- }
21
- export declare function makeFakeDmTransport(): FakeDmTransport;
22
- export interface AclEntry {
23
- granteeType: string;
24
- granteeId: string;
25
- permission: string;
26
- grantedBy: string;
27
- grantedAt: string;
28
- }
29
- export interface AccessAclTree {
30
- prefix: string;
31
- direct: AclEntry[];
32
- inherited: Array<AclEntry & {
33
- sourcePrefix: string;
34
- }>;
35
- children: Array<AclEntry & {
36
- sourcePrefix: string;
37
- }>;
38
- directRow: {
39
- creatorUid: string;
40
- open: boolean;
41
- createdAt: string;
42
- updatedAt: string;
43
- } | null;
44
- effectivePermission: string | null;
45
- }
46
- export interface AccessMember {
47
- personUid: string;
48
- personEmail: string;
49
- personName?: string;
50
- role: "owner" | "admin" | "member" | "guest";
51
- }
52
- export interface AccessVaultFixture {
53
- state: AccessVaultState;
54
- hqRoot: string;
55
- companySlug: string;
56
- companyUid: string;
57
- /** Company-anchored e.g. companies/acme/knowledge/report.md */
58
- key: string;
59
- /** Company-relative e.g. knowledge/report.md */
60
- bucketKey: string;
61
- vaultClient: FilesBrowseVaultClient;
62
- companyClient: CompanyBrowseClientFactory;
63
- vend: ReturnType<typeof vi.fn>;
64
- acl: AccessAclTree | null;
65
- members: AccessMember[];
66
- dm: FakeDmTransport;
67
- listedKeys: string[];
68
- region: string;
69
- }
70
- export interface MakeAccessFixtureOptions {
71
- state: AccessVaultState;
72
- hqRoot: string;
73
- companySlug?: string;
74
- key?: string;
75
- extraKeys?: string[];
76
- acl?: AccessAclTree | null;
77
- members?: AccessMember[];
78
- content?: string;
79
- /**
80
- * `present-denied` only: make the LIST call itself fail with 403 (the
81
- * `/v1/files/list` shape) instead of returning the key. Models a caller
82
- * without read on the prefix — the server refuses to enumerate.
83
- */
84
- listDenied?: boolean;
85
- /** present-denied only: let a test isolate list denial from vend denial. */
86
- vendDenied?: boolean;
87
- /** Deny only the ROOT (prefix "") list — the caller can read the prefix but not enumerate the bucket. */
88
- rootListDenied?: boolean;
89
- }
90
- export declare function vendStatusForState(state: AccessVaultState): {
91
- status: number;
92
- message?: string;
93
- };
94
- export declare function makeAccessFixture(opts: MakeAccessFixtureOptions): AccessVaultFixture;
95
- //# sourceMappingURL=access-vault.d.ts.map
@@ -1,166 +0,0 @@
1
- /**
2
- * In-memory vault / ACL / DM harness for the `hq access` command.
3
- * No network I/O — listings, GetObject, STS vend, and DMs stay in process
4
- * (or under a tmp hqRoot the caller supplies).
5
- */
6
- import * as fs from "node:fs";
7
- import * as path from "node:path";
8
- import { Readable } from "node:stream";
9
- import { vi } from "vitest";
10
- import { ListObjectsV2Command, GetObjectCommand, } from "@aws-sdk/client-s3";
11
- export function makeFakeDmTransport() {
12
- const sent = [];
13
- let n = 0;
14
- return {
15
- sent,
16
- async send(msg) {
17
- sent.push(msg);
18
- n += 1;
19
- return { eventId: `evt_${n}` };
20
- },
21
- };
22
- }
23
- const FAKE_VEND = {
24
- credentials: {
25
- accessKeyId: "ASIA-test",
26
- secretAccessKey: "secret-test",
27
- sessionToken: "session-test",
28
- },
29
- };
30
- const DEFAULT_MEMBERS = [
31
- {
32
- personUid: "prs_owner",
33
- personEmail: "owner@example.com",
34
- personName: "Olive Owner",
35
- role: "owner",
36
- },
37
- {
38
- personUid: "prs_admin",
39
- personEmail: "admin@example.com",
40
- personName: "Adam Admin",
41
- role: "admin",
42
- },
43
- {
44
- personUid: "prs_me",
45
- personEmail: "me@example.com",
46
- personName: "Mia Member",
47
- role: "member",
48
- },
49
- ];
50
- export function vendStatusForState(state) {
51
- if (state === "missing")
52
- return { status: 404 };
53
- if (state === "present-denied") {
54
- return { status: 403, message: "caller lacks read on this prefix" };
55
- }
56
- return { status: 200 };
57
- }
58
- function attachStatus(err, status) {
59
- const tagged = err;
60
- tagged.status = status;
61
- return tagged;
62
- }
63
- function attachHttpStatus(err, httpStatusCode) {
64
- const tagged = err;
65
- tagged.$metadata = { httpStatusCode };
66
- return tagged;
67
- }
68
- function toBucketKey(key, slug) {
69
- const prefix = `companies/${slug}/`;
70
- const trimmed = key.replace(/^\/+/, "");
71
- if (trimmed.startsWith(prefix))
72
- return trimmed.slice(prefix.length);
73
- return trimmed;
74
- }
75
- export function makeAccessFixture(opts) {
76
- const companySlug = opts.companySlug ?? "acme";
77
- const key = opts.key ?? `companies/${companySlug}/knowledge/report.md`;
78
- const bucketKey = toBucketKey(key, companySlug);
79
- const companyUid = `cmp_${companySlug}`;
80
- const content = opts.content ?? "hello";
81
- const extraKeys = opts.extraKeys ?? [];
82
- const listedKeys = opts.state === "missing" ? [...extraKeys] : [...extraKeys, bucketKey];
83
- const members = opts.members ?? DEFAULT_MEMBERS;
84
- const acl = opts.acl === undefined ? null : opts.acl;
85
- const region = "us-east-1";
86
- const dm = makeFakeDmTransport();
87
- if (opts.state === "present-local") {
88
- const dest = path.join(opts.hqRoot, key);
89
- fs.mkdirSync(path.dirname(dest), { recursive: true });
90
- fs.writeFileSync(dest, content, "utf-8");
91
- }
92
- const vend = vi.fn(async () => {
93
- if (opts.state === "missing") {
94
- throw attachStatus(new Error("not found (404)"), 404);
95
- }
96
- if (opts.state === "present-denied" && opts.vendDenied !== false) {
97
- throw attachStatus(new Error("caller lacks read on this prefix (403)"), 403);
98
- }
99
- return FAKE_VEND;
100
- });
101
- const vendSelf = vi.fn(async () => FAKE_VEND);
102
- const listMyExplicitGrants = vi.fn(async () => []);
103
- const entityShape = {
104
- uid: companyUid,
105
- slug: companySlug,
106
- name: companySlug,
107
- bucketName: `hq-vault-cmp-${companySlug}`,
108
- };
109
- const findInMyNamespace = vi.fn(async () => entityShape);
110
- const get = vi.fn(async () => entityShape);
111
- const vaultClient = {
112
- sts: { vend, vendSelf },
113
- listMyExplicitGrants,
114
- entity: { get, findInMyNamespace },
115
- };
116
- const listDenied = opts.state === "present-denied" && opts.listDenied === true;
117
- const send = vi.fn(async (cmd) => {
118
- if (cmd instanceof ListObjectsV2Command) {
119
- const prefix = cmd.input.Prefix ?? "";
120
- if (listDenied || (opts.rootListDenied === true && prefix === "")) {
121
- throw Object.assign(new Error("files list failed (403)"), {
122
- status: 403,
123
- key: prefix,
124
- company: companySlug,
125
- });
126
- }
127
- const Contents = listedKeys
128
- .filter((k) => (prefix === "" ? true : k.startsWith(prefix)))
129
- .map((Key) => ({
130
- Key,
131
- Size: content.length,
132
- LastModified: new Date(),
133
- }));
134
- return { Contents };
135
- }
136
- if (cmd instanceof GetObjectCommand) {
137
- const requested = cmd.input.Key ?? "";
138
- if (opts.state === "missing" || requested !== bucketKey) {
139
- throw attachHttpStatus(new Error("Not found (404)"), 404);
140
- }
141
- if (opts.state === "present-denied") {
142
- throw attachHttpStatus(new Error("caller lacks read on this prefix"), 403);
143
- }
144
- return { Body: Readable.from([content]) };
145
- }
146
- throw new Error(`unexpected command: ${cmd}`);
147
- });
148
- const companyClient = vi.fn(() => ({ send }));
149
- return {
150
- state: opts.state,
151
- hqRoot: opts.hqRoot,
152
- companySlug,
153
- companyUid,
154
- key,
155
- bucketKey,
156
- vaultClient,
157
- companyClient,
158
- vend,
159
- acl,
160
- members,
161
- dm,
162
- listedKeys,
163
- region,
164
- };
165
- }
166
- //# sourceMappingURL=access-vault.js.map
@@ -1,38 +0,0 @@
1
- /**
2
- * Deterministic, platform-independent malicious-tar fixture builder.
3
- *
4
- * WHY THIS EXISTS (cross-platform zip-slip coverage). The adversarial
5
- * safe-extract / marketplace-security suites need archives that GENUINELY carry
6
- * hostile entries — a `../` traversal name, an absolute path, an escaping
7
- * symlink/hardlink. The obvious approach (shell out to the system `tar` to
8
- * CREATE the archive) is NOT portable: GNU tar (Linux / CI / prod Lambdas)
9
- * STRIPS the leading `../` and absolute `/` when it WRITES an archive, so the
10
- * resulting "malicious" fixture contains a benign `evil-escape` entry and the
11
- * guard has nothing to reject — the test passes on macOS bsdtar (which
12
- * preserves them) but fails on Linux. The guard itself is correct; only the
13
- * fixture construction was platform-dependent.
14
- *
15
- * Fix: WRITE THE TAR BYTES DIRECTLY here. A tar archive is just a sequence of
16
- * 512-byte ustar headers, each optionally followed by the file's content padded
17
- * to a 512-byte boundary, terminated by two zero blocks. By emitting the bytes
18
- * ourselves we control the recorded entry names verbatim — `../evil-escape`,
19
- * `/tmp/evil`, a symlink with linkname `../../etc/passwd` — identically on every
20
- * platform, with no create-time stripping. The reading side (`tar -tvf`, which
21
- * safeExtractTarball's pre-flight uses) does NOT strip anything; it faithfully
22
- * lists whatever bytes we wrote, so the guard sees the real attack everywhere.
23
- */
24
- /** ustar typeflag values we use. */
25
- type TarType = 'file' | 'symlink' | 'hardlink';
26
- export interface TarEntrySpec {
27
- /** Recorded entry name — written VERBATIM (may contain `..`, be absolute…). */
28
- name: string;
29
- type?: TarType;
30
- /** For sym/hardlinks: the recorded link target (also written verbatim). */
31
- linkname?: string;
32
- /** File content (regular files only). */
33
- content?: string | Buffer;
34
- }
35
- /** Build the tar, gzip it, and write it to `outPath`. Returns `outPath`. */
36
- export declare function writeMaliciousTarGz(outPath: string, entries: TarEntrySpec[]): string;
37
- export {};
38
- //# sourceMappingURL=make-tar.d.ts.map
@@ -1,102 +0,0 @@
1
- /**
2
- * Deterministic, platform-independent malicious-tar fixture builder.
3
- *
4
- * WHY THIS EXISTS (cross-platform zip-slip coverage). The adversarial
5
- * safe-extract / marketplace-security suites need archives that GENUINELY carry
6
- * hostile entries — a `../` traversal name, an absolute path, an escaping
7
- * symlink/hardlink. The obvious approach (shell out to the system `tar` to
8
- * CREATE the archive) is NOT portable: GNU tar (Linux / CI / prod Lambdas)
9
- * STRIPS the leading `../` and absolute `/` when it WRITES an archive, so the
10
- * resulting "malicious" fixture contains a benign `evil-escape` entry and the
11
- * guard has nothing to reject — the test passes on macOS bsdtar (which
12
- * preserves them) but fails on Linux. The guard itself is correct; only the
13
- * fixture construction was platform-dependent.
14
- *
15
- * Fix: WRITE THE TAR BYTES DIRECTLY here. A tar archive is just a sequence of
16
- * 512-byte ustar headers, each optionally followed by the file's content padded
17
- * to a 512-byte boundary, terminated by two zero blocks. By emitting the bytes
18
- * ourselves we control the recorded entry names verbatim — `../evil-escape`,
19
- * `/tmp/evil`, a symlink with linkname `../../etc/passwd` — identically on every
20
- * platform, with no create-time stripping. The reading side (`tar -tvf`, which
21
- * safeExtractTarball's pre-flight uses) does NOT strip anything; it faithfully
22
- * lists whatever bytes we wrote, so the guard sees the real attack everywhere.
23
- */
24
- import { gzipSync } from 'node:zlib';
25
- import * as fs from 'node:fs';
26
- const BLOCK = 512;
27
- const TYPEFLAG = {
28
- file: '0', // regular file
29
- symlink: '2', // symbolic link
30
- hardlink: '1', // hard link
31
- };
32
- /** Write an ASCII string into a fixed-width field at `offset`, NUL-padded. */
33
- function writeField(buf, offset, width, value) {
34
- // Truncate defensively; ustar fields are fixed-width.
35
- const s = value.slice(0, width);
36
- buf.write(s, offset, 'ascii');
37
- // Remaining bytes are already 0 from Buffer.alloc.
38
- }
39
- /** Write an octal numeric field: `width-1` octal digits, space-or-NUL terminated. */
40
- function writeOctal(buf, offset, width, value) {
41
- // Classic ustar numeric field: zero-padded octal in (width-1) chars + NUL.
42
- const digits = width - 1;
43
- const oct = value.toString(8).padStart(digits, '0').slice(-digits);
44
- buf.write(oct, offset, 'ascii');
45
- buf[offset + digits] = 0; // NUL terminator
46
- }
47
- /**
48
- * Build one 512-byte ustar header (plus content blocks for regular files) for a
49
- * single entry. The header checksum is computed exactly per spec: sum every
50
- * header byte treating the 8 checksum bytes themselves as ASCII spaces, then
51
- * write that sum as 6 octal digits + NUL + space.
52
- */
53
- function makeTarEntry(spec) {
54
- const type = spec.type ?? 'file';
55
- const content = type === 'file'
56
- ? Buffer.isBuffer(spec.content)
57
- ? spec.content
58
- : Buffer.from(spec.content ?? '', 'utf-8')
59
- : Buffer.alloc(0); // links carry no content payload
60
- const header = Buffer.alloc(BLOCK); // zero-filled
61
- writeField(header, 0, 100, spec.name); // name
62
- writeOctal(header, 100, 8, 0o644); // mode
63
- writeOctal(header, 108, 8, 0); // uid
64
- writeOctal(header, 116, 8, 0); // gid
65
- writeOctal(header, 124, 12, content.length); // size (0 for links)
66
- writeOctal(header, 136, 12, 0); // mtime (deterministic: epoch)
67
- // checksum field (148, 8) — filled below; start as spaces for the sum.
68
- header.fill(' '.charCodeAt(0), 148, 156);
69
- writeField(header, 156, 1, TYPEFLAG[type]); // typeflag
70
- if (spec.linkname !== undefined) {
71
- writeField(header, 157, 100, spec.linkname); // linkname (verbatim)
72
- }
73
- writeField(header, 257, 6, 'ustar'); // magic "ustar\0"
74
- writeField(header, 263, 2, '00'); // version "00"
75
- // uname/gname left empty; devmajor/devminor zero (already NUL).
76
- // Header checksum: unsigned sum of all 512 bytes (with the checksum field as
77
- // spaces, which we set above). Written as 6 octal digits, NUL, space.
78
- let sum = 0;
79
- for (let i = 0; i < BLOCK; i++)
80
- sum += header[i];
81
- const cksum = sum.toString(8).padStart(6, '0').slice(-6);
82
- header.write(cksum, 148, 'ascii');
83
- header[154] = 0; // NUL
84
- header[155] = ' '.charCodeAt(0); // space
85
- if (type !== 'file' || content.length === 0)
86
- return header;
87
- // Content padded up to a 512-byte boundary.
88
- const pad = (BLOCK - (content.length % BLOCK)) % BLOCK;
89
- return Buffer.concat([header, content, Buffer.alloc(pad)]);
90
- }
91
- /** Concatenate entries and append the two zero blocks that end every tar. */
92
- function makeTar(entries) {
93
- const blocks = entries.map(makeTarEntry);
94
- blocks.push(Buffer.alloc(BLOCK * 2)); // end-of-archive marker
95
- return Buffer.concat(blocks);
96
- }
97
- /** Build the tar, gzip it, and write it to `outPath`. Returns `outPath`. */
98
- export function writeMaliciousTarGz(outPath, entries) {
99
- fs.writeFileSync(outPath, gzipSync(makeTar(entries)));
100
- return outPath;
101
- }
102
- //# sourceMappingURL=make-tar.js.map
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=secrets-public-types.test-d.d.ts.map
@@ -1,18 +0,0 @@
1
- const scriptUsage = {
2
- scriptId: "fixture-script",
3
- path: "scripts/example.sh",
4
- sha256: "0".repeat(64),
5
- attestationLevel: "verified",
6
- };
7
- const metadata = {
8
- tier: "standard",
9
- cacheTtlMs: 1_000,
10
- };
11
- const loadedSecret = {
12
- ...metadata,
13
- name: "FIXTURE_NAME",
14
- value: "fixture-only",
15
- };
16
- void [scriptUsage, metadata, loadedSecret];
17
- export {};
18
- //# sourceMappingURL=secrets-public-types.test-d.js.map
@@ -1,137 +0,0 @@
1
- /** Producer-service fixtures verified against hq-pro PR #5060 at 7c234efa (in-memory service output; handler wrappers). */
2
- import type { Decision } from "../client.js";
3
- export declare const openDecision: Decision;
4
- export declare const decisionFixtures: {
5
- create: {
6
- decision: Decision;
7
- };
8
- list: {
9
- decisions: Decision[];
10
- };
11
- answer: {
12
- decision: {
13
- state: string;
14
- updatedAt: string;
15
- answer: {
16
- choiceId: string;
17
- by: string;
18
- at: string;
19
- source: string;
20
- };
21
- id: string;
22
- askerPrincipal: string;
23
- companyUid: string;
24
- audience: {
25
- kind: "person";
26
- personUid: string;
27
- } | {
28
- kind: "company_admins";
29
- };
30
- statement: string;
31
- options: import("../client.js").DecisionOption[];
32
- context: {
33
- links: string[];
34
- brief: string;
35
- commitmentId: string | null;
36
- };
37
- talkThreadId: string | null;
38
- createdAt: string;
39
- expiresAt: string;
40
- };
41
- };
42
- talk: {
43
- decision: {
44
- state: string;
45
- updatedAt: string;
46
- talkThreadId: null;
47
- id: string;
48
- askerPrincipal: string;
49
- companyUid: string;
50
- audience: {
51
- kind: "person";
52
- personUid: string;
53
- } | {
54
- kind: "company_admins";
55
- };
56
- statement: string;
57
- options: import("../client.js").DecisionOption[];
58
- context: {
59
- links: string[];
60
- brief: string;
61
- commitmentId: string | null;
62
- };
63
- answer: {
64
- choiceId: string;
65
- by: string;
66
- at: string;
67
- source: "tap" | "thread" | "desktop";
68
- } | null;
69
- createdAt: string;
70
- expiresAt: string;
71
- };
72
- };
73
- withdraw: {
74
- decision: {
75
- state: string;
76
- updatedAt: string;
77
- id: string;
78
- askerPrincipal: string;
79
- companyUid: string;
80
- audience: {
81
- kind: "person";
82
- personUid: string;
83
- } | {
84
- kind: "company_admins";
85
- };
86
- statement: string;
87
- options: import("../client.js").DecisionOption[];
88
- context: {
89
- links: string[];
90
- brief: string;
91
- commitmentId: string | null;
92
- };
93
- answer: {
94
- choiceId: string;
95
- by: string;
96
- at: string;
97
- source: "tap" | "thread" | "desktop";
98
- } | null;
99
- talkThreadId: string | null;
100
- createdAt: string;
101
- expiresAt: string;
102
- };
103
- };
104
- expired: {
105
- decision: {
106
- state: string;
107
- updatedAt: string;
108
- id: string;
109
- askerPrincipal: string;
110
- companyUid: string;
111
- audience: {
112
- kind: "person";
113
- personUid: string;
114
- } | {
115
- kind: "company_admins";
116
- };
117
- statement: string;
118
- options: import("../client.js").DecisionOption[];
119
- context: {
120
- links: string[];
121
- brief: string;
122
- commitmentId: string | null;
123
- };
124
- answer: {
125
- choiceId: string;
126
- by: string;
127
- at: string;
128
- source: "tap" | "thread" | "desktop";
129
- } | null;
130
- talkThreadId: string | null;
131
- createdAt: string;
132
- expiresAt: string;
133
- };
134
- };
135
- };
136
- export declare const decisionRoutes: string[][];
137
- //# sourceMappingURL=us001.d.ts.map
@@ -1,21 +0,0 @@
1
- export const openDecision = {
2
- id: "f3ccdf93-9b7e-4564-a3ad-566067900aee", companyUid: "cmp_indigo", askerPrincipal: "agt_personal", audience: { kind: "person", personUid: "prs_owner" },
3
- statement: "Release the update?",
4
- options: [{ id: "A", label: "Release", recommended: true }, { id: "B", label: "Wait", recommended: false }],
5
- context: { links: ["https://example.com/review"], brief: "Checks passed", commitmentId: "cm_1" },
6
- state: "open", answer: null, talkThreadId: null,
7
- createdAt: "2026-10-18T02:00:00.000Z", expiresAt: "2026-10-19T02:00:00.000Z", updatedAt: "2026-10-18T02:00:00.000Z",
8
- };
9
- export const decisionFixtures = {
10
- create: { decision: openDecision },
11
- list: { decisions: [openDecision] },
12
- answer: { decision: { ...openDecision, state: "answered", updatedAt: "2026-10-18T03:00:00.000Z", answer: { choiceId: "A", by: "prs_owner", at: "2026-10-18T03:00:00.000Z", source: "desktop" } } },
13
- talk: { decision: { ...openDecision, state: "talking", updatedAt: "2026-10-18T03:00:00.000Z", talkThreadId: null } },
14
- withdraw: { decision: { ...openDecision, state: "withdrawn", updatedAt: "2026-10-18T03:00:00.000Z" } },
15
- expired: { decision: { ...openDecision, state: "expired", updatedAt: "2026-10-19T03:00:00.000Z" } },
16
- };
17
- export const decisionRoutes = [
18
- ["POST", "/v1/decisions"], ["GET", "/v1/decisions"],
19
- ["POST", "/v1/decisions/{id}/answer"], ["POST", "/v1/decisions/{id}/talk"], ["POST", "/v1/decisions/{id}/withdraw"],
20
- ];
21
- //# sourceMappingURL=us001.js.map