@indigoai-us/hq-cli 5.345.215-beta.0 → 5.345.217
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 +206 -1
- package/README.md +45 -0
- package/assets/scaffold/core/scripts/hq-delegate-verify.sh +5 -2
- package/assets/scaffold/core/scripts/lib/epochrealtime.sh +30 -0
- package/assets/scaffold/core/scripts/lib/work-mesh-enqueue.sh +12 -5
- package/dist/command-catalog.generated.d.ts +105 -10
- package/dist/command-catalog.generated.js +127 -10
- package/dist/command-help.js +3 -1
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/auth.d.ts +1 -1
- package/dist/commands/auth.js +11 -52
- package/dist/commands/bot.js +75 -10
- package/dist/commands/capacity.d.ts +4 -1
- package/dist/commands/capacity.js +46 -10
- package/dist/commands/cloud-demote.d.ts +19 -4
- package/dist/commands/cloud-demote.js +85 -12
- package/dist/commands/cloud-provision.d.ts +5 -1
- package/dist/commands/cloud-provision.js +6 -2
- package/dist/commands/cloud.d.ts +36 -0
- package/dist/commands/cloud.js +110 -27
- package/dist/commands/core-delegate-w1b.js +15 -1
- package/dist/commands/core-policy.js +67 -8
- package/dist/commands/core.js +1 -0
- package/dist/commands/daemon.js +9 -1
- package/dist/commands/dm.js +7 -0
- package/dist/commands/doctor-usage.d.ts +8 -0
- package/dist/commands/doctor-usage.js +20 -0
- package/dist/commands/doctor.js +7 -1
- package/dist/commands/env.d.ts +18 -0
- package/dist/commands/env.js +82 -0
- package/dist/commands/files-browse.d.ts +11 -4
- package/dist/commands/files-browse.js +21 -4
- package/dist/commands/files.d.ts +1 -1
- package/dist/commands/files.js +25 -11
- package/dist/commands/install-global.js +2 -2
- package/dist/commands/integrations-auth-rules.d.ts +27 -0
- package/dist/commands/integrations-auth-rules.js +79 -0
- package/dist/commands/integrations-import.js +124 -12
- package/dist/commands/lanes.js +102 -26
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.js +41 -34
- package/dist/commands/mesh.d.ts +2 -0
- package/dist/commands/mesh.js +60 -35
- package/dist/commands/sources.d.ts +8 -2
- package/dist/commands/sources.js +65 -9
- package/dist/commands/sync-held.js +5 -2
- package/dist/commands/whoami.js +26 -1
- package/dist/data/command-states.json +15 -0
- package/dist/index.js +52 -4
- package/dist/lazy-commands.js +5 -6
- package/dist/lib/anywhere-person-setting.d.ts +2 -0
- package/dist/lib/anywhere-person-setting.js +6 -3
- package/dist/lib/billing/usage-card.d.ts +25 -4
- package/dist/lib/billing/usage-card.js +76 -9
- package/dist/lib/billing/usage-cost.d.ts +3 -3
- package/dist/lib/billing/usage-cost.js +35 -13
- package/dist/lib/billing/usage-only.js +4 -2
- package/dist/lib/billing/usage-rate-card.d.ts +2 -2
- package/dist/lib/billing/usage-rate-card.js +3 -0
- package/dist/lib/bot/fleet-cron.d.ts +8 -0
- package/dist/lib/bot/fleet-cron.js +126 -7
- package/dist/lib/bot/fleet-daemon.d.ts +46 -0
- package/dist/lib/bot/fleet-daemon.js +99 -1
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/inflight.js +10 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +12 -1
- package/dist/lib/bot/probe.js +7 -1
- package/dist/lib/bot/run.js +20 -1
- package/dist/lib/bot/runtime/codex.js +1 -1
- package/dist/lib/bot/runtime/grok-acp.d.ts +6 -1
- package/dist/lib/bot/runtime/grok-acp.js +32 -14
- package/dist/lib/bot/runtime/grok.js +1 -1
- package/dist/lib/bot/runtime/index.js +19 -9
- package/dist/lib/bot/runtime/messages-stream.js +2 -2
- package/dist/lib/bot/runtime/types.d.ts +15 -0
- package/dist/lib/bot/runtime/types.js +9 -0
- package/dist/lib/bot/runtime-failure.d.ts +23 -0
- package/dist/lib/bot/runtime-failure.js +43 -1
- package/dist/lib/capacity/accounts.d.ts +8 -0
- package/dist/lib/capacity/accounts.js +19 -0
- package/dist/lib/capacity/available.d.ts +154 -0
- package/dist/lib/capacity/available.js +905 -0
- package/dist/lib/capacity/codex-availability.d.ts +14 -1
- package/dist/lib/capacity/codex-availability.js +26 -1
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +29 -2
- package/dist/lib/capacity/collectors/claude-oauth.js +104 -7
- package/dist/lib/capacity/collectors/codex.js +10 -7
- package/dist/lib/capacity/ledger.d.ts +37 -1
- package/dist/lib/capacity/ledger.js +207 -30
- package/dist/lib/capacity/project.d.ts +26 -0
- package/dist/lib/capacity/project.js +137 -8
- package/dist/lib/capacity/refusal-rows.d.ts +31 -0
- package/dist/lib/capacity/refusal-rows.js +61 -0
- package/dist/lib/capacity/refusal.d.ts +53 -2
- package/dist/lib/capacity/refusal.js +284 -65
- package/dist/lib/capacity/route.js +46 -11
- package/dist/lib/capacity/widget.d.ts +12 -1
- package/dist/lib/capacity/widget.js +91 -3
- package/dist/lib/daemon/flag-monitor.d.ts +8 -0
- package/dist/lib/daemon/flag-monitor.js +17 -6
- package/dist/lib/daemon/flag.d.ts +65 -1
- package/dist/lib/daemon/flag.js +190 -40
- package/dist/lib/daemon/ops/policy.js +62 -5
- package/dist/lib/daemon/paths.d.ts +72 -2
- package/dist/lib/daemon/paths.js +154 -3
- package/dist/lib/daemon/resolver.d.ts +2 -0
- package/dist/lib/daemon/resolver.js +3 -0
- package/dist/lib/daemon/run.d.ts +9 -0
- package/dist/lib/daemon/run.js +79 -21
- package/dist/lib/daemon/selfcheck.d.ts +22 -0
- package/dist/lib/daemon/selfcheck.js +40 -1
- package/dist/lib/daemon/server.d.ts +5 -1
- package/dist/lib/daemon/server.js +17 -23
- package/dist/lib/daemon/state-file-switch.d.ts +57 -0
- package/dist/lib/daemon/state-file-switch.js +88 -0
- package/dist/lib/daemon/state-file.d.ts +198 -0
- package/dist/lib/daemon/state-file.js +419 -0
- package/dist/lib/daemon/tcc-eperm.d.ts +153 -0
- package/dist/lib/daemon/tcc-eperm.js +310 -0
- package/dist/lib/daemon/timed-flag-monitors.d.ts +47 -0
- package/dist/lib/daemon/timed-flag-monitors.js +75 -0
- package/dist/lib/delivery/admission.d.ts +86 -0
- package/dist/lib/delivery/admission.js +148 -0
- package/dist/lib/delivery/artifacts.d.ts +7 -1
- package/dist/lib/delivery/artifacts.js +29 -10
- package/dist/lib/delivery/attempt-id.d.ts +13 -0
- package/dist/lib/delivery/attempt-id.js +16 -0
- package/dist/lib/delivery/disposable-target.d.ts +42 -0
- package/dist/lib/delivery/disposable-target.js +111 -0
- package/dist/lib/delivery/effects.d.ts +136 -0
- package/dist/lib/delivery/effects.js +541 -0
- package/dist/lib/delivery/enrollment.d.ts +21 -17
- package/dist/lib/delivery/enrollment.js +83 -5
- package/dist/lib/delivery/escalations.d.ts +51 -0
- package/dist/lib/delivery/escalations.js +60 -0
- package/dist/lib/delivery/lease.d.ts +80 -0
- package/dist/lib/delivery/lease.js +134 -0
- package/dist/lib/delivery/migrations.d.ts +120 -4
- package/dist/lib/delivery/migrations.js +215 -15
- package/dist/lib/delivery/mqtt.d.ts +2 -0
- package/dist/lib/delivery/mqtt.js +7 -0
- package/dist/lib/delivery/reconciler.d.ts +65 -1
- package/dist/lib/delivery/reconciler.js +224 -13
- package/dist/lib/delivery/rpc/client.d.ts +22 -0
- package/dist/lib/delivery/rpc/client.js +159 -0
- package/dist/lib/delivery/rpc/port.d.ts +40 -0
- package/dist/lib/delivery/rpc/port.js +16 -0
- package/dist/lib/delivery/rpc/server.d.ts +30 -0
- package/dist/lib/delivery/rpc/server.js +205 -0
- package/dist/lib/delivery/rpc/wire.d.ts +85 -0
- package/dist/lib/delivery/rpc/wire.js +143 -0
- package/dist/lib/delivery/store.d.ts +2 -0
- package/dist/lib/delivery/store.js +4 -0
- package/dist/lib/delivery/windows-service-install.d.ts +262 -0
- package/dist/lib/delivery/windows-service-install.js +892 -0
- package/dist/lib/delivery/workers/macos.d.ts +16 -1
- package/dist/lib/delivery/workers/macos.js +54 -12
- package/dist/lib/delivery/workers/windows-service-live.d.ts +121 -0
- package/dist/lib/delivery/workers/windows-service-live.js +711 -0
- package/dist/lib/delivery/workers/windows-service-runner.d.ts +33 -0
- package/dist/lib/delivery/workers/windows-service-runner.js +82 -0
- package/dist/lib/delivery/workers/windows-service.d.ts +140 -0
- package/dist/lib/delivery/workers/windows-service.js +584 -0
- package/dist/lib/delivery/workers/windows.d.ts +32 -22
- package/dist/lib/delivery/workers/windows.js +50 -64
- package/dist/lib/doctor/checks/host-core.d.ts +50 -0
- package/dist/lib/doctor/checks/host-core.js +269 -0
- package/dist/lib/doctor/checks/replay-recorder.d.ts +39 -0
- package/dist/lib/doctor/checks/replay-recorder.js +261 -0
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/environment/profile.d.ts +239 -0
- package/dist/lib/environment/profile.js +251 -0
- package/dist/lib/hook-engine/reconcile.js +39 -13
- package/dist/lib/hook-engine/registration.d.ts +9 -0
- package/dist/lib/hook-engine/registration.js +19 -0
- package/dist/lib/hot-channels/adapters/meetings.d.ts +15 -0
- package/dist/lib/hot-channels/adapters/meetings.js +36 -3
- package/dist/lib/hot-channels/adapters/slack.d.ts +21 -5
- package/dist/lib/hot-channels/adapters/slack.js +64 -21
- package/dist/lib/hot-channels/alert.d.ts +2 -0
- package/dist/lib/hot-channels/alert.js +8 -1
- package/dist/lib/hot-channels/contract.d.ts +12 -0
- package/dist/lib/hot-channels/contract.js +7 -0
- package/dist/lib/hot-channels/loop.js +1 -0
- package/dist/lib/hot-channels/run.d.ts +6 -0
- package/dist/lib/hot-channels/run.js +4 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +74 -1
- package/dist/lib/hot-channels/signals-pass.js +82 -41
- package/dist/lib/hot-channels/signals-redo.js +10 -2
- package/dist/lib/install/claude-targets.d.ts +12 -1
- package/dist/lib/install/claude-targets.js +57 -5
- package/dist/lib/install/codex-targets.d.ts +2 -2
- package/dist/lib/install/codex-targets.js +36 -6
- package/dist/lib/install/hook-target.d.ts +3 -0
- package/dist/lib/install/hook-target.js +11 -0
- package/dist/lib/lanes/canonical-host.d.ts +35 -0
- package/dist/lib/lanes/canonical-host.js +65 -0
- package/dist/lib/lanes/host-capacity.d.ts +30 -0
- package/dist/lib/lanes/host-capacity.js +29 -3
- package/dist/lib/lanes/watcher.js +35 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +2 -0
- package/dist/lib/mesh/live/daemon/run.js +5 -2
- package/dist/lib/mesh/live/flush.d.ts +5 -1
- package/dist/lib/mesh/live/flush.js +12 -6
- package/dist/lib/mesh/live/reporting-privacy.d.ts +32 -0
- package/dist/lib/mesh/live/reporting-privacy.js +56 -1
- package/dist/lib/mesh/live/spool.d.ts +7 -0
- package/dist/lib/mesh/live/spool.js +25 -0
- package/dist/lib/person-setting-cache.d.ts +38 -0
- package/dist/lib/person-setting-cache.js +98 -0
- package/dist/lib/safe-store.d.ts +245 -0
- package/dist/lib/safe-store.js +777 -0
- package/dist/lib/signals/engine.d.ts +29 -2
- package/dist/lib/signals/engine.js +103 -4
- package/dist/lib/signals/reply.js +73 -18
- package/dist/lib/signals/steps/adapters.js +7 -2
- package/dist/lib/signals/steps/extract.d.ts +13 -0
- package/dist/lib/signals/steps/extract.js +122 -6
- package/dist/main.js +46 -3
- package/dist/schemas/hq-available-ai.v1.schema.json +76 -0
- package/dist/schemas/hq-environment-profile.v1.schema.json +438 -0
- package/dist/utils/auth-expiry.d.ts +8 -0
- package/dist/utils/auth-expiry.js +53 -0
- package/dist/utils/catalog-runtime-paths.d.ts +34 -0
- package/dist/utils/catalog-runtime-paths.js +53 -0
- package/dist/utils/cli-telemetry.d.ts +21 -0
- package/dist/utils/cli-telemetry.js +34 -0
- package/dist/utils/command-usage.d.ts +275 -0
- package/dist/utils/command-usage.js +797 -0
- package/dist/utils/files-browse-acl.js +1 -1
- package/dist/utils/hook-trust.d.ts +7 -0
- package/dist/utils/hook-trust.js +31 -4
- package/dist/utils/host-registration.d.ts +126 -0
- package/dist/utils/host-registration.js +378 -0
- package/dist/utils/resident-package-preload.js +2 -0
- package/package.json +10 -8
- package/scripts/bench-core.mjs +1096 -0
- package/scripts/check-function-manifest.mjs +702 -0
- package/dist/lib/delivery/workers/windows-boundary.d.ts +0 -453
- package/dist/lib/delivery/workers/windows-boundary.js +0 -693
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "hq-available-ai.v1",
|
|
4
|
+
"title": "hq-available-ai.v1",
|
|
5
|
+
"description": "What AI can run on this computer right now. Holds no credential. It lists the organization names of every account across the companies signed in on this machine, so the file is written mode 0600 (owner-only) to keep those names off other local users. freshness is about the view and is never a failure; failure classes stay in hq capacity doctor and logs.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schemaVersion", "generatedAt", "freshness", "best", "nextBackAt", "options"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schemaVersion": { "const": "hq-available-ai.v1" },
|
|
11
|
+
"generatedAt": { "type": "string" },
|
|
12
|
+
"freshness": { "enum": ["fresh", "refreshing", "stale"] },
|
|
13
|
+
"best": { "type": ["string", "null"], "description": "optionId of an account enabled for work, never a paid tranche. Null only when nothing can run." },
|
|
14
|
+
"nextBackAt": { "type": ["string", "null"] },
|
|
15
|
+
"options": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"required": ["optionId", "provider", "account", "tranche", "availability", "leftPercent", "backAt", "reading", "usableBy", "holder", "models", "reason", "nextStep"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"optionId": { "type": "string", "minLength": 1 },
|
|
23
|
+
"provider": { "enum": ["claude", "codex", "grok"] },
|
|
24
|
+
"account": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": ["id", "label", "organization"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"id": { "type": "string" },
|
|
30
|
+
"label": { "type": "string" },
|
|
31
|
+
"organization": { "type": ["string", "null"] }
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"tranche": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"required": ["kind", "scope", "paid"],
|
|
38
|
+
"properties": {
|
|
39
|
+
"kind": { "enum": ["plan", "scoped_model", "extra_usage", "credits", "api_key"] },
|
|
40
|
+
"scope": { "type": ["string", "null"] },
|
|
41
|
+
"paid": { "type": "boolean" }
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"availability": { "enum": ["ready", "likely_ready", "low", "used_up", "needs_sign_in", "not_installed"] },
|
|
45
|
+
"leftPercent": { "type": ["number", "null"] },
|
|
46
|
+
"backAt": { "type": ["string", "null"] },
|
|
47
|
+
"reading": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["ageSeconds", "confidence"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"ageSeconds": { "type": ["number", "null"] },
|
|
53
|
+
"confidence": { "enum": ["fetched", "observed", "inferred", "unknown"] }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"usableBy": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"items": { "enum": ["model_cli", "lane", "fleet"] }
|
|
59
|
+
},
|
|
60
|
+
"holder": { "enum": ["cli_home", "bot_own", "none"] },
|
|
61
|
+
"models": { "type": "array", "items": { "type": "string" } },
|
|
62
|
+
"reason": { "type": "string" },
|
|
63
|
+
"nextStep": {
|
|
64
|
+
"type": "object",
|
|
65
|
+
"additionalProperties": false,
|
|
66
|
+
"required": ["kind", "label"],
|
|
67
|
+
"properties": {
|
|
68
|
+
"kind": { "enum": ["use", "sign_in", "wait", "install"] },
|
|
69
|
+
"label": { "type": "string" }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "urn:hq:schema:hq-environment-profile:v1",
|
|
4
|
+
"title": "hq-environment-profile.v1",
|
|
5
|
+
"description": "One profile per place that can do work (Mac, Outpost, MicroVM, bot, fleet box), published as a company-scoped view. The declared part changes rarely and is written by the environment's owner or image. The readings part is written by the environment about itself; each reading carries observed_at and ttl_seconds. Every login in accounts records its owning business and its holder; a login the owner holds is listed there whichever of the owner's businesses owns it, and a login held by another person appears only in foreign_accounts. Work is paired only with an account whose usable is true, which requires holder owner. The schema is closed: every object rejects unknown fields and every enum is fixed, so any added field or enum value needs a new schema_version. No secret values, tokens, credential paths or sign-in sessions may appear anywhere in a profile.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["schema_version", "view", "declared", "readings"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"schema_version": { "const": "hq-environment-profile.v1" },
|
|
11
|
+
"view": {
|
|
12
|
+
"description": "Which company this view of the environment is published for. Logins the owner holds are listed in readings.accounts whichever business owns them. Logins held by other people are listed only in readings.foreign_accounts.",
|
|
13
|
+
"type": "object",
|
|
14
|
+
"additionalProperties": false,
|
|
15
|
+
"required": ["company", "generated_at", "generated_by"],
|
|
16
|
+
"properties": {
|
|
17
|
+
"company": { "$ref": "#/$defs/company_slug", "description": "Must be one of declared.companies. The loader checks this; JSON Schema cannot compare the two fields." },
|
|
18
|
+
"generated_at": { "$ref": "#/$defs/timestamp" },
|
|
19
|
+
"generated_by": { "type": "string", "minLength": 1, "description": "Writer, for example 'hand capture 2026-11-13 from hq runners capacity --json'." }
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"declared": { "$ref": "#/$defs/declared" },
|
|
23
|
+
"readings": { "$ref": "#/$defs/readings" },
|
|
24
|
+
"notes": { "type": "array", "items": { "type": "string" } }
|
|
25
|
+
},
|
|
26
|
+
"allOf": [
|
|
27
|
+
{
|
|
28
|
+
"description": "A template does not exist yet, so it has no live readings: no compute, slots, accounts, foreign accounts, access probes or base readiness.",
|
|
29
|
+
"if": { "properties": { "declared": { "properties": { "state": { "const": "template" } } } } },
|
|
30
|
+
"then": {
|
|
31
|
+
"properties": {
|
|
32
|
+
"readings": {
|
|
33
|
+
"properties": {
|
|
34
|
+
"compute": false,
|
|
35
|
+
"slots": false,
|
|
36
|
+
"accounts": { "maxItems": 0 },
|
|
37
|
+
"foreign_accounts": { "maxItems": 0 },
|
|
38
|
+
"access": { "maxItems": 0 },
|
|
39
|
+
"base_readiness": false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"$defs": {
|
|
47
|
+
"company_slug": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
|
|
48
|
+
"timestamp": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"format": "date-time",
|
|
51
|
+
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$",
|
|
52
|
+
"description": "RFC 3339 date-time. The pattern enforces the shape where a validator does not check formats."
|
|
53
|
+
},
|
|
54
|
+
"timestamp_or_null": { "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/timestamp" }] },
|
|
55
|
+
"provenance": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"required": ["source", "verified"],
|
|
59
|
+
"properties": {
|
|
60
|
+
"source": { "type": "string", "minLength": 1, "description": "Command, file:line or document the value came from." },
|
|
61
|
+
"verified": { "type": "boolean", "description": "true only when read from the live system at observed time; false for estimates, prose notes and unconfirmed vendor figures." }
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"label": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "key:value. Keys in use: os, arch, tool, engine, net, role, power, data, image.",
|
|
67
|
+
"pattern": "^[a-z][a-z0-9-]*:[A-Za-z0-9._/@*-]+$"
|
|
68
|
+
},
|
|
69
|
+
"taint": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"additionalProperties": false,
|
|
72
|
+
"required": ["key", "effect", "reason"],
|
|
73
|
+
"properties": {
|
|
74
|
+
"key": { "$ref": "#/$defs/label", "description": "key:value; work tolerates it by listing the same string." },
|
|
75
|
+
"effect": {
|
|
76
|
+
"enum": ["no-place", "prefer-not"],
|
|
77
|
+
"description": "no-place: pass 1 rejects work that does not tolerate it. prefer-not: pass 2 penalty unless tolerated."
|
|
78
|
+
},
|
|
79
|
+
"reason": { "type": "string" }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"declared": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"required": ["kind", "id", "companies", "state", "lifecycle", "limits", "labels", "dispatch", "cost", "taints"],
|
|
86
|
+
"properties": {
|
|
87
|
+
"kind": { "enum": ["local", "outpost", "microvm", "bot", "fleet-box"] },
|
|
88
|
+
"id": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"pattern": "^(local|outpost|microvm|bot|fleet-box):[A-Za-z0-9._@:-]+$",
|
|
91
|
+
"description": "kind:native-id. The prefix must equal kind. The native id is the one hq-lanes-host-capacity.v1 uses where one exists."
|
|
92
|
+
},
|
|
93
|
+
"aliases": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"description": "Other ids the same environment appears under in today's records (lane host ids, instance names, hostnames).",
|
|
96
|
+
"items": { "type": "string" },
|
|
97
|
+
"uniqueItems": true
|
|
98
|
+
},
|
|
99
|
+
"companies": {
|
|
100
|
+
"type": "array",
|
|
101
|
+
"minItems": 1,
|
|
102
|
+
"uniqueItems": true,
|
|
103
|
+
"items": { "$ref": "#/$defs/company_slug" },
|
|
104
|
+
"description": "Companies this environment may do work for. Hard filter."
|
|
105
|
+
},
|
|
106
|
+
"state": { "enum": ["running", "template", "stopped"] },
|
|
107
|
+
"lifecycle": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"additionalProperties": false,
|
|
110
|
+
"required": ["type", "start_seconds_estimate"],
|
|
111
|
+
"properties": {
|
|
112
|
+
"type": { "enum": ["persistent", "ephemeral"] },
|
|
113
|
+
"start_seconds_estimate": {
|
|
114
|
+
"type": ["number", "null"],
|
|
115
|
+
"minimum": 0,
|
|
116
|
+
"description": "0 for a running environment; null when unknown."
|
|
117
|
+
},
|
|
118
|
+
"provenance": { "$ref": "#/$defs/provenance" }
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"limits": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"additionalProperties": false,
|
|
124
|
+
"required": ["max_run_seconds", "workspace_survives"],
|
|
125
|
+
"properties": {
|
|
126
|
+
"vcpu": { "type": ["integer", "null"], "minimum": 1 },
|
|
127
|
+
"memory_mb": { "type": ["integer", "null"], "minimum": 1 },
|
|
128
|
+
"disk_gb": { "type": ["number", "null"], "minimum": 0 },
|
|
129
|
+
"max_concurrent": { "type": ["integer", "null"], "minimum": 1 },
|
|
130
|
+
"max_run_seconds": {
|
|
131
|
+
"type": ["integer", "null"],
|
|
132
|
+
"minimum": 1,
|
|
133
|
+
"description": "Hard ceiling on one run. null means no ceiling."
|
|
134
|
+
},
|
|
135
|
+
"workspace_survives": {
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"description": "Whether the working directory survives the end of a run and a restart."
|
|
138
|
+
},
|
|
139
|
+
"provenance": { "$ref": "#/$defs/provenance" }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"labels": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/label" } },
|
|
143
|
+
"image": {
|
|
144
|
+
"type": ["object", "null"],
|
|
145
|
+
"additionalProperties": false,
|
|
146
|
+
"required": ["name", "version", "ref"],
|
|
147
|
+
"properties": {
|
|
148
|
+
"name": { "type": "string" },
|
|
149
|
+
"version": { "type": "string" },
|
|
150
|
+
"ref": { "type": ["string", "null"], "description": "Registry or snapshot reference; null when the image is not built yet." },
|
|
151
|
+
"contents": { "type": "array", "items": { "type": "string" } }
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"dispatch": {
|
|
155
|
+
"type": "object",
|
|
156
|
+
"additionalProperties": false,
|
|
157
|
+
"required": ["method", "exists_today"],
|
|
158
|
+
"properties": {
|
|
159
|
+
"method": { "enum": ["lane-local", "lane-ssm", "lane-endpoint", "dm", "fleet-task"] },
|
|
160
|
+
"target": { "type": "string", "description": "What the dispatcher addresses, for example '--placement outpost:primary'." },
|
|
161
|
+
"exists_today": { "type": "boolean", "description": "false when the method is proposed and not built." }
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"cost": {
|
|
165
|
+
"type": "object",
|
|
166
|
+
"additionalProperties": false,
|
|
167
|
+
"required": ["model", "marginal_usd_per_hour", "provenance"],
|
|
168
|
+
"properties": {
|
|
169
|
+
"model": {
|
|
170
|
+
"enum": ["owned", "fixed", "metered"],
|
|
171
|
+
"description": "owned: already paid hardware. fixed: a standing charge whether or not work runs. metered: charged while running."
|
|
172
|
+
},
|
|
173
|
+
"marginal_usd_per_hour": { "type": ["number", "null"], "minimum": 0, "description": "Extra cost of one more hour of work here. 0 for owned and fixed." },
|
|
174
|
+
"fixed_usd_per_month": { "type": ["number", "null"], "minimum": 0 },
|
|
175
|
+
"suspend_usd_per_hour": { "type": ["number", "null"], "minimum": 0 },
|
|
176
|
+
"basis": { "type": "string" },
|
|
177
|
+
"provenance": { "$ref": "#/$defs/provenance" }
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
"taints": { "type": "array", "items": { "$ref": "#/$defs/taint" } }
|
|
181
|
+
},
|
|
182
|
+
"allOf": [
|
|
183
|
+
{
|
|
184
|
+
"if": { "properties": { "lifecycle": { "properties": { "type": { "const": "ephemeral" } } } } },
|
|
185
|
+
"then": {
|
|
186
|
+
"properties": {
|
|
187
|
+
"limits": {
|
|
188
|
+
"required": ["max_run_seconds", "workspace_survives"],
|
|
189
|
+
"properties": {
|
|
190
|
+
"workspace_survives": { "const": false },
|
|
191
|
+
"max_run_seconds": { "type": "integer" }
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"if": { "properties": { "kind": { "const": "local" } } },
|
|
199
|
+
"then": { "properties": { "dispatch": { "properties": { "method": { "const": "lane-local" } } } } }
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"description": "The id prefix is the kind.",
|
|
203
|
+
"if": { "properties": { "kind": { "const": "local" } }, "required": ["kind"] },
|
|
204
|
+
"then": { "properties": { "id": { "pattern": "^local:" } } }
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"if": { "properties": { "kind": { "const": "outpost" } }, "required": ["kind"] },
|
|
208
|
+
"then": { "properties": { "id": { "pattern": "^outpost:" } } }
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"if": { "properties": { "kind": { "const": "microvm" } }, "required": ["kind"] },
|
|
212
|
+
"then": { "properties": { "id": { "pattern": "^microvm:" } } }
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
"if": { "properties": { "kind": { "const": "bot" } }, "required": ["kind"] },
|
|
216
|
+
"then": { "properties": { "id": { "pattern": "^bot:" } } }
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"if": { "properties": { "kind": { "const": "fleet-box" } }, "required": ["kind"] },
|
|
220
|
+
"then": { "properties": { "id": { "pattern": "^fleet-box:" } } }
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"if": { "properties": { "kind": { "const": "bot" } } },
|
|
224
|
+
"then": { "properties": { "dispatch": { "properties": { "method": { "const": "dm" } } } } }
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"if": { "properties": { "kind": { "const": "microvm" } } },
|
|
228
|
+
"then": { "properties": { "lifecycle": { "properties": { "type": { "const": "ephemeral" } } } } }
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"if": { "properties": { "state": { "const": "template" } } },
|
|
232
|
+
"then": { "properties": { "image": { "type": "object" } }, "required": ["image"] }
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"reading_meta": {
|
|
237
|
+
"type": "object",
|
|
238
|
+
"required": ["observed_at", "ttl_seconds", "source"],
|
|
239
|
+
"properties": {
|
|
240
|
+
"observed_at": { "$ref": "#/$defs/timestamp" },
|
|
241
|
+
"ttl_seconds": { "type": "integer", "minimum": 0 },
|
|
242
|
+
"source": { "type": "string", "minLength": 1 }
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"compute": {
|
|
246
|
+
"allOf": [{ "$ref": "#/$defs/reading_meta" }],
|
|
247
|
+
"type": "object",
|
|
248
|
+
"unevaluatedProperties": false,
|
|
249
|
+
"properties": {
|
|
250
|
+
"observed_at": true,
|
|
251
|
+
"ttl_seconds": true,
|
|
252
|
+
"source": true,
|
|
253
|
+
"vcpu_online": { "type": "integer", "minimum": 1 },
|
|
254
|
+
"load_1m": { "type": ["number", "null"], "minimum": 0 },
|
|
255
|
+
"load_per_vcpu": { "type": ["number", "null"], "minimum": 0 },
|
|
256
|
+
"mem_total_mb": { "type": "integer", "minimum": 0 },
|
|
257
|
+
"mem_available_mb": { "type": "integer", "minimum": 0 },
|
|
258
|
+
"disk_total_gb": { "type": "number", "minimum": 0 },
|
|
259
|
+
"disk_free_gb": { "type": "number", "minimum": 0 }
|
|
260
|
+
},
|
|
261
|
+
"required": ["vcpu_online", "mem_available_mb", "disk_free_gb"]
|
|
262
|
+
},
|
|
263
|
+
"slots": {
|
|
264
|
+
"allOf": [{ "$ref": "#/$defs/reading_meta" }],
|
|
265
|
+
"type": "object",
|
|
266
|
+
"unevaluatedProperties": false,
|
|
267
|
+
"description": "Content of hq-lanes-host-capacity.v1, provider totals. Per-account slot counts sit on each account.",
|
|
268
|
+
"properties": {
|
|
269
|
+
"observed_at": true,
|
|
270
|
+
"ttl_seconds": true,
|
|
271
|
+
"source": true,
|
|
272
|
+
"host_ref": {
|
|
273
|
+
"type": "object",
|
|
274
|
+
"additionalProperties": false,
|
|
275
|
+
"required": ["kind", "id"],
|
|
276
|
+
"properties": { "kind": { "type": "string" }, "id": { "type": "string" } }
|
|
277
|
+
},
|
|
278
|
+
"providers": {
|
|
279
|
+
"type": "array",
|
|
280
|
+
"items": {
|
|
281
|
+
"type": "object",
|
|
282
|
+
"additionalProperties": false,
|
|
283
|
+
"required": ["engine", "max_running", "running", "queued"],
|
|
284
|
+
"properties": {
|
|
285
|
+
"engine": { "$ref": "#/$defs/engine" },
|
|
286
|
+
"max_running": { "type": "integer", "minimum": 0 },
|
|
287
|
+
"max_queued": { "type": "integer", "minimum": 0 },
|
|
288
|
+
"running": { "type": "integer", "minimum": 0 },
|
|
289
|
+
"queued": { "type": "integer", "minimum": 0 }
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"queued_lanes": { "type": "integer", "minimum": 0 }
|
|
294
|
+
},
|
|
295
|
+
"required": ["host_ref", "providers"]
|
|
296
|
+
},
|
|
297
|
+
"engine": { "enum": ["claude", "codex", "grok"] },
|
|
298
|
+
"account": {
|
|
299
|
+
"allOf": [
|
|
300
|
+
{ "$ref": "#/$defs/reading_meta" },
|
|
301
|
+
{
|
|
302
|
+
"if": { "properties": { "usable": { "const": true } }, "required": ["usable"] },
|
|
303
|
+
"then": {
|
|
304
|
+
"properties": {
|
|
305
|
+
"holder": { "const": "owner" },
|
|
306
|
+
"enabled": { "const": true },
|
|
307
|
+
"signed_in": { "const": true }
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
],
|
|
312
|
+
"type": "object",
|
|
313
|
+
"unevaluatedProperties": false,
|
|
314
|
+
"properties": {
|
|
315
|
+
"observed_at": true,
|
|
316
|
+
"ttl_seconds": true,
|
|
317
|
+
"source": true,
|
|
318
|
+
"engine": { "$ref": "#/$defs/engine" },
|
|
319
|
+
"account_id": { "type": "string", "minLength": 1, "description": "Lane-config account label (the id lanes use)." },
|
|
320
|
+
"provider_account_id": { "type": ["string", "null"], "description": "Provider account id from hq-available-ai.v1, when it can be joined." },
|
|
321
|
+
"provider_account_join_verified": { "type": "boolean" },
|
|
322
|
+
"owning_company": {
|
|
323
|
+
"type": "string",
|
|
324
|
+
"description": "Company slug, 'personal' or 'unknown'.",
|
|
325
|
+
"pattern": "^([a-z0-9][a-z0-9-]*|personal|unknown)$"
|
|
326
|
+
},
|
|
327
|
+
"owning_company_source": { "type": "string" },
|
|
328
|
+
"holder": {
|
|
329
|
+
"enum": ["owner", "unknown"],
|
|
330
|
+
"description": "Who holds this login. owner: the HQ owner, who may use it for any of the owner's businesses, so owning_company is a reporting and ranking input and not a filter. unknown: not recorded yet. A login held by another person is never listed here; it goes in foreign_accounts."
|
|
331
|
+
},
|
|
332
|
+
"holder_source": { "type": "string" },
|
|
333
|
+
"usable": {
|
|
334
|
+
"type": "boolean",
|
|
335
|
+
"description": "Whether work may be paired with this login. true is allowed only when holder is owner, enabled is true and signed_in is true. A login whose holder is unknown is recorded with usable false, whatever its sign-in state, until its holder is recorded."
|
|
336
|
+
},
|
|
337
|
+
"usable_for_companies": {
|
|
338
|
+
"type": "array",
|
|
339
|
+
"uniqueItems": true,
|
|
340
|
+
"items": { "$ref": "#/$defs/company_slug" },
|
|
341
|
+
"description": "Companies the owner has explicitly designated this account for. A record for reporting; an owner-held login is not limited to this list."
|
|
342
|
+
},
|
|
343
|
+
"enabled": { "type": "boolean" },
|
|
344
|
+
"signed_in": { "type": ["boolean", "null"], "description": "null when sources disagree or no reading exists." },
|
|
345
|
+
"sign_in_evidence": { "type": "array", "items": { "type": "string" } },
|
|
346
|
+
"slots": {
|
|
347
|
+
"type": "object",
|
|
348
|
+
"additionalProperties": false,
|
|
349
|
+
"properties": {
|
|
350
|
+
"max_running": { "type": "integer", "minimum": 0 },
|
|
351
|
+
"running": { "type": "integer", "minimum": 0 },
|
|
352
|
+
"queued": { "type": "integer", "minimum": 0 },
|
|
353
|
+
"quota_held": { "type": "boolean" }
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"room": {
|
|
357
|
+
"type": "object",
|
|
358
|
+
"additionalProperties": false,
|
|
359
|
+
"required": ["left_percent", "availability", "observed_at", "ttl_seconds"],
|
|
360
|
+
"description": "From hq-available-ai.v1. left_percent and availability are null when there is no reading.",
|
|
361
|
+
"properties": {
|
|
362
|
+
"left_percent": { "type": ["number", "null"], "minimum": 0, "maximum": 100 },
|
|
363
|
+
"availability": {
|
|
364
|
+
"enum": ["ready", "likely_ready", "low", "used_up", "needs_sign_in", "not_installed", null],
|
|
365
|
+
"description": "Exactly the availability words hq-available-ai.v1 emits, copied unchanged from the option this account was joined to. null when no option was joined, so there is no reading."
|
|
366
|
+
},
|
|
367
|
+
"back_at": { "$ref": "#/$defs/timestamp_or_null" },
|
|
368
|
+
"tranche": { "type": "string" },
|
|
369
|
+
"usage_ref": { "type": ["string", "null"], "description": "optionId in available.json." },
|
|
370
|
+
"observed_at": { "$ref": "#/$defs/timestamp_or_null" },
|
|
371
|
+
"ttl_seconds": { "type": "integer", "minimum": 0 }
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
"required": ["engine", "account_id", "owning_company", "holder", "usable", "enabled", "signed_in", "room"]
|
|
376
|
+
},
|
|
377
|
+
"foreign_account": {
|
|
378
|
+
"type": "object",
|
|
379
|
+
"additionalProperties": false,
|
|
380
|
+
"required": ["engine", "holder", "observed_at", "ttl_seconds", "source"],
|
|
381
|
+
"description": "A login on this environment that is held by a person other than the owner. Only its existence, engine and holder are recorded, with observed_at, ttl_seconds and source like every other reading; it has no account id, no room and no sign-in state, and it is never paired with work.",
|
|
382
|
+
"properties": {
|
|
383
|
+
"engine": { "$ref": "#/$defs/engine" },
|
|
384
|
+
"holder": {
|
|
385
|
+
"type": "string",
|
|
386
|
+
"pattern": "^other(:[a-z0-9][a-z0-9._-]*)?$",
|
|
387
|
+
"description": "other, or other:<person-slug> when the person is known. Never owner: an owner-held login belongs in accounts."
|
|
388
|
+
},
|
|
389
|
+
"observed_at": { "$ref": "#/$defs/timestamp" },
|
|
390
|
+
"ttl_seconds": { "type": "integer", "minimum": 0 },
|
|
391
|
+
"source": { "type": "string", "minLength": 1 }
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"probe": {
|
|
395
|
+
"allOf": [{ "$ref": "#/$defs/reading_meta" }],
|
|
396
|
+
"type": "object",
|
|
397
|
+
"unevaluatedProperties": false,
|
|
398
|
+
"properties": {
|
|
399
|
+
"observed_at": true,
|
|
400
|
+
"ttl_seconds": true,
|
|
401
|
+
"source": true,
|
|
402
|
+
"name": {
|
|
403
|
+
"type": "string",
|
|
404
|
+
"pattern": "^(secret|repo|integration|vault|data|identity|tool):[A-Za-z0-9._/-]+$",
|
|
405
|
+
"description": "secret:<NAME> holds a secret name only, never a value."
|
|
406
|
+
},
|
|
407
|
+
"result": { "enum": ["pass", "fail", "unknown"] },
|
|
408
|
+
"checks": { "type": "string", "description": "What the probe actually proves, for example 'name exists in vault (HEAD)' versus 'resolvable under this identity'." }
|
|
409
|
+
},
|
|
410
|
+
"required": ["name", "result", "checks"]
|
|
411
|
+
},
|
|
412
|
+
"readings": {
|
|
413
|
+
"type": "object",
|
|
414
|
+
"additionalProperties": false,
|
|
415
|
+
"required": ["accounts", "foreign_accounts", "access"],
|
|
416
|
+
"properties": {
|
|
417
|
+
"compute": { "$ref": "#/$defs/compute" },
|
|
418
|
+
"slots": { "$ref": "#/$defs/slots" },
|
|
419
|
+
"accounts": { "type": "array", "items": { "$ref": "#/$defs/account" } },
|
|
420
|
+
"foreign_accounts": { "type": "array", "items": { "$ref": "#/$defs/foreign_account" } },
|
|
421
|
+
"access": { "type": "array", "items": { "$ref": "#/$defs/probe" } },
|
|
422
|
+
"base_readiness": {
|
|
423
|
+
"allOf": [{ "$ref": "#/$defs/reading_meta" }],
|
|
424
|
+
"type": "object",
|
|
425
|
+
"unevaluatedProperties": false,
|
|
426
|
+
"properties": {
|
|
427
|
+
"observed_at": true,
|
|
428
|
+
"ttl_seconds": true,
|
|
429
|
+
"source": true,
|
|
430
|
+
"result": { "enum": ["ready", "degraded", "not-ready", "unknown"] },
|
|
431
|
+
"document_ref": { "type": ["string", "null"] }
|
|
432
|
+
},
|
|
433
|
+
"required": ["result"]
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The expiry as an ISO time, or null when it cannot be read as a time. */
|
|
2
|
+
export declare function authExpiryIso(expiresAt: number | string): string | null;
|
|
3
|
+
/**
|
|
4
|
+
* Expiry of a cached HQ session as text: the ISO time and how far away it is.
|
|
5
|
+
* Shared by `hq whoami` and `hq auth status`. Takes only the expiry, never a token.
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatAuthExpiry(expiresAt: number | string, now?: number): string;
|
|
8
|
+
//# sourceMappingURL=auth-expiry.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** The expiry as an ISO time, or null when it cannot be read as a time. */
|
|
2
|
+
export function authExpiryIso(expiresAt) {
|
|
3
|
+
const expiresAtMs = typeof expiresAt === "number" ? expiresAt : Date.parse(expiresAt);
|
|
4
|
+
// A finite number can still be outside the Date range (a damaged cache
|
|
5
|
+
// holding 1e20, say); toISOString would throw a RangeError on it.
|
|
6
|
+
const expiresAtDate = new Date(expiresAtMs);
|
|
7
|
+
return Number.isFinite(expiresAtMs) && !Number.isNaN(expiresAtDate.getTime())
|
|
8
|
+
? expiresAtDate.toISOString()
|
|
9
|
+
: null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Expiry of a cached HQ session as text: the ISO time and how far away it is.
|
|
13
|
+
* Shared by `hq whoami` and `hq auth status`. Takes only the expiry, never a token.
|
|
14
|
+
*/
|
|
15
|
+
export function formatAuthExpiry(expiresAt, now = Date.now()) {
|
|
16
|
+
const expiresAtMs = typeof expiresAt === "number" ? expiresAt : Date.parse(expiresAt);
|
|
17
|
+
const expiresAtDate = new Date(expiresAtMs);
|
|
18
|
+
if (!Number.isFinite(expiresAtMs) || Number.isNaN(expiresAtDate.getTime())) {
|
|
19
|
+
return String(expiresAt);
|
|
20
|
+
}
|
|
21
|
+
const remainingMs = expiresAtMs - now;
|
|
22
|
+
const absoluteMs = Math.abs(remainingMs);
|
|
23
|
+
let unit;
|
|
24
|
+
let unitMs;
|
|
25
|
+
if (absoluteMs >= 365 * 24 * 60 * 60 * 1_000) {
|
|
26
|
+
unit = "year";
|
|
27
|
+
unitMs = 365 * 24 * 60 * 60 * 1_000;
|
|
28
|
+
}
|
|
29
|
+
else if (absoluteMs >= 30 * 24 * 60 * 60 * 1_000) {
|
|
30
|
+
unit = "month";
|
|
31
|
+
unitMs = 30 * 24 * 60 * 60 * 1_000;
|
|
32
|
+
}
|
|
33
|
+
else if (absoluteMs >= 24 * 60 * 60 * 1_000) {
|
|
34
|
+
unit = "day";
|
|
35
|
+
unitMs = 24 * 60 * 60 * 1_000;
|
|
36
|
+
}
|
|
37
|
+
else if (absoluteMs >= 60 * 60 * 1_000) {
|
|
38
|
+
unit = "hour";
|
|
39
|
+
unitMs = 60 * 60 * 1_000;
|
|
40
|
+
}
|
|
41
|
+
else if (absoluteMs >= 60 * 1_000) {
|
|
42
|
+
unit = "minute";
|
|
43
|
+
unitMs = 60 * 1_000;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
unit = "second";
|
|
47
|
+
unitMs = 1_000;
|
|
48
|
+
}
|
|
49
|
+
const relative = new Intl.RelativeTimeFormat("en", { numeric: "always" })
|
|
50
|
+
.format(Math.round(remainingMs / unitMs), unit);
|
|
51
|
+
return expiresAtDate.toISOString() + " (" + relative + ")";
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=auth-expiry.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Machine-independent runtime paths for the generated command catalog.
|
|
3
|
+
*
|
|
4
|
+
* scripts/generate-command-catalog.mjs records help text with this machine's
|
|
5
|
+
* home folder (and absolute option defaults) replaced by a token, so the
|
|
6
|
+
* checked-in catalog is the same on every machine. On Windows the text after
|
|
7
|
+
* the token used backslashes (`<runtime-home>\.hq\x.json`), and the catalog
|
|
8
|
+
* then differed from the one generated on macOS and Linux, so `pnpm run build`
|
|
9
|
+
* failed its `--check` there. The path after a token is now always written with
|
|
10
|
+
* `/`, and turned back into this platform's separator when the catalog is read
|
|
11
|
+
* (src/lazy-commands.ts), so help text is unchanged on every platform.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RUNTIME_HOME_TOKEN = "<runtime-home>";
|
|
14
|
+
export declare const RUNTIME_PATH_TOKEN = "<runtime-path>";
|
|
15
|
+
/**
|
|
16
|
+
* Replace each runtime path in `text` with its token and write the rest of
|
|
17
|
+
* that path with `/`. `homeDir` gets `<runtime-home>`; any other entry of
|
|
18
|
+
* `runtimePaths` gets `<runtime-path>`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function stableRuntimeText(text: string, runtimePaths: readonly string[], homeDir: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Put this machine's paths back in place of the tokens, with the path after a
|
|
23
|
+
* token in this platform's separator.
|
|
24
|
+
*/
|
|
25
|
+
export declare function restoreRuntimeText(text: string, roots: {
|
|
26
|
+
home: string;
|
|
27
|
+
hqRoot: () => string;
|
|
28
|
+
}, separator: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* True when the catalog on disk is the generated text. A Windows checkout with
|
|
31
|
+
* core.autocrlf=true has CRLF line endings, which are not a difference.
|
|
32
|
+
*/
|
|
33
|
+
export declare function catalogTextMatches(onDisk: string, generated: string): boolean;
|
|
34
|
+
//# sourceMappingURL=catalog-runtime-paths.d.ts.map
|