@indigoai-us/hq-cli 5.345.225 → 5.345.228
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 +174 -0
- package/dist/command-catalog.generated.d.ts +215 -0
- package/dist/command-catalog.generated.js +261 -0
- package/dist/commands/auth.d.ts +2 -2
- package/dist/commands/auth.js +3 -3
- package/dist/commands/core-delegate-w1b.js +92 -69
- package/dist/commands/core-delegate.d.ts +19 -1
- package/dist/commands/core-delegate.js +411 -6
- package/dist/commands/core-dm-bind-native.js +2 -1
- package/dist/commands/core-handoff.d.ts +5 -0
- package/dist/commands/core-handoff.js +1008 -14
- package/dist/commands/core-pin-native.d.ts +1 -0
- package/dist/commands/core-pin-native.js +3 -15
- package/dist/commands/core-register-project-native.d.ts +6 -0
- package/dist/commands/core-register-project-native.js +182 -52
- package/dist/commands/core-work-mesh-bind-trusted-native.js +4 -9
- package/dist/commands/daemon.js +3 -3
- package/dist/commands/deploy-domains.js +38 -2
- package/dist/commands/index-cmd.d.ts +3 -1
- package/dist/commands/index-cmd.js +12 -0
- package/dist/commands/lanes-accounts.d.ts +14 -0
- package/dist/commands/lanes-accounts.js +119 -0
- package/dist/commands/lanes-checks.js +1 -1
- package/dist/commands/lanes-move.js +10 -0
- package/dist/commands/lanes-session-start.d.ts +1 -2
- package/dist/commands/lanes-session-start.js +9 -145
- package/dist/commands/lanes-shared.d.ts +3 -0
- package/dist/commands/lanes-shared.js +9 -0
- package/dist/commands/lanes.d.ts +3 -0
- package/dist/commands/lanes.js +231 -39
- package/dist/commands/link.d.ts +8 -3
- package/dist/commands/link.js +14 -17
- package/dist/commands/mcp-registration.d.ts +65 -7
- package/dist/commands/mcp-registration.js +289 -51
- package/dist/commands/mesh.d.ts +12 -0
- package/dist/commands/mesh.js +92 -10
- package/dist/commands/reindex.js +6 -0
- package/dist/commands/repo.d.ts +13 -0
- package/dist/commands/repo.js +39 -1
- package/dist/commands/sync-held.d.ts +22 -0
- package/dist/commands/sync-held.js +167 -18
- package/dist/commands/sync-mode.d.ts +3 -1
- package/dist/commands/sync-mode.js +11 -1
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +4845 -2524
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lazy-commands.js +3 -4
- package/dist/lib/capacity/accounts.d.ts +4 -0
- package/dist/lib/capacity/accounts.js +4 -0
- package/dist/lib/capacity/route.js +14 -0
- package/dist/lib/capacity/sign-in.d.ts +18 -0
- package/dist/lib/capacity/sign-in.js +34 -1
- package/dist/lib/checkpoint-ontology/entity-file.js +4 -4
- package/dist/lib/checkpoint-ontology/merge-copies.js +7 -11
- package/dist/lib/checkpoint-ontology/plan.js +2 -1
- package/dist/lib/core-utils/archive-old-threads.js +5 -2
- package/dist/lib/core-utils/session-company.d.ts +13 -1
- package/dist/lib/core-utils/session-company.js +75 -4
- package/dist/lib/core-utils/worktree-resume.d.ts +6 -0
- package/dist/lib/core-utils/worktree-resume.js +8 -4
- package/dist/lib/daemon/background-qos.d.ts +7 -0
- package/dist/lib/daemon/background-qos.js +13 -0
- package/dist/lib/daemon/catalog.d.ts +10 -0
- package/dist/lib/daemon/catalog.js +9 -2
- package/dist/lib/daemon/hook-requests-acl-suggest.d.ts +18 -0
- package/dist/lib/daemon/hook-requests-acl-suggest.js +245 -0
- package/dist/lib/daemon/hook-requests-fleet-session-start.d.ts +32 -0
- package/dist/lib/daemon/hook-requests-fleet-session-start.js +214 -0
- package/dist/lib/daemon/hook-requests-mesh-tool-writes.d.ts +44 -0
- package/dist/lib/daemon/hook-requests-mesh-tool-writes.js +292 -0
- package/dist/lib/daemon/hook-requests-mesh.d.ts +54 -0
- package/dist/lib/daemon/hook-requests-mesh.js +559 -0
- package/dist/lib/daemon/hook-requests.d.ts +417 -0
- package/dist/lib/daemon/hook-requests.js +1747 -0
- package/dist/lib/daemon/lanes-reconcile-status.d.ts +35 -0
- package/dist/lib/daemon/lanes-reconcile-status.js +86 -0
- package/dist/lib/daemon/machine-checks.d.ts +12 -2
- package/dist/lib/daemon/machine-checks.js +27 -10
- package/dist/lib/daemon/merge-sections.d.ts +24 -2
- package/dist/lib/daemon/merge-sections.js +58 -16
- package/dist/lib/daemon/ops/policy.d.ts +1 -1
- package/dist/lib/daemon/ops/policy.js +47 -6
- package/dist/lib/daemon/resolver.js +9 -2
- package/dist/lib/daemon/run.d.ts +11 -7
- package/dist/lib/daemon/run.js +195 -18
- package/dist/lib/daemon/search-index-worker-v1.d.ts +2 -0
- package/dist/lib/daemon/search-index-worker-v1.js +25 -0
- package/dist/lib/daemon/server.js +6 -1
- package/dist/lib/daemon/session-registry.d.ts +0 -1
- package/dist/lib/daemon/session-registry.js +0 -3
- package/dist/lib/daemon/supervisor.d.ts +5 -1
- package/dist/lib/daemon/supervisor.js +1 -1
- package/dist/lib/daemon/tcc-eperm.d.ts +59 -4
- package/dist/lib/daemon/tcc-eperm.js +110 -8
- package/dist/lib/doctor/fix/process-identity.d.ts +20 -2
- package/dist/lib/doctor/fix/process-identity.js +48 -5
- 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/canary-gate.js +1 -0
- package/dist/lib/hook-engine/native-stop-compatibility.json +2 -1
- package/dist/lib/hot-channels/adapters/attio.js +2 -1
- package/dist/lib/hot-channels/adapters/meetings.js +2 -1
- package/dist/lib/lanes/account-company.d.ts +7 -1
- package/dist/lib/lanes/account-company.js +22 -4
- package/dist/lib/lanes/account-ownership.d.ts +65 -0
- package/dist/lib/lanes/account-ownership.js +134 -0
- package/dist/lib/lanes/accounts.js +9 -2
- package/dist/lib/lanes/claude-balance.js +9 -3
- package/dist/lib/lanes/company-outposts.d.ts +37 -0
- package/dist/lib/lanes/company-outposts.js +164 -0
- package/dist/lib/lanes/config.js +17 -0
- package/dist/lib/lanes/host-capacity.d.ts +19 -0
- package/dist/lib/lanes/host-capacity.js +37 -0
- package/dist/lib/lanes/liveness.d.ts +6 -0
- package/dist/lib/lanes/liveness.js +49 -8
- package/dist/lib/lanes/orphan-report.d.ts +15 -0
- package/dist/lib/lanes/orphan-report.js +223 -0
- package/dist/lib/lanes/orphan-sweep.d.ts +26 -0
- package/dist/lib/lanes/orphan-sweep.js +152 -0
- package/dist/lib/lanes/reaper.d.ts +2 -0
- package/dist/lib/lanes/reaper.js +11 -8
- package/dist/lib/lanes/reconcile.d.ts +8 -7
- package/dist/lib/lanes/reconcile.js +83 -3
- package/dist/lib/lanes/spawn.d.ts +0 -10
- package/dist/lib/lanes/spawn.js +51 -1
- package/dist/lib/lanes/types.d.ts +12 -0
- package/dist/lib/mesh/live/backfill-held.d.ts +13 -0
- package/dist/lib/mesh/live/backfill-held.js +23 -0
- package/dist/lib/mesh/live/daemon/mode.d.ts +8 -4
- package/dist/lib/mesh/live/daemon/mode.js +8 -4
- package/dist/lib/mesh/live/daemon/run.d.ts +14 -3
- package/dist/lib/mesh/live/daemon/run.js +116 -7
- package/dist/lib/mesh/live/direct-drain.d.ts +123 -0
- package/dist/lib/mesh/live/direct-drain.js +315 -0
- package/dist/lib/mesh/live/emit-replay.d.ts +10 -0
- package/dist/lib/mesh/live/emit-replay.js +10 -0
- package/dist/lib/mesh/live/flush.d.ts +15 -0
- package/dist/lib/mesh/live/flush.js +27 -0
- package/dist/lib/mesh/live/liveness-carry.d.ts +45 -0
- package/dist/lib/mesh/live/liveness-carry.js +141 -0
- package/dist/lib/mesh/live/spool.d.ts +19 -0
- package/dist/lib/mesh/live/spool.js +80 -0
- package/dist/lib/safe-store.d.ts +2 -0
- package/dist/lib/safe-store.js +8 -6
- package/dist/lib/search-index/index.d.ts +9 -3
- package/dist/lib/search-index/index.js +35 -10
- package/dist/lib/search-index/worker-process.d.ts +9 -0
- package/dist/lib/search-index/worker-process.js +171 -0
- package/dist/lib/session-company-lock.d.ts +3 -1
- package/dist/lib/session-company-lock.js +3 -2
- package/dist/utils/delegate-command-supervisor.d.ts +3 -0
- package/dist/utils/delegate-command-supervisor.js +44 -0
- package/dist/utils/delegate-lock.d.ts +12 -0
- package/dist/utils/delegate-lock.js +88 -0
- package/dist/utils/frontmatter.d.ts +27 -0
- package/dist/utils/frontmatter.js +33 -0
- package/dist/utils/hook-trust.d.ts +1 -0
- package/dist/utils/hook-trust.js +18 -2
- package/dist/utils/host-registration.d.ts +13 -1
- package/dist/utils/host-registration.js +98 -5
- package/dist/utils/package-use-lease.d.ts +1 -1
- package/dist/utils/package-use-lease.js +15 -7
- package/docs/anywhere-runtime.md +17 -0
- package/package.json +9 -8
- package/scripts/check-function-manifest.mjs +17 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"hq-cli-daemon-sync-runner","type":"module","version":"6.18.
|
|
1
|
+
{"name":"hq-cli-daemon-sync-runner","type":"module","version":"6.18.110","bundleSha256":"f07bdb64deac33e3fd132bfae7452fb8fb207e0b465b0da77b0fcc323a280bf5","formatVersion":1}
|
package/dist/lazy-commands.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Argument, Command, Option } from "commander";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
2
|
import { homedir } from "node:os";
|
|
4
|
-
import { dirname,
|
|
3
|
+
import { dirname, resolve, sep } from "node:path";
|
|
5
4
|
import { COMMAND_CATALOG } from "./command-catalog.generated.js";
|
|
6
5
|
import { installUnknownCommandSuggestions } from "./unknown-command.js";
|
|
7
6
|
import { restoreRuntimeText } from "./utils/catalog-runtime-paths.js";
|
|
8
7
|
import { STILL_USE_FLAG } from "./utils/command-usage.js";
|
|
8
|
+
import { isHqRoot } from "./utils/hq-roots-core.js";
|
|
9
9
|
import { MissingRegistrationPlanError } from "./utils/registration-plan-error.js";
|
|
10
10
|
const commandCatalog = COMMAND_CATALOG;
|
|
11
11
|
/**
|
|
@@ -91,8 +91,7 @@ function runtimeHqRoot() {
|
|
|
91
91
|
return resolve(configured);
|
|
92
92
|
return findRuntimeHqRoot(resolve(process.cwd()));
|
|
93
93
|
}
|
|
94
|
-
export function findRuntimeHqRoot(start, parentOf = dirname, isRoot =
|
|
95
|
-
(existsSync(join(directory, ".claude")) || existsSync(join(directory, "core")) || existsSync(join(directory, "personal")))) {
|
|
94
|
+
export function findRuntimeHqRoot(start, parentOf = dirname, isRoot = isHqRoot) {
|
|
96
95
|
let directory = start;
|
|
97
96
|
for (;;) {
|
|
98
97
|
if (isRoot(directory))
|
|
@@ -14,6 +14,10 @@ export interface CapacityAccount {
|
|
|
14
14
|
source: CapacityAccountSource;
|
|
15
15
|
/** False for a capacity-only account: read for usage, never used by lanes. */
|
|
16
16
|
lanes?: boolean;
|
|
17
|
+
/** PS-006: owning business (slug, personal or unknown). Absent on default-home rows. */
|
|
18
|
+
owning_company?: string;
|
|
19
|
+
/** PS-006: owner, another named person, or unknown. Absent on default-home rows. */
|
|
20
|
+
holder?: string;
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
23
|
* `disabled_reason` that marks a registry account as capacity-only. Signing in
|
|
@@ -9,6 +9,7 @@ import * as fs from "node:fs";
|
|
|
9
9
|
import * as os from "node:os";
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import { effectiveAccountHome } from "../lanes/account-home.js";
|
|
12
|
+
import { accountOwnership } from "../lanes/account-ownership.js";
|
|
12
13
|
import { lanesConfigPath, loadLanesConfig } from "../lanes/config.js";
|
|
13
14
|
import { resolveLanesHqRoot } from "../lanes/hq-root.js";
|
|
14
15
|
import { LANE_PROVIDERS } from "../lanes/types.js";
|
|
@@ -47,12 +48,15 @@ export function listCapacityAccounts(options = {}) {
|
|
|
47
48
|
if (!account.enabled && !capacityOnly)
|
|
48
49
|
continue;
|
|
49
50
|
const effective = effectiveAccountHome(account, hostname);
|
|
51
|
+
const ownership = accountOwnership(account);
|
|
50
52
|
accounts.push({
|
|
51
53
|
provider,
|
|
52
54
|
label,
|
|
53
55
|
home: effective.home,
|
|
54
56
|
source: effective.source === "host" ? "host" : "registry",
|
|
55
57
|
lanes: account.enabled,
|
|
58
|
+
owning_company: ownership.owning_company,
|
|
59
|
+
holder: ownership.holder,
|
|
56
60
|
});
|
|
57
61
|
}
|
|
58
62
|
}
|
|
@@ -14,6 +14,7 @@ import { codexSnapshotStale, hasCodexCreditRoom } from "./codex-availability.js"
|
|
|
14
14
|
* { ok, at, request, pick, ranked, skipped, moves, next_reset, capacity,
|
|
15
15
|
* lanes_error }
|
|
16
16
|
*/
|
|
17
|
+
import { accountHeldByOther } from "../lanes/account-ownership.js";
|
|
17
18
|
import { canonicalizeHome } from "../lanes/config.js";
|
|
18
19
|
import { LANE_PROVIDERS } from "../lanes/types.js";
|
|
19
20
|
import { capacityLoginCommand } from "./ledger.js";
|
|
@@ -365,6 +366,19 @@ export function pickAccount(input) {
|
|
|
365
366
|
});
|
|
366
367
|
continue;
|
|
367
368
|
}
|
|
369
|
+
// PS-006: another person's login is never a pick, so --account auto
|
|
370
|
+
// moves on to the next account instead of failing at lane create.
|
|
371
|
+
const heldConfig = input.lanesConfig.providers?.[providerId]?.accounts?.[laneMatch.id];
|
|
372
|
+
if (accountHeldByOther(heldConfig)) {
|
|
373
|
+
skipped.push({
|
|
374
|
+
...base,
|
|
375
|
+
reason: "held by another person, not used for lanes",
|
|
376
|
+
fix: "This login is held by " + (heldConfig?.holder ?? "another person") +
|
|
377
|
+
". Use one of your own logins. Change the holder to owner only if this is really your own login: hq lanes accounts set-owner " +
|
|
378
|
+
providerId + " " + laneMatch.id + " --holder owner",
|
|
379
|
+
});
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
368
382
|
const authState = account.authState ?? "unknown";
|
|
369
383
|
// authState "unknown" means the ledger has no usage reading for the
|
|
370
384
|
// account, not that its sign-in failed. Do not send the user to log in
|
|
@@ -22,6 +22,10 @@ export interface RosterRow {
|
|
|
22
22
|
usageOnly?: boolean;
|
|
23
23
|
/** The default home with no HQ account registered on it. Only the vendor login fixes it. */
|
|
24
24
|
unregisteredDefault?: boolean;
|
|
25
|
+
/** PS-006: owning business of the login (slug, personal or unknown). */
|
|
26
|
+
owningCompany?: string;
|
|
27
|
+
/** PS-006: owner, another named person, or unknown. */
|
|
28
|
+
holder?: string;
|
|
25
29
|
}
|
|
26
30
|
/** Sentence printed for an expired Claude credential. Other commands pass through. */
|
|
27
31
|
export declare function formatRefreshLine(provider: string, command: string): string;
|
|
@@ -63,6 +67,20 @@ export declare function repairSelection(rows: readonly RosterRow[], provider?: s
|
|
|
63
67
|
expired: RosterRow[];
|
|
64
68
|
};
|
|
65
69
|
export declare function loginJson(rows: readonly RosterRow[], nowMs: number, provider?: string): unknown;
|
|
70
|
+
/**
|
|
71
|
+
* PS-006: the same readings grouped by the business that owns each login,
|
|
72
|
+
* sorted by slug with `unknown` last, so usage can be reported per business.
|
|
73
|
+
*/
|
|
74
|
+
export declare function groupByOwningCompany(rows: readonly RosterRow[], nowMs: number): Array<{
|
|
75
|
+
owningCompany: string;
|
|
76
|
+
accounts: Array<{
|
|
77
|
+
provider: string;
|
|
78
|
+
label: string;
|
|
79
|
+
holder: string;
|
|
80
|
+
state: SignInState;
|
|
81
|
+
lastReadingAge: string;
|
|
82
|
+
}>;
|
|
83
|
+
}>;
|
|
66
84
|
export interface CapacityLoginRequest {
|
|
67
85
|
provider?: string;
|
|
68
86
|
account?: string;
|
|
@@ -133,10 +133,15 @@ export function rosterFrom(accounts, view, userHome) {
|
|
|
133
133
|
defaultHome.set(account.provider, path.resolve(account.home));
|
|
134
134
|
}
|
|
135
135
|
const registeredDefault = new Set();
|
|
136
|
+
// The registry account folded into each provider's default row, for its labels.
|
|
137
|
+
const foldedAccount = new Map();
|
|
136
138
|
for (const account of accounts) {
|
|
137
139
|
const home = defaultHome.get(account.provider);
|
|
138
|
-
if (account.label !== "default" && home && path.resolve(account.home) === home)
|
|
140
|
+
if (account.label !== "default" && home && path.resolve(account.home) === home) {
|
|
139
141
|
registeredDefault.add(account.provider);
|
|
142
|
+
if (!foldedAccount.has(account.provider))
|
|
143
|
+
foldedAccount.set(account.provider, account);
|
|
144
|
+
}
|
|
140
145
|
}
|
|
141
146
|
const rows = [];
|
|
142
147
|
for (const account of accounts) {
|
|
@@ -149,6 +154,7 @@ export function rosterFrom(accounts, view, userHome) {
|
|
|
149
154
|
const presented = match
|
|
150
155
|
? presentAccount({ ...match, homes: [account.home], labels: [account.label] }, account.provider, userHome)
|
|
151
156
|
: { state: "unknown", reason: null, command: null };
|
|
157
|
+
const owned = account.label === "default" ? foldedAccount.get(account.provider) : account;
|
|
152
158
|
rows.push({
|
|
153
159
|
provider: account.provider,
|
|
154
160
|
label: account.label,
|
|
@@ -164,6 +170,8 @@ export function rosterFrom(accounts, view, userHome) {
|
|
|
164
170
|
home: account.home,
|
|
165
171
|
usageOnly: account.lanes === false,
|
|
166
172
|
...(unregisteredDefault ? { unregisteredDefault: true } : {}),
|
|
173
|
+
owningCompany: owned?.owning_company ?? "unknown",
|
|
174
|
+
holder: owned?.holder ?? "unknown",
|
|
167
175
|
});
|
|
168
176
|
}
|
|
169
177
|
return rows;
|
|
@@ -261,10 +269,35 @@ export function loginJson(rows, nowMs, provider) {
|
|
|
261
269
|
usageOnly: row.usageOnly === true,
|
|
262
270
|
laneCommand: row.usageOnly ? laneEnableCommand(row.provider, row.label) : null,
|
|
263
271
|
lastReadingAge: readingAge(row.observedAt, nowMs),
|
|
272
|
+
owningCompany: row.owningCompany ?? "unknown",
|
|
273
|
+
holder: row.holder ?? "unknown",
|
|
264
274
|
})),
|
|
275
|
+
byOwningCompany: groupByOwningCompany(rows, nowMs),
|
|
265
276
|
addAccountCommands: addAccountCommands(provider),
|
|
266
277
|
};
|
|
267
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* PS-006: the same readings grouped by the business that owns each login,
|
|
281
|
+
* sorted by slug with `unknown` last, so usage can be reported per business.
|
|
282
|
+
*/
|
|
283
|
+
export function groupByOwningCompany(rows, nowMs) {
|
|
284
|
+
const groups = new Map();
|
|
285
|
+
for (const row of rows) {
|
|
286
|
+
const key = row.owningCompany ?? "unknown";
|
|
287
|
+
const list = groups.get(key) ?? [];
|
|
288
|
+
list.push({
|
|
289
|
+
provider: row.provider,
|
|
290
|
+
label: row.label,
|
|
291
|
+
holder: row.holder ?? "unknown",
|
|
292
|
+
state: row.state,
|
|
293
|
+
lastReadingAge: readingAge(row.observedAt, nowMs),
|
|
294
|
+
});
|
|
295
|
+
groups.set(key, list);
|
|
296
|
+
}
|
|
297
|
+
return [...groups.entries()]
|
|
298
|
+
.sort(([a], [b]) => (a === "unknown" ? 1 : 0) - (b === "unknown" ? 1 : 0) || a.localeCompare(b))
|
|
299
|
+
.map(([owningCompany, accounts]) => ({ owningCompany, accounts }));
|
|
300
|
+
}
|
|
268
301
|
function readingAge(observedAt, nowMs) {
|
|
269
302
|
if (!observedAt)
|
|
270
303
|
return "—";
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { isDeepStrictEqual } from "node:util";
|
|
15
15
|
import yaml from "js-yaml";
|
|
16
|
+
import { splitFrontmatterBlock } from "../../utils/frontmatter.js";
|
|
16
17
|
import { entityId } from "./identity.js";
|
|
17
18
|
// Same delimiters as hq-pro `parser.ts`.
|
|
18
19
|
const FRONTMATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
@@ -333,11 +334,10 @@ function backRefTarget(href) {
|
|
|
333
334
|
export function appendBackRefs(fullContent, refs) {
|
|
334
335
|
if (refs.length === 0)
|
|
335
336
|
return { content: fullContent, added: 0 };
|
|
336
|
-
const
|
|
337
|
-
if (!
|
|
337
|
+
const split = splitFrontmatterBlock(fullContent);
|
|
338
|
+
if (!split)
|
|
338
339
|
return { content: fullContent, added: 0 };
|
|
339
|
-
const frontmatter =
|
|
340
|
-
const body = fmMatch[2];
|
|
340
|
+
const { frontmatter, body } = split;
|
|
341
341
|
const sectionMatch = /(^|\n)(##\s+Relationships\s*\n)([\s\S]*?)(?=\n##\s|\s*$)/.exec(body);
|
|
342
342
|
const existing = new Set();
|
|
343
343
|
if (sectionMatch) {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
import * as fs from "node:fs";
|
|
51
51
|
import * as path from "node:path";
|
|
52
52
|
import { isDeepStrictEqual } from "node:util";
|
|
53
|
+
import { matchFrontmatter, splitFrontmatterBlock } from "../../utils/frontmatter.js";
|
|
53
54
|
import { freshAliases, ownNames } from "./aliases.js";
|
|
54
55
|
import { entitiesRoot, safeWriteFile } from "./company.js";
|
|
55
56
|
import { appendBackRefs, OWNED_KEYS, parseEntityFile, patchEntityFile, setIdentityKeys } from "./entity-file.js";
|
|
@@ -82,10 +83,6 @@ function sectionLines(body) {
|
|
|
82
83
|
const match = /(^|\n)##\s+Relationships\s*\n([\s\S]*?)(?=\n##\s|$)/.exec(body);
|
|
83
84
|
return match ? match[2].split(/\r?\n/).map((line) => line.trimEnd()) : [];
|
|
84
85
|
}
|
|
85
|
-
function splitBody(content) {
|
|
86
|
-
const match = /^(---\r?\n[\s\S]*?\r?\n---\r?\n?)([\s\S]*)$/.exec(content);
|
|
87
|
-
return match ? { frontmatter: match[1], body: match[2] } : null;
|
|
88
|
-
}
|
|
89
86
|
/**
|
|
90
87
|
* A line of the copy whose every link points at the copy itself or at its
|
|
91
88
|
* original. Moved to the original it would link the survivor to itself or to
|
|
@@ -97,8 +94,8 @@ function isPairSelfLine(line, pair) {
|
|
|
97
94
|
}
|
|
98
95
|
/** Relationship lines of the copy that the original lacks (back-references and self links excluded). */
|
|
99
96
|
function missingRelationshipLines(originalContent, copyContent, pair) {
|
|
100
|
-
const original =
|
|
101
|
-
const copy =
|
|
97
|
+
const original = splitFrontmatterBlock(originalContent);
|
|
98
|
+
const copy = splitFrontmatterBlock(copyContent);
|
|
102
99
|
if (!original || !copy)
|
|
103
100
|
return [];
|
|
104
101
|
const have = new Set(original.body.split(/\r?\n/).map((line) => line.trimEnd()));
|
|
@@ -115,7 +112,7 @@ function missingRelationshipLines(originalContent, copyContent, pair) {
|
|
|
115
112
|
function appendRelationshipLines(content, lines) {
|
|
116
113
|
if (lines.length === 0)
|
|
117
114
|
return content;
|
|
118
|
-
const parts =
|
|
115
|
+
const parts = splitFrontmatterBlock(content);
|
|
119
116
|
const body = parts.body;
|
|
120
117
|
const section = /(^|\n)(##\s+Relationships\s*\n)([\s\S]*?)(?=\n##\s|\s*$)/.exec(body);
|
|
121
118
|
let next;
|
|
@@ -403,12 +400,11 @@ function relink(fromRel, content, copy, original) {
|
|
|
403
400
|
return `](${target.slice(0, cut + 1)}${encoded}${fragment})`;
|
|
404
401
|
});
|
|
405
402
|
}
|
|
406
|
-
const FRONT_RE = /^---\r?\n([\s\S]*?)\r?\n---(\r?\n|$)/;
|
|
407
403
|
const REL_REF = /^(\s*(?:- )?[A-Za-z_][A-Za-z0-9_]*:\s*)(["']?)(\.\.\/[^"'\n]+?\.md)\2\s*$/;
|
|
408
404
|
const WIKI_LINK = /\[\[(ontology\/entities\/[^\]|\n]+?)(\|[^\]\n]*)?\]\]/g;
|
|
409
405
|
const PATH_LINE = /^(\s*(?:- )?path:\s*)(["']?)(ontology\/entities\/[^"'\n]+?\.md)\2\s*$/;
|
|
410
406
|
function frontLines(content) {
|
|
411
|
-
const match =
|
|
407
|
+
const match = matchFrontmatter(content);
|
|
412
408
|
if (!match)
|
|
413
409
|
return null;
|
|
414
410
|
return { start: match.index + match[0].indexOf(match[1]), lines: match[1].split(/\r?\n/) };
|
|
@@ -727,11 +723,11 @@ function mergeCopy(index, pair, siblings, originalContent, copyContent, now) {
|
|
|
727
723
|
});
|
|
728
724
|
if (!patched.ok)
|
|
729
725
|
return patched.reason;
|
|
730
|
-
const have = new Set(
|
|
726
|
+
const have = new Set(splitFrontmatterBlock(patched.content)?.body.split(/\r?\n/).map((line) => line.trim()) ?? []);
|
|
731
727
|
// The copy's `# Name` heading is not content: its name moves to an alias.
|
|
732
728
|
// The `## Relationships` heading is not content either: its lines count one by one.
|
|
733
729
|
const heading = `# ${copyEntity.canonical_name}`;
|
|
734
|
-
const leftover = (
|
|
730
|
+
const leftover = (splitFrontmatterBlock(copyContent)?.body.split(/\r?\n/) ?? [])
|
|
735
731
|
.map((line) => line.trim())
|
|
736
732
|
.filter((line) => line !== "" &&
|
|
737
733
|
line !== heading &&
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import * as fs from "node:fs";
|
|
12
12
|
import * as path from "node:path";
|
|
13
|
+
import { matchFrontmatter } from "../../utils/frontmatter.js";
|
|
13
14
|
import { writeCompanyBrief } from "./company-brief.js";
|
|
14
15
|
import { resolveOntologyCompany, safeWriteFile, stateRoot } from "./company.js";
|
|
15
16
|
import { startMultiWriterRun } from "./multi-writer.js";
|
|
@@ -459,7 +460,7 @@ const READ_COPY_DIR = "ontology-inputs";
|
|
|
459
460
|
*/
|
|
460
461
|
export function stripAnnotations(text) {
|
|
461
462
|
let out = text;
|
|
462
|
-
const front =
|
|
463
|
+
const front = matchFrontmatter(text);
|
|
463
464
|
if (front && /^entities:/m.test(front[1])) {
|
|
464
465
|
let inList = false;
|
|
465
466
|
const body = front[1]
|
|
@@ -40,10 +40,13 @@ export function archiveOldThreads(args = [], options = {}) {
|
|
|
40
40
|
return 2;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
// One reading of the clock for the whole run: the gate and the cutoff must
|
|
44
|
+
// agree on the day even when the run crosses midnight.
|
|
45
|
+
const at = now();
|
|
43
46
|
const touchfile = path.join(hqRoot, "workspace/.last-archive-run");
|
|
44
47
|
if (gated && fs.existsSync(touchfile)) {
|
|
45
48
|
const mtime = Math.floor(fs.statSync(touchfile).mtimeMs / 1000);
|
|
46
|
-
const seconds = Math.floor(
|
|
49
|
+
const seconds = Math.floor(at.getTime() / 1000);
|
|
47
50
|
if (seconds - mtime < 86_400) {
|
|
48
51
|
line(stderr, "archive-old-threads: gated (ran <24h ago, skipping)");
|
|
49
52
|
return 0;
|
|
@@ -52,7 +55,7 @@ export function archiveOldThreads(args = [], options = {}) {
|
|
|
52
55
|
const threadsDir = path.join(hqRoot, "workspace/threads");
|
|
53
56
|
const archiveRoot = path.join(threadsDir, "archive");
|
|
54
57
|
fs.mkdirSync(archiveRoot, { recursive: true });
|
|
55
|
-
const cutoff = cutoffStamp(
|
|
58
|
+
const cutoff = cutoffStamp(at, cutoffDays);
|
|
56
59
|
// `ls workspace/threads/T-*.json`: top level only, name-ordered, archive/ excluded.
|
|
57
60
|
let names;
|
|
58
61
|
try {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest listing only counts while companies/<slug> does not exist yet
|
|
3
|
+
* (lstat ENOENT, so no dangling symlink either) and no case-insensitive
|
|
4
|
+
* match among real company directories. That lets /newcompany bind before
|
|
5
|
+
* creating the folder without skipping the symlink and case-alias guards.
|
|
6
|
+
*/
|
|
7
|
+
export declare function isPendingManifestCompany(root: string, slug: string): boolean;
|
|
1
8
|
/** Reads the active session's company lock without importing the full hq-session command. */
|
|
2
9
|
export declare function sessionCompanySlugs(root: string, env?: NodeJS.ProcessEnv, multiCompanyLockEnabled?: boolean): string[];
|
|
3
10
|
/**
|
|
@@ -21,7 +28,12 @@ export declare function multiCompanySessionLockRecordedOn(primary: string, env?:
|
|
|
21
28
|
* `hq-session.sh get company_slugs`.
|
|
22
29
|
*
|
|
23
30
|
* Returns [] unless `company_slug` names a real (non-symlink) directory under
|
|
24
|
-
* companies
|
|
31
|
+
* companies/, or is listed in companies/manifest.yaml with no companies/<slug>
|
|
32
|
+
* path yet and no case-alias of another company folder. A pending manifest
|
|
33
|
+
* listing is enough so /newcompany can create companies/<slug>/ after binding
|
|
34
|
+
* the session to that slug (feedback_96cb3024). A symlink or case alias at
|
|
35
|
+
* that slug still fails closed. Listed companies that are neither a real
|
|
36
|
+
* directory nor a pending manifest slug are dropped.
|
|
25
37
|
* hqd's own synthetic `hqd-*` check sessions are ignored, so a caller cannot
|
|
26
38
|
* borrow the binding hqd wrote for a different check. The session folder and
|
|
27
39
|
* its meta.yaml must both be real entries, not symlinks: a symlinked session
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import { readCompaniesManifestMap } from "../work-context/repo-remote.js";
|
|
4
5
|
import { resolveSessionId } from "./session-id.js";
|
|
5
6
|
function metaValue(contents, key) {
|
|
6
7
|
for (const line of contents.split("\n")) {
|
|
@@ -52,6 +53,71 @@ function isExactCompanyDirectory(root, slug) {
|
|
|
52
53
|
}
|
|
53
54
|
return false;
|
|
54
55
|
}
|
|
56
|
+
/** True when companies/manifest.yaml lists this slug, even before its folder exists. */
|
|
57
|
+
function isListedInManifest(root, slug) {
|
|
58
|
+
const map = readCompaniesManifestMap(root);
|
|
59
|
+
return Boolean(map && Object.prototype.hasOwnProperty.call(map, slug));
|
|
60
|
+
}
|
|
61
|
+
function pathExists(target) {
|
|
62
|
+
try {
|
|
63
|
+
fs.lstatSync(target);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const code = error.code;
|
|
68
|
+
if (code === "ENOENT")
|
|
69
|
+
return false;
|
|
70
|
+
if (code === "ENOTDIR" || code === "EACCES" || code === "ELOOP")
|
|
71
|
+
return true;
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** True when a differently cased real company directory already exists. */
|
|
76
|
+
function hasCaseAlias(root, slug) {
|
|
77
|
+
const companies = path.join(root, "companies");
|
|
78
|
+
const fold = slug.toLowerCase();
|
|
79
|
+
try {
|
|
80
|
+
for (const entry of fs.readdirSync(companies)) {
|
|
81
|
+
if (entry === slug || entry.toLowerCase() !== fold)
|
|
82
|
+
continue;
|
|
83
|
+
const candidate = path.join(companies, entry);
|
|
84
|
+
try {
|
|
85
|
+
if (!fs.statSync(candidate).isDirectory() || fs.lstatSync(candidate).isSymbolicLink())
|
|
86
|
+
continue;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const code = error.code;
|
|
91
|
+
if (code !== "ENOENT" && code !== "ENOTDIR" && code !== "EACCES" && code !== "ELOOP")
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
const code = error.code;
|
|
98
|
+
if (code !== "ENOENT" && code !== "ENOTDIR" && code !== "EACCES" && code !== "ELOOP")
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Manifest listing only counts while companies/<slug> does not exist yet
|
|
105
|
+
* (lstat ENOENT, so no dangling symlink either) and no case-insensitive
|
|
106
|
+
* match among real company directories. That lets /newcompany bind before
|
|
107
|
+
* creating the folder without skipping the symlink and case-alias guards.
|
|
108
|
+
*/
|
|
109
|
+
export function isPendingManifestCompany(root, slug) {
|
|
110
|
+
if (!isListedInManifest(root, slug))
|
|
111
|
+
return false;
|
|
112
|
+
if (pathExists(path.join(root, "companies", slug)))
|
|
113
|
+
return false;
|
|
114
|
+
if (hasCaseAlias(root, slug))
|
|
115
|
+
return false;
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
function isUsableCompanyBind(root, slug) {
|
|
119
|
+
return isExactCompanyDirectory(root, slug) || isPendingManifestCompany(root, slug);
|
|
120
|
+
}
|
|
55
121
|
/** Reads the active session's company lock without importing the full hq-session command. */
|
|
56
122
|
export function sessionCompanySlugs(root, env = process.env, multiCompanyLockEnabled = false) {
|
|
57
123
|
const sessionId = resolveSessionId(root, env);
|
|
@@ -74,7 +140,7 @@ export function sessionCompanySlugs(root, env = process.env, multiCompanyLockEna
|
|
|
74
140
|
const primary = metaValue(contents, "company_slug");
|
|
75
141
|
return primary ? [primary] : [];
|
|
76
142
|
}
|
|
77
|
-
return listedCompanySlugs(contents).filter((slug) => slug === "personal" ||
|
|
143
|
+
return listedCompanySlugs(contents).filter((slug) => slug === "personal" || isUsableCompanyBind(root, slug));
|
|
78
144
|
}
|
|
79
145
|
/**
|
|
80
146
|
* Whether the multi-company session lock is on for a session whose primary
|
|
@@ -113,7 +179,12 @@ const SESSION_DIR_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,199}$/;
|
|
|
113
179
|
* `hq-session.sh get company_slugs`.
|
|
114
180
|
*
|
|
115
181
|
* Returns [] unless `company_slug` names a real (non-symlink) directory under
|
|
116
|
-
* companies
|
|
182
|
+
* companies/, or is listed in companies/manifest.yaml with no companies/<slug>
|
|
183
|
+
* path yet and no case-alias of another company folder. A pending manifest
|
|
184
|
+
* listing is enough so /newcompany can create companies/<slug>/ after binding
|
|
185
|
+
* the session to that slug (feedback_96cb3024). A symlink or case alias at
|
|
186
|
+
* that slug still fails closed. Listed companies that are neither a real
|
|
187
|
+
* directory nor a pending manifest slug are dropped.
|
|
117
188
|
* hqd's own synthetic `hqd-*` check sessions are ignored, so a caller cannot
|
|
118
189
|
* borrow the binding hqd wrote for a different check. The session folder and
|
|
119
190
|
* its meta.yaml must both be real entries, not symlinks: a symlinked session
|
|
@@ -143,12 +214,12 @@ export function sessionMetaCompanies(root, sessionId, env = process.env) {
|
|
|
143
214
|
const primary = metaValue(contents, "company_slug");
|
|
144
215
|
if (!primary || primary === "personal" || !/^[A-Za-z0-9_-]+$/.test(primary))
|
|
145
216
|
return [];
|
|
146
|
-
if (!
|
|
217
|
+
if (!isUsableCompanyBind(root, primary))
|
|
147
218
|
return [];
|
|
148
219
|
if (!multiCompanySessionLockRecordedOn(primary, env))
|
|
149
220
|
return [primary];
|
|
150
221
|
const others = listedCompanySlugs(contents)
|
|
151
|
-
.filter((slug) => slug !== primary && slug !== "personal" &&
|
|
222
|
+
.filter((slug) => slug !== primary && slug !== "personal" && isUsableCompanyBind(root, slug));
|
|
152
223
|
return [primary, ...others];
|
|
153
224
|
}
|
|
154
225
|
//# sourceMappingURL=session-company.js.map
|
|
@@ -10,6 +10,12 @@ export type CoreIo = {
|
|
|
10
10
|
cwd?: string;
|
|
11
11
|
now?: () => Date;
|
|
12
12
|
randomBytes?: (size: number) => Buffer;
|
|
13
|
+
/**
|
|
14
|
+
* Arms a timer and returns a function that disarms it. Defaults to
|
|
15
|
+
* setTimeout/clearTimeout; tests inject it to end a stalled URL check
|
|
16
|
+
* without waiting out the real 15 s limit.
|
|
17
|
+
*/
|
|
18
|
+
armTimer?: (onExpire: () => void, ms: number) => () => void;
|
|
13
19
|
};
|
|
14
20
|
export declare function worktreeGcPathKey(value: string): string;
|
|
15
21
|
export declare function runWorktreeGc(args: readonly string[], hqRoot: string, io?: CoreIo): number;
|
|
@@ -16,6 +16,10 @@ const stderr = (io, value) => (io.stderr ?? ((v) => process.stderr.write(v)))(va
|
|
|
16
16
|
const envOf = (io) => io.env ?? process.env;
|
|
17
17
|
const nowOf = (io) => (io.now ?? (() => new Date()))();
|
|
18
18
|
const randomBytesOf = (io, size) => (io.randomBytes ?? randomBytes)(size);
|
|
19
|
+
const defaultArmTimer = (onExpire, ms) => {
|
|
20
|
+
const timer = setTimeout(onExpire, ms);
|
|
21
|
+
return () => clearTimeout(timer);
|
|
22
|
+
};
|
|
19
23
|
const stripTrailingNewlines = (value) => value.replace(/\n+$/u, "");
|
|
20
24
|
function git(args, options = {}) {
|
|
21
25
|
const childEnv = options.env;
|
|
@@ -1026,9 +1030,9 @@ function isReadable(file) {
|
|
|
1026
1030
|
function joinShellPath(root, value) {
|
|
1027
1031
|
return value.startsWith("/") ? value : `${root}/${value}`;
|
|
1028
1032
|
}
|
|
1029
|
-
async function urlIsPresent(url) {
|
|
1033
|
+
async function urlIsPresent(url, io) {
|
|
1030
1034
|
const controller = new AbortController();
|
|
1031
|
-
const
|
|
1035
|
+
const disarm = (io.armTimer ?? defaultArmTimer)(() => controller.abort(), 15_000);
|
|
1032
1036
|
try {
|
|
1033
1037
|
let current;
|
|
1034
1038
|
try {
|
|
@@ -1060,7 +1064,7 @@ async function urlIsPresent(url) {
|
|
|
1060
1064
|
return false;
|
|
1061
1065
|
}
|
|
1062
1066
|
finally {
|
|
1063
|
-
|
|
1067
|
+
disarm();
|
|
1064
1068
|
}
|
|
1065
1069
|
}
|
|
1066
1070
|
async function drainResponseBody(response) {
|
|
@@ -1222,7 +1226,7 @@ export async function runVerifyStoryDeliverables(args, hqRoot, io = {}) {
|
|
|
1222
1226
|
ok = git(["-C", repo, "cat-file", "-e", `${value}^{commit}`], { env }).status === 0;
|
|
1223
1227
|
}
|
|
1224
1228
|
else if (kind === "url")
|
|
1225
|
-
ok = offline === "1" || await urlIsPresent(value);
|
|
1229
|
+
ok = offline === "1" || await urlIsPresent(value, io);
|
|
1226
1230
|
if (ok)
|
|
1227
1231
|
present.push(reference);
|
|
1228
1232
|
else
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prefix a unit's command with `taskpolicy -b` on macOS. taskpolicy execs the
|
|
3
|
+
* command in place, so the pid the supervisor tracks is the unit itself, and
|
|
4
|
+
* PRIO_DARWIN_BG is inherited by everything the unit spawns (qmd included).
|
|
5
|
+
*/
|
|
6
|
+
export declare function backgroundQosCommand(command: [string, string[]], backgroundQos: boolean, platform?: NodeJS.Platform | string, exists?: (file: string) => boolean): [string, string[]];
|
|
7
|
+
//# sourceMappingURL=background-qos.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
const DARWIN_TASKPOLICY = "/usr/sbin/taskpolicy";
|
|
3
|
+
/**
|
|
4
|
+
* Prefix a unit's command with `taskpolicy -b` on macOS. taskpolicy execs the
|
|
5
|
+
* command in place, so the pid the supervisor tracks is the unit itself, and
|
|
6
|
+
* PRIO_DARWIN_BG is inherited by everything the unit spawns (qmd included).
|
|
7
|
+
*/
|
|
8
|
+
export function backgroundQosCommand(command, backgroundQos, platform = process.platform, exists = fs.existsSync) {
|
|
9
|
+
if (!backgroundQos || platform !== "darwin" || !exists(DARWIN_TASKPOLICY))
|
|
10
|
+
return command;
|
|
11
|
+
return [DARWIN_TASKPOLICY, ["-b", command[0], ...command[1]]];
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=background-qos.js.map
|
|
@@ -42,9 +42,16 @@ type UnitCommand = {
|
|
|
42
42
|
} | {
|
|
43
43
|
type: "internal";
|
|
44
44
|
task: InternalTask;
|
|
45
|
+
} | {
|
|
46
|
+
type: "worker";
|
|
47
|
+
task: "search-index";
|
|
45
48
|
};
|
|
46
49
|
/** Work the daemon does in its own process on a schedule, without starting a child. */
|
|
47
50
|
export type InternalTask = "rotate-logs" | "lanes-reconcile";
|
|
51
|
+
/** Compatibility path for installations that do not contain the versioned worker. */
|
|
52
|
+
export declare function legacySearchIndexCommand(root: string | undefined): Extract<UnitCommand, {
|
|
53
|
+
type: "hq";
|
|
54
|
+
}>;
|
|
48
55
|
interface UnitBlock {
|
|
49
56
|
/** `waiting` clears when requirements appear; `unavailable` needs a newer CLI; `paused` needs an explicit resume. */
|
|
50
57
|
state: "waiting" | "unavailable" | "paused";
|
|
@@ -182,6 +189,8 @@ export interface PlanContext {
|
|
|
182
189
|
lanesReconcileInProcess?: boolean;
|
|
183
190
|
/** The active hq-cloud sync runner owns post-sync QMD indexing. */
|
|
184
191
|
searchIndexOwnedBySyncRunner?: boolean;
|
|
192
|
+
/** Whether the daemon can hand package protection to a scheduled worker. */
|
|
193
|
+
searchIndexWorkerAvailable?: boolean;
|
|
185
194
|
/** Sync runner children already started by this daemon before their lease is written. */
|
|
186
195
|
daemonSyncRunnerPids?: ReadonlySet<number>;
|
|
187
196
|
/** The protocol-event heartbeat watchdog timeout for the sync runner. */
|
|
@@ -232,6 +241,7 @@ export declare function hqCloudUnits(machineType: MachineType, enabled: readonly
|
|
|
232
241
|
export declare const CODEX_RUNNER_SCRIPT = "/usr/local/bin/outpost-codex-runner.sh";
|
|
233
242
|
/** The outpost's Claude runner script, read for the session name it uses. */
|
|
234
243
|
export declare const CLAUDE_RUNNER_SCRIPT = "/usr/local/bin/outpost-runner.sh";
|
|
244
|
+
export declare const NOT_SIGNED_IN = "not signed in (run `hq login`)";
|
|
235
245
|
export declare function daemonAloneRunsLegacySync(ctx: PlanContext): boolean;
|
|
236
246
|
/** Turn enabled services into concrete units for this host. */
|
|
237
247
|
export declare function planUnits(services: readonly ServiceName[], ctx: PlanContext): UnitPlan[];
|
|
@@ -93,6 +93,10 @@ export function enabledServices(machineType, overrides) {
|
|
|
93
93
|
};
|
|
94
94
|
return SERVICE_NAMES.filter((s) => wanted(s) || implied(s));
|
|
95
95
|
}
|
|
96
|
+
/** Compatibility path for installations that do not contain the versioned worker. */
|
|
97
|
+
export function legacySearchIndexCommand(root) {
|
|
98
|
+
return { type: "hq", args: ["index", "sync", "--hq-root", root ?? ""] };
|
|
99
|
+
}
|
|
96
100
|
export const FLEET_BOT_STOP_GRACE_MS = 30_000;
|
|
97
101
|
export const FLEET_BOTS_UPDATE_UNIT = "fleet-bots-update";
|
|
98
102
|
export const FLEET_BOTS_UPDATE_INTERVAL_SEC = 30 * 60;
|
|
@@ -143,7 +147,7 @@ export const CODEX_RUNNER_SCRIPT = "/usr/local/bin/outpost-codex-runner.sh";
|
|
|
143
147
|
/** The outpost's Claude runner script, read for the session name it uses. */
|
|
144
148
|
export const CLAUDE_RUNNER_SCRIPT = "/usr/local/bin/outpost-runner.sh";
|
|
145
149
|
const NO_HQ_ROOT = "no HQ folder configured (run `hq daemon install --hq-root <path>`)";
|
|
146
|
-
const NOT_SIGNED_IN = "not signed in (run `hq login`)";
|
|
150
|
+
export const NOT_SIGNED_IN = "not signed in (run `hq login`)";
|
|
147
151
|
const KIT_NOT_SET_UP = "the agent kit is not set up on this machine (run `hq agent kit install`)";
|
|
148
152
|
function syncOwnerBlock(ctx) {
|
|
149
153
|
if (ctx.machineType === "desktop" && ctx.syncOwner === "desktop-app" && ctx.desktopAppManagesSync) {
|
|
@@ -460,7 +464,10 @@ function planService(service, ctx) {
|
|
|
460
464
|
kind: "scheduled",
|
|
461
465
|
intervalSec: 900,
|
|
462
466
|
initialDelaySec: 120,
|
|
463
|
-
command:
|
|
467
|
+
command: ctx.searchIndexWorkerAvailable === false
|
|
468
|
+
? legacySearchIndexCommand(ctx.hqRoot)
|
|
469
|
+
: { type: "worker", task: "search-index" },
|
|
470
|
+
env: ctx.hqRoot ? { HQ_ROOT: ctx.hqRoot } : {},
|
|
464
471
|
// A full qmd pass rereads every indexed file; at default priority it
|
|
465
472
|
// got HQ listed under macOS "Using Significant Energy".
|
|
466
473
|
backgroundQos: true,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ShareCandidate = {
|
|
2
|
+
kind: "deploy";
|
|
3
|
+
appId: string;
|
|
4
|
+
companies: string[];
|
|
5
|
+
} | {
|
|
6
|
+
kind: "path";
|
|
7
|
+
path: string;
|
|
8
|
+
trigger: string;
|
|
9
|
+
threadHandoff?: true;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* At most twelve normalized references. Raw tool input and output cannot be part of a note.
|
|
13
|
+
* A well-formed path the release could not have suggested is skipped; the rest of the note is kept.
|
|
14
|
+
*/
|
|
15
|
+
export declare function parseShareCandidates(value: unknown): ShareCandidate[] | undefined;
|
|
16
|
+
/** Write only the existing local suggestion state. The consumer still must request approval to share. */
|
|
17
|
+
export declare function executeAclSuggestion(root: string, session: string, candidates: ShareCandidate[], env: NodeJS.ProcessEnv, now?: () => Date): number;
|
|
18
|
+
//# sourceMappingURL=hook-requests-acl-suggest.d.ts.map
|