@indigoai-us/hq-cli 5.345.219 → 5.345.221
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 +170 -0
- package/dist/command-catalog.generated.d.ts +169 -3
- package/dist/command-catalog.generated.js +206 -3
- package/dist/commands/auth.js +4 -1
- package/dist/commands/bot-runtime.d.ts +18 -5
- package/dist/commands/bot-runtime.js +29 -12
- package/dist/commands/bot.d.ts +85 -0
- package/dist/commands/bot.js +245 -16
- package/dist/commands/cloud.d.ts +16 -0
- package/dist/commands/cloud.js +112 -102
- package/dist/commands/core-checkpoint-native.d.ts +13 -0
- package/dist/commands/core-checkpoint-native.js +167 -52
- package/dist/commands/core-hook-registration-plan.js +5 -4
- package/dist/commands/core-stop-autosave.d.ts +21 -0
- package/dist/commands/core-stop-autosave.js +300 -0
- package/dist/commands/core.js +2 -0
- package/dist/commands/daemon.d.ts +5 -0
- package/dist/commands/daemon.js +52 -9
- package/dist/commands/doctor-usage.d.ts +5 -0
- package/dist/commands/doctor-usage.js +25 -0
- package/dist/commands/env.d.ts +49 -4
- package/dist/commands/env.js +355 -5
- package/dist/commands/integrations.js +84 -3
- package/dist/commands/lanes-shared.d.ts +3 -0
- package/dist/commands/lanes.d.ts +3 -0
- package/dist/commands/lanes.js +87 -3
- package/dist/commands/packs.js +23 -0
- package/dist/commands/pkg-update.d.ts +6 -0
- package/dist/commands/pkg-update.js +15 -7
- package/dist/commands/run.js +55 -45
- package/dist/commands/sources.js +4 -3
- package/dist/commands/sync-core.d.ts +1 -0
- package/dist/commands/sync-core.js +77 -3
- package/dist/commands/whoami.js +96 -80
- package/dist/lib/bot/config.d.ts +17 -0
- package/dist/lib/bot/config.js +13 -0
- package/dist/lib/bot/fleet-cron.js +29 -4
- package/dist/lib/bot/fleet-local.d.ts +30 -2
- package/dist/lib/bot/fleet-local.js +60 -1
- package/dist/lib/bot/grok-login-scope.d.ts +36 -0
- package/dist/lib/bot/grok-login-scope.js +93 -0
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +51 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +90 -9
- package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
- package/dist/lib/bot/legacy-provider-login.js +28 -22
- package/dist/lib/bot/run.d.ts +29 -5
- package/dist/lib/bot/run.js +203 -1
- package/dist/lib/bot/runtime-sign-in-check.js +6 -1
- package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
- package/dist/lib/bot/signals-try-now.d.ts +76 -0
- package/dist/lib/bot/signals-try-now.js +111 -0
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +22 -3
- package/dist/lib/capacity/collectors/claude-oauth.js +78 -22
- package/dist/lib/capacity/scheduler.d.ts +8 -0
- package/dist/lib/capacity/scheduler.js +5 -2
- package/dist/lib/core-utils/sentry-report.js +2 -0
- package/dist/lib/daemon/machine-checks.d.ts +22 -1
- package/dist/lib/daemon/machine-checks.js +54 -12
- package/dist/lib/daemon/run.js +71 -8
- package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
- package/dist/lib/daemon/runtime-notifications.js +50 -0
- package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
- package/dist/lib/daemon/stop-autosave-lock.js +166 -0
- package/dist/lib/daemon/stop-autosave.d.ts +28 -0
- package/dist/lib/daemon/stop-autosave.js +111 -0
- package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
- package/dist/lib/daemon/stop-diagnostics.js +136 -0
- package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
- package/dist/lib/daemon/stop-job-executor.js +126 -0
- package/dist/lib/daemon/stop-jobs.d.ts +93 -0
- package/dist/lib/daemon/stop-jobs.js +599 -0
- package/dist/lib/doctor/checks/fleet-hook-core.d.ts +9 -1
- package/dist/lib/doctor/checks/fleet-hook-core.js +39 -15
- package/dist/lib/doctor/checks/host-core.js +1 -1
- package/dist/lib/environment/access-probes.d.ts +234 -0
- package/dist/lib/environment/access-probes.js +918 -0
- package/dist/lib/environment/profile.d.ts +15 -2
- package/dist/lib/environment/profile.js +55 -20
- package/dist/lib/environment/rfc3339.d.ts +8 -0
- package/dist/lib/environment/rfc3339.js +26 -0
- package/dist/lib/environment/work-requirements.d.ts +169 -0
- package/dist/lib/environment/work-requirements.js +389 -0
- package/dist/lib/hook-engine/coverage.d.ts +137 -7
- package/dist/lib/hook-engine/coverage.js +1424 -4
- package/dist/lib/hook-engine/fleet-registration.d.ts +17 -5
- package/dist/lib/hook-engine/fleet-registration.js +53 -17
- package/dist/lib/hook-engine/git-stop-config.json +513 -0
- package/dist/lib/hook-engine/native-stop-compatibility.json +311 -0
- package/dist/lib/hook-engine/reconcile.js +2 -2
- package/dist/lib/hot-channels/alert.d.ts +10 -1
- package/dist/lib/hot-channels/alert.js +38 -8
- package/dist/lib/hot-channels/signals-claude-login.d.ts +53 -0
- package/dist/lib/hot-channels/signals-claude-login.js +96 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +143 -17
- package/dist/lib/hot-channels/signals-pass.js +324 -17
- package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
- package/dist/lib/hot-channels/signals-runtime.js +82 -0
- package/dist/lib/install/hook-target.js +1 -1
- package/dist/lib/lanes/host-capacity.d.ts +26 -2
- package/dist/lib/lanes/host-capacity.js +17 -2
- package/dist/lib/lanes/host-compute.d.ts +90 -0
- package/dist/lib/lanes/host-compute.js +185 -0
- package/dist/lib/lanes/index.d.ts +2 -0
- package/dist/lib/lanes/index.js +1 -0
- package/dist/lib/lanes/reconcile.js +22 -1
- package/dist/lib/lanes/resource-usage.d.ts +155 -0
- package/dist/lib/lanes/resource-usage.js +589 -0
- package/dist/lib/lanes/run-size.d.ts +46 -0
- package/dist/lib/lanes/run-size.js +197 -0
- package/dist/lib/lanes/store.js +27 -0
- package/dist/lib/lanes/throttle.d.ts +36 -1
- package/dist/lib/lanes/throttle.js +47 -10
- package/dist/lib/lanes/types.d.ts +40 -0
- package/dist/lib/lanes/types.js +2 -2
- package/dist/lib/lanes/watcher.js +13 -4
- package/dist/lib/lanes/worker-process.d.ts +25 -2
- package/dist/lib/lanes/worker-process.js +71 -19
- package/dist/lib/placement/match.d.ts +192 -0
- package/dist/lib/placement/match.js +667 -0
- package/dist/lib/safe-store.d.ts +14 -0
- package/dist/lib/safe-store.js +77 -4
- package/dist/lib/search-index/index.d.ts +88 -4
- package/dist/lib/search-index/index.js +299 -25
- package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
- package/dist/lib/search-index/max-doc-bytes.js +48 -23
- package/dist/lib/signals/codex-lockdown.d.ts +79 -0
- package/dist/lib/signals/codex-lockdown.js +271 -0
- package/dist/lib/signals/codex-login.d.ts +37 -0
- package/dist/lib/signals/codex-login.js +83 -0
- package/dist/lib/signals/engine.d.ts +28 -0
- package/dist/lib/signals/engine.js +77 -0
- package/dist/lib/signals/reply.d.ts +48 -0
- package/dist/lib/signals/reply.js +94 -12
- package/dist/lib/signals/run-record.js +6 -1
- package/dist/lib/signals/settings.d.ts +5 -0
- package/dist/lib/signals/settings.js +2 -0
- package/dist/lib/signals/steps/adapters.js +6 -0
- package/dist/lib/signals/steps/extract.d.ts +135 -12
- package/dist/lib/signals/steps/extract.js +416 -84
- package/dist/lib/signals/steps/types.d.ts +21 -0
- package/dist/lib/sync-core/engine-home.d.ts +41 -2
- package/dist/lib/sync-core/engine-home.js +132 -19
- package/dist/lib/sync-core/reconcile.js +1 -1
- package/dist/lib/sync-core/release-compare.d.ts +7 -0
- package/dist/lib/sync-core/release-compare.js +16 -0
- package/dist/lib/sync-core/release.d.ts +2 -1
- package/dist/lib/sync-core/release.js +2 -10
- package/dist/lib/sync-core/rollout-state.d.ts +2 -1
- package/dist/lib/sync-core/rollout-state.js +5 -2
- package/dist/lib/sync-core/vault-uid.d.ts +2 -0
- package/dist/lib/sync-core/vault-uid.js +4 -0
- package/dist/run/schema-env-overrides.d.ts +24 -0
- package/dist/run/schema-env-overrides.js +72 -0
- package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
- package/dist/utils/auth-session-check.d.ts +16 -0
- package/dist/utils/auth-session-check.js +16 -0
- package/dist/utils/client-health-contract.d.ts +6 -0
- package/dist/utils/client-health-contract.js +13 -0
- package/dist/utils/client-health.d.ts +7 -0
- package/dist/utils/client-health.js +22 -1
- package/dist/utils/command-usage.d.ts +40 -0
- package/dist/utils/command-usage.js +61 -0
- package/dist/utils/duplicate-command-usage.d.ts +72 -0
- package/dist/utils/duplicate-command-usage.js +125 -0
- package/dist/utils/host-registration.d.ts +1 -1
- package/dist/utils/host-registration.js +6 -1
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/sentry-fingerprint.js +9 -0
- package/dist/utils/windows-bash.d.ts +2 -0
- package/dist/utils/windows-bash.js +2 -1
- package/package.json +15 -10
- package/scripts/bench-core-compare.mjs +313 -0
- package/scripts/bench-core.mjs +399 -12
- package/scripts/check-function-manifest.mjs +121 -7
- package/dist/commands/__fixtures__/access-vault.d.ts +0 -95
- package/dist/commands/__fixtures__/access-vault.js +0 -166
- package/dist/commands/__fixtures__/make-tar.d.ts +0 -38
- package/dist/commands/__fixtures__/make-tar.js +0 -102
- package/dist/commands/secrets-public-types.test-d.d.ts +0 -2
- package/dist/commands/secrets-public-types.test-d.js +0 -18
- package/dist/lib/decisions/fixtures/us001.d.ts +0 -137
- package/dist/lib/decisions/fixtures/us001.js +0 -21
- package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +0 -226
- package/dist/lib/doctor/__testing__/fake-hq-tree.js +0 -408
- package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
- package/dist/lib/doctor/__testing__/run-doctor.js +0 -69
- package/dist/lib/fingerprint/fixtures.d.ts +0 -19
- package/dist/lib/fingerprint/fixtures.js +0 -61
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.d.ts +0 -33
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.js +0 -53
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.d.ts +0 -38
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.js +0 -64
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
- package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
- package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
- package/scripts/hook-engine-manifest.mjs +0 -22
- package/scripts/mesh-daemon-if-stale.mjs +0 -20
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* and a property name is printed only when it looks like a plain field name.
|
|
15
15
|
*/
|
|
16
16
|
import type { Availability } from "../capacity/available.js";
|
|
17
|
+
import { isRfc3339DateTime } from "./rfc3339.js";
|
|
17
18
|
export declare const ENVIRONMENT_PROFILE_SCHEMA_VERSION = "hq-environment-profile.v1";
|
|
18
19
|
export declare const ENVIRONMENT_PROFILE_SCHEMA_ID = "urn:hq:schema:hq-environment-profile:v1";
|
|
19
20
|
export declare const ENVIRONMENT_PROFILE_SCHEMA_PATH: string;
|
|
@@ -219,10 +220,22 @@ export interface EnvironmentProfileFailure {
|
|
|
219
220
|
issues_omitted: number;
|
|
220
221
|
}
|
|
221
222
|
export type EnvironmentProfileResult = EnvironmentProfileSuccess | EnvironmentProfileFailure;
|
|
222
|
-
|
|
223
|
-
export declare function isRfc3339DateTime(value: string): boolean;
|
|
223
|
+
export { isRfc3339DateTime };
|
|
224
224
|
/** At most this many issues are listed; the rest are counted. */
|
|
225
225
|
export declare const ENVIRONMENT_PROFILE_MAX_ISSUES = 100;
|
|
226
|
+
/**
|
|
227
|
+
* Validate one compute block against `$defs/compute` alone, for producers of
|
|
228
|
+
* that block outside a full profile (the host capacity snapshot, PS-004).
|
|
229
|
+
* Returns the failing paths and rules; an empty list means valid.
|
|
230
|
+
*/
|
|
231
|
+
export declare function validateEnvironmentComputeReading(value: unknown): EnvironmentProfileIssue[];
|
|
232
|
+
/**
|
|
233
|
+
* Validate one access probe against `$defs/probe` alone, for producers of
|
|
234
|
+
* `readings.access` entries outside a full profile (`hq env probe`, PS-009).
|
|
235
|
+
* A string shaped like a credential is an issue here too, as it is in a full
|
|
236
|
+
* profile. Returns the failing paths and rules; an empty list means valid.
|
|
237
|
+
*/
|
|
238
|
+
export declare function validateEnvironmentAccessProbe(value: unknown): EnvironmentProfileIssue[];
|
|
226
239
|
/**
|
|
227
240
|
* Validate a parsed document. The schema_version is checked first, so a
|
|
228
241
|
* document from a later major version is refused by name and is not reported
|
|
@@ -18,30 +18,13 @@ import { dirname, join } from "node:path";
|
|
|
18
18
|
import { fileURLToPath } from "node:url";
|
|
19
19
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
20
20
|
import { credentialShapesIn } from "./credential-shapes.js";
|
|
21
|
+
import { isRfc3339DateTime } from "./rfc3339.js";
|
|
21
22
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
22
23
|
export const ENVIRONMENT_PROFILE_SCHEMA_VERSION = "hq-environment-profile.v1";
|
|
23
24
|
export const ENVIRONMENT_PROFILE_SCHEMA_ID = "urn:hq:schema:hq-environment-profile:v1";
|
|
24
25
|
export const ENVIRONMENT_PROFILE_SCHEMA_PATH = join(HERE, "..", "..", "schemas", "hq-environment-profile.v1.schema.json");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export function isRfc3339DateTime(value) {
|
|
28
|
-
const match = TIMESTAMP.exec(value);
|
|
29
|
-
if (!match)
|
|
30
|
-
return false;
|
|
31
|
-
const [year, month, day, hour, minute, second] = match.slice(1, 7).map(Number);
|
|
32
|
-
if (month < 1 || month > 12 || day < 1)
|
|
33
|
-
return false;
|
|
34
|
-
// Day 0 of the next month is the last day of this one.
|
|
35
|
-
const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
36
|
-
if (day > daysInMonth)
|
|
37
|
-
return false;
|
|
38
|
-
// 60 is allowed for a leap second.
|
|
39
|
-
if (hour > 23 || minute > 59 || second > 60)
|
|
40
|
-
return false;
|
|
41
|
-
if (match[9] !== undefined && (Number(match[9]) > 23 || Number(match[10]) > 59))
|
|
42
|
-
return false;
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
26
|
+
// Kept in ./rfc3339.ts so the lanes compute parser uses the same rule without Ajv.
|
|
27
|
+
export { isRfc3339DateTime };
|
|
45
28
|
/** At most this many issues are listed; the rest are counted. */
|
|
46
29
|
export const ENVIRONMENT_PROFILE_MAX_ISSUES = 100;
|
|
47
30
|
/**
|
|
@@ -94,6 +77,58 @@ function validator() {
|
|
|
94
77
|
cachedValidate = ajv.compile(inlineLocalRefs(schema, defs));
|
|
95
78
|
return cachedValidate;
|
|
96
79
|
}
|
|
80
|
+
let cachedComputeValidate;
|
|
81
|
+
/**
|
|
82
|
+
* Validate one compute block against `$defs/compute` alone, for producers of
|
|
83
|
+
* that block outside a full profile (the host capacity snapshot, PS-004).
|
|
84
|
+
* Returns the failing paths and rules; an empty list means valid.
|
|
85
|
+
*/
|
|
86
|
+
export function validateEnvironmentComputeReading(value) {
|
|
87
|
+
if (!cachedComputeValidate) {
|
|
88
|
+
const schema = JSON.parse(readFileSync(ENVIRONMENT_PROFILE_SCHEMA_PATH, "utf8"));
|
|
89
|
+
const defs = (schema.$defs ?? {});
|
|
90
|
+
const ajv = new Ajv2020({
|
|
91
|
+
allErrors: true,
|
|
92
|
+
strict: false,
|
|
93
|
+
formats: { "date-time": isRfc3339DateTime },
|
|
94
|
+
});
|
|
95
|
+
cachedComputeValidate = ajv.compile(inlineLocalRefs({ $ref: "#/$defs/compute" }, defs));
|
|
96
|
+
}
|
|
97
|
+
if (cachedComputeValidate(value))
|
|
98
|
+
return [];
|
|
99
|
+
return (cachedComputeValidate.errors ?? [])
|
|
100
|
+
.map(issueFrom)
|
|
101
|
+
.filter((issue) => issue !== null);
|
|
102
|
+
}
|
|
103
|
+
let cachedProbeValidate;
|
|
104
|
+
/**
|
|
105
|
+
* Validate one access probe against `$defs/probe` alone, for producers of
|
|
106
|
+
* `readings.access` entries outside a full profile (`hq env probe`, PS-009).
|
|
107
|
+
* A string shaped like a credential is an issue here too, as it is in a full
|
|
108
|
+
* profile. Returns the failing paths and rules; an empty list means valid.
|
|
109
|
+
*/
|
|
110
|
+
export function validateEnvironmentAccessProbe(value) {
|
|
111
|
+
if (!cachedProbeValidate) {
|
|
112
|
+
const schema = JSON.parse(readFileSync(ENVIRONMENT_PROFILE_SCHEMA_PATH, "utf8"));
|
|
113
|
+
const defs = (schema.$defs ?? {});
|
|
114
|
+
const ajv = new Ajv2020({
|
|
115
|
+
allErrors: true,
|
|
116
|
+
strict: false,
|
|
117
|
+
formats: { "date-time": isRfc3339DateTime },
|
|
118
|
+
});
|
|
119
|
+
cachedProbeValidate = ajv.compile(inlineLocalRefs({ $ref: "#/$defs/probe" }, defs));
|
|
120
|
+
}
|
|
121
|
+
const issues = [];
|
|
122
|
+
credentialIssues(value, "", issues);
|
|
123
|
+
if (!cachedProbeValidate(value)) {
|
|
124
|
+
for (const error of cachedProbeValidate.errors ?? []) {
|
|
125
|
+
const issue = issueFrom(error);
|
|
126
|
+
if (issue)
|
|
127
|
+
issues.push(issue);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return issues;
|
|
131
|
+
}
|
|
97
132
|
/** A short printable form of a string from the document. */
|
|
98
133
|
function printable(value, limit) {
|
|
99
134
|
const short = value.length > limit ? `${value.slice(0, limit)}...` : value;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hq-environment-profile.v1 date-time rule, in a module with no schema
|
|
3
|
+
* validator behind it, so the lanes placement path can check a timestamp the
|
|
4
|
+
* same way without loading Ajv.
|
|
5
|
+
*/
|
|
6
|
+
/** RFC 3339 date-time with a real calendar date and in-range clock fields. */
|
|
7
|
+
export declare function isRfc3339DateTime(value: string): boolean;
|
|
8
|
+
//# sourceMappingURL=rfc3339.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The hq-environment-profile.v1 date-time rule, in a module with no schema
|
|
3
|
+
* validator behind it, so the lanes placement path can check a timestamp the
|
|
4
|
+
* same way without loading Ajv.
|
|
5
|
+
*/
|
|
6
|
+
const TIMESTAMP = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|[+-](\d{2}):(\d{2}))$/;
|
|
7
|
+
/** RFC 3339 date-time with a real calendar date and in-range clock fields. */
|
|
8
|
+
export function isRfc3339DateTime(value) {
|
|
9
|
+
const match = TIMESTAMP.exec(value);
|
|
10
|
+
if (!match)
|
|
11
|
+
return false;
|
|
12
|
+
const [year, month, day, hour, minute, second] = match.slice(1, 7).map(Number);
|
|
13
|
+
if (month < 1 || month > 12 || day < 1)
|
|
14
|
+
return false;
|
|
15
|
+
// Day 0 of the next month is the last day of this one.
|
|
16
|
+
const daysInMonth = new Date(Date.UTC(year, month, 0)).getUTCDate();
|
|
17
|
+
if (day > daysInMonth)
|
|
18
|
+
return false;
|
|
19
|
+
// 60 is allowed for a leap second.
|
|
20
|
+
if (hour > 23 || minute > 59 || second > 60)
|
|
21
|
+
return false;
|
|
22
|
+
if (match[9] !== undefined && (Number(match[9]) > 23 || Number(match[10]) > 59))
|
|
23
|
+
return false;
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=rfc3339.js.map
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* hq-work-requirements.v1: what one piece of work (a lane, a story, a
|
|
3
|
+
* scheduled job, a message to a bot) needs from an environment.
|
|
4
|
+
*
|
|
5
|
+
* This module holds the TypeScript shape, a validator for
|
|
6
|
+
* src/schemas/hq-work-requirements.v1.schema.json that refuses any other
|
|
7
|
+
* schema_version, and deriveWorkRequirements(), which builds the document for
|
|
8
|
+
* work that declares nothing:
|
|
9
|
+
*
|
|
10
|
+
* - company: the lane's own company when it has one, otherwise the primary
|
|
11
|
+
* company of the session lock (workspace/sessions/<id>/meta.yaml), and
|
|
12
|
+
* "personal" when neither exists;
|
|
13
|
+
* - engines: any (every engine the schema knows);
|
|
14
|
+
* - needs.repos: the repo under repos/public or repos/private that the work
|
|
15
|
+
* was created in, including from a git worktree of that repo;
|
|
16
|
+
* - on_no_fit: conductor-harness, the conductor's own harness (owner
|
|
17
|
+
* decision 3, 2026-11-13).
|
|
18
|
+
*
|
|
19
|
+
* The derivation reads only paths and the session lock's company line. It
|
|
20
|
+
* never reads environment values other than the session id, and secret needs
|
|
21
|
+
* are names only, so a derived document cannot carry a secret value.
|
|
22
|
+
*
|
|
23
|
+
* Failure text never contains a value taken from the document, apart from a
|
|
24
|
+
* shortened schema_version, for the same reason as the environment profile
|
|
25
|
+
* loader: a rejected field may be holding a credential.
|
|
26
|
+
*/
|
|
27
|
+
export declare const WORK_REQUIREMENTS_SCHEMA_VERSION = "hq-work-requirements.v1";
|
|
28
|
+
export declare const WORK_REQUIREMENTS_SCHEMA_ID = "urn:hq:schema:hq-work-requirements:v1";
|
|
29
|
+
export declare const WORK_REQUIREMENTS_SCHEMA_PATH: string;
|
|
30
|
+
export type WorkEngine = "claude" | "codex" | "grok";
|
|
31
|
+
/** Every engine the schema knows. A derived document lists all of them, which means any. */
|
|
32
|
+
export declare const WORK_ENGINES_ANY: readonly WorkEngine[];
|
|
33
|
+
export type WorkOriginKind = "lane" | "story" | "job" | "message" | "session-move";
|
|
34
|
+
/**
|
|
35
|
+
* conductor-harness: run on the harness the conductor itself runs on. The
|
|
36
|
+
* default for work that declares nothing (owner decision 3).
|
|
37
|
+
*/
|
|
38
|
+
export type WorkOnNoFit = "ask" | "queue" | "start" | "conductor-harness";
|
|
39
|
+
export declare const WORK_ON_NO_FIT_CONDUCTOR_HARNESS = "conductor-harness";
|
|
40
|
+
export interface WorkRequirements {
|
|
41
|
+
schema_version: typeof WORK_REQUIREMENTS_SCHEMA_VERSION;
|
|
42
|
+
id: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
origin: {
|
|
45
|
+
kind: WorkOriginKind;
|
|
46
|
+
ref: string;
|
|
47
|
+
/** Real records the values were taken from. */
|
|
48
|
+
derived_from?: string[];
|
|
49
|
+
};
|
|
50
|
+
company: string;
|
|
51
|
+
engines: {
|
|
52
|
+
/** Acceptable engines in order of preference. */
|
|
53
|
+
any_of: WorkEngine[];
|
|
54
|
+
account_pin?: string | null;
|
|
55
|
+
};
|
|
56
|
+
needs: {
|
|
57
|
+
labels: string[];
|
|
58
|
+
repos: string[];
|
|
59
|
+
/** Vault secret names only, never values. */
|
|
60
|
+
secrets: string[];
|
|
61
|
+
integrations: string[];
|
|
62
|
+
data?: string[];
|
|
63
|
+
};
|
|
64
|
+
prefers?: {
|
|
65
|
+
labels?: string[];
|
|
66
|
+
};
|
|
67
|
+
size: {
|
|
68
|
+
vcpu: number;
|
|
69
|
+
memory_mb: number;
|
|
70
|
+
disk_gb: number;
|
|
71
|
+
expected_run_seconds: number;
|
|
72
|
+
provenance?: {
|
|
73
|
+
source: string;
|
|
74
|
+
verified: boolean;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
continuity: {
|
|
78
|
+
mode: "none" | "workspace-must-survive" | "session-move";
|
|
79
|
+
checkpoint_ref?: string | null;
|
|
80
|
+
};
|
|
81
|
+
tolerates: string[];
|
|
82
|
+
on_no_fit: WorkOnNoFit;
|
|
83
|
+
max_cost_usd?: number | null;
|
|
84
|
+
priority?: number;
|
|
85
|
+
/** Values in this declaration that were not taken from a record. */
|
|
86
|
+
assumptions?: string[];
|
|
87
|
+
}
|
|
88
|
+
export interface WorkRequirementsIssue {
|
|
89
|
+
/** JSON pointer into the document; "" is the document itself. */
|
|
90
|
+
path: string;
|
|
91
|
+
message: string;
|
|
92
|
+
}
|
|
93
|
+
export type WorkRequirementsFailureCode = "invalid_json" | "not_an_object" | "missing_schema_version" | "unsupported_schema_version" | "invalid";
|
|
94
|
+
export type WorkRequirementsResult = {
|
|
95
|
+
ok: true;
|
|
96
|
+
requirements: WorkRequirements;
|
|
97
|
+
} | {
|
|
98
|
+
ok: false;
|
|
99
|
+
code: WorkRequirementsFailureCode;
|
|
100
|
+
message: string;
|
|
101
|
+
/** At most WORK_REQUIREMENTS_MAX_ISSUES entries. */
|
|
102
|
+
issues: WorkRequirementsIssue[];
|
|
103
|
+
issues_omitted: number;
|
|
104
|
+
};
|
|
105
|
+
export type WorkRequirementsFailure = Extract<WorkRequirementsResult, {
|
|
106
|
+
ok: false;
|
|
107
|
+
}>;
|
|
108
|
+
export declare const WORK_REQUIREMENTS_MAX_ISSUES = 100;
|
|
109
|
+
/** Same pattern as needs.secrets in the schema. */
|
|
110
|
+
export declare const WORK_SECRET_NAME: RegExp;
|
|
111
|
+
/**
|
|
112
|
+
* Validate a parsed document against hq-work-requirements.v1. A document of
|
|
113
|
+
* another schema_version is refused by name. Strings shaped like a credential
|
|
114
|
+
* are rejected anywhere in the document, identifiers included.
|
|
115
|
+
*/
|
|
116
|
+
export declare function validateWorkRequirements(value: unknown): WorkRequirementsResult;
|
|
117
|
+
/** Parse JSON text and validate it. The text is never echoed in a failure. */
|
|
118
|
+
export declare function parseWorkRequirements(text: string): WorkRequirementsResult;
|
|
119
|
+
export interface WorkRepoResolution {
|
|
120
|
+
/** Directory name under repos/public or repos/private. */
|
|
121
|
+
name: string;
|
|
122
|
+
/** HQ-root-relative path of the repo, for derived_from. */
|
|
123
|
+
repo_path: string;
|
|
124
|
+
via: "repo-directory" | "git-worktree";
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The HQ repo that `cwd` is in: a directory under repos/public or
|
|
128
|
+
* repos/private, or a linked git worktree whose main checkout is one.
|
|
129
|
+
*/
|
|
130
|
+
export declare function workRepoFromCwd(hqRoot: string, cwd: string): WorkRepoResolution | null;
|
|
131
|
+
export interface DeriveWorkRequirementsInput {
|
|
132
|
+
hqRoot: string;
|
|
133
|
+
/** Directory the work was created from. */
|
|
134
|
+
cwd: string;
|
|
135
|
+
/**
|
|
136
|
+
* Used only to find the caller's session id, from the environment. The
|
|
137
|
+
* global workspace/sessions/.current file is never read: it names whichever
|
|
138
|
+
* session wrote it last, not the caller.
|
|
139
|
+
*/
|
|
140
|
+
env?: NodeJS.ProcessEnv;
|
|
141
|
+
origin: {
|
|
142
|
+
kind: WorkOriginKind;
|
|
143
|
+
ref: string;
|
|
144
|
+
};
|
|
145
|
+
/** The work's own company, when it has one (a lane's company as resolveLaneCompany resolves it). */
|
|
146
|
+
company?: string | null;
|
|
147
|
+
title?: string;
|
|
148
|
+
}
|
|
149
|
+
/** Defaults for the size block; nothing about undeclared work is measured. */
|
|
150
|
+
export declare const DERIVED_WORK_SIZE: {
|
|
151
|
+
readonly vcpu: 1;
|
|
152
|
+
readonly memory_mb: 1024;
|
|
153
|
+
readonly disk_gb: 1;
|
|
154
|
+
readonly expected_run_seconds: 3600;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Requirements for work that declares nothing. The result always validates
|
|
158
|
+
* against hq-work-requirements.v1; an input that cannot be used (a company
|
|
159
|
+
* slug or repo name outside the schema's patterns) is left out and named in
|
|
160
|
+
* assumptions.
|
|
161
|
+
*/
|
|
162
|
+
export declare function deriveWorkRequirements(input: DeriveWorkRequirementsInput): WorkRequirements;
|
|
163
|
+
/**
|
|
164
|
+
* A derived document after the work's company was repaired (hq lanes
|
|
165
|
+
* repair-company). The company and the company line of derived_from are
|
|
166
|
+
* replaced; a slug outside the schema pattern leaves the document as it is.
|
|
167
|
+
*/
|
|
168
|
+
export declare function withRepairedCompany(document: WorkRequirements, company: string): WorkRequirements;
|
|
169
|
+
//# sourceMappingURL=work-requirements.d.ts.map
|