@openscout/scout 0.2.63 → 0.2.64

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/dist/main.mjs CHANGED
@@ -191,6 +191,7 @@ function parseSendCommandOptions(args, defaultCurrentDirectory) {
191
191
  const parsed = parseContextRootPrefix(args, defaultCurrentDirectory);
192
192
  let agentName = null;
193
193
  let targetLabel;
194
+ let targetRef;
194
195
  let channel;
195
196
  let shouldSpeak = false;
196
197
  let harness;
@@ -210,6 +211,13 @@ function parseSendCommandOptions(args, defaultCurrentDirectory) {
210
211
  index = value.nextIndex;
211
212
  continue;
212
213
  }
214
+ if (current === "--ref" || current.startsWith("--ref=")) {
215
+ const value = parseFlagValue(parsed.args, index, "--ref");
216
+ targetRef = value.value.replace(/^ref:/, "");
217
+ targetLabel = `ref:${targetRef}`;
218
+ index = value.nextIndex;
219
+ continue;
220
+ }
213
221
  if (current === "--channel" || current.startsWith("--channel=")) {
214
222
  const value = parseFlagValue(parsed.args, index, "--channel");
215
223
  channel = value.value;
@@ -250,6 +258,7 @@ function parseSendCommandOptions(args, defaultCurrentDirectory) {
250
258
  args: parsed.args,
251
259
  agentName,
252
260
  targetLabel,
261
+ targetRef,
253
262
  channel,
254
263
  shouldSpeak,
255
264
  harness,
@@ -261,6 +270,7 @@ function parseAskCommandOptions(args, defaultCurrentDirectory) {
261
270
  const parsed = parseContextRootPrefix(args, defaultCurrentDirectory);
262
271
  let agentName = null;
263
272
  let targetLabel = null;
273
+ let targetRef;
264
274
  let channel;
265
275
  let harness;
266
276
  let timeoutSeconds;
@@ -280,6 +290,13 @@ function parseAskCommandOptions(args, defaultCurrentDirectory) {
280
290
  index = value.nextIndex;
281
291
  continue;
282
292
  }
293
+ if (current === "--ref" || current.startsWith("--ref=")) {
294
+ const value = parseFlagValue(parsed.args, index, "--ref");
295
+ targetRef = value.value.replace(/^ref:/, "");
296
+ targetLabel = `ref:${targetRef}`;
297
+ index = value.nextIndex;
298
+ continue;
299
+ }
283
300
  if (current === "--channel" || current.startsWith("--channel=")) {
284
301
  const value = parseFlagValue(parsed.args, index, "--channel");
285
302
  channel = value.value;
@@ -329,6 +346,7 @@ function parseAskCommandOptions(args, defaultCurrentDirectory) {
329
346
  args: parsed.args,
330
347
  agentName,
331
348
  targetLabel,
349
+ targetRef,
332
350
  channel,
333
351
  harness,
334
352
  timeoutSeconds,
@@ -5289,7 +5307,7 @@ function resolveJavaScriptRuntime(options = {}) {
5289
5307
  };
5290
5308
  }
5291
5309
  function resolveBundledEntrypoint(moduleUrl, filename) {
5292
- const moduleDirectory = dirname4(fileURLToPath3(moduleUrl));
5310
+ const moduleDirectory = dirname4(fileURLToPath3(moduleUrl.toString()));
5293
5311
  const candidate = join5(moduleDirectory, filename);
5294
5312
  return existsSync4(candidate) ? candidate : null;
5295
5313
  }
@@ -5323,7 +5341,7 @@ function resolveRepoEntrypoint(repoRoot, relativePath) {
5323
5341
  return existsSync4(candidate) ? candidate : null;
5324
5342
  }
5325
5343
  function resolveNodeModulesPackageEntrypoint(moduleUrl, packageSegments, entryRelativePath) {
5326
- let current = dirname4(fileURLToPath3(moduleUrl));
5344
+ let current = dirname4(fileURLToPath3(moduleUrl.toString()));
5327
5345
  for (let attempt = 0;attempt < 24; attempt += 1) {
5328
5346
  const candidate = join5(current, "node_modules", ...packageSegments, entryRelativePath);
5329
5347
  if (existsSync4(candidate)) {
@@ -11187,6 +11205,7 @@ class CodexAppServerSession {
11187
11205
  key;
11188
11206
  threadIdPath;
11189
11207
  statePath;
11208
+ replyContextPath;
11190
11209
  stdoutLogPath;
11191
11210
  stderrLogPath;
11192
11211
  process = null;
@@ -11204,6 +11223,7 @@ class CodexAppServerSession {
11204
11223
  this.key = sessionKey2(options);
11205
11224
  this.threadIdPath = join11(options.runtimeDirectory, "codex-thread-id.txt");
11206
11225
  this.statePath = join11(options.runtimeDirectory, "state.json");
11226
+ this.replyContextPath = join11(options.runtimeDirectory, "scout-reply-context.json");
11207
11227
  this.stdoutLogPath = join11(options.logsDirectory, "stdout.log");
11208
11228
  this.stderrLogPath = join11(options.logsDirectory, "stderr.log");
11209
11229
  this.lastConfigSignature = this.configSignature(options);
@@ -11227,7 +11247,7 @@ class CodexAppServerSession {
11227
11247
  threadId: this.threadId
11228
11248
  };
11229
11249
  }
11230
- async invoke(prompt, timeoutMs = 5 * 60000) {
11250
+ async invoke(prompt, timeoutMs = 5 * 60000, replyContext) {
11231
11251
  return this.enqueue(async () => {
11232
11252
  await this.ensureStarted();
11233
11253
  if (!this.threadId) {
@@ -11236,6 +11256,7 @@ class CodexAppServerSession {
11236
11256
  const output = await new Promise(async (resolve8, reject) => {
11237
11257
  const turn = this.createActiveTurn(resolve8, reject, timeoutMs);
11238
11258
  try {
11259
+ await this.writeReplyContext(replyContext ?? null);
11239
11260
  const response = await this.request("turn/start", {
11240
11261
  threadId: this.threadId,
11241
11262
  cwd: this.options.cwd,
@@ -11250,6 +11271,7 @@ class CodexAppServerSession {
11250
11271
  turn.turnId = response.turn.id;
11251
11272
  await this.persistState();
11252
11273
  } catch (error) {
11274
+ await this.clearReplyContext();
11253
11275
  this.clearActiveTurn(turn);
11254
11276
  reject(error instanceof Error ? error : new Error(errorMessage3(error)));
11255
11277
  }
@@ -11398,6 +11420,7 @@ class CodexAppServerSession {
11398
11420
  currentDirectory: this.options.cwd,
11399
11421
  baseEnv: process.env
11400
11422
  });
11423
+ env.OPENSCOUT_REPLY_CONTEXT_FILE = this.replyContextPath;
11401
11424
  const child = spawn3(codexExecutable, [
11402
11425
  "app-server",
11403
11426
  ...buildScoutMcpCodexLaunchArgs({
@@ -11640,6 +11663,20 @@ class CodexAppServerSession {
11640
11663
  error: buildUnsupportedServerRequestError2(message)
11641
11664
  });
11642
11665
  }
11666
+ async writeReplyContext(context) {
11667
+ if (!context) {
11668
+ await this.clearReplyContext();
11669
+ return;
11670
+ }
11671
+ await mkdir5(this.options.runtimeDirectory, { recursive: true });
11672
+ await writeFile5(this.replyContextPath, `${JSON.stringify(context, null, 2)}
11673
+ `, "utf8");
11674
+ }
11675
+ async clearReplyContext() {
11676
+ await rm4(this.replyContextPath, { force: true }).catch(() => {
11677
+ return;
11678
+ });
11679
+ }
11643
11680
  handleNotification(message) {
11644
11681
  const method = message.method;
11645
11682
  const params = message.params ?? {};
@@ -11694,6 +11731,7 @@ class CodexAppServerSession {
11694
11731
  return;
11695
11732
  }
11696
11733
  if (method === "turn/completed") {
11734
+ this.clearReplyContext();
11697
11735
  this.completeTurn(params);
11698
11736
  return;
11699
11737
  }
@@ -13494,7 +13532,11 @@ var init_paths = __esm(() => {
13494
13532
  deliver: "/v1/deliver",
13495
13533
  activity: "/v1/activity",
13496
13534
  collaborationRecords: "/v1/collaboration/records",
13497
- collaborationEvents: "/v1/collaboration/events"
13535
+ collaborationEvents: "/v1/collaboration/events",
13536
+ pairingAttach: "/v1/pairing/attach",
13537
+ pairingDetach: "/v1/pairing/detach",
13538
+ localSessionsAttach: "/v1/local-sessions/attach",
13539
+ localSessionsDetach: "/v1/local-sessions/detach"
13498
13540
  }
13499
13541
  };
13500
13542
  });
@@ -14410,7 +14452,10 @@ async function sendScoutMessage(input) {
14410
14452
  const source = input.source?.trim() || "scout-cli";
14411
14453
  const senderId = await resolveConversationActorId(broker.baseUrl, broker.snapshot, broker.node.id, input.senderId, currentDirectory);
14412
14454
  const requestedTargetLabel = input.targetLabel?.trim();
14413
- if (requestedTargetLabel) {
14455
+ const requestedTargetRef = input.targetRef?.trim() || (requestedTargetLabel?.startsWith("ref:") ? requestedTargetLabel.slice("ref:".length) : "");
14456
+ if (requestedTargetLabel || requestedTargetRef) {
14457
+ const target = requestedTargetRef ? { kind: "binding_ref", ref: requestedTargetRef } : { kind: "agent_label", label: requestedTargetLabel };
14458
+ const renderedTarget = requestedTargetRef ? `ref:${requestedTargetRef}` : requestedTargetLabel;
14414
14459
  const delivery = await brokerPostDeliver(broker.baseUrl, {
14415
14460
  caller: {
14416
14461
  actorId: senderId,
@@ -14418,11 +14463,8 @@ async function sendScoutMessage(input) {
14418
14463
  currentDirectory,
14419
14464
  metadata: { source }
14420
14465
  },
14421
- target: {
14422
- kind: "agent_label",
14423
- label: requestedTargetLabel
14424
- },
14425
- targetLabel: requestedTargetLabel,
14466
+ target,
14467
+ targetLabel: renderedTarget,
14426
14468
  body: input.body,
14427
14469
  intent: "tell",
14428
14470
  channel: input.channel,
@@ -14435,7 +14477,7 @@ async function sendScoutMessage(input) {
14435
14477
  return {
14436
14478
  usedBroker: true,
14437
14479
  invokedTargets: [],
14438
- unresolvedTargets: [requestedTargetLabel],
14480
+ unresolvedTargets: [renderedTarget],
14439
14481
  targetDiagnostic: scoutTargetDiagnosticFromDeliveryFailure(delivery)
14440
14482
  };
14441
14483
  }
@@ -14443,6 +14485,7 @@ async function sendScoutMessage(input) {
14443
14485
  usedBroker: true,
14444
14486
  conversationId: delivery.conversation.id,
14445
14487
  messageId: delivery.message.id,
14488
+ bindingRef: delivery.receipt?.bindingRef ?? delivery.bindingRef,
14446
14489
  invokedTargets: delivery.targetAgentId ? [delivery.targetAgentId] : [],
14447
14490
  unresolvedTargets: [],
14448
14491
  routeKind: delivery.routeKind
@@ -14557,6 +14600,88 @@ async function sendScoutMessage(input) {
14557
14600
  routeKind: relayRouteKind(conversation)
14558
14601
  };
14559
14602
  }
14603
+ async function replyToScoutMessage(input) {
14604
+ const broker = await loadScoutBrokerContext();
14605
+ if (!broker) {
14606
+ return { usedBroker: false, notifiedActorIds: [] };
14607
+ }
14608
+ const conversationId = input.conversationId.trim();
14609
+ const replyToMessageId = input.replyToMessageId.trim();
14610
+ if (!conversationId || !replyToMessageId) {
14611
+ return {
14612
+ usedBroker: true,
14613
+ notifiedActorIds: [],
14614
+ routingError: "missing_reply_context"
14615
+ };
14616
+ }
14617
+ const conversation = broker.snapshot.conversations[conversationId];
14618
+ if (!conversation) {
14619
+ return {
14620
+ usedBroker: true,
14621
+ conversationId,
14622
+ replyToMessageId,
14623
+ notifiedActorIds: [],
14624
+ routingError: "unknown_conversation"
14625
+ };
14626
+ }
14627
+ const replyTarget = broker.snapshot.messages[replyToMessageId];
14628
+ if (!replyTarget) {
14629
+ return {
14630
+ usedBroker: true,
14631
+ conversationId,
14632
+ replyToMessageId,
14633
+ notifiedActorIds: [],
14634
+ routingError: "unknown_reply_target"
14635
+ };
14636
+ }
14637
+ if (replyTarget.conversationId !== conversationId) {
14638
+ return {
14639
+ usedBroker: true,
14640
+ conversationId,
14641
+ replyToMessageId,
14642
+ notifiedActorIds: [],
14643
+ routingError: "reply_target_conversation_mismatch"
14644
+ };
14645
+ }
14646
+ const currentDirectory = input.currentDirectory ?? process.cwd();
14647
+ const source = input.source?.trim() || "scout-mcp";
14648
+ const senderId = await resolveConversationActorId(broker.baseUrl, broker.snapshot, broker.node.id, input.senderId, currentDirectory);
14649
+ const createdAtMs = input.createdAtMs ?? Date.now();
14650
+ const messageId = `m-${createdAtMs.toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
14651
+ const notifiedActorIds = replyTarget.actorId !== senderId ? [replyTarget.actorId] : [];
14652
+ const speechText = input.shouldSpeak ? input.body.trim() : "";
14653
+ const returnAddress = buildScoutReturnAddress2(broker.snapshot, senderId, {
14654
+ conversationId,
14655
+ replyToMessageId: messageId
14656
+ });
14657
+ await brokerPostJson(broker.baseUrl, scoutBrokerPaths.v1.messages, {
14658
+ id: messageId,
14659
+ conversationId,
14660
+ replyToMessageId,
14661
+ actorId: senderId,
14662
+ originNodeId: broker.node.id,
14663
+ class: conversation.kind === "system" ? "system" : "agent",
14664
+ body: input.body,
14665
+ speech: speechText ? { text: speechText } : undefined,
14666
+ audience: notifiedActorIds.length > 0 ? { notify: notifiedActorIds, reason: "thread_reply" } : undefined,
14667
+ visibility: conversation.visibility,
14668
+ policy: "durable",
14669
+ createdAt: createdAtMs,
14670
+ metadata: {
14671
+ source,
14672
+ relayChannel: relayChannelMetadata(conversation),
14673
+ relayMessageId: messageId,
14674
+ returnAddress
14675
+ }
14676
+ });
14677
+ return {
14678
+ usedBroker: true,
14679
+ conversationId,
14680
+ messageId,
14681
+ replyToMessageId,
14682
+ notifiedActorIds
14683
+ };
14684
+ }
14560
14685
  async function sendScoutMessageToAgentIds(input) {
14561
14686
  const broker = await loadScoutBrokerContext();
14562
14687
  if (!broker) {
@@ -14665,6 +14790,18 @@ async function openScoutPeerSession(input) {
14665
14790
  targetId
14666
14791
  };
14667
14792
  }
14793
+ async function attachScoutManagedLocalSession(input) {
14794
+ const broker = await requireScoutBrokerContext();
14795
+ return brokerPostJson(broker.baseUrl, scoutBrokerPaths.v1.localSessionsAttach, {
14796
+ externalSessionId: input.externalSessionId,
14797
+ transport: input.transport,
14798
+ cwd: input.currentDirectory,
14799
+ ...input.projectRoot ? { projectRoot: input.projectRoot } : {},
14800
+ ...input.agentId ? { agentId: input.agentId } : {},
14801
+ ...input.alias ? { alias: input.alias } : {},
14802
+ ...input.displayName ? { displayName: input.displayName } : {}
14803
+ });
14804
+ }
14668
14805
  async function sendScoutDirectMessage(input) {
14669
14806
  const broker = await requireScoutBrokerContext();
14670
14807
  const source = input.source?.trim() || "scout-mobile";
@@ -14683,7 +14820,10 @@ async function sendScoutDirectMessage(input) {
14683
14820
  body: input.body.trim(),
14684
14821
  intent: "consult",
14685
14822
  replyToMessageId: input.replyToMessageId ?? undefined,
14686
- execution: input.executionHarness ? { harness: input.executionHarness } : undefined,
14823
+ execution: {
14824
+ ...input.executionHarness ? { harness: input.executionHarness } : {},
14825
+ session: "new"
14826
+ },
14687
14827
  ensureAwake: true,
14688
14828
  messageMetadata: {
14689
14829
  source,
@@ -14738,7 +14878,10 @@ async function askScoutAgentById(input) {
14738
14878
  intent: "consult",
14739
14879
  channel: input.channel,
14740
14880
  speechText: input.shouldSpeak ? input.body.trim() : undefined,
14741
- execution: input.executionHarness ? { harness: input.executionHarness } : undefined,
14881
+ execution: {
14882
+ ...input.executionHarness ? { harness: input.executionHarness } : {},
14883
+ session: "new"
14884
+ },
14742
14885
  ensureAwake: true,
14743
14886
  messageMetadata: {
14744
14887
  source
@@ -14781,6 +14924,9 @@ async function askScoutQuestion(input) {
14781
14924
  const senderId = await resolveConversationActorId(broker.baseUrl, broker.snapshot, broker.node.id, input.senderId, currentDirectory);
14782
14925
  const createdAt = input.createdAtMs ?? Date.now();
14783
14926
  const messageBody = input.body.trim();
14927
+ const targetRef = input.targetRef?.trim() || (input.targetLabel.trim().startsWith("ref:") ? input.targetLabel.trim().slice("ref:".length) : "");
14928
+ const target = targetRef ? { kind: "binding_ref", ref: targetRef } : { kind: "agent_label", label: input.targetLabel };
14929
+ const renderedTarget = targetRef ? `ref:${targetRef}` : input.targetLabel;
14784
14930
  const delivery = await brokerPostDeliver(broker.baseUrl, {
14785
14931
  caller: {
14786
14932
  actorId: senderId,
@@ -14788,16 +14934,16 @@ async function askScoutQuestion(input) {
14788
14934
  currentDirectory,
14789
14935
  metadata: { source }
14790
14936
  },
14791
- target: {
14792
- kind: "agent_label",
14793
- label: input.targetLabel
14794
- },
14795
- targetLabel: input.targetLabel,
14937
+ target,
14938
+ targetLabel: renderedTarget,
14796
14939
  body: messageBody,
14797
14940
  intent: "consult",
14798
14941
  channel: input.channel,
14799
14942
  speechText: input.shouldSpeak ? stripScoutAgentSelectorLabels(messageBody) : undefined,
14800
- execution: input.executionHarness ? { harness: input.executionHarness } : undefined,
14943
+ execution: {
14944
+ ...input.executionHarness ? { harness: input.executionHarness } : {},
14945
+ session: targetRef ? "existing" : "new"
14946
+ },
14801
14947
  ensureAwake: true,
14802
14948
  messageMetadata: {
14803
14949
  source
@@ -14809,7 +14955,7 @@ async function askScoutQuestion(input) {
14809
14955
  if (delivery.kind !== "delivery") {
14810
14956
  return {
14811
14957
  usedBroker: true,
14812
- unresolvedTarget: input.targetLabel,
14958
+ unresolvedTarget: renderedTarget,
14813
14959
  targetDiagnostic: scoutTargetDiagnosticFromDeliveryFailure(delivery)
14814
14960
  };
14815
14961
  }
@@ -14827,6 +14973,7 @@ async function askScoutQuestion(input) {
14827
14973
  flight: delivery.flight,
14828
14974
  conversationId: delivery.conversation.id,
14829
14975
  messageId: delivery.message.id,
14976
+ bindingRef: delivery.receipt?.bindingRef ?? delivery.bindingRef,
14830
14977
  workItem
14831
14978
  };
14832
14979
  }
@@ -15204,7 +15351,7 @@ __export(exports_ask, {
15204
15351
  });
15205
15352
  function renderAskCommandHelp() {
15206
15353
  return [
15207
- "Usage: scout ask --to <agent> [--as <sender>] [--channel <name>] [--timeout <seconds>] [--harness <runtime>] [--prompt-file <path> | <message>]",
15354
+ "Usage: scout ask (--to <agent> | --ref <ref>) [--as <sender>] [--channel <name>] [--timeout <seconds>] [--harness <runtime>] [--prompt-file <path> | <message>]",
15208
15355
  "",
15209
15356
  "Ask one agent to do work or return a concrete answer.",
15210
15357
  "",
@@ -15223,6 +15370,7 @@ function renderAskCommandHelp() {
15223
15370
  "",
15224
15371
  "Examples:",
15225
15372
  ' scout ask --to hudson "review the parser"',
15373
+ ' scout ask --ref 7f3a9c21 "continue from that result"',
15226
15374
  " scout ask --to hudson --prompt-file ./handoff.md",
15227
15375
  ' scout ask --as premotion.master.mini --to hudson "build the editor"',
15228
15376
  ' scout ask --to vox.harness:codex "take another pass on the runtime fix"',
@@ -15300,6 +15448,7 @@ async function runAskWithOptions(context, options) {
15300
15448
  const result = await askScoutQuestion({
15301
15449
  senderId,
15302
15450
  targetLabel: options.targetLabel,
15451
+ targetRef: options.targetRef,
15303
15452
  body,
15304
15453
  channel: options.channel,
15305
15454
  executionHarness: parseScoutHarness(options.harness),
@@ -15320,6 +15469,7 @@ async function runAskWithOptions(context, options) {
15320
15469
  senderId,
15321
15470
  conversationId: result.conversationId ?? null,
15322
15471
  messageId: result.messageId ?? null,
15472
+ bindingRef: result.bindingRef ? `ref:${result.bindingRef}` : null,
15323
15473
  flight: completed,
15324
15474
  output: completed.output ?? completed.summary ?? ""
15325
15475
  }, (value) => value.output);
@@ -15389,6 +15539,9 @@ function renderScoutMessagePostResult(result) {
15389
15539
  const route = result.conversationId.startsWith("dm.") ? "DM" : "Conversation";
15390
15540
  lines.push(`${route}: ${result.conversationId}`);
15391
15541
  }
15542
+ if (result.bindingRef) {
15543
+ lines.push(`Ref: ref:${result.bindingRef}`);
15544
+ }
15392
15545
  if (result.invokedTargets.length > 0) {
15393
15546
  lines.push(`Routed to: ${result.invokedTargets.join(", ")}`);
15394
15547
  }
@@ -15480,7 +15633,7 @@ __export(exports_send, {
15480
15633
  });
15481
15634
  function renderSendCommandHelp() {
15482
15635
  return [
15483
- "Usage: scout send [--as <sender>] [--to <agent>] [--channel <name>] [--speak] [--harness <runtime>] [--message-file <path> | <message>]",
15636
+ "Usage: scout send [--as <sender>] [--to <agent> | --ref <ref>] [--channel <name>] [--speak] [--harness <runtime>] [--message-file <path> | <message>]",
15484
15637
  "",
15485
15638
  "Tell or update another agent or an explicit channel.",
15486
15639
  "",
@@ -15501,6 +15654,7 @@ function renderSendCommandHelp() {
15501
15654
  "",
15502
15655
  "Examples:",
15503
15656
  ' scout send --to hudson "ready for review; literal @codex stays text"',
15657
+ ' scout send --ref 7f3a9c21 "follow-up for that bound session"',
15504
15658
  ' scout send --to lattices#codex?5.5 "ready for review"',
15505
15659
  " scout send --channel triage --message-file ./status.md",
15506
15660
  ' scout send --as premotion.master.mini --to hudson "editor branch is green"',
@@ -15565,6 +15719,7 @@ async function runSendCommand(context, args) {
15565
15719
  senderId,
15566
15720
  body,
15567
15721
  targetLabel: options.targetLabel,
15722
+ targetRef: options.targetRef,
15568
15723
  channel: options.channel,
15569
15724
  shouldSpeak: options.shouldSpeak,
15570
15725
  executionHarness: parseScoutHarness(options.harness),
@@ -15583,6 +15738,7 @@ async function runSendCommand(context, args) {
15583
15738
  senderId,
15584
15739
  conversationId: result.conversationId,
15585
15740
  message: body,
15741
+ bindingRef: result.bindingRef,
15586
15742
  invokedTargets: result.invokedTargets,
15587
15743
  unresolvedTargets: result.unresolvedTargets,
15588
15744
  routeKind: result.routeKind
@@ -44505,30 +44661,40 @@ function resolveJavaScriptRuntimeExecutable() {
44505
44661
  }
44506
44662
  throw new Error("No JavaScript runtime found for openscout-runtime script entry. Install Node.js or set OPENSCOUT_RUNTIME_NODE_BIN.");
44507
44663
  }
44508
- function resolveRuntimeServiceEntrypoint() {
44509
- const installedExecutable = resolveExecutableFromSearch({
44510
- env: process.env,
44664
+ function resolveRuntimeServiceEntrypoint(options = {}) {
44665
+ const env = options.env ?? process.env;
44666
+ const moduleUrl = options.moduleUrl ?? import.meta.url;
44667
+ const currentWorkingDirectory = options.currentWorkingDirectory ?? process.cwd();
44668
+ const explicitRuntimeEntrypoint = resolveExecutableFromSearch({
44669
+ env,
44511
44670
  envKeys: ["OPENSCOUT_RUNTIME_BIN"],
44512
- names: ["openscout-runtime"]
44671
+ names: []
44513
44672
  });
44514
- if (installedExecutable) {
44515
- return installedExecutable.path;
44673
+ if (explicitRuntimeEntrypoint) {
44674
+ return explicitRuntimeEntrypoint.path;
44516
44675
  }
44517
- const fromNodeModules = resolveNodeModulesPackageEntrypoint(import.meta.url, ["@openscout", "runtime"], "bin/openscout-runtime.mjs");
44676
+ const fromNodeModules = resolveNodeModulesPackageEntrypoint(moduleUrl, ["@openscout", "runtime"], "bin/openscout-runtime.mjs");
44518
44677
  if (fromNodeModules) {
44519
44678
  return fromNodeModules;
44520
44679
  }
44521
44680
  const repoRoot = resolveOpenScoutRepoRoot({
44522
44681
  startDirectories: [
44523
- process.env.OPENSCOUT_SETUP_CWD,
44524
- process.cwd(),
44525
- dirname9(fileURLToPath7(import.meta.url))
44682
+ env.OPENSCOUT_SETUP_CWD,
44683
+ currentWorkingDirectory,
44684
+ dirname9(fileURLToPath7(moduleUrl))
44526
44685
  ]
44527
44686
  });
44528
44687
  const repoEntrypoint = resolveRepoEntrypoint(repoRoot, "packages/runtime/bin/openscout-runtime.mjs");
44529
44688
  if (repoEntrypoint) {
44530
44689
  return repoEntrypoint;
44531
44690
  }
44691
+ const installedExecutable = resolveExecutableFromSearch({
44692
+ env,
44693
+ names: ["openscout-runtime"]
44694
+ });
44695
+ if (installedExecutable) {
44696
+ return installedExecutable.path;
44697
+ }
44532
44698
  throw new Error("openscout-runtime not found on PATH. Install @openscout/runtime (e.g. npm i -g @openscout/runtime) or set OPENSCOUT_RUNTIME_BIN.");
44533
44699
  }
44534
44700
  function spawnArgsForRuntime(entry, serviceArgs) {
@@ -44551,9 +44717,11 @@ async function runRuntimeBrokerService(subcommand) {
44551
44717
  env: process.env,
44552
44718
  stdio: ["ignore", "pipe", "pipe"]
44553
44719
  });
44720
+ child.stdout?.setEncoding("utf8");
44554
44721
  child.stdout?.on("data", (chunk) => {
44555
44722
  stdoutChunks.push(chunk);
44556
44723
  });
44724
+ child.stderr?.setEncoding("utf8");
44557
44725
  child.stderr?.on("data", (chunk) => {
44558
44726
  stderrChunks.push(chunk);
44559
44727
  });
@@ -44562,8 +44730,8 @@ async function runRuntimeBrokerService(subcommand) {
44562
44730
  resolveExit(exitCode ?? 1);
44563
44731
  });
44564
44732
  });
44565
- const stdout = Buffer.concat(stdoutChunks).toString("utf8").trim();
44566
- const stderr = Buffer.concat(stderrChunks).toString("utf8").trim();
44733
+ const stdout = stdoutChunks.join("").trim();
44734
+ const stderr = stderrChunks.join("").trim();
44567
44735
  if (code !== 0) {
44568
44736
  const detail = stderr || stdout || `exit ${code}`;
44569
44737
  throw new Error(`openscout-runtime service ${subcommand} failed: ${detail}`);
@@ -45238,7 +45406,7 @@ import {
45238
45406
  renameSync,
45239
45407
  writeFileSync as writeFileSync4
45240
45408
  } from "fs";
45241
- import { homedir as homedir10 } from "os";
45409
+ import { homedir as homedir10, hostname as osHostname } from "os";
45242
45410
  import { dirname as dirname12, join as join18 } from "path";
45243
45411
  function localConfigHome() {
45244
45412
  return process.env.OPENSCOUT_HOME ?? join18(homedir10(), ".openscout");
@@ -46268,6 +46436,7 @@ var init_mcp = __esm(() => {
46268
46436
  });
46269
46437
 
46270
46438
  // ../../apps/desktop/src/core/mcp/scout-mcp.ts
46439
+ import { readFileSync as readFileSync8 } from "fs";
46271
46440
  import { basename as basename7, resolve as resolve12 } from "path";
46272
46441
  function createAgentPickerFieldMeta(input) {
46273
46442
  return {
@@ -46303,6 +46472,54 @@ function createToolUiMeta(fields) {
46303
46472
  [SCOUT_MCP_UI_META_KEY]: value
46304
46473
  };
46305
46474
  }
46475
+ function parseScoutReplyContextFromEnv(env) {
46476
+ const contextFile = env.OPENSCOUT_REPLY_CONTEXT_FILE?.trim();
46477
+ if (contextFile) {
46478
+ try {
46479
+ const rawFileJson = readFileSync8(contextFile, "utf8").trim();
46480
+ if (rawFileJson) {
46481
+ const parsed = JSON.parse(rawFileJson);
46482
+ if (isScoutReplyContext(parsed)) {
46483
+ return parsed;
46484
+ }
46485
+ }
46486
+ } catch {}
46487
+ }
46488
+ const rawJson = env.OPENSCOUT_REPLY_CONTEXT?.trim();
46489
+ if (rawJson) {
46490
+ try {
46491
+ const parsed = JSON.parse(rawJson);
46492
+ if (isScoutReplyContext(parsed)) {
46493
+ return parsed;
46494
+ }
46495
+ } catch {
46496
+ return null;
46497
+ }
46498
+ }
46499
+ const mode = env.OPENSCOUT_REPLY_MODE?.trim();
46500
+ const fromAgentId = env.OPENSCOUT_REPLY_FROM_AGENT_ID?.trim();
46501
+ const toAgentId = env.OPENSCOUT_REPLY_TO_AGENT_ID?.trim();
46502
+ const conversationId = env.OPENSCOUT_REPLY_CONVERSATION_ID?.trim();
46503
+ const messageId = env.OPENSCOUT_REPLY_MESSAGE_ID?.trim();
46504
+ const replyToMessageId = env.OPENSCOUT_REPLY_TO_MESSAGE_ID?.trim() || messageId;
46505
+ const replyPath = env.OPENSCOUT_REPLY_PATH?.trim() || "mcp_reply";
46506
+ if (mode === "broker_reply" && fromAgentId && toAgentId && conversationId && messageId && replyToMessageId && (replyPath === "final_response" || replyPath === "mcp_reply")) {
46507
+ return {
46508
+ mode: "broker_reply",
46509
+ fromAgentId,
46510
+ toAgentId,
46511
+ conversationId,
46512
+ messageId,
46513
+ replyToMessageId,
46514
+ replyPath,
46515
+ ...env.OPENSCOUT_REPLY_ACTION?.trim() ? { action: env.OPENSCOUT_REPLY_ACTION.trim() } : {}
46516
+ };
46517
+ }
46518
+ return null;
46519
+ }
46520
+ function isScoutReplyContext(value) {
46521
+ return value.mode === "broker_reply" && typeof value.fromAgentId === "string" && value.fromAgentId.length > 0 && typeof value.toAgentId === "string" && value.toAgentId.length > 0 && typeof value.conversationId === "string" && value.conversationId.length > 0 && typeof value.messageId === "string" && value.messageId.length > 0 && typeof value.replyToMessageId === "string" && value.replyToMessageId.length > 0 && (value.replyPath === "final_response" || value.replyPath === "mcp_reply");
46522
+ }
46306
46523
  function createTextContent(value) {
46307
46524
  return [{ type: "text", text: JSON.stringify(value, null, 2) }];
46308
46525
  }
@@ -46355,6 +46572,13 @@ function resolveAskReplyMode(input) {
46355
46572
  function workUrlFor(workItem) {
46356
46573
  return workItem ? `/api/work/${encodeURIComponent(workItem.id)}` : null;
46357
46574
  }
46575
+ function resolveCurrentCodexThreadId(env) {
46576
+ const threadId = env.CODEX_THREAD_ID?.trim();
46577
+ if (!threadId) {
46578
+ throw new Error("The current host session is not an attachable Codex session. Expected CODEX_THREAD_ID in the environment.");
46579
+ }
46580
+ return threadId;
46581
+ }
46358
46582
  function sendScoutReplyNotification(server, params) {
46359
46583
  return server.server.notification({
46360
46584
  method: "notifications/scout/reply",
@@ -46815,6 +47039,23 @@ function defaultScoutMcpDependencies(env) {
46815
47039
  currentDirectory,
46816
47040
  createdById
46817
47041
  }),
47042
+ attachCurrentLocalSession: ({
47043
+ externalSessionId,
47044
+ transport,
47045
+ currentDirectory,
47046
+ projectRoot,
47047
+ agentId,
47048
+ alias,
47049
+ displayName
47050
+ }) => attachScoutManagedLocalSession({
47051
+ externalSessionId,
47052
+ transport,
47053
+ currentDirectory,
47054
+ projectRoot,
47055
+ agentId,
47056
+ alias,
47057
+ displayName
47058
+ }),
46818
47059
  sendMessage: ({
46819
47060
  senderId,
46820
47061
  body,
@@ -46849,6 +47090,23 @@ function defaultScoutMcpDependencies(env) {
46849
47090
  currentDirectory,
46850
47091
  source
46851
47092
  }),
47093
+ replyMessage: ({
47094
+ senderId,
47095
+ body,
47096
+ conversationId,
47097
+ replyToMessageId,
47098
+ shouldSpeak,
47099
+ currentDirectory,
47100
+ source
47101
+ }) => replyToScoutMessage({
47102
+ senderId,
47103
+ body,
47104
+ conversationId,
47105
+ replyToMessageId,
47106
+ shouldSpeak,
47107
+ currentDirectory,
47108
+ source
47109
+ }),
46852
47110
  askQuestion: ({
46853
47111
  senderId,
46854
47112
  targetLabel,
@@ -46932,6 +47190,142 @@ function createScoutMcpServer(options) {
46932
47190
  structuredContent
46933
47191
  };
46934
47192
  });
47193
+ server.registerTool("current_reply_context", {
47194
+ title: "Current Scout Reply Context",
47195
+ description: "Inspect whether this MCP host has an active Scout broker reply context. Use this to distinguish replying to an inbound Scout ask from sending a new message.",
47196
+ inputSchema: object2({}),
47197
+ outputSchema: currentReplyContextResultSchema,
47198
+ annotations: {
47199
+ readOnlyHint: true,
47200
+ idempotentHint: true,
47201
+ destructiveHint: false,
47202
+ openWorldHint: false
47203
+ }
47204
+ }, async () => {
47205
+ const context = parseScoutReplyContextFromEnv(env);
47206
+ const structuredContent = {
47207
+ active: Boolean(context),
47208
+ context
47209
+ };
47210
+ return {
47211
+ content: createTextContent(structuredContent),
47212
+ structuredContent
47213
+ };
47214
+ });
47215
+ server.registerTool("messages_reply", {
47216
+ title: "Reply to Scout Message",
47217
+ description: "Reply to the active inbound Scout broker ask. If conversationId and replyToMessageId are omitted, this uses the active ScoutReplyContext. If there is no active context, use messages_send for a new message or pass both ids explicitly.",
47218
+ inputSchema: object2({
47219
+ body: string2().min(1),
47220
+ currentDirectory: string2().optional(),
47221
+ senderId: string2().optional(),
47222
+ conversationId: string2().optional(),
47223
+ replyToMessageId: string2().optional(),
47224
+ shouldSpeak: boolean2().optional()
47225
+ }),
47226
+ outputSchema: replyResultSchema,
47227
+ annotations: {
47228
+ readOnlyHint: false,
47229
+ idempotentHint: false,
47230
+ destructiveHint: false,
47231
+ openWorldHint: false
47232
+ }
47233
+ }, async ({
47234
+ body,
47235
+ currentDirectory,
47236
+ senderId,
47237
+ conversationId,
47238
+ replyToMessageId,
47239
+ shouldSpeak
47240
+ }) => {
47241
+ const resolvedCurrentDirectory = resolveToolCurrentDirectory(currentDirectory, options.defaultCurrentDirectory);
47242
+ const context = parseScoutReplyContextFromEnv(env);
47243
+ const resolvedConversationId = conversationId?.trim() || context?.conversationId || "";
47244
+ const resolvedReplyToMessageId = replyToMessageId?.trim() || context?.replyToMessageId || "";
47245
+ const resolvedSenderId = await deps.resolveSenderId(senderId ?? context?.toAgentId, resolvedCurrentDirectory, env);
47246
+ if (!resolvedConversationId || !resolvedReplyToMessageId) {
47247
+ const structuredContent2 = {
47248
+ currentDirectory: resolvedCurrentDirectory,
47249
+ senderId: resolvedSenderId,
47250
+ usedBroker: true,
47251
+ conversationId: resolvedConversationId || null,
47252
+ messageId: null,
47253
+ replyToMessageId: resolvedReplyToMessageId || null,
47254
+ notifiedActorIds: [],
47255
+ routingError: "missing_reply_context"
47256
+ };
47257
+ return {
47258
+ content: createPlainTextContent("No active Scout broker reply context. Use messages_send for a new message, or pass conversationId and replyToMessageId explicitly."),
47259
+ structuredContent: structuredContent2
47260
+ };
47261
+ }
47262
+ const result = await deps.replyMessage({
47263
+ senderId: resolvedSenderId,
47264
+ body,
47265
+ conversationId: resolvedConversationId,
47266
+ replyToMessageId: resolvedReplyToMessageId,
47267
+ shouldSpeak,
47268
+ currentDirectory: resolvedCurrentDirectory,
47269
+ source: "scout-mcp"
47270
+ });
47271
+ const structuredContent = {
47272
+ currentDirectory: resolvedCurrentDirectory,
47273
+ senderId: resolvedSenderId,
47274
+ usedBroker: result.usedBroker,
47275
+ conversationId: result.conversationId ?? resolvedConversationId,
47276
+ messageId: result.messageId ?? null,
47277
+ replyToMessageId: result.replyToMessageId ?? resolvedReplyToMessageId,
47278
+ notifiedActorIds: result.notifiedActorIds,
47279
+ routingError: result.routingError ?? null
47280
+ };
47281
+ return {
47282
+ content: createPlainTextContent(result.routingError ? `Reply was not sent: ${result.routingError}.` : `Reply sent in ${structuredContent.conversationId}${structuredContent.messageId ? ` (${structuredContent.messageId})` : ""}.`),
47283
+ structuredContent
47284
+ };
47285
+ });
47286
+ server.registerTool("session_attach_current", {
47287
+ title: "Attach Current Codex Session",
47288
+ description: "Attach the current live Codex session to Scout so other agents can route direct messages and asks back to it. This requires a Codex host that exposes CODEX_THREAD_ID; Claude and other hosts do not support this attach path yet.",
47289
+ inputSchema: object2({
47290
+ currentDirectory: string2().optional(),
47291
+ projectPath: string2().optional(),
47292
+ agentId: string2().optional(),
47293
+ alias: string2().optional(),
47294
+ displayName: string2().optional()
47295
+ }),
47296
+ outputSchema: currentSessionAttachResultSchema,
47297
+ annotations: {
47298
+ readOnlyHint: false,
47299
+ idempotentHint: false,
47300
+ destructiveHint: false,
47301
+ openWorldHint: false
47302
+ }
47303
+ }, async ({ currentDirectory, projectPath, agentId, alias, displayName }) => {
47304
+ const resolvedCurrentDirectory = resolveToolCurrentDirectory(currentDirectory, options.defaultCurrentDirectory);
47305
+ const externalSessionId = resolveCurrentCodexThreadId(env);
47306
+ const attached = await deps.attachCurrentLocalSession({
47307
+ externalSessionId,
47308
+ transport: "codex_app_server",
47309
+ currentDirectory: resolvedCurrentDirectory,
47310
+ projectRoot: projectPath?.trim() ? resolve12(projectPath.trim()) : undefined,
47311
+ agentId: agentId?.trim() || undefined,
47312
+ alias: alias?.trim() || undefined,
47313
+ displayName: displayName?.trim() || undefined
47314
+ });
47315
+ const structuredContent = {
47316
+ currentDirectory: resolvedCurrentDirectory,
47317
+ externalSessionId,
47318
+ transport: "codex_app_server",
47319
+ agentId: attached.agentId,
47320
+ selector: attached.selector ?? null,
47321
+ endpointId: attached.endpointId,
47322
+ sessionId: attached.sessionId
47323
+ };
47324
+ return {
47325
+ content: createPlainTextContent(attached.selector ? `Current Codex session attached as ${attached.selector}.` : `Current Codex session attached as ${attached.agentId}.`),
47326
+ structuredContent
47327
+ };
47328
+ });
46935
47329
  server.registerTool("card_create", {
46936
47330
  title: "Create Scout Agent Card",
46937
47331
  description: "Create a dedicated Scout agent card with a reply-ready return address. Use this when another agent should get back to you on a fresh project-scoped inbox or worktree-scoped alias. One target stays private by default; group coordination still requires an explicit channel elsewhere.",
@@ -47136,6 +47530,7 @@ function createScoutMcpServer(options) {
47136
47530
  usedBroker: result2.usedBroker,
47137
47531
  conversationId: result2.conversationId ?? null,
47138
47532
  messageId: result2.messageId ?? null,
47533
+ bindingRef: result2.bindingRef ? `ref:${result2.bindingRef}` : null,
47139
47534
  invokedTargetIds: result2.invokedTargets,
47140
47535
  unresolvedTargetIds: result2.unresolvedTargets,
47141
47536
  targetDiagnostic: result2.targetDiagnostic ?? null,
@@ -47162,6 +47557,7 @@ function createScoutMcpServer(options) {
47162
47557
  usedBroker: result.usedBroker,
47163
47558
  conversationId: result.conversationId ?? null,
47164
47559
  messageId: result.messageId ?? null,
47560
+ bindingRef: result.bindingRef ? `ref:${result.bindingRef}` : null,
47165
47561
  invokedTargetIds: result.invokedTargets,
47166
47562
  unresolvedTargetIds: result.unresolvedTargets,
47167
47563
  targetDiagnostic: result.targetDiagnostic ?? null,
@@ -47319,6 +47715,7 @@ function createScoutMcpServer(options) {
47319
47715
  targetLabel: targetLabel.trim(),
47320
47716
  conversationId: result.conversationId ?? null,
47321
47717
  messageId: result.messageId ?? null,
47718
+ bindingRef: result.bindingRef ? `ref:${result.bindingRef}` : null,
47322
47719
  flightId: result.flight.id,
47323
47720
  workItem: trackedWorkItem,
47324
47721
  workId: trackedWorkItem?.id ?? null,
@@ -47341,6 +47738,7 @@ function createScoutMcpServer(options) {
47341
47738
  } : null,
47342
47739
  conversationId: result.conversationId ?? null,
47343
47740
  messageId: result.messageId ?? null,
47741
+ bindingRef: result.bindingRef ? `ref:${result.bindingRef}` : null,
47344
47742
  flight: completedFlight ?? result.flight ?? null,
47345
47743
  flightId: completedFlight?.id ?? result.flight?.id ?? null,
47346
47744
  output: completedFlight?.output ?? completedFlight?.summary ?? null,
@@ -47402,7 +47800,7 @@ async function runScoutMcpServer(options) {
47402
47800
  const transport = new StdioServerTransport;
47403
47801
  await server.connect(transport);
47404
47802
  }
47405
- var AGENT_STATE_VALUES, REGISTRATION_KIND_VALUES, RESOLVE_KIND_VALUES, MESSAGE_ROUTE_KIND_VALUES, MESSAGE_ROUTING_ERROR_VALUES, REPLY_MODE_VALUES, REPLY_DELIVERY_VALUES, LOCAL_AGENT_HARNESS_VALUES, SCOUT_MCP_UI_META_KEY = "openscout/ui", scoutAgentToolIconMeta, scoutAgentAvatarMeta, targetLabelInputSchema, targetAgentIdInputSchema, mentionAgentIdsInputSchema, flightSchema, trackedWorkItemSchema, workItemInputSchema, waitingOnSchema, progressSchema, workItemUpdateSchema, agentCandidateSchema, scoutReturnAddressSchema, scoutAgentCardSchema, whoAmISchema, searchResultSchema, resolveResultSchema, sendResultSchema, cardCreateResultSchema, askResultSchema, workUpdateResultSchema;
47803
+ var AGENT_STATE_VALUES, REGISTRATION_KIND_VALUES, RESOLVE_KIND_VALUES, MESSAGE_ROUTE_KIND_VALUES, MESSAGE_ROUTING_ERROR_VALUES, REPLY_MODE_VALUES, REPLY_DELIVERY_VALUES, LOCAL_AGENT_HARNESS_VALUES, SCOUT_MCP_UI_META_KEY = "openscout/ui", scoutAgentToolIconMeta, scoutAgentAvatarMeta, targetLabelInputSchema, targetAgentIdInputSchema, mentionAgentIdsInputSchema, flightSchema, trackedWorkItemSchema, workItemInputSchema, waitingOnSchema, progressSchema, workItemUpdateSchema, agentCandidateSchema, scoutReturnAddressSchema, scoutAgentCardSchema, whoAmISchema, searchResultSchema, resolveResultSchema, sendResultSchema, replyContextSchema, currentReplyContextResultSchema, replyResultSchema, cardCreateResultSchema, currentSessionAttachResultSchema, askResultSchema, workUpdateResultSchema;
47406
47804
  var init_scout_mcp = __esm(() => {
47407
47805
  init_mcp();
47408
47806
  init_stdio2();
@@ -47599,11 +47997,49 @@ var init_scout_mcp = __esm(() => {
47599
47997
  routeKind: _enum2(MESSAGE_ROUTE_KIND_VALUES).nullable(),
47600
47998
  routingError: _enum2(MESSAGE_ROUTING_ERROR_VALUES).nullable()
47601
47999
  });
48000
+ replyContextSchema = object2({
48001
+ mode: literal("broker_reply"),
48002
+ fromAgentId: string2(),
48003
+ toAgentId: string2(),
48004
+ conversationId: string2(),
48005
+ messageId: string2(),
48006
+ replyToMessageId: string2(),
48007
+ replyPath: _enum2(["final_response", "mcp_reply"]),
48008
+ action: string2().optional()
48009
+ });
48010
+ currentReplyContextResultSchema = object2({
48011
+ active: boolean2(),
48012
+ context: replyContextSchema.nullable()
48013
+ });
48014
+ replyResultSchema = object2({
48015
+ currentDirectory: string2(),
48016
+ senderId: string2(),
48017
+ usedBroker: boolean2(),
48018
+ conversationId: string2().nullable(),
48019
+ messageId: string2().nullable(),
48020
+ replyToMessageId: string2().nullable(),
48021
+ notifiedActorIds: array(string2()),
48022
+ routingError: _enum2([
48023
+ "missing_reply_context",
48024
+ "unknown_conversation",
48025
+ "unknown_reply_target",
48026
+ "reply_target_conversation_mismatch"
48027
+ ]).nullable()
48028
+ });
47602
48029
  cardCreateResultSchema = object2({
47603
48030
  currentDirectory: string2(),
47604
48031
  senderId: string2(),
47605
48032
  card: scoutAgentCardSchema
47606
48033
  });
48034
+ currentSessionAttachResultSchema = object2({
48035
+ currentDirectory: string2(),
48036
+ externalSessionId: string2(),
48037
+ transport: literal("codex_app_server"),
48038
+ agentId: string2(),
48039
+ selector: string2().nullable(),
48040
+ endpointId: string2(),
48041
+ sessionId: string2()
48042
+ });
47607
48043
  askResultSchema = object2({
47608
48044
  currentDirectory: string2(),
47609
48045
  senderId: string2(),
@@ -47639,6 +48075,325 @@ var init_scout_mcp = __esm(() => {
47639
48075
  });
47640
48076
  });
47641
48077
 
48078
+ // ../../apps/desktop/src/cli/commands/mcp-install.ts
48079
+ import { spawnSync as spawnSync2 } from "child_process";
48080
+ import { accessSync as accessSync3, constants as constants5, existsSync as existsSync14 } from "fs";
48081
+ import { homedir as homedir11 } from "os";
48082
+ import { delimiter as delimiter4, join as join19, resolve as resolve13 } from "path";
48083
+ function isExecutable4(filePath) {
48084
+ if (!filePath) {
48085
+ return false;
48086
+ }
48087
+ try {
48088
+ accessSync3(filePath, constants5.X_OK);
48089
+ return true;
48090
+ } catch {
48091
+ return false;
48092
+ }
48093
+ }
48094
+ function resolveExecutableFromSearchPath2(names, env) {
48095
+ const pathEntries = (env.PATH ?? "").split(delimiter4).filter(Boolean);
48096
+ const commonDirectories = [
48097
+ join19(homedir11(), ".local", "bin"),
48098
+ join19(homedir11(), ".bun", "bin"),
48099
+ "/opt/homebrew/bin",
48100
+ "/usr/local/bin",
48101
+ "/Applications/Codex.app/Contents/Resources"
48102
+ ];
48103
+ for (const directory of [...pathEntries, ...commonDirectories]) {
48104
+ for (const name of names) {
48105
+ const candidate = join19(directory, name);
48106
+ if (isExecutable4(candidate)) {
48107
+ return candidate;
48108
+ }
48109
+ }
48110
+ }
48111
+ return null;
48112
+ }
48113
+ function resolveHostExecutable(host, env) {
48114
+ if (host === "codex") {
48115
+ return resolveExecutableFromSearchPath2(["codex"], env);
48116
+ }
48117
+ return resolveExecutableFromSearchPath2(["claude"], env);
48118
+ }
48119
+ function resolveCurrentScoutMcpLaunchCommand(env) {
48120
+ const currentScript = process.argv[1];
48121
+ if (currentScript && existsSync14(currentScript) && isExecutable4(process.execPath)) {
48122
+ return {
48123
+ command: process.execPath,
48124
+ args: [resolve13(currentScript), "mcp"]
48125
+ };
48126
+ }
48127
+ const explicitCandidates = [
48128
+ env.OPENSCOUT_CLI_BIN,
48129
+ env.SCOUT_CLI_BIN,
48130
+ env.OPENSCOUT_SCOUT_BIN,
48131
+ env.SCOUT_BIN
48132
+ ];
48133
+ for (const candidate of explicitCandidates) {
48134
+ if (isExecutable4(candidate)) {
48135
+ return {
48136
+ command: candidate,
48137
+ args: ["mcp"]
48138
+ };
48139
+ }
48140
+ }
48141
+ const scoutExecutable = resolveExecutableFromSearchPath2(["scout"], env);
48142
+ if (scoutExecutable) {
48143
+ return {
48144
+ command: scoutExecutable,
48145
+ args: ["mcp"]
48146
+ };
48147
+ }
48148
+ throw new ScoutCliError("Could not resolve a Scout CLI command to register with MCP hosts.");
48149
+ }
48150
+ function parseFlagValue2(args, index, flag) {
48151
+ const current = args[index] ?? "";
48152
+ if (current === flag) {
48153
+ const value = args[index + 1];
48154
+ if (!value) {
48155
+ throw new ScoutCliError(`missing value for ${flag}`);
48156
+ }
48157
+ return { value, nextIndex: index + 1 };
48158
+ }
48159
+ const prefix = `${flag}=`;
48160
+ if (current.startsWith(prefix)) {
48161
+ return { value: current.slice(prefix.length), nextIndex: index };
48162
+ }
48163
+ throw new ScoutCliError(`missing value for ${flag}`);
48164
+ }
48165
+ function parseHostValue(value) {
48166
+ if (value === "codex" || value === "claude") {
48167
+ return value;
48168
+ }
48169
+ throw new ScoutCliError(`unsupported MCP host "${value}" (expected codex or claude)`);
48170
+ }
48171
+ function renderMcpInstallHelp() {
48172
+ return [
48173
+ "Usage: scout mcp install [--host <codex|claude>] [--force] [--dry-run]",
48174
+ "",
48175
+ "Register the current Scout MCP server command with supported local hosts.",
48176
+ "",
48177
+ "Defaults to every detected host. Codex is installed through its global",
48178
+ "config, and Claude Code is installed at user scope.",
48179
+ "",
48180
+ "Examples:",
48181
+ " scout mcp install",
48182
+ " scout mcp install --host codex --force",
48183
+ " scout mcp install --host claude --dry-run"
48184
+ ].join(`
48185
+ `);
48186
+ }
48187
+ function parseMcpInstallCommandOptions(args, env) {
48188
+ const hosts = [];
48189
+ let force = false;
48190
+ let dryRun = false;
48191
+ for (let index = 0;index < args.length; index += 1) {
48192
+ const current = args[index] ?? "";
48193
+ if (!current) {
48194
+ continue;
48195
+ }
48196
+ if (HELP_FLAGS5.has(current)) {
48197
+ continue;
48198
+ }
48199
+ if (current === "--force") {
48200
+ force = true;
48201
+ continue;
48202
+ }
48203
+ if (current === "--dry-run") {
48204
+ dryRun = true;
48205
+ continue;
48206
+ }
48207
+ if (current === "--host" || current.startsWith("--host=")) {
48208
+ const parsed = parseFlagValue2(args, index, "--host");
48209
+ hosts.push(parseHostValue(parsed.value));
48210
+ index = parsed.nextIndex;
48211
+ continue;
48212
+ }
48213
+ throw new ScoutCliError(`unexpected argument for mcp install: ${current}`);
48214
+ }
48215
+ const resolvedHosts = hosts.length > 0 ? [...new Set(hosts)] : ["codex", "claude"].filter((host) => resolveHostExecutable(host, env) !== null);
48216
+ return {
48217
+ dryRun,
48218
+ force,
48219
+ hosts: [...resolvedHosts]
48220
+ };
48221
+ }
48222
+ function defaultCommandRunner(context) {
48223
+ return (command, args) => {
48224
+ const result = spawnSync2(command, args, {
48225
+ cwd: context.cwd,
48226
+ env: context.env,
48227
+ encoding: "utf8",
48228
+ stdio: "pipe"
48229
+ });
48230
+ return {
48231
+ status: result.status,
48232
+ stdout: result.stdout ?? "",
48233
+ stderr: result.stderr ?? "",
48234
+ error: result.error
48235
+ };
48236
+ };
48237
+ }
48238
+ function commandFailed(result) {
48239
+ return Boolean(result.error) || result.status !== 0;
48240
+ }
48241
+ function installForCodex(input) {
48242
+ const existing = input.run(input.executablePath, ["mcp", "get", "scout"]);
48243
+ if (!commandFailed(existing) && !input.force) {
48244
+ return {
48245
+ host: "codex",
48246
+ status: "already_installed",
48247
+ detail: "Codex already has a scout MCP entry."
48248
+ };
48249
+ }
48250
+ if (input.dryRun) {
48251
+ return {
48252
+ host: "codex",
48253
+ status: "installed",
48254
+ detail: `Would run: ${input.executablePath} mcp add scout -- ${input.launch.command} ${input.launch.args.join(" ")}`
48255
+ };
48256
+ }
48257
+ if (!commandFailed(existing) && input.force) {
48258
+ const removed = input.run(input.executablePath, ["mcp", "remove", "scout"]);
48259
+ if (commandFailed(removed)) {
48260
+ return {
48261
+ host: "codex",
48262
+ status: "failed",
48263
+ detail: removed.stderr.trim() || removed.stdout.trim() || "Failed to replace existing Codex MCP config."
48264
+ };
48265
+ }
48266
+ }
48267
+ const added = input.run(input.executablePath, [
48268
+ "mcp",
48269
+ "add",
48270
+ "scout",
48271
+ "--",
48272
+ input.launch.command,
48273
+ ...input.launch.args
48274
+ ]);
48275
+ if (commandFailed(added)) {
48276
+ return {
48277
+ host: "codex",
48278
+ status: "failed",
48279
+ detail: added.stderr.trim() || added.stdout.trim() || "Failed to install scout MCP into Codex."
48280
+ };
48281
+ }
48282
+ return {
48283
+ host: "codex",
48284
+ status: "installed",
48285
+ detail: "Installed scout MCP for Codex."
48286
+ };
48287
+ }
48288
+ function installForClaude(input) {
48289
+ const existing = input.run(input.executablePath, ["mcp", "get", "scout"]);
48290
+ if (!commandFailed(existing) && !input.force) {
48291
+ return {
48292
+ host: "claude",
48293
+ status: "already_installed",
48294
+ detail: "Claude Code already has a scout MCP entry."
48295
+ };
48296
+ }
48297
+ if (input.dryRun) {
48298
+ return {
48299
+ host: "claude",
48300
+ status: "installed",
48301
+ detail: `Would run: ${input.executablePath} mcp add --scope user scout -- ${input.launch.command} ${input.launch.args.join(" ")}`
48302
+ };
48303
+ }
48304
+ if (!commandFailed(existing) && input.force) {
48305
+ const removed = input.run(input.executablePath, ["mcp", "remove", "--scope", "user", "scout"]);
48306
+ if (commandFailed(removed)) {
48307
+ return {
48308
+ host: "claude",
48309
+ status: "failed",
48310
+ detail: removed.stderr.trim() || removed.stdout.trim() || "Failed to replace existing Claude Code MCP config."
48311
+ };
48312
+ }
48313
+ }
48314
+ const added = input.run(input.executablePath, [
48315
+ "mcp",
48316
+ "add",
48317
+ "--scope",
48318
+ "user",
48319
+ "scout",
48320
+ "--",
48321
+ input.launch.command,
48322
+ ...input.launch.args
48323
+ ]);
48324
+ if (commandFailed(added)) {
48325
+ return {
48326
+ host: "claude",
48327
+ status: "failed",
48328
+ detail: added.stderr.trim() || added.stdout.trim() || "Failed to install scout MCP into Claude Code."
48329
+ };
48330
+ }
48331
+ return {
48332
+ host: "claude",
48333
+ status: "installed",
48334
+ detail: "Installed scout MCP for Claude Code."
48335
+ };
48336
+ }
48337
+ function installScoutMcpForHosts(input) {
48338
+ const launch = (input.resolveLaunchCommand ?? resolveCurrentScoutMcpLaunchCommand)(input.env);
48339
+ const run = input.run ?? (input.context ? defaultCommandRunner(input.context) : undefined);
48340
+ const resolveHostPath = input.resolveHostPath ?? resolveHostExecutable;
48341
+ if (!run) {
48342
+ throw new ScoutCliError("A command runner or command context is required.");
48343
+ }
48344
+ return input.hosts.map((host) => {
48345
+ const executablePath = resolveHostPath(host, input.env);
48346
+ if (!executablePath) {
48347
+ return {
48348
+ host,
48349
+ status: "skipped",
48350
+ detail: `Skipped ${host}: executable not found.`
48351
+ };
48352
+ }
48353
+ if (host === "codex") {
48354
+ return installForCodex({
48355
+ executablePath,
48356
+ launch,
48357
+ force: input.force,
48358
+ dryRun: input.dryRun,
48359
+ run
48360
+ });
48361
+ }
48362
+ return installForClaude({
48363
+ executablePath,
48364
+ launch,
48365
+ force: input.force,
48366
+ dryRun: input.dryRun,
48367
+ run
48368
+ });
48369
+ });
48370
+ }
48371
+ async function runMcpInstallCommand(context, args) {
48372
+ if (args.some((arg) => HELP_FLAGS5.has(arg))) {
48373
+ context.output.writeText(renderMcpInstallHelp());
48374
+ return;
48375
+ }
48376
+ const options = parseMcpInstallCommandOptions(args, context.env);
48377
+ if (options.hosts.length === 0) {
48378
+ context.output.writeText("No supported hosts detected. Looked for codex and claude.");
48379
+ return;
48380
+ }
48381
+ const outcomes = installScoutMcpForHosts({
48382
+ env: context.env,
48383
+ hosts: options.hosts,
48384
+ force: options.force,
48385
+ dryRun: options.dryRun,
48386
+ context
48387
+ });
48388
+ context.output.writeText(outcomes.map((outcome) => `[${outcome.host}] ${outcome.detail}`).join(`
48389
+ `));
48390
+ }
48391
+ var HELP_FLAGS5;
48392
+ var init_mcp_install = __esm(() => {
48393
+ init_errors();
48394
+ HELP_FLAGS5 = new Set(["--help", "-h"]);
48395
+ });
48396
+
47642
48397
  // ../../apps/desktop/src/cli/commands/mcp.ts
47643
48398
  var exports_mcp = {};
47644
48399
  __export(exports_mcp, {
@@ -47647,31 +48402,42 @@ __export(exports_mcp, {
47647
48402
  });
47648
48403
  function renderMcpCommandHelp() {
47649
48404
  return [
47650
- "Usage: scout mcp [--context-root <path>]",
48405
+ "Usage:",
48406
+ " scout mcp [--context-root <path>]",
48407
+ " scout mcp install [--host <codex|claude>] [--force] [--dry-run]",
47651
48408
  "",
47652
- "Run a Scout MCP server over stdio.",
48409
+ "Run or install the Scout MCP server.",
47653
48410
  "",
47654
- "This command is intended to be launched by an MCP host. It exposes",
48411
+ "The stdio server form is intended to be launched by an MCP host. It exposes",
47655
48412
  "the same canonical Scout coordination loop the CLI teaches:",
47656
48413
  "",
47657
48414
  " whoami inspect sender identity when the host is unclear",
48415
+ " session_attach_current",
48416
+ " attach the current live Codex session to Scout",
48417
+ " card_create fresh reply-ready return address",
47658
48418
  " agents_search find likely targets when routing is ambiguous",
47659
48419
  " agents_resolve pin one exact target when needed",
47660
48420
  " messages_send tell / update with explicit target fields or channel",
47661
48421
  " invocations_ask owned work / reply handoff with explicit target fields",
47662
48422
  " work_update progress / waiting / review / done for existing work",
47663
- " card_create fresh reply-ready return address",
47664
48423
  "",
47665
48424
  "Pass targets as tool fields. Message body text is payload, so quoted",
47666
- "handles such as @codex should not become routing instructions."
48425
+ "handles such as @codex should not become routing instructions.",
48426
+ "",
48427
+ renderMcpInstallHelp()
47667
48428
  ].join(`
47668
48429
  `);
47669
48430
  }
47670
48431
  async function runMcpCommand(context, args) {
48432
+ const subcommand = args[0]?.trim() || "";
47671
48433
  if (args.includes("--help") || args.includes("-h")) {
47672
48434
  context.output.writeText(renderMcpCommandHelp());
47673
48435
  return;
47674
48436
  }
48437
+ if (subcommand === "install") {
48438
+ await runMcpInstallCommand(context, args.slice(1));
48439
+ return;
48440
+ }
47675
48441
  const options = parseContextRootCommandOptions("mcp", args, defaultScoutContextDirectory(context));
47676
48442
  await runScoutMcpServer({
47677
48443
  defaultCurrentDirectory: options.currentDirectory,
@@ -47682,6 +48448,7 @@ var init_mcp2 = __esm(() => {
47682
48448
  init_context();
47683
48449
  init_options();
47684
48450
  init_scout_mcp();
48451
+ init_mcp_install();
47685
48452
  });
47686
48453
 
47687
48454
  // ../../apps/desktop/src/cli/commands/menu.ts
@@ -47691,10 +48458,10 @@ __export(exports_menu, {
47691
48458
  renderMenuCommandHelp: () => renderMenuCommandHelp,
47692
48459
  parseMenuCommand: () => parseMenuCommand
47693
48460
  });
47694
- import { spawnSync as spawnSync2 } from "child_process";
47695
- import { existsSync as existsSync14 } from "fs";
47696
- import { homedir as homedir11 } from "os";
47697
- import { dirname as dirname13, join as join19, resolve as resolve13 } from "path";
48461
+ import { spawnSync as spawnSync3 } from "child_process";
48462
+ import { existsSync as existsSync15 } from "fs";
48463
+ import { homedir as homedir12 } from "os";
48464
+ import { dirname as dirname13, join as join20, resolve as resolve14 } from "path";
47698
48465
  import { fileURLToPath as fileURLToPath9 } from "url";
47699
48466
  function renderMenuCommandHelp() {
47700
48467
  return [
@@ -47755,7 +48522,7 @@ function parseMenuCommand(args) {
47755
48522
  }
47756
48523
  }
47757
48524
  function runProcess(command, args, options) {
47758
- const result = spawnSync2(command, args, {
48525
+ const result = spawnSync3(command, args, {
47759
48526
  cwd: options.cwd,
47760
48527
  env: options.env,
47761
48528
  encoding: "utf8"
@@ -47778,10 +48545,10 @@ function runProcess(command, args, options) {
47778
48545
  };
47779
48546
  }
47780
48547
  function findRepoMenuHelper(startDirectory) {
47781
- let current = resolve13(startDirectory);
48548
+ let current = resolve14(startDirectory);
47782
48549
  while (true) {
47783
- const candidate = join19(current, "apps", "macos", "bin", "openscout-menu.ts");
47784
- if (existsSync14(candidate)) {
48550
+ const candidate = join20(current, "apps", "macos", "bin", "openscout-menu.ts");
48551
+ if (existsSync15(candidate)) {
47785
48552
  return candidate;
47786
48553
  }
47787
48554
  const parent = dirname13(current);
@@ -47790,11 +48557,11 @@ function findRepoMenuHelper(startDirectory) {
47790
48557
  }
47791
48558
  current = parent;
47792
48559
  }
47793
- const sourceRelativeCandidate = fileURLToPath9(new URL("../../../../macos/bin/openscout-menu.ts", import.meta.url));
47794
- return existsSync14(sourceRelativeCandidate) ? sourceRelativeCandidate : null;
48560
+ const sourceRelativeCandidate = fileURLToPath9(new URL("../../../../macos/bin/openscout-menu.ts", import.meta.url).toString());
48561
+ return existsSync15(sourceRelativeCandidate) ? sourceRelativeCandidate : null;
47795
48562
  }
47796
48563
  function resolveRepoBundlePath(helperPath) {
47797
- return resolve13(dirname13(helperPath), "..", "dist", MENU_BUNDLE_NAME);
48564
+ return resolve14(dirname13(helperPath), "..", "dist", MENU_BUNDLE_NAME);
47798
48565
  }
47799
48566
  function isMenuRunning(env) {
47800
48567
  return runProcess("pgrep", ["-x", MENU_PROCESS_NAME], { env, allowFailure: true }).ok;
@@ -47810,7 +48577,7 @@ function resolveInstalledMenuBundlePath(env) {
47810
48577
  return indexedPath;
47811
48578
  }
47812
48579
  for (const candidate of COMMON_MENU_BUNDLE_PATHS) {
47813
- if (existsSync14(candidate)) {
48580
+ if (existsSync15(candidate)) {
47814
48581
  return candidate;
47815
48582
  }
47816
48583
  }
@@ -47879,7 +48646,7 @@ function runWithRepoHelper(context, helperPath, command) {
47879
48646
  });
47880
48647
  const bundlePath = resolveRepoBundlePath(helperPath);
47881
48648
  const running = command.action === "quit" ? false : isMenuRunning(context.env);
47882
- const installed = existsSync14(bundlePath) || running;
48649
+ const installed = existsSync15(bundlePath) || running;
47883
48650
  return {
47884
48651
  action: command.action,
47885
48652
  mode: "repo-helper",
@@ -47928,7 +48695,7 @@ function runWithInstalledApp(context, command) {
47928
48695
  };
47929
48696
  }
47930
48697
  async function runMenuCommand(context, args) {
47931
- if (HELP_FLAGS5.has(args[0] ?? "")) {
48698
+ if (HELP_FLAGS6.has(args[0] ?? "")) {
47932
48699
  context.output.writeText(renderMenuCommandHelp());
47933
48700
  return;
47934
48701
  }
@@ -47940,14 +48707,14 @@ async function runMenuCommand(context, args) {
47940
48707
  const result = helperPath ? runWithRepoHelper(context, helperPath, command) : runWithInstalledApp(context, command);
47941
48708
  context.output.writeValue(result, renderMenuResult);
47942
48709
  }
47943
- var MENU_BUNDLE_ID = "com.openscout.menu", MENU_BUNDLE_NAME = "OpenScoutMenu.app", MENU_PROCESS_NAME = "OpenScoutMenu", HELP_FLAGS5, COMMON_MENU_BUNDLE_PATHS;
48710
+ var MENU_BUNDLE_ID = "com.openscout.menu", MENU_BUNDLE_NAME = "OpenScoutMenu.app", MENU_PROCESS_NAME = "OpenScoutMenu", HELP_FLAGS6, COMMON_MENU_BUNDLE_PATHS;
47944
48711
  var init_menu = __esm(() => {
47945
48712
  init_context();
47946
48713
  init_errors();
47947
- HELP_FLAGS5 = new Set(["help", "--help", "-h"]);
48714
+ HELP_FLAGS6 = new Set(["help", "--help", "-h"]);
47948
48715
  COMMON_MENU_BUNDLE_PATHS = [
47949
- join19("/Applications", MENU_BUNDLE_NAME),
47950
- join19(homedir11(), "Applications", MENU_BUNDLE_NAME)
48716
+ join20("/Applications", MENU_BUNDLE_NAME),
48717
+ join20(homedir12(), "Applications", MENU_BUNDLE_NAME)
47951
48718
  ];
47952
48719
  });
47953
48720
 
@@ -48467,11 +49234,11 @@ var init_mesh = __esm(() => {
48467
49234
  });
48468
49235
 
48469
49236
  // ../../apps/desktop/src/core/pairing/runtime/config.ts
48470
- import { existsSync as existsSync15, mkdirSync as mkdirSync5, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "fs";
48471
- import { homedir as homedir12 } from "os";
49237
+ import { existsSync as existsSync16, mkdirSync as mkdirSync5, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "fs";
49238
+ import { homedir as homedir13 } from "os";
48472
49239
  import path from "path";
48473
49240
  function pairingPaths() {
48474
- const rootDir = path.join(homedir12(), ".scout/pairing");
49241
+ const rootDir = path.join(homedir13(), ".scout/pairing");
48475
49242
  return {
48476
49243
  rootDir,
48477
49244
  configPath: path.join(rootDir, "config.json"),
@@ -48484,11 +49251,11 @@ function pairingPaths() {
48484
49251
  }
48485
49252
  function loadPairingConfig() {
48486
49253
  const { configPath } = pairingPaths();
48487
- if (!existsSync15(configPath)) {
49254
+ if (!existsSync16(configPath)) {
48488
49255
  return {};
48489
49256
  }
48490
49257
  try {
48491
- const payload = JSON.parse(readFileSync8(configPath, "utf8"));
49258
+ const payload = JSON.parse(readFileSync9(configPath, "utf8"));
48492
49259
  return typeof payload === "object" && payload ? payload : {};
48493
49260
  } catch {
48494
49261
  return {};
@@ -50571,17 +51338,17 @@ var init_noise = __esm(() => {
50571
51338
  });
50572
51339
 
50573
51340
  // ../../apps/desktop/src/core/pairing/runtime/security/identity.ts
50574
- import { existsSync as existsSync16, mkdirSync as mkdirSync6, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "fs";
50575
- import { join as join20 } from "path";
50576
- import { homedir as homedir13 } from "os";
51341
+ import { existsSync as existsSync17, mkdirSync as mkdirSync6, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "fs";
51342
+ import { join as join21 } from "path";
51343
+ import { homedir as homedir14 } from "os";
50577
51344
  function loadOrCreateIdentity() {
50578
- if (existsSync16(IDENTITY_FILE)) {
51345
+ if (existsSync17(IDENTITY_FILE)) {
50579
51346
  return loadIdentity();
50580
51347
  }
50581
51348
  return createAndSaveIdentity();
50582
51349
  }
50583
51350
  function loadIdentity() {
50584
- const data = JSON.parse(readFileSync9(IDENTITY_FILE, "utf8"));
51351
+ const data = JSON.parse(readFileSync10(IDENTITY_FILE, "utf8"));
50585
51352
  return {
50586
51353
  publicKey: hexToBytes2(data.publicKey),
50587
51354
  privateKey: hexToBytes2(data.privateKey)
@@ -50599,9 +51366,9 @@ function createAndSaveIdentity() {
50599
51366
  return keyPair;
50600
51367
  }
50601
51368
  function loadTrustedPeers() {
50602
- if (!existsSync16(TRUSTED_PEERS_FILE))
51369
+ if (!existsSync17(TRUSTED_PEERS_FILE))
50603
51370
  return new Map;
50604
- const data = JSON.parse(readFileSync9(TRUSTED_PEERS_FILE, "utf8"));
51371
+ const data = JSON.parse(readFileSync10(TRUSTED_PEERS_FILE, "utf8"));
50605
51372
  return new Map(data.map((p) => [p.publicKey, p]));
50606
51373
  }
50607
51374
  function saveTrustedPeer(peer) {
@@ -50650,9 +51417,9 @@ function hexToBytes2(hex3) {
50650
51417
  var PAIRING_DIR, IDENTITY_FILE, TRUSTED_PEERS_FILE, QR_VERSION = 1, QR_EXPIRY_MS;
50651
51418
  var init_identity = __esm(() => {
50652
51419
  init_noise();
50653
- PAIRING_DIR = join20(homedir13(), ".scout/pairing");
50654
- IDENTITY_FILE = join20(PAIRING_DIR, "identity.json");
50655
- TRUSTED_PEERS_FILE = join20(PAIRING_DIR, "trusted-peers.json");
51420
+ PAIRING_DIR = join21(homedir14(), ".scout/pairing");
51421
+ IDENTITY_FILE = join21(PAIRING_DIR, "identity.json");
51422
+ TRUSTED_PEERS_FILE = join21(PAIRING_DIR, "trusted-peers.json");
50656
51423
  QR_EXPIRY_MS = 5 * 60 * 1000;
50657
51424
  });
50658
51425
 
@@ -50797,14 +51564,14 @@ var init_security2 = __esm(() => {
50797
51564
  });
50798
51565
 
50799
51566
  // ../../apps/desktop/src/core/pairing/runtime/runtime-state.ts
50800
- import { existsSync as existsSync17, mkdirSync as mkdirSync7, readFileSync as readFileSync10, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync7 } from "fs";
51567
+ import { existsSync as existsSync18, mkdirSync as mkdirSync7, readFileSync as readFileSync11, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync7 } from "fs";
50801
51568
  function readPairingRuntimeSnapshot() {
50802
51569
  const { runtimeStatePath } = pairingPaths();
50803
- if (!existsSync17(runtimeStatePath)) {
51570
+ if (!existsSync18(runtimeStatePath)) {
50804
51571
  return null;
50805
51572
  }
50806
51573
  try {
50807
- const parsed = JSON.parse(readFileSync10(runtimeStatePath, "utf8"));
51574
+ const parsed = JSON.parse(readFileSync11(runtimeStatePath, "utf8"));
50808
51575
  return parsed?.version === 1 ? parsed : null;
50809
51576
  } catch {
50810
51577
  return null;
@@ -50828,8 +51595,8 @@ var init_runtime_state = __esm(() => {
50828
51595
 
50829
51596
  // ../../apps/desktop/src/core/pairing/runtime/bridge/log.ts
50830
51597
  import { appendFileSync, mkdirSync as mkdirSync8 } from "fs";
50831
- import { join as join21 } from "path";
50832
- import { homedir as homedir14 } from "os";
51598
+ import { join as join22 } from "path";
51599
+ import { homedir as homedir15 } from "os";
50833
51600
  function write(level, category, message, data) {
50834
51601
  const ts = new Date().toISOString().slice(11, 23);
50835
51602
  const lvl = level.toUpperCase().padEnd(5);
@@ -50845,8 +51612,8 @@ function write(level, category, message, data) {
50845
51612
  }
50846
51613
  var LOG_DIR, LOG_FILE, log;
50847
51614
  var init_log = __esm(() => {
50848
- LOG_DIR = join21(homedir14(), ".scout/pairing");
50849
- LOG_FILE = join21(LOG_DIR, "bridge.log");
51615
+ LOG_DIR = join22(homedir15(), ".scout/pairing");
51616
+ LOG_FILE = join22(LOG_DIR, "bridge.log");
50850
51617
  mkdirSync8(LOG_DIR, { recursive: true });
50851
51618
  log = {
50852
51619
  debug: (cat, msg, data) => write("debug", cat, msg, data),
@@ -50922,15 +51689,15 @@ var init_bridge = __esm(() => {
50922
51689
  });
50923
51690
 
50924
51691
  // ../../apps/desktop/src/core/pairing/runtime/bridge/config.ts
50925
- import { existsSync as existsSync18, readFileSync as readFileSync11 } from "fs";
50926
- import { join as join22 } from "path";
50927
- import { homedir as homedir15 } from "os";
51692
+ import { existsSync as existsSync19, readFileSync as readFileSync12 } from "fs";
51693
+ import { join as join23 } from "path";
51694
+ import { homedir as homedir16 } from "os";
50928
51695
  function loadConfigFile() {
50929
- if (!existsSync18(CONFIG_FILE)) {
51696
+ if (!existsSync19(CONFIG_FILE)) {
50930
51697
  return {};
50931
51698
  }
50932
51699
  try {
50933
- const raw = readFileSync11(CONFIG_FILE, "utf8");
51700
+ const raw = readFileSync12(CONFIG_FILE, "utf8");
50934
51701
  const parsed = JSON.parse(raw);
50935
51702
  return parsed;
50936
51703
  } catch (err) {
@@ -50987,8 +51754,8 @@ var init_config3 = __esm(() => {
50987
51754
  port: 7888,
50988
51755
  secure: true
50989
51756
  };
50990
- CONFIG_DIR = join22(homedir15(), ".scout/pairing");
50991
- CONFIG_FILE = join22(CONFIG_DIR, "config.json");
51757
+ CONFIG_DIR = join23(homedir16(), ".scout/pairing");
51758
+ CONFIG_FILE = join23(CONFIG_DIR, "config.json");
50992
51759
  });
50993
51760
 
50994
51761
  // ../../apps/desktop/src/core/pairing/runtime/bridge/web-handoff.ts
@@ -51007,10 +51774,12 @@ function scopesMatch(left, right) {
51007
51774
  if (left.sessionId !== right.sessionId) {
51008
51775
  return false;
51009
51776
  }
51010
- if (left.kind === "session") {
51011
- return true;
51777
+ switch (left.kind) {
51778
+ case "session":
51779
+ return true;
51780
+ case "file_change":
51781
+ return right.kind === "file_change" && left.turnId === right.turnId && left.blockId === right.blockId;
51012
51782
  }
51013
- return left.turnId === right.turnId && left.blockId === right.blockId;
51014
51783
  }
51015
51784
  function pathForWebHandoffScope(scope) {
51016
51785
  switch (scope.kind) {
@@ -51054,7 +51823,7 @@ var init_web_handoff = __esm(() => {
51054
51823
 
51055
51824
  // ../../apps/desktop/src/core/pairing/runtime/bridge/fileserver.ts
51056
51825
  import { isAbsolute as isAbsolute2 } from "path";
51057
- import { homedir as homedir16 } from "os";
51826
+ import { homedir as homedir17 } from "os";
51058
51827
  function isTrustedLoopbackHostname(hostname5) {
51059
51828
  const normalized = hostname5.trim().toLowerCase();
51060
51829
  return normalized === "localhost" || normalized.endsWith(".localhost") || normalized === "::1" || LOOPBACK_IPV4_HOST_PATTERN.test(normalized);
@@ -51062,7 +51831,7 @@ function isTrustedLoopbackHostname(hostname5) {
51062
51831
  function isAllowedPath(filePath) {
51063
51832
  if (!isAbsolute2(filePath))
51064
51833
  return false;
51065
- const relToHome = filePath.slice(homedir16().length + 1);
51834
+ const relToHome = filePath.slice(homedir17().length + 1);
51066
51835
  if (relToHome.startsWith(".") && !relToHome.startsWith(".claude") && !relToHome.startsWith(".scout/pairing")) {
51067
51836
  return false;
51068
51837
  }
@@ -51643,17 +52412,17 @@ function formatTimestamp(value) {
51643
52412
  var ALLOWED_ROOTS, LOOPBACK_IPV4_HOST_PATTERN;
51644
52413
  var init_fileserver = __esm(() => {
51645
52414
  init_web_handoff();
51646
- ALLOWED_ROOTS = [homedir16(), "/tmp"];
52415
+ ALLOWED_ROOTS = [homedir17(), "/tmp"];
51647
52416
  LOOPBACK_IPV4_HOST_PATTERN = /^127(?:\.\d{1,3}){3}$/;
51648
52417
  });
51649
52418
 
51650
52419
  // ../../apps/desktop/src/server/db-queries.ts
51651
52420
  import { Database } from "bun:sqlite";
51652
- import { homedir as homedir17 } from "os";
51653
- import { join as join23 } from "path";
52421
+ import { homedir as homedir18 } from "os";
52422
+ import { join as join24 } from "path";
51654
52423
  function resolveDbPath() {
51655
- const controlHome = process.env.OPENSCOUT_CONTROL_HOME ?? join23(homedir17(), ".openscout", "control-plane");
51656
- return join23(controlHome, "control-plane.sqlite");
52424
+ const controlHome = process.env.OPENSCOUT_CONTROL_HOME ?? join24(homedir18(), ".openscout", "control-plane");
52425
+ return join24(controlHome, "control-plane.sqlite");
51657
52426
  }
51658
52427
  function db() {
51659
52428
  if (!_db) {
@@ -51925,13 +52694,13 @@ var _db = null, HOME, LATEST_AGENT_ENDPOINT_JOIN = `LEFT JOIN agent_endpoints ep
51925
52694
  LIMIT 1
51926
52695
  )`, ACTIVE_FLIGHT_STATES_SQL, ACTIVE_WORK_STATES_SQL;
51927
52696
  var init_db_queries = __esm(() => {
51928
- HOME = homedir17();
52697
+ HOME = homedir18();
51929
52698
  ACTIVE_FLIGHT_STATES_SQL = sqlStringList(["running", "waking", "waiting", "queued"]);
51930
52699
  ACTIVE_WORK_STATES_SQL = sqlStringList(["open", "working", "waiting", "review"]);
51931
52700
  });
51932
52701
 
51933
52702
  // ../../apps/desktop/src/core/mobile/service.ts
51934
- import { basename as basename8, resolve as resolve14 } from "path";
52703
+ import { basename as basename8, resolve as resolve15 } from "path";
51935
52704
  function normalizeTimestamp2(value) {
51936
52705
  if (!value)
51937
52706
  return null;
@@ -52320,7 +53089,7 @@ async function createScoutSession(input, currentDirectory, deviceId) {
52320
53089
  if (!rawWorkspaceId) {
52321
53090
  throw new Error(`Invalid workspaceId.`);
52322
53091
  }
52323
- const workspaceRoot = resolve14(rawWorkspaceId);
53092
+ const workspaceRoot = resolve15(rawWorkspaceId);
52324
53093
  const projectName = basename8(workspaceRoot) || workspaceRoot;
52325
53094
  const workspace = {
52326
53095
  id: workspaceRoot,
@@ -52430,17 +53199,17 @@ async function deriveNewAgentName(projectName, branch, harness) {
52430
53199
  }
52431
53200
  async function createGitWorktree(projectRoot, agentName) {
52432
53201
  const { execSync: execSync2 } = await import("child_process");
52433
- const { join: join24 } = await import("path");
52434
- const { mkdirSync: mkdirSync9, existsSync: existsSync19 } = await import("fs");
53202
+ const { join: join25 } = await import("path");
53203
+ const { mkdirSync: mkdirSync9, existsSync: existsSync20 } = await import("fs");
52435
53204
  try {
52436
53205
  execSync2("git rev-parse --git-dir", { cwd: projectRoot, stdio: "pipe" });
52437
53206
  } catch {
52438
53207
  return null;
52439
53208
  }
52440
53209
  const branchName = `scout/${agentName}`;
52441
- const worktreeDir = join24(projectRoot, ".scout-worktrees");
52442
- const worktreePath = join24(worktreeDir, agentName);
52443
- if (existsSync19(worktreePath)) {
53210
+ const worktreeDir = join25(projectRoot, ".scout-worktrees");
53211
+ const worktreePath = join25(worktreeDir, agentName);
53212
+ if (existsSync20(worktreePath)) {
52444
53213
  return { path: worktreePath, branch: branchName };
52445
53214
  }
52446
53215
  mkdirSync9(worktreeDir, { recursive: true });
@@ -52481,10 +53250,10 @@ var init_service5 = __esm(() => {
52481
53250
  });
52482
53251
 
52483
53252
  // ../../apps/desktop/src/core/pairing/runtime/bridge/server.ts
52484
- import { readdirSync as readdirSync2, readFileSync as readFileSync12, realpathSync, statSync as statSync3 } from "fs";
53253
+ import { readdirSync as readdirSync2, readFileSync as readFileSync13, realpathSync, statSync as statSync3 } from "fs";
52485
53254
  import { execSync as execSync2 } from "child_process";
52486
- import { basename as basename9, isAbsolute as isAbsolute3, join as join24, relative as relative2 } from "path";
52487
- import { homedir as homedir18 } from "os";
53255
+ import { basename as basename9, isAbsolute as isAbsolute3, join as join25, relative as relative2 } from "path";
53256
+ import { homedir as homedir19 } from "os";
52488
53257
  function replaySyncEvents(bridge, sessionId, lastSeq) {
52489
53258
  return bridge.replay(sessionId, lastSeq);
52490
53259
  }
@@ -52847,7 +53616,7 @@ async function handleRPCInner(bridge, req, deviceId) {
52847
53616
  return { id: req.id, error: { code: -32000, message: "Only .jsonl files can be read" } };
52848
53617
  }
52849
53618
  try {
52850
- const content = readFileSync12(p.path, "utf-8");
53619
+ const content = readFileSync13(p.path, "utf-8");
52851
53620
  const lines = content.split(`
52852
53621
  `).filter((l) => l.trim().length > 0);
52853
53622
  const trimmed = lines.length > 500 ? lines.slice(-500) : lines;
@@ -52965,13 +53734,13 @@ function resolveMobileCurrentDirectory() {
52965
53734
  }
52966
53735
  }
52967
53736
  function resolveWorkspaceRoot(root) {
52968
- const expandedRoot = root.replace(/^~/, homedir18());
53737
+ const expandedRoot = root.replace(/^~/, homedir19());
52969
53738
  return realpathSync(expandedRoot);
52970
53739
  }
52971
53740
  function resolveWorkspacePath(root, requestedPath) {
52972
53741
  const normalizedRoot = resolveWorkspaceRoot(root);
52973
- const expandedPath = requestedPath?.replace(/^~/, homedir18());
52974
- const candidate = expandedPath ? isAbsolute3(expandedPath) ? expandedPath : join24(normalizedRoot, expandedPath) : normalizedRoot;
53742
+ const expandedPath = requestedPath?.replace(/^~/, homedir19());
53743
+ const candidate = expandedPath ? isAbsolute3(expandedPath) ? expandedPath : join25(normalizedRoot, expandedPath) : normalizedRoot;
52975
53744
  const resolvedCandidate = realpathSync(candidate);
52976
53745
  const rel = relative2(normalizedRoot, resolvedCandidate);
52977
53746
  if (rel === "" || !rel.startsWith("..") && !isAbsolute3(rel)) {
@@ -52986,7 +53755,7 @@ function listDirectories(dirPath) {
52986
53755
  continue;
52987
53756
  if (name === "node_modules" || name === ".build" || name === "target")
52988
53757
  continue;
52989
- const fullPath = join24(dirPath, name);
53758
+ const fullPath = join25(dirPath, name);
52990
53759
  try {
52991
53760
  const stat4 = statSync3(fullPath);
52992
53761
  if (!stat4.isDirectory())
@@ -53009,7 +53778,7 @@ function listDirectories(dirPath) {
53009
53778
  return entries.sort((a, b) => a.name.localeCompare(b.name));
53010
53779
  }
53011
53780
  async function discoverSessionFiles(maxAgeDays, limit) {
53012
- const home = homedir18();
53781
+ const home = homedir19();
53013
53782
  const results = [];
53014
53783
  const searchPaths = [
53015
53784
  { pattern: `${home}/.claude/projects`, agent: "claude-code" },
@@ -54255,7 +55024,7 @@ function pipeReducer(prev, fn) {
54255
55024
  }
54256
55025
  function observableToPromise(observable$1) {
54257
55026
  const ac = new AbortController;
54258
- const promise3 = new Promise((resolve15, reject) => {
55027
+ const promise3 = new Promise((resolve16, reject) => {
54259
55028
  let isDone = false;
54260
55029
  function onDone() {
54261
55030
  if (isDone)
@@ -54269,7 +55038,7 @@ function observableToPromise(observable$1) {
54269
55038
  const obs$ = observable$1.subscribe({
54270
55039
  next(data) {
54271
55040
  isDone = true;
54272
- resolve15(data);
55041
+ resolve16(data);
54273
55042
  onDone();
54274
55043
  },
54275
55044
  error(data) {
@@ -54572,15 +55341,15 @@ function resolveSelfTuple(promise3) {
54572
55341
  return Unpromise.proxy(promise3).then(() => [promise3]);
54573
55342
  }
54574
55343
  function withResolvers() {
54575
- let resolve15;
55344
+ let resolve16;
54576
55345
  let reject;
54577
55346
  const promise3 = new Promise((_resolve, _reject) => {
54578
- resolve15 = _resolve;
55347
+ resolve16 = _resolve;
54579
55348
  reject = _reject;
54580
55349
  });
54581
55350
  return {
54582
55351
  promise: promise3,
54583
- resolve: resolve15,
55352
+ resolve: resolve16,
54584
55353
  reject
54585
55354
  };
54586
55355
  }
@@ -54619,8 +55388,8 @@ function timerResource(ms) {
54619
55388
  return makeResource({ start() {
54620
55389
  if (timer)
54621
55390
  throw new Error("Timer already started");
54622
- const promise3 = new Promise((resolve15) => {
54623
- timer = setTimeout(() => resolve15(disposablePromiseTimerResult), ms);
55391
+ const promise3 = new Promise((resolve16) => {
55392
+ timer = setTimeout(() => resolve16(disposablePromiseTimerResult), ms);
54624
55393
  });
54625
55394
  return promise3;
54626
55395
  } }, () => {
@@ -54669,15 +55438,15 @@ function _takeWithGrace() {
54669
55438
  return _takeWithGrace.apply(this, arguments);
54670
55439
  }
54671
55440
  function createDeferred() {
54672
- let resolve15;
55441
+ let resolve16;
54673
55442
  let reject;
54674
55443
  const promise3 = new Promise((res, rej) => {
54675
- resolve15 = res;
55444
+ resolve16 = res;
54676
55445
  reject = rej;
54677
55446
  });
54678
55447
  return {
54679
55448
  promise: promise3,
54680
- resolve: resolve15,
55449
+ resolve: resolve16,
54681
55450
  reject
54682
55451
  };
54683
55452
  }
@@ -55653,8 +56422,8 @@ var import_objectSpread2$13, jsonContentTypeHandler, formDataContentTypeHandler,
55653
56422
  status: "fulfilled",
55654
56423
  value
55655
56424
  };
55656
- subscribers === null || subscribers === undefined || subscribers.forEach(({ resolve: resolve15 }) => {
55657
- resolve15(value);
56425
+ subscribers === null || subscribers === undefined || subscribers.forEach(({ resolve: resolve16 }) => {
56426
+ resolve16(value);
55658
56427
  });
55659
56428
  });
55660
56429
  if ("catch" in thenReturn)
@@ -56329,15 +57098,15 @@ var init_loggerLink_ineCN1PO = __esm(() => {
56329
57098
 
56330
57099
  // ../../node_modules/.bun/@trpc+client@11.17.0+3482dd4c4b115906/node_modules/@trpc/client/dist/wsLink-DSf4KOdW.mjs
56331
57100
  function withResolvers2() {
56332
- let resolve15;
57101
+ let resolve16;
56333
57102
  let reject;
56334
57103
  const promise3 = new Promise((res, rej) => {
56335
- resolve15 = res;
57104
+ resolve16 = res;
56336
57105
  reject = rej;
56337
57106
  });
56338
57107
  return {
56339
57108
  promise: promise3,
56340
- resolve: resolve15,
57109
+ resolve: resolve16,
56341
57110
  reject
56342
57111
  };
56343
57112
  }
@@ -56357,10 +57126,10 @@ async function buildConnectionMessage(connectionParams, encoder) {
56357
57126
  return encoder.encode(message);
56358
57127
  }
56359
57128
  function asyncWsOpen(ws) {
56360
- const { promise: promise3, resolve: resolve15, reject } = withResolvers2();
57129
+ const { promise: promise3, resolve: resolve16, reject } = withResolvers2();
56361
57130
  ws.addEventListener("open", () => {
56362
57131
  ws.removeEventListener("error", reject);
56363
- resolve15();
57132
+ resolve16();
56364
57133
  });
56365
57134
  ws.addEventListener("error", reject);
56366
57135
  return promise3;
@@ -56474,7 +57243,7 @@ var jsonEncoder, lazyDefaults, keepAliveDefaults, exponentialBackoff = (attemptI
56474
57243
  (0, import_defineProperty$2.default)(this, "pendingRequests", {});
56475
57244
  }
56476
57245
  register(message, callbacks) {
56477
- const { promise: end, resolve: resolve15 } = withResolvers2();
57246
+ const { promise: end, resolve: resolve16 } = withResolvers2();
56478
57247
  this.outgoingRequests.push({
56479
57248
  id: String(message.id),
56480
57249
  message,
@@ -56483,18 +57252,18 @@ var jsonEncoder, lazyDefaults, keepAliveDefaults, exponentialBackoff = (attemptI
56483
57252
  next: callbacks.next,
56484
57253
  complete: () => {
56485
57254
  callbacks.complete();
56486
- resolve15();
57255
+ resolve16();
56487
57256
  },
56488
57257
  error: (e) => {
56489
57258
  callbacks.error(e);
56490
- resolve15();
57259
+ resolve16();
56491
57260
  }
56492
57261
  }
56493
57262
  });
56494
57263
  return () => {
56495
57264
  this.delete(message.id);
56496
57265
  callbacks.complete();
56497
- resolve15();
57266
+ resolve16();
56498
57267
  };
56499
57268
  }
56500
57269
  delete(messageId) {
@@ -57374,12 +58143,12 @@ var init_tail_fanout = __esm(() => {
57374
58143
 
57375
58144
  // ../runtime/src/mobile-push.ts
57376
58145
  import { Database as Database2 } from "bun:sqlite";
57377
- import { mkdirSync as mkdirSync9, readFileSync as readFileSync13 } from "fs";
58146
+ import { mkdirSync as mkdirSync9, readFileSync as readFileSync14 } from "fs";
57378
58147
  import { connect as connectHttp2 } from "http2";
57379
58148
  import { createPrivateKey, sign as signWithKey } from "crypto";
57380
- import { dirname as dirname14, join as join25 } from "path";
58149
+ import { dirname as dirname14, join as join26 } from "path";
57381
58150
  function resolveControlPlaneDbPath() {
57382
- return join25(resolveOpenScoutSupportPaths().controlHome, "control-plane.sqlite");
58151
+ return join26(resolveOpenScoutSupportPaths().controlHome, "control-plane.sqlite");
57383
58152
  }
57384
58153
  function ensureMobilePushSchema(database) {
57385
58154
  database.exec("PRAGMA busy_timeout = 5000;");
@@ -57531,7 +58300,7 @@ function deleteMobilePushRegistrationByToken(pushToken) {
57531
58300
  writeDb().query(`DELETE FROM mobile_push_registrations WHERE push_token = ?1`).run(token);
57532
58301
  }
57533
58302
  function base64UrlEncode(input) {
57534
- const buffer = typeof input === "string" ? Buffer.from(input, "utf8") : input;
58303
+ const buffer = typeof input === "string" ? Buffer.from(input, "utf8") : Buffer.from(Array.from(input));
57535
58304
  return buffer.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
57536
58305
  }
57537
58306
  function loadApnsCredentials() {
@@ -57545,7 +58314,7 @@ function loadApnsCredentials() {
57545
58314
  privateKeyPem = Buffer.from(inlineBase64, "base64").toString("utf8");
57546
58315
  }
57547
58316
  if (!privateKeyPem && path2) {
57548
- privateKeyPem = readFileSync13(path2, "utf8");
58317
+ privateKeyPem = readFileSync14(path2, "utf8");
57549
58318
  }
57550
58319
  if (!teamId || !keyId || !privateKeyPem) {
57551
58320
  return null;
@@ -57576,7 +58345,7 @@ function apnsJwt(credentials) {
57576
58345
  }));
57577
58346
  const unsignedToken = `${header}.${claims}`;
57578
58347
  const privateKey = createPrivateKey(credentials.privateKeyPem);
57579
- const signature = signWithKey("sha256", Buffer.from(unsignedToken), privateKey);
58348
+ const signature = signWithKey("sha256", new TextEncoder().encode(unsignedToken), privateKey);
57580
58349
  const token = `${unsignedToken}.${base64UrlEncode(signature)}`;
57581
58350
  cachedApnsJwt = {
57582
58351
  cacheKey,
@@ -57609,7 +58378,7 @@ async function sendApnsAlertToRegistration(registration, alert) {
57609
58378
  },
57610
58379
  ...alert.payload ? { scout: alert.payload } : {}
57611
58380
  });
57612
- return new Promise((resolve15, reject) => {
58381
+ return new Promise((resolve16, reject) => {
57613
58382
  const client = connectHttp2(authority);
57614
58383
  client.once("error", reject);
57615
58384
  const request = client.request({
@@ -57632,11 +58401,11 @@ async function sendApnsAlertToRegistration(registration, alert) {
57632
58401
  apnsId = typeof headers["apns-id"] === "string" ? headers["apns-id"] : null;
57633
58402
  });
57634
58403
  request.on("data", (chunk) => {
57635
- chunks.push(typeof chunk === "string" ? Buffer.from(chunk, "utf8") : chunk);
58404
+ chunks.push(chunk);
57636
58405
  });
57637
58406
  request.on("end", () => {
57638
58407
  client.close();
57639
- const rawBody = chunks.length > 0 ? Buffer.concat(chunks).toString("utf8") : "";
58408
+ const rawBody = chunks.join("");
57640
58409
  let reason = null;
57641
58410
  if (rawBody.trim().length > 0) {
57642
58411
  try {
@@ -57647,7 +58416,7 @@ async function sendApnsAlertToRegistration(registration, alert) {
57647
58416
  }
57648
58417
  }
57649
58418
  if (status === 200) {
57650
- resolve15({
58419
+ resolve16({
57651
58420
  delivered: true,
57652
58421
  skipped: false,
57653
58422
  status,
@@ -57659,7 +58428,7 @@ async function sendApnsAlertToRegistration(registration, alert) {
57659
58428
  if (reason === "BadDeviceToken" || reason === "Unregistered") {
57660
58429
  deleteMobilePushRegistrationByToken(registration.pushToken);
57661
58430
  }
57662
- resolve15({
58431
+ resolve16({
57663
58432
  delivered: false,
57664
58433
  skipped: false,
57665
58434
  status,
@@ -57746,10 +58515,10 @@ var init_mobile_push = __esm(() => {
57746
58515
  });
57747
58516
 
57748
58517
  // ../../apps/desktop/src/core/pairing/runtime/bridge/router.ts
57749
- import { readFileSync as readFileSync14, readdirSync as readdirSync3, realpathSync as realpathSync2, statSync as statSync4 } from "fs";
58518
+ import { readFileSync as readFileSync15, readdirSync as readdirSync3, realpathSync as realpathSync2, statSync as statSync4 } from "fs";
57750
58519
  import { execSync as execSync3 } from "child_process";
57751
- import { basename as basename10, isAbsolute as isAbsolute4, join as join26, relative as relative3 } from "path";
57752
- import { homedir as homedir19 } from "os";
58520
+ import { basename as basename10, isAbsolute as isAbsolute4, join as join27, relative as relative3 } from "path";
58521
+ import { homedir as homedir20 } from "os";
57753
58522
  function resolveMobileCurrentDirectory2() {
57754
58523
  const config2 = resolveConfig();
57755
58524
  const configuredRoot = config2.workspace?.root;
@@ -57762,13 +58531,13 @@ function resolveMobileCurrentDirectory2() {
57762
58531
  }
57763
58532
  }
57764
58533
  function resolveWorkspaceRoot2(root) {
57765
- const expandedRoot = root.replace(/^~/, homedir19());
58534
+ const expandedRoot = root.replace(/^~/, homedir20());
57766
58535
  return realpathSync2(expandedRoot);
57767
58536
  }
57768
58537
  function resolveWorkspacePath2(root, requestedPath) {
57769
58538
  const normalizedRoot = resolveWorkspaceRoot2(root);
57770
- const expandedPath = requestedPath?.replace(/^~/, homedir19());
57771
- const candidate = expandedPath ? isAbsolute4(expandedPath) ? expandedPath : join26(normalizedRoot, expandedPath) : normalizedRoot;
58539
+ const expandedPath = requestedPath?.replace(/^~/, homedir20());
58540
+ const candidate = expandedPath ? isAbsolute4(expandedPath) ? expandedPath : join27(normalizedRoot, expandedPath) : normalizedRoot;
57772
58541
  const resolvedCandidate = realpathSync2(candidate);
57773
58542
  const rel = relative3(normalizedRoot, resolvedCandidate);
57774
58543
  if (rel === "" || !rel.startsWith("..") && !isAbsolute4(rel)) {
@@ -57783,7 +58552,7 @@ function listDirectories2(dirPath) {
57783
58552
  continue;
57784
58553
  if (name === "node_modules" || name === ".build" || name === "target")
57785
58554
  continue;
57786
- const fullPath = join26(dirPath, name);
58555
+ const fullPath = join27(dirPath, name);
57787
58556
  try {
57788
58557
  const stat4 = statSync4(fullPath);
57789
58558
  if (!stat4.isDirectory())
@@ -57822,7 +58591,7 @@ function detectAgent2(filePath) {
57822
58591
  return "unknown";
57823
58592
  }
57824
58593
  async function discoverSessionFiles2(maxAgeDays, limit) {
57825
- const home = homedir19();
58594
+ const home = homedir20();
57826
58595
  const results = [];
57827
58596
  const searchPaths = [
57828
58597
  { pattern: `${home}/.claude/projects`, agent: "claude-code" },
@@ -57904,23 +58673,23 @@ function bridgeEventIterable(bridge, signal) {
57904
58673
  return {
57905
58674
  [Symbol.asyncIterator]() {
57906
58675
  const buffer = [];
57907
- let resolve15 = null;
58676
+ let resolve16 = null;
57908
58677
  let done = false;
57909
58678
  const unsub = bridge.onEvent((event) => {
57910
58679
  if (done)
57911
58680
  return;
57912
58681
  buffer.push(event);
57913
- if (resolve15) {
57914
- resolve15();
57915
- resolve15 = null;
58682
+ if (resolve16) {
58683
+ resolve16();
58684
+ resolve16 = null;
57916
58685
  }
57917
58686
  });
57918
58687
  const cleanup = () => {
57919
58688
  done = true;
57920
58689
  unsub();
57921
- if (resolve15) {
57922
- resolve15();
57923
- resolve15 = null;
58690
+ if (resolve16) {
58691
+ resolve16();
58692
+ resolve16 = null;
57924
58693
  }
57925
58694
  };
57926
58695
  signal?.addEventListener("abort", cleanup, { once: true });
@@ -57933,7 +58702,7 @@ function bridgeEventIterable(bridge, signal) {
57933
58702
  return { done: false, value: buffer.shift() };
57934
58703
  }
57935
58704
  await new Promise((r) => {
57936
- resolve15 = r;
58705
+ resolve16 = r;
57937
58706
  });
57938
58707
  }
57939
58708
  },
@@ -57956,23 +58725,23 @@ function tailEventIterable(signal) {
57956
58725
  return {
57957
58726
  [Symbol.asyncIterator]() {
57958
58727
  const buffer = [];
57959
- let resolve15 = null;
58728
+ let resolve16 = null;
57960
58729
  let done = false;
57961
58730
  const unsub = getTailFanout().subscribe((event) => {
57962
58731
  if (done)
57963
58732
  return;
57964
58733
  buffer.push(event);
57965
- if (resolve15) {
57966
- resolve15();
57967
- resolve15 = null;
58734
+ if (resolve16) {
58735
+ resolve16();
58736
+ resolve16 = null;
57968
58737
  }
57969
58738
  });
57970
58739
  const cleanup = () => {
57971
58740
  done = true;
57972
58741
  unsub();
57973
- if (resolve15) {
57974
- resolve15();
57975
- resolve15 = null;
58742
+ if (resolve16) {
58743
+ resolve16();
58744
+ resolve16 = null;
57976
58745
  }
57977
58746
  };
57978
58747
  signal?.addEventListener("abort", cleanup, { once: true });
@@ -57985,7 +58754,7 @@ function tailEventIterable(signal) {
57985
58754
  return { done: false, value: buffer.shift() };
57986
58755
  }
57987
58756
  await new Promise((r) => {
57988
- resolve15 = r;
58757
+ resolve16 = r;
57989
58758
  });
57990
58759
  }
57991
58760
  },
@@ -58543,7 +59312,7 @@ var init_router = __esm(() => {
58543
59312
  });
58544
59313
  }
58545
59314
  try {
58546
- const content = readFileSync14(input.path, "utf-8");
59315
+ const content = readFileSync15(input.path, "utf-8");
58547
59316
  const lines = content.split(`
58548
59317
  `).filter((l) => l.trim().length > 0);
58549
59318
  const trimmed = lines.length > 500 ? lines.slice(-500) : lines;
@@ -60817,14 +61586,14 @@ var init_dist5 = __esm(() => {
60817
61586
 
60818
61587
  // ../../apps/desktop/src/core/pairing/runtime/bridge/server-trpc.ts
60819
61588
  import { realpathSync as realpathSync3 } from "fs";
60820
- import { homedir as homedir20 } from "os";
61589
+ import { homedir as homedir21 } from "os";
60821
61590
  function resolveCurrentDirectory() {
60822
61591
  try {
60823
61592
  const config2 = resolveConfig();
60824
61593
  const configuredRoot = config2.workspace?.root;
60825
61594
  if (!configuredRoot)
60826
61595
  return process.cwd();
60827
- const expanded = configuredRoot.replace(/^~/, homedir20());
61596
+ const expanded = configuredRoot.replace(/^~/, homedir21());
60828
61597
  return realpathSync3(expanded);
60829
61598
  } catch {
60830
61599
  return process.cwd();
@@ -60970,8 +61739,8 @@ function startBridgeServerTRPC(options) {
60970
61739
  }
60971
61740
  const iterable = isObservable(result) ? observableToAsyncIterable(result, abortController.signal) : result;
60972
61741
  const iterator = iterable[Symbol.asyncIterator]();
60973
- const abortPromise = new Promise((resolve15) => {
60974
- abortController.signal.addEventListener("abort", () => resolve15("abort"), {
61742
+ const abortPromise = new Promise((resolve16) => {
61743
+ abortController.signal.addEventListener("abort", () => resolve16("abort"), {
60975
61744
  once: true
60976
61745
  });
60977
61746
  });
@@ -61287,7 +62056,7 @@ var init_server_trpc = __esm(() => {
61287
62056
  });
61288
62057
 
61289
62058
  // ../../apps/desktop/src/core/pairing/runtime/runtime.ts
61290
- import { homedir as homedir21 } from "os";
62059
+ import { homedir as homedir22 } from "os";
61291
62060
  function createPairingAdapterRegistry(configAdapters) {
61292
62061
  const adapters = {
61293
62062
  "claude-code": createAdapter,
@@ -61366,7 +62135,7 @@ async function autoStartConfiguredSessions(bridge, sessions3) {
61366
62135
  try {
61367
62136
  const session = await bridge.createSession(entry.adapter, {
61368
62137
  name: entry.name,
61369
- cwd: entry.cwd?.replace(/^~/, homedir21()),
62138
+ cwd: entry.cwd?.replace(/^~/, homedir22()),
61370
62139
  options: entry.options
61371
62140
  });
61372
62141
  console.log(`[bridge] session started: ${session.name} (${entry.adapter})`);
@@ -61636,11 +62405,11 @@ var BRIDGE_ABSENCE_GRACE_MS = 30000, ROOM_IDLE_TIMEOUT_MS = 60000;
61636
62405
 
61637
62406
  // ../../apps/desktop/src/core/pairing/runtime/relay-runtime.ts
61638
62407
  import { execSync as execSync4 } from "child_process";
61639
- import { existsSync as existsSync19, mkdirSync as mkdirSync11, readdirSync as readdirSync4 } from "fs";
61640
- import { homedir as homedir22, networkInterfaces } from "os";
61641
- import { join as join27 } from "path";
62408
+ import { existsSync as existsSync20, mkdirSync as mkdirSync11, readdirSync as readdirSync4 } from "fs";
62409
+ import { homedir as homedir23, networkInterfaces } from "os";
62410
+ import { join as join28 } from "path";
61642
62411
  function findStoredCerts() {
61643
- if (!existsSync19(PAIRING_DIR2)) {
62412
+ if (!existsSync20(PAIRING_DIR2)) {
61644
62413
  return null;
61645
62414
  }
61646
62415
  try {
@@ -61654,8 +62423,8 @@ function findStoredCerts() {
61654
62423
  return null;
61655
62424
  }
61656
62425
  return {
61657
- cert: join27(PAIRING_DIR2, certFile),
61658
- key: join27(PAIRING_DIR2, keyFile)
62426
+ cert: join28(PAIRING_DIR2, certFile),
62427
+ key: join28(PAIRING_DIR2, keyFile)
61659
62428
  };
61660
62429
  } catch {
61661
62430
  return null;
@@ -61735,8 +62504,8 @@ function resolveRelayEndpointForTailscaleStatus(port, tailscale, options = {}) {
61735
62504
  }
61736
62505
  function generateTailscaleCerts(hostname5) {
61737
62506
  mkdirSync11(PAIRING_DIR2, { recursive: true });
61738
- const certPath = join27(PAIRING_DIR2, `${hostname5}.crt`);
61739
- const keyPath = join27(PAIRING_DIR2, `${hostname5}.key`);
62507
+ const certPath = join28(PAIRING_DIR2, `${hostname5}.crt`);
62508
+ const keyPath = join28(PAIRING_DIR2, `${hostname5}.key`);
61740
62509
  try {
61741
62510
  pairingLog.info("relay", "generating tailscale TLS cert", { hostname: hostname5 });
61742
62511
  execSync4(`tailscale cert --cert-file "${certPath}" --key-file "${keyPath}" "${hostname5}"`, {
@@ -61752,8 +62521,8 @@ function generateTailscaleCerts(hostname5) {
61752
62521
  }
61753
62522
  function generateSelfSignedCert(hostname5) {
61754
62523
  mkdirSync11(PAIRING_DIR2, { recursive: true });
61755
- const certPath = join27(PAIRING_DIR2, `${hostname5}.crt`);
61756
- const keyPath = join27(PAIRING_DIR2, `${hostname5}.key`);
62524
+ const certPath = join28(PAIRING_DIR2, `${hostname5}.crt`);
62525
+ const keyPath = join28(PAIRING_DIR2, `${hostname5}.key`);
61757
62526
  try {
61758
62527
  execSync4(`openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 ` + `-keyout "${keyPath}" -out "${certPath}" -days 365 -nodes ` + `-subj "/CN=${hostname5}" -addext "subjectAltName=DNS:${hostname5}"`, {
61759
62528
  stdio: ["pipe", "pipe", "pipe"],
@@ -61866,7 +62635,7 @@ function parseIPv4(address) {
61866
62635
  var PAIRING_DIR2;
61867
62636
  var init_relay_runtime = __esm(() => {
61868
62637
  init_log2();
61869
- PAIRING_DIR2 = join27(homedir22(), ".scout/pairing");
62638
+ PAIRING_DIR2 = join28(homedir23(), ".scout/pairing");
61870
62639
  });
61871
62640
 
61872
62641
  // ../../node_modules/.bun/uqr@0.1.3/node_modules/uqr/dist/index.mjs
@@ -62738,8 +63507,8 @@ async function runPairCommand(context, args) {
62738
63507
  process.on("SIGINT", handleSignal);
62739
63508
  process.on("SIGTERM", handleSignal);
62740
63509
  try {
62741
- await new Promise((resolve15) => {
62742
- controller.signal.addEventListener("abort", () => resolve15(), { once: true });
63510
+ await new Promise((resolve16) => {
63511
+ controller.signal.addEventListener("abort", () => resolve16(), { once: true });
62743
63512
  });
62744
63513
  } finally {
62745
63514
  process.off("SIGINT", handleSignal);
@@ -62813,9 +63582,9 @@ __export(exports_server, {
62813
63582
  normalizeServerOpenPath: () => normalizeServerOpenPath
62814
63583
  });
62815
63584
  import { spawn as spawn5 } from "child_process";
62816
- import { existsSync as existsSync20, mkdirSync as mkdirSync12, openSync } from "fs";
62817
- import { homedir as homedir23 } from "os";
62818
- import { dirname as dirname15, join as join28, resolve as resolve15 } from "path";
63585
+ import { existsSync as existsSync21, mkdirSync as mkdirSync12, openSync } from "fs";
63586
+ import { homedir as homedir24 } from "os";
63587
+ import { dirname as dirname15, join as join29, resolve as resolve16 } from "path";
62819
63588
  import { fileURLToPath as fileURLToPath10 } from "url";
62820
63589
  function renderServerCommandHelp() {
62821
63590
  return [
@@ -62835,6 +63604,14 @@ function renderServerCommandHelp() {
62835
63604
  " --static Serve built UI from disk",
62836
63605
  " --static-root DIR Static client root (optional override OPENSCOUT_WEB_STATIC_ROOT)",
62837
63606
  " --vite-url URL Dev proxy target for non-API routes (optional override OPENSCOUT_WEB_VITE_URL)",
63607
+ " --public-origin URL",
63608
+ " Public origin behind Caddy, e.g. https://scout.<host>.local",
63609
+ " --advertised-host HOST",
63610
+ " LAN host to advertise/trust (default scout.<machine>.local)",
63611
+ " --trusted-host HOST",
63612
+ " Additional trusted API host; may be repeated",
63613
+ " --trusted-origin URL",
63614
+ " Additional trusted browser origin; may be repeated",
62838
63615
  " --cwd DIR Workspace / setup root (optional override OPENSCOUT_SETUP_CWD)",
62839
63616
  " --path PATH Browser path for `open` (default /)",
62840
63617
  "",
@@ -62893,6 +63670,34 @@ function parseServerFlags(args) {
62893
63670
  env.OPENSCOUT_WEB_VITE_URL = v;
62894
63671
  continue;
62895
63672
  }
63673
+ if (a === "--public-origin") {
63674
+ const v = args[++i];
63675
+ if (!v)
63676
+ throw new ScoutCliError("--public-origin requires a value");
63677
+ env.OPENSCOUT_WEB_PUBLIC_ORIGIN = v;
63678
+ continue;
63679
+ }
63680
+ if (a === "--advertised-host") {
63681
+ const v = args[++i];
63682
+ if (!v)
63683
+ throw new ScoutCliError("--advertised-host requires a value");
63684
+ env.OPENSCOUT_WEB_ADVERTISED_HOST = v;
63685
+ continue;
63686
+ }
63687
+ if (a === "--trusted-host") {
63688
+ const v = args[++i];
63689
+ if (!v)
63690
+ throw new ScoutCliError("--trusted-host requires a value");
63691
+ appendEnvList(env, "OPENSCOUT_WEB_TRUSTED_HOSTS", v);
63692
+ continue;
63693
+ }
63694
+ if (a === "--trusted-origin") {
63695
+ const v = args[++i];
63696
+ if (!v)
63697
+ throw new ScoutCliError("--trusted-origin requires a value");
63698
+ appendEnvList(env, "OPENSCOUT_WEB_TRUSTED_ORIGINS", v);
63699
+ continue;
63700
+ }
62896
63701
  if (a === "--cwd") {
62897
63702
  const v = args[++i];
62898
63703
  if (!v)
@@ -62919,6 +63724,22 @@ function parseServerFlags(args) {
62919
63724
  env.OPENSCOUT_WEB_VITE_URL = a.slice("--vite-url=".length);
62920
63725
  continue;
62921
63726
  }
63727
+ if (a.startsWith("--public-origin=")) {
63728
+ env.OPENSCOUT_WEB_PUBLIC_ORIGIN = a.slice("--public-origin=".length);
63729
+ continue;
63730
+ }
63731
+ if (a.startsWith("--advertised-host=")) {
63732
+ env.OPENSCOUT_WEB_ADVERTISED_HOST = a.slice("--advertised-host=".length);
63733
+ continue;
63734
+ }
63735
+ if (a.startsWith("--trusted-host=")) {
63736
+ appendEnvList(env, "OPENSCOUT_WEB_TRUSTED_HOSTS", a.slice("--trusted-host=".length));
63737
+ continue;
63738
+ }
63739
+ if (a.startsWith("--trusted-origin=")) {
63740
+ appendEnvList(env, "OPENSCOUT_WEB_TRUSTED_ORIGINS", a.slice("--trusted-origin=".length));
63741
+ continue;
63742
+ }
62922
63743
  if (a.startsWith("--cwd=")) {
62923
63744
  env.OPENSCOUT_SETUP_CWD = a.slice("--cwd=".length);
62924
63745
  continue;
@@ -62931,11 +63752,14 @@ function parseServerFlags(args) {
62931
63752
  }
62932
63753
  return { env, openPath };
62933
63754
  }
63755
+ function appendEnvList(env, key, value) {
63756
+ env[key] = env[key] ? `${env[key]},${value}` : value;
63757
+ }
62934
63758
  function resolveBundledStaticClientRoot(entry, _mode) {
62935
63759
  const entryDir = dirname15(entry);
62936
- const clientDirectory = join28(entryDir, "client");
62937
- const indexPath = join28(clientDirectory, "index.html");
62938
- return existsSync20(indexPath) ? clientDirectory : null;
63760
+ const clientDirectory = join29(entryDir, "client");
63761
+ const indexPath = join29(clientDirectory, "index.html");
63762
+ return existsSync21(indexPath) ? clientDirectory : null;
62939
63763
  }
62940
63764
  function resolveBunExecutable4(env) {
62941
63765
  const bun = resolveBunExecutable(env);
@@ -63116,9 +63940,9 @@ async function openBrowser(url2) {
63116
63940
  });
63117
63941
  }
63118
63942
  function resolveScoutWebServerLogPath() {
63119
- const dir = join28(homedir23(), ".scout", "logs");
63943
+ const dir = join29(homedir24(), ".scout", "logs");
63120
63944
  mkdirSync12(dir, { recursive: true });
63121
- return join28(dir, "web-server.log");
63945
+ return join29(dir, "web-server.log");
63122
63946
  }
63123
63947
  async function spawnDetachedServer(entry, env) {
63124
63948
  const bunExecutable = resolveBunExecutable4(env);
@@ -63149,7 +63973,7 @@ async function waitForScoutServer(port, mode, expectedCurrentDirectory) {
63149
63973
  while (Date.now() < deadline) {
63150
63974
  const probe = await probeScoutServer(port);
63151
63975
  if (probe.status === "healthy") {
63152
- const actualCurrentDirectory = resolve15(probe.health.currentDirectory);
63976
+ const actualCurrentDirectory = resolve16(probe.health.currentDirectory);
63153
63977
  if (!isCurrentScoutWebSurface(probe.health.surface)) {
63154
63978
  throw new ScoutCliError(`port ${port} is serving Scout ${renderSurfaceLabel(probe.health.surface)}, not ${renderModeLabel(mode)}.`);
63155
63979
  }
@@ -63171,7 +63995,7 @@ async function openScoutServer(options) {
63171
63995
  const browserUrl = new URL(normalizeServerOpenPath(options.openPath), `http://127.0.0.1:${port}`).toString();
63172
63996
  const probe = await probeScoutServer(port);
63173
63997
  if (probe.status === "healthy") {
63174
- const actualCurrentDirectory = resolve15(probe.health.currentDirectory);
63998
+ const actualCurrentDirectory = resolve16(probe.health.currentDirectory);
63175
63999
  if (!isCurrentScoutWebSurface(probe.health.surface)) {
63176
64000
  throw new ScoutCliError(`port ${port} is already serving Scout ${renderSurfaceLabel(probe.health.surface)}, not ${renderModeLabel(options.mode)}.`);
63177
64001
  }
@@ -63370,11 +64194,11 @@ import { EventEmitter } from "events";
63370
64194
  import { Buffer as Buffer2 } from "buffer";
63371
64195
  import { Buffer as Buffer3 } from "buffer";
63372
64196
  import { EventEmitter as EventEmitter2 } from "events";
63373
- import { resolve as resolve16, dirname as dirname16 } from "path";
64197
+ import { resolve as resolve17, dirname as dirname16 } from "path";
63374
64198
  import { fileURLToPath as fileURLToPath11 } from "url";
63375
64199
  import { resolve as resolve22, isAbsolute as isAbsolute5, parse as parse7 } from "path";
63376
- import { existsSync as existsSync21 } from "fs";
63377
- import { basename as basename11, join as join29 } from "path";
64200
+ import { existsSync as existsSync22 } from "fs";
64201
+ import { basename as basename11, join as join30 } from "path";
63378
64202
  import os from "os";
63379
64203
  import path2 from "path";
63380
64204
  import { EventEmitter as EventEmitter3 } from "events";
@@ -63385,7 +64209,7 @@ import { mkdir as mkdir9, readFile as readFile11, writeFile as writeFile8 } from
63385
64209
  import * as path3 from "path";
63386
64210
  import { readdir as readdir3 } from "fs/promises";
63387
64211
  import { dlopen, toArrayBuffer as toArrayBuffer4, JSCallback, ptr as ptr4 } from "bun:ffi";
63388
- import { existsSync as existsSync22, writeFileSync as writeFileSync8 } from "fs";
64212
+ import { existsSync as existsSync23, writeFileSync as writeFileSync8 } from "fs";
63389
64213
  import { EventEmitter as EventEmitter4 } from "events";
63390
64214
  import { toArrayBuffer, ptr } from "bun:ffi";
63391
64215
  import { ptr as ptr2, toArrayBuffer as toArrayBuffer2 } from "bun:ffi";
@@ -66506,13 +67330,13 @@ class DebounceController {
66506
67330
  }
66507
67331
  debounce(id, ms, fn) {
66508
67332
  const scopeMap = TIMERS_MAP.get(this.scopeId);
66509
- return new Promise((resolve18, reject) => {
67333
+ return new Promise((resolve19, reject) => {
66510
67334
  if (scopeMap.has(id)) {
66511
67335
  clearTimeout(scopeMap.get(id));
66512
67336
  }
66513
67337
  const timerId = setTimeout(() => {
66514
67338
  try {
66515
- resolve18(fn());
67339
+ resolve19(fn());
66516
67340
  } catch (error48) {
66517
67341
  reject(error48);
66518
67342
  }
@@ -66602,25 +67426,25 @@ function getParsers() {
66602
67426
  filetype: "javascript",
66603
67427
  aliases: ["javascriptreact"],
66604
67428
  queries: {
66605
- highlights: [resolve16(dirname16(fileURLToPath11(import.meta.url)), highlights_default)]
67429
+ highlights: [resolve17(dirname16(fileURLToPath11(import.meta.url)), highlights_default)]
66606
67430
  },
66607
- wasm: resolve16(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_javascript_default)
67431
+ wasm: resolve17(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_javascript_default)
66608
67432
  },
66609
67433
  {
66610
67434
  filetype: "typescript",
66611
67435
  aliases: ["typescriptreact"],
66612
67436
  queries: {
66613
- highlights: [resolve16(dirname16(fileURLToPath11(import.meta.url)), highlights_default2)]
67437
+ highlights: [resolve17(dirname16(fileURLToPath11(import.meta.url)), highlights_default2)]
66614
67438
  },
66615
- wasm: resolve16(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_typescript_default)
67439
+ wasm: resolve17(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_typescript_default)
66616
67440
  },
66617
67441
  {
66618
67442
  filetype: "markdown",
66619
67443
  queries: {
66620
- highlights: [resolve16(dirname16(fileURLToPath11(import.meta.url)), highlights_default3)],
66621
- injections: [resolve16(dirname16(fileURLToPath11(import.meta.url)), injections_default)]
67444
+ highlights: [resolve17(dirname16(fileURLToPath11(import.meta.url)), highlights_default3)],
67445
+ injections: [resolve17(dirname16(fileURLToPath11(import.meta.url)), injections_default)]
66622
67446
  },
66623
- wasm: resolve16(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_markdown_default),
67447
+ wasm: resolve17(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_markdown_default),
66624
67448
  injectionMapping: {
66625
67449
  nodeTypes: {
66626
67450
  inline: "markdown_inline",
@@ -66643,16 +67467,16 @@ function getParsers() {
66643
67467
  {
66644
67468
  filetype: "markdown_inline",
66645
67469
  queries: {
66646
- highlights: [resolve16(dirname16(fileURLToPath11(import.meta.url)), highlights_default4)]
67470
+ highlights: [resolve17(dirname16(fileURLToPath11(import.meta.url)), highlights_default4)]
66647
67471
  },
66648
- wasm: resolve16(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_markdown_inline_default)
67472
+ wasm: resolve17(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_markdown_inline_default)
66649
67473
  },
66650
67474
  {
66651
67475
  filetype: "zig",
66652
67476
  queries: {
66653
- highlights: [resolve16(dirname16(fileURLToPath11(import.meta.url)), highlights_default5)]
67477
+ highlights: [resolve17(dirname16(fileURLToPath11(import.meta.url)), highlights_default5)]
66654
67478
  },
66655
- wasm: resolve16(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_zig_default)
67479
+ wasm: resolve17(dirname16(fileURLToPath11(import.meta.url)), tree_sitter_zig_default)
66656
67480
  }
66657
67481
  ];
66658
67482
  }
@@ -66665,7 +67489,7 @@ function getBunfsRootPath() {
66665
67489
  return process.platform === "win32" ? "B:\\~BUN\\root" : "/$bunfs/root";
66666
67490
  }
66667
67491
  function normalizeBunfsPath(fileName) {
66668
- return join29(getBunfsRootPath(), basename11(fileName));
67492
+ return join30(getBunfsRootPath(), basename11(fileName));
66669
67493
  }
66670
67494
  function addDefaultParsers(parsers) {
66671
67495
  for (const parser of parsers) {
@@ -72419,7 +73243,7 @@ var __defProp4, __returnValue2 = (v) => v, __export2 = (target, all) => {
72419
73243
  configurable: true,
72420
73244
  set: __exportSetter2.bind(all, name)
72421
73245
  });
72422
- }, exports_src, loadYoga, yoga_wasm_base64_esm_default, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, constants5, YGEnums_default, Yoga, src_default, VALID_BORDER_STYLES, BorderChars, BorderCharArrays, KeyHandler, InternalKeyHandler, CSS_COLOR_NAMES, block_default, shade_default, slick_default, tiny_default, huge_default, grid_default, pallet_default, fonts, parsedFonts, TextAttributes, ATTRIBUTE_BASE_BITS = 8, ATTRIBUTE_BASE_MASK = 255, DebugOverlayCorner, TargetChannel, ATTRIBUTE_BASE_MASK2 = 255, LINK_ID_SHIFT = 8, LINK_ID_PAYLOAD_MASK = 16777215, BrandedStyledText, StyledText, black = (input) => applyStyle(input, { fg: "black" }), red = (input) => applyStyle(input, { fg: "red" }), green = (input) => applyStyle(input, { fg: "green" }), yellow = (input) => applyStyle(input, { fg: "yellow" }), blue = (input) => applyStyle(input, { fg: "blue" }), magenta = (input) => applyStyle(input, { fg: "magenta" }), cyan = (input) => applyStyle(input, { fg: "cyan" }), white = (input) => applyStyle(input, { fg: "white" }), brightBlack = (input) => applyStyle(input, { fg: "brightBlack" }), brightRed = (input) => applyStyle(input, { fg: "brightRed" }), brightGreen = (input) => applyStyle(input, { fg: "brightGreen" }), brightYellow = (input) => applyStyle(input, { fg: "brightYellow" }), brightBlue = (input) => applyStyle(input, { fg: "brightBlue" }), brightMagenta = (input) => applyStyle(input, { fg: "brightMagenta" }), brightCyan = (input) => applyStyle(input, { fg: "brightCyan" }), brightWhite = (input) => applyStyle(input, { fg: "brightWhite" }), bgBlack = (input) => applyStyle(input, { bg: "black" }), bgRed = (input) => applyStyle(input, { bg: "red" }), bgGreen = (input) => applyStyle(input, { bg: "green" }), bgYellow = (input) => applyStyle(input, { bg: "yellow" }), bgBlue = (input) => applyStyle(input, { bg: "blue" }), bgMagenta = (input) => applyStyle(input, { bg: "magenta" }), bgCyan = (input) => applyStyle(input, { bg: "cyan" }), bgWhite = (input) => applyStyle(input, { bg: "white" }), bold = (input) => applyStyle(input, { bold: true }), italic = (input) => applyStyle(input, { italic: true }), underline = (input) => applyStyle(input, { underline: true }), strikethrough = (input) => applyStyle(input, { strikethrough: true }), dim = (input) => applyStyle(input, { dim: true }), reverse = (input) => applyStyle(input, { reverse: true }), blink = (input) => applyStyle(input, { blink: true }), fg = (color) => (input) => applyStyle(input, { fg: color }), bg = (color) => (input) => applyStyle(input, { bg: color }), link = (url2) => (input) => {
73246
+ }, exports_src, loadYoga, yoga_wasm_base64_esm_default, Align, BoxSizing, Dimension, Direction, Display, Edge, Errata, ExperimentalFeature, FlexDirection, Gutter, Justify, LogLevel, MeasureMode, NodeType, Overflow, PositionType, Unit, Wrap, constants6, YGEnums_default, Yoga, src_default, VALID_BORDER_STYLES, BorderChars, BorderCharArrays, KeyHandler, InternalKeyHandler, CSS_COLOR_NAMES, block_default, shade_default, slick_default, tiny_default, huge_default, grid_default, pallet_default, fonts, parsedFonts, TextAttributes, ATTRIBUTE_BASE_BITS = 8, ATTRIBUTE_BASE_MASK = 255, DebugOverlayCorner, TargetChannel, ATTRIBUTE_BASE_MASK2 = 255, LINK_ID_SHIFT = 8, LINK_ID_PAYLOAD_MASK = 16777215, BrandedStyledText, StyledText, black = (input) => applyStyle(input, { fg: "black" }), red = (input) => applyStyle(input, { fg: "red" }), green = (input) => applyStyle(input, { fg: "green" }), yellow = (input) => applyStyle(input, { fg: "yellow" }), blue = (input) => applyStyle(input, { fg: "blue" }), magenta = (input) => applyStyle(input, { fg: "magenta" }), cyan = (input) => applyStyle(input, { fg: "cyan" }), white = (input) => applyStyle(input, { fg: "white" }), brightBlack = (input) => applyStyle(input, { fg: "brightBlack" }), brightRed = (input) => applyStyle(input, { fg: "brightRed" }), brightGreen = (input) => applyStyle(input, { fg: "brightGreen" }), brightYellow = (input) => applyStyle(input, { fg: "brightYellow" }), brightBlue = (input) => applyStyle(input, { fg: "brightBlue" }), brightMagenta = (input) => applyStyle(input, { fg: "brightMagenta" }), brightCyan = (input) => applyStyle(input, { fg: "brightCyan" }), brightWhite = (input) => applyStyle(input, { fg: "brightWhite" }), bgBlack = (input) => applyStyle(input, { bg: "black" }), bgRed = (input) => applyStyle(input, { bg: "red" }), bgGreen = (input) => applyStyle(input, { bg: "green" }), bgYellow = (input) => applyStyle(input, { bg: "yellow" }), bgBlue = (input) => applyStyle(input, { bg: "blue" }), bgMagenta = (input) => applyStyle(input, { bg: "magenta" }), bgCyan = (input) => applyStyle(input, { bg: "cyan" }), bgWhite = (input) => applyStyle(input, { bg: "white" }), bold = (input) => applyStyle(input, { bold: true }), italic = (input) => applyStyle(input, { italic: true }), underline = (input) => applyStyle(input, { underline: true }), strikethrough = (input) => applyStyle(input, { strikethrough: true }), dim = (input) => applyStyle(input, { dim: true }), reverse = (input) => applyStyle(input, { reverse: true }), blink = (input) => applyStyle(input, { blink: true }), fg = (color) => (input) => applyStyle(input, { fg: color }), bg = (color) => (input) => applyStyle(input, { bg: color }), link = (url2) => (input) => {
72423
73247
  const chunk = typeof input === "object" && "__isChunk" in input ? input : {
72424
73248
  __isChunk: true,
72425
73249
  text: String(input)
@@ -74079,7 +74903,7 @@ var init_index_vy1rm1x3 = __esm(async () => {
74079
74903
  Wrap2[Wrap2["WrapReverse"] = 2] = "WrapReverse";
74080
74904
  return Wrap2;
74081
74905
  }({});
74082
- constants5 = {
74906
+ constants6 = {
74083
74907
  ALIGN_AUTO: Align.Auto,
74084
74908
  ALIGN_FLEX_START: Align.FlexStart,
74085
74909
  ALIGN_CENTER: Align.Center,
@@ -74153,7 +74977,7 @@ var init_index_vy1rm1x3 = __esm(async () => {
74153
74977
  WRAP_WRAP: Wrap.Wrap,
74154
74978
  WRAP_WRAP_REVERSE: Wrap.WrapReverse
74155
74979
  };
74156
- YGEnums_default = constants5;
74980
+ YGEnums_default = constants6;
74157
74981
  Yoga = wrapAssembly(await yoga_wasm_base64_esm_default());
74158
74982
  src_default = Yoga;
74159
74983
  VALID_BORDER_STYLES = ["single", "double", "rounded", "heavy"];
@@ -77587,7 +78411,7 @@ var init_index_vy1rm1x3 = __esm(async () => {
77587
78411
  worker_path = this.options.workerPath;
77588
78412
  } else {
77589
78413
  worker_path = new URL("./parser.worker.js", import.meta.url).href;
77590
- if (!existsSync21(resolve22(import.meta.dirname, "parser.worker.js"))) {
78414
+ if (!existsSync22(resolve22(import.meta.dirname, "parser.worker.js"))) {
77591
78415
  worker_path = new URL("./parser.worker.ts", import.meta.url).href;
77592
78416
  }
77593
78417
  }
@@ -78419,7 +79243,7 @@ var init_index_vy1rm1x3 = __esm(async () => {
78419
79243
  if (isBunfsPath(targetLibPath)) {
78420
79244
  targetLibPath = targetLibPath.replace("../", "");
78421
79245
  }
78422
- if (!existsSync22(targetLibPath)) {
79246
+ if (!existsSync23(targetLibPath)) {
78423
79247
  throw new Error(`opentui is not supported on the current platform: ${process.platform}-${process.arch}`);
78424
79248
  }
78425
79249
  registerEnvVar({
@@ -95888,14 +96712,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
95888
96712
  prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
95889
96713
  actScopeDepth = prevActScopeDepth;
95890
96714
  }
95891
- function recursivelyFlushAsyncActWork(returnValue, resolve18, reject) {
96715
+ function recursivelyFlushAsyncActWork(returnValue, resolve19, reject) {
95892
96716
  var queue = ReactSharedInternals.actQueue;
95893
96717
  if (queue !== null)
95894
96718
  if (queue.length !== 0)
95895
96719
  try {
95896
96720
  flushActQueue(queue);
95897
96721
  enqueueTask(function() {
95898
- return recursivelyFlushAsyncActWork(returnValue, resolve18, reject);
96722
+ return recursivelyFlushAsyncActWork(returnValue, resolve19, reject);
95899
96723
  });
95900
96724
  return;
95901
96725
  } catch (error48) {
@@ -95903,7 +96727,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
95903
96727
  }
95904
96728
  else
95905
96729
  ReactSharedInternals.actQueue = null;
95906
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve18(returnValue);
96730
+ 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve19(returnValue);
95907
96731
  }
95908
96732
  function flushActQueue(queue) {
95909
96733
  if (!isFlushing) {
@@ -96079,14 +96903,14 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
96079
96903
  didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
96080
96904
  });
96081
96905
  return {
96082
- then: function(resolve18, reject) {
96906
+ then: function(resolve19, reject) {
96083
96907
  didAwaitActCall = true;
96084
96908
  thenable.then(function(returnValue) {
96085
96909
  popActScope(prevActQueue, prevActScopeDepth);
96086
96910
  if (prevActScopeDepth === 0) {
96087
96911
  try {
96088
96912
  flushActQueue(queue), enqueueTask(function() {
96089
- return recursivelyFlushAsyncActWork(returnValue, resolve18, reject);
96913
+ return recursivelyFlushAsyncActWork(returnValue, resolve19, reject);
96090
96914
  });
96091
96915
  } catch (error$0) {
96092
96916
  ReactSharedInternals.thrownErrors.push(error$0);
@@ -96097,7 +96921,7 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
96097
96921
  reject(_thrownError);
96098
96922
  }
96099
96923
  } else
96100
- resolve18(returnValue);
96924
+ resolve19(returnValue);
96101
96925
  }, function(error48) {
96102
96926
  popActScope(prevActQueue, prevActScopeDepth);
96103
96927
  0 < ReactSharedInternals.thrownErrors.length ? (error48 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error48)) : reject(error48);
@@ -96113,11 +96937,11 @@ See https://react.dev/link/invalid-hook-call for tips about how to debug and fix
96113
96937
  if (0 < ReactSharedInternals.thrownErrors.length)
96114
96938
  throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
96115
96939
  return {
96116
- then: function(resolve18, reject) {
96940
+ then: function(resolve19, reject) {
96117
96941
  didAwaitActCall = true;
96118
96942
  prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
96119
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve18, reject);
96120
- })) : resolve18(returnValue$jscomp$0);
96943
+ return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve19, reject);
96944
+ })) : resolve19(returnValue$jscomp$0);
96121
96945
  }
96122
96946
  };
96123
96947
  };
@@ -98598,8 +99422,8 @@ It can also happen if the client has a browser extension installed which messes
98598
99422
  currentEntangledActionThenable = {
98599
99423
  status: "pending",
98600
99424
  value: undefined,
98601
- then: function(resolve18) {
98602
- entangledListeners.push(resolve18);
99425
+ then: function(resolve19) {
99426
+ entangledListeners.push(resolve19);
98603
99427
  }
98604
99428
  };
98605
99429
  }
@@ -98623,8 +99447,8 @@ It can also happen if the client has a browser extension installed which messes
98623
99447
  status: "pending",
98624
99448
  value: null,
98625
99449
  reason: null,
98626
- then: function(resolve18) {
98627
- listeners.push(resolve18);
99450
+ then: function(resolve19) {
99451
+ listeners.push(resolve19);
98628
99452
  }
98629
99453
  };
98630
99454
  thenable.then(function() {
@@ -123778,837 +124602,6 @@ var init_react = __esm(async () => {
123778
124602
  extend2({ "time-to-first-draw": TimeToFirstDrawRenderable });
123779
124603
  });
123780
124604
 
123781
- // ../../../../node_modules/react/cjs/react.development.js
123782
- var require_react_development2 = __commonJS((exports, module2) => {
123783
- (function() {
123784
- function defineDeprecationWarning(methodName, info) {
123785
- Object.defineProperty(Component.prototype, methodName, {
123786
- get: function() {
123787
- console.warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
123788
- }
123789
- });
123790
- }
123791
- function getIteratorFn(maybeIterable) {
123792
- if (maybeIterable === null || typeof maybeIterable !== "object")
123793
- return null;
123794
- maybeIterable = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable["@@iterator"];
123795
- return typeof maybeIterable === "function" ? maybeIterable : null;
123796
- }
123797
- function warnNoop(publicInstance, callerName) {
123798
- publicInstance = (publicInstance = publicInstance.constructor) && (publicInstance.displayName || publicInstance.name) || "ReactClass";
123799
- var warningKey = publicInstance + "." + callerName;
123800
- didWarnStateUpdateForUnmountedComponent[warningKey] || (console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, publicInstance), didWarnStateUpdateForUnmountedComponent[warningKey] = true);
123801
- }
123802
- function Component(props, context, updater) {
123803
- this.props = props;
123804
- this.context = context;
123805
- this.refs = emptyObject2;
123806
- this.updater = updater || ReactNoopUpdateQueue;
123807
- }
123808
- function ComponentDummy() {}
123809
- function PureComponent(props, context, updater) {
123810
- this.props = props;
123811
- this.context = context;
123812
- this.refs = emptyObject2;
123813
- this.updater = updater || ReactNoopUpdateQueue;
123814
- }
123815
- function noop4() {}
123816
- function testStringCoercion(value) {
123817
- return "" + value;
123818
- }
123819
- function checkKeyStringCoercion(value) {
123820
- try {
123821
- testStringCoercion(value);
123822
- var JSCompiler_inline_result = false;
123823
- } catch (e) {
123824
- JSCompiler_inline_result = true;
123825
- }
123826
- if (JSCompiler_inline_result) {
123827
- JSCompiler_inline_result = console;
123828
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
123829
- var JSCompiler_inline_result$jscomp$0 = typeof Symbol === "function" && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
123830
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
123831
- return testStringCoercion(value);
123832
- }
123833
- }
123834
- function getComponentNameFromType(type) {
123835
- if (type == null)
123836
- return null;
123837
- if (typeof type === "function")
123838
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
123839
- if (typeof type === "string")
123840
- return type;
123841
- switch (type) {
123842
- case REACT_FRAGMENT_TYPE:
123843
- return "Fragment";
123844
- case REACT_PROFILER_TYPE:
123845
- return "Profiler";
123846
- case REACT_STRICT_MODE_TYPE:
123847
- return "StrictMode";
123848
- case REACT_SUSPENSE_TYPE:
123849
- return "Suspense";
123850
- case REACT_SUSPENSE_LIST_TYPE:
123851
- return "SuspenseList";
123852
- case REACT_ACTIVITY_TYPE:
123853
- return "Activity";
123854
- }
123855
- if (typeof type === "object")
123856
- switch (typeof type.tag === "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
123857
- case REACT_PORTAL_TYPE:
123858
- return "Portal";
123859
- case REACT_CONTEXT_TYPE:
123860
- return type.displayName || "Context";
123861
- case REACT_CONSUMER_TYPE:
123862
- return (type._context.displayName || "Context") + ".Consumer";
123863
- case REACT_FORWARD_REF_TYPE:
123864
- var innerType = type.render;
123865
- type = type.displayName;
123866
- type || (type = innerType.displayName || innerType.name || "", type = type !== "" ? "ForwardRef(" + type + ")" : "ForwardRef");
123867
- return type;
123868
- case REACT_MEMO_TYPE:
123869
- return innerType = type.displayName || null, innerType !== null ? innerType : getComponentNameFromType(type.type) || "Memo";
123870
- case REACT_LAZY_TYPE:
123871
- innerType = type._payload;
123872
- type = type._init;
123873
- try {
123874
- return getComponentNameFromType(type(innerType));
123875
- } catch (x2) {}
123876
- }
123877
- return null;
123878
- }
123879
- function getTaskName(type) {
123880
- if (type === REACT_FRAGMENT_TYPE)
123881
- return "<>";
123882
- if (typeof type === "object" && type !== null && type.$$typeof === REACT_LAZY_TYPE)
123883
- return "<...>";
123884
- try {
123885
- var name = getComponentNameFromType(type);
123886
- return name ? "<" + name + ">" : "<...>";
123887
- } catch (x2) {
123888
- return "<...>";
123889
- }
123890
- }
123891
- function getOwner() {
123892
- var dispatcher = ReactSharedInternals.A;
123893
- return dispatcher === null ? null : dispatcher.getOwner();
123894
- }
123895
- function UnknownOwner() {
123896
- return Error("react-stack-top-frame");
123897
- }
123898
- function hasValidKey(config3) {
123899
- if (hasOwnProperty.call(config3, "key")) {
123900
- var getter = Object.getOwnPropertyDescriptor(config3, "key").get;
123901
- if (getter && getter.isReactWarning)
123902
- return false;
123903
- }
123904
- return config3.key !== undefined;
123905
- }
123906
- function defineKeyPropWarningGetter(props, displayName) {
123907
- function warnAboutAccessingKey() {
123908
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
123909
- }
123910
- warnAboutAccessingKey.isReactWarning = true;
123911
- Object.defineProperty(props, "key", {
123912
- get: warnAboutAccessingKey,
123913
- configurable: true
123914
- });
123915
- }
123916
- function elementRefGetterWithDeprecationWarning() {
123917
- var componentName = getComponentNameFromType(this.type);
123918
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
123919
- componentName = this.props.ref;
123920
- return componentName !== undefined ? componentName : null;
123921
- }
123922
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
123923
- var refProp = props.ref;
123924
- type = {
123925
- $$typeof: REACT_ELEMENT_TYPE,
123926
- type,
123927
- key,
123928
- props,
123929
- _owner: owner
123930
- };
123931
- (refProp !== undefined ? refProp : null) !== null ? Object.defineProperty(type, "ref", {
123932
- enumerable: false,
123933
- get: elementRefGetterWithDeprecationWarning
123934
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
123935
- type._store = {};
123936
- Object.defineProperty(type._store, "validated", {
123937
- configurable: false,
123938
- enumerable: false,
123939
- writable: true,
123940
- value: 0
123941
- });
123942
- Object.defineProperty(type, "_debugInfo", {
123943
- configurable: false,
123944
- enumerable: false,
123945
- writable: true,
123946
- value: null
123947
- });
123948
- Object.defineProperty(type, "_debugStack", {
123949
- configurable: false,
123950
- enumerable: false,
123951
- writable: true,
123952
- value: debugStack
123953
- });
123954
- Object.defineProperty(type, "_debugTask", {
123955
- configurable: false,
123956
- enumerable: false,
123957
- writable: true,
123958
- value: debugTask
123959
- });
123960
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
123961
- return type;
123962
- }
123963
- function cloneAndReplaceKey(oldElement, newKey) {
123964
- newKey = ReactElement(oldElement.type, newKey, oldElement.props, oldElement._owner, oldElement._debugStack, oldElement._debugTask);
123965
- oldElement._store && (newKey._store.validated = oldElement._store.validated);
123966
- return newKey;
123967
- }
123968
- function validateChildKeys(node) {
123969
- isValidElement(node) ? node._store && (node._store.validated = 1) : typeof node === "object" && node !== null && node.$$typeof === REACT_LAZY_TYPE && (node._payload.status === "fulfilled" ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
123970
- }
123971
- function isValidElement(object4) {
123972
- return typeof object4 === "object" && object4 !== null && object4.$$typeof === REACT_ELEMENT_TYPE;
123973
- }
123974
- function escape2(key) {
123975
- var escaperLookup = { "=": "=0", ":": "=2" };
123976
- return "$" + key.replace(/[=:]/g, function(match2) {
123977
- return escaperLookup[match2];
123978
- });
123979
- }
123980
- function getElementKey(element, index) {
123981
- return typeof element === "object" && element !== null && element.key != null ? (checkKeyStringCoercion(element.key), escape2("" + element.key)) : index.toString(36);
123982
- }
123983
- function resolveThenable(thenable) {
123984
- switch (thenable.status) {
123985
- case "fulfilled":
123986
- return thenable.value;
123987
- case "rejected":
123988
- throw thenable.reason;
123989
- default:
123990
- switch (typeof thenable.status === "string" ? thenable.then(noop4, noop4) : (thenable.status = "pending", thenable.then(function(fulfilledValue) {
123991
- thenable.status === "pending" && (thenable.status = "fulfilled", thenable.value = fulfilledValue);
123992
- }, function(error48) {
123993
- thenable.status === "pending" && (thenable.status = "rejected", thenable.reason = error48);
123994
- })), thenable.status) {
123995
- case "fulfilled":
123996
- return thenable.value;
123997
- case "rejected":
123998
- throw thenable.reason;
123999
- }
124000
- }
124001
- throw thenable;
124002
- }
124003
- function mapIntoArray(children, array3, escapedPrefix, nameSoFar, callback) {
124004
- var type = typeof children;
124005
- if (type === "undefined" || type === "boolean")
124006
- children = null;
124007
- var invokeCallback = false;
124008
- if (children === null)
124009
- invokeCallback = true;
124010
- else
124011
- switch (type) {
124012
- case "bigint":
124013
- case "string":
124014
- case "number":
124015
- invokeCallback = true;
124016
- break;
124017
- case "object":
124018
- switch (children.$$typeof) {
124019
- case REACT_ELEMENT_TYPE:
124020
- case REACT_PORTAL_TYPE:
124021
- invokeCallback = true;
124022
- break;
124023
- case REACT_LAZY_TYPE:
124024
- return invokeCallback = children._init, mapIntoArray(invokeCallback(children._payload), array3, escapedPrefix, nameSoFar, callback);
124025
- }
124026
- }
124027
- if (invokeCallback) {
124028
- invokeCallback = children;
124029
- callback = callback(invokeCallback);
124030
- var childKey = nameSoFar === "" ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
124031
- isArrayImpl(callback) ? (escapedPrefix = "", childKey != null && (escapedPrefix = childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"), mapIntoArray(callback, array3, escapedPrefix, "", function(c) {
124032
- return c;
124033
- })) : callback != null && (isValidElement(callback) && (callback.key != null && (invokeCallback && invokeCallback.key === callback.key || checkKeyStringCoercion(callback.key)), escapedPrefix = cloneAndReplaceKey(callback, escapedPrefix + (callback.key == null || invokeCallback && invokeCallback.key === callback.key ? "" : ("" + callback.key).replace(userProvidedKeyEscapeRegex, "$&/") + "/") + childKey), nameSoFar !== "" && invokeCallback != null && isValidElement(invokeCallback) && invokeCallback.key == null && invokeCallback._store && !invokeCallback._store.validated && (escapedPrefix._store.validated = 2), callback = escapedPrefix), array3.push(callback));
124034
- return 1;
124035
- }
124036
- invokeCallback = 0;
124037
- childKey = nameSoFar === "" ? "." : nameSoFar + ":";
124038
- if (isArrayImpl(children))
124039
- for (var i = 0;i < children.length; i++)
124040
- nameSoFar = children[i], type = childKey + getElementKey(nameSoFar, i), invokeCallback += mapIntoArray(nameSoFar, array3, escapedPrefix, type, callback);
124041
- else if (i = getIteratorFn(children), typeof i === "function")
124042
- for (i === children.entries && (didWarnAboutMaps || console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."), didWarnAboutMaps = true), children = i.call(children), i = 0;!(nameSoFar = children.next()).done; )
124043
- nameSoFar = nameSoFar.value, type = childKey + getElementKey(nameSoFar, i++), invokeCallback += mapIntoArray(nameSoFar, array3, escapedPrefix, type, callback);
124044
- else if (type === "object") {
124045
- if (typeof children.then === "function")
124046
- return mapIntoArray(resolveThenable(children), array3, escapedPrefix, nameSoFar, callback);
124047
- array3 = String(children);
124048
- throw Error("Objects are not valid as a React child (found: " + (array3 === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : array3) + "). If you meant to render a collection of children, use an array instead.");
124049
- }
124050
- return invokeCallback;
124051
- }
124052
- function mapChildren(children, func, context) {
124053
- if (children == null)
124054
- return children;
124055
- var result = [], count = 0;
124056
- mapIntoArray(children, result, "", "", function(child) {
124057
- return func.call(context, child, count++);
124058
- });
124059
- return result;
124060
- }
124061
- function lazyInitializer(payload) {
124062
- if (payload._status === -1) {
124063
- var ioInfo = payload._ioInfo;
124064
- ioInfo != null && (ioInfo.start = ioInfo.end = performance.now());
124065
- ioInfo = payload._result;
124066
- var thenable = ioInfo();
124067
- thenable.then(function(moduleObject) {
124068
- if (payload._status === 0 || payload._status === -1) {
124069
- payload._status = 1;
124070
- payload._result = moduleObject;
124071
- var _ioInfo = payload._ioInfo;
124072
- _ioInfo != null && (_ioInfo.end = performance.now());
124073
- thenable.status === undefined && (thenable.status = "fulfilled", thenable.value = moduleObject);
124074
- }
124075
- }, function(error48) {
124076
- if (payload._status === 0 || payload._status === -1) {
124077
- payload._status = 2;
124078
- payload._result = error48;
124079
- var _ioInfo2 = payload._ioInfo;
124080
- _ioInfo2 != null && (_ioInfo2.end = performance.now());
124081
- thenable.status === undefined && (thenable.status = "rejected", thenable.reason = error48);
124082
- }
124083
- });
124084
- ioInfo = payload._ioInfo;
124085
- if (ioInfo != null) {
124086
- ioInfo.value = thenable;
124087
- var displayName = thenable.displayName;
124088
- typeof displayName === "string" && (ioInfo.name = displayName);
124089
- }
124090
- payload._status === -1 && (payload._status = 0, payload._result = thenable);
124091
- }
124092
- if (payload._status === 1)
124093
- return ioInfo = payload._result, ioInfo === undefined && console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
124094
-
124095
- Your code should look like:
124096
- const MyComponent = lazy(() => import('./MyComponent'))
124097
-
124098
- Did you accidentally put curly braces around the import?`, ioInfo), "default" in ioInfo || console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
124099
-
124100
- Your code should look like:
124101
- const MyComponent = lazy(() => import('./MyComponent'))`, ioInfo), ioInfo.default;
124102
- throw payload._result;
124103
- }
124104
- function resolveDispatcher() {
124105
- var dispatcher = ReactSharedInternals.H;
124106
- dispatcher === null && console.error(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
124107
- 1. You might have mismatching versions of React and the renderer (such as React DOM)
124108
- 2. You might be breaking the Rules of Hooks
124109
- 3. You might have more than one copy of React in the same app
124110
- See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`);
124111
- return dispatcher;
124112
- }
124113
- function releaseAsyncTransition() {
124114
- ReactSharedInternals.asyncTransitions--;
124115
- }
124116
- function enqueueTask(task) {
124117
- if (enqueueTaskImpl === null)
124118
- try {
124119
- var requireString = ("require" + Math.random()).slice(0, 7);
124120
- enqueueTaskImpl = (module2 && module2[requireString]).call(module2, "timers").setImmediate;
124121
- } catch (_err) {
124122
- enqueueTaskImpl = function(callback) {
124123
- didWarnAboutMessageChannel === false && (didWarnAboutMessageChannel = true, typeof MessageChannel === "undefined" && console.error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));
124124
- var channel = new MessageChannel;
124125
- channel.port1.onmessage = callback;
124126
- channel.port2.postMessage(undefined);
124127
- };
124128
- }
124129
- return enqueueTaskImpl(task);
124130
- }
124131
- function aggregateErrors(errors4) {
124132
- return 1 < errors4.length && typeof AggregateError === "function" ? new AggregateError(errors4) : errors4[0];
124133
- }
124134
- function popActScope(prevActQueue, prevActScopeDepth) {
124135
- prevActScopeDepth !== actScopeDepth - 1 && console.error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
124136
- actScopeDepth = prevActScopeDepth;
124137
- }
124138
- function recursivelyFlushAsyncActWork(returnValue, resolve18, reject) {
124139
- var queue = ReactSharedInternals.actQueue;
124140
- if (queue !== null)
124141
- if (queue.length !== 0)
124142
- try {
124143
- flushActQueue(queue);
124144
- enqueueTask(function() {
124145
- return recursivelyFlushAsyncActWork(returnValue, resolve18, reject);
124146
- });
124147
- return;
124148
- } catch (error48) {
124149
- ReactSharedInternals.thrownErrors.push(error48);
124150
- }
124151
- else
124152
- ReactSharedInternals.actQueue = null;
124153
- 0 < ReactSharedInternals.thrownErrors.length ? (queue = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(queue)) : resolve18(returnValue);
124154
- }
124155
- function flushActQueue(queue) {
124156
- if (!isFlushing) {
124157
- isFlushing = true;
124158
- var i = 0;
124159
- try {
124160
- for (;i < queue.length; i++) {
124161
- var callback = queue[i];
124162
- do {
124163
- ReactSharedInternals.didUsePromise = false;
124164
- var continuation = callback(false);
124165
- if (continuation !== null) {
124166
- if (ReactSharedInternals.didUsePromise) {
124167
- queue[i] = callback;
124168
- queue.splice(0, i);
124169
- return;
124170
- }
124171
- callback = continuation;
124172
- } else
124173
- break;
124174
- } while (1);
124175
- }
124176
- queue.length = 0;
124177
- } catch (error48) {
124178
- queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error48);
124179
- } finally {
124180
- isFlushing = false;
124181
- }
124182
- }
124183
- }
124184
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
124185
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
124186
- isMounted: function() {
124187
- return false;
124188
- },
124189
- enqueueForceUpdate: function(publicInstance) {
124190
- warnNoop(publicInstance, "forceUpdate");
124191
- },
124192
- enqueueReplaceState: function(publicInstance) {
124193
- warnNoop(publicInstance, "replaceState");
124194
- },
124195
- enqueueSetState: function(publicInstance) {
124196
- warnNoop(publicInstance, "setState");
124197
- }
124198
- }, assign = Object.assign, emptyObject2 = {};
124199
- Object.freeze(emptyObject2);
124200
- Component.prototype.isReactComponent = {};
124201
- Component.prototype.setState = function(partialState, callback) {
124202
- if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null)
124203
- throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
124204
- this.updater.enqueueSetState(this, partialState, callback, "setState");
124205
- };
124206
- Component.prototype.forceUpdate = function(callback) {
124207
- this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
124208
- };
124209
- var deprecatedAPIs = {
124210
- isMounted: [
124211
- "isMounted",
124212
- "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
124213
- ],
124214
- replaceState: [
124215
- "replaceState",
124216
- "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
124217
- ]
124218
- };
124219
- for (fnName in deprecatedAPIs)
124220
- deprecatedAPIs.hasOwnProperty(fnName) && defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
124221
- ComponentDummy.prototype = Component.prototype;
124222
- deprecatedAPIs = PureComponent.prototype = new ComponentDummy;
124223
- deprecatedAPIs.constructor = PureComponent;
124224
- assign(deprecatedAPIs, Component.prototype);
124225
- deprecatedAPIs.isPureReactComponent = true;
124226
- var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
124227
- H: null,
124228
- A: null,
124229
- T: null,
124230
- S: null,
124231
- actQueue: null,
124232
- asyncTransitions: 0,
124233
- isBatchingLegacy: false,
124234
- didScheduleLegacyUpdate: false,
124235
- didUsePromise: false,
124236
- thrownErrors: [],
124237
- getCurrentStack: null,
124238
- recentlyCreatedOwnerStacks: 0
124239
- }, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
124240
- return null;
124241
- };
124242
- deprecatedAPIs = {
124243
- react_stack_bottom_frame: function(callStackForError) {
124244
- return callStackForError();
124245
- }
124246
- };
124247
- var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
124248
- var didWarnAboutElementRef = {};
124249
- var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(deprecatedAPIs, UnknownOwner)();
124250
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
124251
- var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = typeof reportError === "function" ? reportError : function(error48) {
124252
- if (typeof window === "object" && typeof window.ErrorEvent === "function") {
124253
- var event = new window.ErrorEvent("error", {
124254
- bubbles: true,
124255
- cancelable: true,
124256
- message: typeof error48 === "object" && error48 !== null && typeof error48.message === "string" ? String(error48.message) : String(error48),
124257
- error: error48
124258
- });
124259
- if (!window.dispatchEvent(event))
124260
- return;
124261
- } else if (typeof process === "object" && typeof process.emit === "function") {
124262
- process.emit("uncaughtException", error48);
124263
- return;
124264
- }
124265
- console.error(error48);
124266
- }, didWarnAboutMessageChannel = false, enqueueTaskImpl = null, actScopeDepth = 0, didWarnNoAwaitAct = false, isFlushing = false, queueSeveralMicrotasks = typeof queueMicrotask === "function" ? function(callback) {
124267
- queueMicrotask(function() {
124268
- return queueMicrotask(callback);
124269
- });
124270
- } : enqueueTask;
124271
- deprecatedAPIs = Object.freeze({
124272
- __proto__: null,
124273
- c: function(size) {
124274
- return resolveDispatcher().useMemoCache(size);
124275
- }
124276
- });
124277
- var fnName = {
124278
- map: mapChildren,
124279
- forEach: function(children, forEachFunc, forEachContext) {
124280
- mapChildren(children, function() {
124281
- forEachFunc.apply(this, arguments);
124282
- }, forEachContext);
124283
- },
124284
- count: function(children) {
124285
- var n = 0;
124286
- mapChildren(children, function() {
124287
- n++;
124288
- });
124289
- return n;
124290
- },
124291
- toArray: function(children) {
124292
- return mapChildren(children, function(child) {
124293
- return child;
124294
- }) || [];
124295
- },
124296
- only: function(children) {
124297
- if (!isValidElement(children))
124298
- throw Error("React.Children.only expected to receive a single React element child.");
124299
- return children;
124300
- }
124301
- };
124302
- exports.Activity = REACT_ACTIVITY_TYPE;
124303
- exports.Children = fnName;
124304
- exports.Component = Component;
124305
- exports.Fragment = REACT_FRAGMENT_TYPE;
124306
- exports.Profiler = REACT_PROFILER_TYPE;
124307
- exports.PureComponent = PureComponent;
124308
- exports.StrictMode = REACT_STRICT_MODE_TYPE;
124309
- exports.Suspense = REACT_SUSPENSE_TYPE;
124310
- exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
124311
- exports.__COMPILER_RUNTIME = deprecatedAPIs;
124312
- exports.act = function(callback) {
124313
- var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
124314
- actScopeDepth++;
124315
- var queue = ReactSharedInternals.actQueue = prevActQueue !== null ? prevActQueue : [], didAwaitActCall = false;
124316
- try {
124317
- var result = callback();
124318
- } catch (error48) {
124319
- ReactSharedInternals.thrownErrors.push(error48);
124320
- }
124321
- if (0 < ReactSharedInternals.thrownErrors.length)
124322
- throw popActScope(prevActQueue, prevActScopeDepth), callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
124323
- if (result !== null && typeof result === "object" && typeof result.then === "function") {
124324
- var thenable = result;
124325
- queueSeveralMicrotasks(function() {
124326
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"));
124327
- });
124328
- return {
124329
- then: function(resolve18, reject) {
124330
- didAwaitActCall = true;
124331
- thenable.then(function(returnValue) {
124332
- popActScope(prevActQueue, prevActScopeDepth);
124333
- if (prevActScopeDepth === 0) {
124334
- try {
124335
- flushActQueue(queue), enqueueTask(function() {
124336
- return recursivelyFlushAsyncActWork(returnValue, resolve18, reject);
124337
- });
124338
- } catch (error$0) {
124339
- ReactSharedInternals.thrownErrors.push(error$0);
124340
- }
124341
- if (0 < ReactSharedInternals.thrownErrors.length) {
124342
- var _thrownError = aggregateErrors(ReactSharedInternals.thrownErrors);
124343
- ReactSharedInternals.thrownErrors.length = 0;
124344
- reject(_thrownError);
124345
- }
124346
- } else
124347
- resolve18(returnValue);
124348
- }, function(error48) {
124349
- popActScope(prevActQueue, prevActScopeDepth);
124350
- 0 < ReactSharedInternals.thrownErrors.length ? (error48 = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, reject(error48)) : reject(error48);
124351
- });
124352
- }
124353
- };
124354
- }
124355
- var returnValue$jscomp$0 = result;
124356
- popActScope(prevActQueue, prevActScopeDepth);
124357
- prevActScopeDepth === 0 && (flushActQueue(queue), queue.length !== 0 && queueSeveralMicrotasks(function() {
124358
- didAwaitActCall || didWarnNoAwaitAct || (didWarnNoAwaitAct = true, console.error("A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"));
124359
- }), ReactSharedInternals.actQueue = null);
124360
- if (0 < ReactSharedInternals.thrownErrors.length)
124361
- throw callback = aggregateErrors(ReactSharedInternals.thrownErrors), ReactSharedInternals.thrownErrors.length = 0, callback;
124362
- return {
124363
- then: function(resolve18, reject) {
124364
- didAwaitActCall = true;
124365
- prevActScopeDepth === 0 ? (ReactSharedInternals.actQueue = queue, enqueueTask(function() {
124366
- return recursivelyFlushAsyncActWork(returnValue$jscomp$0, resolve18, reject);
124367
- })) : resolve18(returnValue$jscomp$0);
124368
- }
124369
- };
124370
- };
124371
- exports.cache = function(fn) {
124372
- return function() {
124373
- return fn.apply(null, arguments);
124374
- };
124375
- };
124376
- exports.cacheSignal = function() {
124377
- return null;
124378
- };
124379
- exports.captureOwnerStack = function() {
124380
- var getCurrentStack = ReactSharedInternals.getCurrentStack;
124381
- return getCurrentStack === null ? null : getCurrentStack();
124382
- };
124383
- exports.cloneElement = function(element, config3, children) {
124384
- if (element === null || element === undefined)
124385
- throw Error("The argument must be a React element, but you passed " + element + ".");
124386
- var props = assign({}, element.props), key = element.key, owner = element._owner;
124387
- if (config3 != null) {
124388
- var JSCompiler_inline_result;
124389
- a: {
124390
- if (hasOwnProperty.call(config3, "ref") && (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(config3, "ref").get) && JSCompiler_inline_result.isReactWarning) {
124391
- JSCompiler_inline_result = false;
124392
- break a;
124393
- }
124394
- JSCompiler_inline_result = config3.ref !== undefined;
124395
- }
124396
- JSCompiler_inline_result && (owner = getOwner());
124397
- hasValidKey(config3) && (checkKeyStringCoercion(config3.key), key = "" + config3.key);
124398
- for (propName in config3)
124399
- !hasOwnProperty.call(config3, propName) || propName === "key" || propName === "__self" || propName === "__source" || propName === "ref" && config3.ref === undefined || (props[propName] = config3[propName]);
124400
- }
124401
- var propName = arguments.length - 2;
124402
- if (propName === 1)
124403
- props.children = children;
124404
- else if (1 < propName) {
124405
- JSCompiler_inline_result = Array(propName);
124406
- for (var i = 0;i < propName; i++)
124407
- JSCompiler_inline_result[i] = arguments[i + 2];
124408
- props.children = JSCompiler_inline_result;
124409
- }
124410
- props = ReactElement(element.type, key, props, owner, element._debugStack, element._debugTask);
124411
- for (key = 2;key < arguments.length; key++)
124412
- validateChildKeys(arguments[key]);
124413
- return props;
124414
- };
124415
- exports.createContext = function(defaultValue) {
124416
- defaultValue = {
124417
- $$typeof: REACT_CONTEXT_TYPE,
124418
- _currentValue: defaultValue,
124419
- _currentValue2: defaultValue,
124420
- _threadCount: 0,
124421
- Provider: null,
124422
- Consumer: null
124423
- };
124424
- defaultValue.Provider = defaultValue;
124425
- defaultValue.Consumer = {
124426
- $$typeof: REACT_CONSUMER_TYPE,
124427
- _context: defaultValue
124428
- };
124429
- defaultValue._currentRenderer = null;
124430
- defaultValue._currentRenderer2 = null;
124431
- return defaultValue;
124432
- };
124433
- exports.createElement = function(type, config3, children) {
124434
- for (var i = 2;i < arguments.length; i++)
124435
- validateChildKeys(arguments[i]);
124436
- i = {};
124437
- var key = null;
124438
- if (config3 != null)
124439
- for (propName in didWarnAboutOldJSXRuntime || !("__self" in config3) || "key" in config3 || (didWarnAboutOldJSXRuntime = true, console.warn("Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform")), hasValidKey(config3) && (checkKeyStringCoercion(config3.key), key = "" + config3.key), config3)
124440
- hasOwnProperty.call(config3, propName) && propName !== "key" && propName !== "__self" && propName !== "__source" && (i[propName] = config3[propName]);
124441
- var childrenLength = arguments.length - 2;
124442
- if (childrenLength === 1)
124443
- i.children = children;
124444
- else if (1 < childrenLength) {
124445
- for (var childArray = Array(childrenLength), _i = 0;_i < childrenLength; _i++)
124446
- childArray[_i] = arguments[_i + 2];
124447
- Object.freeze && Object.freeze(childArray);
124448
- i.children = childArray;
124449
- }
124450
- if (type && type.defaultProps)
124451
- for (propName in childrenLength = type.defaultProps, childrenLength)
124452
- i[propName] === undefined && (i[propName] = childrenLength[propName]);
124453
- key && defineKeyPropWarningGetter(i, typeof type === "function" ? type.displayName || type.name || "Unknown" : type);
124454
- var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
124455
- return ReactElement(type, key, i, getOwner(), propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack, propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
124456
- };
124457
- exports.createRef = function() {
124458
- var refObject = { current: null };
124459
- Object.seal(refObject);
124460
- return refObject;
124461
- };
124462
- exports.forwardRef = function(render) {
124463
- render != null && render.$$typeof === REACT_MEMO_TYPE ? console.error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).") : typeof render !== "function" ? console.error("forwardRef requires a render function but was given %s.", render === null ? "null" : typeof render) : render.length !== 0 && render.length !== 2 && console.error("forwardRef render functions accept exactly two parameters: props and ref. %s", render.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
124464
- render != null && render.defaultProps != null && console.error("forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?");
124465
- var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render }, ownName;
124466
- Object.defineProperty(elementType, "displayName", {
124467
- enumerable: false,
124468
- configurable: true,
124469
- get: function() {
124470
- return ownName;
124471
- },
124472
- set: function(name) {
124473
- ownName = name;
124474
- render.name || render.displayName || (Object.defineProperty(render, "name", { value: name }), render.displayName = name);
124475
- }
124476
- });
124477
- return elementType;
124478
- };
124479
- exports.isValidElement = isValidElement;
124480
- exports.lazy = function(ctor) {
124481
- ctor = { _status: -1, _result: ctor };
124482
- var lazyType2 = {
124483
- $$typeof: REACT_LAZY_TYPE,
124484
- _payload: ctor,
124485
- _init: lazyInitializer
124486
- }, ioInfo = {
124487
- name: "lazy",
124488
- start: -1,
124489
- end: -1,
124490
- value: null,
124491
- owner: null,
124492
- debugStack: Error("react-stack-top-frame"),
124493
- debugTask: console.createTask ? console.createTask("lazy()") : null
124494
- };
124495
- ctor._ioInfo = ioInfo;
124496
- lazyType2._debugInfo = [{ awaited: ioInfo }];
124497
- return lazyType2;
124498
- };
124499
- exports.memo = function(type, compare) {
124500
- type == null && console.error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
124501
- compare = {
124502
- $$typeof: REACT_MEMO_TYPE,
124503
- type,
124504
- compare: compare === undefined ? null : compare
124505
- };
124506
- var ownName;
124507
- Object.defineProperty(compare, "displayName", {
124508
- enumerable: false,
124509
- configurable: true,
124510
- get: function() {
124511
- return ownName;
124512
- },
124513
- set: function(name) {
124514
- ownName = name;
124515
- type.name || type.displayName || (Object.defineProperty(type, "name", { value: name }), type.displayName = name);
124516
- }
124517
- });
124518
- return compare;
124519
- };
124520
- exports.startTransition = function(scope) {
124521
- var prevTransition = ReactSharedInternals.T, currentTransition = {};
124522
- currentTransition._updatedFibers = new Set;
124523
- ReactSharedInternals.T = currentTransition;
124524
- try {
124525
- var returnValue = scope(), onStartTransitionFinish = ReactSharedInternals.S;
124526
- onStartTransitionFinish !== null && onStartTransitionFinish(currentTransition, returnValue);
124527
- typeof returnValue === "object" && returnValue !== null && typeof returnValue.then === "function" && (ReactSharedInternals.asyncTransitions++, returnValue.then(releaseAsyncTransition, releaseAsyncTransition), returnValue.then(noop4, reportGlobalError));
124528
- } catch (error48) {
124529
- reportGlobalError(error48);
124530
- } finally {
124531
- prevTransition === null && currentTransition._updatedFibers && (scope = currentTransition._updatedFibers.size, currentTransition._updatedFibers.clear(), 10 < scope && console.warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.")), prevTransition !== null && currentTransition.types !== null && (prevTransition.types !== null && prevTransition.types !== currentTransition.types && console.error("We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."), prevTransition.types = currentTransition.types), ReactSharedInternals.T = prevTransition;
124532
- }
124533
- };
124534
- exports.unstable_useCacheRefresh = function() {
124535
- return resolveDispatcher().useCacheRefresh();
124536
- };
124537
- exports.use = function(usable) {
124538
- return resolveDispatcher().use(usable);
124539
- };
124540
- exports.useActionState = function(action, initialState, permalink) {
124541
- return resolveDispatcher().useActionState(action, initialState, permalink);
124542
- };
124543
- exports.useCallback = function(callback, deps) {
124544
- return resolveDispatcher().useCallback(callback, deps);
124545
- };
124546
- exports.useContext = function(Context2) {
124547
- var dispatcher = resolveDispatcher();
124548
- Context2.$$typeof === REACT_CONSUMER_TYPE && console.error("Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?");
124549
- return dispatcher.useContext(Context2);
124550
- };
124551
- exports.useDebugValue = function(value, formatterFn) {
124552
- return resolveDispatcher().useDebugValue(value, formatterFn);
124553
- };
124554
- exports.useDeferredValue = function(value, initialValue) {
124555
- return resolveDispatcher().useDeferredValue(value, initialValue);
124556
- };
124557
- exports.useEffect = function(create, deps) {
124558
- create == null && console.warn("React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?");
124559
- return resolveDispatcher().useEffect(create, deps);
124560
- };
124561
- exports.useEffectEvent = function(callback) {
124562
- return resolveDispatcher().useEffectEvent(callback);
124563
- };
124564
- exports.useId = function() {
124565
- return resolveDispatcher().useId();
124566
- };
124567
- exports.useImperativeHandle = function(ref, create, deps) {
124568
- return resolveDispatcher().useImperativeHandle(ref, create, deps);
124569
- };
124570
- exports.useInsertionEffect = function(create, deps) {
124571
- create == null && console.warn("React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?");
124572
- return resolveDispatcher().useInsertionEffect(create, deps);
124573
- };
124574
- exports.useLayoutEffect = function(create, deps) {
124575
- create == null && console.warn("React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?");
124576
- return resolveDispatcher().useLayoutEffect(create, deps);
124577
- };
124578
- exports.useMemo = function(create, deps) {
124579
- return resolveDispatcher().useMemo(create, deps);
124580
- };
124581
- exports.useOptimistic = function(passthrough, reducer) {
124582
- return resolveDispatcher().useOptimistic(passthrough, reducer);
124583
- };
124584
- exports.useReducer = function(reducer, initialArg, init) {
124585
- return resolveDispatcher().useReducer(reducer, initialArg, init);
124586
- };
124587
- exports.useRef = function(initialValue) {
124588
- return resolveDispatcher().useRef(initialValue);
124589
- };
124590
- exports.useState = function(initialState) {
124591
- return resolveDispatcher().useState(initialState);
124592
- };
124593
- exports.useSyncExternalStore = function(subscribe, getSnapshot, getServerSnapshot) {
124594
- return resolveDispatcher().useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
124595
- };
124596
- exports.useTransition = function() {
124597
- return resolveDispatcher().useTransition();
124598
- };
124599
- exports.version = "19.2.4";
124600
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
124601
- })();
124602
- });
124603
-
124604
- // ../../../../node_modules/react/index.js
124605
- var require_react2 = __commonJS((exports, module2) => {
124606
- var react_development = __toESM(require_react_development2());
124607
- if (false) {} else {
124608
- module2.exports = react_development;
124609
- }
124610
- });
124611
-
124612
124605
  // ../../apps/desktop/src/core/monitor/service.ts
124613
124606
  async function loadScoutMonitorSnapshot(input) {
124614
124607
  const channel = input.channel?.trim() || DEFAULT_MONITOR_CHANNEL;
@@ -125409,7 +125402,7 @@ var init_app = __esm(async () => {
125409
125402
  init_user_config();
125410
125403
  init_jsx_dev_runtime();
125411
125404
  await init_react();
125412
- import_react13 = __toESM(require_react2(), 1);
125405
+ import_react13 = __toESM(require_react(), 1);
125413
125406
  C2 = {
125414
125407
  accent: "#34d399",
125415
125408
  dim: "#6b7280",
@@ -125433,14 +125426,14 @@ async function runScoutMonitorApp(options) {
125433
125426
  }
125434
125427
  const renderer = await createCliRenderer();
125435
125428
  let closed = false;
125436
- await new Promise((resolve18) => {
125429
+ await new Promise((resolve19) => {
125437
125430
  const close = () => {
125438
125431
  if (closed) {
125439
125432
  return;
125440
125433
  }
125441
125434
  closed = true;
125442
125435
  renderer.destroy();
125443
- resolve18();
125436
+ resolve19();
125444
125437
  };
125445
125438
  createRoot(renderer).render(/* @__PURE__ */ import_jsx_dev_runtime2.jsxDEV(ScoutMonitorApp, {
125446
125439
  currentDirectory: options.currentDirectory,
@@ -125488,8 +125481,8 @@ var exports_up = {};
125488
125481
  __export(exports_up, {
125489
125482
  runUpCommand: () => runUpCommand
125490
125483
  });
125491
- import { existsSync as existsSync23 } from "fs";
125492
- import { resolve as resolve18 } from "path";
125484
+ import { existsSync as existsSync24 } from "fs";
125485
+ import { resolve as resolve19 } from "path";
125493
125486
  function looksLikePath(value) {
125494
125487
  return value.includes("/") || value.startsWith(".") || value.startsWith("~");
125495
125488
  }
@@ -125551,8 +125544,8 @@ async function runUpCommand(context, args) {
125551
125544
  throw new ScoutCliError("usage: scout up <name|path> [--name <alias>] [--harness <claude|codex>] [--model <model>]");
125552
125545
  }
125553
125546
  let projectPath;
125554
- if (looksLikePath(target) || existsSync23(resolve18(target))) {
125555
- projectPath = resolve18(target);
125547
+ if (looksLikePath(target) || existsSync24(resolve19(target))) {
125548
+ projectPath = resolve19(target);
125556
125549
  } else {
125557
125550
  const resolved = await resolveLocalAgentByName(target);
125558
125551
  if (!resolved) {
@@ -125675,10 +125668,10 @@ var init_whoami = __esm(() => {
125675
125668
  });
125676
125669
 
125677
125670
  // ../../apps/desktop/src/cli/main.ts
125678
- import { existsSync as existsSync25, readFileSync as readFileSync15, writeFileSync as writeFileSync9, statSync as statSync5, mkdirSync as mkdirSync13 } from "fs";
125679
- import { join as join32 } from "path";
125680
- import { spawnSync as spawnSync3 } from "child_process";
125681
- import { homedir as homedir24 } from "os";
125671
+ import { existsSync as existsSync26, readFileSync as readFileSync16, writeFileSync as writeFileSync9, statSync as statSync5, mkdirSync as mkdirSync13 } from "fs";
125672
+ import { join as join33 } from "path";
125673
+ import { spawnSync as spawnSync4 } from "child_process";
125674
+ import { homedir as homedir25 } from "os";
125682
125675
 
125683
125676
  // ../../apps/desktop/src/cli/argv.ts
125684
125677
  function parseScoutArgv(argv) {
@@ -125963,27 +125956,27 @@ var _scoutBinPath = null;
125963
125956
  function getScoutBinPath() {
125964
125957
  if (_scoutBinPath)
125965
125958
  return _scoutBinPath;
125966
- _scoutBinPath = join32(homedir24(), ".bun", "bin", "scout");
125967
- if (!existsSync25(_scoutBinPath)) {
125968
- _scoutBinPath = spawnSync3("which", ["scout"], { encoding: "utf8" }).stdout.trim();
125959
+ _scoutBinPath = join33(homedir25(), ".bun", "bin", "scout");
125960
+ if (!existsSync26(_scoutBinPath)) {
125961
+ _scoutBinPath = spawnSync4("which", ["scout"], { encoding: "utf8" }).stdout.trim();
125969
125962
  }
125970
125963
  return _scoutBinPath;
125971
125964
  }
125972
125965
  async function ensureBrokerUptodate() {
125973
125966
  try {
125974
125967
  const mtime = normalizeCliBinaryMtimeMs(statSync5(getScoutBinPath()).mtimeMs);
125975
- const checkpointDir = join32(homedir24(), ".scout");
125976
- const mtimePath = join32(checkpointDir, "cli-mtime");
125977
- const lastMtime = existsSync25(mtimePath) ? Number(readFileSync15(mtimePath, "utf8").trim()) : 0;
125968
+ const checkpointDir = join33(homedir25(), ".scout");
125969
+ const mtimePath = join33(checkpointDir, "cli-mtime");
125970
+ const lastMtime = existsSync26(mtimePath) ? Number(readFileSync16(mtimePath, "utf8").trim()) : 0;
125978
125971
  if (shouldRestartBrokerForCliMtime(mtime, lastMtime)) {
125979
125972
  const uid = process.getuid();
125980
- const plistPath = join32(homedir24(), "Library", "LaunchAgents", "dev.openscout.broker.plist");
125981
- spawnSync3("launchctl", ["bootout", `gui/${uid}/dev.openscout.broker`], { stdio: "ignore" });
125982
- await new Promise((resolve19) => setTimeout(resolve19, 1500));
125983
- spawnSync3("launchctl", ["bootstrap", `gui/${uid}`, plistPath], { stdio: "ignore" });
125984
- await new Promise((resolve19) => setTimeout(resolve19, 2000));
125973
+ const plistPath = join33(homedir25(), "Library", "LaunchAgents", "dev.openscout.broker.plist");
125974
+ spawnSync4("launchctl", ["bootout", `gui/${uid}/dev.openscout.broker`], { stdio: "ignore" });
125975
+ await new Promise((resolve20) => setTimeout(resolve20, 1500));
125976
+ spawnSync4("launchctl", ["bootstrap", `gui/${uid}`, plistPath], { stdio: "ignore" });
125977
+ await new Promise((resolve20) => setTimeout(resolve20, 2000));
125985
125978
  }
125986
- if (!existsSync25(checkpointDir)) {
125979
+ if (!existsSync26(checkpointDir)) {
125987
125980
  mkdirSync13(checkpointDir, { recursive: true });
125988
125981
  }
125989
125982
  writeFileSync9(mtimePath, String(mtime), { encoding: "utf8", flag: "w" });