@dosu/cli 0.55.0 → 0.56.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 (2) hide show
  1. package/bin/dosu.js +41 -10
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -1050,7 +1050,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
1050
1050
  function getVersionString() {
1051
1051
  return `v${VERSION}`;
1052
1052
  }
1053
- var VERSION = "0.55.0", INSTALL_CHANNEL = "npm";
1053
+ var VERSION = "0.56.0", INSTALL_CHANNEL = "npm";
1054
1054
 
1055
1055
  // src/debug/logger.ts
1056
1056
  import {
@@ -13604,10 +13604,12 @@ async function runKnowledgeSync(options = {}) {
13604
13604
  return { status: "skipped-gateway", ...base, studiedSessions: 0, learner };
13605
13605
  }
13606
13606
  default: {
13607
+ const at = now().toISOString();
13607
13608
  saveState({
13608
13609
  ...state,
13609
- last_attempt_at: now().toISOString(),
13610
- consecutive_failures: state.consecutive_failures + 1
13610
+ last_attempt_at: at,
13611
+ consecutive_failures: state.consecutive_failures + 1,
13612
+ ...learner.outcome === "gateway_rejected" && learner.message ? { last_refusal: { at, outcome: learner.outcome, message: learner.message } } : {}
13611
13613
  });
13612
13614
  logger.debug("sync", `studying failed: ${learner.outcome}; ${learner.message ?? ""}`);
13613
13615
  return {
@@ -13635,7 +13637,7 @@ var init_sync = __esm(() => {
13635
13637
  });
13636
13638
 
13637
13639
  // src/telemetry/debug-id.ts
13638
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "b4f16876-0cf8-4262-6475-6e2164756e21";
13640
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "2f023ff0-da66-217c-6475-6e2164756e21";
13639
13641
 
13640
13642
  // src/telemetry/telemetry.ts
13641
13643
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -14471,6 +14473,7 @@ var init_telemetry = __esm(() => {
14471
14473
  "consent_off",
14472
14474
  "credit_limit",
14473
14475
  "quota_exceeded",
14476
+ "gateway_rejected",
14474
14477
  "error"
14475
14478
  ]);
14476
14479
  BACKFILL_OFFERS = new Set([
@@ -15079,6 +15082,7 @@ function buildLearnerEnv(options) {
15079
15082
  env.ANTHROPIC_CUSTOM_HEADERS = headers.join(`
15080
15083
  `);
15081
15084
  env.CLAUDE_CONFIG_DIR = options.configDir;
15085
+ env.CLAUDE_CODE_MAX_OUTPUT_TOKENS = "32000";
15082
15086
  env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1";
15083
15087
  env.DISABLE_TELEMETRY = "1";
15084
15088
  env.DISABLE_ERROR_REPORTING = "1";
@@ -58100,6 +58104,21 @@ function snippet(value) {
58100
58104
  const flat = (text ?? "").replace(/\s+/g, " ").trim();
58101
58105
  return flat.length > TRACE_SNIPPET_LIMIT ? `${flat.slice(0, TRACE_SNIPPET_LIMIT)}…` : flat;
58102
58106
  }
58107
+ function classifyGatewayRejection(text) {
58108
+ const match = API_400_PATTERN.exec(text);
58109
+ if (!match)
58110
+ return null;
58111
+ let detail = match[1];
58112
+ try {
58113
+ const body = JSON.parse(detail);
58114
+ if (typeof body.error?.message === "string")
58115
+ detail = body.error.message;
58116
+ } catch {}
58117
+ return {
58118
+ outcome: "gateway_rejected",
58119
+ message: `LLM gateway rejected the study run: ${snippet(detail)}`
58120
+ };
58121
+ }
58103
58122
  function traceAgentMessage(message) {
58104
58123
  const msg = message;
58105
58124
  const content = msg.message?.content;
@@ -58242,7 +58261,7 @@ async function runLearner(options) {
58242
58261
  if (message.type === "result") {
58243
58262
  turns = message.num_turns;
58244
58263
  const text = message.subtype === "success" ? message.result : message.subtype;
58245
- const gatewayError = classifyGatewayError(text ?? "");
58264
+ const gatewayError = classifyGatewayError(text ?? "") ?? (message.is_error ? classifyGatewayRejection(text ?? "") : null);
58246
58265
  if (gatewayError) {
58247
58266
  return {
58248
58267
  outcome: gatewayError.outcome,
@@ -58272,7 +58291,7 @@ async function runLearner(options) {
58272
58291
  };
58273
58292
  } catch (error) {
58274
58293
  const text = error instanceof Error ? error.message : String(error);
58275
- const gatewayError = classifyGatewayError(text);
58294
+ const gatewayError = classifyGatewayError(text) ?? classifyGatewayRejection(text);
58276
58295
  if (gatewayError) {
58277
58296
  return { outcome: gatewayError.outcome, notesWritten, turns, message: gatewayError.message };
58278
58297
  }
@@ -58288,7 +58307,7 @@ async function runLearner(options) {
58288
58307
  configDir.cleanup();
58289
58308
  }
58290
58309
  }
58291
- var DEFAULT_MAX_TURNS = 160, DEFAULT_MAX_NOTES = 80, DEFAULT_TIMEOUT_MS2, KNOWLEDGE_SERVER_NAME = "dosu", GATEWAY_ERRORS, TRACE_SNIPPET_LIMIT = 400;
58310
+ var DEFAULT_MAX_TURNS = 160, DEFAULT_MAX_NOTES = 80, DEFAULT_TIMEOUT_MS2, KNOWLEDGE_SERVER_NAME = "dosu", GATEWAY_ERRORS, TRACE_SNIPPET_LIMIT = 400, API_400_PATTERN;
58292
58311
  var init_runner = __esm(() => {
58293
58312
  init_logger();
58294
58313
  init_config_helpers();
@@ -58313,6 +58332,7 @@ var init_runner = __esm(() => {
58313
58332
  message: "Daily Dosu Remote Sessions budget reached; runs resume tomorrow."
58314
58333
  }
58315
58334
  };
58335
+ API_400_PATTERN = /API Error: 400\b\s*(.*)/s;
58316
58336
  });
58317
58337
 
58318
58338
  // src/commands/knowledge.ts
@@ -62572,10 +62592,18 @@ function allowlistedWorkflowProperties(properties) {
62572
62592
  if (Array.isArray(input.providers)) {
62573
62593
  safe.providers = input.providers.filter((provider) => typeof provider === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(provider)).slice(0, 50);
62574
62594
  }
62575
- for (const key of ["completed_mcp", "completed_skill", "completed_agents_md"]) {
62595
+ for (const key of [
62596
+ "completed_mcp",
62597
+ "completed_skill",
62598
+ "completed_agents_md",
62599
+ "completed_hooks"
62600
+ ]) {
62576
62601
  if (typeof input[key] === "boolean")
62577
62602
  safe[key] = input[key];
62578
62603
  }
62604
+ if (typeof input.hook_count === "number" && Number.isInteger(input.hook_count) && input.hook_count >= 0 && input.hook_count <= 50) {
62605
+ safe.hook_count = input.hook_count;
62606
+ }
62579
62607
  return safe;
62580
62608
  }
62581
62609
  function safeIdentifier(value, maxLength) {
@@ -63252,10 +63280,13 @@ async function runSetupFlow(opts = {}) {
63252
63280
  agentsMdCompleted = await stepUpdateAgentsMd();
63253
63281
  }
63254
63282
  if (mcpCompleted || skillCompleted || agentsMdCompleted) {
63283
+ const hookCount = configuredProviders.filter((result) => result.hook).length;
63255
63284
  trackInBackground(trackCliOnboardingEvent(cfg, onboardingRunID, "cli_onboarding_completed", {
63256
63285
  completed_mcp: mcpCompleted,
63257
63286
  completed_skill: skillCompleted,
63258
- completed_agents_md: agentsMdCompleted
63287
+ completed_agents_md: agentsMdCompleted,
63288
+ completed_hooks: hookCount > 0,
63289
+ hook_count: hookCount
63259
63290
  }));
63260
63291
  }
63261
63292
  if (mcpCompleted && cfg.mode !== MODE_OSS) {
@@ -66385,4 +66416,4 @@ main().catch((err) => {
66385
66416
  process.exit(1);
66386
66417
  });
66387
66418
 
66388
- //# debugId=b4f16876-0cf8-4262-6475-6e2164756e21
66419
+ //# debugId=2f023ff0-da66-217c-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.55.0",
3
+ "version": "0.56.0",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Manage MCP servers for AI tools",
6
6
  "license": "MIT",