@indigoai-us/hq-cloud 6.15.4 → 6.15.6
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/dist/cli/push-scan-exclusions.test.d.ts +2 -0
- package/dist/cli/push-scan-exclusions.test.d.ts.map +1 -0
- package/dist/cli/push-scan-exclusions.test.js +87 -0
- package/dist/cli/push-scan-exclusions.test.js.map +1 -0
- package/dist/cli/rescue-exec-bit-preserve.test.js +8 -0
- package/dist/cli/rescue-exec-bit-preserve.test.js.map +1 -1
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +21 -1
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +82 -0
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync.d.ts +23 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +9 -0
- package/dist/cli/sync.js.map +1 -1
- package/dist/lib/net-errors.d.ts.map +1 -1
- package/dist/lib/net-errors.js +4 -0
- package/dist/lib/net-errors.js.map +1 -1
- package/dist/machine-auth.test.js +7 -1
- package/dist/machine-auth.test.js.map +1 -1
- package/dist/object-io.d.ts +21 -0
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +229 -77
- package/dist/object-io.js.map +1 -1
- package/dist/object-io.test.js +211 -1
- package/dist/object-io.test.js.map +1 -1
- package/dist/outposts/billing.d.ts +41 -0
- package/dist/outposts/billing.d.ts.map +1 -0
- package/dist/outposts/billing.js +53 -0
- package/dist/outposts/billing.js.map +1 -0
- package/dist/outposts/cli-billing.d.ts +59 -0
- package/dist/outposts/cli-billing.d.ts.map +1 -0
- package/dist/outposts/cli-billing.js +93 -0
- package/dist/outposts/cli-billing.js.map +1 -0
- package/dist/outposts/cli.d.ts +13 -0
- package/dist/outposts/cli.d.ts.map +1 -0
- package/dist/outposts/cli.js +13 -0
- package/dist/outposts/cli.js.map +1 -0
- package/dist/outposts/client.d.ts +140 -0
- package/dist/outposts/client.d.ts.map +1 -0
- package/dist/outposts/client.js +271 -0
- package/dist/outposts/client.js.map +1 -0
- package/dist/outposts/client.test.d.ts +9 -0
- package/dist/outposts/client.test.d.ts.map +1 -0
- package/dist/outposts/client.test.js +226 -0
- package/dist/outposts/client.test.js.map +1 -0
- package/dist/outposts/command.d.ts +74 -0
- package/dist/outposts/command.d.ts.map +1 -0
- package/dist/outposts/command.js +661 -0
- package/dist/outposts/command.js.map +1 -0
- package/dist/outposts/command.test.d.ts +18 -0
- package/dist/outposts/command.test.d.ts.map +1 -0
- package/dist/outposts/command.test.js +933 -0
- package/dist/outposts/command.test.js.map +1 -0
- package/dist/outposts/errors.d.ts +32 -0
- package/dist/outposts/errors.d.ts.map +1 -0
- package/dist/outposts/errors.js +72 -0
- package/dist/outposts/errors.js.map +1 -0
- package/dist/outposts/heartbeat-command.d.ts +106 -0
- package/dist/outposts/heartbeat-command.d.ts.map +1 -0
- package/dist/outposts/heartbeat-command.js +186 -0
- package/dist/outposts/heartbeat-command.js.map +1 -0
- package/dist/outposts/host-deps.d.ts +49 -0
- package/dist/outposts/host-deps.d.ts.map +1 -0
- package/dist/outposts/host-deps.js +93 -0
- package/dist/outposts/host-deps.js.map +1 -0
- package/dist/outposts/index.d.ts +36 -0
- package/dist/outposts/index.d.ts.map +1 -0
- package/dist/outposts/index.js +32 -0
- package/dist/outposts/index.js.map +1 -0
- package/dist/outposts/node.d.ts +23 -0
- package/dist/outposts/node.d.ts.map +1 -0
- package/dist/outposts/node.js +22 -0
- package/dist/outposts/node.js.map +1 -0
- package/dist/outposts/remote-command.d.ts +30 -0
- package/dist/outposts/remote-command.d.ts.map +1 -0
- package/dist/outposts/remote-command.js +39 -0
- package/dist/outposts/remote-command.js.map +1 -0
- package/dist/outposts/replica-sync.d.ts +40 -0
- package/dist/outposts/replica-sync.d.ts.map +1 -0
- package/dist/outposts/replica-sync.js +188 -0
- package/dist/outposts/replica-sync.js.map +1 -0
- package/dist/outposts/replica-sync.test.d.ts +2 -0
- package/dist/outposts/replica-sync.test.d.ts.map +1 -0
- package/dist/outposts/replica-sync.test.js +224 -0
- package/dist/outposts/replica-sync.test.js.map +1 -0
- package/dist/outposts/self-deploy.d.ts +47 -0
- package/dist/outposts/self-deploy.d.ts.map +1 -0
- package/dist/outposts/self-deploy.js +188 -0
- package/dist/outposts/self-deploy.js.map +1 -0
- package/dist/outposts/self-deploy.test.d.ts +2 -0
- package/dist/outposts/self-deploy.test.d.ts.map +1 -0
- package/dist/outposts/self-deploy.test.js +186 -0
- package/dist/outposts/self-deploy.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-bounds.test.d.ts +25 -0
- package/dist/outposts/session-heartbeat-bounds.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-bounds.test.js +156 -0
- package/dist/outposts/session-heartbeat-bounds.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-guard.test.d.ts +16 -0
- package/dist/outposts/session-heartbeat-guard.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-guard.test.js +88 -0
- package/dist/outposts/session-heartbeat-guard.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-publisher.d.ts +76 -0
- package/dist/outposts/session-heartbeat-publisher.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-publisher.js +117 -0
- package/dist/outposts/session-heartbeat-publisher.js.map +1 -0
- package/dist/outposts/session-heartbeat-publisher.test.d.ts +10 -0
- package/dist/outposts/session-heartbeat-publisher.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-publisher.test.js +153 -0
- package/dist/outposts/session-heartbeat-publisher.test.js.map +1 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts +18 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.js +106 -0
- package/dist/outposts/session-heartbeat-retain-guard.test.js.map +1 -0
- package/dist/outposts/session-heartbeat.d.ts +210 -0
- package/dist/outposts/session-heartbeat.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat.js +657 -0
- package/dist/outposts/session-heartbeat.js.map +1 -0
- package/dist/outposts/session-heartbeat.test.d.ts +11 -0
- package/dist/outposts/session-heartbeat.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat.test.js +370 -0
- package/dist/outposts/session-heartbeat.test.js.map +1 -0
- package/dist/outposts/ssh.d.ts +29 -0
- package/dist/outposts/ssh.d.ts.map +1 -0
- package/dist/outposts/ssh.js +66 -0
- package/dist/outposts/ssh.js.map +1 -0
- package/dist/outposts/transport.d.ts +76 -0
- package/dist/outposts/transport.d.ts.map +1 -0
- package/dist/outposts/transport.js +91 -0
- package/dist/outposts/transport.js.map +1 -0
- package/dist/outposts/transport.test.d.ts +10 -0
- package/dist/outposts/transport.test.d.ts.map +1 -0
- package/dist/outposts/transport.test.js +116 -0
- package/dist/outposts/transport.test.js.map +1 -0
- package/dist/outposts/types.d.ts +125 -0
- package/dist/outposts/types.d.ts.map +1 -0
- package/dist/outposts/types.js +13 -0
- package/dist/outposts/types.js.map +1 -0
- package/dist/personal-vault.d.ts +69 -0
- package/dist/personal-vault.d.ts.map +1 -1
- package/dist/personal-vault.js +100 -0
- package/dist/personal-vault.js.map +1 -1
- package/dist/personal-vault.test.js +140 -1
- package/dist/personal-vault.test.js.map +1 -1
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +62 -0
- package/dist/s3.js.map +1 -1
- package/dist/s3.test.js +126 -0
- package/dist/s3.test.js.map +1 -1
- package/package.json +39 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP seam for the `/outpost/*` control plane.
|
|
3
|
+
*
|
|
4
|
+
* Every request the client makes goes through an injected {@link OutpostTransport}
|
|
5
|
+
* rather than calling `fetch` directly. That indirection is the whole reason this
|
|
6
|
+
* module is portable:
|
|
7
|
+
*
|
|
8
|
+
* - hq-cli passes its own `vaultApiFetch`, keeping Sentry breadcrumbs, the
|
|
9
|
+
* `hqk_` API-key path rewrite table, plan-gate decoding, and plan-limit
|
|
10
|
+
* peeking exactly as they were before this code moved out of the CLI.
|
|
11
|
+
* - a Next.js app (server action / route handler) passes
|
|
12
|
+
* {@link createOutpostTransport}, which is a thin authenticated `fetch` with
|
|
13
|
+
* no Node built-ins and no ambient state.
|
|
14
|
+
* - a test passes a stub and asserts on the request shape.
|
|
15
|
+
*
|
|
16
|
+
* The option bag deliberately matches hq-cli's `VaultApiOptions` field-for-field
|
|
17
|
+
* so `vaultApiFetch` satisfies `OutpostTransport` structurally — no adapter, no
|
|
18
|
+
* chance of the two drifting into a subtle mismatch.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The public hq-pro control plane. `HQ_VAULT_API_URL` overrides it, matching
|
|
22
|
+
* hq-cli's `DEFAULT_VAULT_API_URL` and hq-cloud's sync runner so all three
|
|
23
|
+
* surfaces resolve against the SAME plane by default — a token minted for one
|
|
24
|
+
* deployment and sent to another is simply rejected, which reads to the user as
|
|
25
|
+
* a confusing auth failure.
|
|
26
|
+
*
|
|
27
|
+
* Read lazily rather than captured at module load: a Next.js server bundle can
|
|
28
|
+
* evaluate this module before the runtime environment is populated, and a value
|
|
29
|
+
* frozen at import time would silently pin the wrong origin.
|
|
30
|
+
*
|
|
31
|
+
* The default `env` is obtained through a guarded lookup, never a bare
|
|
32
|
+
* `process.env`. An edge isolate need not define the Node `process` global, and
|
|
33
|
+
* evaluating `process.env` as a default parameter there throws
|
|
34
|
+
* `ReferenceError: process is not defined` before a request is ever made —
|
|
35
|
+
* exactly the environment this portable client is meant to support.
|
|
36
|
+
*/
|
|
37
|
+
function safeProcessEnv() {
|
|
38
|
+
return typeof process !== "undefined" && process.env ? process.env : {};
|
|
39
|
+
}
|
|
40
|
+
export function defaultOutpostApiUrl(env = safeProcessEnv()) {
|
|
41
|
+
return env.HQ_VAULT_API_URL ?? "https://hqapi.hq.computer";
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Build a plain authenticated-`fetch` transport. This is the default wiring for
|
|
45
|
+
* any non-CLI consumer — notably a Next.js server action or route handler.
|
|
46
|
+
*
|
|
47
|
+
* Uses no Node built-ins and keeps no module-level state, so it works unchanged
|
|
48
|
+
* on the Node and edge runtimes. Never attach this to a client component: the
|
|
49
|
+
* bearer token must stay server-side.
|
|
50
|
+
*
|
|
51
|
+
* ```ts
|
|
52
|
+
* // app/outposts/actions.ts
|
|
53
|
+
* "use server";
|
|
54
|
+
* import { OutpostsClient, createOutpostTransport } from "@indigoai-us/hq-cloud/outposts";
|
|
55
|
+
*
|
|
56
|
+
* const client = new OutpostsClient({
|
|
57
|
+
* transport: createOutpostTransport(),
|
|
58
|
+
* token: async () => (await auth())!.idToken,
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* export async function listMyOutposts() {
|
|
62
|
+
* return client.list();
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function createOutpostTransport(options = {}) {
|
|
67
|
+
return async (request) => {
|
|
68
|
+
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
69
|
+
if (typeof fetchImpl !== "function") {
|
|
70
|
+
throw new Error("No fetch implementation available — pass `fetch` to createOutpostTransport().");
|
|
71
|
+
}
|
|
72
|
+
const base = request.baseUrl ?? options.baseUrl ?? defaultOutpostApiUrl();
|
|
73
|
+
const url = new URL(request.path, base);
|
|
74
|
+
if (request.query) {
|
|
75
|
+
for (const [key, value] of Object.entries(request.query)) {
|
|
76
|
+
url.searchParams.set(key, value);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return fetchImpl(url.toString(), {
|
|
80
|
+
method: request.method ?? "GET",
|
|
81
|
+
headers: {
|
|
82
|
+
Authorization: `Bearer ${request.token}`,
|
|
83
|
+
"Content-Type": "application/json",
|
|
84
|
+
...options.headers,
|
|
85
|
+
},
|
|
86
|
+
body: request.body ? JSON.stringify(request.body) : undefined,
|
|
87
|
+
signal: request.signal,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/outposts/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAkCH;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,cAAc;IACrB,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,oBAAoB,CAClC,MAA0C,cAAc,EAAE;IAE1D,OAAO,GAAG,CAAC,gBAAgB,IAAI,2BAA2B,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAOI,EAAE;IAEN,OAAO,KAAK,EAAE,OAAO,EAAE,EAAE;QACvB,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,KAAK,CAAC;QACpD,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,IAAI,oBAAoB,EAAE,CAAC;QAC1E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAClB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACnC,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;YAC/B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;YAC/B,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE;gBACxC,cAAc,EAAE,kBAAkB;gBAClC,GAAG,OAAO,CAAC,OAAO;aACnB;YACD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;YAC7D,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the portable transport seam.
|
|
3
|
+
*
|
|
4
|
+
* These pin the two behaviours a Next.js consumer relies on: the default
|
|
5
|
+
* transport is a plain authenticated `fetch` with an injectable implementation,
|
|
6
|
+
* and the API origin is read lazily from the environment rather than frozen at
|
|
7
|
+
* module load.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=transport.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.test.d.ts","sourceRoot":"","sources":["../../src/outposts/transport.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the portable transport seam.
|
|
3
|
+
*
|
|
4
|
+
* These pin the two behaviours a Next.js consumer relies on: the default
|
|
5
|
+
* transport is a plain authenticated `fetch` with an injectable implementation,
|
|
6
|
+
* and the API origin is read lazily from the environment rather than frozen at
|
|
7
|
+
* module load.
|
|
8
|
+
*/
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
10
|
+
import { createOutpostTransport, defaultOutpostApiUrl, } from "./transport.js";
|
|
11
|
+
describe("defaultOutpostApiUrl", () => {
|
|
12
|
+
it("falls back to the public control plane", () => {
|
|
13
|
+
expect(defaultOutpostApiUrl({})).toBe("https://hqapi.hq.computer");
|
|
14
|
+
});
|
|
15
|
+
it("honours HQ_VAULT_API_URL", () => {
|
|
16
|
+
expect(defaultOutpostApiUrl({ HQ_VAULT_API_URL: "https://hqapi.test.invalid" })).toBe("https://hqapi.test.invalid");
|
|
17
|
+
});
|
|
18
|
+
it("does not touch the Node process global when it is absent (edge runtime)", () => {
|
|
19
|
+
// An edge isolate need not define `process`. Evaluating the default param
|
|
20
|
+
// must not throw ReferenceError there — it must fall back to the public
|
|
21
|
+
// origin. Simulate by deleting the global for the duration of the call.
|
|
22
|
+
const descriptor = Object.getOwnPropertyDescriptor(globalThis, "process");
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
delete globalThis.process;
|
|
25
|
+
try {
|
|
26
|
+
expect(() => defaultOutpostApiUrl()).not.toThrow();
|
|
27
|
+
expect(defaultOutpostApiUrl()).toBe("https://hqapi.hq.computer");
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
if (descriptor)
|
|
31
|
+
Object.defineProperty(globalThis, "process", descriptor);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
it("reads the environment lazily, not at import time", () => {
|
|
35
|
+
// A Next.js bundle can evaluate this module before the runtime env is
|
|
36
|
+
// populated. Freezing the value at import would pin the wrong origin.
|
|
37
|
+
const before = defaultOutpostApiUrl({});
|
|
38
|
+
const after = defaultOutpostApiUrl({
|
|
39
|
+
HQ_VAULT_API_URL: "https://later.invalid",
|
|
40
|
+
});
|
|
41
|
+
expect(before).not.toBe(after);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe("createOutpostTransport", () => {
|
|
45
|
+
let fetchImpl;
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
fetchImpl = vi.fn(async () => new Response("{}", { status: 200 }));
|
|
48
|
+
});
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
vi.restoreAllMocks();
|
|
51
|
+
});
|
|
52
|
+
it("attaches the bearer token and JSON content type", async () => {
|
|
53
|
+
const transport = createOutpostTransport({
|
|
54
|
+
baseUrl: "https://hqapi.test.invalid",
|
|
55
|
+
fetch: fetchImpl,
|
|
56
|
+
});
|
|
57
|
+
await transport({ token: "tok", path: "/outpost/list" });
|
|
58
|
+
const [url, init] = fetchImpl.mock.calls[0];
|
|
59
|
+
expect(url).toBe("https://hqapi.test.invalid/outpost/list");
|
|
60
|
+
expect(init.method).toBe("GET");
|
|
61
|
+
expect(init.headers.Authorization).toBe("Bearer tok");
|
|
62
|
+
expect(init.headers["Content-Type"]).toBe("application/json");
|
|
63
|
+
});
|
|
64
|
+
it("serializes the body and appends query params", async () => {
|
|
65
|
+
const transport = createOutpostTransport({
|
|
66
|
+
baseUrl: "https://hqapi.test.invalid",
|
|
67
|
+
fetch: fetchImpl,
|
|
68
|
+
});
|
|
69
|
+
await transport({
|
|
70
|
+
token: "tok",
|
|
71
|
+
path: "/outpost/exec",
|
|
72
|
+
method: "POST",
|
|
73
|
+
body: { mode: "submit", command: "ls" },
|
|
74
|
+
query: { outpostId: "2" },
|
|
75
|
+
});
|
|
76
|
+
const [url, init] = fetchImpl.mock.calls[0];
|
|
77
|
+
expect(String(url)).toContain("/outpost/exec?outpostId=2");
|
|
78
|
+
expect(init.method).toBe("POST");
|
|
79
|
+
expect(JSON.parse(init.body)).toEqual({ mode: "submit", command: "ls" });
|
|
80
|
+
});
|
|
81
|
+
it("merges extra headers (e.g. client identification)", async () => {
|
|
82
|
+
const transport = createOutpostTransport({
|
|
83
|
+
baseUrl: "https://hqapi.test.invalid",
|
|
84
|
+
fetch: fetchImpl,
|
|
85
|
+
headers: { "x-hq-client": "console" },
|
|
86
|
+
});
|
|
87
|
+
await transport({ token: "tok", path: "/outpost/list" });
|
|
88
|
+
const headers = fetchImpl.mock.calls[0][1].headers;
|
|
89
|
+
expect(headers["x-hq-client"]).toBe("console");
|
|
90
|
+
});
|
|
91
|
+
it("lets a per-request baseUrl override the transport default", async () => {
|
|
92
|
+
const transport = createOutpostTransport({
|
|
93
|
+
baseUrl: "https://default.invalid",
|
|
94
|
+
fetch: fetchImpl,
|
|
95
|
+
});
|
|
96
|
+
await transport({
|
|
97
|
+
token: "tok",
|
|
98
|
+
path: "/outpost/list",
|
|
99
|
+
baseUrl: "https://override.invalid",
|
|
100
|
+
});
|
|
101
|
+
expect(String(fetchImpl.mock.calls[0][0])).toContain("https://override.invalid");
|
|
102
|
+
});
|
|
103
|
+
it("throws a clear error when no fetch is available", async () => {
|
|
104
|
+
const original = globalThis.fetch;
|
|
105
|
+
// Simulate a runtime with no global fetch and no injected one.
|
|
106
|
+
globalThis.fetch = undefined;
|
|
107
|
+
try {
|
|
108
|
+
const transport = createOutpostTransport();
|
|
109
|
+
await expect(transport({ token: "tok", path: "/outpost/list" })).rejects.toThrow(/No fetch implementation/);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
globalThis.fetch = original;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=transport.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.test.js","sourceRoot":"","sources":["../../src/outposts/transport.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GAErB,MAAM,gBAAgB,CAAC;AAExB,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IACrE,CAAC,CAAC,CA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AS,CAAC;YACd,KAAK,EAAE,KAAK;YACZ,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,0BAA0B;SACpC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,0BAA0B,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC/D,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,+DAA+D;QAC9D,UAAkC,CAAC,KAAK,GAAG,SAAS,CAAC;QACtD,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,sBAAsB,EAAE,CAAC;YAC3C,MAAM,MAAM,CACV,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CACnD,CAAC,OAAO,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;QAC/C,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,KAAK,GAAG,QAAQ,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the hq-pro `/outpost/*` control plane.
|
|
3
|
+
*
|
|
4
|
+
* Portable by construction: this module imports nothing. It is safe to load
|
|
5
|
+
* from a Next.js server action, a route handler, an edge function, or a CLI.
|
|
6
|
+
*
|
|
7
|
+
* Outposts are PERSONAL / caller-scoped — hq-pro keys every `/outpost/*` route
|
|
8
|
+
* on the caller's Cognito sub, so there is no company parameter anywhere in
|
|
9
|
+
* this surface. `outpostId` selects a specific box; omitting it targets the
|
|
10
|
+
* caller's primary slot.
|
|
11
|
+
*/
|
|
12
|
+
/** Row summary from `GET /outpost/list`. */
|
|
13
|
+
export interface OutpostSummary {
|
|
14
|
+
outpostId: string;
|
|
15
|
+
state: string;
|
|
16
|
+
instanceName: string;
|
|
17
|
+
region: string;
|
|
18
|
+
agentRuntime: string;
|
|
19
|
+
platform: string;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
/** The agent runtime a box is provisioned with. */
|
|
24
|
+
export type OutpostAgentRuntime = "claude" | "codex";
|
|
25
|
+
/** Body for `POST /outpost/provision`. */
|
|
26
|
+
export interface ProvisionOutpostInput {
|
|
27
|
+
/**
|
|
28
|
+
* The caller's Cognito refresh token, so the box can authenticate AS the
|
|
29
|
+
* caller. SENSITIVE — sent over HTTPS and never logged or printed.
|
|
30
|
+
*/
|
|
31
|
+
refreshToken: string;
|
|
32
|
+
/** The caller's public IP for the box's SSH ingress. Server derives it otherwise. */
|
|
33
|
+
clientIp?: string;
|
|
34
|
+
/** Root disk size in GB (EC2 only). */
|
|
35
|
+
diskSizeGb?: number;
|
|
36
|
+
/** Defaults to `claude` server-side when omitted. */
|
|
37
|
+
agentRuntime?: OutpostAgentRuntime;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* hq-pro's per-person cap envelope on a `409` provision block. Unlike every
|
|
41
|
+
* other `/outpost/*` failure this body carries NO `message`/`error` field —
|
|
42
|
+
* only the cap facts — so it has to be decoded structurally or the reason
|
|
43
|
+
* degrades to a bare `res.statusText` ("Conflict").
|
|
44
|
+
*/
|
|
45
|
+
export interface OutpostCappedPayload {
|
|
46
|
+
limit: number;
|
|
47
|
+
outposts: OutpostSummary[];
|
|
48
|
+
}
|
|
49
|
+
/** Result of a synchronous `POST /outpost/exec` — one SSM invocation. */
|
|
50
|
+
export interface OutpostExecResult {
|
|
51
|
+
ok: true;
|
|
52
|
+
outpostId: string;
|
|
53
|
+
instanceId: string;
|
|
54
|
+
commandId: string;
|
|
55
|
+
/** SSM invocation status (Success | Failed | Cancelled). */
|
|
56
|
+
status: string;
|
|
57
|
+
/** Remote process exit code, or null when SSM reported none. */
|
|
58
|
+
exitCode: number | null;
|
|
59
|
+
stdout: string;
|
|
60
|
+
stderr: string;
|
|
61
|
+
/** True when SSM clipped stdout/stderr at its inline output limit. */
|
|
62
|
+
truncated: boolean;
|
|
63
|
+
}
|
|
64
|
+
/** Presigned input-upload details from `mode: "stage"`. */
|
|
65
|
+
export interface OutpostExecStage {
|
|
66
|
+
ok: true;
|
|
67
|
+
userId: string;
|
|
68
|
+
outpostId: string;
|
|
69
|
+
key: string;
|
|
70
|
+
putUrl: string;
|
|
71
|
+
getUrl: string;
|
|
72
|
+
expiresInSeconds: number;
|
|
73
|
+
}
|
|
74
|
+
/** Asynchronous SSM command details from `mode: "submit"`. */
|
|
75
|
+
export interface OutpostExecSubmission {
|
|
76
|
+
ok: true;
|
|
77
|
+
userId: string;
|
|
78
|
+
outpostId: string;
|
|
79
|
+
instanceId: string;
|
|
80
|
+
commandId: string;
|
|
81
|
+
outputPrefix: string;
|
|
82
|
+
/** Shell budget applied server-side (AWS-RunShellScript executionTimeout). */
|
|
83
|
+
executionTimeoutSeconds?: number;
|
|
84
|
+
}
|
|
85
|
+
/** Poll response from `mode: "result"`; streams arrive only when terminal. */
|
|
86
|
+
export interface OutpostExecAsyncResult {
|
|
87
|
+
ok: true;
|
|
88
|
+
userId: string;
|
|
89
|
+
outpostId: string;
|
|
90
|
+
status: string;
|
|
91
|
+
done: boolean;
|
|
92
|
+
exitCode?: number | null;
|
|
93
|
+
stdout?: string;
|
|
94
|
+
stderr?: string;
|
|
95
|
+
truncated?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/** SSH connection details vended by `POST /outpost/ssh-access`. */
|
|
98
|
+
export interface OutpostSshAccess {
|
|
99
|
+
outpostId: string;
|
|
100
|
+
platform: "ec2" | "lightsail";
|
|
101
|
+
host: string;
|
|
102
|
+
port: number;
|
|
103
|
+
username: string;
|
|
104
|
+
/** PEM private key for the box. SENSITIVE — never print or log this. */
|
|
105
|
+
privateKey: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* The server-supplied "how to add a card" action on a `402 billing_required`.
|
|
109
|
+
* Mirrors hq-pro `src/billing/activation-billing.ts` `BillingSetupAction` and
|
|
110
|
+
* hq-console's `src/lib/billing-setup.ts`.
|
|
111
|
+
*/
|
|
112
|
+
export interface BillingSetupAction {
|
|
113
|
+
payerType: "company" | "person";
|
|
114
|
+
path: "/v1/billing/checkout/org" | "/v1/billing/checkout/person";
|
|
115
|
+
method: "POST";
|
|
116
|
+
body?: {
|
|
117
|
+
companyUid?: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** The `billing` envelope hq-pro attaches to a billing-blocked provision. */
|
|
121
|
+
export interface BillingErrorPayload {
|
|
122
|
+
status: string;
|
|
123
|
+
setup?: BillingSetupAction;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/outposts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,mDAAmD;AACnD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC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AC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,GAAG,WAAW,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,SAAS,GAAG,QAAQ,CAAC;IAChC,IAAI,EAAE,0BAA0B,GAAG,6BAA6B,CAAC;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChC;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire types for the hq-pro `/outpost/*` control plane.
|
|
3
|
+
*
|
|
4
|
+
* Portable by construction: this module imports nothing. It is safe to load
|
|
5
|
+
* from a Next.js server action, a route handler, an edge function, or a CLI.
|
|
6
|
+
*
|
|
7
|
+
* Outposts are PERSONAL / caller-scoped — hq-pro keys every `/outpost/*` route
|
|
8
|
+
* on the caller's Cognito sub, so there is no company parameter anywhere in
|
|
9
|
+
* this surface. `outpostId` selects a specific box; omitting it targets the
|
|
10
|
+
* caller's primary slot.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/outposts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
package/dist/personal-vault.d.ts
CHANGED
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
* on v12–v14 roots with no `core/core.yaml`, the root `core.yaml` IS the
|
|
45
45
|
* scaffold/version manifest and round-trips like any other top-level file.
|
|
46
46
|
*/
|
|
47
|
+
import type { SyncJournal } from "./types.js";
|
|
47
48
|
export declare const PERSONAL_VAULT_EXCLUDED_TOP_LEVEL: readonly string[];
|
|
48
49
|
/**
|
|
49
50
|
* Company slugs that are never eligible for the personal-bucket fallback,
|
|
@@ -229,4 +230,72 @@ export declare function computePersonalCompanySubdirs(hqRoot: string, teamSynced
|
|
|
229
230
|
* Only `cmp_*` uids count (same rule as company-resolver / telemetry).
|
|
230
231
|
*/
|
|
231
232
|
export declare function readCloudBackedSlugsFromManifest(hqRoot: string): Set<string>;
|
|
233
|
+
/**
|
|
234
|
+
* Result of a {@link purgeExcludedPersonalVaultJournalEntries} pass.
|
|
235
|
+
*/
|
|
236
|
+
export interface PersonalVaultJournalPurge {
|
|
237
|
+
/** Vault keys removed from the journal, capped-free (full list). */
|
|
238
|
+
removed: string[];
|
|
239
|
+
/** Count of removed entries, bucketed by the reason class that caught them. */
|
|
240
|
+
byReason: Record<PersonalVaultJournalPurgeReason, number>;
|
|
241
|
+
}
|
|
242
|
+
export type PersonalVaultJournalPurgeReason = "ignore-filtered" | "excluded-top-level";
|
|
243
|
+
/**
|
|
244
|
+
* Purge journal entries that fall OUTSIDE the current personal-vault push
|
|
245
|
+
* scope, so a stale baseline written by an older engine (before an exclusion
|
|
246
|
+
* rule existed) converges instead of being re-diffed on every push forever.
|
|
247
|
+
*
|
|
248
|
+
* WHY THIS EXISTS. The push WALK already prunes excluded trees correctly
|
|
249
|
+
* (`collectFiles`/`walkDir` in share.ts apply the same filter and never descend
|
|
250
|
+
* into `.claude/worktrees/`, `node_modules/`, etc.). But nothing ever REMOVES a
|
|
251
|
+
* journal entry that predates an exclusion rule: `computeDeletePlan` skips such
|
|
252
|
+
* an entry (either because its local file still exists — the `presentLocally`
|
|
253
|
+
* short-circuit — or because the exclusion filter rejects it) WITHOUT deleting
|
|
254
|
+
* the journal row, and `finalizeShareJournal` then writes the journal back
|
|
255
|
+
* verbatim. So entries under rules added after they were first journaled —
|
|
256
|
+
* the `.claude/worktrees/` default ignore (added 5.8.2), the `workspace/`
|
|
257
|
+
* top-level exclusion, the `.hq-conflicts/` conflict-mirror rule, the
|
|
258
|
+
* `.conflict-*` ephemeral pattern, `node_modules/` — persist indefinitely, are
|
|
259
|
+
* re-`lstat`'d every push, and keep the baseline from ever stabilising.
|
|
260
|
+
*
|
|
261
|
+
* The two exclusion mechanisms this mirrors:
|
|
262
|
+
* 1. `shouldSync` — the shared ignore filter (`createIgnoreFilter`) plus, in
|
|
263
|
+
* personal mode, the personal-vault default exclusions. Catches
|
|
264
|
+
* `.claude/worktrees/`, `node_modules/`, `.hq-conflicts/`, `.env`, etc.
|
|
265
|
+
* 2. The `workspace/` (and `repos/`) top-level exclusion, which lives ONLY at
|
|
266
|
+
* the walk-root level (`PERSONAL_VAULT_EXCLUDED_TOP_LEVEL`, applied by
|
|
267
|
+
* `computePersonalVaultPaths`) and is therefore INVISIBLE to `shouldSync`.
|
|
268
|
+
* The synced carve-outs under `workspace/` (the continuity pointer + its
|
|
269
|
+
* active thread, `workspace/agency/`, `workspace/.session-logs/`) are
|
|
270
|
+
* re-included so they are never purged.
|
|
271
|
+
*
|
|
272
|
+
* DEFERS to two existing owners so it is a pure safety-net for the classes no
|
|
273
|
+
* other mechanism drains:
|
|
274
|
+
* - `isVaultLitterArtifact` (`isLitterArtifact` here) — conflict-mirror
|
|
275
|
+
* (`.conflict-*`) and rescue-drift (`.drift-*`) litter is REMOTELY DELETED
|
|
276
|
+
* by `computeDeletePlan`'s litter drain when the local file is gone, which
|
|
277
|
+
* is stronger than forgetting the row. Never purge it here — that would
|
|
278
|
+
* preempt the remote cleanup and strand the vault object.
|
|
279
|
+
* - `isPersonalVaultDeletionExcluded` — release scaffold (`core/`),
|
|
280
|
+
* reindex-generated skill wrappers (`.claude/skills/<ns>:<skill>/`), and
|
|
281
|
+
* command wrappers are recreated locally by a release / `hq reindex`, so
|
|
282
|
+
* their journal rows are deliberately retained (a local absence is not user
|
|
283
|
+
* intent). Keep them.
|
|
284
|
+
*
|
|
285
|
+
* `companies/` is deliberately NOT purged here even though it is in
|
|
286
|
+
* `PERSONAL_VAULT_EXCLUDED_TOP_LEVEL`: local companies legitimately journal
|
|
287
|
+
* `companies/{slug}/…` keys, and cloud companies' stale keys are drained by the
|
|
288
|
+
* separate decommission plan (`computeDecommissionPlan`) — purging them here
|
|
289
|
+
* would rob that plan of the journal rows it deletes remotely against.
|
|
290
|
+
*
|
|
291
|
+
* Disposition is option (a) of the stale-journal question: drop the row so it
|
|
292
|
+
* is no longer re-diffed. Any remote object the row pointed at is left as an
|
|
293
|
+
* inert orphan — the PULL leg already refuses these keys
|
|
294
|
+
* (`computePullPlan` in sync.ts consults the same filters), so a peer can never
|
|
295
|
+
* rematerialise them, and existing rescue/litter tooling sweeps the remote.
|
|
296
|
+
*
|
|
297
|
+
* Mutates `journal.files` in place and returns what was removed for a summary
|
|
298
|
+
* event. Pure w.r.t. the filesystem beyond the carve-out probes.
|
|
299
|
+
*/
|
|
300
|
+
export declare function purgeExcludedPersonalVaultJournalEntries(journal: SyncJournal, hqRoot: string, syncRoot: string, shouldSync: (absPath: string, isDir?: boolean) => boolean, isLitterArtifact: (key: string) => boolean): PersonalVaultJournalPurge;
|
|
232
301
|
//# sourceMappingURL=personal-vault.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personal-vault.d.ts","sourceRoot":"","sources":["../src/personal-vault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAQpE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,eAAe,GAAE,WAAW,CAAC,MAAM,CAAa,GAC/C,MAAM,EAAE,CA8BV;AAED;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAmC5E;AAqCD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC;CAC3D;AAED,MAAM,MAAM,+BAA+B,GACvC,iBAAiB,GACjB,oBAAoB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,EACzD,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,GACzC,yBAAyB,CA+C3B"}
|
package/dist/personal-vault.js
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
import * as fs from "fs";
|
|
48
48
|
import * as path from "path";
|
|
49
49
|
import { isGeneratedCommandWrapperPath } from "./personal-vault-exclusions.js";
|
|
50
|
+
import { localPathForVaultKey, vaultKeyForLocalPath, } from "./local-path-codec.js";
|
|
50
51
|
export const PERSONAL_VAULT_EXCLUDED_TOP_LEVEL = [
|
|
51
52
|
".git",
|
|
52
53
|
"companies",
|
|
@@ -471,4 +472,103 @@ function companyHasCloudTrueMarker(subdir) {
|
|
|
471
472
|
}
|
|
472
473
|
return /^cloud:\s*true\b/m.test(text);
|
|
473
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Purge journal entries that fall OUTSIDE the current personal-vault push
|
|
477
|
+
* scope, so a stale baseline written by an older engine (before an exclusion
|
|
478
|
+
* rule existed) converges instead of being re-diffed on every push forever.
|
|
479
|
+
*
|
|
480
|
+
* WHY THIS EXISTS. The push WALK already prunes excluded trees correctly
|
|
481
|
+
* (`collectFiles`/`walkDir` in share.ts apply the same filter and never descend
|
|
482
|
+
* into `.claude/worktrees/`, `node_modules/`, etc.). But nothing ever REMOVES a
|
|
483
|
+
* journal entry that predates an exclusion rule: `computeDeletePlan` skips such
|
|
484
|
+
* an entry (either because its local file still exists — the `presentLocally`
|
|
485
|
+
* short-circuit — or because the exclusion filter rejects it) WITHOUT deleting
|
|
486
|
+
* the journal row, and `finalizeShareJournal` then writes the journal back
|
|
487
|
+
* verbatim. So entries under rules added after they were first journaled —
|
|
488
|
+
* the `.claude/worktrees/` default ignore (added 5.8.2), the `workspace/`
|
|
489
|
+
* top-level exclusion, the `.hq-conflicts/` conflict-mirror rule, the
|
|
490
|
+
* `.conflict-*` ephemeral pattern, `node_modules/` — persist indefinitely, are
|
|
491
|
+
* re-`lstat`'d every push, and keep the baseline from ever stabilising.
|
|
492
|
+
*
|
|
493
|
+
* The two exclusion mechanisms this mirrors:
|
|
494
|
+
* 1. `shouldSync` — the shared ignore filter (`createIgnoreFilter`) plus, in
|
|
495
|
+
* personal mode, the personal-vault default exclusions. Catches
|
|
496
|
+
* `.claude/worktrees/`, `node_modules/`, `.hq-conflicts/`, `.env`, etc.
|
|
497
|
+
* 2. The `workspace/` (and `repos/`) top-level exclusion, which lives ONLY at
|
|
498
|
+
* the walk-root level (`PERSONAL_VAULT_EXCLUDED_TOP_LEVEL`, applied by
|
|
499
|
+
* `computePersonalVaultPaths`) and is therefore INVISIBLE to `shouldSync`.
|
|
500
|
+
* The synced carve-outs under `workspace/` (the continuity pointer + its
|
|
501
|
+
* active thread, `workspace/agency/`, `workspace/.session-logs/`) are
|
|
502
|
+
* re-included so they are never purged.
|
|
503
|
+
*
|
|
504
|
+
* DEFERS to two existing owners so it is a pure safety-net for the classes no
|
|
505
|
+
* other mechanism drains:
|
|
506
|
+
* - `isVaultLitterArtifact` (`isLitterArtifact` here) — conflict-mirror
|
|
507
|
+
* (`.conflict-*`) and rescue-drift (`.drift-*`) litter is REMOTELY DELETED
|
|
508
|
+
* by `computeDeletePlan`'s litter drain when the local file is gone, which
|
|
509
|
+
* is stronger than forgetting the row. Never purge it here — that would
|
|
510
|
+
* preempt the remote cleanup and strand the vault object.
|
|
511
|
+
* - `isPersonalVaultDeletionExcluded` — release scaffold (`core/`),
|
|
512
|
+
* reindex-generated skill wrappers (`.claude/skills/<ns>:<skill>/`), and
|
|
513
|
+
* command wrappers are recreated locally by a release / `hq reindex`, so
|
|
514
|
+
* their journal rows are deliberately retained (a local absence is not user
|
|
515
|
+
* intent). Keep them.
|
|
516
|
+
*
|
|
517
|
+
* `companies/` is deliberately NOT purged here even though it is in
|
|
518
|
+
* `PERSONAL_VAULT_EXCLUDED_TOP_LEVEL`: local companies legitimately journal
|
|
519
|
+
* `companies/{slug}/…` keys, and cloud companies' stale keys are drained by the
|
|
520
|
+
* separate decommission plan (`computeDecommissionPlan`) — purging them here
|
|
521
|
+
* would rob that plan of the journal rows it deletes remotely against.
|
|
522
|
+
*
|
|
523
|
+
* Disposition is option (a) of the stale-journal question: drop the row so it
|
|
524
|
+
* is no longer re-diffed. Any remote object the row pointed at is left as an
|
|
525
|
+
* inert orphan — the PULL leg already refuses these keys
|
|
526
|
+
* (`computePullPlan` in sync.ts consults the same filters), so a peer can never
|
|
527
|
+
* rematerialise them, and existing rescue/litter tooling sweeps the remote.
|
|
528
|
+
*
|
|
529
|
+
* Mutates `journal.files` in place and returns what was removed for a summary
|
|
530
|
+
* event. Pure w.r.t. the filesystem beyond the carve-out probes.
|
|
531
|
+
*/
|
|
532
|
+
export function purgeExcludedPersonalVaultJournalEntries(journal, hqRoot, syncRoot, shouldSync, isLitterArtifact) {
|
|
533
|
+
// Precompute the synced carve-out roots under the otherwise-excluded
|
|
534
|
+
// `workspace/` once (not per journal entry). These are exactly the paths
|
|
535
|
+
// `computePersonalVaultPaths` pierces the top-level exclusion for.
|
|
536
|
+
const workspaceCarveKeys = [
|
|
537
|
+
...computeContinuityPointerPaths(hqRoot),
|
|
538
|
+
...computeAgencySyncPaths(hqRoot),
|
|
539
|
+
...computeSessionLogsSyncPaths(hqRoot),
|
|
540
|
+
].map((abs) => vaultKeyForLocalPath(syncRoot, abs));
|
|
541
|
+
const isSyncedWorkspaceCarveKey = (key) => workspaceCarveKeys.some((root) => key === root || key.startsWith(`${root}/`));
|
|
542
|
+
const byReason = {
|
|
543
|
+
"ignore-filtered": 0,
|
|
544
|
+
"excluded-top-level": 0,
|
|
545
|
+
};
|
|
546
|
+
const removed = [];
|
|
547
|
+
for (const key of Object.keys(journal.files)) {
|
|
548
|
+
// Defer to the two existing owners (see the doc-comment): litter is
|
|
549
|
+
// remotely drained, and release/reindex mirrors are deliberately retained.
|
|
550
|
+
if (isLitterArtifact(key) || isPersonalVaultDeletionExcluded(key))
|
|
551
|
+
continue;
|
|
552
|
+
const absPath = localPathForVaultKey(syncRoot, key);
|
|
553
|
+
const topLevel = key.split("/")[0];
|
|
554
|
+
let reason = null;
|
|
555
|
+
if (!shouldSync(absPath, false) && !shouldSync(absPath, true)) {
|
|
556
|
+
// shouldSync catches every ignore-filter / personal-vault-default class,
|
|
557
|
+
// including `.git/`, root `/repos/`, `.claude/worktrees/`, `node_modules/`,
|
|
558
|
+
// and `.hq-conflicts/`.
|
|
559
|
+
reason = "ignore-filtered";
|
|
560
|
+
}
|
|
561
|
+
else if (topLevel === "workspace" && !isSyncedWorkspaceCarveKey(key)) {
|
|
562
|
+
// `workspace/` is excluded only at the walk-root level, so shouldSync did
|
|
563
|
+
// not see it. Purge everything under it except the synced carve-outs.
|
|
564
|
+
reason = "excluded-top-level";
|
|
565
|
+
}
|
|
566
|
+
if (reason !== null) {
|
|
567
|
+
delete journal.files[key];
|
|
568
|
+
removed.push(key);
|
|
569
|
+
byReason[reason]++;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return { removed, byReason };
|
|
573
|
+
}
|
|
474
574
|
//# sourceMappingURL=personal-vault.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personal-vault.js","sourceRoot":"","sources":["../src/personal-vault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"personal-vault.js","sourceRoot":"","sources":["../src/personal-vault.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,CAAC,MAAM,iCAAiC,GAAsB;IAClE,MAAM;IACN,WAAW;IACX,OAAO;IACP,WAAW;CACZ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAsB;IACtE,WAAW;CACZ,CAAC;AAeF;;;;;;;;;;;;;;;;;;GAkBG;AACH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAErE;;;;;;;;;;GAUG;AACH,MAAM,UAAU,w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