@clipboard-health/groundcrew 3.0.1 → 3.0.3

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/README.md CHANGED
@@ -192,7 +192,7 @@ Agent selection uses Linear labels: `agent-claude`, `agent-codex`, `agent-<name>
192
192
  | `models.definitions` | `{ claude, codex }` | Agent definitions. Additive merge with shipped defaults. |
193
193
  | `models.definitions.<name>.cmd` | — | Shell command launched for the model. Runs in the worktree through the resolved `local.runner`. `{{worktree}}` is replaced before launch; `{{sandbox}}` expands to the sbx sandbox name under the sdx runner and an empty string otherwise. |
194
194
  | `models.definitions.<name>.color` | — | Color for the workspace status pill (cmux only; tmux silently drops it). |
195
- | `models.definitions.<name>.usage` | optional | If set, codexbar usage is fetched for this model and gated by `sessionLimitPercentage`. Omit to never gate. When `usage.codexbar.source` is omitted, groundcrew uses `auto` on macOS and `cli` elsewhere. |
195
+ | `models.definitions.<name>.usage` | optional | If set, codexbar usage is fetched for this model and gated by `sessionLimitPercentage`. Omit to never gate. When `usage.codexbar.source` is omitted, groundcrew uses `oauth` for Codex/Claude on macOS, `auto` for other macOS providers, and `cli` elsewhere. |
196
196
  | `models.definitions.<name>.sandbox` | optional | Docker Sandboxes binding for the model. Required at launch when `local.runner` resolves to `sdx`. Fields: `agent` (required sbx agent name), `template`, `kits`, `setupCommand` (override for the inside-sandbox setup script). |
197
197
  | `models.definitions.<name>.disabled` | optional | When set to exactly `true`, drops the named shipped default (`claude` or `codex`). Doctor skips probing it; `agent-<name>` labels fall back to `models.default` with a warning. |
198
198
  | `prompts.initial` | (template) | First message sent to the agent. Placeholders: `{{ticket}}`, `{{worktree}}`, `{{title}}`, `{{description}}`. |
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAsHD,wBAAsB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAK1E"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAgHD,wBAAsB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAK1E"}
@@ -6,6 +6,7 @@ import { existsSync, statSync } from "node:fs";
6
6
  import { loadConfig, } from "../lib/config.js";
7
7
  import { detectHostCapabilities, which } from "../lib/host.js";
8
8
  import { resolveLocalRunner } from "../lib/localRunner.js";
9
+ import { gatedModels } from "../lib/usage.js";
9
10
  import { errorMessage, resolveLinearApiKey, writeOutput } from "../lib/util.js";
10
11
  import { resolveWorkspaceKind } from "../lib/workspaces.js";
11
12
  import { parseTicketDoctorFlags, runTicketDoctor } from "./ticketDoctor.js";
@@ -104,9 +105,6 @@ function gatherToolTokens(config) {
104
105
  }
105
106
  return [...all];
106
107
  }
107
- function anyModelUsesUsage(config) {
108
- return Object.values(config.models.definitions).some((definition) => definition.usage !== undefined);
109
- }
110
108
  function format(check) {
111
109
  let tag;
112
110
  if (check.ok) {
@@ -189,8 +187,21 @@ async function doctorHost() {
189
187
  const check = await checkCmd(token, required, required ? undefined : "required for local runs");
190
188
  checks.push(check);
191
189
  }
192
- if (anyModelUsesUsage(config)) {
193
- checks.push(await checkCmd("codexbar", false, "optional — only used for usage gating"));
190
+ const usageGatedModels = gatedModels(config);
191
+ if (usageGatedModels.length > 0) {
192
+ const codexbarPath = await which("codexbar");
193
+ if (codexbarPath === undefined) {
194
+ const modelList = usageGatedModels.map((name) => `\`${name}\``).join(", ");
195
+ checks.push({
196
+ name: "codexbar",
197
+ ok: false,
198
+ required: true,
199
+ hint: `required for usage gating on ${modelList} — install codexbar, or set \`models.definitions.<name>.usage\` to disable gating`,
200
+ });
201
+ }
202
+ else {
203
+ checks.push({ name: "codexbar", ok: true, required: true, hint: codexbarPath });
204
+ }
194
205
  }
195
206
  for (const check of checks) {
196
207
  if (check === localCapability) {
@@ -22,6 +22,7 @@ export type UsageByModel = Record<string, NormalizedUsage>;
22
22
  * exists to close.
23
23
  */
24
24
  export declare const EXHAUSTED_USAGE: NormalizedUsage;
25
+ export declare function gatedModels(config: ResolvedConfig): string[];
25
26
  export declare function getUsageByModel(config: ResolvedConfig, signal?: AbortSignal): Promise<UsageByModel>;
26
27
  export {};
27
28
  //# sourceMappingURL=usage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/lib/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;AA+BnE,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,eAK7B,CAAC;AAyGF,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,CA6BvB"}
1
+ {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/lib/usage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;AA+BnE,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,EAAE,eAK7B,CAAC;AA2GF,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,EAAE,CAI5D;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,YAAY,CAAC,CA6BvB"}
package/dist/lib/usage.js CHANGED
@@ -24,8 +24,16 @@ export const EXHAUSTED_USAGE = {
24
24
  const MS_PER_MINUTE = 60_000;
25
25
  const PERCENT_FRACTION_DIVISOR = 100;
26
26
  const CODEXBAR_TIMEOUT_MS = 30_000;
27
- function defaultCodexbarSource() {
28
- return process.platform === "darwin" ? "auto" : "cli";
27
+ function defaultCodexbarSource(provider) {
28
+ if (process.platform !== "darwin") {
29
+ return "cli";
30
+ }
31
+ // codexbar's CLI `auto` for Codex/Claude probes browser sessions before OAuth,
32
+ // while the menu bar app prefers OAuth. Match the app so gates follow the CLI account.
33
+ if (provider === "codex" || provider === "claude") {
34
+ return "oauth";
35
+ }
36
+ return "auto";
29
37
  }
30
38
  async function codexbarUsage(definition, signal) {
31
39
  /* v8 ignore next 3 @preserve -- callers filter to definitions with usage; this is a defensive guard */
@@ -34,7 +42,7 @@ async function codexbarUsage(definition, signal) {
34
42
  }
35
43
  const { provider } = definition.usage.codexbar;
36
44
  const configuredSource = definition.usage.codexbar.source;
37
- const source = configuredSource ?? defaultCodexbarSource();
45
+ const source = configuredSource ?? defaultCodexbarSource(provider);
38
46
  const arguments_ = [
39
47
  "usage",
40
48
  "--provider",
@@ -103,7 +111,7 @@ function normalize(usage) {
103
111
  weekEndDuration: minutesUntil(usage.secondary?.resetsAt),
104
112
  };
105
113
  }
106
- function gatedModels(config) {
114
+ export function gatedModels(config) {
107
115
  return Object.entries(config.models.definitions)
108
116
  .filter(([, definition]) => definition.usage !== undefined)
109
117
  .map(([name]) => name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipboard-health/groundcrew",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Linear-driven orchestrator that launches AI coding agents in git worktrees, with workspace lifecycle and usage tracking.",
5
5
  "keywords": [
6
6
  "agent",