@dosu/cli 0.67.0-beta.7 → 0.67.0-beta.9

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 +231 -74
  2. package/package.json +1 -1
package/bin/dosu.js CHANGED
@@ -450,7 +450,7 @@ function isNpxInvocation(channel = INSTALL_CHANNEL, env = process.env) {
450
450
  function getVersionString() {
451
451
  return `v${VERSION}`;
452
452
  }
453
- var VERSION = "0.67.0-beta.7", INSTALL_CHANNEL = "npm";
453
+ var VERSION = "0.67.0-beta.9", INSTALL_CHANNEL = "npm";
454
454
 
455
455
  // src/debug/logger.ts
456
456
  import {
@@ -9580,10 +9580,14 @@ function headReflogOfDir(dir, timeout = 5000) {
9580
9580
  function displayRepo(repo) {
9581
9581
  return repo.split("/").slice(1).join("/") || repo;
9582
9582
  }
9583
- var GIT_LOCATION_ENV, GIT_TIMED_OUT;
9583
+ function githubSlugOfRepo(repo) {
9584
+ return repo === null ? null : GITHUB_SLUG.exec(repo)?.[1] ?? null;
9585
+ }
9586
+ var GIT_LOCATION_ENV, GIT_TIMED_OUT, GITHUB_SLUG;
9584
9587
  var init_repo = __esm(() => {
9585
9588
  GIT_LOCATION_ENV = ["GIT_DIR", "GIT_WORK_TREE", "GIT_COMMON_DIR", "GIT_INDEX_FILE"];
9586
9589
  GIT_TIMED_OUT = Symbol("git timed out");
9590
+ GITHUB_SLUG = /^github\.com\/([a-z0-9-]+\/[a-z0-9._-]+)$/;
9587
9591
  });
9588
9592
 
9589
9593
  // src/sync/lock.ts
@@ -22237,7 +22241,7 @@ var init_backlog = __esm(() => {
22237
22241
  });
22238
22242
 
22239
22243
  // src/telemetry/debug-id.ts
22240
- var BUNDLE_DEBUG_ID_PLACEHOLDER = "edd9dc12-2f93-0c3d-6475-6e2164756e21";
22244
+ var BUNDLE_DEBUG_ID_PLACEHOLDER = "d33cbd82-2145-b9b8-6475-6e2164756e21";
22241
22245
 
22242
22246
  // src/telemetry/telemetry.ts
22243
22247
  import { randomUUID as randomUUID2 } from "node:crypto";
@@ -23539,6 +23543,152 @@ var init_session_start = __esm(() => {
23539
23543
  init_normalize();
23540
23544
  });
23541
23545
 
23546
+ // src/shipper/usage.ts
23547
+ import { readFileSync as readFileSync25 } from "node:fs";
23548
+ function isObject7(value) {
23549
+ return typeof value === "object" && value !== null && !Array.isArray(value);
23550
+ }
23551
+ function str2(value) {
23552
+ return typeof value === "string" && value !== "" ? value : null;
23553
+ }
23554
+ function int(value) {
23555
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.trunc(value) : 0;
23556
+ }
23557
+ function parseLines(transcript) {
23558
+ const lines = [];
23559
+ for (const line of transcript.split(`
23560
+ `)) {
23561
+ if (line.trim() === "")
23562
+ continue;
23563
+ try {
23564
+ const value = JSON.parse(line);
23565
+ if (isObject7(value))
23566
+ lines.push(value);
23567
+ } catch {}
23568
+ }
23569
+ return lines;
23570
+ }
23571
+ function billed(request) {
23572
+ return request.input + request.output + request.cache_read + request.cache_write > 0 || request.tool_call_ids.length > 0;
23573
+ }
23574
+ function claudeUsage(transcript) {
23575
+ const requests = new Map;
23576
+ for (const line of parseLines(transcript)) {
23577
+ if (line.type !== "assistant" || !isObject7(line.message))
23578
+ continue;
23579
+ const message = line.message;
23580
+ const usage = message.usage;
23581
+ const id = str2(line.requestId) ?? str2(message.id) ?? str2(line.uuid);
23582
+ if (!isObject7(usage) || id === null)
23583
+ continue;
23584
+ const toolCallIds = Array.isArray(message.content) ? message.content.filter((block) => isObject7(block) && block.type === "tool_use").map((block) => str2(block.id)).filter((toolId) => toolId !== null) : [];
23585
+ const cacheCreation = isObject7(usage.cache_creation) ? usage.cache_creation : {};
23586
+ const entry = {
23587
+ id,
23588
+ model: str2(message.model),
23589
+ timestamp: str2(line.timestamp),
23590
+ input: int(usage.input_tokens),
23591
+ output: int(usage.output_tokens),
23592
+ cache_read: int(usage.cache_read_input_tokens),
23593
+ cache_write: int(usage.cache_creation_input_tokens),
23594
+ cache_write_1h: int(cacheCreation.ephemeral_1h_input_tokens),
23595
+ speed: str2(usage.speed),
23596
+ tool_call_ids: toolCallIds
23597
+ };
23598
+ const previous = requests.get(id);
23599
+ if (previous === undefined) {
23600
+ requests.set(id, entry);
23601
+ continue;
23602
+ }
23603
+ const latest = entry.output >= previous.output ? entry : previous;
23604
+ requests.set(id, {
23605
+ ...latest,
23606
+ timestamp: entry.timestamp ?? previous.timestamp,
23607
+ tool_call_ids: [...new Set([...previous.tool_call_ids, ...entry.tool_call_ids])]
23608
+ });
23609
+ }
23610
+ return [...requests.values()].filter(billed);
23611
+ }
23612
+ function codexUsage(transcript) {
23613
+ const requests = [];
23614
+ let model = null;
23615
+ let ownSessionId = null;
23616
+ let historyStart = null;
23617
+ let lastTotal = null;
23618
+ let toolCallIds = [];
23619
+ for (const line of parseLines(transcript)) {
23620
+ const payload = isObject7(line.payload) ? line.payload : {};
23621
+ const ordinal = typeof line.ordinal === "number" ? line.ordinal : null;
23622
+ if (historyStart !== null && ordinal !== null && ordinal < historyStart)
23623
+ continue;
23624
+ if (line.type === "session_meta") {
23625
+ const metaId = str2(payload.id);
23626
+ if (ownSessionId === null) {
23627
+ ownSessionId = metaId;
23628
+ if (str2(payload.forked_from_id) !== null) {
23629
+ const start = payload.subagent_history_start_ordinal;
23630
+ historyStart = typeof start === "number" ? start : null;
23631
+ }
23632
+ }
23633
+ } else if (line.type === "turn_context") {
23634
+ model = str2(payload.model) ?? model;
23635
+ } else if (line.type === "response_item") {
23636
+ const callId = str2(payload.call_id);
23637
+ if (callId !== null && typeof payload.type === "string" && payload.type.endsWith("_call")) {
23638
+ toolCallIds.push(callId);
23639
+ }
23640
+ } else if (line.type === "event_msg" && payload.type === "token_count") {
23641
+ const info = isObject7(payload.info) ? payload.info : null;
23642
+ const last = info && isObject7(info.last_token_usage) ? info.last_token_usage : null;
23643
+ const total = info && isObject7(info.total_token_usage) ? info.total_token_usage : null;
23644
+ if (last === null || total === null)
23645
+ continue;
23646
+ const runningTotal = int(total.total_tokens);
23647
+ if (runningTotal === lastTotal)
23648
+ continue;
23649
+ lastTotal = runningTotal;
23650
+ const input = int(last.input_tokens);
23651
+ const cached = int(last.cached_input_tokens);
23652
+ const cacheWrite = int(last.cache_write_input_tokens);
23653
+ const disjoint = cached + cacheWrite <= input;
23654
+ const request = {
23655
+ id: `codex:${runningTotal}`,
23656
+ model,
23657
+ timestamp: str2(line.timestamp),
23658
+ input: Math.max(0, input - cached - (disjoint ? cacheWrite : 0)),
23659
+ output: int(last.output_tokens),
23660
+ cache_read: cached,
23661
+ cache_write: disjoint ? cacheWrite : 0,
23662
+ cache_write_1h: 0,
23663
+ speed: null,
23664
+ tool_call_ids: toolCallIds
23665
+ };
23666
+ toolCallIds = [];
23667
+ if (billed(request))
23668
+ requests.push(request);
23669
+ }
23670
+ }
23671
+ return requests;
23672
+ }
23673
+ function readSessionUsage(session) {
23674
+ const reader = READERS[session.harness];
23675
+ if (!reader)
23676
+ return null;
23677
+ try {
23678
+ const requests = reader(readFileSync25(session.path, "utf8"));
23679
+ return requests.length > 0 ? { requests } : null;
23680
+ } catch {
23681
+ return null;
23682
+ }
23683
+ }
23684
+ var READERS;
23685
+ var init_usage = __esm(() => {
23686
+ READERS = {
23687
+ claude: claudeUsage,
23688
+ codex: codexUsage
23689
+ };
23690
+ });
23691
+
23542
23692
  // src/shipper/worthiness.ts
23543
23693
  function isTrivialTrajectory(records) {
23544
23694
  let asked = false;
@@ -23568,6 +23718,7 @@ function createShipStep(options) {
23568
23718
  const fetchImpl = options.fetchImpl ?? fetch;
23569
23719
  const isIncognito = options.isIncognito ?? isIncognitoSession;
23570
23720
  const normalize = options.normalize ?? normalizeSessionRecords;
23721
+ const readUsage = options.readUsage ?? readSessionUsage;
23571
23722
  async function shipOne(session, shipped, resolve, hold) {
23572
23723
  const held = hold(session);
23573
23724
  if (held === "stop")
@@ -23597,18 +23748,21 @@ function createShipStep(options) {
23597
23748
  const start = sessionStartOf(records, copied);
23598
23749
  const branch = start.recorded ?? resolve.resolveBranch(session, start.firstPromptAt);
23599
23750
  const parentSessionId = session.parentId ?? session.forkOf?.id;
23751
+ const repo = githubSlugOfRepo(resolve.resolveRepo(session));
23752
+ const usage = readUsage(session);
23600
23753
  const body = JSON.stringify({
23601
23754
  records: plan.records,
23602
23755
  metadata: {
23603
23756
  deployment_id: options.deploymentId,
23604
23757
  project,
23605
- repo: project,
23758
+ ...repo ? { repo } : {},
23606
23759
  agent: trajectorySourceOf(session.harness) ?? session.harness,
23607
23760
  session_id: session.id,
23608
23761
  ...branch ? { branch } : {},
23609
23762
  ...parentSessionId ? { parent_session_id: parentSessionId } : {},
23610
23763
  ...plan.continuation ? { continuation: plan.continuation } : {}
23611
- }
23764
+ },
23765
+ ...usage ? { usage } : {}
23612
23766
  });
23613
23767
  const late = hold(session);
23614
23768
  if (late === "stop")
@@ -23654,10 +23808,11 @@ function createShipStep(options) {
23654
23808
  return async (sessions, shippedOf = () => {
23655
23809
  return;
23656
23810
  }, hold = () => null, settled = () => {}) => {
23657
- const resolver = options.resolveProject && options.resolveBranch ? undefined : createProjectDirResolver();
23811
+ const resolver = options.resolveProject && options.resolveBranch && options.resolveRepo ? undefined : createProjectDirResolver();
23658
23812
  const resolve = {
23659
23813
  resolveProject: options.resolveProject ?? ((session) => resolver?.resolveProject(session) ?? null),
23660
- resolveBranch: options.resolveBranch ?? ((session, at) => resolver?.resolveBranch(session, at) ?? null)
23814
+ resolveBranch: options.resolveBranch ?? ((session, at) => resolver?.resolveBranch(session, at) ?? null),
23815
+ resolveRepo: options.resolveRepo ?? ((session) => resolver?.resolveRepo(session) ?? null)
23661
23816
  };
23662
23817
  const results = [];
23663
23818
  for (const session of sessions) {
@@ -23676,16 +23831,18 @@ function createShipStep(options) {
23676
23831
  var REJECTED_STATUSES, REQUEST_TIMEOUT_MS2 = 60000;
23677
23832
  var init_runner = __esm(() => {
23678
23833
  init_project_dir();
23834
+ init_repo();
23679
23835
  init_incognito();
23680
23836
  init_continuation();
23681
23837
  init_normalize();
23682
23838
  init_session_start();
23839
+ init_usage();
23683
23840
  REJECTED_STATUSES = new Set([400, 413, 422]);
23684
23841
  });
23685
23842
 
23686
23843
  // src/memory/context-hook.ts
23687
23844
  import { basename as basename10 } from "node:path";
23688
- function str2(value) {
23845
+ function str3(value) {
23689
23846
  return typeof value === "string" && value.length > 0 ? value : null;
23690
23847
  }
23691
23848
  function harnessOf(agent) {
@@ -23723,10 +23880,10 @@ function incognitoCheckOf(agent) {
23723
23880
  return transcriptHasIncognitoMarker;
23724
23881
  }
23725
23882
  function sessionIdOf(payload, format) {
23726
- const transcript = str2(payload.transcript_path);
23883
+ const transcript = str3(payload.transcript_path);
23727
23884
  if (format === "codex" && transcript?.endsWith(".jsonl"))
23728
23885
  return basename10(transcript, ".jsonl");
23729
- return str2(payload.session_id);
23886
+ return str3(payload.session_id);
23730
23887
  }
23731
23888
  function claudeCaller(id, transcript, agentId) {
23732
23889
  if (!agentId)
@@ -23745,7 +23902,7 @@ function outsideIncognitoSession(stdin, options) {
23745
23902
  const id = sessionIdOf(payload, options.format ?? "claude");
23746
23903
  if (!id)
23747
23904
  return null;
23748
- const stored = storedSession2({ harness, id, transcript: str2(payload.transcript_path) });
23905
+ const stored = storedSession2({ harness, id, transcript: str3(payload.transcript_path) });
23749
23906
  if (!stored || scannedEverywhere(harness, stored.path))
23750
23907
  return null;
23751
23908
  return options.incognito.sessions[`${harness}/${id}`]?.by_agent ? null : stored;
@@ -23765,16 +23922,16 @@ function denial(reason) {
23765
23922
  function memoryToolHookOutput(payload, isIncognito, incognito) {
23766
23923
  if (typeof payload.tool_name !== "string" || !MEMORY_TOOL.test(payload.tool_name))
23767
23924
  return "";
23768
- const transcript = str2(payload.transcript_path);
23769
- const id = str2(payload.session_id);
23925
+ const transcript = str3(payload.transcript_path);
23926
+ const id = str3(payload.session_id);
23770
23927
  const how = incognito ? agentSwitchOf(incognito, { harness: "claude", id }, () => id && transcript ? sessionAtPath("claude", id, transcript) : null) : null;
23771
23928
  if (how)
23772
23929
  return denial(agentSwitchMessage(how, "claude", TOOLS_UNAVAILABLE));
23773
23930
  if (transcript && isIncognito(transcript))
23774
23931
  return denial(INCOGNITO_DENIAL);
23775
- const toolUseId = str2(payload.tool_use_id);
23932
+ const toolUseId = str3(payload.tool_use_id);
23776
23933
  if (toolUseId && id) {
23777
- recordClaudeToolCall(toolUseId, claudeCaller(id, transcript, str2(payload.agent_id)));
23934
+ recordClaudeToolCall(toolUseId, claudeCaller(id, transcript, str3(payload.agent_id)));
23778
23935
  }
23779
23936
  return "";
23780
23937
  }
@@ -23792,7 +23949,7 @@ async function contextHookOutput(stdin, options) {
23792
23949
  }
23793
23950
  if (format !== "plain" && payload.hook_event_name !== "UserPromptSubmit")
23794
23951
  return "";
23795
- const prompt = str2(payload.prompt);
23952
+ const prompt = str3(payload.prompt);
23796
23953
  if (!prompt || NOTIFICATION_PROMPT.test(prompt))
23797
23954
  return "";
23798
23955
  if (textHasIncognitoMarker(prompt) || promptRunsIncognito(prompt))
@@ -23800,14 +23957,14 @@ async function contextHookOutput(stdin, options) {
23800
23957
  const agent = options.agent ?? CLAUDE_CODE_AGENT;
23801
23958
  const harness = harnessOf(agent);
23802
23959
  const sessionId = sessionIdOf(payload, format);
23803
- const transcript = str2(payload.transcript_path);
23960
+ const transcript = str3(payload.transcript_path);
23804
23961
  const switchedOff = harness && options.incognito ? agentSwitchOf(options.incognito, { harness, id: sessionId }, () => sessionId ? storedSession2({ harness, id: sessionId, transcript }) : null) : null;
23805
23962
  if (switchedOff)
23806
23963
  return "";
23807
23964
  const isIncognito = options.isIncognito ?? incognitoCheckOf(agent);
23808
23965
  if (transcript && isIncognito(transcript))
23809
23966
  return "";
23810
- const cwd = str2(payload.cwd);
23967
+ const cwd = str3(payload.cwd);
23811
23968
  const fetchImpl = options.fetchImpl ?? fetch;
23812
23969
  const budgetMs = options.timeoutMs ?? CONTEXT_TIMEOUT_MS;
23813
23970
  const startedAt = Date.now();
@@ -23835,9 +23992,9 @@ async function contextHookOutput(stdin, options) {
23835
23992
  return "";
23836
23993
  }
23837
23994
  const body = await response.json();
23838
- const digest = str2(body.digest);
23995
+ const digest = str3(body.digest);
23839
23996
  if (!digest) {
23840
- note(`no digest, ${str2(body.reason) ?? "none"}`);
23997
+ note(`no digest, ${str3(body.reason) ?? "none"}`);
23841
23998
  return "";
23842
23999
  }
23843
24000
  const count = Array.isArray(body.memory_ids) ? body.memory_ids.length : 0;
@@ -23869,7 +24026,7 @@ var init_context_hook = __esm(() => {
23869
24026
  });
23870
24027
 
23871
24028
  // src/commands/knowledge.ts
23872
- import { readFileSync as readFileSync25 } from "node:fs";
24029
+ import { readFileSync as readFileSync26 } from "node:fs";
23873
24030
  function collectValues(value, previous = []) {
23874
24031
  return [...previous, value];
23875
24032
  }
@@ -24126,7 +24283,7 @@ function buildShipper() {
24126
24283
  };
24127
24284
  }
24128
24285
  function readStdin3() {
24129
- return readFileSync25(0, "utf-8");
24286
+ return readFileSync26(0, "utf-8");
24130
24287
  }
24131
24288
  function contextCommand2() {
24132
24289
  return new Command("context").description("Prompt-submit hook: add task memory to the agent's context").option("--agent <source>", "Trajectory source the session ships as", "claude-code").option("--format <format>", "Output: claude or codex hook JSON, or plain digest text", "claude").action(async (opts) => {
@@ -24850,17 +25007,17 @@ var init_members = __esm(() => {
24850
25007
  });
24851
25008
 
24852
25009
  // src/mcp/relay.ts
24853
- function isObject7(value) {
25010
+ function isObject8(value) {
24854
25011
  return typeof value === "object" && value !== null && !Array.isArray(value);
24855
25012
  }
24856
25013
  function messagesOf(value) {
24857
25014
  return Array.isArray(value) ? value : [value];
24858
25015
  }
24859
25016
  function requestIds(message) {
24860
- return messagesOf(message).flatMap((m) => isObject7(m) && typeof m.method === "string" && (typeof m.id === "string" || typeof m.id === "number") ? [m.id] : []);
25017
+ return messagesOf(message).flatMap((m) => isObject8(m) && typeof m.method === "string" && (typeof m.id === "string" || typeof m.id === "number") ? [m.id] : []);
24861
25018
  }
24862
25019
  function responseIds(message) {
24863
- return messagesOf(message).flatMap((m) => isObject7(m) && (typeof m.id === "string" || typeof m.id === "number") && (("result" in m) || ("error" in m)) ? [m.id] : []);
25020
+ return messagesOf(message).flatMap((m) => isObject8(m) && (typeof m.id === "string" || typeof m.id === "number") && (("result" in m) || ("error" in m)) ? [m.id] : []);
24864
25021
  }
24865
25022
  function transportError(id, message) {
24866
25023
  return { jsonrpc: "2.0", id, error: { code: TRANSPORT_ERROR, message } };
@@ -24868,9 +25025,9 @@ function transportError(id, message) {
24868
25025
  function errorDetail(body) {
24869
25026
  try {
24870
25027
  const parsed = JSON.parse(body);
24871
- if (isObject7(parsed)) {
25028
+ if (isObject8(parsed)) {
24872
25029
  const { error, error_description, detail } = parsed;
24873
- if (isObject7(error) && typeof error.message === "string")
25030
+ if (isObject8(error) && typeof error.message === "string")
24874
25031
  return error.message;
24875
25032
  if (typeof error_description === "string")
24876
25033
  return error_description;
@@ -24885,7 +25042,7 @@ function errorDetail(body) {
24885
25042
  function jsonRpcErrorBody(body, ids) {
24886
25043
  try {
24887
25044
  const parsed = JSON.parse(body);
24888
- if (isObject7(parsed) && isObject7(parsed.error) && ids.includes(parsed.id)) {
25045
+ if (isObject8(parsed) && isObject8(parsed.error) && ids.includes(parsed.id)) {
24889
25046
  return parsed;
24890
25047
  }
24891
25048
  } catch {}
@@ -24979,9 +25136,9 @@ function createMcpRelay(options) {
24979
25136
  return out;
24980
25137
  }
24981
25138
  function noteInitialized(sent, reply) {
24982
- const initializeIds = messagesOf(sent).flatMap((m) => isObject7(m) && m.method === "initialize" ? [m.id] : []);
25139
+ const initializeIds = messagesOf(sent).flatMap((m) => isObject8(m) && m.method === "initialize" ? [m.id] : []);
24983
25140
  for (const m of messagesOf(reply)) {
24984
- if (!isObject7(m) || !initializeIds.includes(m.id) || !isObject7(m.result))
25141
+ if (!isObject8(m) || !initializeIds.includes(m.id) || !isObject8(m.result))
24985
25142
  continue;
24986
25143
  if (typeof m.result.protocolVersion === "string")
24987
25144
  protocolVersion = m.result.protocolVersion;
@@ -25106,13 +25263,13 @@ function openSession(options) {
25106
25263
  function proxyRelay(options = {}) {
25107
25264
  return openSession(options).relay;
25108
25265
  }
25109
- function isObject8(value) {
25266
+ function isObject9(value) {
25110
25267
  return typeof value === "object" && value !== null && !Array.isArray(value);
25111
25268
  }
25112
25269
  function firstRootDir(answer) {
25113
- const roots = isObject8(answer.result) ? answer.result.roots : undefined;
25270
+ const roots = isObject9(answer.result) ? answer.result.roots : undefined;
25114
25271
  for (const root of Array.isArray(roots) ? roots : []) {
25115
- if (!isObject8(root) || typeof root.uri !== "string" || !root.uri.startsWith("file:"))
25272
+ if (!isObject9(root) || typeof root.uri !== "string" || !root.uri.startsWith("file:"))
25116
25273
  continue;
25117
25274
  try {
25118
25275
  return fileURLToPath3(root.uri);
@@ -25146,10 +25303,10 @@ async function serveStdio(session, input, write) {
25146
25303
  emit({ jsonrpc: "2.0", id: ROOTS_REQUEST_ID, method: "roots/list" });
25147
25304
  };
25148
25305
  const screen = (message) => {
25149
- const call = isObject8(message) && message.method === "tools/call" ? message : null;
25306
+ const call = isObject9(message) && message.method === "tools/call" ? message : null;
25150
25307
  if (!call)
25151
25308
  return { callSession: null, refusal: null };
25152
- const callSession = isObject8(call.params) ? takeCallSession(call.params, session.client) : null;
25309
+ const callSession = isObject9(call.params) ? takeCallSession(call.params, session.client) : null;
25153
25310
  const text = callRefusal(session.client, callSession ? [callSession] : []);
25154
25311
  if (!text)
25155
25312
  return { callSession, refusal: null };
@@ -25174,14 +25331,14 @@ async function serveStdio(session, input, write) {
25174
25331
  emit(PARSE_ERROR);
25175
25332
  return;
25176
25333
  }
25177
- const method = isObject8(message) ? message.method : undefined;
25178
- if (takeRoots && isObject8(message) && message.id === ROOTS_REQUEST_ID && !method) {
25334
+ const method = isObject9(message) ? message.method : undefined;
25335
+ if (takeRoots && isObject9(message) && message.id === ROOTS_REQUEST_ID && !method) {
25179
25336
  takeRoots(message);
25180
25337
  return;
25181
25338
  }
25182
- if (method === "initialize" && isObject8(message)) {
25183
- const params = isObject8(message.params) ? message.params : {};
25184
- agentOffersRoots = isObject8(params.capabilities) && isObject8(params.capabilities.roots);
25339
+ if (method === "initialize" && isObject9(message)) {
25340
+ const params = isObject9(message.params) ? message.params : {};
25341
+ agentOffersRoots = isObject9(params.capabilities) && isObject9(params.capabilities.roots);
25185
25342
  }
25186
25343
  let outgoing = message;
25187
25344
  let named = null;
@@ -25421,12 +25578,12 @@ var init_org = __esm(() => {
25421
25578
  });
25422
25579
 
25423
25580
  // src/sessions/project-links.ts
25424
- import { existsSync as existsSync19, readFileSync as readFileSync26 } from "node:fs";
25581
+ import { existsSync as existsSync19, readFileSync as readFileSync27 } from "node:fs";
25425
25582
  function readLinksFile(configDir) {
25426
25583
  const path = projectLinksPath(configDir);
25427
25584
  if (!existsSync19(path))
25428
25585
  return { links: [] };
25429
- const raw = readFileSync26(path, "utf-8").trim();
25586
+ const raw = readFileSync27(path, "utf-8").trim();
25430
25587
  if (!raw)
25431
25588
  return { links: [] };
25432
25589
  let parsed;
@@ -25875,7 +26032,7 @@ var init_time_range = __esm(() => {
25875
26032
  });
25876
26033
 
25877
26034
  // src/commands/review.ts
25878
- import { readFileSync as readFileSync27 } from "node:fs";
26035
+ import { readFileSync as readFileSync28 } from "node:fs";
25879
26036
  function requireConfig10() {
25880
26037
  return requireLoginConfig();
25881
26038
  }
@@ -26113,7 +26270,7 @@ function reviewCommand() {
26113
26270
  let body = opts.body;
26114
26271
  if (opts.bodyFile) {
26115
26272
  try {
26116
- body = readFileSync27(opts.bodyFile, "utf-8");
26273
+ body = readFileSync28(opts.bodyFile, "utf-8");
26117
26274
  } catch (err) {
26118
26275
  throw invalidArgument(`Failed to read --body-file: ${err.message}`);
26119
26276
  }
@@ -27057,7 +27214,7 @@ import {
27057
27214
  existsSync as existsSync20,
27058
27215
  lstatSync,
27059
27216
  mkdirSync as mkdirSync12,
27060
- readFileSync as readFileSync28,
27217
+ readFileSync as readFileSync29,
27061
27218
  rmSync as rmSync4,
27062
27219
  symlinkSync,
27063
27220
  writeFileSync as writeFileSync13
@@ -27099,7 +27256,7 @@ function readSkillInstallState() {
27099
27256
  const path = installStatePath();
27100
27257
  if (!existsSync20(path))
27101
27258
  return null;
27102
- const data = JSON.parse(readFileSync28(path, "utf-8"));
27259
+ const data = JSON.parse(readFileSync29(path, "utf-8"));
27103
27260
  if (typeof data?.version === "string" && Array.isArray(data.agents) && data.agents.every((agent) => typeof agent === "string") && typeof data.installedAt === "number") {
27104
27261
  return { version: data.version, agents: data.agents, installedAt: data.installedAt };
27105
27262
  }
@@ -27126,7 +27283,7 @@ function pruneLegacySkillLock() {
27126
27283
  try {
27127
27284
  if (!existsSync20(lockPath))
27128
27285
  return [];
27129
- const lock = JSON.parse(readFileSync28(lockPath, "utf-8"));
27286
+ const lock = JSON.parse(readFileSync29(lockPath, "utf-8"));
27130
27287
  const skills = lock?.skills;
27131
27288
  if (!skills || typeof skills !== "object")
27132
27289
  return [];
@@ -27595,7 +27752,7 @@ import {
27595
27752
  existsSync as existsSync21,
27596
27753
  lstatSync as lstatSync2,
27597
27754
  mkdirSync as mkdirSync13,
27598
- readFileSync as readFileSync29,
27755
+ readFileSync as readFileSync30,
27599
27756
  renameSync as renameSync5,
27600
27757
  unlinkSync as unlinkSync6,
27601
27758
  writeFileSync as writeFileSync14
@@ -27670,7 +27827,7 @@ function readTelemetrySettings() {
27670
27827
  }
27671
27828
  let content;
27672
27829
  try {
27673
- content = readFileSync29(path, "utf-8");
27830
+ content = readFileSync30(path, "utf-8");
27674
27831
  } catch {
27675
27832
  return { status: "error", settings: disabledTelemetrySettings() };
27676
27833
  }
@@ -28178,7 +28335,7 @@ var init_claude = __esm(() => {
28178
28335
  });
28179
28336
 
28180
28337
  // src/mcp/providers/codex.ts
28181
- import { existsSync as existsSync22, readFileSync as readFileSync30 } from "node:fs";
28338
+ import { existsSync as existsSync22, readFileSync as readFileSync31 } from "node:fs";
28182
28339
  import { dirname as dirname9, join as join27 } from "node:path";
28183
28340
  function codexHome4() {
28184
28341
  return process.env.CODEX_HOME || expandHome("~/.codex");
@@ -28191,7 +28348,7 @@ function getConfigPath2(global) {
28191
28348
  function readTOML(path) {
28192
28349
  if (!existsSync22(path))
28193
28350
  return "";
28194
- return readFileSync30(path, "utf-8");
28351
+ return readFileSync31(path, "utf-8");
28195
28352
  }
28196
28353
  function writeTOML(path, content) {
28197
28354
  writeSecureFile(path, content);
@@ -28732,7 +28889,7 @@ import {
28732
28889
  existsSync as existsSync23,
28733
28890
  mkdirSync as mkdirSync14,
28734
28891
  openSync as openSync8,
28735
- readFileSync as readFileSync31,
28892
+ readFileSync as readFileSync32,
28736
28893
  rmSync as rmSync5,
28737
28894
  statSync as statSync11,
28738
28895
  writeFileSync as writeFileSync15,
@@ -28751,7 +28908,7 @@ function isValidVersion(value) {
28751
28908
  }
28752
28909
  function readState() {
28753
28910
  try {
28754
- const raw = JSON.parse(readFileSync31(statePath(), "utf-8"));
28911
+ const raw = JSON.parse(readFileSync32(statePath(), "utf-8"));
28755
28912
  if (typeof raw !== "object" || raw === null || Array.isArray(raw))
28756
28913
  return {};
28757
28914
  const data = raw;
@@ -28846,7 +29003,7 @@ function releaseLock() {
28846
29003
  }
28847
29004
  function readLockVersion() {
28848
29005
  try {
28849
- const version = readFileSync31(lockPath2(), "utf-8").trim();
29006
+ const version = readFileSync32(lockPath2(), "utf-8").trim();
28850
29007
  return isValidVersion(version) ? version : undefined;
28851
29008
  } catch {
28852
29009
  return;
@@ -28920,7 +29077,7 @@ var init_auto_update = __esm(() => {
28920
29077
  });
28921
29078
 
28922
29079
  // src/version/mcp-refresh-check.ts
28923
- import { existsSync as existsSync24, mkdirSync as mkdirSync15, readFileSync as readFileSync32, writeFileSync as writeFileSync16 } from "node:fs";
29080
+ import { existsSync as existsSync24, mkdirSync as mkdirSync15, readFileSync as readFileSync33, writeFileSync as writeFileSync16 } from "node:fs";
28924
29081
  import { join as join34 } from "node:path";
28925
29082
  function getCachePath2() {
28926
29083
  return join34(getConfigDir(), CACHE_FILENAME3);
@@ -28930,7 +29087,7 @@ function readMcpRefreshCache() {
28930
29087
  const path = getCachePath2();
28931
29088
  if (!existsSync24(path))
28932
29089
  return null;
28933
- const data = JSON.parse(readFileSync32(path, "utf-8"));
29090
+ const data = JSON.parse(readFileSync33(path, "utf-8"));
28934
29091
  if (typeof data?.version === "string")
28935
29092
  return { version: data.version };
28936
29093
  return null;
@@ -29084,7 +29241,7 @@ function createLogFollower(path, emit) {
29084
29241
  var init_follow = () => {};
29085
29242
 
29086
29243
  // src/sessions/session-title.ts
29087
- import { existsSync as existsSync25, mkdirSync as mkdirSync16, readFileSync as readFileSync33, renameSync as renameSync6, statSync as statSync13, writeFileSync as writeFileSync17 } from "node:fs";
29244
+ import { existsSync as existsSync25, mkdirSync as mkdirSync16, readFileSync as readFileSync34, renameSync as renameSync6, statSync as statSync13, writeFileSync as writeFileSync17 } from "node:fs";
29088
29245
  import { homedir as homedir11 } from "node:os";
29089
29246
  import { join as join35 } from "node:path";
29090
29247
  function cachePath2(configDir) {
@@ -29092,7 +29249,7 @@ function cachePath2(configDir) {
29092
29249
  }
29093
29250
  function loadCacheFile2(configDir) {
29094
29251
  try {
29095
- const raw = JSON.parse(readFileSync33(cachePath2(configDir), "utf-8"));
29252
+ const raw = JSON.parse(readFileSync34(cachePath2(configDir), "utf-8"));
29096
29253
  if (raw.schema_version !== CACHE_SCHEMA_VERSION2 || typeof raw.entries !== "object")
29097
29254
  return {};
29098
29255
  return raw.entries;
@@ -29160,7 +29317,7 @@ function reconstructSession(harness, id, slug, home = homedir11(), exists = exis
29160
29317
  }
29161
29318
  function readHead3(path) {
29162
29319
  try {
29163
- return readFileSync33(path, "utf-8").slice(0, 128 * 1024);
29320
+ return readFileSync34(path, "utf-8").slice(0, 128 * 1024);
29164
29321
  } catch {
29165
29322
  return null;
29166
29323
  }
@@ -29240,7 +29397,7 @@ var init_alt_screen = __esm(() => {
29240
29397
  });
29241
29398
 
29242
29399
  // src/tui/activity-view.ts
29243
- import { existsSync as existsSync26, readFileSync as readFileSync34 } from "node:fs";
29400
+ import { existsSync as existsSync26, readFileSync as readFileSync35 } from "node:fs";
29244
29401
  import { basename as basename11 } from "node:path";
29245
29402
  function reduceActivityViewKey(key) {
29246
29403
  if (key === "q" || key === ESC7 || key === CTRL_C4)
@@ -29564,7 +29721,7 @@ function createRowNamer() {
29564
29721
  }
29565
29722
  function defaultReadLog2() {
29566
29723
  try {
29567
- return readFileSync34(logger.getLogPath(), "utf-8");
29724
+ return readFileSync35(logger.getLogPath(), "utf-8");
29568
29725
  } catch {
29569
29726
  return "";
29570
29727
  }
@@ -29784,7 +29941,7 @@ var init_activity_view = __esm(() => {
29784
29941
  });
29785
29942
 
29786
29943
  // src/rules/installer.ts
29787
- import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync35, unlinkSync as unlinkSync7, writeFileSync as writeFileSync18 } from "node:fs";
29944
+ import { existsSync as existsSync27, mkdirSync as mkdirSync17, readFileSync as readFileSync36, unlinkSync as unlinkSync7, writeFileSync as writeFileSync18 } from "node:fs";
29788
29945
  import { homedir as homedir12 } from "node:os";
29789
29946
  import { dirname as dirname10, join as join36 } from "node:path";
29790
29947
  function claudeConfigDir4() {
@@ -29825,7 +29982,7 @@ function writeIfChanged2(path, content) {
29825
29982
  writeFileSync18(path, content, "utf-8");
29826
29983
  return "created";
29827
29984
  }
29828
- if (readFileSync35(path, "utf-8") === content)
29985
+ if (readFileSync36(path, "utf-8") === content)
29829
29986
  return "unchanged";
29830
29987
  writeFileSync18(path, content, "utf-8");
29831
29988
  return "updated";
@@ -29860,7 +30017,7 @@ function upsertSection(path, content) {
29860
30017
  `, "utf-8");
29861
30018
  return "created";
29862
30019
  }
29863
- const existing = readFileSync35(path, "utf-8");
30020
+ const existing = readFileSync36(path, "utf-8");
29864
30021
  const lineEnding = lineEndingFor(existing);
29865
30022
  const section = buildSection(content, lineEnding);
29866
30023
  const location = findSection(existing);
@@ -29896,7 +30053,7 @@ function removeRuleForAgent(agent) {
29896
30053
  unlinkSync7(path);
29897
30054
  return { agent, path, action: "removed" };
29898
30055
  }
29899
- const existing = readFileSync35(path, "utf-8");
30056
+ const existing = readFileSync36(path, "utf-8");
29900
30057
  const lineEnding = lineEndingFor(existing);
29901
30058
  const location = findSection(existing);
29902
30059
  if (!location)
@@ -29957,7 +30114,7 @@ var init_installer = __esm(() => {
29957
30114
 
29958
30115
  // src/setup/agents-md-step.ts
29959
30116
  import { execSync as execSync2 } from "node:child_process";
29960
- import { existsSync as existsSync28, readFileSync as readFileSync36, writeFileSync as writeFileSync19 } from "node:fs";
30117
+ import { existsSync as existsSync28, readFileSync as readFileSync37, writeFileSync as writeFileSync19 } from "node:fs";
29961
30118
  import { join as join37 } from "node:path";
29962
30119
  function inGitWorkTree(cwd = process.cwd()) {
29963
30120
  try {
@@ -29975,7 +30132,7 @@ function dosuAgentsSectionState(cwd = process.cwd()) {
29975
30132
  const path = join37(cwd, "AGENTS.md");
29976
30133
  if (!existsSync28(path))
29977
30134
  return "missing";
29978
- const content = readFileSync36(path, "utf-8");
30135
+ const content = readFileSync37(path, "utf-8");
29979
30136
  const startMatch = content.match(SECTION_START_RE);
29980
30137
  if (!startMatch || !content.includes(DOSU_SECTION_END))
29981
30138
  return "missing";
@@ -30017,7 +30174,7 @@ function upsertDosuAgentsSection(cwd = process.cwd(), content = FALLBACK_DOSU_RU
30017
30174
  `);
30018
30175
  return { path, action: "created" };
30019
30176
  }
30020
- const existing = readFileSync36(path, "utf-8");
30177
+ const existing = readFileSync37(path, "utf-8");
30021
30178
  const lineEnding = lineEndingFor2(existing);
30022
30179
  const section = renderDosuAgentsSection(content, lineEnding);
30023
30180
  const location = findSection2(existing);
@@ -32117,7 +32274,7 @@ var init_incognito_backfill_check = __esm(() => {
32117
32274
  });
32118
32275
 
32119
32276
  // src/version/update-check.ts
32120
- import { existsSync as existsSync30, mkdirSync as mkdirSync19, readFileSync as readFileSync37, writeFileSync as writeFileSync21 } from "node:fs";
32277
+ import { existsSync as existsSync30, mkdirSync as mkdirSync19, readFileSync as readFileSync38, writeFileSync as writeFileSync21 } from "node:fs";
32121
32278
  import { join as join39 } from "node:path";
32122
32279
  function isValidVersion2(value) {
32123
32280
  return typeof value === "string" && SEMVER_PATTERN.test(value);
@@ -32178,7 +32335,7 @@ function readCache() {
32178
32335
  const path = getCachePath3();
32179
32336
  if (!existsSync30(path))
32180
32337
  return null;
32181
- const data = JSON.parse(readFileSync37(path, "utf-8"));
32338
+ const data = JSON.parse(readFileSync38(path, "utf-8"));
32182
32339
  if (typeof data.lastCheck === "number" && isValidVersion2(data.latestVersion)) {
32183
32340
  return data;
32184
32341
  }
@@ -34049,7 +34206,7 @@ var init_flow3 = __esm(() => {
34049
34206
  });
34050
34207
 
34051
34208
  // src/cli/cli.ts
34052
- import { readFileSync as readFileSync38, unlinkSync as unlinkSync8 } from "node:fs";
34209
+ import { readFileSync as readFileSync39, unlinkSync as unlinkSync8 } from "node:fs";
34053
34210
  function shouldRunBackgroundChecks(command) {
34054
34211
  return !NO_BACKGROUND_CHECKS.has(command);
34055
34212
  }
@@ -34503,7 +34660,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
34503
34660
  }
34504
34661
  if (opts.follow) {
34505
34662
  try {
34506
- const lines = readFileSync38(logPath, "utf-8").split(`
34663
+ const lines = readFileSync39(logPath, "utf-8").split(`
34507
34664
  `);
34508
34665
  if (lines.at(-1) === "")
34509
34666
  lines.pop();
@@ -34519,7 +34676,7 @@ Use 'dosu mcp add <agent>' to add Dosu MCP to a tool.`);
34519
34676
  if (opts.tail !== undefined) {
34520
34677
  const n = typeof opts.tail === "string" ? parseInt(opts.tail, 10) || 50 : 50;
34521
34678
  try {
34522
- const content = readFileSync38(logPath, "utf-8");
34679
+ const content = readFileSync39(logPath, "utf-8");
34523
34680
  const lines = content.split(`
34524
34681
  `);
34525
34682
  console.log(lines.slice(-n).join(`
@@ -34705,4 +34862,4 @@ main().catch((err) => {
34705
34862
  process.exit(1);
34706
34863
  });
34707
34864
 
34708
- //# debugId=edd9dc12-2f93-0c3d-6475-6e2164756e21
34865
+ //# debugId=d33cbd82-2145-b9b8-6475-6e2164756e21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosu/cli",
3
- "version": "0.67.0-beta.7",
3
+ "version": "0.67.0-beta.9",
4
4
  "type": "module",
5
5
  "description": "Dosu CLI - Set up Dosu MCP for AI tools and work with Dosu Libraries, docs, and reviews",
6
6
  "license": "MIT",