@indigoai-us/hq-cli 5.235.0 → 5.237.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 +57 -0
- package/assets/bot-workers/setup/skills/agents-and-team.md +154 -0
- package/assets/bot-workers/setup/skills/first-company.md +4 -1
- package/assets/bot-workers/setup/skills/pricing.md +92 -0
- package/assets/bot-workers/setup/skills/standing-help.md +7 -0
- package/assets/bot-workers/setup/worker.yaml +244 -63
- package/dist/command-catalog.generated.d.ts +3 -0
- package/dist/command-catalog.generated.js +4 -0
- package/dist/commands/bot.d.ts +2 -0
- package/dist/commands/bot.js +14 -2
- package/dist/commands/lanes-checks.js +22 -1
- package/dist/lib/bot/config.d.ts +12 -0
- package/dist/lib/bot/config.js +25 -0
- package/dist/lib/bot/local-config.d.ts +2 -1
- package/dist/lib/bot/local-config.js +4 -0
- package/dist/lib/bot/progress.d.ts +25 -0
- package/dist/lib/bot/progress.js +39 -1
- package/dist/lib/bot/prompt.d.ts +2 -0
- package/dist/lib/bot/prompt.js +12 -2
- package/dist/lib/bot/run.js +10 -2
- package/dist/lib/lanes/store.d.ts +3 -0
- package/dist/lib/lanes/store.js +82 -3
- package/dist/lib/lanes/types.d.ts +4 -0
- package/dist/lib/lanes/types.js +1 -1
- package/dist/node-network-compat.d.ts +1 -10
- package/dist/node-network-compat.js +3 -70
- package/package.json +1 -1
- package/dist/node-network-compat-flag.d.ts +0 -19
- package/dist/node-network-compat-flag.js +0 -87
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Node network defaults for HQ CLI entry points.
|
|
3
3
|
*
|
|
4
|
-
* The compatibility timeout remains the default
|
|
5
|
-
* advertised but unusable, the default-off hq-flags gate can also prefer IPv4
|
|
6
|
-
* and disable automatic family racing before the CLI issues its first request.
|
|
4
|
+
* The compatibility timeout remains the default for HQ CLI entry points.
|
|
7
5
|
*
|
|
8
6
|
* Keep this module safe to import immediately after the Node version preflight.
|
|
9
|
-
* The hq-flags reader loads dynamically so an unsupported runtime exits through
|
|
10
|
-
* the preflight rather than failing during module linking.
|
|
11
7
|
*/
|
|
12
|
-
import * as nodeDns from "node:dns";
|
|
13
8
|
import * as nodeNet from "node:net";
|
|
14
9
|
export const HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS = 1000;
|
|
15
10
|
const ATTEMPT_TIMEOUT_OPTION = "--network-family-autoselection-attempt-timeout";
|
|
@@ -19,18 +14,6 @@ function hasExplicitAttemptTimeout(nodeOptions, execArgv) {
|
|
|
19
14
|
execArgv.some((argument) => argument === ATTEMPT_TIMEOUT_OPTION ||
|
|
20
15
|
argument.startsWith(ATTEMPT_TIMEOUT_OPTION + "=")));
|
|
21
16
|
}
|
|
22
|
-
function hasExplicitFamilySelection(nodeOptions, execArgv) {
|
|
23
|
-
const optionPattern = /(?:^|\s)(?:--network-family-autoselection|--enable-network-family-autoselection|--no-network-family-autoselection|--dns-result-order)(?:=|\s|$)/;
|
|
24
|
-
return (optionPattern.test(nodeOptions) ||
|
|
25
|
-
execArgv.some((argument) => argument === "--network-family-autoselection" ||
|
|
26
|
-
argument === "--enable-network-family-autoselection" ||
|
|
27
|
-
argument === "--no-network-family-autoselection" ||
|
|
28
|
-
argument === "--dns-result-order" ||
|
|
29
|
-
argument.startsWith("--network-family-autoselection=") ||
|
|
30
|
-
argument.startsWith("--enable-network-family-autoselection=") ||
|
|
31
|
-
argument.startsWith("--no-network-family-autoselection=") ||
|
|
32
|
-
argument.startsWith("--dns-result-order=")));
|
|
33
|
-
}
|
|
34
17
|
function resolveSetAttemptTimeout(override) {
|
|
35
18
|
if (override === null)
|
|
36
19
|
return undefined;
|
|
@@ -39,69 +22,19 @@ function resolveSetAttemptTimeout(override) {
|
|
|
39
22
|
const fn = nodeNet.setDefaultAutoSelectFamilyAttemptTimeout;
|
|
40
23
|
return typeof fn === "function" ? fn.bind(nodeNet) : undefined;
|
|
41
24
|
}
|
|
42
|
-
function resolveSetAutoSelectFamily(override) {
|
|
43
|
-
if (override === null)
|
|
44
|
-
return undefined;
|
|
45
|
-
if (override)
|
|
46
|
-
return override;
|
|
47
|
-
const fn = nodeNet.setDefaultAutoSelectFamily;
|
|
48
|
-
return typeof fn === "function" ? fn.bind(nodeNet) : undefined;
|
|
49
|
-
}
|
|
50
|
-
function resolveSetDefaultResultOrder(override) {
|
|
51
|
-
if (override === null)
|
|
52
|
-
return undefined;
|
|
53
|
-
if (override)
|
|
54
|
-
return override;
|
|
55
|
-
const fn = nodeDns.setDefaultResultOrder;
|
|
56
|
-
return typeof fn === "function" ? fn.bind(nodeDns) : undefined;
|
|
57
|
-
}
|
|
58
|
-
function applyIpv4Preference(options, nodeOptions, execArgv) {
|
|
59
|
-
if (!options.forceIpv4 || hasExplicitFamilySelection(nodeOptions, execArgv)) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
const setAutoSelectFamily = resolveSetAutoSelectFamily(options.setAutoSelectFamily);
|
|
63
|
-
const setDefaultResultOrder = resolveSetDefaultResultOrder(options.setDefaultResultOrder);
|
|
64
|
-
if (!setAutoSelectFamily || !setDefaultResultOrder)
|
|
65
|
-
return false;
|
|
66
|
-
setDefaultResultOrder("ipv4first");
|
|
67
|
-
setAutoSelectFamily(false);
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
25
|
export function configureNodeNetworkCompatibility(options = {}) {
|
|
71
26
|
const nodeOptions = options.nodeOptions ?? process.env.NODE_OPTIONS ?? "";
|
|
72
27
|
const execArgv = options.execArgv ?? process.execArgv;
|
|
73
|
-
const ipv4Applied = applyIpv4Preference(options, nodeOptions, execArgv);
|
|
74
28
|
if (hasExplicitAttemptTimeout(nodeOptions, execArgv)) {
|
|
75
|
-
return
|
|
29
|
+
return false;
|
|
76
30
|
}
|
|
77
31
|
const setAttemptTimeout = resolveSetAttemptTimeout(options.setAttemptTimeout);
|
|
78
32
|
if (!setAttemptTimeout) {
|
|
79
33
|
// Runtime lacks the API; the Node preflight should already have exited.
|
|
80
|
-
return
|
|
34
|
+
return false;
|
|
81
35
|
}
|
|
82
36
|
setAttemptTimeout(HQ_NETWORK_FAMILY_ATTEMPT_TIMEOUT_MS);
|
|
83
37
|
return true;
|
|
84
38
|
}
|
|
85
|
-
async function applyHqFlaggedIpv4Preference() {
|
|
86
|
-
try {
|
|
87
|
-
const { nodeNetworkForceIpv4Enabled } = await import("./node-network-compat-flag.js");
|
|
88
|
-
if (nodeNetworkForceIpv4Enabled &&
|
|
89
|
-
(await nodeNetworkForceIpv4Enabled())) {
|
|
90
|
-
configureNodeNetworkCompatibility({ forceIpv4: true });
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
const rawName = error instanceof Error ? error.name : "UnknownError";
|
|
95
|
-
const errorName = /^[A-Za-z][A-Za-z0-9]{0,63}$/.test(rawName)
|
|
96
|
-
? rawName
|
|
97
|
-
: "UnknownError";
|
|
98
|
-
process.stderr.write("HQ network IPv4 flag lookup failed (" +
|
|
99
|
-
errorName +
|
|
100
|
-
"); using default off.\n");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
// Preserve the historical timeout before any flag request. If the hq-flags
|
|
104
|
-
// lookup succeeds, the IPv4 preference is applied before command dispatch.
|
|
105
39
|
configureNodeNetworkCompatibility();
|
|
106
|
-
await applyHqFlaggedIpv4Preference();
|
|
107
40
|
//# sourceMappingURL=node-network-compat.js.map
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { FlagClient, FlagClientOptions } from "@indigoai-us/hq-flags-client";
|
|
2
|
-
export declare const NODE_NETWORK_FORCE_IPV4_FLAG = "cli.network.force-ipv4";
|
|
3
|
-
export declare const NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK = false;
|
|
4
|
-
export declare const NODE_NETWORK_FORCE_IPV4_FLAG_TIMEOUT_MS = 1500;
|
|
5
|
-
type NetworkFlagClient = Pick<FlagClient, "ready" | "isEnabled" | "close">;
|
|
6
|
-
export interface NodeNetworkForceIpv4Dependencies {
|
|
7
|
-
env?: NodeJS.ProcessEnv;
|
|
8
|
-
createClient?: (options: FlagClientOptions) => NetworkFlagClient;
|
|
9
|
-
getToken?: () => string | Promise<string>;
|
|
10
|
-
reportFailure?: (error: unknown) => void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Read the opt-in hq-flags gate before CLI dispatch. Local hq-flags overrides
|
|
14
|
-
* work without a token or endpoint; service decisions require a company
|
|
15
|
-
* identity and use a short request deadline so startup remains bounded.
|
|
16
|
-
*/
|
|
17
|
-
export declare function nodeNetworkForceIpv4Enabled(dependencies?: NodeNetworkForceIpv4Dependencies): Promise<boolean>;
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=node-network-compat-flag.d.ts.map
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { createFlagClient, readLocalOverride } from "@indigoai-us/hq-flags-client";
|
|
2
|
-
import { resolveFlagRegistryEndpoint } from "./lib/flag-registry-endpoint.js";
|
|
3
|
-
export const NODE_NETWORK_FORCE_IPV4_FLAG = "cli.network.force-ipv4";
|
|
4
|
-
export const NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK = false;
|
|
5
|
-
// Node waits up to 1s before trying the next address family. Keep this request
|
|
6
|
-
// deadline above that wait so a dead IPv6 path can reach the usable IPv4 host.
|
|
7
|
-
export const NODE_NETWORK_FORCE_IPV4_FLAG_TIMEOUT_MS = 1_500;
|
|
8
|
-
function safeErrorClass(error) {
|
|
9
|
-
const name = error instanceof Error ? error.name : "UnknownError";
|
|
10
|
-
return /^[A-Za-z][A-Za-z0-9]{0,63}$/.test(name)
|
|
11
|
-
? name
|
|
12
|
-
: "UnknownError";
|
|
13
|
-
}
|
|
14
|
-
function reportFlagFailure(error) {
|
|
15
|
-
process.stderr.write("HQ network IPv4 flag lookup failed (" +
|
|
16
|
-
safeErrorClass(error) +
|
|
17
|
-
"); using default off.\n");
|
|
18
|
-
}
|
|
19
|
-
async function loadCachedIdToken() {
|
|
20
|
-
const { loadCachedTokens } = await import("@indigoai-us/hq-cloud");
|
|
21
|
-
return loadCachedTokens()?.idToken ?? "";
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Read the opt-in hq-flags gate before CLI dispatch. Local hq-flags overrides
|
|
25
|
-
* work without a token or endpoint; service decisions require a company
|
|
26
|
-
* identity and use a short request deadline so startup remains bounded.
|
|
27
|
-
*/
|
|
28
|
-
export async function nodeNetworkForceIpv4Enabled(dependencies = {}) {
|
|
29
|
-
const env = dependencies.env ?? process.env;
|
|
30
|
-
const localOverride = readLocalOverride(NODE_NETWORK_FORCE_IPV4_FLAG, env);
|
|
31
|
-
if (localOverride !== null)
|
|
32
|
-
return localOverride;
|
|
33
|
-
const endpoint = resolveFlagRegistryEndpoint(undefined, env);
|
|
34
|
-
const companyUid = env.HQ_COMPANY_UID?.trim() || "";
|
|
35
|
-
if (!/^cmp_[A-Za-z0-9]{3,128}$/.test(companyUid)) {
|
|
36
|
-
return NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK;
|
|
37
|
-
}
|
|
38
|
-
const companySlug = env.HQ_COMPANY_SLUG?.trim() || "";
|
|
39
|
-
let client;
|
|
40
|
-
let failed = false;
|
|
41
|
-
let failureReported = false;
|
|
42
|
-
let enabled = NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK;
|
|
43
|
-
const reportFailureOnce = (error) => {
|
|
44
|
-
failed = true;
|
|
45
|
-
if (failureReported)
|
|
46
|
-
return;
|
|
47
|
-
failureReported = true;
|
|
48
|
-
(dependencies.reportFailure ?? reportFlagFailure)(error);
|
|
49
|
-
};
|
|
50
|
-
try {
|
|
51
|
-
const token = await (dependencies.getToken ?? loadCachedIdToken)();
|
|
52
|
-
if (!token)
|
|
53
|
-
return NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK;
|
|
54
|
-
const createClient = dependencies.createClient ?? createFlagClient;
|
|
55
|
-
client = createClient({
|
|
56
|
-
endpoint,
|
|
57
|
-
companyUid,
|
|
58
|
-
...(companySlug && /^[A-Za-z0-9][A-Za-z0-9-]{0,63}$/.test(companySlug)
|
|
59
|
-
? { companyIdentifiers: [companySlug] }
|
|
60
|
-
: {}),
|
|
61
|
-
env: {},
|
|
62
|
-
getToken: () => token,
|
|
63
|
-
refreshIntervalMs: 0,
|
|
64
|
-
requestTimeoutMs: NODE_NETWORK_FORCE_IPV4_FLAG_TIMEOUT_MS,
|
|
65
|
-
onError: reportFailureOnce,
|
|
66
|
-
});
|
|
67
|
-
await client.ready();
|
|
68
|
-
if (!failed) {
|
|
69
|
-
enabled = client.isEnabled(NODE_NETWORK_FORCE_IPV4_FLAG, {
|
|
70
|
-
fallback: NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
catch (error) {
|
|
75
|
-
reportFailureOnce(error);
|
|
76
|
-
}
|
|
77
|
-
finally {
|
|
78
|
-
try {
|
|
79
|
-
client?.close();
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
reportFailureOnce(error);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return failed ? NODE_NETWORK_FORCE_IPV4_FLAG_FALLBACK : enabled;
|
|
86
|
-
}
|
|
87
|
-
//# sourceMappingURL=node-network-compat-flag.js.map
|