@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.
Files changed (103) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/command-catalog.generated.d.ts +134 -7
  3. package/dist/command-catalog.generated.js +168 -7
  4. package/dist/commands/agents.d.ts +51 -1
  5. package/dist/commands/agents.js +154 -2
  6. package/dist/commands/bot-jobs.d.ts +2 -15
  7. package/dist/commands/bot-jobs.js +2 -94
  8. package/dist/commands/bot-runtime.d.ts +46 -5
  9. package/dist/commands/bot-runtime.js +228 -18
  10. package/dist/commands/bot.d.ts +16 -9
  11. package/dist/commands/bot.js +169 -51
  12. package/dist/commands/cloud.d.ts +66 -13
  13. package/dist/commands/cloud.js +120 -39
  14. package/dist/commands/company-restore.d.ts +23 -0
  15. package/dist/commands/company-restore.js +128 -0
  16. package/dist/commands/company.js +2 -0
  17. package/dist/commands/integrations-connect.d.ts +10 -3
  18. package/dist/commands/integrations-connect.js +87 -13
  19. package/dist/commands/lanes.js +26 -9
  20. package/dist/commands/sources.js +6 -0
  21. package/dist/commands/storage-offload.d.ts +12 -0
  22. package/dist/commands/storage-offload.js +41 -3
  23. package/dist/commands/sync-mode.js +5 -0
  24. package/dist/commands/whoami.js +4 -0
  25. package/dist/lib/bot/config.d.ts +1 -0
  26. package/dist/lib/bot/config.js +10 -0
  27. package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
  28. package/dist/lib/bot/eventbridge-cron.js +104 -0
  29. package/dist/lib/bot/fleet-local.d.ts +33 -1
  30. package/dist/lib/bot/fleet-local.js +215 -31
  31. package/dist/lib/bot/fleet-python.d.ts +3 -0
  32. package/dist/lib/bot/fleet-python.js +34 -4
  33. package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
  34. package/dist/lib/bot/fleet-runtime-sources.js +30 -0
  35. package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
  36. package/dist/lib/bot/legacy-provider-login.js +19 -2
  37. package/dist/lib/bot/prompt.js +1 -1
  38. package/dist/lib/bot/readiness.d.ts +8 -0
  39. package/dist/lib/bot/readiness.js +17 -3
  40. package/dist/lib/bot/runtime-auth.d.ts +30 -0
  41. package/dist/lib/bot/runtime-auth.js +94 -3
  42. package/dist/lib/bot/status.d.ts +2 -0
  43. package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
  44. package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
  45. package/dist/lib/capacity/collectors/grok.d.ts +5 -0
  46. package/dist/lib/capacity/collectors/grok.js +56 -5
  47. package/dist/lib/daemon/catalog.js +11 -1
  48. package/dist/lib/db/sqlite-binding.d.ts +1 -0
  49. package/dist/lib/db/sqlite-binding.js +1 -1
  50. package/dist/lib/delivery/artifacts.d.ts +99 -0
  51. package/dist/lib/delivery/artifacts.js +548 -0
  52. package/dist/lib/delivery/backup.d.ts +78 -0
  53. package/dist/lib/delivery/backup.js +343 -0
  54. package/dist/lib/delivery/cache.d.ts +29 -0
  55. package/dist/lib/delivery/cache.js +33 -0
  56. package/dist/lib/delivery/contracts.d.ts +142 -0
  57. package/dist/lib/delivery/contracts.js +289 -0
  58. package/dist/lib/delivery/credentials.d.ts +54 -0
  59. package/dist/lib/delivery/credentials.js +119 -0
  60. package/dist/lib/delivery/enrollment.d.ts +142 -0
  61. package/dist/lib/delivery/enrollment.js +382 -0
  62. package/dist/lib/delivery/identity.d.ts +25 -0
  63. package/dist/lib/delivery/identity.js +82 -0
  64. package/dist/lib/delivery/inbox.d.ts +116 -0
  65. package/dist/lib/delivery/inbox.js +260 -0
  66. package/dist/lib/delivery/migrations.d.ts +139 -0
  67. package/dist/lib/delivery/migrations.js +623 -0
  68. package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
  69. package/dist/lib/delivery/mqtt-adapter.js +242 -0
  70. package/dist/lib/delivery/mqtt.d.ts +61 -0
  71. package/dist/lib/delivery/mqtt.js +112 -0
  72. package/dist/lib/delivery/outbox.d.ts +95 -0
  73. package/dist/lib/delivery/outbox.js +187 -0
  74. package/dist/lib/delivery/provenance.d.ts +129 -0
  75. package/dist/lib/delivery/provenance.js +93 -0
  76. package/dist/lib/delivery/reconciler.d.ts +151 -0
  77. package/dist/lib/delivery/reconciler.js +492 -0
  78. package/dist/lib/delivery/restore.d.ts +35 -0
  79. package/dist/lib/delivery/restore.js +134 -0
  80. package/dist/lib/delivery/store.d.ts +161 -0
  81. package/dist/lib/delivery/store.js +940 -0
  82. package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
  83. package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
  84. package/dist/lib/delivery/workers/macos.d.ts +176 -0
  85. package/dist/lib/delivery/workers/macos.js +901 -0
  86. package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
  87. package/dist/lib/delivery/workers/windows-boundary.js +693 -0
  88. package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
  89. package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
  90. package/dist/lib/delivery/workers/windows.d.ts +241 -0
  91. package/dist/lib/delivery/workers/windows.js +608 -0
  92. package/dist/lib/install/provider-wrappers.d.ts +2 -0
  93. package/dist/lib/install/provider-wrappers.js +68 -3
  94. package/dist/utils/cognito-callback-port.d.ts +14 -0
  95. package/dist/utils/cognito-callback-port.js +24 -0
  96. package/dist/utils/cognito-session.js +3 -3
  97. package/dist/utils/deleted-company-notice.d.ts +59 -0
  98. package/dist/utils/deleted-company-notice.js +156 -0
  99. package/dist/utils/login-browser.d.ts +1 -1
  100. package/dist/utils/login-browser.js +7 -5
  101. package/dist/utils/resident-package-preload.js +30 -15
  102. package/dist/utils/vault-api.js +7 -0
  103. package/package.json +7 -7
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The native macOS containment supervisor (US-007), as C source.
3
+ *
4
+ * Node cannot put a process tree in a sandbox or tell which processes belong
5
+ * to one job once they leave the process group, so the worker compiles this
6
+ * source once with the system C compiler (/usr/bin/cc, from the Command Line
7
+ * Tools) and runs the result as a small supervisor per job. No package or
8
+ * system software is installed and nothing is registered with launchd.
9
+ *
10
+ * Protocol. The worker writes the spec to the helper's stdin as
11
+ * "key<TAB>base64(utf8 value)" lines ended by "end". Keys: app, arg (one line
12
+ * per argument, argv[0] first), cwd, log, env (one line per KEY=VALUE), mem
13
+ * (bytes), procs, cpu (ms), profile (the Seatbelt profile), mark and ctrl
14
+ * (the job's marker and control files), win (the cleanup window in ms,
15
+ * default 2000), seen (how many distinct processes the helper tracks,
16
+ * default 8192), fsize and nofile (RLIMIT_FSIZE and RLIMIT_NOFILE, unset when
17
+ * absent), room (the RLIMIT_NPROC room above procs) and sample ("0" turns the
18
+ * sampled limits off; tests use it to prove the kernel limits alone). The
19
+ * helper writes one event per stdout line:
20
+ * reaper <pid> the reaper (see below) is running
21
+ * watchdog <pid> the watchdog (see below) is running in the sandbox
22
+ * started <pid> the root process runs inside the job's sandbox
23
+ * process <pid> a process was seen in the job's sandbox
24
+ * exit <reason> <code> the tree is gone; reason is exited, cancelled,
25
+ * memory_limit, process_limit or cpu_limit (also
26
+ * when the kernel stopped the root with SIGXCPU)
27
+ * exit kill_incomplete -1
28
+ * members were still alive when the cleanup window
29
+ * ran out; the worker leaves the job directory for
30
+ * the next sweep
31
+ * exit protocol -1 the worker sent a stdin line longer than the
32
+ * helper's buffer; the tree was killed
33
+ * error <stage> <errno> the job could not be set up; nothing ran
34
+ * After "end", a stdin line "cancel", or stdin closing, kills the tree.
35
+ *
36
+ * Containment. The root process enters a per-job Seatbelt profile
37
+ * (sandbox_init) before exec. The profile denies reading the job's marker
38
+ * file, so every descendant, including ones that call setsid, are started
39
+ * detached, or are reparented to launchd, inherits it. The helper finds the
40
+ * tree by asking the kernel, for every process of the same user, whether that
41
+ * process may read the marker (it may not) and the control file next to it
42
+ * (it may): sandbox_check answers for a process that is not the caller. A
43
+ * process that passes both checks is in this job. The rest of the profile
44
+ * (reads, network, mach services, process inspection, signals, writes and
45
+ * exec) is built by the worker; see jobProfile in macos.ts.
46
+ *
47
+ * Kills. Each member is signalled only after its start time is read again and
48
+ * matches the scan that found it, and it still passes the membership checks,
49
+ * so a pid reused by an unrelated process is never signalled. Kills repeat
50
+ * until two scans in a row find nobody or the cleanup window ends; a window
51
+ * that ends with members alive is reported as kill_incomplete.
52
+ *
53
+ * Reaper. Before the job starts the helper forks a reaper outside the
54
+ * sandbox in its own session. The reaper waits on the helper's exit (kqueue
55
+ * NOTE_EXIT) and, if the helper dies without stopping it first, kills every
56
+ * member within the cleanup window and exits. So a tree whose helper and
57
+ * worker host both die is gone within the window, without a later prepare.
58
+ * The helper kills and waits for the reaper before every exit line.
59
+ *
60
+ * Watchdog. The reaper and the helper can both be killed at once. So the
61
+ * pre-exec child forks a watchdog after it enters the sandbox: it is in the
62
+ * job's sandbox but is not counted toward the job's limits. It holds the read
63
+ * end of a pipe whose only write ends the helper and the reaper hold, and
64
+ * blocks on it. When both are gone, however they died, the read returns EOF
65
+ * and the watchdog kills every process it can see and exits. The sandbox lets
66
+ * it see and signal only processes of its own sandbox, which is this job's
67
+ * tree. A normal exit kills the watchdog with the rest of the tree. Only the
68
+ * job itself can kill its watchdog early; then the prepare sweep is the
69
+ * fallback.
70
+ *
71
+ * Limits. The helper waits on kqueue for stdin, and for NOTE_FORK and
72
+ * NOTE_EXIT on every member it has seen, so a fork wakes it to scan at once.
73
+ * Otherwise it samples every 10 ms when a memory limit is set and every 50 ms
74
+ * when not. Each 10 ms memory sample sums resident memory over the members the
75
+ * helper already knows: the root, children reported by fork notes, and members
76
+ * found by earlier scans. A member the fork notes missed is counted only after
77
+ * the next 50 ms discovery scan finds it. Each sample reads the kernel's task
78
+ * info: resident memory summed over live members, user plus system CPU time
79
+ * summed over every member seen (exited ones keep their last reading), and the
80
+ * count of live members. A full seen table is a process-limit breach.
81
+ *
82
+ * Kernel limits, set in the pre-exec child and inherited by every
83
+ * descendant: RLIMIT_CPU per process at ceil(cpu / 1000) s (SIGXCPU, then
84
+ * SIGKILL a second later); RLIMIT_NPROC at the user's process count now plus
85
+ * procs, the watchdog and room, a ceiling on the user's processes that a fork
86
+ * bomb cannot pass; RLIMIT_FSIZE and RLIMIT_NOFILE when declared; RLIMIT_CORE
87
+ * 0. RLIMIT_AS and RLIMIT_DATA return EINVAL on macOS and RLIMIT_RSS is not
88
+ * enforced, so memory has the sampled limit only, and the per-job process
89
+ * count is sampled because RLIMIT_NPROC counts every process of the user.
90
+ *
91
+ * Modes.
92
+ * --selftest <dir> checks membership, non-membership, the identity
93
+ * check before a signal and fork notes; prints one
94
+ * "check <name> <0|1>" line each, then "selftest ok",
95
+ * or "selftest failed" with exit 1
96
+ * --reap <marker> <control>
97
+ * kills every member of a job whose helper died
98
+ * --start <pid> prints "<sec> <usec>", the process start time
99
+ * --alive <pid> <sec> <usec>
100
+ * exits 0 only when that pid is alive with that start time
101
+ */
102
+ export declare const HELPER_SOURCE: string;
103
+ //# sourceMappingURL=macos-job-helper.d.ts.map