@indigoai-us/hq-cli 5.345.214 → 5.345.215-beta.0
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 +29 -0
- package/dist/command-catalog.generated.d.ts +134 -7
- package/dist/command-catalog.generated.js +168 -7
- package/dist/commands/agents.d.ts +51 -1
- package/dist/commands/agents.js +154 -2
- package/dist/commands/bot-jobs.d.ts +2 -15
- package/dist/commands/bot-jobs.js +2 -94
- package/dist/commands/bot-runtime.d.ts +46 -5
- package/dist/commands/bot-runtime.js +228 -18
- package/dist/commands/bot.d.ts +16 -9
- package/dist/commands/bot.js +169 -51
- package/dist/commands/cloud.d.ts +66 -13
- package/dist/commands/cloud.js +120 -39
- package/dist/commands/company-restore.d.ts +23 -0
- package/dist/commands/company-restore.js +128 -0
- package/dist/commands/company.js +2 -0
- package/dist/commands/integrations-connect.d.ts +10 -3
- package/dist/commands/integrations-connect.js +87 -13
- package/dist/commands/lanes.js +26 -9
- package/dist/commands/sources.js +6 -0
- package/dist/commands/storage-offload.d.ts +12 -0
- package/dist/commands/storage-offload.js +41 -3
- package/dist/commands/sync-mode.js +5 -0
- package/dist/commands/whoami.js +4 -0
- package/dist/lib/bot/config.d.ts +1 -0
- package/dist/lib/bot/config.js +10 -0
- package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
- package/dist/lib/bot/eventbridge-cron.js +104 -0
- package/dist/lib/bot/fleet-local.d.ts +33 -1
- package/dist/lib/bot/fleet-local.js +215 -31
- package/dist/lib/bot/fleet-python.d.ts +3 -0
- package/dist/lib/bot/fleet-python.js +34 -4
- package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
- package/dist/lib/bot/fleet-runtime-sources.js +30 -0
- package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
- package/dist/lib/bot/legacy-provider-login.js +19 -2
- package/dist/lib/bot/prompt.js +1 -1
- package/dist/lib/bot/readiness.d.ts +8 -0
- package/dist/lib/bot/readiness.js +17 -3
- package/dist/lib/bot/runtime-auth.d.ts +30 -0
- package/dist/lib/bot/runtime-auth.js +94 -3
- package/dist/lib/bot/status.d.ts +2 -0
- package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
- package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
- package/dist/lib/capacity/collectors/grok.d.ts +5 -0
- package/dist/lib/capacity/collectors/grok.js +56 -5
- package/dist/lib/daemon/catalog.js +11 -1
- package/dist/lib/db/sqlite-binding.d.ts +1 -0
- package/dist/lib/db/sqlite-binding.js +1 -1
- package/dist/lib/delivery/artifacts.d.ts +99 -0
- package/dist/lib/delivery/artifacts.js +548 -0
- package/dist/lib/delivery/backup.d.ts +78 -0
- package/dist/lib/delivery/backup.js +343 -0
- package/dist/lib/delivery/cache.d.ts +29 -0
- package/dist/lib/delivery/cache.js +33 -0
- package/dist/lib/delivery/contracts.d.ts +142 -0
- package/dist/lib/delivery/contracts.js +289 -0
- package/dist/lib/delivery/credentials.d.ts +54 -0
- package/dist/lib/delivery/credentials.js +119 -0
- package/dist/lib/delivery/enrollment.d.ts +142 -0
- package/dist/lib/delivery/enrollment.js +382 -0
- package/dist/lib/delivery/identity.d.ts +25 -0
- package/dist/lib/delivery/identity.js +82 -0
- package/dist/lib/delivery/inbox.d.ts +116 -0
- package/dist/lib/delivery/inbox.js +260 -0
- package/dist/lib/delivery/migrations.d.ts +139 -0
- package/dist/lib/delivery/migrations.js +623 -0
- package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
- package/dist/lib/delivery/mqtt-adapter.js +242 -0
- package/dist/lib/delivery/mqtt.d.ts +61 -0
- package/dist/lib/delivery/mqtt.js +112 -0
- package/dist/lib/delivery/outbox.d.ts +95 -0
- package/dist/lib/delivery/outbox.js +187 -0
- package/dist/lib/delivery/provenance.d.ts +129 -0
- package/dist/lib/delivery/provenance.js +93 -0
- package/dist/lib/delivery/reconciler.d.ts +151 -0
- package/dist/lib/delivery/reconciler.js +492 -0
- package/dist/lib/delivery/restore.d.ts +35 -0
- package/dist/lib/delivery/restore.js +134 -0
- package/dist/lib/delivery/store.d.ts +161 -0
- package/dist/lib/delivery/store.js +940 -0
- package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
- package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
- package/dist/lib/delivery/workers/macos.d.ts +176 -0
- package/dist/lib/delivery/workers/macos.js +901 -0
- package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
- package/dist/lib/delivery/workers/windows-boundary.js +693 -0
- package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
- package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
- package/dist/lib/delivery/workers/windows.d.ts +241 -0
- package/dist/lib/delivery/workers/windows.js +608 -0
- package/dist/lib/install/provider-wrappers.d.ts +2 -0
- package/dist/lib/install/provider-wrappers.js +68 -3
- package/dist/utils/cognito-callback-port.d.ts +14 -0
- package/dist/utils/cognito-callback-port.js +24 -0
- package/dist/utils/cognito-session.js +3 -3
- package/dist/utils/deleted-company-notice.d.ts +59 -0
- package/dist/utils/deleted-company-notice.js +156 -0
- package/dist/utils/login-browser.d.ts +1 -1
- package/dist/utils/login-browser.js +7 -5
- package/dist/utils/resident-package-preload.js +30 -15
- package/dist/utils/vault-api.js +7 -0
- package/package.json +7 -7
|
@@ -335,8 +335,20 @@ export interface SyncRecord {
|
|
|
335
335
|
/**
|
|
336
336
|
* `companies/<slug>/<rest>` belongs to that company's vault at key `<rest>`.
|
|
337
337
|
* Every other path belongs to the personal vault at its HQ-root-relative path.
|
|
338
|
+
* The match is exact-case, the same as companyForPointer. Callers pass a path
|
|
339
|
+
* from hqRelative (below), which spells the HQ companies folder as `companies`.
|
|
338
340
|
*/
|
|
339
341
|
export declare function resolveOffloadTarget(rel: string): OffloadTarget;
|
|
342
|
+
/**
|
|
343
|
+
* companiesOnDisk is the on-disk name of `<HQ root>/companies` (from native
|
|
344
|
+
* realpath). On a case-insensitive volume whose folder is spelled, say,
|
|
345
|
+
* `Companies`, native realpath returns that spelling, and this maps it back
|
|
346
|
+
* to `companies` so it stays a company path (this is the macOS intent of
|
|
347
|
+
* #2475). On a case-sensitive volume a `COMPANIES/` folder is a different
|
|
348
|
+
* folder, its first segment never equals the on-disk name `companies`, so it
|
|
349
|
+
* stays personal.
|
|
350
|
+
*/
|
|
351
|
+
export declare function canonicalCompaniesRel(rel: string, companiesOnDisk: string | null): string;
|
|
340
352
|
/** Whether current-file offload can run with the installed HQ sync. */
|
|
341
353
|
export declare function currentSyncReady(deps: Pick<OffloadDeps, "syncExcludesOffload" | "syncHoldsPlaceholders">): boolean;
|
|
342
354
|
export declare function storageScriptPath(hqRoot: string): string;
|
|
@@ -518,14 +518,49 @@ export function s3VaultObjectStore(bucket, s3, opts = {}) {
|
|
|
518
518
|
/**
|
|
519
519
|
* `companies/<slug>/<rest>` belongs to that company's vault at key `<rest>`.
|
|
520
520
|
* Every other path belongs to the personal vault at its HQ-root-relative path.
|
|
521
|
+
* The match is exact-case, the same as companyForPointer. Callers pass a path
|
|
522
|
+
* from hqRelative (below), which spells the HQ companies folder as `companies`.
|
|
521
523
|
*/
|
|
522
524
|
export function resolveOffloadTarget(rel) {
|
|
523
525
|
const posix = toPosix(rel);
|
|
524
|
-
const m = /^companies\/([^/]+)\/(.+)
|
|
526
|
+
const m = /^companies\/([^/]+)\/(.+)$/.exec(posix);
|
|
525
527
|
if (m)
|
|
526
528
|
return { vault: "company", slug: m[1], key: m[2] };
|
|
527
529
|
return { vault: "personal", key: posix };
|
|
528
530
|
}
|
|
531
|
+
/**
|
|
532
|
+
* companiesOnDisk is the on-disk name of `<HQ root>/companies` (from native
|
|
533
|
+
* realpath). On a case-insensitive volume whose folder is spelled, say,
|
|
534
|
+
* `Companies`, native realpath returns that spelling, and this maps it back
|
|
535
|
+
* to `companies` so it stays a company path (this is the macOS intent of
|
|
536
|
+
* #2475). On a case-sensitive volume a `COMPANIES/` folder is a different
|
|
537
|
+
* folder, its first segment never equals the on-disk name `companies`, so it
|
|
538
|
+
* stays personal.
|
|
539
|
+
*/
|
|
540
|
+
export function canonicalCompaniesRel(rel, companiesOnDisk) {
|
|
541
|
+
const slash = rel.indexOf("/");
|
|
542
|
+
const first = slash === -1 ? rel : rel.slice(0, slash);
|
|
543
|
+
if (first !== "companies" && companiesOnDisk !== null && first === companiesOnDisk) {
|
|
544
|
+
const rest = slash === -1 ? "" : rel.slice(slash);
|
|
545
|
+
return `companies${rest}`;
|
|
546
|
+
}
|
|
547
|
+
return rel;
|
|
548
|
+
}
|
|
549
|
+
/** HQ-root-relative path of `abs`, with the companies folder spelled `companies`. */
|
|
550
|
+
function hqRelative(realRoot, abs) {
|
|
551
|
+
const rel = toPosix(path.relative(realRoot, abs));
|
|
552
|
+
let companiesOnDisk = null;
|
|
553
|
+
try {
|
|
554
|
+
const companiesReal = fs.realpathSync.native(path.join(realRoot, "companies"));
|
|
555
|
+
// A symlinked companies folder pointing elsewhere is not renamed.
|
|
556
|
+
if (path.dirname(companiesReal) === realRoot)
|
|
557
|
+
companiesOnDisk = path.basename(companiesReal);
|
|
558
|
+
}
|
|
559
|
+
catch {
|
|
560
|
+
// Missing or unreadable: leave the relative path unchanged.
|
|
561
|
+
}
|
|
562
|
+
return canonicalCompaniesRel(rel, companiesOnDisk);
|
|
563
|
+
}
|
|
529
564
|
/** Whether current-file offload can run with the installed HQ sync. */
|
|
530
565
|
export function currentSyncReady(deps) {
|
|
531
566
|
return deps.syncExcludesOffload() && deps.syncHoldsPlaceholders?.() === true;
|
|
@@ -599,6 +634,8 @@ export function worktreeHoldsAllCopy(held) {
|
|
|
599
634
|
export function selectHistoryBlobs(blobs, minBytes) {
|
|
600
635
|
// A blob may have both personal and company names. Never send any such
|
|
601
636
|
// content to the personal store; historical paths need no longer exist.
|
|
637
|
+
// History paths are git tree names, not on-disk spellings, and excluding a
|
|
638
|
+
// blob keeps it in local history, so a case-insensitive exclusion is the safe direction.
|
|
602
639
|
return blobs.filter((b) => !b.in_head && b.bytes >= minBytes && b.paths.length > 0 &&
|
|
603
640
|
b.paths.every((p) => !/^companies(?:\/|$)/i.test(toPosix(path.posix.normalize(toPosix(p))))));
|
|
604
641
|
}
|
|
@@ -677,7 +714,7 @@ export async function offloadCurrentFile(rel, store, deps, fsOps = durablePlaceh
|
|
|
677
714
|
if (store.vault !== "personal")
|
|
678
715
|
throw new Error("Offload only writes to your personal vault.");
|
|
679
716
|
const abs = containedPath(deps.hqRoot, rel);
|
|
680
|
-
rel =
|
|
717
|
+
rel = hqRelative(fs.realpathSync.native(deps.hqRoot), abs);
|
|
681
718
|
if (resolveOffloadTarget(rel).vault === "company") {
|
|
682
719
|
throw new Error(`'${rel}' is a company file. Company files are never uploaded to your personal vault.`);
|
|
683
720
|
}
|
|
@@ -1063,7 +1100,7 @@ async function planCurrentFiles(rels, opts, deps, openVault) {
|
|
|
1063
1100
|
for (const candidate of rels) {
|
|
1064
1101
|
const abs = containedPath(deps.hqRoot, candidate);
|
|
1065
1102
|
// Canonicalise discovery output too, not just explicit path arguments.
|
|
1066
|
-
const rel =
|
|
1103
|
+
const rel = hqRelative(fs.realpathSync.native(deps.hqRoot), abs);
|
|
1067
1104
|
if (skippedByName(rel))
|
|
1068
1105
|
continue;
|
|
1069
1106
|
let st;
|
|
@@ -1557,6 +1594,7 @@ async function downloadVerified(download, key, dest, expect) {
|
|
|
1557
1594
|
}
|
|
1558
1595
|
/** Company slug for a company-vault placeholder, checked against its key. */
|
|
1559
1596
|
export function companyForPointer(pointer) {
|
|
1597
|
+
// Must stay exact-case, matching resolveOffloadTarget.
|
|
1560
1598
|
const m = /^companies\/([^/]+)\/(.+)$/.exec(pointer.path);
|
|
1561
1599
|
if (!m || (!isCompanyOffloadCopy(pointer) && m[2] !== pointer.key)) {
|
|
1562
1600
|
throw new Error(`Placeholder for '${pointer.path}' names company vault key '${pointer.key}', which does not match its location. Nothing was changed.`);
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
* in package.json — revert that line to `^5.20.0` (or whatever the
|
|
31
31
|
* published cut is) once US-004 ships to npm.
|
|
32
32
|
*/
|
|
33
|
+
import { printDeletedCompanyNotices } from "../utils/deleted-company-notice.js";
|
|
33
34
|
import { isAccessDeniedError, accessDeniedKeyOf, reportAccessDenied, accessDeniedCompanyOf, } from "../utils/access-denied-hint.js";
|
|
34
35
|
import chalk from "chalk";
|
|
35
36
|
import * as fs from "node:fs";
|
|
@@ -243,6 +244,10 @@ export function registerSyncModeCommand(syncCmd) {
|
|
|
243
244
|
}
|
|
244
245
|
const rows = await showSyncModes({ vaultClient: client });
|
|
245
246
|
console.log(formatShowTable(rows));
|
|
247
|
+
// No memberships may mean the person's company was deleted.
|
|
248
|
+
if (rows.length === 0) {
|
|
249
|
+
await printDeletedCompanyNotices({ token: accessToken });
|
|
250
|
+
}
|
|
246
251
|
return;
|
|
247
252
|
}
|
|
248
253
|
if (!modeArg) {
|
package/dist/commands/whoami.js
CHANGED
|
@@ -9,6 +9,7 @@ import { colorizePlanLimitNotice, fetchPlanLimitStatus, renderPlanLine, renderPl
|
|
|
9
9
|
import { resolveCompanyFlagGate, } from "../lib/flag-registry.js";
|
|
10
10
|
import { queuePlanLimitInviteTeammateExposure } from "../utils/cli-telemetry.js";
|
|
11
11
|
import { resolveCallerPersonUid } from "../utils/vault-api.js";
|
|
12
|
+
import { printDeletedCompanyNotices } from "../utils/deleted-company-notice.js";
|
|
12
13
|
export const CLI_LIMIT_INVITE_TEAMMATE_FLAG = "cli.limit-invite-teammate-v1";
|
|
13
14
|
/**
|
|
14
15
|
* Resolves the person represented by an ID token without pairing a delegated
|
|
@@ -228,6 +229,9 @@ export function registerWhoamiCommand(program) {
|
|
|
228
229
|
const { email, sub } = resolveWhoamiIdentity(peekIdToken(cached.idToken));
|
|
229
230
|
console.log(`Logged in as ${email ?? 'unknown'}${sub ? ` (${sub})` : ''}`);
|
|
230
231
|
await printPlanBlock(opts.company);
|
|
232
|
+
// Person sessions only: a deleted company is otherwise invisible here.
|
|
233
|
+
// Bounded like the person-uid lookup, on stderr, and never a failure.
|
|
234
|
+
await printDeletedCompanyNotices({ timeoutMs: PERSON_UID_LOOKUP_TIMEOUT_MS });
|
|
231
235
|
}
|
|
232
236
|
catch (error) {
|
|
233
237
|
console.error(chalk.red('Error:'), error instanceof Error ? error.message : 'Unknown error');
|
package/dist/lib/bot/config.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export interface BotEngineMetadata {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function isBotEngineMetadata(value: unknown): value is BotEngineMetadata;
|
|
16
16
|
export declare function isBotRuntimeId(value: unknown): value is BotRuntimeId;
|
|
17
|
+
export declare function botRuntimeFromBrainName(value: string | undefined | null): BotRuntimeId | null;
|
|
17
18
|
/**
|
|
18
19
|
* What a bot is (owner decisions, 2026-09-15):
|
|
19
20
|
* - "personal": acts as its owner. Every turn (DMs, kickoff, rooms) runs with
|
package/dist/lib/bot/config.js
CHANGED
|
@@ -23,6 +23,16 @@ export function isBotEngineMetadata(value) {
|
|
|
23
23
|
export function isBotRuntimeId(value) {
|
|
24
24
|
return typeof value === "string" && BOT_RUNTIMES.includes(value);
|
|
25
25
|
}
|
|
26
|
+
export function botRuntimeFromBrainName(value) {
|
|
27
|
+
const name = (value ?? "").trim().toLowerCase();
|
|
28
|
+
if (name === "claude")
|
|
29
|
+
return "claude";
|
|
30
|
+
if (name === "codex" || name === "chatgpt")
|
|
31
|
+
return "codex";
|
|
32
|
+
if (name === "grok")
|
|
33
|
+
return "grok";
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
26
36
|
/**
|
|
27
37
|
* What a bot is (owner decisions, 2026-09-15):
|
|
28
38
|
* - "personal": acts as its owner. Every turn (DMs, kickoff, rooms) runs with
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard five-field cron to the stored six-field `cron(...)` form shared by
|
|
3
|
+
* local bot jobs and hosted agent jobs. Pure and dependency-free so commands on
|
|
4
|
+
* resident paths (`hq agents jobs update`) can use it without loading the bot
|
|
5
|
+
* jobs command graph.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BotJobsError extends Error {
|
|
8
|
+
readonly expected: true;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Standard 5-field cron → the six-field `cron(...)` string a job is stored as.
|
|
12
|
+
*
|
|
13
|
+
* The stored form (the six-field cron syntax hosted agent jobs also use, so
|
|
14
|
+
* local and hosted jobs share one format; the function keeps its historical
|
|
15
|
+
* name) has SIX fields (a trailing year), numbers its days of week
|
|
16
|
+
* 1–7 with SUNDAY = 1 (standard cron uses 0–6 with SUNDAY = 0), and refuses
|
|
17
|
+
* `*` in BOTH the day-of-month and day-of-week fields — exactly one must be
|
|
18
|
+
* `?`. An expression that is already `cron(...)` or `rate(...)` is passed
|
|
19
|
+
* through untouched.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toEventBridgeCron(expr: string): string;
|
|
22
|
+
//# sourceMappingURL=eventbridge-cron.d.ts.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard five-field cron to the stored six-field `cron(...)` form shared by
|
|
3
|
+
* local bot jobs and hosted agent jobs. Pure and dependency-free so commands on
|
|
4
|
+
* resident paths (`hq agents jobs update`) can use it without loading the bot
|
|
5
|
+
* jobs command graph.
|
|
6
|
+
*/
|
|
7
|
+
export class BotJobsError extends Error {
|
|
8
|
+
expected = true;
|
|
9
|
+
}
|
|
10
|
+
function refuse(message) {
|
|
11
|
+
throw new BotJobsError(message);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Standard 5-field cron → the six-field `cron(...)` string a job is stored as.
|
|
15
|
+
*
|
|
16
|
+
* The stored form (the six-field cron syntax hosted agent jobs also use, so
|
|
17
|
+
* local and hosted jobs share one format; the function keeps its historical
|
|
18
|
+
* name) has SIX fields (a trailing year), numbers its days of week
|
|
19
|
+
* 1–7 with SUNDAY = 1 (standard cron uses 0–6 with SUNDAY = 0), and refuses
|
|
20
|
+
* `*` in BOTH the day-of-month and day-of-week fields — exactly one must be
|
|
21
|
+
* `?`. An expression that is already `cron(...)` or `rate(...)` is passed
|
|
22
|
+
* through untouched.
|
|
23
|
+
*/
|
|
24
|
+
export function toEventBridgeCron(expr) {
|
|
25
|
+
const trimmed = expr.trim();
|
|
26
|
+
// An explicit cron(...) / rate(...) is the caller saying "this is already the
|
|
27
|
+
// stored syntax" — passed through untranslated, on purpose.
|
|
28
|
+
if (/^(cron|rate)\s*\(/i.test(trimmed))
|
|
29
|
+
return trimmed;
|
|
30
|
+
const fields = trimmed.split(/\s+/).filter(Boolean);
|
|
31
|
+
if (fields.length === 6) {
|
|
32
|
+
// Six BARE fields are ambiguous: the stored form's sixth field is a
|
|
33
|
+
// trailing year, Quartz's first is leading seconds. Guessing wrong
|
|
34
|
+
// silently moves every run. Make the caller say which they mean.
|
|
35
|
+
refuse(`"${trimmed}" has six fields, and I can't tell whether the last one is a year ` +
|
|
36
|
+
`(minute hour day-of-month month day-of-week year, the form bot jobs are stored in) or the ` +
|
|
37
|
+
`first one is seconds (a Quartz expression) — reading it the wrong way would schedule the job ` +
|
|
38
|
+
`at the wrong time. Pass five fields ("0 9 * * 1-5"), or wrap it yourself as cron(...) if it ` +
|
|
39
|
+
`already ends with a year field.`);
|
|
40
|
+
}
|
|
41
|
+
if (fields.length !== 5) {
|
|
42
|
+
refuse(`"${trimmed}" is not a cron expression. A cron expression has five fields: ` +
|
|
43
|
+
`minute hour day-of-month month day-of-week (for example "0 9 * * 1-5").`);
|
|
44
|
+
}
|
|
45
|
+
const [minute, hour, month] = [fields[0], fields[1], fields[3]];
|
|
46
|
+
let dayOfMonth = fields[2];
|
|
47
|
+
let dayOfWeek = fields[4];
|
|
48
|
+
if (dayOfWeek === "*" || dayOfWeek === "?") {
|
|
49
|
+
dayOfWeek = "?";
|
|
50
|
+
if (dayOfMonth === "?")
|
|
51
|
+
dayOfMonth = "*";
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
dayOfWeek = shiftDayOfWeek(dayOfWeek);
|
|
55
|
+
if (dayOfMonth === "*")
|
|
56
|
+
dayOfMonth = "?";
|
|
57
|
+
}
|
|
58
|
+
return `cron(${minute} ${hour} ${dayOfMonth} ${month} ${dayOfWeek} *)`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Standard 0–6 (SUN=0, and 7 also SUN) → the stored form's 1–7 (SUN=1).
|
|
62
|
+
*
|
|
63
|
+
* Mapped per TERM, not per digit. Shifting digits individually turned a range
|
|
64
|
+
* that wraps past Sunday — "6-0" (Sat–Sun), "5-1" (Fri–Mon) — into "7-1" /
|
|
65
|
+
* "6-2": reversed or plain wrong, and silently so. Such a range is refused with
|
|
66
|
+
* the list form that does work.
|
|
67
|
+
*/
|
|
68
|
+
function shiftDayOfWeek(field) {
|
|
69
|
+
return field
|
|
70
|
+
.split(",")
|
|
71
|
+
.map((term) => shiftDayOfWeekTerm(term.trim()))
|
|
72
|
+
.join(",");
|
|
73
|
+
}
|
|
74
|
+
function shiftDay(n) {
|
|
75
|
+
return (n % 7) + 1;
|
|
76
|
+
}
|
|
77
|
+
function shiftDayOfWeekTerm(term) {
|
|
78
|
+
const step = term.match(/^(.+)\/(\d+)$/);
|
|
79
|
+
if (step)
|
|
80
|
+
return `${shiftDayOfWeekTerm(step[1])}/${step[2]}`;
|
|
81
|
+
const range = term.match(/^(\d+)-(\d+)$/);
|
|
82
|
+
if (range) {
|
|
83
|
+
const from = shiftDay(Number(range[1]));
|
|
84
|
+
const to = shiftDay(Number(range[2]));
|
|
85
|
+
if (from > to) {
|
|
86
|
+
const days = [];
|
|
87
|
+
for (let d = Number(range[1]);; d = (d + 1) % 7) {
|
|
88
|
+
days.push(d);
|
|
89
|
+
if (d === Number(range[2]) % 7)
|
|
90
|
+
break;
|
|
91
|
+
if (days.length > 7)
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
refuse(`"${term}" is a day-of-week range that wraps past Sunday, which the schedule cannot express. ` +
|
|
95
|
+
`List the days instead, for example "${days.join(",")}".`);
|
|
96
|
+
}
|
|
97
|
+
return `${from}-${to}`;
|
|
98
|
+
}
|
|
99
|
+
if (/^\d+$/.test(term))
|
|
100
|
+
return String(shiftDay(Number(term)));
|
|
101
|
+
// Day NAMES (MON, MON-FRI) mean the same thing in both syntaxes.
|
|
102
|
+
return term;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=eventbridge-cron.js.map
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { type BotEngineMetadata } from "./config.js";
|
|
1
|
+
import { type BotEngineMetadata, type BotRuntimeId } from "./config.js";
|
|
2
2
|
import type { BotMachineCreds } from "./creds.js";
|
|
3
3
|
import { type FleetPython } from "./fleet-python.js";
|
|
4
4
|
import { vaultApiFetch } from "../../utils/vault-api.js";
|
|
5
5
|
import type { LocalBotPromotionRuntime } from "./promote.js";
|
|
6
|
+
export interface FleetLocalEnvironmentArtifact {
|
|
7
|
+
name: string;
|
|
8
|
+
sha256: string;
|
|
9
|
+
size: number;
|
|
10
|
+
}
|
|
6
11
|
export interface FleetLocalReleasePin {
|
|
7
12
|
repository: string;
|
|
8
13
|
tag: string;
|
|
@@ -14,12 +19,14 @@ export interface FleetLocalReleasePin {
|
|
|
14
19
|
manifestSha256: string;
|
|
15
20
|
signatureSha256: string;
|
|
16
21
|
runtimeCommit: string;
|
|
22
|
+
environmentArtifacts?: Record<string, FleetLocalEnvironmentArtifact>;
|
|
17
23
|
}
|
|
18
24
|
export interface FleetLocalReleaseFiles {
|
|
19
25
|
archive: Buffer;
|
|
20
26
|
runtimeArchive: Buffer;
|
|
21
27
|
manifest: Buffer;
|
|
22
28
|
signature: Buffer;
|
|
29
|
+
wheelhouse?: string;
|
|
23
30
|
}
|
|
24
31
|
export interface FleetLocalInstallation {
|
|
25
32
|
release: FleetLocalReleasePin;
|
|
@@ -29,6 +36,8 @@ export interface FleetLocalInstallation {
|
|
|
29
36
|
manifest: string;
|
|
30
37
|
signature: string;
|
|
31
38
|
engine: BotEngineMetadata;
|
|
39
|
+
wheelhouse?: string;
|
|
40
|
+
environmentPlatform?: string;
|
|
32
41
|
}
|
|
33
42
|
export interface FleetLocalProfile {
|
|
34
43
|
schemaVersion: 1;
|
|
@@ -69,6 +78,8 @@ export interface FleetLocalInstallDeps {
|
|
|
69
78
|
/** How long a download may go without bytes before it is resumed (tests). */
|
|
70
79
|
downloadStallMs?: number;
|
|
71
80
|
allowFileLinks?: boolean;
|
|
81
|
+
platform?: NodeJS.Platform;
|
|
82
|
+
arch?: string;
|
|
72
83
|
}
|
|
73
84
|
export interface FleetLocalProfileInput {
|
|
74
85
|
agentUid: string;
|
|
@@ -244,6 +255,9 @@ export declare const FLEET_RELEASE_POINTER_FILE_ENV = "HQ_FLEET_RELEASE_POINTER_
|
|
|
244
255
|
export declare function fleetReleasePointerFileOverride(env?: NodeJS.ProcessEnv): string | null;
|
|
245
256
|
export declare function readLocalFleetReleasePointer(file: string, now?: number): FleetLocalReleasePointer;
|
|
246
257
|
export declare function parseFleetLocalReleasePin(value: unknown): FleetLocalReleasePin | null;
|
|
258
|
+
export declare function fleetEnvironmentPlatform(platform?: NodeJS.Platform, arch?: string): string;
|
|
259
|
+
export declare function releaseWheelhouse(release: FleetLocalReleasePin, platform: string): FleetLocalEnvironmentArtifact | null;
|
|
260
|
+
export declare function verifyFleetLocalWheelhouse(file: string, artifact: FleetLocalEnvironmentArtifact, manifest: Buffer, platform: string, release: FleetLocalReleasePin): void;
|
|
247
261
|
export declare function parseFleetLocalReleasePointer(body: unknown, now?: number): FleetLocalReleasePointer | null;
|
|
248
262
|
export declare function chooseFleetLocalTargetRelease(pointer: FleetLocalReleasePointer | null, compiled?: FleetLocalReleasePin, cliVersion?: string): FleetLocalTargetRelease;
|
|
249
263
|
export declare function fetchFleetLocalReleasePointer(deps?: {
|
|
@@ -373,6 +387,14 @@ export declare function writeFleetLocalFirstStart(profileDir: string, firstStart
|
|
|
373
387
|
intro?: string;
|
|
374
388
|
kickoff?: string;
|
|
375
389
|
}): string;
|
|
390
|
+
export interface FleetLocalSignInNeeded {
|
|
391
|
+
runtime: BotRuntimeId;
|
|
392
|
+
login: "claude-code" | "codex-cli" | "grok-cli" | "bot" | null;
|
|
393
|
+
since: string | null;
|
|
394
|
+
}
|
|
395
|
+
export declare function fleetLocalSignInNeededPath(agentUid: string, deps?: Pick<FleetLocalControlDeps, "fleetHome">): string;
|
|
396
|
+
export declare function readFleetLocalSignInNeeded(agentUid: string, deps?: Pick<FleetLocalControlDeps, "fleetHome">): FleetLocalSignInNeeded | null;
|
|
397
|
+
export declare function readFleetLocalIntroSentAt(agentUid: string, deps?: Pick<FleetLocalControlDeps, "fleetHome">): string | null;
|
|
376
398
|
export declare function writeFleetLocalSoul(agentUid: string, systemPrompt: string, deps?: Pick<FleetLocalControlDeps, "fleetHome">): string;
|
|
377
399
|
/**
|
|
378
400
|
* The pinned runtime refuses a persona file that trips its context-file
|
|
@@ -412,6 +434,12 @@ export declare function fleetLocalBusyReason(agentUid: string, deps?: Pick<Fleet
|
|
|
412
434
|
export declare function refreshFleetLocalInstructions(agentUid: string, systemPrompt: string, deps?: FleetLocalControlDeps): string;
|
|
413
435
|
/** Last few non-empty stderr lines of a failed child process, trimmed for an error message. */
|
|
414
436
|
export declare function stderrTail(error: unknown): string;
|
|
437
|
+
export declare const FLEET_WHEELHOUSE_EXIT: {
|
|
438
|
+
readonly installed: 0;
|
|
439
|
+
readonly verificationFailed: 2;
|
|
440
|
+
readonly unavailable: 3;
|
|
441
|
+
readonly installFailed: 4;
|
|
442
|
+
};
|
|
415
443
|
/** A FleetLocalSpawn backed by an execFileSync-shaped runner (stderr is only known on failure). */
|
|
416
444
|
export declare function spawnFromRun(run: FleetLocalExec): FleetLocalSpawn;
|
|
417
445
|
/**
|
|
@@ -449,6 +477,10 @@ export interface FleetLocalProviderAuthStatus {
|
|
|
449
477
|
* not installed, or the helper failed.
|
|
450
478
|
*/
|
|
451
479
|
export declare function fleetLocalProviderAuthStatus(agentUid: string, provider: string, deps?: FleetLocalControlDeps): FleetLocalProviderAuthStatus | null;
|
|
480
|
+
export type FleetLocalAsyncRun = (executable: string, args: string[], options: Record<string, unknown>) => Promise<string>;
|
|
481
|
+
export declare function fleetLocalProviderAuthStatusAsync(agentUid: string, provider: string, deps?: FleetLocalControlDeps & {
|
|
482
|
+
runAsync?: FleetLocalAsyncRun;
|
|
483
|
+
}): Promise<FleetLocalProviderAuthStatus | null>;
|
|
452
484
|
/**
|
|
453
485
|
* Sign a bot in from a login already on this computer, without a browser:
|
|
454
486
|
* the helper imports the Codex CLI login (CODEX_HOME, else ~/.codex) or
|