@factory/droid-sdk 0.9.0 → 0.9.1

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.
@@ -1465,6 +1465,7 @@ var ToolConfirmationOutcome = /* @__PURE__ */ ((ToolConfirmationOutcome2) => {
1465
1465
  ToolConfirmationOutcome2["ProceedEdit"] = "proceed_edit";
1466
1466
  ToolConfirmationOutcome2["ProceedAlwaysTools"] = "proceed_always_tools";
1467
1467
  ToolConfirmationOutcome2["ProceedAlwaysServer"] = "proceed_always_server";
1468
+ ToolConfirmationOutcome2["ProceedReportFalsePositive"] = "proceed_report_false_positive";
1468
1469
  ToolConfirmationOutcome2["Cancel"] = "cancel";
1469
1470
  return ToolConfirmationOutcome2;
1470
1471
  })(ToolConfirmationOutcome || {});
@@ -1573,6 +1574,7 @@ var SessionNotificationType = /* @__PURE__ */ ((SessionNotificationType2) => {
1573
1574
  SessionNotificationType2["MCP_STATUS_CHANGED"] = "mcp_status_changed";
1574
1575
  SessionNotificationType2["ASSISTANT_TEXT_DELTA"] = "assistant_text_delta";
1575
1576
  SessionNotificationType2["ASSISTANT_TEXT_COMPLETE"] = "assistant_text_complete";
1577
+ SessionNotificationType2["ASSISTANT_MESSAGE_RETRACTED"] = "assistant_message_retracted";
1576
1578
  SessionNotificationType2["STRUCTURED_OUTPUT"] = "structured_output";
1577
1579
  SessionNotificationType2["THINKING_TEXT_DELTA"] = "thinking_text_delta";
1578
1580
  SessionNotificationType2["THINKING_TEXT_COMPLETE"] = "thinking_text_complete";
@@ -1627,6 +1629,7 @@ var AgentTurnCompletionReason = /* @__PURE__ */ ((AgentTurnCompletionReason3) =>
1627
1629
  AgentTurnCompletionReason3["ModelRequestRejected"] = "model_request_rejected";
1628
1630
  AgentTurnCompletionReason3["ModelProviderUnreachable"] = "model_provider_unreachable";
1629
1631
  AgentTurnCompletionReason3["ModelProviderUnavailable"] = "model_provider_unavailable";
1632
+ AgentTurnCompletionReason3["ModelRateLimited"] = "model_rate_limited";
1630
1633
  AgentTurnCompletionReason3["PromptRejected"] = "prompt_rejected";
1631
1634
  AgentTurnCompletionReason3["CompletionPersistenceFailed"] = "completion_persistence_failed";
1632
1635
  AgentTurnCompletionReason3["NoApproverAvailable"] = "no_approver_available";
@@ -1872,6 +1875,7 @@ var ModelID = /* @__PURE__ */ ((ModelID2) => {
1872
1875
  ModelID2["CLAUDE_OPUS_5_FAST"] = "claude-opus-5-fast";
1873
1876
  ModelID2["CLAUDE_SONNET_5"] = "claude-sonnet-5";
1874
1877
  ModelID2["CLAUDE_FABLE_5"] = "claude-fable-5";
1878
+ ModelID2["CLAUDE_FABLE_5_1"] = "claude-fable-5.1";
1875
1879
  ModelID2["ATLAS_0721"] = "atlas-07-21";
1876
1880
  ModelID2["ASTER_0715"] = "aster-07-15";
1877
1881
  ModelID2["GPT_5"] = "gpt-5-2025-08-07";
@@ -1896,6 +1900,7 @@ var ModelID = /* @__PURE__ */ ((ModelID2) => {
1896
1900
  ModelID2["GPT_5_6_SOL_FAST"] = "gpt-5.6-sol-fast";
1897
1901
  ModelID2["GPT_5_6_TERRA"] = "gpt-5.6-terra";
1898
1902
  ModelID2["GPT_5_6_LUNA"] = "gpt-5.6-luna";
1903
+ ModelID2["GPT_6_ASTRA"] = "gpt-6-astra";
1899
1904
  ModelID2["GPT_IMAGE_2"] = "gpt-image-2";
1900
1905
  ModelID2["GPT_TRANSCRIBE"] = "gpt-transcribe";
1901
1906
  ModelID2["GPT_4O_MINI_TRANSCRIBE"] = "gpt-4o-mini-transcribe";
@@ -1907,6 +1912,7 @@ var ModelID = /* @__PURE__ */ ((ModelID2) => {
1907
1912
  ModelID2["GEMINI_3_5_FLASH"] = "gemini-3.5-flash";
1908
1913
  ModelID2["GEMINI_3_6_FLASH"] = "gemini-3.6-flash";
1909
1914
  ModelID2["GEMINI_3_7_FLASH"] = "gemini-3.7-flash";
1915
+ ModelID2["GEMINI_3_8_FLASH"] = "gemini-3.8-flash";
1910
1916
  ModelID2["GEMINI_3_PRO_IMAGE"] = "gemini-3-pro-image-preview";
1911
1917
  ModelID2["GARNET_0715"] = "garnet-07-15";
1912
1918
  ModelID2["GROK_4_5"] = "grok-4.5";
@@ -2288,6 +2294,9 @@ var ToolUseSchema = _zod2.default.object({
2288
2294
  name: _zod2.default.string(),
2289
2295
  thoughtSignature: _zod2.default.string().optional(),
2290
2296
  // Gemini thought signature
2297
+ // OpenAI Responses function_call.namespace (native client tool search).
2298
+ // Provider-emitted and replayed verbatim; never synthesized.
2299
+ namespace: _zod2.default.string().optional(),
2291
2300
  scriptExecution: _zod2.default.object({
2292
2301
  runId: _zod2.default.string(),
2293
2302
  outerToolUseId: _zod2.default.string()
@@ -3135,6 +3144,10 @@ var AssistantTextCompleteNotificationSchema = _zod2.default.object({
3135
3144
  messageId: _zod2.default.string(),
3136
3145
  blockIndex: _zod2.default.number()
3137
3146
  });
3147
+ var AssistantMessageRetractedNotificationSchema = _zod2.default.object({
3148
+ type: _zod2.default.literal("assistant_message_retracted" /* ASSISTANT_MESSAGE_RETRACTED */),
3149
+ messageId: _zod2.default.string()
3150
+ });
3138
3151
  var StructuredOutputNotificationSchema = _zod2.default.object({
3139
3152
  type: _zod2.default.literal("structured_output" /* STRUCTURED_OUTPUT */),
3140
3153
  messageId: _zod2.default.string(),
@@ -3342,7 +3355,8 @@ var SessionNotificationSchemaList = [
3342
3355
  // N[] aliases in schemas/sdk-local.ts keep their canonical indices.
3343
3356
  SessionWorkingDirectoryChangedNotificationSchema,
3344
3357
  LlmRetryNotificationSchema,
3345
- ToolExecutionPhaseChangedNotificationSchema
3358
+ ToolExecutionPhaseChangedNotificationSchema,
3359
+ AssistantMessageRetractedNotificationSchema
3346
3360
  ];
3347
3361
  var SessionNotificationParamsSchema = _zod2.default.object({
3348
3362
  sessionId: _zod2.default.string().optional(),
@@ -3891,9 +3905,10 @@ var InitializeSessionRequestParamsSchema = _zod2.default.object({
3891
3905
  */
3892
3906
  worktree: _zod2.default.boolean().optional(),
3893
3907
  /**
3894
- * Optional override for the worktrees root this session's checkout is
3895
- * created under. Falls back to the user's `worktreeDirectory` setting
3896
- * (or that setting's default root) when omitted.
3908
+ * @deprecated Ignored once Desktop worktrees are on: the checkout is
3909
+ * created under the single root the user's `worktreeDirectory` setting
3910
+ * names, so that only one root's worktrees have their lifecycle managed.
3911
+ * Kept for wire compatibility with clients that still send it.
3897
3912
  */
3898
3913
  worktreeDir: _zod2.default.string().optional(),
3899
3914
  /**
@@ -5428,289 +5443,6 @@ var DaemonCronStateChangedNotificationSchema = JsonRpcBaseNotificationSchema.ext
5428
5443
  // ../droid-sdk-core/src/protocol/daemon/schemas/droid.ts
5429
5444
 
5430
5445
 
5431
- // ../droid-sdk-core/src/protocol/droid/constants.ts
5432
- var seconds = (value) => value * 1e3;
5433
- var minutes = (value) => seconds(value * 60);
5434
- var hours = (value) => minutes(value * 60);
5435
- var LOOP_INTERVAL_POLICY = {
5436
- minMs: minutes(1),
5437
- maxMs: hours(24),
5438
- displayRange: "1m\u201324h",
5439
- examples: "5m, 30m, 2h"
5440
- };
5441
- var SYSTEM_REMINDER_START = "<system-reminder>";
5442
- var SYSTEM_REMINDER_END = "</system-reminder>";
5443
- var SYSTEM_NOTIFICATION_START = "<system-notification>";
5444
- var SYSTEM_NOTIFICATION_END = "</system-notification>";
5445
- var DROID_RUNNING_STATES = [
5446
- "thinking" /* Thinking */,
5447
- "streaming_assistant_message" /* StreamingAssistantMessage */,
5448
- "executing_tool" /* ExecutingTool */,
5449
- "compacting_conversation" /* CompactingConversation */
5450
- ];
5451
- var DROID_IN_PROGRESS_STATES = [
5452
- ...DROID_RUNNING_STATES,
5453
- "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */
5454
- ];
5455
-
5456
- // ../droid-sdk-core/src/protocol/droid/tool-execution-lifecycle.ts
5457
- function getToolExecutionLifecyclePhaseRank(phase) {
5458
- switch (phase) {
5459
- case "streaming_input" /* StreamingInput */:
5460
- return 0;
5461
- case "queued" /* Queued */:
5462
- return 1;
5463
- case "executing" /* Executing */:
5464
- return 2;
5465
- case "settled_after_execution" /* SettledAfterExecution */:
5466
- case "settled_without_execution" /* SettledWithoutExecution */:
5467
- case "settled_unknown" /* SettledUnknown */:
5468
- return 3;
5469
- }
5470
- }
5471
- function mergeToolExecutionLifecyclePhase(current, next) {
5472
- if (!current) return next;
5473
- if (!next) return current;
5474
- return getToolExecutionLifecyclePhaseRank(next) > getToolExecutionLifecyclePhaseRank(current) ? next : current;
5475
- }
5476
- function settleToolExecutionLifecyclePhase(phase) {
5477
- if (phase === "settled_after_execution" /* SettledAfterExecution */ || phase === "settled_without_execution" /* SettledWithoutExecution */ || phase === "settled_unknown" /* SettledUnknown */) {
5478
- return phase;
5479
- }
5480
- if (phase === "executing" /* Executing */) {
5481
- return "settled_after_execution" /* SettledAfterExecution */;
5482
- }
5483
- if (phase === "streaming_input" /* StreamingInput */ || phase === "queued" /* Queued */) {
5484
- return "settled_without_execution" /* SettledWithoutExecution */;
5485
- }
5486
- return "settled_unknown" /* SettledUnknown */;
5487
- }
5488
-
5489
- // ../droid-sdk-core/src/protocol/droid/schemas/constants.ts
5490
- var FACTORY_PROTOCOL_VERSION = "1.193.0";
5491
- var FACTORY_CLIENT_HEADER = "X-Factory-Client";
5492
- var FACTORY_SDK_HEADER = "X-Factory-Sdk";
5493
- var FACTORY_CLIENT_VERSION = "X-Client-Version";
5494
- var LEGACY_FACTORY_API_VERSION2 = LEGACY_FACTORY_API_VERSION;
5495
- var JSONRPC_VERSION2 = JSONRPC_VERSION;
5496
-
5497
- // ../droid-sdk-core/src/protocol/droid/schemas/automations.ts
5498
-
5499
- var ExecutionLocationSchema = _zod2.default.enum(["local", "remote"]);
5500
- var AutomationStatusSchema = _zod2.default.enum(["active", "paused"]);
5501
- var AutomationIdSchema = _zod2.default.string().trim().min(1);
5502
- var PromptSchema = _zod2.default.string().trim().min(1);
5503
- function requireField(ctx, field, message) {
5504
- ctx.addIssue({ code: _zod2.default.ZodIssueCode.custom, path: [field], message });
5505
- }
5506
- var AutomationCreateToolInputSchema = _zod2.default.object({
5507
- executionLocation: ExecutionLocationSchema.describe(
5508
- 'Where the automation runs: "local" creates a local filesystem automation on this machine; "remote" creates a cloud automation that runs on a droid computer.'
5509
- ),
5510
- name: _zod2.default.string().trim().min(1).max(128).describe("Display name for the automation."),
5511
- schedule: _zod2.default.string().trim().min(1).describe(
5512
- "A 5-field cron expression for local automations, or a 5-field cron expression/natural-language cadence for remote automations."
5513
- ),
5514
- prompt: PromptSchema.describe(
5515
- "Agent instructions to run on each scheduled tick."
5516
- ),
5517
- status: AutomationStatusSchema.optional().default("active").describe(
5518
- 'Initial status. Use "paused" when creating an automation for a draft Software Factory workstream.'
5519
- ),
5520
- description: _zod2.default.string().trim().max(1024).optional().describe("Optional description."),
5521
- visualization_instruction: _zod2.default.string().trim().min(1).optional().describe(
5522
- 'Optional visualization guidance, folded into the run prompt as a "## Visualization" section.'
5523
- ),
5524
- memory_instruction: _zod2.default.string().trim().min(1).optional().describe(
5525
- 'Optional memory guidance, folded into the run prompt as a "## Memory & Evolution" section.'
5526
- ),
5527
- computerId: _zod2.default.string().trim().min(1).optional().describe(
5528
- "ID of the droid computer the automation runs on. Remote automations require computerId or computerName."
5529
- ),
5530
- computerName: _zod2.default.string().trim().min(1).optional().describe(
5531
- "Name of the droid computer the automation runs on, resolved to its ID at creation time (use ListComputers to see available names). Remote automations require computerId or computerName; if the name matches multiple computers, ask the user which one to use and retry with its computerId."
5532
- ),
5533
- executionTemplateId: _zod2.default.string().trim().min(1).optional().describe(
5534
- "ID of the Execution Template used to provision a fresh Computer for every remote automation run."
5535
- ),
5536
- workstreamId: _zod2.default.string().trim().min(1).max(128).optional().describe(
5537
- "Optional Software Factory workstream id. Set this when the automation is created as part of a workstream so it stays linked to that workstream."
5538
- ),
5539
- tags: _zod2.default.array(_zod2.default.string().trim().min(1).max(128)).max(16).optional().describe(
5540
- 'Optional tags stored on the remote automation, used for grouping and lifecycle linkage (e.g. "sf-workstream:<id>" ties the automation to a Software Factory workstream so workstream deletion removes it). Remote automations only.'
5541
- )
5542
- }).superRefine((data, ctx) => {
5543
- const remoteTargets = [
5544
- data.computerId,
5545
- data.computerName,
5546
- data.executionTemplateId
5547
- ].filter((target) => target !== void 0);
5548
- if (data.executionLocation === "remote" && remoteTargets.length === 0) {
5549
- requireField(
5550
- ctx,
5551
- "computerId",
5552
- 'computerId, computerName, or executionTemplateId is required when executionLocation is "remote".'
5553
- );
5554
- }
5555
- if (remoteTargets.length > 1) {
5556
- requireField(
5557
- ctx,
5558
- data.executionTemplateId ? "executionTemplateId" : "computerName",
5559
- "Provide exactly one of computerId, computerName, or executionTemplateId."
5560
- );
5561
- }
5562
- if (data.executionLocation === "local" && data.computerId) {
5563
- requireField(
5564
- ctx,
5565
- "computerId",
5566
- 'computerId is only supported when executionLocation is "remote".'
5567
- );
5568
- }
5569
- if (data.executionLocation === "local" && data.computerName) {
5570
- requireField(
5571
- ctx,
5572
- "computerName",
5573
- 'computerName is only supported when executionLocation is "remote".'
5574
- );
5575
- }
5576
- if (data.executionLocation === "local" && data.executionTemplateId) {
5577
- requireField(
5578
- ctx,
5579
- "executionTemplateId",
5580
- 'executionTemplateId is only supported when executionLocation is "remote".'
5581
- );
5582
- }
5583
- if (data.executionLocation === "local" && data.tags) {
5584
- requireField(
5585
- ctx,
5586
- "tags",
5587
- 'tags are only supported when executionLocation is "remote".'
5588
- );
5589
- }
5590
- });
5591
- var AutomationListToolInputSchema = _zod2.default.object({
5592
- executionLocation: ExecutionLocationSchema.describe(
5593
- 'Where to list automations from: "local" for this machine or "remote" for cloud automations.'
5594
- )
5595
- });
5596
- var AutomationReadToolInputSchema = _zod2.default.object({
5597
- executionLocation: ExecutionLocationSchema.describe(
5598
- 'Where to read the automation from: "local" for this machine or "remote" for cloud automations.'
5599
- ),
5600
- automationId: AutomationIdSchema.describe("Automation id.")
5601
- });
5602
- var AutomationDeleteToolInputSchema = _zod2.default.object({
5603
- executionLocation: ExecutionLocationSchema.describe(
5604
- 'Where to delete the automation from: "local" for this machine or "remote" for cloud automations.'
5605
- ),
5606
- automationId: AutomationIdSchema.describe("Automation id.")
5607
- });
5608
- var AutomationEditToolInputSchema = _zod2.default.object({
5609
- executionLocation: ExecutionLocationSchema.describe(
5610
- 'Where to edit the automation: "local" for this machine or "remote" for cloud automations.'
5611
- ),
5612
- automationId: AutomationIdSchema.describe("Automation id."),
5613
- name: _zod2.default.string().trim().min(1).max(128).optional().describe("New display name."),
5614
- description: _zod2.default.string().trim().max(1024).optional().describe("New description."),
5615
- schedule: _zod2.default.string().trim().min(1).optional().describe("New cron expression or natural-language cadence."),
5616
- prompt: PromptSchema.optional().describe("New agent instructions."),
5617
- status: AutomationStatusSchema.optional().describe(
5618
- 'New status: "active" or "paused".'
5619
- ),
5620
- computerId: _zod2.default.string().trim().min(1).optional().describe("Move a remote automation to a different computer.")
5621
- }).superRefine((data, ctx) => {
5622
- const hasAnyUpdate = data.name !== void 0 || data.description !== void 0 || data.schedule !== void 0 || data.prompt !== void 0 || data.status !== void 0 || data.computerId !== void 0;
5623
- if (!hasAnyUpdate) {
5624
- ctx.addIssue({
5625
- code: _zod2.default.ZodIssueCode.custom,
5626
- message: "Provide at least one field to update."
5627
- });
5628
- }
5629
- if (data.executionLocation === "local") {
5630
- if (data.description !== void 0) {
5631
- requireField(
5632
- ctx,
5633
- "description",
5634
- 'description is only supported when executionLocation is "remote".'
5635
- );
5636
- }
5637
- if (data.schedule !== void 0) {
5638
- requireField(
5639
- ctx,
5640
- "schedule",
5641
- 'schedule edits are only supported when executionLocation is "remote".'
5642
- );
5643
- }
5644
- if (data.computerId !== void 0) {
5645
- requireField(
5646
- ctx,
5647
- "computerId",
5648
- 'computerId is only supported when executionLocation is "remote".'
5649
- );
5650
- }
5651
- }
5652
- });
5653
-
5654
- // ../droid-sdk-core/src/protocol/droid/schemas/loop-tool.ts
5655
-
5656
- var CronExpressionSchema = _zod2.default.string().trim().regex(/^(\S+\s+){4}\S+$/, "Expected a standard 5-field cron expression");
5657
- var LoopToolInputSchema = _zod2.default.object({
5658
- action: _zod2.default.enum(["create", "list", "cancel"]).describe("Operation to perform: create, list, or cancel."),
5659
- prompt: _zod2.default.string().trim().min(1).optional().describe('Recurring prompt. Required when action is "create".'),
5660
- cron: CronExpressionSchema.optional().describe(
5661
- "5-field cron expression in UTC. Pure step cadences are anchored to loop creation."
5662
- ),
5663
- loopId: _zod2.default.string().trim().min(1).optional().describe(
5664
- 'Loop ID returned by the "list" action. Required when action is "cancel".'
5665
- ),
5666
- runImmediately: _zod2.default.boolean().optional().describe(
5667
- 'Also fire once on creation. Defaults to true; only valid for action "create".'
5668
- )
5669
- }).superRefine((data, ctx) => {
5670
- const addRequiredIssue = (field) => {
5671
- ctx.addIssue({
5672
- code: _zod2.default.ZodIssueCode.custom,
5673
- path: [field],
5674
- message: `"${field}" is required when action is "${data.action}".`
5675
- });
5676
- };
5677
- const rejectField = (field) => {
5678
- if (data[field] === void 0) return;
5679
- ctx.addIssue({
5680
- code: _zod2.default.ZodIssueCode.custom,
5681
- path: [field],
5682
- message: `"${field}" is not valid when action is "${data.action}".`
5683
- });
5684
- };
5685
- switch (data.action) {
5686
- case "create":
5687
- if (data.prompt === void 0) addRequiredIssue("prompt");
5688
- if (data.cron === void 0) addRequiredIssue("cron");
5689
- rejectField("loopId");
5690
- break;
5691
- case "list":
5692
- rejectField("prompt");
5693
- rejectField("cron");
5694
- rejectField("loopId");
5695
- rejectField("runImmediately");
5696
- break;
5697
- case "cancel":
5698
- if (data.loopId === void 0) addRequiredIssue("loopId");
5699
- rejectField("prompt");
5700
- rejectField("cron");
5701
- rejectField("runImmediately");
5702
- break;
5703
- default:
5704
- break;
5705
- }
5706
- });
5707
-
5708
- // ../droid-sdk-core/src/protocol/session/tags/constants.ts
5709
- var SESSION_TAG_SUBAGENT = "subagent";
5710
-
5711
- // ../droid-sdk-core/src/protocol/sessionV2/constants.ts
5712
- var TOOL_RESULT_PENDING_MARKER = "__TOOL_RESULT_PENDING__";
5713
-
5714
5446
  // ../droid-sdk-core/src/protocol/daemon/schemas/automations.ts
5715
5447
 
5716
5448
  var AutomationTemplateId = /* @__PURE__ */ ((AutomationTemplateId2) => {
@@ -6223,29 +5955,327 @@ var DaemonUpdateAutomationRequestSchema = JsonRpcBaseRequestSchema.extend({
6223
5955
  method: _zod2.default.literal("daemon.update_automation" /* UPDATE_AUTOMATION */),
6224
5956
  params: DaemonUpdateAutomationRequestParamsSchema
6225
5957
  });
6226
- var DaemonUpdateAutomationResultSchema = _zod2.default.object({
6227
- success: _zod2.default.boolean(),
6228
- error: _zod2.default.string().optional()
5958
+ var DaemonUpdateAutomationResultSchema = _zod2.default.object({
5959
+ success: _zod2.default.boolean(),
5960
+ error: _zod2.default.string().optional()
5961
+ });
5962
+
5963
+ // ../droid-sdk-core/src/protocol/daemon/schemas/bug-report.ts
5964
+
5965
+ var DaemonSubmitBugReportRequestParamsSchema = _zod2.default.object({
5966
+ sessionId: _zod2.default.string(),
5967
+ userComment: _zod2.default.string(),
5968
+ clientLogs: _zod2.default.string().optional(),
5969
+ source: BugReportSourceSchema.optional()
5970
+ });
5971
+ var DaemonSubmitBugReportRequestSchema = JsonRpcBaseRequestSchema.extend({
5972
+ method: _zod2.default.literal("daemon.submit_bug_report" /* SUBMIT_BUG_REPORT */),
5973
+ params: DaemonSubmitBugReportRequestParamsSchema
5974
+ });
5975
+ var DaemonSubmitBugReportResultSchema = _zod2.default.object({
5976
+ bugReportId: _zod2.default.string()
5977
+ });
5978
+
5979
+ // ../droid-sdk-core/src/protocol/daemon/schemas/commands.ts
5980
+
5981
+
5982
+ // ../droid-sdk-core/src/protocol/droid/constants.ts
5983
+ var seconds = (value) => value * 1e3;
5984
+ var minutes = (value) => seconds(value * 60);
5985
+ var hours = (value) => minutes(value * 60);
5986
+ var LOOP_INTERVAL_POLICY = {
5987
+ minMs: minutes(1),
5988
+ maxMs: hours(24),
5989
+ displayRange: "1m\u201324h",
5990
+ examples: "5m, 30m, 2h"
5991
+ };
5992
+ var SYSTEM_REMINDER_START = "<system-reminder>";
5993
+ var SYSTEM_REMINDER_END = "</system-reminder>";
5994
+ var SYSTEM_NOTIFICATION_START = "<system-notification>";
5995
+ var SYSTEM_NOTIFICATION_END = "</system-notification>";
5996
+ var DROID_RUNNING_STATES = [
5997
+ "thinking" /* Thinking */,
5998
+ "streaming_assistant_message" /* StreamingAssistantMessage */,
5999
+ "executing_tool" /* ExecutingTool */,
6000
+ "compacting_conversation" /* CompactingConversation */
6001
+ ];
6002
+ var DROID_IN_PROGRESS_STATES = [
6003
+ ...DROID_RUNNING_STATES,
6004
+ "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */
6005
+ ];
6006
+
6007
+ // ../droid-sdk-core/src/protocol/droid/tool-execution-lifecycle.ts
6008
+ function getToolExecutionLifecyclePhaseRank(phase) {
6009
+ switch (phase) {
6010
+ case "streaming_input" /* StreamingInput */:
6011
+ return 0;
6012
+ case "queued" /* Queued */:
6013
+ return 1;
6014
+ case "executing" /* Executing */:
6015
+ return 2;
6016
+ case "settled_after_execution" /* SettledAfterExecution */:
6017
+ case "settled_without_execution" /* SettledWithoutExecution */:
6018
+ case "settled_unknown" /* SettledUnknown */:
6019
+ return 3;
6020
+ }
6021
+ }
6022
+ function mergeToolExecutionLifecyclePhase(current, next) {
6023
+ if (!current) return next;
6024
+ if (!next) return current;
6025
+ return getToolExecutionLifecyclePhaseRank(next) > getToolExecutionLifecyclePhaseRank(current) ? next : current;
6026
+ }
6027
+ function settleToolExecutionLifecyclePhase(phase) {
6028
+ if (phase === "settled_after_execution" /* SettledAfterExecution */ || phase === "settled_without_execution" /* SettledWithoutExecution */ || phase === "settled_unknown" /* SettledUnknown */) {
6029
+ return phase;
6030
+ }
6031
+ if (phase === "executing" /* Executing */) {
6032
+ return "settled_after_execution" /* SettledAfterExecution */;
6033
+ }
6034
+ if (phase === "streaming_input" /* StreamingInput */ || phase === "queued" /* Queued */) {
6035
+ return "settled_without_execution" /* SettledWithoutExecution */;
6036
+ }
6037
+ return "settled_unknown" /* SettledUnknown */;
6038
+ }
6039
+
6040
+ // ../droid-sdk-core/src/protocol/droid/schemas/constants.ts
6041
+ var FACTORY_PROTOCOL_VERSION = "1.201.1";
6042
+ var FACTORY_CLIENT_HEADER = "X-Factory-Client";
6043
+ var FACTORY_SDK_HEADER = "X-Factory-Sdk";
6044
+ var FACTORY_CLIENT_VERSION = "X-Client-Version";
6045
+ var LEGACY_FACTORY_API_VERSION2 = LEGACY_FACTORY_API_VERSION;
6046
+ var JSONRPC_VERSION2 = JSONRPC_VERSION;
6047
+
6048
+ // ../droid-sdk-core/src/protocol/droid/schemas/automations.ts
6049
+
6050
+ var ExecutionLocationSchema = _zod2.default.enum(["local", "remote"]);
6051
+ var AutomationStatusSchema = _zod2.default.enum(["active", "paused"]);
6052
+ var AutomationIdSchema = _zod2.default.string().trim().min(1);
6053
+ var PromptSchema = _zod2.default.string().trim().min(1);
6054
+ function requireField(ctx, field, message) {
6055
+ ctx.addIssue({ code: _zod2.default.ZodIssueCode.custom, path: [field], message });
6056
+ }
6057
+ var AutomationCreateToolInputSchema = _zod2.default.object({
6058
+ executionLocation: ExecutionLocationSchema.describe(
6059
+ 'Where the automation runs: "local" creates a local filesystem automation on this machine; "remote" creates a cloud automation that runs on a droid computer.'
6060
+ ),
6061
+ name: _zod2.default.string().trim().min(1).max(128).describe("Display name for the automation."),
6062
+ schedule: _zod2.default.string().trim().min(1).describe(
6063
+ "A 5-field cron expression for local automations, or a 5-field cron expression/natural-language cadence for remote automations."
6064
+ ),
6065
+ prompt: PromptSchema.describe(
6066
+ "Agent instructions to run on each scheduled tick."
6067
+ ),
6068
+ model: _zod2.default.string().trim().min(1).optional().describe(
6069
+ 'Optional model for run sessions. Accepts a model id, a model display name, or "cheapest" to pin the lowest-cost available model (good for mechanical scheduled work). Names are resolved against the live model catalog; an unrecognized name fails with the available models listed. Omit to use the default model. A pin the run target cannot resolve falls back to the default at run time.'
6070
+ ),
6071
+ reasoningEffort: _zod2.default.string().trim().min(1).optional().describe(
6072
+ 'Optional reasoning effort for run sessions (e.g. "low", "medium", "high"). Unsupported values are clamped to the model default at run time. Omit to use the model default.'
6073
+ ),
6074
+ status: AutomationStatusSchema.optional().default("active").describe(
6075
+ 'Initial status. Use "paused" when creating an automation for a draft Software Factory workstream.'
6076
+ ),
6077
+ description: _zod2.default.string().trim().max(1024).optional().describe("Optional description."),
6078
+ visualization_instruction: _zod2.default.string().trim().min(1).optional().describe(
6079
+ 'Optional visualization guidance, folded into the run prompt as a "## Visualization" section.'
6080
+ ),
6081
+ memory_instruction: _zod2.default.string().trim().min(1).optional().describe(
6082
+ 'Optional memory guidance, folded into the run prompt as a "## Memory & Evolution" section.'
6083
+ ),
6084
+ computerId: _zod2.default.string().trim().min(1).optional().describe(
6085
+ "ID of the droid computer the automation runs on. Remote automations require computerId or computerName."
6086
+ ),
6087
+ computerName: _zod2.default.string().trim().min(1).optional().describe(
6088
+ "Name of the droid computer the automation runs on, resolved to its ID at creation time (use ListComputers to see available names). Remote automations require computerId or computerName; if the name matches multiple computers, ask the user which one to use and retry with its computerId."
6089
+ ),
6090
+ executionTemplateId: _zod2.default.string().trim().min(1).optional().describe(
6091
+ "ID of the Execution Template used to provision a fresh Computer for every remote automation run."
6092
+ ),
6093
+ workstreamId: _zod2.default.string().trim().min(1).max(128).optional().describe(
6094
+ "Optional Software Factory workstream id. Set this when the automation is created as part of a workstream so it stays linked to that workstream."
6095
+ ),
6096
+ tags: _zod2.default.array(_zod2.default.string().trim().min(1).max(128)).max(16).optional().describe(
6097
+ 'Optional tags stored on the remote automation, used for grouping and lifecycle linkage (e.g. "sf-workstream:<id>" ties the automation to a Software Factory workstream so workstream deletion removes it). Remote automations only.'
6098
+ )
6099
+ }).superRefine((data, ctx) => {
6100
+ const remoteTargets = [
6101
+ data.computerId,
6102
+ data.computerName,
6103
+ data.executionTemplateId
6104
+ ].filter((target) => target !== void 0);
6105
+ if (data.executionLocation === "remote" && remoteTargets.length === 0) {
6106
+ requireField(
6107
+ ctx,
6108
+ "computerId",
6109
+ 'computerId, computerName, or executionTemplateId is required when executionLocation is "remote".'
6110
+ );
6111
+ }
6112
+ if (remoteTargets.length > 1) {
6113
+ requireField(
6114
+ ctx,
6115
+ data.executionTemplateId ? "executionTemplateId" : "computerName",
6116
+ "Provide exactly one of computerId, computerName, or executionTemplateId."
6117
+ );
6118
+ }
6119
+ if (data.executionLocation === "local" && data.computerId) {
6120
+ requireField(
6121
+ ctx,
6122
+ "computerId",
6123
+ 'computerId is only supported when executionLocation is "remote".'
6124
+ );
6125
+ }
6126
+ if (data.executionLocation === "local" && data.computerName) {
6127
+ requireField(
6128
+ ctx,
6129
+ "computerName",
6130
+ 'computerName is only supported when executionLocation is "remote".'
6131
+ );
6132
+ }
6133
+ if (data.executionLocation === "local" && data.executionTemplateId) {
6134
+ requireField(
6135
+ ctx,
6136
+ "executionTemplateId",
6137
+ 'executionTemplateId is only supported when executionLocation is "remote".'
6138
+ );
6139
+ }
6140
+ if (data.executionLocation === "local" && data.tags) {
6141
+ requireField(
6142
+ ctx,
6143
+ "tags",
6144
+ 'tags are only supported when executionLocation is "remote".'
6145
+ );
6146
+ }
6147
+ });
6148
+ var AutomationListToolInputSchema = _zod2.default.object({
6149
+ executionLocation: ExecutionLocationSchema.describe(
6150
+ 'Where to list automations from: "local" for this machine or "remote" for cloud automations.'
6151
+ )
6152
+ });
6153
+ var AutomationReadToolInputSchema = _zod2.default.object({
6154
+ executionLocation: ExecutionLocationSchema.describe(
6155
+ 'Where to read the automation from: "local" for this machine or "remote" for cloud automations.'
6156
+ ),
6157
+ automationId: AutomationIdSchema.describe("Automation id.")
6158
+ });
6159
+ var AutomationDeleteToolInputSchema = _zod2.default.object({
6160
+ executionLocation: ExecutionLocationSchema.describe(
6161
+ 'Where to delete the automation from: "local" for this machine or "remote" for cloud automations.'
6162
+ ),
6163
+ automationId: AutomationIdSchema.describe("Automation id.")
6164
+ });
6165
+ var AutomationEditToolInputSchema = _zod2.default.object({
6166
+ executionLocation: ExecutionLocationSchema.describe(
6167
+ 'Where to edit the automation: "local" for this machine or "remote" for cloud automations.'
6168
+ ),
6169
+ automationId: AutomationIdSchema.describe("Automation id."),
6170
+ name: _zod2.default.string().trim().min(1).max(128).optional().describe("New display name."),
6171
+ description: _zod2.default.string().trim().max(1024).optional().describe("New description."),
6172
+ schedule: _zod2.default.string().trim().min(1).optional().describe("New cron expression or natural-language cadence."),
6173
+ prompt: PromptSchema.optional().describe("New agent instructions."),
6174
+ model: _zod2.default.string().trim().optional().describe(
6175
+ 'New model for run sessions. Accepts a model id, a model display name, or "cheapest" to pin the lowest-cost available model. Pass an empty string to clear the pin and use the default model.'
6176
+ ),
6177
+ reasoningEffort: _zod2.default.string().trim().optional().describe(
6178
+ 'New reasoning effort for run sessions (e.g. "low", "medium", "high"). Pass an empty string to clear it. Remote automations only.'
6179
+ ),
6180
+ status: AutomationStatusSchema.optional().describe(
6181
+ 'New status: "active" or "paused".'
6182
+ ),
6183
+ computerId: _zod2.default.string().trim().min(1).optional().describe("Move a remote automation to a different computer.")
6184
+ }).superRefine((data, ctx) => {
6185
+ const hasAnyUpdate = data.name !== void 0 || data.description !== void 0 || data.schedule !== void 0 || data.prompt !== void 0 || data.model !== void 0 || data.reasoningEffort !== void 0 || data.status !== void 0 || data.computerId !== void 0;
6186
+ if (!hasAnyUpdate) {
6187
+ ctx.addIssue({
6188
+ code: _zod2.default.ZodIssueCode.custom,
6189
+ message: "Provide at least one field to update."
6190
+ });
6191
+ }
6192
+ if (data.executionLocation === "local") {
6193
+ if (data.description !== void 0) {
6194
+ requireField(
6195
+ ctx,
6196
+ "description",
6197
+ 'description is only supported when executionLocation is "remote".'
6198
+ );
6199
+ }
6200
+ if (data.schedule !== void 0) {
6201
+ requireField(
6202
+ ctx,
6203
+ "schedule",
6204
+ 'schedule edits are only supported when executionLocation is "remote".'
6205
+ );
6206
+ }
6207
+ if (data.reasoningEffort !== void 0) {
6208
+ requireField(
6209
+ ctx,
6210
+ "reasoningEffort",
6211
+ 'reasoningEffort edits are only supported when executionLocation is "remote".'
6212
+ );
6213
+ }
6214
+ if (data.computerId !== void 0) {
6215
+ requireField(
6216
+ ctx,
6217
+ "computerId",
6218
+ 'computerId is only supported when executionLocation is "remote".'
6219
+ );
6220
+ }
6221
+ }
6229
6222
  });
6230
6223
 
6231
- // ../droid-sdk-core/src/protocol/daemon/schemas/bug-report.ts
6224
+ // ../droid-sdk-core/src/protocol/droid/schemas/loop-tool.ts
6232
6225
 
6233
- var DaemonSubmitBugReportRequestParamsSchema = _zod2.default.object({
6234
- sessionId: _zod2.default.string(),
6235
- userComment: _zod2.default.string(),
6236
- clientLogs: _zod2.default.string().optional(),
6237
- source: BugReportSourceSchema.optional()
6238
- });
6239
- var DaemonSubmitBugReportRequestSchema = JsonRpcBaseRequestSchema.extend({
6240
- method: _zod2.default.literal("daemon.submit_bug_report" /* SUBMIT_BUG_REPORT */),
6241
- params: DaemonSubmitBugReportRequestParamsSchema
6242
- });
6243
- var DaemonSubmitBugReportResultSchema = _zod2.default.object({
6244
- bugReportId: _zod2.default.string()
6226
+ var CronExpressionSchema = _zod2.default.string().trim().regex(/^(\S+\s+){4}\S+$/, "Expected a standard 5-field cron expression");
6227
+ var LoopToolInputSchema = _zod2.default.object({
6228
+ action: _zod2.default.enum(["create", "list", "cancel"]).describe("Operation to perform: create, list, or cancel."),
6229
+ prompt: _zod2.default.string().trim().min(1).optional().describe('Recurring prompt. Required when action is "create".'),
6230
+ cron: CronExpressionSchema.optional().describe(
6231
+ "5-field cron expression in UTC. Pure step cadences are anchored to loop creation."
6232
+ ),
6233
+ loopId: _zod2.default.string().trim().min(1).optional().describe(
6234
+ 'Loop ID returned by the "list" action. Required when action is "cancel".'
6235
+ ),
6236
+ runImmediately: _zod2.default.boolean().optional().describe(
6237
+ 'Also fire once on creation. Defaults to true; only valid for action "create".'
6238
+ )
6239
+ }).superRefine((data, ctx) => {
6240
+ const addRequiredIssue = (field) => {
6241
+ ctx.addIssue({
6242
+ code: _zod2.default.ZodIssueCode.custom,
6243
+ path: [field],
6244
+ message: `"${field}" is required when action is "${data.action}".`
6245
+ });
6246
+ };
6247
+ const rejectField = (field) => {
6248
+ if (data[field] === void 0) return;
6249
+ ctx.addIssue({
6250
+ code: _zod2.default.ZodIssueCode.custom,
6251
+ path: [field],
6252
+ message: `"${field}" is not valid when action is "${data.action}".`
6253
+ });
6254
+ };
6255
+ switch (data.action) {
6256
+ case "create":
6257
+ if (data.prompt === void 0) addRequiredIssue("prompt");
6258
+ if (data.cron === void 0) addRequiredIssue("cron");
6259
+ rejectField("loopId");
6260
+ break;
6261
+ case "list":
6262
+ rejectField("prompt");
6263
+ rejectField("cron");
6264
+ rejectField("loopId");
6265
+ rejectField("runImmediately");
6266
+ break;
6267
+ case "cancel":
6268
+ if (data.loopId === void 0) addRequiredIssue("loopId");
6269
+ rejectField("prompt");
6270
+ rejectField("cron");
6271
+ rejectField("runImmediately");
6272
+ break;
6273
+ default:
6274
+ break;
6275
+ }
6245
6276
  });
6246
6277
 
6247
6278
  // ../droid-sdk-core/src/protocol/daemon/schemas/commands.ts
6248
-
6249
6279
  var DaemonListCommandsRequestParamsSchema = _zod2.default.object({
6250
6280
  sessionId: _zod2.default.string()
6251
6281
  });
@@ -7047,6 +7077,11 @@ var SoftwareFactoryWorkstreamSchema = _zod2.default.object({
7047
7077
  dashboardPort: _zod2.default.number().int().optional(),
7048
7078
  /** Public URL of the workstream's published Conjure dashboard site. */
7049
7079
  dashboardUrl: _zod2.default.string().optional(),
7080
+ /**
7081
+ * Self-contained dashboard HTML, present when the workstream has no
7082
+ * published site. `dashboardUrl` takes precedence when both exist.
7083
+ */
7084
+ dashboardHtml: _zod2.default.string().optional(),
7050
7085
  /** Pause proposed changes for human approval before investigation. */
7051
7086
  requireChangeApproval: _zod2.default.boolean().optional(),
7052
7087
  /** Pause completed investigation specifications for human approval. */
@@ -7225,6 +7260,7 @@ var DaemonSfUpdateWorkstreamRequestParamsSchema = _zod2.default.object({
7225
7260
  stewardConcurrency: _zod2.default.number().optional(),
7226
7261
  dashboardPort: _zod2.default.number().optional(),
7227
7262
  dashboardUrl: _zod2.default.string().optional(),
7263
+ dashboardHtml: _zod2.default.string().optional(),
7228
7264
  requireChangeApproval: _zod2.default.boolean().optional(),
7229
7265
  requireApproval: _zod2.default.boolean().optional(),
7230
7266
  reviewers: _zod2.default.array(_zod2.default.string()).optional()
@@ -7659,6 +7695,12 @@ var DaemonCleanupWorktreeResponseSchema = _zod.z.union([
7659
7695
  JsonRpcBaseResponseFailureSchema
7660
7696
  ]);
7661
7697
 
7698
+ // ../droid-sdk-core/src/protocol/session/tags/constants.ts
7699
+ var SESSION_TAG_SUBAGENT = "subagent";
7700
+
7701
+ // ../droid-sdk-core/src/protocol/sessionV2/constants.ts
7702
+ var TOOL_RESULT_PENDING_MARKER = "__TOOL_RESULT_PENDING__";
7703
+
7662
7704
  // ../droid-sdk-core/src/protocol/daemon/schemas/droid.ts
7663
7705
  var DaemonCommandAckResultSchema = CommandAckSchema;
7664
7706
  var createResponseSchema = (resultSchema) => _zod2.default.union([
@@ -7694,7 +7736,13 @@ var DaemonLoadSessionSpawnOptionsSchema = _zod2.default.object({
7694
7736
  disableBuiltinSkills: _zod2.default.boolean().optional(),
7695
7737
  skipPermissionsUnsafe: _zod2.default.boolean().optional(),
7696
7738
  runtimeSettingsPath: _zod2.default.string().optional(),
7697
- structuredOutputFormat: OutputFormatSchema.nullable().optional()
7739
+ structuredOutputFormat: OutputFormatSchema.nullable().optional(),
7740
+ /**
7741
+ * Trusted hint from the Task executor that this load owns a Task-spawned
7742
+ * process. Used to account for legacy remote Task sessions created before
7743
+ * their persisted settings carried the process tag.
7744
+ */
7745
+ taskSubagentProcess: _zod2.default.literal(true).optional()
7698
7746
  });
7699
7747
  var DaemonLoadSessionRequestParamsSchema = LoadSessionRequestParamsSchema.merge(
7700
7748
  DaemonLoadSessionSpawnOptionsSchema
@@ -7722,7 +7770,14 @@ var DaemonInterruptSessionRequestParamsSchema = InterruptSessionRequestParamsSch
7722
7770
  sessionId: _zod2.default.string()
7723
7771
  });
7724
7772
  var DaemonCloseSessionRequestParamsSchema = _zod2.default.object({
7725
- sessionId: _zod2.default.string()
7773
+ sessionId: _zod2.default.string(),
7774
+ /**
7775
+ * Keep the session's on-disk files even when it is still an empty draft.
7776
+ * Set by close-for-respawn flows (e.g. the TUI's cwd-change reload) that
7777
+ * immediately re-load the same session: reaping the draft there would make
7778
+ * the follow-up load fail with SessionNotFoundError and strand the client.
7779
+ */
7780
+ preserveEmptyDraft: _zod2.default.boolean().optional()
7726
7781
  });
7727
7782
  var DaemonSessionListFilterSchema = _zod2.default.object({
7728
7783
  missionSessions: _zod2.default.boolean().optional(),
@@ -9244,6 +9299,7 @@ var McpAuthCompletedNotificationSchema2 = N[26];
9244
9299
  var HookExecutionStartedNotificationSchema2 = N[27];
9245
9300
  var HookExecutionCompletedNotificationSchema2 = N[28];
9246
9301
  var ToolCallNotificationSchema2 = N[29];
9302
+ var AssistantMessageRetractedNotificationSchema2 = N[35];
9247
9303
  var D = ToolConfirmationDetailsSchema.options;
9248
9304
  var EditToolConfirmationDetailsSchema2 = D[0];
9249
9305
  var ExecuteToolConfirmationDetailsSchema2 = D[1];
@@ -9299,19 +9355,20 @@ var SESSION_INIT_TIMEOUT = 6e4;
9299
9355
  var MCP_AUTH_TIMEOUT = 3e5;
9300
9356
  var COMPACTION_TIMEOUT = 24e4;
9301
9357
  var REWIND_TIMEOUT = 6e4;
9302
- var SDK_VERSION = "0.9.0";
9303
- var SDK_CLIENT_METADATA = {
9358
+ var SDK_VERSION = "0.9.1";
9359
+ var SDK_CLIENT_METADATA = Object.freeze({
9304
9360
  language: "typescript",
9305
9361
  version: SDK_VERSION
9306
- };
9307
- var SDK_REQUEST_ATTRIBUTION = {
9362
+ });
9363
+ var SDK_IDENTITY = formatSdkClientMetadata(SDK_CLIENT_METADATA);
9364
+ var SDK_REQUEST_ATTRIBUTION = Object.freeze({
9308
9365
  client: "sdk" /* SDK */,
9309
9366
  sdk: SDK_CLIENT_METADATA
9310
- };
9311
- var SDK_TAG = {
9367
+ });
9368
+ var SDK_TAG = Object.freeze({
9312
9369
  name: "sdk",
9313
9370
  metadata: SDK_CLIENT_METADATA
9314
- };
9371
+ });
9315
9372
 
9316
9373
  // src/schemas/constants.ts
9317
9374
  var JSONRPC_VERSION3 = JSONRPC_VERSION;
@@ -9570,6 +9627,7 @@ var DroidMessageType = {
9570
9627
  ToolCall: "tool_call",
9571
9628
  AssistantTextDelta: "assistant_text_delta",
9572
9629
  AssistantTextComplete: "assistant_text_complete",
9630
+ AssistantMessageRetracted: "assistant_message_retracted",
9573
9631
  ThinkingTextDelta: "thinking_text_delta",
9574
9632
  ThinkingTextComplete: "thinking_text_complete",
9575
9633
  ToolCallDelta: "tool_call_delta",
@@ -9614,6 +9672,11 @@ function convertNotificationToStreamMessage(raw) {
9614
9672
  messageId: notification.messageId,
9615
9673
  blockIndex: notification.blockIndex
9616
9674
  };
9675
+ case "assistant_message_retracted" /* ASSISTANT_MESSAGE_RETRACTED */:
9676
+ return {
9677
+ type: DroidMessageType.AssistantMessageRetracted,
9678
+ messageId: notification.messageId
9679
+ };
9617
9680
  case "thinking_text_delta" /* THINKING_TEXT_DELTA */:
9618
9681
  return {
9619
9682
  type: DroidMessageType.ThinkingTextDelta,
@@ -9829,18 +9892,20 @@ function convertNotificationToStreamMessage(raw) {
9829
9892
  }
9830
9893
  }
9831
9894
  var StreamStateTracker = (_class = class {
9832
- constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);
9895
+ constructor(options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this);_class.prototype.__init6.call(this);_class.prototype.__init7.call(this);_class.prototype.__init8.call(this);_class.prototype.__init9.call(this);_class.prototype.__init10.call(this);
9833
9896
  this.options = options;
9834
9897
  }
9835
9898
 
9836
9899
  __init() {this.lastTokenUsage = null}
9837
9900
  __init2() {this.fullText = ""}
9838
- __init3() {this.finalAssistantText = ""}
9839
- __init4() {this.structuredOutput = null}
9840
- __init5() {this.structuredOutputError = null}
9841
- __init6() {this.errors = []}
9842
- __init7() {this.emittedMessages = []}
9843
- __init8() {this.toolNameMap = /* @__PURE__ */ new Map()}
9901
+ __init3() {this.streamedTextByMessageId = /* @__PURE__ */ new Map()}
9902
+ __init4() {this.finalAssistantText = ""}
9903
+ __init5() {this.finalAssistantMessageId = null}
9904
+ __init6() {this.structuredOutput = null}
9905
+ __init7() {this.structuredOutputError = null}
9906
+ __init8() {this.errors = []}
9907
+ __init9() {this.emittedMessages = []}
9908
+ __init10() {this.toolNameMap = /* @__PURE__ */ new Map()}
9844
9909
  getToolName(toolUseId) {
9845
9910
  return _nullishCoalesce(this.toolNameMap.get(toolUseId), () => ( ""));
9846
9911
  }
@@ -9860,8 +9925,21 @@ var StreamStateTracker = (_class = class {
9860
9925
  }
9861
9926
  if (message.type === DroidMessageType.AssistantTextDelta) {
9862
9927
  this.fullText += message.text;
9928
+ this.streamedTextByMessageId.set(
9929
+ message.messageId,
9930
+ (_nullishCoalesce(this.streamedTextByMessageId.get(message.messageId), () => ( ""))) + message.text
9931
+ );
9932
+ }
9933
+ if (message.type === DroidMessageType.AssistantMessageRetracted) {
9934
+ this.streamedTextByMessageId.delete(message.messageId);
9935
+ this.fullText = [...this.streamedTextByMessageId.values()].join("");
9936
+ if (this.finalAssistantMessageId === message.messageId) {
9937
+ this.finalAssistantMessageId = null;
9938
+ this.finalAssistantText = "";
9939
+ }
9863
9940
  }
9864
9941
  if (message.type === DroidMessageType.Assistant) {
9942
+ this.finalAssistantMessageId = message.message.id;
9865
9943
  this.finalAssistantText = message.text;
9866
9944
  if (this.fullText.length === 0) {
9867
9945
  this.fullText = message.text;
@@ -10132,7 +10210,7 @@ function extractInnerNotification(notification) {
10132
10210
  return parsed.success ? parsed.data.params.notification : null;
10133
10211
  }
10134
10212
  var MessageBridge = (_class2 = class {
10135
- constructor(onDone, _options = {}) {;_class2.prototype.__init9.call(this);_class2.prototype.__init10.call(this);_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);
10213
+ constructor(onDone, _options = {}) {;_class2.prototype.__init11.call(this);_class2.prototype.__init12.call(this);_class2.prototype.__init13.call(this);_class2.prototype.__init14.call(this);_class2.prototype.__init15.call(this);_class2.prototype.__init16.call(this);_class2.prototype.__init17.call(this);
10136
10214
  this._options = _options;
10137
10215
  this._onDone = onDone;
10138
10216
  this._stateTracker = new StreamStateTracker({
@@ -10142,20 +10220,20 @@ var MessageBridge = (_class2 = class {
10142
10220
  });
10143
10221
  }
10144
10222
 
10145
- __init9() {this._queue = []}
10223
+ __init11() {this._queue = []}
10146
10224
 
10147
- __init10() {this._resolveWaiting = null}
10148
- __init11() {this._done = false}
10149
- __init12() {this._error = null}
10150
- __init13() {this._turnCompleted = false}
10225
+ __init12() {this._resolveWaiting = null}
10226
+ __init13() {this._done = false}
10227
+ __init14() {this._error = null}
10228
+ __init15() {this._turnCompleted = false}
10151
10229
 
10152
10230
 
10153
- __init14() {this.notificationHandler = (notification) => {
10231
+ __init16() {this.notificationHandler = (notification) => {
10154
10232
  const inner = extractInnerNotification(notification);
10155
10233
  if (!inner) return;
10156
10234
  this.sessionNotificationHandler(inner);
10157
10235
  }}
10158
- __init15() {this.sessionNotificationHandler = (inner) => {
10236
+ __init17() {this.sessionNotificationHandler = (inner) => {
10159
10237
  if (inner.type === "agent_turn_completed" /* AGENT_TURN_COMPLETED */ && this._options.turnId !== void 0 && inner.turnId === void 0) {
10160
10238
  this.signalError(
10161
10239
  new ProtocolError(
@@ -10317,6 +10395,10 @@ function buildUserMessageContentBlocks({
10317
10395
  }
10318
10396
  return blocks;
10319
10397
  }
10398
+ function compareMessagesByCreatedAtAndId(left, right) {
10399
+ const timestampDifference = left.createdAt - right.createdAt;
10400
+ return timestampDifference !== 0 ? timestampDifference : left.id.localeCompare(right.id);
10401
+ }
10320
10402
  function orderMessagesByParentChain(messages) {
10321
10403
  if (messages.length === 0) {
10322
10404
  return [];
@@ -10326,7 +10408,7 @@ function orderMessagesByParentChain(messages) {
10326
10408
  (message) => message.parentId !== void 0 && message.parentId !== message.id && messageById.has(message.parentId)
10327
10409
  );
10328
10410
  if (!hasParentLinks) {
10329
- return messages.slice().sort((left, right) => left.createdAt - right.createdAt);
10411
+ return messages.slice().sort(compareMessagesByCreatedAtAndId);
10330
10412
  }
10331
10413
  const referencedParentIds = new Set(
10332
10414
  messages.flatMap(
@@ -10352,7 +10434,7 @@ function orderMessagesByParentChain(messages) {
10352
10434
  if (ordered.length < messages.length) {
10353
10435
  const included = new Set(ordered.map((message) => message.id));
10354
10436
  ordered.push(
10355
- ...messages.filter((message) => !included.has(message.id)).sort((left, right) => left.createdAt - right.createdAt)
10437
+ ...messages.filter((message) => !included.has(message.id)).sort(compareMessagesByCreatedAtAndId)
10356
10438
  );
10357
10439
  }
10358
10440
  return ordered;
@@ -10368,30 +10450,38 @@ function repairParentChainCorruption(messages) {
10368
10450
  return parentId === message.parentId ? message : { ...message, parentId };
10369
10451
  });
10370
10452
  const byId = new Map(repaired.map((message) => [message.id, message]));
10371
- const cycleClosingIds = /* @__PURE__ */ new Set();
10453
+ const cycleRootIds = /* @__PURE__ */ new Set();
10372
10454
  const safeIds = /* @__PURE__ */ new Set();
10373
10455
  for (const start of byId.values()) {
10374
- const pathIds = /* @__PURE__ */ new Set();
10456
+ const pathIndexById = /* @__PURE__ */ new Map();
10375
10457
  const path = [];
10376
10458
  let current = start;
10377
10459
  while (current && !safeIds.has(current.id)) {
10378
- if (pathIds.has(current.id)) {
10379
- cycleClosingIds.add(path[path.length - 1].id);
10460
+ const cycleStart = pathIndexById.get(current.id);
10461
+ if (cycleStart !== void 0) {
10462
+ let cycleRoot = path[cycleStart];
10463
+ for (let index = cycleStart + 1; index < path.length; index++) {
10464
+ const candidate = path[index];
10465
+ if (compareMessagesByCreatedAtAndId(candidate, cycleRoot) < 0) {
10466
+ cycleRoot = candidate;
10467
+ }
10468
+ }
10469
+ cycleRootIds.add(cycleRoot.id);
10380
10470
  break;
10381
10471
  }
10382
- pathIds.add(current.id);
10472
+ pathIndexById.set(current.id, path.length);
10383
10473
  path.push(current);
10384
10474
  current = current.parentId ? byId.get(current.parentId) : void 0;
10385
10475
  }
10386
- for (const id of pathIds) {
10476
+ for (const id of pathIndexById.keys()) {
10387
10477
  safeIds.add(id);
10388
10478
  }
10389
10479
  }
10390
- if (cycleClosingIds.size === 0) {
10480
+ if (cycleRootIds.size === 0) {
10391
10481
  return repaired;
10392
10482
  }
10393
10483
  return repaired.map(
10394
- (message) => cycleClosingIds.has(message.id) ? { ...message, parentId: void 0 } : message
10484
+ (message) => cycleRootIds.has(message.id) ? { ...message, parentId: void 0 } : message
10395
10485
  );
10396
10486
  }
10397
10487
  function stripTaggedBlocks(text, startTag, endTag) {
@@ -10774,7 +10864,7 @@ function retryWithLogger(func, {
10774
10864
  return async function retryWrapper(...args) {
10775
10865
  let attempts = 0;
10776
10866
  let funcError = new Error("No error captured");
10777
- while (attempts < retries) {
10867
+ while (typeof retries === "function" || attempts < retries) {
10778
10868
  try {
10779
10869
  const result = await func(...args);
10780
10870
  if (onSuccess) {
@@ -10794,7 +10884,8 @@ function retryWithLogger(func, {
10794
10884
  logWarn2("Retry attempt failed", { cause: error });
10795
10885
  }
10796
10886
  }
10797
- if (attempts >= retries) {
10887
+ const retryLimit = typeof retries === "function" ? retries(funcError) : retries;
10888
+ if (attempts >= retryLimit) {
10798
10889
  break;
10799
10890
  }
10800
10891
  const baseDelayTime = exponentialBackoff ? delay * backoffFactor ** attempts : delay;
@@ -11081,16 +11172,16 @@ var RequestEngine = (_class3 = class _RequestEngine {
11081
11172
 
11082
11173
 
11083
11174
 
11084
- __init16() {this.pendingRequests = /* @__PURE__ */ new Map()}
11085
- __init17() {this.ackNotificationWaiters = /* @__PURE__ */ new Map()}
11086
- __init18() {this.messageInterceptor = null}
11087
- __init19() {this.transportMessageHandler = (data) => {
11175
+ __init18() {this.pendingRequests = /* @__PURE__ */ new Map()}
11176
+ __init19() {this.ackNotificationWaiters = /* @__PURE__ */ new Map()}
11177
+ __init20() {this.messageInterceptor = null}
11178
+ __init21() {this.transportMessageHandler = (data) => {
11088
11179
  this.handleMessage(data);
11089
11180
  }}
11090
- __init20() {this.transportCloseHandler = (code, reason) => {
11181
+ __init22() {this.transportCloseHandler = (code, reason) => {
11091
11182
  this.rejectAllPending(code, reason);
11092
11183
  }}
11093
- constructor(config) {;_class3.prototype.__init16.call(this);_class3.prototype.__init17.call(this);_class3.prototype.__init18.call(this);_class3.prototype.__init19.call(this);_class3.prototype.__init20.call(this);
11184
+ constructor(config) {;_class3.prototype.__init18.call(this);_class3.prototype.__init19.call(this);_class3.prototype.__init20.call(this);_class3.prototype.__init21.call(this);_class3.prototype.__init22.call(this);
11094
11185
  this.transport = config.transport;
11095
11186
  this.requestTimeout = config.requestTimeout;
11096
11187
  this.machineTraceAttributes = config.machineTraceAttributes;
@@ -11404,8 +11495,8 @@ var DaemonClient = (_class4 = class _DaemonClient {
11404
11495
  /** factory.* attributes describing the daemon this client talks to. */
11405
11496
 
11406
11497
  // Auth queue: non-auth requests wait for this to resolve
11407
- __init21() {this.authPromise = null}
11408
- __init22() {this.authResolve = null}
11498
+ __init23() {this.authPromise = null}
11499
+ __init24() {this.authResolve = null}
11409
11500
  /** Client surface from config, used in auth metadata (not span attributes). */
11410
11501
 
11411
11502
  /**
@@ -11413,8 +11504,8 @@ var DaemonClient = (_class4 = class _DaemonClient {
11413
11504
  * params include a sessionId. Awaited before the request is sent; if it
11414
11505
  * throws or rejects, the originating request rejects with the same error.
11415
11506
  */
11416
- __init23() {this.beforeRequest = null}
11417
- constructor(config) {;_class4.prototype.__init21.call(this);_class4.prototype.__init22.call(this);_class4.prototype.__init23.call(this);
11507
+ __init25() {this.beforeRequest = null}
11508
+ constructor(config) {;_class4.prototype.__init23.call(this);_class4.prototype.__init24.call(this);_class4.prototype.__init25.call(this);
11418
11509
  this.transport = config.transport;
11419
11510
  this.clientSurface = config.clientSurface;
11420
11511
  this.machineTraceAttributes = _DaemonClient.buildMachineTraceAttributes(
@@ -11660,14 +11751,18 @@ var DaemonClient = (_class4 = class _DaemonClient {
11660
11751
  const validated = DaemonKillWorkerSessionRequestSchema.parse(request);
11661
11752
  return this.sendRequest(validated, DaemonKillWorkerSessionResultSchema);
11662
11753
  }
11663
- listOpenedSessions(params = {}) {
11754
+ listOpenedSessions(params, options) {
11664
11755
  const request = _DaemonClient.buildDaemonRequest({
11665
11756
  method: "daemon.list_opened_sessions" /* LIST_OPENED_SESSIONS */,
11666
11757
  id: _DaemonClient.generateRequestId(),
11667
- params
11758
+ params: _nullishCoalesce(params, () => ( {}))
11668
11759
  });
11669
11760
  const validated = DaemonListOpenedSessionsRequestSchema.parse(request);
11670
- return this.sendRequest(validated, DaemonListOpenedSessionsResultSchema);
11761
+ return this.sendRequest(
11762
+ validated,
11763
+ DaemonListOpenedSessionsResultSchema,
11764
+ _optionalChain([options, 'optionalAccess', _71 => _71.timeout])
11765
+ );
11671
11766
  }
11672
11767
  listAvailableSessions(params) {
11673
11768
  const request = _DaemonClient.buildDaemonRequest({
@@ -11839,14 +11934,18 @@ var DaemonClient = (_class4 = class _DaemonClient {
11839
11934
  const validated = DaemonRelayStopRequestSchema.parse(request);
11840
11935
  return this.sendRequest(validated, DaemonRelayStopResultSchema);
11841
11936
  }
11842
- getRelayStatus() {
11937
+ getRelayStatus(options) {
11843
11938
  const request = _DaemonClient.buildDaemonRequest({
11844
11939
  method: "daemon.relay.get_status" /* GET_STATUS */,
11845
11940
  id: _DaemonClient.generateRequestId(),
11846
11941
  params: {}
11847
11942
  });
11848
11943
  const validated = DaemonRelayGetStatusRequestSchema.parse(request);
11849
- return this.sendRequest(validated, DaemonRelayGetStatusResultSchema);
11944
+ return this.sendRequest(
11945
+ validated,
11946
+ DaemonRelayGetStatusResultSchema,
11947
+ _optionalChain([options, 'optionalAccess', _72 => _72.timeout])
11948
+ );
11850
11949
  }
11851
11950
  // Terminal methods
11852
11951
  createTerminal(params) {
@@ -12971,6 +13070,7 @@ var DaemonClient = (_class4 = class _DaemonClient {
12971
13070
  // ../daemon-sdk/src/connectWithRetry.ts
12972
13071
  var DEFAULT_MAX_RETRIES = 10;
12973
13072
  var RETRY_POLL_INTERVAL_MS = 2e3;
13073
+ var RETRY_POLL_JITTER_MS = 500;
12974
13074
  async function connectAndAuthenticate({
12975
13075
  client,
12976
13076
  url,
@@ -13041,7 +13141,8 @@ async function connectWithRetry({
13041
13141
  },
13042
13142
  {
13043
13143
  retries: maxRetries + 1,
13044
- delay: RETRY_POLL_INTERVAL_MS
13144
+ delay: RETRY_POLL_INTERVAL_MS,
13145
+ getDelay: () => RETRY_POLL_INTERVAL_MS + Math.random() * RETRY_POLL_JITTER_MS
13045
13146
  }
13046
13147
  );
13047
13148
  try {
@@ -13052,7 +13153,7 @@ async function connectWithRetry({
13052
13153
  });
13053
13154
  if (attempts > 0) {
13054
13155
  try {
13055
- _optionalChain([onAttempts, 'optionalCall', _71 => _71(attempts)]);
13156
+ _optionalChain([onAttempts, 'optionalCall', _73 => _73(attempts)]);
13056
13157
  } catch (e4) {
13057
13158
  }
13058
13159
  }
@@ -13069,6 +13170,7 @@ var ConnectionFailureReason = /* @__PURE__ */ ((ConnectionFailureReason2) => {
13069
13170
  ConnectionFailureReason2["IdentityMismatch"] = "identity_mismatch";
13070
13171
  ConnectionFailureReason2["ProtocolMismatch"] = "protocol_mismatch";
13071
13172
  ConnectionFailureReason2["ComputeLimitExceeded"] = "compute_limit_exceeded";
13173
+ ConnectionFailureReason2["ComputerSessionLimitExceeded"] = "computer_session_limit_exceeded";
13072
13174
  ConnectionFailureReason2["RelayUnauthorized"] = "relay_unauthorized";
13073
13175
  ConnectionFailureReason2["DaemonConflict"] = "daemon_conflict";
13074
13176
  ConnectionFailureReason2["RelayUnreachable"] = "relay_unreachable";
@@ -13192,6 +13294,7 @@ function getMetricLabels({
13192
13294
  return {
13193
13295
  surface: options.surface,
13194
13296
  ...options.provider && { providerType: options.provider },
13297
+ ...options.audience && { audience: options.audience },
13195
13298
  attemptTrigger,
13196
13299
  outcome,
13197
13300
  ...failureReason && { failureReason },
@@ -13364,10 +13467,10 @@ var CONNECT_TIMEOUT_MS = 3e4;
13364
13467
  var MAX_CONNECT_RETRIES = 10;
13365
13468
  var CONNECT_RETRY_POLL_INTERVAL_MS = 2e3;
13366
13469
  var TunnelConnection = (_class5 = class extends _eventemitter3.EventEmitter {
13367
- __init24() {this.ws = null}
13470
+ __init26() {this.ws = null}
13368
13471
 
13369
13472
  constructor(options) {
13370
- super();_class5.prototype.__init24.call(this);;
13473
+ super();_class5.prototype.__init26.call(this);;
13371
13474
  this.options = options;
13372
13475
  }
13373
13476
  /* eslint-disable no-use-before-define -- mutual recursion between handlers */
@@ -13496,7 +13599,7 @@ var TunnelConnection = (_class5 = class extends _eventemitter3.EventEmitter {
13496
13599
  this.close();
13497
13600
  throw new MetaError("No access token for relay authentication");
13498
13601
  }
13499
- const activeOrganizationId = await _asyncNullishCoalesce(await _optionalChain([this, 'access', _72 => _72.options, 'access', _73 => _73.getActiveOrganizationId, 'optionalCall', _74 => _74()]), async () => ( null));
13602
+ const activeOrganizationId = await _asyncNullishCoalesce(await _optionalChain([this, 'access', _74 => _74.options, 'access', _75 => _75.getActiveOrganizationId, 'optionalCall', _76 => _76()]), async () => ( null));
13500
13603
  if (!this.ws) {
13501
13604
  throw new MetaError("Not connected");
13502
13605
  }
@@ -13578,6 +13681,10 @@ var REASON_BEHAVIOR = {
13578
13681
  retryable: false,
13579
13682
  message: COMPUTE_LIMIT_EXCEEDED_MESSAGE
13580
13683
  },
13684
+ ["computer_session_limit_exceeded" /* ComputerSessionLimitExceeded */]: {
13685
+ retryable: false,
13686
+ message: "This organization has reached its active Cloud session limit."
13687
+ },
13581
13688
  ["relay_unauthorized" /* RelayUnauthorized */]: {
13582
13689
  retryable: false,
13583
13690
  message: "Relay authentication failed. Please sign in again."
@@ -13707,8 +13814,8 @@ function failureReasonFromRelayAuthError(code, retryable) {
13707
13814
  function createConnectionFailure(reason, opts) {
13708
13815
  const behavior = REASON_BEHAVIOR[reason];
13709
13816
  return new ConnectionFailureError(reason, {
13710
- retryable: _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _75 => _75.retryable]), () => ( behavior.retryable)),
13711
- cause: _optionalChain([opts, 'optionalAccess', _76 => _76.cause]),
13817
+ retryable: _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _77 => _77.retryable]), () => ( behavior.retryable)),
13818
+ cause: _optionalChain([opts, 'optionalAccess', _78 => _78.cause]),
13712
13819
  message: behavior.message
13713
13820
  });
13714
13821
  }
@@ -13719,14 +13826,14 @@ function removeIpcMessageListener(target, listenerFn) {
13719
13826
  target.off("message", listenerFn);
13720
13827
  return;
13721
13828
  }
13722
- _optionalChain([target, 'access', _77 => _77.removeListener, 'optionalCall', _78 => _78("message", listenerFn)]);
13829
+ _optionalChain([target, 'access', _79 => _79.removeListener, 'optionalCall', _80 => _80("message", listenerFn)]);
13723
13830
  }
13724
13831
  function removeIpcDisconnectListener(target, listenerFn) {
13725
13832
  if (typeof target.off === "function") {
13726
13833
  target.off("disconnect", listenerFn);
13727
13834
  return;
13728
13835
  }
13729
- _optionalChain([target, 'access', _79 => _79.removeListener, 'optionalCall', _80 => _80("disconnect", listenerFn)]);
13836
+ _optionalChain([target, 'access', _81 => _81.removeListener, 'optionalCall', _82 => _82("disconnect", listenerFn)]);
13730
13837
  }
13731
13838
  function createProcessDaemonIpcMessageChannel(processRef) {
13732
13839
  return {
@@ -13768,18 +13875,18 @@ function createProcessDaemonIpcMessageChannel(processRef) {
13768
13875
  };
13769
13876
  }
13770
13877
  var IpcDaemonClientTransport = (_class6 = class {
13771
- __init25() {this.connectionId = _uuid.v4.call(void 0, )}
13772
- __init26() {this.connected = false}
13878
+ __init27() {this.connectionId = _uuid.v4.call(void 0, )}
13879
+ __init28() {this.connected = false}
13773
13880
 
13774
- __init27() {this.unsubscribeMessage = null}
13775
- __init28() {this.unsubscribeDisconnect = null}
13776
- __init29() {this.handlers = {
13881
+ __init29() {this.unsubscribeMessage = null}
13882
+ __init30() {this.unsubscribeDisconnect = null}
13883
+ __init31() {this.handlers = {
13777
13884
  open: /* @__PURE__ */ new Set(),
13778
13885
  close: /* @__PURE__ */ new Set(),
13779
13886
  error: /* @__PURE__ */ new Set(),
13780
13887
  message: /* @__PURE__ */ new Set()
13781
13888
  }}
13782
- __init30() {this.handleChannelMessage = (message) => {
13889
+ __init32() {this.handleChannelMessage = (message) => {
13783
13890
  if (!this.connected) {
13784
13891
  return;
13785
13892
  }
@@ -13787,7 +13894,7 @@ var IpcDaemonClientTransport = (_class6 = class {
13787
13894
  handler(message);
13788
13895
  }
13789
13896
  }}
13790
- __init31() {this.handleChannelDisconnect = (event) => {
13897
+ __init33() {this.handleChannelDisconnect = (event) => {
13791
13898
  const wasConnected = this.connected;
13792
13899
  this.connected = false;
13793
13900
  this.cleanupSubscriptions();
@@ -13795,12 +13902,12 @@ var IpcDaemonClientTransport = (_class6 = class {
13795
13902
  return;
13796
13903
  }
13797
13904
  for (const handler of this.handlers.close) {
13798
- handler(1e3, _nullishCoalesce(_optionalChain([event, 'optionalAccess', _82 => _82.reason]), () => ( "IPC disconnected")));
13905
+ handler(1e3, _nullishCoalesce(_optionalChain([event, 'optionalAccess', _84 => _84.reason]), () => ( "IPC disconnected")));
13799
13906
  }
13800
13907
  }}
13801
13908
  constructor(channel = createProcessDaemonIpcMessageChannel(
13802
13909
  process
13803
- )) {;_class6.prototype.__init25.call(this);_class6.prototype.__init26.call(this);_class6.prototype.__init27.call(this);_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);
13910
+ )) {;_class6.prototype.__init27.call(this);_class6.prototype.__init28.call(this);_class6.prototype.__init29.call(this);_class6.prototype.__init30.call(this);_class6.prototype.__init31.call(this);_class6.prototype.__init32.call(this);_class6.prototype.__init33.call(this);
13804
13911
  this.channel = channel;
13805
13912
  }
13806
13913
  async connect(_url) {
@@ -13816,7 +13923,7 @@ var IpcDaemonClientTransport = (_class6 = class {
13816
13923
  return;
13817
13924
  }
13818
13925
  this.unsubscribeMessage = this.channel.onMessage(this.handleChannelMessage);
13819
- this.unsubscribeDisconnect = _nullishCoalesce(_optionalChain([this, 'access', _83 => _83.channel, 'access', _84 => _84.onDisconnect, 'optionalCall', _85 => _85(this.handleChannelDisconnect)]), () => ( null));
13926
+ this.unsubscribeDisconnect = _nullishCoalesce(_optionalChain([this, 'access', _85 => _85.channel, 'access', _86 => _86.onDisconnect, 'optionalCall', _87 => _87(this.handleChannelDisconnect)]), () => ( null));
13820
13927
  this.connected = true;
13821
13928
  queueMicrotask(() => {
13822
13929
  if (!this.connected) {
@@ -13855,9 +13962,9 @@ var IpcDaemonClientTransport = (_class6 = class {
13855
13962
  this.handlers[event].delete(handler);
13856
13963
  }
13857
13964
  cleanupSubscriptions() {
13858
- _optionalChain([this, 'access', _86 => _86.unsubscribeMessage, 'optionalCall', _87 => _87()]);
13965
+ _optionalChain([this, 'access', _88 => _88.unsubscribeMessage, 'optionalCall', _89 => _89()]);
13859
13966
  this.unsubscribeMessage = null;
13860
- _optionalChain([this, 'access', _88 => _88.unsubscribeDisconnect, 'optionalCall', _89 => _89()]);
13967
+ _optionalChain([this, 'access', _90 => _90.unsubscribeDisconnect, 'optionalCall', _91 => _91()]);
13861
13968
  this.unsubscribeDisconnect = null;
13862
13969
  }
13863
13970
  async isChannelAvailable() {
@@ -13889,31 +13996,31 @@ var IpcDaemonClientTransport = (_class6 = class {
13889
13996
  // ../daemon-sdk/src/transports/InProcessDaemonClientTransport.ts
13890
13997
 
13891
13998
  var InProcessDaemonClientTransport = (_class7 = class {
13892
- __init32() {this.connectionId = _uuid.v4.call(void 0, )}
13999
+ __init34() {this.connectionId = _uuid.v4.call(void 0, )}
13893
14000
 
13894
- __init33() {this.connected = false}
13895
- __init34() {this.unsubscribeFns = /* @__PURE__ */ new Set()}
13896
- __init35() {this.handlers = {
14001
+ __init35() {this.connected = false}
14002
+ __init36() {this.unsubscribeFns = /* @__PURE__ */ new Set()}
14003
+ __init37() {this.handlers = {
13897
14004
  open: /* @__PURE__ */ new Set(),
13898
14005
  close: /* @__PURE__ */ new Set(),
13899
14006
  error: /* @__PURE__ */ new Set(),
13900
14007
  message: /* @__PURE__ */ new Set()
13901
14008
  }}
13902
- constructor(options) {;_class7.prototype.__init32.call(this);_class7.prototype.__init33.call(this);_class7.prototype.__init34.call(this);_class7.prototype.__init35.call(this);
14009
+ constructor(options) {;_class7.prototype.__init34.call(this);_class7.prototype.__init35.call(this);_class7.prototype.__init36.call(this);_class7.prototype.__init37.call(this);
13903
14010
  this.options = options;
13904
14011
  }
13905
14012
  async connect(url) {
13906
14013
  if (this.connected) return;
13907
14014
  this.registerUnsubscribe(
13908
- _optionalChain([this, 'access', _90 => _90.options, 'access', _91 => _91.onMessage, 'optionalCall', _92 => _92((data) => this.emitMessage(data))])
14015
+ _optionalChain([this, 'access', _92 => _92.options, 'access', _93 => _93.onMessage, 'optionalCall', _94 => _94((data) => this.emitMessage(data))])
13909
14016
  );
13910
14017
  this.registerUnsubscribe(
13911
- _optionalChain([this, 'access', _93 => _93.options, 'access', _94 => _94.onClose, 'optionalCall', _95 => _95((code, reason) => this.handleClose(code, reason))])
14018
+ _optionalChain([this, 'access', _95 => _95.options, 'access', _96 => _96.onClose, 'optionalCall', _97 => _97((code, reason) => this.handleClose(code, reason))])
13912
14019
  );
13913
14020
  this.registerUnsubscribe(
13914
- _optionalChain([this, 'access', _96 => _96.options, 'access', _97 => _97.onError, 'optionalCall', _98 => _98((error) => this.emitError(error))])
14021
+ _optionalChain([this, 'access', _98 => _98.options, 'access', _99 => _99.onError, 'optionalCall', _100 => _100((error) => this.emitError(error))])
13915
14022
  );
13916
- await _optionalChain([this, 'access', _99 => _99.options, 'access', _100 => _100.connect, 'optionalCall', _101 => _101(url)]);
14023
+ await _optionalChain([this, 'access', _101 => _101.options, 'access', _102 => _102.connect, 'optionalCall', _103 => _103(url)]);
13917
14024
  this.connected = true;
13918
14025
  queueMicrotask(() => {
13919
14026
  if (!this.connected) return;
@@ -13924,7 +14031,7 @@ var InProcessDaemonClientTransport = (_class7 = class {
13924
14031
  if (!this.connected) return;
13925
14032
  this.connected = false;
13926
14033
  try {
13927
- _optionalChain([this, 'access', _102 => _102.options, 'access', _103 => _103.disconnect, 'optionalCall', _104 => _104()]);
14034
+ _optionalChain([this, 'access', _104 => _104.options, 'access', _105 => _105.disconnect, 'optionalCall', _106 => _106()]);
13928
14035
  } catch (error) {
13929
14036
  logWarn(
13930
14037
  "[InProcessDaemonClientTransport] Client disconnect threw, ignoring",
@@ -13967,7 +14074,7 @@ var InProcessDaemonClientTransport = (_class7 = class {
13967
14074
  * runtime after it moves behind `DaemonClient`.
13968
14075
  */
13969
14076
  setPendingSessionReady(sessionId, promise) {
13970
- _optionalChain([this, 'access', _105 => _105.options, 'access', _106 => _106.setPendingSessionReady, 'optionalCall', _107 => _107(sessionId, promise)]);
14077
+ _optionalChain([this, 'access', _107 => _107.options, 'access', _108 => _108.setPendingSessionReady, 'optionalCall', _109 => _109(sessionId, promise)]);
13971
14078
  }
13972
14079
  async sendWhenAvailable(data) {
13973
14080
  try {
@@ -14025,11 +14132,11 @@ var WebSocketConnection = (_class8 = class extends _eventemitter3.EventEmitter {
14025
14132
 
14026
14133
 
14027
14134
 
14028
- __init36() {this.ws = null}
14029
- __init37() {this.isIntentionallyClosed = false}
14030
- __init38() {this.connectionId = null}
14135
+ __init38() {this.ws = null}
14136
+ __init39() {this.isIntentionallyClosed = false}
14137
+ __init40() {this.connectionId = null}
14031
14138
  constructor(config) {
14032
- super();_class8.prototype.__init36.call(this);_class8.prototype.__init37.call(this);_class8.prototype.__init38.call(this);;
14139
+ super();_class8.prototype.__init38.call(this);_class8.prototype.__init39.call(this);_class8.prototype.__init40.call(this);;
14033
14140
  this.maxConnectRetries = config.maxConnectRetries;
14034
14141
  this.initialRetryDelayMs = config.initialRetryDelayMs;
14035
14142
  this.maxRetryDelayMs = config.maxRetryDelayMs;
@@ -14258,7 +14365,7 @@ var WebSocketDaemonTransport = (_class9 = class _WebSocketDaemonTransport {
14258
14365
 
14259
14366
 
14260
14367
 
14261
- __init39() {this.onHandlers = {
14368
+ __init41() {this.onHandlers = {
14262
14369
  open: (handler) => {
14263
14370
  this.connection.on("open", handler);
14264
14371
  },
@@ -14272,7 +14379,7 @@ var WebSocketDaemonTransport = (_class9 = class _WebSocketDaemonTransport {
14272
14379
  this.connection.on("message", handler);
14273
14380
  }
14274
14381
  }}
14275
- __init40() {this.offHandlers = {
14382
+ __init42() {this.offHandlers = {
14276
14383
  open: (handler) => {
14277
14384
  this.connection.off("open", handler);
14278
14385
  },
@@ -14286,7 +14393,7 @@ var WebSocketDaemonTransport = (_class9 = class _WebSocketDaemonTransport {
14286
14393
  this.connection.off("message", handler);
14287
14394
  }
14288
14395
  }}
14289
- constructor(config) {;_class9.prototype.__init39.call(this);_class9.prototype.__init40.call(this);
14396
+ constructor(config) {;_class9.prototype.__init41.call(this);_class9.prototype.__init42.call(this);
14290
14397
  this.connection = new WebSocketConnection(config);
14291
14398
  this.relayConnection = _nullishCoalesce(config.isRelayConnection, () => ( false));
14292
14399
  this.getAccessToken = _nullishCoalesce(config.getAccessToken, () => ( (() => Promise.resolve(null))));
@@ -14378,7 +14485,7 @@ var WebSocketDaemonTransport = (_class9 = class _WebSocketDaemonTransport {
14378
14485
  return "relay_timeout" /* RelayTimeout */;
14379
14486
  }
14380
14487
  const wsError = error instanceof WebSocketConnectionError ? error : error instanceof Error && error.cause instanceof WebSocketConnectionError ? error.cause : null;
14381
- return _nullishCoalesce(failureReasonFromCloseCode(_optionalChain([wsError, 'optionalAccess', _108 => _108.closeCode])), () => ( "relay_auth_rejected")) /* RelayAuthRejected */;
14488
+ return _nullishCoalesce(failureReasonFromCloseCode(_optionalChain([wsError, 'optionalAccess', _110 => _110.closeCode])), () => ( "relay_auth_rejected")) /* RelayAuthRejected */;
14382
14489
  }
14383
14490
  }, _class9);
14384
14491
 
@@ -14391,6 +14498,34 @@ function getWebSocketConfigForMachine(type) {
14391
14498
  }
14392
14499
 
14393
14500
  // ../daemon-sdk/src/createWebSocketDaemonClient.ts
14501
+ async function getLegacyDaemonAuthenticationCredential(getAccessToken) {
14502
+ const token = await getAccessToken();
14503
+ return token ? { token } : null;
14504
+ }
14505
+ function getDaemonAuthenticationCredential(config) {
14506
+ if (config.getCredential) {
14507
+ return config.getCredential();
14508
+ }
14509
+ return getLegacyDaemonAuthenticationCredential(config.getAccessToken);
14510
+ }
14511
+ function getDaemonClientSurface(clientType) {
14512
+ switch (clientType) {
14513
+ case "cli":
14514
+ return ClientUiSurface.CliTui;
14515
+ case "desktop":
14516
+ return ClientUiSurface.Desktop;
14517
+ case "web":
14518
+ return ClientUiSurface.Web;
14519
+ case "sdk":
14520
+ return ClientUiSurface.Sdk;
14521
+ default: {
14522
+ const exhaustiveCheck = clientType;
14523
+ throw new MetaError("Unhandled daemon client type", {
14524
+ clientType: exhaustiveCheck
14525
+ });
14526
+ }
14527
+ }
14528
+ }
14394
14529
  function createWebSocketDaemonClient(config) {
14395
14530
  const transport = new WebSocketDaemonTransport({
14396
14531
  ...getWebSocketConfigForMachine(config.machineType),
@@ -14435,6 +14570,31 @@ function createWebSocketDaemonClient(config) {
14435
14570
  }
14436
14571
  }
14437
14572
  }
14573
+ function createWebSocketDaemonClientFromConfig(config) {
14574
+ return createWebSocketDaemonClient({
14575
+ machineType: config.machineType,
14576
+ ...config.machineType === "computer" /* Computer */ ? { providerType: config.providerType } : {},
14577
+ getAccessToken: async () => {
14578
+ const credential = await getDaemonAuthenticationCredential(config);
14579
+ if (!credential) return null;
14580
+ if ("apiKey" in credential) {
14581
+ throw new MetaError(
14582
+ "API-key credentials cannot authenticate relay connections"
14583
+ );
14584
+ }
14585
+ return credential.token;
14586
+ },
14587
+ getActiveOrganizationId: config.getActiveOrganizationId,
14588
+ requestTimeout: config.requestTimeout,
14589
+ clientSurface: getDaemonClientSurface(_nullishCoalesce(config.clientType, () => ( "web"))),
14590
+ transportConfig: {
14591
+ maxConnectRetries: 0,
14592
+ initialRetryDelayMs: 0,
14593
+ maxRetryDelayMs: 0,
14594
+ connectionTimeoutMs: config.connectionTimeoutMs
14595
+ }
14596
+ });
14597
+ }
14438
14598
 
14439
14599
  // ../daemon-sdk/src/session/DaemonSessionController.ts
14440
14600
 
@@ -14659,7 +14819,7 @@ var MessageRouter = class _MessageRouter extends _eventemitter3.EventEmitter {
14659
14819
  logInfo("[MessageRouter] Received unsupported session notification", {
14660
14820
  type: _nullishCoalesce(notificationType, () => ( void 0)),
14661
14821
  isError: !!protocolVersionMismatch,
14662
- version: _optionalChain([protocolVersionMismatch, 'optionalAccess', _109 => _109.localFactoryProtocolVersion]),
14822
+ version: _optionalChain([protocolVersionMismatch, 'optionalAccess', _111 => _111.localFactoryProtocolVersion]),
14663
14823
  sessionId: _nullishCoalesce(sessionId, () => ( void 0))
14664
14824
  });
14665
14825
  return true;
@@ -14706,13 +14866,13 @@ var MessageRouter = class _MessageRouter extends _eventemitter3.EventEmitter {
14706
14866
 
14707
14867
  // ../daemon-sdk/src/session/core/ReconnectionStrategy.ts
14708
14868
  var ReconnectionStrategy = (_class10 = class {
14709
- __init41() {this.attempts = 0}
14869
+ __init43() {this.attempts = 0}
14710
14870
 
14711
14871
 
14712
14872
 
14713
14873
 
14714
14874
 
14715
- constructor(maxAttempts, baseDelay, maxDelay, backoffFactor, reconnectDelegated = false) {;_class10.prototype.__init41.call(this);
14875
+ constructor(maxAttempts, baseDelay, maxDelay, backoffFactor, reconnectDelegated = false) {;_class10.prototype.__init43.call(this);
14716
14876
  this.maxAttempts = maxAttempts;
14717
14877
  this.baseDelay = baseDelay;
14718
14878
  this.maxDelay = maxDelay;
@@ -14895,12 +15055,10 @@ function orderedContentBlocksMatch(left, right) {
14895
15055
  }
14896
15056
  function hasCanonicalFallbackOrder(content) {
14897
15057
  const fallbackContent = [
14898
- ...content.images.map(
14899
- (source) => ({
14900
- type: "image" /* Image */,
14901
- source
14902
- })
14903
- )
15058
+ ...content.images.map((source) => ({
15059
+ type: "image" /* Image */,
15060
+ source
15061
+ }))
14904
15062
  ];
14905
15063
  if (content.text) {
14906
15064
  fallbackContent.push({
@@ -15118,7 +15276,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15118
15276
  // Per-session permission subscribers. A subagent (child Task) permission is
15119
15277
  // fanned out to every subscribed session in its `associatedSessionIds`, so a
15120
15278
  // child's prompt surfaces on both the child and its parent.
15121
- __init42() {this.sessionPermissionSubscribers = /* @__PURE__ */ new Map()}
15279
+ __init44() {this.sessionPermissionSubscribers = /* @__PURE__ */ new Map()}
15122
15280
  get askUserHandler() {
15123
15281
  return this.sessionStateManager.askUserRequests;
15124
15282
  }
@@ -15130,7 +15288,16 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15130
15288
  // stores. The stores outlive the controller, so destroy() must detach
15131
15289
  // exactly this controller's listeners (removeAllListeners would detach
15132
15290
  // other controllers' too).
15133
- __init43() {this.promptStoreUnsubscribes = []}
15291
+ __init45() {this.promptStoreUnsubscribes = []}
15292
+ // Prompt-owning sessions interrupted specifically by transport loss. Unlike
15293
+ // daemon inactivity, their first reconnect snapshot can transiently omit a
15294
+ // still-pending prompt while the worker is being restored.
15295
+ __init46() {this.transportInterruptedPromptSessions = /* @__PURE__ */ new Set()}
15296
+ // A reconnect may preserve an omitted prompt for one snapshot. If the user
15297
+ // answers during that grace window, the session remains in the inactive
15298
+ // response path so the answer is buffered and replayed against the worker's
15299
+ // restored request id instead of being sent to a stale pre-disconnect id.
15300
+ __init47() {this.reconnectPromptSnapshotGraceConsumedSessions = /* @__PURE__ */ new Set()}
15134
15301
  // Whether a session's worker is paused (buffer responses), whether a session
15135
15302
  // is draining a concurrent prompt batch (suppress resume-driven auto-clear),
15136
15303
  // and the spawn options replayed on self-resume all describe the *session*,
@@ -15139,61 +15306,44 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15139
15306
  // Sessions with a self-resume loadSession already in flight. Stays on this
15140
15307
  // controller: it dedupes an in-flight RPC/retry loop on this connection's
15141
15308
  // daemonClient, not session state.
15142
- __init44() {this.selfResumeInFlight = /* @__PURE__ */ new Set()}
15309
+ __init48() {this.selfResumeInFlight = /* @__PURE__ */ new Set()}
15143
15310
  // addUserMessage responses can resolve after their CREATE_MESSAGE notification.
15144
15311
  // Track that ordering so an already-confirmed turn is not added to the
15145
15312
  // visible queue after its real user message has been rendered.
15146
- __init45() {this.inFlightAddUserMessageRequests = /* @__PURE__ */ new Set()}
15147
- __init46() {this.confirmedInFlightAddUserMessageRequests = /* @__PURE__ */ new Set()}
15148
- __init47() {this.pendingChildSessionHydrations = /* @__PURE__ */ new Set()}
15149
- __init48() {this.trackedChildSessionIds = /* @__PURE__ */ new Set()}
15150
- __init49() {this.childSessionAttachmentGeneration = /* @__PURE__ */ new Map()}
15151
- __init50() {this.connectionGeneration = 0}
15313
+ __init49() {this.inFlightAddUserMessageRequests = /* @__PURE__ */ new Set()}
15314
+ __init50() {this.confirmedInFlightAddUserMessageRequests = /* @__PURE__ */ new Set()}
15315
+ __init51() {this.pendingChildSessionHydrations = /* @__PURE__ */ new Set()}
15316
+ __init52() {this.trackedChildSessionIds = /* @__PURE__ */ new Set()}
15317
+ __init53() {this.childSessionAttachmentGeneration = /* @__PURE__ */ new Map()}
15318
+ __init54() {this.connectionGeneration = 0}
15152
15319
  /**
15153
15320
  * In-flight loadSession promises keyed by sessionId. ensureSessionLoaded
15154
15321
  * awaits the tracked promise so concurrent guarded RPCs are gated on a
15155
15322
  * single load instead of racing against a session in `Loading` state.
15156
15323
  */
15157
- __init51() {this.sessionLoadInFlight = /* @__PURE__ */ new Map()}
15324
+ __init55() {this.sessionLoadInFlight = /* @__PURE__ */ new Map()}
15158
15325
 
15159
15326
 
15160
15327
 
15161
15328
 
15162
- __init52() {this.connectAttemptContext = null}
15163
- __init53() {this.reconnectTimer = null}
15164
- __init54() {this.delegatedReconnectAbort = null}
15165
- __init55() {this.isReconnecting = false}
15166
- __init56() {this.hasEverConnected = false}
15329
+ __init56() {this.connectAttemptContext = null}
15330
+ __init57() {this.reconnectTimer = null}
15331
+ __init58() {this.delegatedReconnectAbort = null}
15332
+ __init59() {this.isReconnecting = false}
15333
+ __init60() {this.hasEverConnected = false}
15167
15334
  /** Tracks whether doEstablishConnection is actively polling (used for diagnostics) */
15168
- __init57() {this.isPolling = false}
15169
- __init58() {this.pendingConnection = null}
15170
- __init59() {this._isAuthenticated = false}
15171
- __init60() {this.lastConnectionFailure = null}
15172
- __init61() {this.manuallyDisconnected = false}
15173
- __init62() {this.authenticationPromise = null}
15174
- __init63() {this.machineInfo = null}
15335
+ __init61() {this.isPolling = false}
15336
+ __init62() {this.pendingConnection = null}
15337
+ __init63() {this._isAuthenticated = false}
15338
+ __init64() {this.lastConnectionFailure = null}
15339
+ __init65() {this.manuallyDisconnected = false}
15340
+ __init66() {this.authenticationPromise = null}
15341
+ __init67() {this.machineInfo = null}
15175
15342
  constructor(params) {
15176
- super();_class11.prototype.__init42.call(this);_class11.prototype.__init43.call(this);_class11.prototype.__init44.call(this);_class11.prototype.__init45.call(this);_class11.prototype.__init46.call(this);_class11.prototype.__init47.call(this);_class11.prototype.__init48.call(this);_class11.prototype.__init49.call(this);_class11.prototype.__init50.call(this);_class11.prototype.__init51.call(this);_class11.prototype.__init52.call(this);_class11.prototype.__init53.call(this);_class11.prototype.__init54.call(this);_class11.prototype.__init55.call(this);_class11.prototype.__init56.call(this);_class11.prototype.__init57.call(this);_class11.prototype.__init58.call(this);_class11.prototype.__init59.call(this);_class11.prototype.__init60.call(this);_class11.prototype.__init61.call(this);_class11.prototype.__init62.call(this);_class11.prototype.__init63.call(this);;
15343
+ super();_class11.prototype.__init44.call(this);_class11.prototype.__init45.call(this);_class11.prototype.__init46.call(this);_class11.prototype.__init47.call(this);_class11.prototype.__init48.call(this);_class11.prototype.__init49.call(this);_class11.prototype.__init50.call(this);_class11.prototype.__init51.call(this);_class11.prototype.__init52.call(this);_class11.prototype.__init53.call(this);_class11.prototype.__init54.call(this);_class11.prototype.__init55.call(this);_class11.prototype.__init56.call(this);_class11.prototype.__init57.call(this);_class11.prototype.__init58.call(this);_class11.prototype.__init59.call(this);_class11.prototype.__init60.call(this);_class11.prototype.__init61.call(this);_class11.prototype.__init62.call(this);_class11.prototype.__init63.call(this);_class11.prototype.__init64.call(this);_class11.prototype.__init65.call(this);_class11.prototype.__init66.call(this);_class11.prototype.__init67.call(this);;
15177
15344
  const { sessionStateManager, config, daemonClient, missionStateManager } = params;
15178
15345
  this.config = config;
15179
- this.daemonClient = _nullishCoalesce(daemonClient, () => ( createWebSocketDaemonClient({
15180
- machineType: config.machineType,
15181
- ...config.machineType === "computer" /* Computer */ && {
15182
- providerType: config.providerType
15183
- },
15184
- getAccessToken: config.getAccessToken,
15185
- getActiveOrganizationId: config.getActiveOrganizationId,
15186
- requestTimeout: config.requestTimeout,
15187
- clientSurface: _DaemonSessionController.getClientSurfaceForType(
15188
- config.clientType
15189
- ),
15190
- transportConfig: {
15191
- maxConnectRetries: 0,
15192
- initialRetryDelayMs: 0,
15193
- maxRetryDelayMs: 0,
15194
- connectionTimeoutMs: config.connectionTimeoutMs
15195
- }
15196
- })));
15346
+ this.daemonClient = _nullishCoalesce(daemonClient, () => ( createWebSocketDaemonClientFromConfig(config)));
15197
15347
  this.messageRouter = new MessageRouter({
15198
15348
  emitReceiveSpans: config.clientType !== "cli"
15199
15349
  });
@@ -15207,7 +15357,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15207
15357
  this.config.reconnectBackoffFactor,
15208
15358
  reconnectDelegated
15209
15359
  );
15210
- _optionalChain([this, 'access', _110 => _110.daemonClient, 'access', _111 => _111.setBeforeRequest, 'optionalCall', _112 => _112(async (sessionId, method) => {
15360
+ _optionalChain([this, 'access', _112 => _112.daemonClient, 'access', _113 => _113.setBeforeRequest, 'optionalCall', _114 => _114(async (sessionId, method) => {
15211
15361
  if (SKIP_ENSURE_LOADED.has(method)) return;
15212
15362
  await this.ensureSessionLoaded(sessionId);
15213
15363
  })]);
@@ -15219,24 +15369,12 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15219
15369
  getClientType() {
15220
15370
  return _nullishCoalesce(this.config.clientType, () => ( "web"));
15221
15371
  }
15222
- static getClientSurfaceForType(clientType) {
15223
- if (clientType === "desktop") {
15224
- return ClientUiSurface.Desktop;
15225
- }
15226
- if (clientType === "web") {
15227
- return ClientUiSurface.Web;
15228
- }
15229
- if (clientType === "sdk") {
15230
- return ClientUiSurface.Sdk;
15231
- }
15232
- return void 0;
15233
- }
15234
15372
  /**
15235
15373
  * Get the current client interaction surface for RPC requests.
15236
15374
  * Uses injectable clientType from config instead of checking window.electronAPI.
15237
15375
  */
15238
15376
  getClientSurface() {
15239
- return _nullishCoalesce(_DaemonSessionController.getClientSurfaceForType(this.getClientType()), () => ( ClientUiSurface.Web));
15377
+ return getDaemonClientSurface(this.getClientType());
15240
15378
  }
15241
15379
  async withConnectAttemptContext(context, fn) {
15242
15380
  const previous = this.connectAttemptContext;
@@ -15343,7 +15481,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15343
15481
  let effectiveMax = maxAttempts;
15344
15482
  let attempt = 0;
15345
15483
  while (attempt < effectiveMax) {
15346
- if (_optionalChain([signal, 'optionalAccess', _113 => _113.aborted])) {
15484
+ if (_optionalChain([signal, 'optionalAccess', _115 => _115.aborted])) {
15347
15485
  throw new MetaError("pollUntilConnected aborted");
15348
15486
  }
15349
15487
  this.notifyPollAttempt(preConnectionAttempt, {
@@ -15397,19 +15535,19 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15397
15535
  if (attempt < effectiveMax) {
15398
15536
  await new Promise((resolve, reject) => {
15399
15537
  const handle = setTimeout(() => {
15400
- _optionalChain([signal, 'optionalAccess', _114 => _114.removeEventListener, 'call', _115 => _115("abort", onAbort)]);
15538
+ _optionalChain([signal, 'optionalAccess', _116 => _116.removeEventListener, 'call', _117 => _117("abort", onAbort)]);
15401
15539
  resolve();
15402
15540
  }, _DaemonSessionController.CONNECTION_POLL_INTERVAL_MS);
15403
15541
  const onAbort = () => {
15404
15542
  clearTimeout(handle);
15405
15543
  reject(new MetaError("pollUntilConnected aborted"));
15406
15544
  };
15407
- if (_optionalChain([signal, 'optionalAccess', _116 => _116.aborted])) {
15545
+ if (_optionalChain([signal, 'optionalAccess', _118 => _118.aborted])) {
15408
15546
  clearTimeout(handle);
15409
15547
  reject(new MetaError("pollUntilConnected aborted"));
15410
15548
  return;
15411
15549
  }
15412
- _optionalChain([signal, 'optionalAccess', _117 => _117.addEventListener, 'call', _118 => _118("abort", onAbort, { once: true })]);
15550
+ _optionalChain([signal, 'optionalAccess', _119 => _119.addEventListener, 'call', _120 => _120("abort", onAbort, { once: true })]);
15413
15551
  });
15414
15552
  }
15415
15553
  }
@@ -15492,7 +15630,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15492
15630
  }
15493
15631
  }
15494
15632
  );
15495
- _optionalChain([this, 'access', _119 => _119.connectAttemptContext, 'optionalAccess', _120 => _120.setStartType, 'call', _121 => _121(
15633
+ _optionalChain([this, 'access', _121 => _121.connectAttemptContext, 'optionalAccess', _122 => _122.setStartType, 'call', _123 => _123(
15496
15634
  wasRestarted ? "cold" /* Cold */ : "warm" /* Warm */
15497
15635
  )]);
15498
15636
  }
@@ -15527,7 +15665,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15527
15665
  switch (notification.type) {
15528
15666
  case "create_message" /* CREATE_MESSAGE */: {
15529
15667
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
15530
- const messagesCount = _optionalChain([sessionManager, 'optionalAccess', _122 => _122.getStore, 'call', _123 => _123(), 'access', _124 => _124.getMessageCount, 'call', _125 => _125()]);
15668
+ const messagesCount = _optionalChain([sessionManager, 'optionalAccess', _124 => _124.getStore, 'call', _125 => _125(), 'access', _126 => _126.getMessageCount, 'call', _127 => _127()]);
15531
15669
  this.emit("messageThreadUpdated" /* MessageThreadUpdated */, {
15532
15670
  sessionId,
15533
15671
  messagesCount
@@ -15540,7 +15678,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15540
15678
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
15541
15679
  this.emit("messageThreadUpdated" /* MessageThreadUpdated */, {
15542
15680
  sessionId,
15543
- messagesCount: _optionalChain([sessionManager, 'optionalAccess', _126 => _126.getStore, 'call', _127 => _127(), 'access', _128 => _128.getMessageCount, 'call', _129 => _129()])
15681
+ messagesCount: _optionalChain([sessionManager, 'optionalAccess', _128 => _128.getStore, 'call', _129 => _129(), 'access', _130 => _130.getMessageCount, 'call', _131 => _131()])
15544
15682
  });
15545
15683
  break;
15546
15684
  }
@@ -15553,7 +15691,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15553
15691
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
15554
15692
  this.emit("messageThreadUpdated" /* MessageThreadUpdated */, {
15555
15693
  sessionId,
15556
- messagesCount: _optionalChain([sessionManager, 'optionalAccess', _130 => _130.getStore, 'call', _131 => _131(), 'access', _132 => _132.getMessageCount, 'call', _133 => _133()])
15694
+ messagesCount: _optionalChain([sessionManager, 'optionalAccess', _132 => _132.getStore, 'call', _133 => _133(), 'access', _134 => _134.getMessageCount, 'call', _135 => _135()])
15557
15695
  });
15558
15696
  break;
15559
15697
  }
@@ -15562,7 +15700,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15562
15700
  }
15563
15701
  case "droid_working_state_changed" /* DROID_WORKING_STATE_CHANGED */: {
15564
15702
  const { type: _, ...stateNotification } = notification;
15565
- const effectiveState = _nullishCoalesce(_optionalChain([this, 'access', _134 => _134.sessionStateManager, 'access', _135 => _135.getSessionManager, 'call', _136 => _136(sessionId), 'optionalAccess', _137 => _137.getDroidWorkingState, 'call', _138 => _138()]), () => ( stateNotification.newState));
15703
+ const effectiveState = _nullishCoalesce(_optionalChain([this, 'access', _136 => _136.sessionStateManager, 'access', _137 => _137.getSessionManager, 'call', _138 => _138(sessionId), 'optionalAccess', _139 => _139.getDroidWorkingState, 'call', _140 => _140()]), () => ( stateNotification.newState));
15566
15704
  this.emit("droidWorkingStateChanged" /* DroidWorkingStateChanged */, {
15567
15705
  sessionId,
15568
15706
  newState: effectiveState
@@ -15660,7 +15798,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15660
15798
  }
15661
15799
  case "mission_features_changed" /* MISSION_FEATURES_CHANGED */: {
15662
15800
  const missionStore = this.getMissionStoreForSession(sessionId);
15663
- _optionalChain([missionStore, 'optionalAccess', _139 => _139.setFeatures, 'call', _140 => _140(notification.features)]);
15801
+ _optionalChain([missionStore, 'optionalAccess', _141 => _141.setFeatures, 'call', _142 => _142(notification.features)]);
15664
15802
  break;
15665
15803
  }
15666
15804
  case "mission_progress_entry" /* MISSION_PROGRESS_ENTRY */: {
@@ -15671,7 +15809,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15671
15809
  (entry) => entry.type === "mission_accepted" /* MissionAccepted */
15672
15810
  );
15673
15811
  if (acceptedMissionEntry) {
15674
- _optionalChain([missionStore, 'access', _141 => _141.setTitle, 'optionalCall', _142 => _142(acceptedMissionEntry.title)]);
15812
+ _optionalChain([missionStore, 'access', _143 => _143.setTitle, 'optionalCall', _144 => _144(acceptedMissionEntry.title)]);
15675
15813
  }
15676
15814
  }
15677
15815
  break;
@@ -15680,7 +15818,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15680
15818
  break;
15681
15819
  case "mission_worker_started" /* MISSION_WORKER_STARTED */: {
15682
15820
  const missionStore = this.getMissionStoreForSession(sessionId);
15683
- _optionalChain([missionStore, 'optionalAccess', _143 => _143.addWorker, 'call', _144 => _144(notification.workerSessionId)]);
15821
+ _optionalChain([missionStore, 'optionalAccess', _145 => _145.addWorker, 'call', _146 => _146(notification.workerSessionId)]);
15684
15822
  this.emit("missionWorkerStarted" /* MissionWorkerStarted */, {
15685
15823
  sessionId,
15686
15824
  workerSessionId: notification.workerSessionId
@@ -15689,7 +15827,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15689
15827
  }
15690
15828
  case "mission_worker_completed" /* MISSION_WORKER_COMPLETED */: {
15691
15829
  const missionStore = this.getMissionStoreForSession(sessionId);
15692
- _optionalChain([missionStore, 'optionalAccess', _145 => _145.completeWorker, 'call', _146 => _146(
15830
+ _optionalChain([missionStore, 'optionalAccess', _147 => _147.completeWorker, 'call', _148 => _148(
15693
15831
  notification.workerSessionId,
15694
15832
  notification.exitCode
15695
15833
  )]);
@@ -15733,7 +15871,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15733
15871
  break;
15734
15872
  }
15735
15873
  case "agent_turn_completed" /* AGENT_TURN_COMPLETED */:
15736
- _optionalChain([this, 'access', _147 => _147.sessionStateManager, 'access', _148 => _148.getSessionManager, 'call', _149 => _149(sessionId), 'optionalAccess', _150 => _150.getStore, 'call', _151 => _151(), 'access', _152 => _152.setAgentTurnCompletionReason, 'call', _153 => _153(notification.reason)]);
15874
+ _optionalChain([this, 'access', _149 => _149.sessionStateManager, 'access', _150 => _150.getSessionManager, 'call', _151 => _151(sessionId), 'optionalAccess', _152 => _152.getStore, 'call', _153 => _153(), 'access', _154 => _154.setAgentTurnCompletionReason, 'call', _155 => _155(notification.reason)]);
15737
15875
  break;
15738
15876
  case "mcp_auth_required" /* MCP_AUTH_REQUIRED */:
15739
15877
  this.emit("mcpAuthRequired" /* McpAuthRequired */, {
@@ -15756,12 +15894,13 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15756
15894
  case "hook_execution_completed" /* HOOK_EXECUTION_COMPLETED */:
15757
15895
  case "structured_output" /* STRUCTURED_OUTPUT */:
15758
15896
  case "session_compacted" /* SESSION_COMPACTED */:
15897
+ case "assistant_message_retracted" /* ASSISTANT_MESSAGE_RETRACTED */:
15759
15898
  break;
15760
15899
  case "tool_call" /* TOOL_CALL */: {
15761
15900
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
15762
15901
  this.emit("messageThreadUpdated" /* MessageThreadUpdated */, {
15763
15902
  sessionId,
15764
- messagesCount: _optionalChain([sessionManager, 'optionalAccess', _154 => _154.getStore, 'call', _155 => _155(), 'access', _156 => _156.getMessageCount, 'call', _157 => _157()])
15903
+ messagesCount: _optionalChain([sessionManager, 'optionalAccess', _156 => _156.getStore, 'call', _157 => _157(), 'access', _158 => _158.getMessageCount, 'call', _159 => _159()])
15765
15904
  });
15766
15905
  break;
15767
15906
  }
@@ -15769,7 +15908,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15769
15908
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
15770
15909
  this.emit("messageThreadUpdated" /* MessageThreadUpdated */, {
15771
15910
  sessionId,
15772
- messagesCount: _optionalChain([sessionManager, 'optionalAccess', _158 => _158.getStore, 'call', _159 => _159(), 'access', _160 => _160.getMessageCount, 'call', _161 => _161()])
15911
+ messagesCount: _optionalChain([sessionManager, 'optionalAccess', _160 => _160.getStore, 'call', _161 => _161(), 'access', _162 => _162.getMessageCount, 'call', _163 => _163()])
15773
15912
  });
15774
15913
  break;
15775
15914
  }
@@ -15799,7 +15938,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15799
15938
  let currentSessionId = sessionId;
15800
15939
  for (let depth = 0; depth < 10 && currentSessionId; depth++) {
15801
15940
  const manager = this.sessionStateManager.getSessionManager(currentSessionId);
15802
- const parentSessionId = _optionalChain([manager, 'optionalAccess', _162 => _162.getStore, 'call', _163 => _163(), 'access', _164 => _164.getCallingSessionId, 'call', _165 => _165()]);
15941
+ const parentSessionId = _optionalChain([manager, 'optionalAccess', _164 => _164.getStore, 'call', _165 => _165(), 'access', _166 => _166.getCallingSessionId, 'call', _167 => _167()]);
15803
15942
  if (!parentSessionId || associated.has(parentSessionId)) {
15804
15943
  break;
15805
15944
  }
@@ -15821,7 +15960,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15821
15960
  });
15822
15961
  this.permissionHandler.clearSessionPermissions(sessionId, {
15823
15962
  emitResolved: true,
15824
- preserveRelayed: _optionalChain([options, 'optionalAccess', _166 => _166.preserveRelayedPermissions])
15963
+ preserveRelayed: _optionalChain([options, 'optionalAccess', _168 => _168.preserveRelayedPermissions])
15825
15964
  });
15826
15965
  this.askUserHandler.clearSessionAskUserRequests(sessionId);
15827
15966
  this.sessionStateManager.clearConcurrentPrompts(sessionId);
@@ -15844,8 +15983,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15844
15983
  return false;
15845
15984
  }
15846
15985
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
15847
- if (_optionalChain([sessionManager, 'optionalAccess', _167 => _167.getDroidWorkingState, 'call', _168 => _168()]) !== "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */) {
15848
- _optionalChain([sessionManager, 'optionalAccess', _169 => _169.setWaitingForConfirmation, 'call', _170 => _170()]);
15986
+ if (_optionalChain([sessionManager, 'optionalAccess', _169 => _169.getDroidWorkingState, 'call', _170 => _170()]) !== "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */) {
15987
+ _optionalChain([sessionManager, 'optionalAccess', _171 => _171.setWaitingForConfirmation, 'call', _172 => _172()]);
15849
15988
  }
15850
15989
  return true;
15851
15990
  }
@@ -15952,7 +16091,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15952
16091
  for (const resolvedToolUseId of resolvedToolUseIds) {
15953
16092
  this.pendingUserActionStore.takeForToolUse(resolvedToolUseId);
15954
16093
  }
15955
- const associatedWaitingSessionIds = _nullishCoalesce(_optionalChain([permission, 'optionalAccess', _171 => _171.associatedSessionIds, 'access', _172 => _172.filter, 'call', _173 => _173((id) => id !== sessionId)]), () => ( []));
16094
+ const associatedWaitingSessionIds = _nullishCoalesce(_optionalChain([permission, 'optionalAccess', _173 => _173.associatedSessionIds, 'access', _174 => _174.filter, 'call', _175 => _175((id) => id !== sessionId)]), () => ( []));
15956
16095
  if (permission) {
15957
16096
  this.permissionHandler.resolvePermission(
15958
16097
  resolvedNotification.requestId,
@@ -15992,6 +16131,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
15992
16131
  break;
15993
16132
  }
15994
16133
  case "session_closed" /* SESSION_CLOSED */: {
16134
+ this.transportInterruptedPromptSessions.delete(sessionId);
16135
+ this.reconnectPromptSnapshotGraceConsumedSessions.delete(sessionId);
15995
16136
  this.trackedChildSessionIds.delete(sessionId);
15996
16137
  this.childSessionAttachmentGeneration.delete(sessionId);
15997
16138
  this.clearPendingUserActionsForSession(sessionId);
@@ -16001,12 +16142,17 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16001
16142
  }
16002
16143
  case "droid_working_state_changed" /* DROID_WORKING_STATE_CHANGED */: {
16003
16144
  if (notification.newState !== "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */) {
16145
+ if (this.transportInterruptedPromptSessions.has(sessionId)) {
16146
+ this.sessionStateManager.markSessionActive(sessionId);
16147
+ this.transportInterruptedPromptSessions.delete(sessionId);
16148
+ this.reconnectPromptSnapshotGraceConsumedSessions.delete(sessionId);
16149
+ }
16004
16150
  this.clearStalePromptsOnResume(sessionId);
16005
16151
  }
16006
16152
  break;
16007
16153
  }
16008
16154
  case "agent_turn_completed" /* AGENT_TURN_COMPLETED */:
16009
- _optionalChain([this, 'access', _174 => _174.sessionStateManager, 'access', _175 => _175.getSessionManager, 'call', _176 => _176(sessionId), 'optionalAccess', _177 => _177.getStore, 'call', _178 => _178(), 'access', _179 => _179.setAgentTurnCompletionReason, 'call', _180 => _180(notification.reason)]);
16155
+ _optionalChain([this, 'access', _176 => _176.sessionStateManager, 'access', _177 => _177.getSessionManager, 'call', _178 => _178(sessionId), 'optionalAccess', _179 => _179.getStore, 'call', _180 => _180(), 'access', _181 => _181.setAgentTurnCompletionReason, 'call', _182 => _182(notification.reason)]);
16010
16156
  this.updateSubagentInvocationSummaryFromState(
16011
16157
  sessionId,
16012
16158
  notification.reason
@@ -16030,7 +16176,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16030
16176
  break;
16031
16177
  }
16032
16178
  case "session_working_directory_changed" /* SESSION_WORKING_DIRECTORY_CHANGED */:
16033
- _optionalChain([this, 'access', _181 => _181.sessionStateManager, 'access', _182 => _182.getSessionManager, 'call', _183 => _183(sessionId), 'optionalAccess', _184 => _184.getStore, 'call', _185 => _185(), 'access', _186 => _186.setCwd, 'call', _187 => _187(notification.cwd)]);
16179
+ _optionalChain([this, 'access', _183 => _183.sessionStateManager, 'access', _184 => _184.getSessionManager, 'call', _185 => _185(sessionId), 'optionalAccess', _186 => _186.getStore, 'call', _187 => _187(), 'access', _188 => _188.setCwd, 'call', _189 => _189(notification.cwd)]);
16034
16180
  break;
16035
16181
  case "child_session_available" /* CHILD_SESSION_AVAILABLE */:
16036
16182
  this.handleChildSessionAvailable(notification, sessionId);
@@ -16043,6 +16189,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16043
16189
  case "structured_output" /* STRUCTURED_OUTPUT */:
16044
16190
  case "thinking_text_delta" /* THINKING_TEXT_DELTA */:
16045
16191
  case "assistant_text_complete" /* ASSISTANT_TEXT_COMPLETE */:
16192
+ case "assistant_message_retracted" /* ASSISTANT_MESSAGE_RETRACTED */:
16046
16193
  case "thinking_text_complete" /* THINKING_TEXT_COMPLETE */:
16047
16194
  case "mcp_auth_required" /* MCP_AUTH_REQUIRED */:
16048
16195
  case "mcp_auth_completed" /* MCP_AUTH_COMPLETED */:
@@ -16097,7 +16244,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16097
16244
  ...existing,
16098
16245
  status: taskInvocationStatusForCompletionReason(completionReason),
16099
16246
  ...summary && { toolUseCount: summary.toolUseCount },
16100
- ..._optionalChain([summary, 'optionalAccess', _188 => _188.durationMs]) !== void 0 && {
16247
+ ..._optionalChain([summary, 'optionalAccess', _190 => _190.durationMs]) !== void 0 && {
16101
16248
  durationMs: summary.durationMs
16102
16249
  }
16103
16250
  });
@@ -16150,7 +16297,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16150
16297
  async tryReplayBufferedPermission(sessionId, requestId) {
16151
16298
  const pending = this.permissionHandler.getPendingPermission(requestId);
16152
16299
  if (!pending) return;
16153
- const toolUseId = _optionalChain([pending, 'access', _189 => _189.toolUses, 'access', _190 => _190[0], 'optionalAccess', _191 => _191.toolUse, 'access', _192 => _192.id]);
16300
+ const toolUseId = _optionalChain([pending, 'access', _191 => _191.toolUses, 'access', _192 => _192[0], 'optionalAccess', _193 => _193.toolUse, 'access', _194 => _194.id]);
16154
16301
  if (!toolUseId) return;
16155
16302
  const stored = this.pendingUserActionStore.getForToolUse(toolUseId);
16156
16303
  if (!stored) return;
@@ -16350,7 +16497,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16350
16497
  }
16351
16498
  });
16352
16499
  this.messageRouter.on("notification", ({ notification, sessionId }) => {
16353
- const associatedPermissionSessionIds = notification.type === "permission_resolved" /* PERMISSION_RESOLVED */ ? _nullishCoalesce(_optionalChain([this, 'access', _193 => _193.permissionHandler, 'access', _194 => _194.getPendingPermission, 'call', _195 => _195(notification.requestId), 'optionalAccess', _196 => _196.associatedSessionIds, 'access', _197 => _197.filter, 'call', _198 => _198((id) => id !== sessionId)]), () => ( [])) : [];
16500
+ const associatedPermissionSessionIds = notification.type === "permission_resolved" /* PERMISSION_RESOLVED */ ? _nullishCoalesce(_optionalChain([this, 'access', _195 => _195.permissionHandler, 'access', _196 => _196.getPendingPermission, 'call', _197 => _197(notification.requestId), 'optionalAccess', _198 => _198.associatedSessionIds, 'access', _199 => _199.filter, 'call', _200 => _200((id) => id !== sessionId)]), () => ( [])) : [];
16354
16501
  this.emit("sessionNotification" /* SessionNotification */, {
16355
16502
  sessionId,
16356
16503
  notification
@@ -16480,7 +16627,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16480
16627
  return;
16481
16628
  }
16482
16629
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
16483
- _optionalChain([sessionManager, 'optionalAccess', _199 => _199.setWaitingForConfirmation, 'call', _200 => _200()]);
16630
+ _optionalChain([sessionManager, 'optionalAccess', _201 => _201.setWaitingForConfirmation, 'call', _202 => _202()]);
16484
16631
  this.emit("droidWorkingStateChanged" /* DroidWorkingStateChanged */, {
16485
16632
  sessionId,
16486
16633
  newState: "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */
@@ -16596,14 +16743,14 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16596
16743
  }
16597
16744
  );
16598
16745
  try {
16599
- const token = await this.config.getAccessToken();
16600
- if (!token) {
16746
+ const credential = await getDaemonAuthenticationCredential(this.config);
16747
+ if (!credential) {
16601
16748
  throw createConnectionFailure("no_token" /* NoToken */, {
16602
16749
  retryable: this.config.machineType === "local" /* Local */
16603
16750
  });
16604
16751
  }
16605
- const actAsGrant = await _optionalChain([this, 'access', _201 => _201.config, 'access', _202 => _202.getActAsGrant, 'optionalCall', _203 => _203()]);
16606
- await this.authenticateDaemon(token, actAsGrant);
16752
+ const actAsGrant = await _optionalChain([this, 'access', _203 => _203.config, 'access', _204 => _204.getActAsGrant, 'optionalCall', _205 => _205()]);
16753
+ await this.authenticateDaemon(credential, actAsGrant);
16607
16754
  this.lastConnectionFailure = null;
16608
16755
  Metrics.addToCounter(
16609
16756
  "factory_app_jsonrpc_authentication_success_count" /* FACTORY_APP_JSONRPC_AUTHENTICATION_SUCCESS_COUNT */,
@@ -16634,7 +16781,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16634
16781
  cause: _nullishCoalesce(failure.originalError, () => ( failure))
16635
16782
  });
16636
16783
  if (!preserved.retryable) {
16637
- _optionalChain([this, 'access', _204 => _204.config, 'access', _205 => _205.onAuthenticationError, 'optionalCall', _206 => _206(preserved)]);
16784
+ _optionalChain([this, 'access', _206 => _206.config, 'access', _207 => _207.onAuthenticationError, 'optionalCall', _208 => _208(preserved)]);
16638
16785
  }
16639
16786
  this.daemonClient.disconnect();
16640
16787
  this.emit("error", preserved);
@@ -16646,9 +16793,9 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16646
16793
  * Authenticate with the daemon. Translates daemon auth errors into
16647
16794
  * ConnectionFailureError.
16648
16795
  */
16649
- async authenticateDaemon(token, actAsGrant) {
16796
+ async authenticateDaemon(credential, actAsGrant) {
16650
16797
  try {
16651
- await this.authenticate(token, { actAsGrant });
16798
+ await this.authenticate(credential, { actAsGrant });
16652
16799
  } catch (error) {
16653
16800
  if (error instanceof JsonRpcRequestError) {
16654
16801
  throw createConnectionFailure(
@@ -16675,6 +16822,20 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16675
16822
  this._isAuthenticated = false;
16676
16823
  this.authenticationPromise = null;
16677
16824
  this.connectionGeneration += 1;
16825
+ for (const permission of this.permissionHandler.getPendingPermissions()) {
16826
+ this.sessionStateManager.markSessionInactive(permission.sessionId);
16827
+ this.transportInterruptedPromptSessions.add(permission.sessionId);
16828
+ this.reconnectPromptSnapshotGraceConsumedSessions.delete(
16829
+ permission.sessionId
16830
+ );
16831
+ }
16832
+ for (const request of this.askUserHandler.getPendingAskUserRequests()) {
16833
+ this.sessionStateManager.markSessionInactive(request.sessionId);
16834
+ this.transportInterruptedPromptSessions.add(request.sessionId);
16835
+ this.reconnectPromptSnapshotGraceConsumedSessions.delete(
16836
+ request.sessionId
16837
+ );
16838
+ }
16678
16839
  if (!this.lastConnectionFailure && !this.manuallyDisconnected) {
16679
16840
  this.lastConnectionFailure = createConnectionFailure(
16680
16841
  _nullishCoalesce(failureReasonFromCloseCode(code), () => ( "connection_lost")) /* ConnectionLost */
@@ -16800,12 +16961,12 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16800
16961
  * Authenticate the WebSocket connection with the daemon.
16801
16962
  * Requires an open transport and must complete before session operations.
16802
16963
  * Prevents concurrent authentication attempts.
16803
- * @param token - WorkOS JWT access token
16964
+ * @param credential - WorkOS JWT access token or Factory API key.
16804
16965
  * @param options.actAsGrant - act-as delegation grant (`fdg-...`). When
16805
16966
  * provided, the operator's `token` plus this grant authenticate the
16806
16967
  * connection as the target service account on an SA-owned daemon.
16807
16968
  */
16808
- async authenticate(token, options) {
16969
+ async authenticate(credential, options) {
16809
16970
  if (this._isAuthenticated) {
16810
16971
  logInfo("Already authenticated, skipping duplicate authenticate call");
16811
16972
  return;
@@ -16817,8 +16978,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16817
16978
  }
16818
16979
  const connectionId = this.daemonClient.getConnectionId();
16819
16980
  this.authenticationPromise = this.daemonClient.authenticate({
16820
- token,
16821
- ..._optionalChain([options, 'optionalAccess', _207 => _207.actAsGrant]) && { actAsGrant: options.actAsGrant },
16981
+ ...credential,
16982
+ ..._optionalChain([options, 'optionalAccess', _209 => _209.actAsGrant]) && { actAsGrant: options.actAsGrant },
16822
16983
  ...connectionId && { connectionId },
16823
16984
  caller: this.getFactoryClientType(),
16824
16985
  metadata: {
@@ -16838,8 +16999,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16838
16999
  this._isAuthenticated = true;
16839
17000
  logInfo("Daemon connection authenticated", {
16840
17001
  machineId: this.config.machineId,
16841
- userId: _optionalChain([result, 'optionalAccess', _208 => _208.userId]),
16842
- orgId: _optionalChain([result, 'optionalAccess', _209 => _209.orgId])
17002
+ userId: _optionalChain([result, 'optionalAccess', _210 => _210.userId]),
17003
+ orgId: _optionalChain([result, 'optionalAccess', _211 => _211.orgId])
16843
17004
  });
16844
17005
  } finally {
16845
17006
  this.authenticationPromise = null;
@@ -16862,7 +17023,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16862
17023
  this.reconnectTimer = null;
16863
17024
  }
16864
17025
  this.pendingChildSessionHydrations.clear();
16865
- _optionalChain([this, 'access', _210 => _210.delegatedReconnectAbort, 'optionalAccess', _211 => _211.abort, 'call', _212 => _212()]);
17026
+ _optionalChain([this, 'access', _212 => _212.delegatedReconnectAbort, 'optionalAccess', _213 => _213.abort, 'call', _214 => _214()]);
16866
17027
  this.delegatedReconnectAbort = null;
16867
17028
  this.isReconnecting = false;
16868
17029
  this._isAuthenticated = false;
@@ -16906,7 +17067,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16906
17067
  * eventually succeeded; otherwise it spawns a fresh attempt.
16907
17068
  */
16908
17069
  async initializeSessionWithRetry(params, options) {
16909
- const perAttemptTimeout = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _213 => _213.timeout]), () => ( INITIALIZE_SESSION_PER_ATTEMPT_TIMEOUT_MS));
17070
+ const perAttemptTimeout = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _215 => _215.timeout]), () => ( INITIALIZE_SESSION_PER_ATTEMPT_TIMEOUT_MS));
16910
17071
  const maxAttempts = INITIALIZE_SESSION_MAX_ATTEMPTS;
16911
17072
  let lastError;
16912
17073
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
@@ -16939,7 +17100,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16939
17100
  const initPromise = this.performInitializeSession(params, options);
16940
17101
  if (params.sessionId !== void 0) {
16941
17102
  this.sessionLoadInFlight.set(params.sessionId, initPromise);
16942
- _optionalChain([this, 'access', _214 => _214.daemonClient, 'access', _215 => _215.setPendingSessionReady, 'optionalCall', _216 => _216(params.sessionId, initPromise)]);
17103
+ _optionalChain([this, 'access', _216 => _216.daemonClient, 'access', _217 => _217.setPendingSessionReady, 'optionalCall', _218 => _218(params.sessionId, initPromise)]);
16943
17104
  try {
16944
17105
  return await initPromise;
16945
17106
  } finally {
@@ -16962,28 +17123,28 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16962
17123
  throw error;
16963
17124
  }
16964
17125
  if (result.session.title) {
16965
- _optionalChain([this, 'access', _217 => _217.sessionStateManager, 'access', _218 => _218.getSessionManager, 'call', _219 => _219(result.sessionId), 'optionalAccess', _220 => _220.getStore, 'call', _221 => _221(), 'access', _222 => _222.setTitle, 'call', _223 => _223(result.session.title)]);
17126
+ _optionalChain([this, 'access', _219 => _219.sessionStateManager, 'access', _220 => _220.getSessionManager, 'call', _221 => _221(result.sessionId), 'optionalAccess', _222 => _222.getStore, 'call', _223 => _223(), 'access', _224 => _224.setTitle, 'call', _225 => _225(result.session.title)]);
16966
17127
  }
16967
17128
  this.sessionStateManager.initializeSession(
16968
17129
  result.sessionId,
16969
17130
  result.session.messages
16970
17131
  );
16971
- const effectiveCwd = params.worktree === true ? _nullishCoalesce(_optionalChain([result, 'access', _224 => _224.worktree, 'optionalAccess', _225 => _225.path]), () => ( params.cwd)) : params.cwd;
17132
+ const effectiveCwd = params.worktree === true ? _nullishCoalesce(_optionalChain([result, 'access', _226 => _226.worktree, 'optionalAccess', _227 => _227.path]), () => ( params.cwd)) : params.cwd;
16972
17133
  const sessionManager = this.sessionStateManager.getSessionManager(
16973
17134
  result.sessionId
16974
17135
  );
16975
- _optionalChain([sessionManager, 'optionalAccess', _226 => _226.getStore, 'call', _227 => _227(), 'access', _228 => _228.setCwd, 'call', _229 => _229(_nullishCoalesce(effectiveCwd, () => ( null)))]);
17136
+ _optionalChain([sessionManager, 'optionalAccess', _228 => _228.getStore, 'call', _229 => _229(), 'access', _230 => _230.setCwd, 'call', _231 => _231(_nullishCoalesce(effectiveCwd, () => ( null)))]);
16976
17137
  const { callingSessionId, callingToolUseId } = getSubagentCallingMetadata2(
16977
17138
  params.tags
16978
17139
  );
16979
17140
  if (result.session.title) {
16980
- _optionalChain([sessionManager, 'optionalAccess', _230 => _230.getStore, 'call', _231 => _231(), 'access', _232 => _232.setTitle, 'call', _233 => _233(result.session.title)]);
17141
+ _optionalChain([sessionManager, 'optionalAccess', _232 => _232.getStore, 'call', _233 => _233(), 'access', _234 => _234.setTitle, 'call', _235 => _235(result.session.title)]);
16981
17142
  }
16982
17143
  if (callingSessionId) {
16983
- _optionalChain([sessionManager, 'optionalAccess', _234 => _234.getStore, 'call', _235 => _235(), 'access', _236 => _236.setCallingSessionId, 'call', _237 => _237(callingSessionId)]);
17144
+ _optionalChain([sessionManager, 'optionalAccess', _236 => _236.getStore, 'call', _237 => _237(), 'access', _238 => _238.setCallingSessionId, 'call', _239 => _239(callingSessionId)]);
16984
17145
  }
16985
17146
  if (callingToolUseId) {
16986
- _optionalChain([sessionManager, 'optionalAccess', _238 => _238.getStore, 'call', _239 => _239(), 'access', _240 => _240.setCallingToolUseId, 'call', _241 => _241(callingToolUseId)]);
17147
+ _optionalChain([sessionManager, 'optionalAccess', _240 => _240.getStore, 'call', _241 => _241(), 'access', _242 => _242.setCallingToolUseId, 'call', _243 => _243(callingToolUseId)]);
16987
17148
  }
16988
17149
  this.sessionStateManager.setSessionLoadOptions(
16989
17150
  result.sessionId,
@@ -16998,13 +17159,13 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
16998
17159
  sessionId: result.sessionId,
16999
17160
  hostId: result.hostId,
17000
17161
  cwd: effectiveCwd,
17001
- repoRoot: _optionalChain([result, 'access', _242 => _242.worktree, 'optionalAccess', _243 => _243.repoRoot]),
17162
+ repoRoot: _optionalChain([result, 'access', _244 => _244.worktree, 'optionalAccess', _245 => _245.repoRoot]),
17002
17163
  // Reflect only what the connected daemon actually reported. Never
17003
17164
  // synthesize a lifecycle from `params.worktreeLifecycle` (the value the
17004
17165
  // client asked for, which an older daemon may not have honored). A
17005
17166
  // reported worktree with no lifecycle is passed through as it stands:
17006
17167
  // the daemon records none for a checkout it adopted rather than created.
17007
- worktree: _optionalChain([result, 'access', _244 => _244.worktree, 'optionalAccess', _245 => _245.repoRoot]) ? {
17168
+ worktree: _optionalChain([result, 'access', _246 => _246.worktree, 'optionalAccess', _247 => _247.repoRoot]) ? {
17008
17169
  branch: result.worktree.branch,
17009
17170
  lifecycle: result.worktree.lifecycle,
17010
17171
  ...result.worktree.parentWorktreePath ? { parentWorktreePath: result.worktree.parentWorktreePath } : {},
@@ -17089,6 +17250,14 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17089
17250
  sessionSource: void 0
17090
17251
  });
17091
17252
  }
17253
+ /**
17254
+ * Whether this controller currently owns an initialize or load operation for
17255
+ * the session. A false result after a failed operation means shared Loading
17256
+ * or Loaded state has no newer operation responsible for completing it.
17257
+ */
17258
+ isSessionLoadInFlight(sessionId) {
17259
+ return this.sessionLoadInFlight.has(sessionId);
17260
+ }
17092
17261
  /**
17093
17262
  * Ensures the current daemon connection is subscribed to a child session.
17094
17263
  * Loaded state only describes the local snapshot; listener attachment is
@@ -17174,10 +17343,11 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17174
17343
  params.sessionId,
17175
17344
  this.config.machineId
17176
17345
  );
17177
- const workingStateRevisionBeforeLoad = _nullishCoalesce(_optionalChain([this, 'access', _246 => _246.sessionStateManager, 'access', _247 => _247.getSessionManager, 'call', _248 => _248(params.sessionId), 'optionalAccess', _249 => _249.getWorkingStateRevision, 'call', _250 => _250()]), () => ( 0));
17178
- const fetched = await this.config.getAccessToken();
17179
- if (fetched === null) {
17180
- throw new MetaError("No access token available for loadSession", {
17346
+ const workingStateRevisionBeforeLoad = _nullishCoalesce(_optionalChain([this, 'access', _248 => _248.sessionStateManager, 'access', _249 => _249.getSessionManager, 'call', _250 => _250(params.sessionId), 'optionalAccess', _251 => _251.getWorkingStateRevision, 'call', _252 => _252()]), () => ( 0));
17347
+ const subagentSummaryRevisionBeforeLoad = this.sessionStateManager.captureSubagentInvocationSummaryRevision();
17348
+ const credential = await getDaemonAuthenticationCredential(this.config);
17349
+ if (credential === null) {
17350
+ throw new MetaError("No credential available for loadSession", {
17181
17351
  sessionId: params.sessionId
17182
17352
  });
17183
17353
  }
@@ -17186,10 +17356,13 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17186
17356
  stashedOptions,
17187
17357
  params
17188
17358
  );
17359
+ const spawnCredential = credential.token !== void 0 ? credential.token : credential.apiKey;
17189
17360
  const resolvedParams = {
17190
17361
  ...params,
17191
17362
  structuredOutputFormat,
17192
- token: fetched,
17363
+ // The daemon currently discards this legacy spawn-auth field on load.
17364
+ // Connection authentication above preserves the credential kind.
17365
+ token: spawnCredential,
17193
17366
  loadAllMessages: this.getClientType() === "cli" ? params.loadAllMessages : true,
17194
17367
  messageLimit: _nullishCoalesce(params.messageLimit, () => ( this.config.defaultMessageLimit)),
17195
17368
  disableInactivityTimeout: _nullishCoalesce(_nullishCoalesce(params.disableInactivityTimeout, () => ( stashedOptions.disableInactivityTimeout)), () => ( this.config.disableInactivityTimeout)),
@@ -17204,22 +17377,23 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17204
17377
  disableBuiltinSkills: resolvedParams.disableBuiltinSkills,
17205
17378
  skipPermissionsUnsafe: resolvedParams.skipPermissionsUnsafe,
17206
17379
  runtimeSettingsPath: resolvedParams.runtimeSettingsPath,
17207
- structuredOutputFormat
17380
+ structuredOutputFormat,
17381
+ taskSubagentProcess: resolvedParams.taskSubagentProcess
17208
17382
  })
17209
17383
  );
17210
17384
  let result;
17211
17385
  let reportedWorkingState;
17212
17386
  let didHydrateReportedWorkingState = false;
17213
17387
  const loadPromise = this.daemonClient.loadSession(resolvedParams);
17214
- _optionalChain([this, 'access', _251 => _251.daemonClient, 'access', _252 => _252.setPendingSessionReady, 'optionalCall', _253 => _253(params.sessionId, loadPromise)]);
17388
+ _optionalChain([this, 'access', _253 => _253.daemonClient, 'access', _254 => _254.setPendingSessionReady, 'optionalCall', _255 => _255(params.sessionId, loadPromise)]);
17215
17389
  try {
17216
17390
  result = await loadPromise;
17217
17391
  reportedWorkingState = result.workingState !== void 0 && result.workingState !== "idle" /* Idle */ ? result.workingState : result.isAgentLoopInProgress ? "streaming_assistant_message" /* StreamingAssistantMessage */ : "idle" /* Idle */;
17218
17392
  const sessionManager2 = this.sessionStateManager.getSessionManager(
17219
17393
  params.sessionId
17220
17394
  );
17221
- const shouldHydrateReportedWorkingState = _optionalChain([sessionManager2, 'optionalAccess', _254 => _254.getWorkingStateRevision, 'call', _255 => _255()]) === workingStateRevisionBeforeLoad;
17222
- didHydrateReportedWorkingState = shouldHydrateReportedWorkingState && _optionalChain([sessionManager2, 'optionalAccess', _256 => _256.getDroidWorkingState, 'call', _257 => _257()]) !== reportedWorkingState;
17395
+ const shouldHydrateReportedWorkingState = _optionalChain([sessionManager2, 'optionalAccess', _256 => _256.getWorkingStateRevision, 'call', _257 => _257()]) === workingStateRevisionBeforeLoad;
17396
+ didHydrateReportedWorkingState = shouldHydrateReportedWorkingState && _optionalChain([sessionManager2, 'optionalAccess', _258 => _258.getDroidWorkingState, 'call', _259 => _259()]) !== reportedWorkingState;
17223
17397
  this.sessionStateManager.loadSession(
17224
17398
  params.sessionId,
17225
17399
  this.config.machineId,
@@ -17233,13 +17407,14 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17233
17407
  );
17234
17408
  if (result.subagentInvocations && result.subagentInvocations.length > 0) {
17235
17409
  this.sessionStateManager.hydrateSubagentInvocationSummaries(
17236
- result.subagentInvocations
17410
+ result.subagentInvocations,
17411
+ subagentSummaryRevisionBeforeLoad
17237
17412
  );
17238
17413
  }
17239
17414
  } catch (error) {
17240
17415
  const sessionRpcError = error instanceof JsonRpcRequestError2 ? error.rpcError : void 0;
17241
17416
  const daemonRpcError = error instanceof JsonRpcRequestError ? error.error : void 0;
17242
- const errorCode = _nullishCoalesce(_nullishCoalesce(_optionalChain([sessionRpcError, 'optionalAccess', _258 => _258.code]), () => ( _optionalChain([daemonRpcError, 'optionalAccess', _259 => _259.code]))), () => ( void 0));
17417
+ const errorCode = _nullishCoalesce(_nullishCoalesce(_optionalChain([sessionRpcError, 'optionalAccess', _260 => _260.code]), () => ( _optionalChain([daemonRpcError, 'optionalAccess', _261 => _261.code]))), () => ( void 0));
17243
17418
  const isSessionNotFound = errorCode === -32004 /* ENTITY_NOT_FOUND */;
17244
17419
  if (isSessionNotFound) {
17245
17420
  this.sessionStateManager.markSessionNotFound(params.sessionId);
@@ -17289,16 +17464,42 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17289
17464
  settings: result.settings
17290
17465
  });
17291
17466
  let hasPendingAskUserRequests = false;
17467
+ let shouldKeepPromptSessionInactive = false;
17292
17468
  try {
17293
- this.permissionHandler.clearSessionPermissions(params.sessionId, {
17294
- preserveRelayed: true
17295
- });
17469
+ const isReconnectingPromptSession = this.transportInterruptedPromptSessions.has(params.sessionId);
17470
+ const reconnectGraceAlreadyConsumed = this.reconnectPromptSnapshotGraceConsumedSessions.has(params.sessionId);
17471
+ const localPermissions = this.permissionHandler.getPendingPermissions().filter((permission) => permission.sessionId === params.sessionId);
17472
+ const localAskUserRequests = this.askUserHandler.getPendingAskUserRequests().filter((request) => request.sessionId === params.sessionId);
17296
17473
  const reloadedPermissions = _nullishCoalesce(result.pendingPermissions, () => ( []));
17474
+ const reloadedPermissionToolUseIds = new Set(
17475
+ reloadedPermissions.flatMap(
17476
+ (permission) => (_nullishCoalesce(permission.toolUses, () => ( []))).map((toolUse) => toolUse.toolUse.id)
17477
+ )
17478
+ );
17479
+ const reloadedAskUserToolCallIds = new Set(
17480
+ (_nullishCoalesce(result.pendingAskUserRequests, () => ( []))).map(
17481
+ (request) => request.toolCallId
17482
+ )
17483
+ );
17484
+ const reconnectSnapshotConfirmsLocalPrompts = localPermissions.every(
17485
+ (permission) => permission.toolUses.some(
17486
+ (toolUse) => reloadedPermissionToolUseIds.has(toolUse.toolUse.id)
17487
+ )
17488
+ ) && localAskUserRequests.every(
17489
+ (request) => reloadedAskUserToolCallIds.has(request.toolCallId)
17490
+ );
17491
+ const shouldPreserveLocalPrompts = isReconnectingPromptSession && !reconnectGraceAlreadyConsumed;
17492
+ shouldKeepPromptSessionInactive = shouldPreserveLocalPrompts && !reconnectSnapshotConfirmsLocalPrompts;
17493
+ if (!shouldPreserveLocalPrompts) {
17494
+ this.permissionHandler.clearSessionPermissions(params.sessionId, {
17495
+ preserveRelayed: true
17496
+ });
17497
+ }
17297
17498
  let surfacedPermissionCount = 0;
17298
17499
  if (reloadedPermissions.length > 0) {
17299
17500
  const invalidPermissions = [];
17300
17501
  for (const permissionRequest of reloadedPermissions) {
17301
- const reloadedToolUseId = _optionalChain([permissionRequest, 'access', _260 => _260.toolUses, 'optionalAccess', _261 => _261[0], 'optionalAccess', _262 => _262.toolUse, 'optionalAccess', _263 => _263.id]);
17502
+ const reloadedToolUseId = _optionalChain([permissionRequest, 'access', _262 => _262.toolUses, 'optionalAccess', _263 => _263[0], 'optionalAccess', _264 => _264.toolUse, 'optionalAccess', _265 => _265.id]);
17302
17503
  if (reloadedToolUseId) {
17303
17504
  const replayed = await this.replayBufferedPermissionOnLoad({
17304
17505
  sessionId: params.sessionId,
@@ -17343,7 +17544,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17343
17544
  );
17344
17545
  invalidPermissions.push({
17345
17546
  requestId: permissionRequest.requestId,
17346
- toolUseId: _nullishCoalesce(_optionalChain([permissionRequest, 'access', _264 => _264.toolUses, 'optionalAccess', _265 => _265[0], 'optionalAccess', _266 => _266.toolUse, 'optionalAccess', _267 => _267.id]), () => ( "unknown")),
17547
+ toolUseId: _nullishCoalesce(_optionalChain([permissionRequest, 'access', _266 => _266.toolUses, 'optionalAccess', _267 => _267[0], 'optionalAccess', _268 => _268.toolUse, 'optionalAccess', _269 => _269.id]), () => ( "unknown")),
17347
17548
  error: request.error.message
17348
17549
  });
17349
17550
  continue;
@@ -17394,9 +17595,11 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17394
17595
  reloadedPermissions
17395
17596
  );
17396
17597
  }
17397
- this.askUserHandler.clearSessionAskUserRequests(params.sessionId);
17398
- hasPendingAskUserRequests = !!(result.pendingAskUserRequests && result.pendingAskUserRequests.length > 0);
17399
- if (hasPendingAskUserRequests) {
17598
+ if (!shouldPreserveLocalPrompts) {
17599
+ this.askUserHandler.clearSessionAskUserRequests(params.sessionId);
17600
+ }
17601
+ const hasReloadedAskUserRequests = !!(result.pendingAskUserRequests && result.pendingAskUserRequests.length > 0);
17602
+ if (hasReloadedAskUserRequests) {
17400
17603
  for (const askUserRequest of result.pendingAskUserRequests) {
17401
17604
  const request = DaemonAskUserSchema.safeParse({
17402
17605
  type: "request",
@@ -17441,8 +17644,17 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17441
17644
  result.pendingAskUserRequests
17442
17645
  );
17443
17646
  }
17647
+ hasPendingAskUserRequests = this.askUserHandler.getPendingAskUserRequests().some((request) => request.sessionId === params.sessionId);
17444
17648
  } finally {
17445
- this.sessionStateManager.markSessionActive(params.sessionId);
17649
+ if (shouldKeepPromptSessionInactive) {
17650
+ this.reconnectPromptSnapshotGraceConsumedSessions.add(params.sessionId);
17651
+ } else {
17652
+ this.sessionStateManager.markSessionActive(params.sessionId);
17653
+ this.transportInterruptedPromptSessions.delete(params.sessionId);
17654
+ this.reconnectPromptSnapshotGraceConsumedSessions.delete(
17655
+ params.sessionId
17656
+ );
17657
+ }
17446
17658
  }
17447
17659
  if (sessionManager) {
17448
17660
  await reconcileQueuedMessagesAfterLoad({
@@ -17499,13 +17711,13 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17499
17711
  if (sessionManager && result.callingToolUseId) {
17500
17712
  sessionManager.getStore().setCallingToolUseId(result.callingToolUseId);
17501
17713
  }
17502
- if (sessionManager && _optionalChain([result, 'access', _268 => _268.settings, 'optionalAccess', _269 => _269.tags]) !== void 0) {
17714
+ if (sessionManager && _optionalChain([result, 'access', _270 => _270.settings, 'optionalAccess', _271 => _271.tags]) !== void 0) {
17503
17715
  sessionManager.getStore().setTags(result.settings.tags);
17504
17716
  }
17505
17717
  if (result.mission) {
17506
17718
  const missionStore = this.getMissionStoreForSession(params.sessionId);
17507
17719
  if (missionStore) {
17508
- _optionalChain([missionStore, 'access', _270 => _270.setTitle, 'optionalCall', _271 => _271(_nullishCoalesce(result.mission.title, () => ( null)))]);
17720
+ _optionalChain([missionStore, 'access', _272 => _272.setTitle, 'optionalCall', _273 => _273(_nullishCoalesce(result.mission.title, () => ( null)))]);
17509
17721
  missionStore.setState(result.mission.state);
17510
17722
  missionStore.setFeatures(result.mission.features);
17511
17723
  missionStore.setProgressLog(result.mission.progressLog);
@@ -17514,7 +17726,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17514
17726
  );
17515
17727
  const workerStates = result.mission.workerStates;
17516
17728
  for (const workerSessionId of result.mission.workerSessionIds) {
17517
- const workerState = _optionalChain([workerStates, 'optionalAccess', _272 => _272[workerSessionId]]);
17729
+ const workerState = _optionalChain([workerStates, 'optionalAccess', _274 => _274[workerSessionId]]);
17518
17730
  if (workerState) {
17519
17731
  missionStore.addWorkerWithState(workerSessionId, workerState);
17520
17732
  } else {
@@ -17550,7 +17762,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17550
17762
  callingSessionId: result.callingSessionId,
17551
17763
  callingToolUseId: result.callingToolUseId,
17552
17764
  decompSessionType: result.decompSessionType,
17553
- tags: _optionalChain([result, 'access', _273 => _273.settings, 'optionalAccess', _274 => _274.tags])
17765
+ tags: _optionalChain([result, 'access', _275 => _275.settings, 'optionalAccess', _276 => _276.tags])
17554
17766
  });
17555
17767
  logInfo("[DaemonSessionController] Session loaded", {
17556
17768
  sessionId: params.sessionId
@@ -17560,7 +17772,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17560
17772
  async addUserMessage(sessionId, params, externalRequestId) {
17561
17773
  let sessionManager = this.sessionStateManager.getSessionManager(sessionId);
17562
17774
  const requestId = _nullishCoalesce(externalRequestId, () => ( _uuid.v4.call(void 0, )));
17563
- const wasOptimisticallySubmittedWhileIdleBeforeRequest = _optionalChain([sessionManager, 'optionalAccess', _275 => _275.getDroidWorkingState, 'call', _276 => _276()]) === "idle" /* Idle */ && sessionManager.getOptimisticMessage(requestId) !== void 0;
17775
+ const wasOptimisticallySubmittedWhileIdleBeforeRequest = _optionalChain([sessionManager, 'optionalAccess', _277 => _277.getDroidWorkingState, 'call', _278 => _278()]) === "idle" /* Idle */ && sessionManager.getOptimisticMessage(requestId) !== void 0;
17564
17776
  const content = buildUserMessageContentBlocks2({
17565
17777
  text: params.text,
17566
17778
  content: params.content,
@@ -17573,9 +17785,9 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17573
17785
  type: f.type,
17574
17786
  mediaType: f.mediaType,
17575
17787
  hasData: Boolean(f.data),
17576
- dataLength: _nullishCoalesce(_optionalChain([f, 'access', _277 => _277.data, 'optionalAccess', _278 => _278.length]), () => ( 0)),
17788
+ dataLength: _nullishCoalesce(_optionalChain([f, 'access', _279 => _279.data, 'optionalAccess', _280 => _280.length]), () => ( 0)),
17577
17789
  hasParsedData: "parsedData" in f && Boolean(f.parsedData),
17578
- parsedDataLength: "parsedData" in f ? _nullishCoalesce(_optionalChain([f, 'access', _279 => _279.parsedData, 'optionalAccess', _280 => _280.length]), () => ( 0)) : 0
17790
+ parsedDataLength: "parsedData" in f ? _nullishCoalesce(_optionalChain([f, 'access', _281 => _281.parsedData, 'optionalAccess', _282 => _282.length]), () => ( 0)) : 0
17579
17791
  }));
17580
17792
  logInfo("[DaemonSessionController] Sending files with message", {
17581
17793
  sessionId,
@@ -17601,8 +17813,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17601
17813
  this.inFlightAddUserMessageRequests.delete(requestId);
17602
17814
  const wasConfirmedWhileRequestPending = this.confirmedInFlightAddUserMessageRequests.delete(requestId);
17603
17815
  sessionManager = _nullishCoalesce(this.sessionStateManager.getSessionManager(sessionId), () => ( sessionManager));
17604
- const isDroidIdle = _optionalChain([sessionManager, 'optionalAccess', _281 => _281.getDroidWorkingState, 'call', _282 => _282()]) === "idle" /* Idle */;
17605
- const wasOptimisticallySubmittedWhileIdle = wasOptimisticallySubmittedWhileIdleBeforeRequest || _optionalChain([sessionManager, 'optionalAccess', _283 => _283.getOptimisticMessage, 'call', _284 => _284(requestId)]) !== void 0;
17816
+ const isDroidIdle = _optionalChain([sessionManager, 'optionalAccess', _283 => _283.getDroidWorkingState, 'call', _284 => _284()]) === "idle" /* Idle */;
17817
+ const wasOptimisticallySubmittedWhileIdle = wasOptimisticallySubmittedWhileIdleBeforeRequest || _optionalChain([sessionManager, 'optionalAccess', _285 => _285.getOptimisticMessage, 'call', _286 => _286(requestId)]) !== void 0;
17606
17818
  if (params.skipAgentLoop) {
17607
17819
  logInfo(
17608
17820
  "[DaemonSessionController] User message added without agent loop",
@@ -17615,7 +17827,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17615
17827
  );
17616
17828
  } else if (params.queuePlacement !== "end_of_loop" /* EndOfLoop */ && (isDroidIdle || wasOptimisticallySubmittedWhileIdle)) {
17617
17829
  if (isDroidIdle) {
17618
- _optionalChain([sessionManager, 'optionalAccess', _285 => _285.startStreaming, 'call', _286 => _286()]);
17830
+ _optionalChain([sessionManager, 'optionalAccess', _287 => _287.startStreaming, 'call', _288 => _288()]);
17619
17831
  this.emit("droidWorkingStateChanged" /* DroidWorkingStateChanged */, {
17620
17832
  sessionId,
17621
17833
  newState: "streaming_assistant_message" /* StreamingAssistantMessage */
@@ -17624,7 +17836,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17624
17836
  logInfo("[DaemonSessionController] User message processing immediately", {
17625
17837
  sessionId,
17626
17838
  requestId,
17627
- state: _optionalChain([sessionManager, 'optionalAccess', _287 => _287.getDroidWorkingState, 'call', _288 => _288()]),
17839
+ state: _optionalChain([sessionManager, 'optionalAccess', _289 => _289.getDroidWorkingState, 'call', _290 => _290()]),
17628
17840
  reason: wasOptimisticallySubmittedWhileIdle ? "optimistically_submitted_while_idle" : "droid_idle"
17629
17841
  });
17630
17842
  } else {
@@ -17728,8 +17940,13 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17728
17940
  /**
17729
17941
  * Close a session. Used to terminate a worker session cleanly.
17730
17942
  */
17731
- async closeSession(sessionId) {
17732
- await this.daemonClient.closeSession({ sessionId });
17943
+ async closeSession(sessionId, options) {
17944
+ await this.daemonClient.closeSession({
17945
+ sessionId,
17946
+ ..._optionalChain([options, 'optionalAccess', _291 => _291.preserveEmptyDraft]) !== void 0 && {
17947
+ preserveEmptyDraft: options.preserveEmptyDraft
17948
+ }
17949
+ });
17733
17950
  this.sessionStateManager.deleteSessionLoadOptions(sessionId);
17734
17951
  this.sessionLoadInFlight.delete(sessionId);
17735
17952
  this.trackedChildSessionIds.delete(sessionId);
@@ -17768,7 +17985,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17768
17985
  }
17769
17986
  async createTerminal(sessionId, params) {
17770
17987
  const sessionManagerForCwd = this.sessionStateManager.getSessionManager(sessionId);
17771
- const cwd = _optionalChain([sessionManagerForCwd, 'optionalAccess', _289 => _289.getStore, 'call', _290 => _290(), 'access', _291 => _291.getCwd, 'call', _292 => _292()]);
17988
+ const cwd = _optionalChain([sessionManagerForCwd, 'optionalAccess', _292 => _292.getStore, 'call', _293 => _293(), 'access', _294 => _294.getCwd, 'call', _295 => _295()]);
17772
17989
  const requestParams = {
17773
17990
  ...params,
17774
17991
  sessionId
@@ -17803,7 +18020,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17803
18020
  async listGitBranches(cwd, options) {
17804
18021
  return this.daemonClient.listGitBranches({
17805
18022
  cwd,
17806
- ..._optionalChain([options, 'optionalAccess', _293 => _293.includeOriginBranches]) === true ? { includeOriginBranches: true } : {}
18023
+ ..._optionalChain([options, 'optionalAccess', _296 => _296.includeOriginBranches]) === true ? { includeOriginBranches: true } : {}
17807
18024
  });
17808
18025
  }
17809
18026
  async checkoutGitBranch(params) {
@@ -17945,7 +18162,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17945
18162
  }
17946
18163
  getActiveTerminalId(sessionId) {
17947
18164
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
17948
- return _nullishCoalesce(_optionalChain([sessionManager, 'optionalAccess', _294 => _294.getActiveTerminalId, 'call', _295 => _295()]), () => ( null));
18165
+ return _nullishCoalesce(_optionalChain([sessionManager, 'optionalAccess', _297 => _297.getActiveTerminalId, 'call', _298 => _298()]), () => ( null));
17949
18166
  }
17950
18167
  async updateSessionSettings(sessionId, params) {
17951
18168
  const { specModeModelId, specModeReasoningEffort, ...settings } = params;
@@ -17978,8 +18195,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
17978
18195
  async forkSession(sessionId, options) {
17979
18196
  return this.daemonClient.forkSession({
17980
18197
  sessionId,
17981
- title: _optionalChain([options, 'optionalAccess', _296 => _296.title]),
17982
- tags: _optionalChain([options, 'optionalAccess', _297 => _297.tags])
18198
+ title: _optionalChain([options, 'optionalAccess', _299 => _299.title]),
18199
+ tags: _optionalChain([options, 'optionalAccess', _300 => _300.tags])
17983
18200
  });
17984
18201
  }
17985
18202
  async getContextBreakdown(sessionId) {
@@ -18037,7 +18254,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18037
18254
  }
18038
18255
  async changeWorkingDirectory(params) {
18039
18256
  const result = await this.daemonClient.changeWorkingDirectory(params);
18040
- _optionalChain([this, 'access', _298 => _298.sessionStateManager, 'access', _299 => _299.getSessionManager, 'call', _300 => _300(params.sessionId), 'optionalAccess', _301 => _301.getStore, 'call', _302 => _302(), 'access', _303 => _303.setCwd, 'call', _304 => _304(result.resolvedPath)]);
18257
+ _optionalChain([this, 'access', _301 => _301.sessionStateManager, 'access', _302 => _302.getSessionManager, 'call', _303 => _303(params.sessionId), 'optionalAccess', _304 => _304.getStore, 'call', _305 => _305(), 'access', _306 => _306.setCwd, 'call', _307 => _307(result.resolvedPath)]);
18041
18258
  return result;
18042
18259
  }
18043
18260
  async toggleMcpServer(params) {
@@ -18066,8 +18283,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18066
18283
  async listFilesWithMetadata(sessionId, options) {
18067
18284
  const result = await this.daemonClient.listFiles({
18068
18285
  sessionId,
18069
- showHidden: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _305 => _305.showHidden]), () => ( false)),
18070
- ..._optionalChain([options, 'optionalAccess', _306 => _306.path]) !== void 0 ? { path: options.path } : {}
18286
+ showHidden: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _308 => _308.showHidden]), () => ( false)),
18287
+ ..._optionalChain([options, 'optionalAccess', _309 => _309.path]) !== void 0 ? { path: options.path } : {}
18071
18288
  });
18072
18289
  return result;
18073
18290
  }
@@ -18462,7 +18679,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18462
18679
  );
18463
18680
  }
18464
18681
  if (this.sessionStateManager.isSessionInactive(executionSessionId)) {
18465
- const toolUseId = _optionalChain([permission, 'access', _307 => _307.toolUses, 'access', _308 => _308[0], 'optionalAccess', _309 => _309.toolUse, 'access', _310 => _310.id]);
18682
+ const toolUseId = _optionalChain([permission, 'access', _310 => _310.toolUses, 'access', _311 => _311[0], 'optionalAccess', _312 => _312.toolUse, 'access', _313 => _313.id]);
18466
18683
  if (toolUseId) {
18467
18684
  this.pendingUserActionStore.savePermission({
18468
18685
  kind: "permission",
@@ -18488,7 +18705,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18488
18705
  const isRelayedPermission = permission.associatedSessionIds.some(
18489
18706
  (id) => id !== executionSessionId
18490
18707
  );
18491
- const responseToolUseId = _optionalChain([permission, 'access', _311 => _311.toolUses, 'access', _312 => _312[0], 'optionalAccess', _313 => _313.toolUse, 'access', _314 => _314.id]);
18708
+ const responseToolUseId = _optionalChain([permission, 'access', _314 => _314.toolUses, 'access', _315 => _315[0], 'optionalAccess', _316 => _316.toolUse, 'access', _317 => _317.id]);
18492
18709
  if (isRelayedPermission && responseToolUseId) {
18493
18710
  this.pendingUserActionStore.savePermission({
18494
18711
  kind: "permission",
@@ -18625,7 +18842,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18625
18842
  * Returns true when there's no failure, or the failure is retryable.
18626
18843
  */
18627
18844
  isRetryAllowed() {
18628
- return _optionalChain([this, 'access', _315 => _315.lastConnectionFailure, 'optionalAccess', _316 => _316.retryable]) !== false;
18845
+ return _optionalChain([this, 'access', _318 => _318.lastConnectionFailure, 'optionalAccess', _319 => _319.retryable]) !== false;
18629
18846
  }
18630
18847
  /**
18631
18848
  * Whether this connection can serve RPCs: socket open AND authenticated.
@@ -18679,7 +18896,7 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18679
18896
  * exact owned record.
18680
18897
  */
18681
18898
  getPromptOwnership(prompt) {
18682
- const machineId = prompt.machineId || _optionalChain([this, 'access', _317 => _317.sessionStateManager, 'access', _318 => _318.getSessionManager, 'call', _319 => _319(prompt.sessionId), 'optionalAccess', _320 => _320.getMachineId, 'call', _321 => _321()]);
18899
+ const machineId = prompt.machineId || _optionalChain([this, 'access', _320 => _320.sessionStateManager, 'access', _321 => _321.getSessionManager, 'call', _322 => _322(prompt.sessionId), 'optionalAccess', _323 => _323.getMachineId, 'call', _324 => _324()]);
18683
18900
  if (!machineId) {
18684
18901
  return "unknown";
18685
18902
  }
@@ -18691,6 +18908,19 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18691
18908
  getMachineType() {
18692
18909
  return this.config.machineType;
18693
18910
  }
18911
+ /**
18912
+ * Refresh connection lifecycle data that may change while a Computer
18913
+ * controller remains registered under the same machine id.
18914
+ */
18915
+ updateComputerEnsureRunning(ensureRunning) {
18916
+ if (this.config.machineType !== "computer" /* Computer */) {
18917
+ return;
18918
+ }
18919
+ this.config = {
18920
+ ...this.config,
18921
+ ensureRunning
18922
+ };
18923
+ }
18694
18924
  /**
18695
18925
  * Get the machine connection type for this daemon client.
18696
18926
  *
@@ -18760,14 +18990,14 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18760
18990
  */
18761
18991
  getTerminalSerializedState(sessionId, terminalId) {
18762
18992
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
18763
- return _optionalChain([sessionManager, 'optionalAccess', _322 => _322.getTerminalSerializedState, 'call', _323 => _323(terminalId)]);
18993
+ return _optionalChain([sessionManager, 'optionalAccess', _325 => _325.getTerminalSerializedState, 'call', _326 => _326(terminalId)]);
18764
18994
  }
18765
18995
  /**
18766
18996
  * Get buffered data that arrived while terminal was unmounted.
18767
18997
  */
18768
18998
  getTerminalBufferedData(sessionId, terminalId) {
18769
18999
  const sessionManager = this.sessionStateManager.getSessionManager(sessionId);
18770
- return _optionalChain([sessionManager, 'optionalAccess', _324 => _324.getTerminalBufferedData, 'call', _325 => _325(terminalId)]);
19000
+ return _optionalChain([sessionManager, 'optionalAccess', _327 => _327.getTerminalBufferedData, 'call', _328 => _328(terminalId)]);
18771
19001
  }
18772
19002
  /**
18773
19003
  * Clear restoration state after terminal is successfully restored.
@@ -18797,6 +19027,8 @@ var DaemonSessionController = (_class11 = class _DaemonSessionController extends
18797
19027
  this.sessionLoadInFlight.clear();
18798
19028
  this.trackedChildSessionIds.clear();
18799
19029
  this.childSessionAttachmentGeneration.clear();
19030
+ this.transportInterruptedPromptSessions.clear();
19031
+ this.reconnectPromptSnapshotGraceConsumedSessions.clear();
18800
19032
  }
18801
19033
  }, _class11.__initStatic(), _class11.__initStatic2(), _class11.__initStatic3(), _class11.__initStatic4(), _class11);
18802
19034
 
@@ -18854,24 +19086,24 @@ function deriveWorkerStateInfo(progressLog, existingWorkerStates) {
18854
19086
  nextWorkerStates[workerSessionId] = {
18855
19087
  ...nextWorkerStates[workerSessionId],
18856
19088
  completedAt: entry.timestamp,
18857
- exitCode: _nullishCoalesce(entry.exitCode, () => ( _optionalChain([nextWorkerStates, 'access', _326 => _326[workerSessionId], 'optionalAccess', _327 => _327.exitCode])))
19089
+ exitCode: _nullishCoalesce(entry.exitCode, () => ( _optionalChain([nextWorkerStates, 'access', _329 => _329[workerSessionId], 'optionalAccess', _330 => _330.exitCode])))
18858
19090
  };
18859
19091
  }
18860
19092
  }
18861
19093
  return nextWorkerStates;
18862
19094
  }
18863
- var MissionStore = (_class12 = class {constructor() { _class12.prototype.__init64.call(this);_class12.prototype.__init65.call(this);_class12.prototype.__init66.call(this);_class12.prototype.__init67.call(this);_class12.prototype.__init68.call(this);_class12.prototype.__init69.call(this); }
19095
+ var MissionStore = (_class12 = class {constructor() { _class12.prototype.__init68.call(this);_class12.prototype.__init69.call(this);_class12.prototype.__init70.call(this);_class12.prototype.__init71.call(this);_class12.prototype.__init72.call(this);_class12.prototype.__init73.call(this); }
18864
19096
  /**
18865
19097
  * Merge-tracked mission fields. Key presence doubles as "this store
18866
19098
  * actually received the field", so mergeFrom cannot desync a set-flag from
18867
19099
  * its value and a future field added here is merge-safe by construction.
18868
19100
  */
18869
- __init64() {this.data = {}}
18870
- __init65() {this.workerSessionIds = /* @__PURE__ */ new Set()}
18871
- __init66() {this.workerStates = {}}
18872
- __init67() {this.tokenUsageBySessionId = {}}
18873
- __init68() {this.listeners = /* @__PURE__ */ new Set()}
18874
- __init69() {this.cachedSnapshot = null}
19101
+ __init68() {this.data = {}}
19102
+ __init69() {this.workerSessionIds = /* @__PURE__ */ new Set()}
19103
+ __init70() {this.workerStates = {}}
19104
+ __init71() {this.tokenUsageBySessionId = {}}
19105
+ __init72() {this.listeners = /* @__PURE__ */ new Set()}
19106
+ __init73() {this.cachedSnapshot = null}
18875
19107
  subscribe(listener) {
18876
19108
  this.listeners.add(listener);
18877
19109
  return () => {
@@ -18967,7 +19199,7 @@ var MissionStore = (_class12 = class {constructor() { _class12.prototype.__init6
18967
19199
  completeWorker(workerSessionId, exitCode) {
18968
19200
  this.workerSessionIds.add(workerSessionId);
18969
19201
  this.workerStates[workerSessionId] = {
18970
- startedAt: _nullishCoalesce(_optionalChain([this, 'access', _328 => _328.workerStates, 'access', _329 => _329[workerSessionId], 'optionalAccess', _330 => _330.startedAt]), () => ( (/* @__PURE__ */ new Date()).toISOString())),
19202
+ startedAt: _nullishCoalesce(_optionalChain([this, 'access', _331 => _331.workerStates, 'access', _332 => _332[workerSessionId], 'optionalAccess', _333 => _333.startedAt]), () => ( (/* @__PURE__ */ new Date()).toISOString())),
18971
19203
  completedAt: (/* @__PURE__ */ new Date()).toISOString(),
18972
19204
  exitCode
18973
19205
  };
@@ -18986,10 +19218,10 @@ var MissionStore = (_class12 = class {constructor() { _class12.prototype.__init6
18986
19218
  }, _class12);
18987
19219
 
18988
19220
  // ../daemon-sdk/src/session/state/MultiMissionStateManager.ts
18989
- var MultiMissionStateManager = (_class13 = class {constructor() { _class13.prototype.__init70.call(this);_class13.prototype.__init71.call(this);_class13.prototype.__init72.call(this); }
18990
- __init70() {this.missionStores = /* @__PURE__ */ new Map()}
18991
- __init71() {this.sessionToMissionId = /* @__PURE__ */ new Map()}
18992
- __init72() {this.listeners = /* @__PURE__ */ new Set()}
19221
+ var MultiMissionStateManager = (_class13 = class {constructor() { _class13.prototype.__init74.call(this);_class13.prototype.__init75.call(this);_class13.prototype.__init76.call(this); }
19222
+ __init74() {this.missionStores = /* @__PURE__ */ new Map()}
19223
+ __init75() {this.sessionToMissionId = /* @__PURE__ */ new Map()}
19224
+ __init76() {this.listeners = /* @__PURE__ */ new Set()}
18993
19225
  subscribe(listener) {
18994
19226
  this.listeners.add(listener);
18995
19227
  return () => {
@@ -19352,83 +19584,83 @@ function getSettledHydrationFloorMessageId(messages) {
19352
19584
  unsettledStartIndex = index;
19353
19585
  }
19354
19586
  }
19355
- return _optionalChain([messages, 'access', _331 => _331[(_nullishCoalesce(unsettledStartIndex, () => ( messages.length))) - 1], 'optionalAccess', _332 => _332.id]);
19587
+ return _optionalChain([messages, 'access', _334 => _334[(_nullishCoalesce(unsettledStartIndex, () => ( messages.length))) - 1], 'optionalAccess', _335 => _335.id]);
19356
19588
  }
19357
19589
  var SessionStore = (_class14 = class _SessionStore {
19358
19590
 
19359
19591
 
19360
- __init73() {this.messages = /* @__PURE__ */ new Map()}
19361
- __init74() {this.terminals = /* @__PURE__ */ new Map()}
19362
- __init75() {this.activeTerminalId = null}
19363
- __init76() {this.messageOrder = []}
19592
+ __init77() {this.messages = /* @__PURE__ */ new Map()}
19593
+ __init78() {this.terminals = /* @__PURE__ */ new Map()}
19594
+ __init79() {this.activeTerminalId = null}
19595
+ __init80() {this.messageOrder = []}
19364
19596
 
19365
- __init77() {this.sessionMetadata = /* @__PURE__ */ new Map()}
19366
- __init78() {this.modelId = null}
19367
- __init79() {this.reasoningEffort = null}
19368
- __init80() {this.interactionMode = null}
19369
- __init81() {this.autonomyLevel = null}
19370
- __init82() {this.specModeModelId = null}
19371
- __init83() {this.specModeReasoningEffort = null}
19372
- __init84() {this.missionSettings = null}
19373
- __init85() {this.compactionThresholdCheckEnabled = null}
19374
- __init86() {this.sandbox = null}
19375
- __init87() {this.cwd = null}
19376
- __init88() {this.title = null}
19377
- __init89() {this.availableModels = null}
19378
- __init90() {this.mcpServers = []}
19379
- __init91() {this.mcpStatus = "not-initialized"} /* NotInitialized */
19380
- __init92() {this.lastCallTokenUsage = null}
19381
- __init93() {this.tokenUsage = null}
19382
- __init94() {this.inclusiveTokenUsage = null}
19383
- __init95() {this.decompSessionType = null}
19384
- __init96() {this.callingSessionId = null}
19385
- __init97() {this.tags = null}
19386
- __init98() {this.callingToolUseId = null}
19387
- __init99() {this.agentTurnCompletionReason = null}
19597
+ __init81() {this.sessionMetadata = /* @__PURE__ */ new Map()}
19598
+ __init82() {this.modelId = null}
19599
+ __init83() {this.reasoningEffort = null}
19600
+ __init84() {this.interactionMode = null}
19601
+ __init85() {this.autonomyLevel = null}
19602
+ __init86() {this.specModeModelId = null}
19603
+ __init87() {this.specModeReasoningEffort = null}
19604
+ __init88() {this.missionSettings = null}
19605
+ __init89() {this.compactionThresholdCheckEnabled = null}
19606
+ __init90() {this.sandbox = null}
19607
+ __init91() {this.cwd = null}
19608
+ __init92() {this.title = null}
19609
+ __init93() {this.availableModels = null}
19610
+ __init94() {this.mcpServers = []}
19611
+ __init95() {this.mcpStatus = "not-initialized"} /* NotInitialized */
19612
+ __init96() {this.lastCallTokenUsage = null}
19613
+ __init97() {this.tokenUsage = null}
19614
+ __init98() {this.inclusiveTokenUsage = null}
19615
+ __init99() {this.decompSessionType = null}
19616
+ __init100() {this.callingSessionId = null}
19617
+ __init101() {this.tags = null}
19618
+ __init102() {this.callingToolUseId = null}
19619
+ __init103() {this.agentTurnCompletionReason = null}
19388
19620
  // Transient status describing an in-progress LLM retry (provider overload /
19389
19621
  // throttling backoff). Present only while the agent is retrying; cleared
19390
19622
  // once the agent makes progress or the turn terminally fails. Lets the UI
19391
19623
  // show "retrying" instead of an apparent hang during silent backoff.
19392
- __init100() {this.llmRetryStatus = null}
19393
- __init101() {this.loopState = null}
19624
+ __init104() {this.llmRetryStatus = null}
19625
+ __init105() {this.loopState = null}
19394
19626
  // ============ UI Render State ============
19395
- __init102() {this.uiRenderCutoffMessageId = null}
19627
+ __init106() {this.uiRenderCutoffMessageId = null}
19396
19628
 
19397
19629
  // Count of messages pruned by compaction so the "Previous N messages hidden"
19398
19630
  // indicator survives even though the pruned messages are no longer present.
19399
- __init103() {this.uiRenderHiddenMessageCount = 0}
19631
+ __init107() {this.uiRenderHiddenMessageCount = 0}
19400
19632
 
19401
19633
  // ============ Tool Progress Fields ============
19402
- __init104() {this.toolProgressUpdates = /* @__PURE__ */ new Map()}
19403
- __init105() {this.toolExecutionPhases = /* @__PURE__ */ new Map()}
19404
- __init106() {this.toolProgressCleanupTimers = /* @__PURE__ */ new Map()}
19634
+ __init108() {this.toolProgressUpdates = /* @__PURE__ */ new Map()}
19635
+ __init109() {this.toolExecutionPhases = /* @__PURE__ */ new Map()}
19636
+ __init110() {this.toolProgressCleanupTimers = /* @__PURE__ */ new Map()}
19405
19637
  static __initStatic5() {this.TOOL_PROGRESS_CLEANUP_DELAY_MS = 6e4}
19406
19638
  static __initStatic6() {this.EMPTY_TOOL_UPDATES = []}
19407
19639
 
19408
19640
 
19409
- __init107() {this.hookExecutions = /* @__PURE__ */ new Map()}
19410
- __init108() {this.version = 0}
19411
- __init109() {this.messagesVersion = 0}
19412
- __init110() {this.hasPendingSilentMessageChanges = false}
19413
- __init111() {this.suppressedStateEventDepth = 0}
19414
- __init112() {this.streamingVersion = 0}
19415
- __init113() {this.streamingNotifyTimer = null}
19416
- __init114() {this.streamingNotifyFrame = null}
19417
- __init115() {this.pendingStreamingNotify = false}
19641
+ __init111() {this.hookExecutions = /* @__PURE__ */ new Map()}
19642
+ __init112() {this.version = 0}
19643
+ __init113() {this.messagesVersion = 0}
19644
+ __init114() {this.hasPendingSilentMessageChanges = false}
19645
+ __init115() {this.suppressedStateEventDepth = 0}
19646
+ __init116() {this.streamingVersion = 0}
19647
+ __init117() {this.streamingNotifyTimer = null}
19648
+ __init118() {this.streamingNotifyFrame = null}
19649
+ __init119() {this.pendingStreamingNotify = false}
19418
19650
  static __initStatic7() {this.STREAMING_NOTIFY_FALLBACK_MS = 16}
19419
- __init116() {this.coalescedNotifyTimer = null}
19420
- __init117() {this.coalescedNotifyFrame = null}
19421
- __init118() {this.pendingCoalescedEvents = /* @__PURE__ */ new Set()}
19422
- __init119() {this.pendingToolProgressNotifyIds = /* @__PURE__ */ new Set()}
19651
+ __init120() {this.coalescedNotifyTimer = null}
19652
+ __init121() {this.coalescedNotifyFrame = null}
19653
+ __init122() {this.pendingCoalescedEvents = /* @__PURE__ */ new Set()}
19654
+ __init123() {this.pendingToolProgressNotifyIds = /* @__PURE__ */ new Set()}
19423
19655
  static __initStatic8() {this.COALESCED_NOTIFY_FALLBACK_MS = 50}
19424
- __init120() {this.toolProgressVersion = 0}
19656
+ __init124() {this.toolProgressVersion = 0}
19425
19657
  constructor({
19426
19658
  sessionId,
19427
19659
  machineId,
19428
19660
  onToolProgressUpdate,
19429
19661
  onStateEvent,
19430
19662
  enableProgressiveUiRendering
19431
- }) {;_class14.prototype.__init73.call(this);_class14.prototype.__init74.call(this);_class14.prototype.__init75.call(this);_class14.prototype.__init76.call(this);_class14.prototype.__init77.call(this);_class14.prototype.__init78.call(this);_class14.prototype.__init79.call(this);_class14.prototype.__init80.call(this);_class14.prototype.__init81.call(this);_class14.prototype.__init82.call(this);_class14.prototype.__init83.call(this);_class14.prototype.__init84.call(this);_class14.prototype.__init85.call(this);_class14.prototype.__init86.call(this);_class14.prototype.__init87.call(this);_class14.prototype.__init88.call(this);_class14.prototype.__init89.call(this);_class14.prototype.__init90.call(this);_class14.prototype.__init91.call(this);_class14.prototype.__init92.call(this);_class14.prototype.__init93.call(this);_class14.prototype.__init94.call(this);_class14.prototype.__init95.call(this);_class14.prototype.__init96.call(this);_class14.prototype.__init97.call(this);_class14.prototype.__init98.call(this);_class14.prototype.__init99.call(this);_class14.prototype.__init100.call(this);_class14.prototype.__init101.call(this);_class14.prototype.__init102.call(this);_class14.prototype.__init103.call(this);_class14.prototype.__init104.call(this);_class14.prototype.__init105.call(this);_class14.prototype.__init106.call(this);_class14.prototype.__init107.call(this);_class14.prototype.__init108.call(this);_class14.prototype.__init109.call(this);_class14.prototype.__init110.call(this);_class14.prototype.__init111.call(this);_class14.prototype.__init112.call(this);_class14.prototype.__init113.call(this);_class14.prototype.__init114.call(this);_class14.prototype.__init115.call(this);_class14.prototype.__init116.call(this);_class14.prototype.__init117.call(this);_class14.prototype.__init118.call(this);_class14.prototype.__init119.call(this);_class14.prototype.__init120.call(this);
19663
+ }) {;_class14.prototype.__init77.call(this);_class14.prototype.__init78.call(this);_class14.prototype.__init79.call(this);_class14.prototype.__init80.call(this);_class14.prototype.__init81.call(this);_class14.prototype.__init82.call(this);_class14.prototype.__init83.call(this);_class14.prototype.__init84.call(this);_class14.prototype.__init85.call(this);_class14.prototype.__init86.call(this);_class14.prototype.__init87.call(this);_class14.prototype.__init88.call(this);_class14.prototype.__init89.call(this);_class14.prototype.__init90.call(this);_class14.prototype.__init91.call(this);_class14.prototype.__init92.call(this);_class14.prototype.__init93.call(this);_class14.prototype.__init94.call(this);_class14.prototype.__init95.call(this);_class14.prototype.__init96.call(this);_class14.prototype.__init97.call(this);_class14.prototype.__init98.call(this);_class14.prototype.__init99.call(this);_class14.prototype.__init100.call(this);_class14.prototype.__init101.call(this);_class14.prototype.__init102.call(this);_class14.prototype.__init103.call(this);_class14.prototype.__init104.call(this);_class14.prototype.__init105.call(this);_class14.prototype.__init106.call(this);_class14.prototype.__init107.call(this);_class14.prototype.__init108.call(this);_class14.prototype.__init109.call(this);_class14.prototype.__init110.call(this);_class14.prototype.__init111.call(this);_class14.prototype.__init112.call(this);_class14.prototype.__init113.call(this);_class14.prototype.__init114.call(this);_class14.prototype.__init115.call(this);_class14.prototype.__init116.call(this);_class14.prototype.__init117.call(this);_class14.prototype.__init118.call(this);_class14.prototype.__init119.call(this);_class14.prototype.__init120.call(this);_class14.prototype.__init121.call(this);_class14.prototype.__init122.call(this);_class14.prototype.__init123.call(this);_class14.prototype.__init124.call(this);
19432
19664
  this.sessionId = sessionId;
19433
19665
  this.machineId = machineId;
19434
19666
  this.onToolProgressUpdate = onToolProgressUpdate;
@@ -19495,7 +19727,7 @@ var SessionStore = (_class14 = class _SessionStore {
19495
19727
  const toolUseIds = [...this.pendingToolProgressNotifyIds];
19496
19728
  this.pendingToolProgressNotifyIds.clear();
19497
19729
  for (const toolUseId of toolUseIds) {
19498
- _optionalChain([this, 'access', _333 => _333.onToolProgressUpdate, 'optionalCall', _334 => _334(this.sessionId, toolUseId)]);
19730
+ _optionalChain([this, 'access', _336 => _336.onToolProgressUpdate, 'optionalCall', _337 => _337(this.sessionId, toolUseId)]);
19499
19731
  }
19500
19732
  };
19501
19733
  if (typeof globalThis.requestAnimationFrame === "function") {
@@ -19509,7 +19741,7 @@ var SessionStore = (_class14 = class _SessionStore {
19509
19741
  }
19510
19742
  clearCoalescedNotifySchedule() {
19511
19743
  if (this.coalescedNotifyFrame !== null) {
19512
- _optionalChain([globalThis, 'access', _335 => _335.cancelAnimationFrame, 'optionalCall', _336 => _336(this.coalescedNotifyFrame)]);
19744
+ _optionalChain([globalThis, 'access', _338 => _338.cancelAnimationFrame, 'optionalCall', _339 => _339(this.coalescedNotifyFrame)]);
19513
19745
  this.coalescedNotifyFrame = null;
19514
19746
  }
19515
19747
  if (this.coalescedNotifyTimer !== null) {
@@ -19625,7 +19857,7 @@ var SessionStore = (_class14 = class _SessionStore {
19625
19857
  }
19626
19858
  clearStreamingNotifySchedule() {
19627
19859
  if (this.streamingNotifyFrame !== null) {
19628
- _optionalChain([globalThis, 'access', _337 => _337.cancelAnimationFrame, 'optionalCall', _338 => _338(this.streamingNotifyFrame)]);
19860
+ _optionalChain([globalThis, 'access', _340 => _340.cancelAnimationFrame, 'optionalCall', _341 => _341(this.streamingNotifyFrame)]);
19629
19861
  this.streamingNotifyFrame = null;
19630
19862
  }
19631
19863
  if (this.streamingNotifyTimer !== null) {
@@ -19638,10 +19870,10 @@ var SessionStore = (_class14 = class _SessionStore {
19638
19870
  this.emitMessageThreadUpdated("coarse" /* Coarse */);
19639
19871
  return;
19640
19872
  }
19641
- _optionalChain([this, 'access', _339 => _339.onStateEvent, 'optionalCall', _340 => _340(event, { sessionId: this.sessionId })]);
19873
+ _optionalChain([this, 'access', _342 => _342.onStateEvent, 'optionalCall', _343 => _343(event, { sessionId: this.sessionId })]);
19642
19874
  }
19643
19875
  emitMessageThreadUpdated(granularity) {
19644
- _optionalChain([this, 'access', _341 => _341.onStateEvent, 'optionalCall', _342 => _342("message_thread_updated" /* MessageThreadUpdated */, {
19876
+ _optionalChain([this, 'access', _344 => _344.onStateEvent, 'optionalCall', _345 => _345("message_thread_updated" /* MessageThreadUpdated */, {
19645
19877
  granularity,
19646
19878
  sessionId: this.sessionId
19647
19879
  })]);
@@ -19706,7 +19938,7 @@ var SessionStore = (_class14 = class _SessionStore {
19706
19938
  const candidate = this.messages.get(
19707
19939
  this.messageOrder[insertIndex]
19708
19940
  );
19709
- if (!_optionalChain([candidate, 'optionalAccess', _343 => _343.parentId]) || !descendantIds.has(candidate.parentId)) {
19941
+ if (!_optionalChain([candidate, 'optionalAccess', _346 => _346.parentId]) || !descendantIds.has(candidate.parentId)) {
19710
19942
  break;
19711
19943
  }
19712
19944
  descendantIds.add(candidate.id);
@@ -19723,7 +19955,7 @@ var SessionStore = (_class14 = class _SessionStore {
19723
19955
  this.lastConversationMessageId = storedMessage.id;
19724
19956
  }
19725
19957
  }
19726
- if (_optionalChain([options, 'optionalAccess', _344 => _344.silent])) {
19958
+ if (_optionalChain([options, 'optionalAccess', _347 => _347.silent])) {
19727
19959
  this.hasPendingSilentMessageChanges = true;
19728
19960
  } else {
19729
19961
  this.messagesVersion++;
@@ -19749,7 +19981,7 @@ var SessionStore = (_class14 = class _SessionStore {
19749
19981
  }
19750
19982
  parentId = parent.parentId;
19751
19983
  }
19752
- if (_optionalChain([this, 'access', _345 => _345.messages, 'access', _346 => _346.get, 'call', _347 => _347(storedMessage.parentId), 'optionalAccess', _348 => _348.id])) {
19984
+ if (_optionalChain([this, 'access', _348 => _348.messages, 'access', _349 => _349.get, 'call', _350 => _350(storedMessage.parentId), 'optionalAccess', _351 => _351.id])) {
19753
19985
  storedMessage.parentId = this.lastConversationMessageId;
19754
19986
  }
19755
19987
  return storedMessage;
@@ -19794,11 +20026,11 @@ var SessionStore = (_class14 = class _SessionStore {
19794
20026
  if (isTranscriptSidebandMessage(existing) !== isTranscriptSidebandMessage(updatedMessage)) {
19795
20027
  this.recomputeLastConversationMessageId();
19796
20028
  }
19797
- if (_optionalChain([options, 'optionalAccess', _349 => _349.silent])) {
20029
+ if (_optionalChain([options, 'optionalAccess', _352 => _352.silent])) {
19798
20030
  this.hasPendingSilentMessageChanges = true;
19799
20031
  } else {
19800
20032
  this.messagesVersion++;
19801
- if (_optionalChain([options, 'optionalAccess', _350 => _350.coalesce])) {
20033
+ if (_optionalChain([options, 'optionalAccess', _353 => _353.coalesce])) {
19802
20034
  this.notifyCoalesced("message_thread_updated" /* MessageThreadUpdated */);
19803
20035
  } else {
19804
20036
  this.notify("message_thread_updated" /* MessageThreadUpdated */);
@@ -20279,7 +20511,7 @@ var SessionStore = (_class14 = class _SessionStore {
20279
20511
  * Get serialized terminal state
20280
20512
  */
20281
20513
  getTerminalSerializedState(terminalId) {
20282
- return _optionalChain([this, 'access', _351 => _351.terminals, 'access', _352 => _352.get, 'call', _353 => _353(terminalId), 'optionalAccess', _354 => _354.serializedState]);
20514
+ return _optionalChain([this, 'access', _354 => _354.terminals, 'access', _355 => _355.get, 'call', _356 => _356(terminalId), 'optionalAccess', _357 => _357.serializedState]);
20283
20515
  }
20284
20516
  /**
20285
20517
  * Append data to terminal buffer (called for DATA notifications while unmounted)
@@ -20298,7 +20530,7 @@ var SessionStore = (_class14 = class _SessionStore {
20298
20530
  * Get buffered data for terminal
20299
20531
  */
20300
20532
  getTerminalBufferedData(terminalId) {
20301
- return _optionalChain([this, 'access', _355 => _355.terminals, 'access', _356 => _356.get, 'call', _357 => _357(terminalId), 'optionalAccess', _358 => _358.bufferedData]);
20533
+ return _optionalChain([this, 'access', _358 => _358.terminals, 'access', _359 => _359.get, 'call', _360 => _360(terminalId), 'optionalAccess', _361 => _361.bufferedData]);
20302
20534
  }
20303
20535
  /**
20304
20536
  * Clear only buffered data for terminal (called after flushing)
@@ -20448,7 +20680,7 @@ var SessionStore = (_class14 = class _SessionStore {
20448
20680
  // ============ Hook Execution Methods ============
20449
20681
  addHookExecution(hookId, data, options) {
20450
20682
  this.hookExecutions.set(hookId, { ...data, createdAt: Date.now() });
20451
- if (_optionalChain([options, 'optionalAccess', _359 => _359.notify]) !== false) {
20683
+ if (_optionalChain([options, 'optionalAccess', _362 => _362.notify]) !== false) {
20452
20684
  this.notify("message_thread_updated" /* MessageThreadUpdated */);
20453
20685
  }
20454
20686
  }
@@ -20458,7 +20690,7 @@ var SessionStore = (_class14 = class _SessionStore {
20458
20690
  existing.hookStatus = update.hookStatus;
20459
20691
  existing.hookPreventedAction = update.hookPreventedAction;
20460
20692
  existing.hookResults = update.hookResults;
20461
- if (_optionalChain([options, 'optionalAccess', _360 => _360.notify]) !== false) {
20693
+ if (_optionalChain([options, 'optionalAccess', _363 => _363.notify]) !== false) {
20462
20694
  this.notify("message_thread_updated" /* MessageThreadUpdated */);
20463
20695
  }
20464
20696
  return true;
@@ -20558,7 +20790,7 @@ var SessionStore = (_class14 = class _SessionStore {
20558
20790
  if (lastTodoId) {
20559
20791
  const todoMessage = this.messages.get(lastTodoId);
20560
20792
  const todoToolUseIds = new Set(
20561
- Array.isArray(_optionalChain([todoMessage, 'optionalAccess', _361 => _361.content])) ? todoMessage.content.filter(
20793
+ Array.isArray(_optionalChain([todoMessage, 'optionalAccess', _364 => _364.content])) ? todoMessage.content.filter(
20562
20794
  (block) => block.type === "tool_use" /* ToolUse */ && block.name === TOOL_LLM_ID_TODO_WRITE
20563
20795
  ).map((block) => block.id) : []
20564
20796
  );
@@ -20626,7 +20858,7 @@ var SessionStore = (_class14 = class _SessionStore {
20626
20858
  this.toolProgressUpdates.delete(toolUseId);
20627
20859
  this.toolProgressVersion++;
20628
20860
  this.pendingToolProgressNotifyIds.delete(toolUseId);
20629
- _optionalChain([this, 'access', _362 => _362.onToolProgressUpdate, 'optionalCall', _363 => _363(this.sessionId, toolUseId)]);
20861
+ _optionalChain([this, 'access', _365 => _365.onToolProgressUpdate, 'optionalCall', _366 => _366(this.sessionId, toolUseId)]);
20630
20862
  const timer = this.toolProgressCleanupTimers.get(toolUseId);
20631
20863
  if (timer) {
20632
20864
  clearTimeout(timer);
@@ -20642,7 +20874,7 @@ var SessionStore = (_class14 = class _SessionStore {
20642
20874
  }
20643
20875
  this.toolProgressCleanupTimers.clear();
20644
20876
  for (const toolUseId of toolUseIds) {
20645
- _optionalChain([this, 'access', _364 => _364.onToolProgressUpdate, 'optionalCall', _365 => _365(this.sessionId, toolUseId)]);
20877
+ _optionalChain([this, 'access', _367 => _367.onToolProgressUpdate, 'optionalCall', _368 => _368(this.sessionId, toolUseId)]);
20646
20878
  }
20647
20879
  }
20648
20880
  }, _class14.__initStatic5(), _class14.__initStatic6(), _class14.__initStatic7(), _class14.__initStatic8(), _class14);
@@ -20704,7 +20936,7 @@ function parseTodoString(input) {
20704
20936
  return {
20705
20937
  id: String(index + 1),
20706
20938
  status: "pending",
20707
- content: (_nullishCoalesce(_nullishCoalesce(_optionalChain([numberedMatch, 'optionalAccess', _366 => _366[1]]), () => ( _optionalChain([bulletMatch, 'optionalAccess', _367 => _367[1]]))), () => ( trimmed))).trim(),
20939
+ content: (_nullishCoalesce(_nullishCoalesce(_optionalChain([numberedMatch, 'optionalAccess', _369 => _369[1]]), () => ( _optionalChain([bulletMatch, 'optionalAccess', _370 => _370[1]]))), () => ( trimmed))).trim(),
20708
20940
  priority: "high"
20709
20941
  };
20710
20942
  });
@@ -20854,12 +21086,12 @@ var isSingleRootedParentGraph = (messages) => {
20854
21086
  var orderMergedSessionMessages = (messages) => isSingleRootedParentGraph(messages) ? orderMessagesByParentChain2(messages) : messages.slice().sort((a, b) => a.createdAt - b.createdAt);
20855
21087
  var SessionStateManager = (_class15 = class _SessionStateManager {
20856
21088
 
20857
- __init121() {this.streamingMessageIds = /* @__PURE__ */ new Set()}
21089
+ __init125() {this.streamingMessageIds = /* @__PURE__ */ new Set()}
20858
21090
  // SSM is the source of truth for all queued prompts in this session.
20859
21091
  // Queue entries explicitly distinguish local post-Esc deferrals from
20860
21092
  // daemon-accepted discardable queue entries while preserving FIFO order.
20861
- __init122() {this.queuedMessages = /* @__PURE__ */ new Map()}
20862
- __init123() {this.processedMessageRequestIds = /* @__PURE__ */ new Set()}
21093
+ __init126() {this.queuedMessages = /* @__PURE__ */ new Map()}
21094
+ __init127() {this.processedMessageRequestIds = /* @__PURE__ */ new Set()}
20863
21095
  /**
20864
21096
  * Ids of the real messages that replaced a leading optimistic card. The
20865
21097
  * launch records its steps one at a time, so this is what keeps the cards
@@ -20867,28 +21099,28 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
20867
21099
  * jumping back above them. Bounded by the number of leading cards a launch
20868
21100
  * stages (one per launch step).
20869
21101
  */
20870
- __init124() {this.confirmedLeadingMessageIds = /* @__PURE__ */ new Set()}
21102
+ __init128() {this.confirmedLeadingMessageIds = /* @__PURE__ */ new Set()}
20871
21103
  // Track tool messages that arrived before their parent assistant message
20872
21104
  // Key: toolUseId, Value: tool result message
20873
- __init125() {this.orphanedToolMessages = /* @__PURE__ */ new Map()}
21105
+ __init129() {this.orphanedToolMessages = /* @__PURE__ */ new Map()}
20874
21106
  // Track the pending assistant message created from TOOL_CALL notifications.
20875
21107
  // TOOL_CALL notifications arrive individually before the authoritative
20876
21108
  // CREATE_MESSAGE (assistant). We buffer them into a single pending message
20877
21109
  // and replace it when CREATE_MESSAGE arrives.
20878
- __init126() {this.pendingAssistantMessageId = null}
20879
- __init127() {this.droidWorkingState = "idle"} /* Idle */
20880
- __init128() {this.droidWorkingStateChangedAtMs = Date.now()}
21110
+ __init130() {this.pendingAssistantMessageId = null}
21111
+ __init131() {this.droidWorkingState = "idle"} /* Idle */
21112
+ __init132() {this.droidWorkingStateChangedAtMs = Date.now()}
20881
21113
  // Bumped whenever a live DROID_WORKING_STATE_CHANGED notification is
20882
21114
  // processed. Session load captures this after the load RPC resolves and
20883
21115
  // skips applying the load-response working-state sample if it advanced,
20884
21116
  // since the live notification is strictly fresher.
20885
- __init129() {this.workingStateRevision = 0}
21117
+ __init133() {this.workingStateRevision = 0}
20886
21118
  // Track whether the last notification was a streaming text/thinking delta
20887
21119
  // so we can flush pending throttled notifications when transitioning to
20888
21120
  // a discrete event type.
20889
- __init130() {this.lastNotificationWasStreamingDelta = false}
20890
- __init131() {this.thinkingBlockStartTimes = /* @__PURE__ */ new Map()}
20891
- __init132() {this.thinkingBlockContentIndices = /* @__PURE__ */ new Map()}
21121
+ __init134() {this.lastNotificationWasStreamingDelta = false}
21122
+ __init135() {this.thinkingBlockStartTimes = /* @__PURE__ */ new Map()}
21123
+ __init136() {this.thinkingBlockContentIndices = /* @__PURE__ */ new Map()}
20892
21124
  getThinkingBlockKey(messageId, blockIndex) {
20893
21125
  return `${messageId}:${blockIndex}`;
20894
21126
  }
@@ -20901,7 +21133,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
20901
21133
  getMappedThinkingBlockContentIndex(messageId, blockIndex, content) {
20902
21134
  const key = this.getThinkingBlockKey(messageId, blockIndex);
20903
21135
  const contentIndex = this.thinkingBlockContentIndices.get(key);
20904
- if (contentIndex !== void 0 && _optionalChain([content, 'access', _368 => _368[contentIndex], 'optionalAccess', _369 => _369.type]) === "thinking" /* Thinking */) {
21136
+ if (contentIndex !== void 0 && _optionalChain([content, 'access', _371 => _371[contentIndex], 'optionalAccess', _372 => _372.type]) === "thinking" /* Thinking */) {
20905
21137
  return contentIndex;
20906
21138
  }
20907
21139
  if (contentIndex !== void 0) {
@@ -20999,16 +21231,16 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
20999
21231
  this.thinkingBlockStartTimes.delete(key);
21000
21232
  return startedAtMs === void 0 ? void 0 : Math.max(0, Date.now() - startedAtMs);
21001
21233
  }
21002
- __init133() {this.loadState = "NOT_LOADED"} /* NotLoaded */
21003
- __init134() {this.hasOlderMessages = false}
21004
- __init135() {this.loadedMessageLimit = 0}
21234
+ __init137() {this.loadState = "NOT_LOADED"} /* NotLoaded */
21235
+ __init138() {this.hasOlderMessages = false}
21236
+ __init139() {this.loadedMessageLimit = 0}
21005
21237
  // Terminal registry: maps terminalId → write handler
21006
21238
  // When a terminal is mounted, it registers a handler
21007
21239
  // When unmounted, it unregisters and data gets buffered instead
21008
- __init136() {this.terminalWriteHandlers = /* @__PURE__ */ new Map()}
21240
+ __init140() {this.terminalWriteHandlers = /* @__PURE__ */ new Map()}
21009
21241
  // Optimistic messages that are shown immediately before server confirmation
21010
21242
  // Key: requestId, Value: the optimistic message and where it belongs
21011
- __init137() {this.optimisticMessages = /* @__PURE__ */ new Map()}
21243
+ __init141() {this.optimisticMessages = /* @__PURE__ */ new Map()}
21012
21244
  // Streaming-assistant placeholder bubble id rendered while the user's
21013
21245
  // submitted turn is in flight. Set synchronously by
21014
21246
  // MultiSessionStateManager.registerOptimisticSubmit alongside the user
@@ -21016,7 +21248,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21016
21248
  // confirm/cancel via the same path. The user bubble itself is
21017
21249
  // rendered via getDisplayMessages → optimisticMessages, so this field
21018
21250
  // is just for the (empty) assistant streaming placeholder slot.
21019
- __init138() {this.optimisticAssistantBubbleId = null}
21251
+ __init142() {this.optimisticAssistantBubbleId = null}
21020
21252
  // Progressive UI rendering (on by default, used by the Ink CLI): when
21021
21253
  // enabled, initializeSession bounds the initially rendered tail of large
21022
21254
  // transcripts and the consumer expands via expandUiMessages(). Web/desktop
@@ -21025,23 +21257,23 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21025
21257
 
21026
21258
  // When non-null, limits how many messages are rendered (from the tail).
21027
21259
  // null means "show all" (fully expanded).
21028
- __init139() {this.renderLimit = null}
21260
+ __init143() {this.renderLimit = null}
21029
21261
  static __initStatic9() {this.INITIAL_UI_RENDER_LIMIT = 30}
21030
- __init140() {this.currentTodos = null}
21262
+ __init144() {this.currentTodos = null}
21031
21263
  // Index of TodoWrite tool-use blocks by tool-use id so todo state updates
21032
21264
  // on tool results are O(1) instead of rescanning the whole transcript.
21033
- __init141() {this.todoToolUsesById = /* @__PURE__ */ new Map()}
21265
+ __init145() {this.todoToolUsesById = /* @__PURE__ */ new Map()}
21034
21266
  // Recency guard: tool-use ids are assigned monotonically increasing
21035
21267
  // sequence numbers on first track, and currentTodos remembers the sequence
21036
21268
  // that produced it, so a re-delivered success result for an older TodoWrite
21037
21269
  // (notification replay, reconnect result overwrites) cannot regress the
21038
21270
  // list to an earlier state.
21039
- __init142() {this.todoToolUseSequenceById = /* @__PURE__ */ new Map()}
21040
- __init143() {this.nextTodoToolUseSequence = 0}
21041
- __init144() {this.currentTodosSequence = -1}
21042
- constructor(store, options) {;_class15.prototype.__init121.call(this);_class15.prototype.__init122.call(this);_class15.prototype.__init123.call(this);_class15.prototype.__init124.call(this);_class15.prototype.__init125.call(this);_class15.prototype.__init126.call(this);_class15.prototype.__init127.call(this);_class15.prototype.__init128.call(this);_class15.prototype.__init129.call(this);_class15.prototype.__init130.call(this);_class15.prototype.__init131.call(this);_class15.prototype.__init132.call(this);_class15.prototype.__init133.call(this);_class15.prototype.__init134.call(this);_class15.prototype.__init135.call(this);_class15.prototype.__init136.call(this);_class15.prototype.__init137.call(this);_class15.prototype.__init138.call(this);_class15.prototype.__init139.call(this);_class15.prototype.__init140.call(this);_class15.prototype.__init141.call(this);_class15.prototype.__init142.call(this);_class15.prototype.__init143.call(this);_class15.prototype.__init144.call(this);
21271
+ __init146() {this.todoToolUseSequenceById = /* @__PURE__ */ new Map()}
21272
+ __init147() {this.nextTodoToolUseSequence = 0}
21273
+ __init148() {this.currentTodosSequence = -1}
21274
+ constructor(store, options) {;_class15.prototype.__init125.call(this);_class15.prototype.__init126.call(this);_class15.prototype.__init127.call(this);_class15.prototype.__init128.call(this);_class15.prototype.__init129.call(this);_class15.prototype.__init130.call(this);_class15.prototype.__init131.call(this);_class15.prototype.__init132.call(this);_class15.prototype.__init133.call(this);_class15.prototype.__init134.call(this);_class15.prototype.__init135.call(this);_class15.prototype.__init136.call(this);_class15.prototype.__init137.call(this);_class15.prototype.__init138.call(this);_class15.prototype.__init139.call(this);_class15.prototype.__init140.call(this);_class15.prototype.__init141.call(this);_class15.prototype.__init142.call(this);_class15.prototype.__init143.call(this);_class15.prototype.__init144.call(this);_class15.prototype.__init145.call(this);_class15.prototype.__init146.call(this);_class15.prototype.__init147.call(this);_class15.prototype.__init148.call(this);
21043
21275
  this.store = store;
21044
- this.isProgressiveUiRenderingEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _370 => _370.enableProgressiveUiRendering]), () => ( true));
21276
+ this.isProgressiveUiRenderingEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _373 => _373.enableProgressiveUiRendering]), () => ( true));
21045
21277
  }
21046
21278
  setOptimisticAssistantBubbleId(id) {
21047
21279
  this.optimisticAssistantBubbleId = id;
@@ -21234,7 +21466,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21234
21466
  */
21235
21467
  setLoadState(state, options) {
21236
21468
  this.loadState = state;
21237
- if (state === "NOT_LOADED" /* NotLoaded */ && _optionalChain([options, 'optionalAccess', _371 => _371.preserveWorkingState]) !== true && this.droidWorkingState !== "idle" /* Idle */) {
21469
+ if (state === "NOT_LOADED" /* NotLoaded */ && _optionalChain([options, 'optionalAccess', _374 => _374.preserveWorkingState]) !== true && this.droidWorkingState !== "idle" /* Idle */) {
21238
21470
  this.stopStreaming();
21239
21471
  }
21240
21472
  }
@@ -21255,7 +21487,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21255
21487
  id: messageId,
21256
21488
  role: "assistant" /* Assistant */,
21257
21489
  content: [textBlock],
21258
- parentId: _optionalChain([lastMessage, 'optionalAccess', _372 => _372.id]),
21490
+ parentId: _optionalChain([lastMessage, 'optionalAccess', _375 => _375.id]),
21259
21491
  createdAt: Date.now(),
21260
21492
  updatedAt: Date.now()
21261
21493
  };
@@ -21316,7 +21548,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21316
21548
  id: messageId,
21317
21549
  role: "assistant" /* Assistant */,
21318
21550
  content: [thinkingBlock],
21319
- parentId: _optionalChain([lastMessage, 'optionalAccess', _373 => _373.id]),
21551
+ parentId: _optionalChain([lastMessage, 'optionalAccess', _376 => _376.id]),
21320
21552
  createdAt: Date.now(),
21321
21553
  updatedAt: Date.now()
21322
21554
  };
@@ -21384,7 +21616,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21384
21616
  if (!message) return;
21385
21617
  const updatedContent = [...message.content];
21386
21618
  const indexedBlock = updatedContent[blockIndex];
21387
- if (_optionalChain([indexedBlock, 'optionalAccess', _374 => _374.type]) === "text" /* Text */) {
21619
+ if (_optionalChain([indexedBlock, 'optionalAccess', _377 => _377.type]) === "text" /* Text */) {
21388
21620
  const streamingBlock = {
21389
21621
  ...indexedBlock,
21390
21622
  isStreaming: false
@@ -21692,7 +21924,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21692
21924
  }
21693
21925
  this.store.updateMessage(message.id, newMessage);
21694
21926
  } else {
21695
- const fallbackParentId = isTranscriptSidebandMessage(message) ? void 0 : _optionalChain([this, 'access', _375 => _375.store, 'access', _376 => _376.getLastConversationMessage, 'call', _377 => _377(), 'optionalAccess', _378 => _378.id]);
21927
+ const fallbackParentId = isTranscriptSidebandMessage(message) ? void 0 : _optionalChain([this, 'access', _378 => _378.store, 'access', _379 => _379.getLastConversationMessage, 'call', _380 => _380(), 'optionalAccess', _381 => _381.id]);
21696
21928
  const messageWithParent = {
21697
21929
  ...message,
21698
21930
  parentId: _nullishCoalesce(incomingParentId, () => ( fallbackParentId))
@@ -21747,7 +21979,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21747
21979
  if (!existing) {
21748
21980
  let finalParentId = parentId;
21749
21981
  if (!finalParentId) {
21750
- finalParentId = _optionalChain([this, 'access', _379 => _379.store, 'access', _380 => _380.getLastConversationMessage, 'call', _381 => _381(), 'optionalAccess', _382 => _382.id]);
21982
+ finalParentId = _optionalChain([this, 'access', _382 => _382.store, 'access', _383 => _383.getLastConversationMessage, 'call', _384 => _384(), 'optionalAccess', _385 => _385.id]);
21751
21983
  }
21752
21984
  const newMessage = {
21753
21985
  id: messageId,
@@ -21854,7 +22086,8 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21854
22086
  const { notification } = params;
21855
22087
  const isStreamingDelta = notification.type === "assistant_text_delta" /* ASSISTANT_TEXT_DELTA */ || notification.type === "thinking_text_delta" /* THINKING_TEXT_DELTA */;
21856
22088
  const isBlockComplete = notification.type === "assistant_text_complete" /* ASSISTANT_TEXT_COMPLETE */ || notification.type === "thinking_text_complete" /* THINKING_TEXT_COMPLETE */;
21857
- if (this.lastNotificationWasStreamingDelta && !isStreamingDelta && !isBlockComplete) {
22089
+ const isMessageRetraction = notification.type === "assistant_message_retracted" /* ASSISTANT_MESSAGE_RETRACTED */;
22090
+ if (this.lastNotificationWasStreamingDelta && !isStreamingDelta && !isBlockComplete && !isMessageRetraction) {
21858
22091
  logInfo(
21859
22092
  "[SessionStateManager] Heuristic flush: streaming delta \u2192 discrete event",
21860
22093
  {
@@ -21873,7 +22106,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21873
22106
  if (this.pendingAssistantMessageId && notification.message.role === "assistant" /* Assistant */) {
21874
22107
  const pendingId = this.pendingAssistantMessageId;
21875
22108
  this.pendingAssistantMessageId = null;
21876
- const pendingParentId = _optionalChain([this, 'access', _383 => _383.store, 'access', _384 => _384.getMessage, 'call', _385 => _385(pendingId), 'optionalAccess', _386 => _386.parentId]);
22109
+ const pendingParentId = _optionalChain([this, 'access', _386 => _386.store, 'access', _387 => _387.getMessage, 'call', _388 => _388(pendingId), 'optionalAccess', _389 => _389.parentId]);
21877
22110
  const allMessages = this.store.getMessages();
21878
22111
  for (const msg of allMessages) {
21879
22112
  if (msg.parentId === pendingId) {
@@ -21933,7 +22166,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21933
22166
  logError("[SessionStateManager] Session error notification", {
21934
22167
  sessionId: params.sessionId,
21935
22168
  type: notification.errorType,
21936
- errorName: _optionalChain([notification, 'access', _387 => _387.error, 'optionalAccess', _388 => _388.name]),
22169
+ errorName: _optionalChain([notification, 'access', _390 => _390.error, 'optionalAccess', _391 => _391.name]),
21937
22170
  message: notification.message
21938
22171
  });
21939
22172
  }
@@ -21948,7 +22181,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21948
22181
  timeout: notification.timeoutSeconds
21949
22182
  });
21950
22183
  this.setLoadState("NOT_LOADED" /* NotLoaded */, {
21951
- preserveWorkingState: _optionalChain([options, 'optionalAccess', _389 => _389.preserveWorkingStateOnInactive]) === true
22184
+ preserveWorkingState: _optionalChain([options, 'optionalAccess', _392 => _392.preserveWorkingStateOnInactive]) === true
21952
22185
  });
21953
22186
  break;
21954
22187
  }
@@ -21959,7 +22192,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
21959
22192
  timestamp: notification.timestamp
21960
22193
  });
21961
22194
  this.setLoadState("NOT_LOADED" /* NotLoaded */, {
21962
- preserveWorkingState: _optionalChain([options, 'optionalAccess', _390 => _390.preserveWorkingStateOnInactive]) === true
22195
+ preserveWorkingState: _optionalChain([options, 'optionalAccess', _393 => _393.preserveWorkingStateOnInactive]) === true
21963
22196
  });
21964
22197
  break;
21965
22198
  }
@@ -22085,7 +22318,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22085
22318
  {
22086
22319
  sessionId: params.sessionId,
22087
22320
  messageId: notification.messageId,
22088
- count: _optionalChain([this, 'access', _391 => _391.store, 'access', _392 => _392.getMessage, 'call', _393 => _393(notification.messageId), 'optionalAccess', _394 => _394.content, 'access', _395 => _395.length])
22321
+ count: _optionalChain([this, 'access', _394 => _394.store, 'access', _395 => _395.getMessage, 'call', _396 => _396(notification.messageId), 'optionalAccess', _397 => _397.content, 'access', _398 => _398.length])
22089
22322
  }
22090
22323
  );
22091
22324
  this.updateDroidWorkingState(
@@ -22107,7 +22340,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22107
22340
  {
22108
22341
  sessionId: params.sessionId,
22109
22342
  messageId: notification.messageId,
22110
- count: _optionalChain([this, 'access', _396 => _396.store, 'access', _397 => _397.getMessage, 'call', _398 => _398(notification.messageId), 'optionalAccess', _399 => _399.content, 'access', _400 => _400.length])
22343
+ count: _optionalChain([this, 'access', _399 => _399.store, 'access', _400 => _400.getMessage, 'call', _401 => _401(notification.messageId), 'optionalAccess', _402 => _402.content, 'access', _403 => _403.length])
22111
22344
  }
22112
22345
  );
22113
22346
  this.updateDroidWorkingState("thinking" /* Thinking */);
@@ -22121,6 +22354,24 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22121
22354
  this.store.notifyStreamingChange();
22122
22355
  break;
22123
22356
  }
22357
+ case "assistant_message_retracted" /* ASSISTANT_MESSAGE_RETRACTED */: {
22358
+ const pendingMessageId = this.pendingAssistantMessageId;
22359
+ const messageIds = /* @__PURE__ */ new Set([notification.messageId]);
22360
+ if (pendingMessageId) {
22361
+ messageIds.add(pendingMessageId);
22362
+ this.pendingAssistantMessageId = null;
22363
+ }
22364
+ const hadRetractedMessage = [...messageIds].some(
22365
+ (messageId) => this.store.getMessage(messageId) !== void 0
22366
+ );
22367
+ for (const messageId of messageIds) {
22368
+ this.store.removeMessage(messageId);
22369
+ }
22370
+ if (!hadRetractedMessage) break;
22371
+ this.store.flushStreamingChanges();
22372
+ this.store.flushNotify("message_thread_updated" /* MessageThreadUpdated */);
22373
+ break;
22374
+ }
22124
22375
  case "assistant_text_complete" /* ASSISTANT_TEXT_COMPLETE */: {
22125
22376
  logInfo("[SessionStateManager] Text block complete", {
22126
22377
  sessionId: params.sessionId,
@@ -22195,7 +22446,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22195
22446
  );
22196
22447
  } else {
22197
22448
  const lastMessage = this.store.getLastConversationMessage();
22198
- if (_optionalChain([lastMessage, 'optionalAccess', _401 => _401.role]) === "assistant" /* Assistant */) {
22449
+ if (_optionalChain([lastMessage, 'optionalAccess', _404 => _404.role]) === "assistant" /* Assistant */) {
22199
22450
  this.handleToolUseNotification(lastMessage.id, toolUse);
22200
22451
  } else {
22201
22452
  const messages = this.store.getMessages();
@@ -22211,7 +22462,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22211
22462
  id: pendingId,
22212
22463
  role: "assistant" /* Assistant */,
22213
22464
  content: [toolUse],
22214
- parentId: _optionalChain([lastMessage, 'optionalAccess', _402 => _402.id]),
22465
+ parentId: _optionalChain([lastMessage, 'optionalAccess', _405 => _405.id]),
22215
22466
  createdAt: Date.now(),
22216
22467
  updatedAt: Date.now()
22217
22468
  };
@@ -22371,7 +22622,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22371
22622
  case "executing_tool" /* ExecutingTool */:
22372
22623
  case "waiting_for_tool_confirmation" /* WaitingForToolConfirmation */:
22373
22624
  this.completeStreamingContentBlocks({
22374
- silent: _optionalChain([options, 'optionalAccess', _403 => _403.silent]) === true
22625
+ silent: _optionalChain([options, 'optionalAccess', _406 => _406.silent]) === true
22375
22626
  });
22376
22627
  break;
22377
22628
  case "thinking" /* Thinking */:
@@ -22386,13 +22637,13 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22386
22637
  }
22387
22638
  this.updateDroidWorkingState(newState);
22388
22639
  };
22389
- if (_optionalChain([options, 'optionalAccess', _404 => _404.silent]) === true) {
22640
+ if (_optionalChain([options, 'optionalAccess', _407 => _407.silent]) === true) {
22390
22641
  this.store.runWithStateEventsSuppressed(transition);
22391
22642
  } else {
22392
22643
  transition();
22393
22644
  }
22394
22645
  const didChange = previousState !== this.droidWorkingState;
22395
- if (didChange && _optionalChain([options, 'optionalAccess', _405 => _405.silent]) !== true) {
22646
+ if (didChange && _optionalChain([options, 'optionalAccess', _408 => _408.silent]) !== true) {
22396
22647
  this.store.flushNotify("working_state_changed" /* WorkingStateChanged */);
22397
22648
  }
22398
22649
  }
@@ -22652,14 +22903,14 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22652
22903
  }
22653
22904
  mergeOptimisticMessages(realMessages) {
22654
22905
  const entries = Array.from(this.optimisticMessages.values()).sort(
22655
- (a, b) => (_nullishCoalesce(_optionalChain([a, 'access', _406 => _406.messages, 'access', _407 => _407[0], 'optionalAccess', _408 => _408.createdAt]), () => ( 0))) - (_nullishCoalesce(_optionalChain([b, 'access', _409 => _409.messages, 'access', _410 => _410[0], 'optionalAccess', _411 => _411.createdAt]), () => ( 0)))
22906
+ (a, b) => (_nullishCoalesce(_optionalChain([a, 'access', _409 => _409.messages, 'access', _410 => _410[0], 'optionalAccess', _411 => _411.createdAt]), () => ( 0))) - (_nullishCoalesce(_optionalChain([b, 'access', _412 => _412.messages, 'access', _413 => _413[0], 'optionalAccess', _414 => _414.createdAt]), () => ( 0)))
22656
22907
  );
22657
22908
  const historicalSystemMessages = entries.filter(
22658
- (entry) => _optionalChain([entry, 'access', _412 => _412.messages, 'access', _413 => _413[0], 'optionalAccess', _414 => _414.role]) === "system" /* System */ && entry.leadingOrder === void 0
22909
+ (entry) => _optionalChain([entry, 'access', _415 => _415.messages, 'access', _416 => _416[0], 'optionalAccess', _417 => _417.role]) === "system" /* System */ && entry.leadingOrder === void 0
22659
22910
  ).flatMap((entry) => entry.messages);
22660
22911
  const leadingMessages = entries.filter((entry) => entry.leadingOrder !== void 0).sort((a, b) => (_nullishCoalesce(a.leadingOrder, () => ( 0))) - (_nullishCoalesce(b.leadingOrder, () => ( 0)))).flatMap((entry) => entry.messages);
22661
22912
  const pendingMessages = entries.filter(
22662
- (entry) => _optionalChain([entry, 'access', _415 => _415.messages, 'access', _416 => _416[0], 'optionalAccess', _417 => _417.role]) !== "system" /* System */ && entry.leadingOrder === void 0
22913
+ (entry) => _optionalChain([entry, 'access', _418 => _418.messages, 'access', _419 => _419[0], 'optionalAccess', _420 => _420.role]) !== "system" /* System */ && entry.leadingOrder === void 0
22663
22914
  ).flatMap((entry) => entry.messages);
22664
22915
  const leadingInsertIndex = leadingMessages.length === 0 ? 0 : this.findLeadingInsertIndex(realMessages);
22665
22916
  return [
@@ -22693,7 +22944,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22693
22944
  * yet below it. Ignores request ids that never staged a leading card.
22694
22945
  */
22695
22946
  rememberConfirmedLeadingMessage(requestId, messageId) {
22696
- if (_optionalChain([this, 'access', _418 => _418.optimisticMessages, 'access', _419 => _419.get, 'call', _420 => _420(requestId), 'optionalAccess', _421 => _421.leadingOrder]) === void 0) {
22947
+ if (_optionalChain([this, 'access', _421 => _421.optimisticMessages, 'access', _422 => _422.get, 'call', _423 => _423(requestId), 'optionalAccess', _424 => _424.leadingOrder]) === void 0) {
22697
22948
  return;
22698
22949
  }
22699
22950
  this.confirmedLeadingMessageIds.add(messageId);
@@ -22733,7 +22984,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22733
22984
  }
22734
22985
  this.optimisticMessages.set(requestId, {
22735
22986
  messages,
22736
- ..._optionalChain([options, 'optionalAccess', _422 => _422.leadingOrder]) !== void 0 ? { leadingOrder: options.leadingOrder } : {}
22987
+ ..._optionalChain([options, 'optionalAccess', _425 => _425.leadingOrder]) !== void 0 ? { leadingOrder: options.leadingOrder } : {}
22737
22988
  });
22738
22989
  this.store.notifyMessagesChanged();
22739
22990
  }
@@ -22745,7 +22996,7 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22745
22996
  * notification was lost.
22746
22997
  */
22747
22998
  getOptimisticMessage(requestId) {
22748
- return _optionalChain([this, 'access', _423 => _423.optimisticMessages, 'access', _424 => _424.get, 'call', _425 => _425(requestId), 'optionalAccess', _426 => _426.messages, 'access', _427 => _427[0]]);
22999
+ return _optionalChain([this, 'access', _426 => _426.optimisticMessages, 'access', _427 => _427.get, 'call', _428 => _428(requestId), 'optionalAccess', _429 => _429.messages, 'access', _430 => _430[0]]);
22749
23000
  }
22750
23001
  /** Keeps the unconfirmed half of a staged exchange until it arrives. */
22751
23002
  confirmOptimisticMessages(requestId, messageId) {
@@ -22970,8 +23221,8 @@ var SessionStateManager = (_class15 = class _SessionStateManager {
22970
23221
 
22971
23222
  // ../daemon-sdk/src/session/handlers/AskUserRequestHandler.ts
22972
23223
 
22973
- var AskUserRequestHandler = (_class16 = class _AskUserRequestHandler extends _eventemitter3.EventEmitter {constructor(...args2) { super(...args2); _class16.prototype.__init145.call(this); }
22974
- __init145() {this.pendingRequests = /* @__PURE__ */ new Map()}
23224
+ var AskUserRequestHandler = (_class16 = class _AskUserRequestHandler extends _eventemitter3.EventEmitter {constructor(...args2) { super(...args2); _class16.prototype.__init149.call(this); }
23225
+ __init149() {this.pendingRequests = /* @__PURE__ */ new Map()}
22975
23226
  static buildResolutionContext(pending) {
22976
23227
  return {
22977
23228
  sessionId: pending.sessionId,
@@ -22986,14 +23237,14 @@ var AskUserRequestHandler = (_class16 = class _AskUserRequestHandler extends _ev
22986
23237
  toolCallId: request.params.toolCallId,
22987
23238
  count: request.params.questions.length
22988
23239
  });
22989
- const machineId = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _428 => _428.machineId]), () => ( _optionalChain([this, 'access', _429 => _429.pendingRequests, 'access', _430 => _430.get, 'call', _431 => _431(id), 'optionalAccess', _432 => _432.machineId])));
23240
+ const machineId = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _431 => _431.machineId]), () => ( _optionalChain([this, 'access', _432 => _432.pendingRequests, 'access', _433 => _433.get, 'call', _434 => _434(id), 'optionalAccess', _435 => _435.machineId])));
22990
23241
  const pending = {
22991
23242
  requestId: id,
22992
23243
  sessionId,
22993
23244
  toolCallId: request.params.toolCallId,
22994
23245
  questions: request.params.questions,
22995
23246
  timestamp: Date.now(),
22996
- ..._optionalChain([context, 'optionalAccess', _433 => _433.isRestored]) ? { isRestored: true } : {},
23247
+ ..._optionalChain([context, 'optionalAccess', _436 => _436.isRestored]) ? { isRestored: true } : {},
22997
23248
  ...machineId ? { machineId } : {}
22998
23249
  };
22999
23250
  const existingRequest = this.pendingRequests.get(id);
@@ -23005,6 +23256,11 @@ var AskUserRequestHandler = (_class16 = class _AskUserRequestHandler extends _ev
23005
23256
  });
23006
23257
  return;
23007
23258
  }
23259
+ for (const [pendingId, existing] of this.pendingRequests) {
23260
+ if (existing.sessionId === sessionId && existing.toolCallId === pending.toolCallId) {
23261
+ this.clearAskUser(pendingId);
23262
+ }
23263
+ }
23008
23264
  this.pendingRequests.set(id, pending);
23009
23265
  this.emit("askUserRequested", pending);
23010
23266
  }
@@ -23103,9 +23359,9 @@ var AskUserRequestHandler = (_class16 = class _AskUserRequestHandler extends _ev
23103
23359
  }, _class16);
23104
23360
 
23105
23361
  // ../daemon-sdk/src/session/handlers/PendingUserActionStore.ts
23106
- var PendingUserActionStore = (_class17 = class {constructor() { _class17.prototype.__init146.call(this);_class17.prototype.__init147.call(this); }
23107
- __init146() {this.permissionsByToolUseId = /* @__PURE__ */ new Map()}
23108
- __init147() {this.askUsersBySession = /* @__PURE__ */ new Map()}
23362
+ var PendingUserActionStore = (_class17 = class {constructor() { _class17.prototype.__init150.call(this);_class17.prototype.__init151.call(this); }
23363
+ __init150() {this.permissionsByToolUseId = /* @__PURE__ */ new Map()}
23364
+ __init151() {this.askUsersBySession = /* @__PURE__ */ new Map()}
23109
23365
  savePermission(action) {
23110
23366
  this.permissionsByToolUseId.set(action.toolUseId, action);
23111
23367
  logInfo("[PendingUserActionStore] Stored permission for later replay", {
@@ -23133,7 +23389,7 @@ var PendingUserActionStore = (_class17 = class {constructor() { _class17.prototy
23133
23389
  return this.permissionsByToolUseId.get(toolUseId);
23134
23390
  }
23135
23391
  getForToolCall(sessionId, toolCallId) {
23136
- return _optionalChain([this, 'access', _434 => _434.askUsersBySession, 'access', _435 => _435.get, 'call', _436 => _436(sessionId), 'optionalAccess', _437 => _437.get, 'call', _438 => _438(toolCallId)]);
23392
+ return _optionalChain([this, 'access', _437 => _437.askUsersBySession, 'access', _438 => _438.get, 'call', _439 => _439(sessionId), 'optionalAccess', _440 => _440.get, 'call', _441 => _441(toolCallId)]);
23137
23393
  }
23138
23394
  /** Remove and return a buffered permission response by tool-use id. */
23139
23395
  takeForToolUse(toolUseId) {
@@ -23168,7 +23424,7 @@ var PendingUserActionStore = (_class17 = class {constructor() { _class17.prototy
23168
23424
  permCount += 1;
23169
23425
  }
23170
23426
  }
23171
- const askCount = _nullishCoalesce(_optionalChain([this, 'access', _439 => _439.askUsersBySession, 'access', _440 => _440.get, 'call', _441 => _441(sessionId), 'optionalAccess', _442 => _442.size]), () => ( 0));
23427
+ const askCount = _nullishCoalesce(_optionalChain([this, 'access', _442 => _442.askUsersBySession, 'access', _443 => _443.get, 'call', _444 => _444(sessionId), 'optionalAccess', _445 => _445.size]), () => ( 0));
23172
23428
  this.askUsersBySession.delete(sessionId);
23173
23429
  const total = permCount + askCount;
23174
23430
  if (total > 0) {
@@ -23194,9 +23450,9 @@ var PendingUserActionStore = (_class17 = class {constructor() { _class17.prototy
23194
23450
  function normalizeAssociatedSessionIds(sessionId, associatedSessionIds) {
23195
23451
  return Array.from(/* @__PURE__ */ new Set([sessionId, ..._nullishCoalesce(associatedSessionIds, () => ( []))]));
23196
23452
  }
23197
- var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler extends _eventemitter3.EventEmitter {constructor(...args3) { super(...args3); _class18.prototype.__init148.call(this);_class18.prototype.__init149.call(this); }
23198
- __init148() {this.pendingPermissions = /* @__PURE__ */ new Map()}
23199
- __init149() {this.statistics = {
23453
+ var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler extends _eventemitter3.EventEmitter {constructor(...args3) { super(...args3); _class18.prototype.__init152.call(this);_class18.prototype.__init153.call(this); }
23454
+ __init152() {this.pendingPermissions = /* @__PURE__ */ new Map()}
23455
+ __init153() {this.statistics = {
23200
23456
  total: 0,
23201
23457
  approved: 0,
23202
23458
  denied: 0,
@@ -23240,7 +23496,7 @@ var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler exten
23240
23496
  ...existingPermission.associatedSessionIds,
23241
23497
  ...requestAssociatedSessionIds
23242
23498
  ]) : requestAssociatedSessionIds;
23243
- const machineId = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _443 => _443.machineId]), () => ( _optionalChain([existingPermission, 'optionalAccess', _444 => _444.machineId])));
23499
+ const machineId = _nullishCoalesce(_optionalChain([context, 'optionalAccess', _446 => _446.machineId]), () => ( _optionalChain([existingPermission, 'optionalAccess', _447 => _447.machineId])));
23244
23500
  const pendingPermission = {
23245
23501
  requestId: id,
23246
23502
  sessionId,
@@ -23248,7 +23504,7 @@ var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler exten
23248
23504
  toolUses,
23249
23505
  options,
23250
23506
  timestamp: Date.now(),
23251
- ..._optionalChain([context, 'optionalAccess', _445 => _445.isRestored]) ? { isRestored: true } : {},
23507
+ ..._optionalChain([context, 'optionalAccess', _448 => _448.isRestored]) ? { isRestored: true } : {},
23252
23508
  ...machineId ? { machineId } : {}
23253
23509
  };
23254
23510
  if (existingPermission) {
@@ -23329,7 +23585,7 @@ var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler exten
23329
23585
  clearPermission(id, options) {
23330
23586
  const pending = this.pendingPermissions.get(id);
23331
23587
  this.pendingPermissions.delete(id);
23332
- if (_optionalChain([options, 'optionalAccess', _446 => _446.emitResolved])) {
23588
+ if (_optionalChain([options, 'optionalAccess', _449 => _449.emitResolved])) {
23333
23589
  this.emit(
23334
23590
  "permissionResolved",
23335
23591
  id,
@@ -23353,7 +23609,7 @@ var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler exten
23353
23609
  if (permission.sessionId !== sessionId) {
23354
23610
  continue;
23355
23611
  }
23356
- if (_optionalChain([options, 'optionalAccess', _447 => _447.preserveRelayed]) && permission.associatedSessionIds.some(
23612
+ if (_optionalChain([options, 'optionalAccess', _450 => _450.preserveRelayed]) && permission.associatedSessionIds.some(
23357
23613
  (associatedId) => associatedId !== sessionId
23358
23614
  )) {
23359
23615
  continue;
@@ -23409,25 +23665,28 @@ var PermissionRequestHandler = (_class18 = class _PermissionRequestHandler exten
23409
23665
  // ../daemon-sdk/src/session/state/MultiSessionStateManager.ts
23410
23666
  var DEFAULT_MAX_CAPACITY = 20;
23411
23667
  var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23412
- __init150() {this.sessions = /* @__PURE__ */ new Map()}
23413
- __init151() {this.sessionStateEvents = new (0, _eventemitter3.EventEmitter)()}
23668
+ __init154() {this.sessions = /* @__PURE__ */ new Map()}
23669
+ __init155() {this.sessionStateEvents = new (0, _eventemitter3.EventEmitter)()}
23414
23670
  // Queue notifications that arrive before session is initialized
23415
23671
  // Prevents state drift when notifications arrive during loadSession request
23416
- __init152() {this.pendingNotifications = /* @__PURE__ */ new Map()}
23672
+ __init156() {this.pendingNotifications = /* @__PURE__ */ new Map()}
23417
23673
  // Track sessions that were not found (persists across component remounts)
23418
- __init153() {this.notFoundSessions = /* @__PURE__ */ new Set()}
23674
+ __init157() {this.notFoundSessions = /* @__PURE__ */ new Set()}
23419
23675
  // Track throwaway pre-init sessions (the new-session page warms a session
23420
23676
  // before the user submits). These reach Loaded/Loading like real sessions but
23421
23677
  // must NOT pin a computer connection: an abandoned pre-init should never keep
23422
23678
  // the shared controller alive. `hasActiveSessionsForMachine` skips them.
23423
- __init154() {this.preInitSessions = /* @__PURE__ */ new Set()}
23679
+ __init158() {this.preInitSessions = /* @__PURE__ */ new Set()}
23424
23680
  // Persisted tool-use summaries for Task-spawned subagents, keyed by child
23425
23681
  // session id. Survives child-session removal so the Task renderer can show a
23426
23682
  // real tool-use count after the child closes or the parent session reloads.
23427
23683
  // Hydrated from loadSession (disk-backed) and updated live on completion.
23428
- __init155() {this.subagentInvocationSummaries = /* @__PURE__ */ new Map()}
23684
+ __init159() {this.subagentInvocationSummaries = /* @__PURE__ */ new Map()}
23685
+ __init160() {this.subagentInvocationSummaryRevision = 0}
23686
+ __init161() {this.subagentInvocationSummaryLastModifiedRevision = /* @__PURE__ */ new Map()}
23687
+ __init162() {this.subagentInvocationSummaryEpoch = 0}
23429
23688
  // Track sessions that have already had their initial prompt sent (persists across remounts)
23430
- __init156() {this.sentInitialPromptSessions = /* @__PURE__ */ new Set()}
23689
+ __init163() {this.sentInitialPromptSessions = /* @__PURE__ */ new Set()}
23431
23690
  // Session-scoped prompt state, owned here (app lifetime) rather than by the
23432
23691
  // per-connection DaemonSessionController: pending prompts and buffered
23433
23692
  // answers must survive controller teardown/recreation (machine removal,
@@ -23435,9 +23694,9 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23435
23694
  // loadState stayed Loaded and suppressed the daemon-side restore. Entries
23436
23695
  // are keyed by globally unique request ids and carry their sessionId, so a
23437
23696
  // single shared instance serves every machine's controller.
23438
- __init157() {this._askUserRequests = new AskUserRequestHandler()}
23439
- __init158() {this._permissionRequests = new PermissionRequestHandler()}
23440
- __init159() {this._pendingUserActions = new PendingUserActionStore()}
23697
+ __init164() {this._askUserRequests = new AskUserRequestHandler()}
23698
+ __init165() {this._permissionRequests = new PermissionRequestHandler()}
23699
+ __init166() {this._pendingUserActions = new PendingUserActionStore()}
23441
23700
  // Narrowed public views: per-entry read/subscribe/mutate only. Whole-store
23442
23701
  // teardown stays internal (see removeSession / clear).
23443
23702
  get askUserRequests() {
@@ -23462,9 +23721,9 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23462
23721
  // - sessionLoadOptions: spawn options replayed on any later
23463
23722
  // ensureSessionLoaded / self-resume so the session is not respawned with
23464
23723
  // the wrong flags.
23465
- __init160() {this.inactiveSessions = /* @__PURE__ */ new Set()}
23466
- __init161() {this.sessionsWithConcurrentPrompts = /* @__PURE__ */ new Set()}
23467
- __init162() {this.sessionLoadOptions = /* @__PURE__ */ new Map()}
23724
+ __init167() {this.inactiveSessions = /* @__PURE__ */ new Set()}
23725
+ __init168() {this.sessionsWithConcurrentPrompts = /* @__PURE__ */ new Set()}
23726
+ __init169() {this.sessionLoadOptions = /* @__PURE__ */ new Map()}
23468
23727
 
23469
23728
 
23470
23729
  // Store for explicit setting changes made before a concrete session store
@@ -23481,21 +23740,21 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23481
23740
  * `externalRequestId`, so CREATE_MESSAGE notifications confirm by exact
23482
23741
  * id match via confirmOptimisticSubmit.
23483
23742
  */
23484
- __init163() {this.pendingOptimisticSubmits = /* @__PURE__ */ new Map()}
23743
+ __init170() {this.pendingOptimisticSubmits = /* @__PURE__ */ new Map()}
23485
23744
  /**
23486
23745
  * Default error timeout for pending submits. Replays the
23487
23746
  * OptimisticUpdateConfig defaults from before the manager was deleted.
23488
23747
  */
23489
- __init164() {this.OPTIMISTIC_SUBMIT_ERROR_TIMEOUT_MS = 2e4}
23748
+ __init171() {this.OPTIMISTIC_SUBMIT_ERROR_TIMEOUT_MS = 2e4}
23490
23749
  // LRU cache eviction state
23491
23750
 
23492
- __init165() {this.lastAccessTime = /* @__PURE__ */ new Map()}
23493
- __init166() {this.accessCounter = 0}
23494
- __init167() {this.activeSessionId = null}
23495
- constructor(options) {;_class19.prototype.__init150.call(this);_class19.prototype.__init151.call(this);_class19.prototype.__init152.call(this);_class19.prototype.__init153.call(this);_class19.prototype.__init154.call(this);_class19.prototype.__init155.call(this);_class19.prototype.__init156.call(this);_class19.prototype.__init157.call(this);_class19.prototype.__init158.call(this);_class19.prototype.__init159.call(this);_class19.prototype.__init160.call(this);_class19.prototype.__init161.call(this);_class19.prototype.__init162.call(this);_class19.prototype.__init163.call(this);_class19.prototype.__init164.call(this);_class19.prototype.__init165.call(this);_class19.prototype.__init166.call(this);_class19.prototype.__init167.call(this);_class19.prototype.__init168.call(this);
23496
- this.onToolProgressUpdate = _optionalChain([options, 'optionalAccess', _453 => _453.onToolProgressUpdate]);
23497
- this.maxCapacity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _454 => _454.maxCapacity]), () => ( DEFAULT_MAX_CAPACITY));
23498
- this.isProgressiveUiRenderingEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _455 => _455.enableProgressiveUiRendering]), () => ( true));
23751
+ __init172() {this.lastAccessTime = /* @__PURE__ */ new Map()}
23752
+ __init173() {this.accessCounter = 0}
23753
+ __init174() {this.activeSessionId = null}
23754
+ constructor(options) {;_class19.prototype.__init154.call(this);_class19.prototype.__init155.call(this);_class19.prototype.__init156.call(this);_class19.prototype.__init157.call(this);_class19.prototype.__init158.call(this);_class19.prototype.__init159.call(this);_class19.prototype.__init160.call(this);_class19.prototype.__init161.call(this);_class19.prototype.__init162.call(this);_class19.prototype.__init163.call(this);_class19.prototype.__init164.call(this);_class19.prototype.__init165.call(this);_class19.prototype.__init166.call(this);_class19.prototype.__init167.call(this);_class19.prototype.__init168.call(this);_class19.prototype.__init169.call(this);_class19.prototype.__init170.call(this);_class19.prototype.__init171.call(this);_class19.prototype.__init172.call(this);_class19.prototype.__init173.call(this);_class19.prototype.__init174.call(this);_class19.prototype.__init175.call(this);
23755
+ this.onToolProgressUpdate = _optionalChain([options, 'optionalAccess', _456 => _456.onToolProgressUpdate]);
23756
+ this.maxCapacity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _457 => _457.maxCapacity]), () => ( DEFAULT_MAX_CAPACITY));
23757
+ this.isProgressiveUiRenderingEnabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _458 => _458.enableProgressiveUiRendering]), () => ( true));
23499
23758
  this.pendingStore = new SessionStore({
23500
23759
  sessionId: PENDING_SETTINGS_STORE_SESSION_ID,
23501
23760
  machineId: "",
@@ -23509,7 +23768,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23509
23768
  onStateEvent: this.emitSessionStateEvent
23510
23769
  });
23511
23770
  }
23512
- __init168() {this.emitSessionStateEvent = (event, payload) => {
23771
+ __init175() {this.emitSessionStateEvent = (event, payload) => {
23513
23772
  for (const listener of this.sessionStateEvents.listeners(event)) {
23514
23773
  try {
23515
23774
  Reflect.apply(listener, void 0, [payload]);
@@ -23519,7 +23778,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23519
23778
  });
23520
23779
  }
23521
23780
  }
23522
- if (event === "working_state_changed" /* WorkingStateChanged */ && this.sessions.size > this.maxCapacity && _optionalChain([this, 'access', _456 => _456.sessions, 'access', _457 => _457.get, 'call', _458 => _458(payload.sessionId), 'optionalAccess', _459 => _459.getDroidWorkingState, 'call', _460 => _460()]) === "idle" /* Idle */) {
23781
+ if (event === "working_state_changed" /* WorkingStateChanged */ && this.sessions.size > this.maxCapacity && _optionalChain([this, 'access', _459 => _459.sessions, 'access', _460 => _460.get, 'call', _461 => _461(payload.sessionId), 'optionalAccess', _462 => _462.getDroidWorkingState, 'call', _463 => _463()]) === "idle" /* Idle */) {
23523
23782
  this.evictIfNeeded();
23524
23783
  }
23525
23784
  }}
@@ -23826,7 +24085,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23826
24085
  const entry = this.pendingOptimisticSubmits.get(externalKey);
23827
24086
  if (!entry) return;
23828
24087
  entry.status = "error" /* Error */;
23829
- _optionalChain([entry, 'access', _461 => _461.onError, 'optionalCall', _462 => _462(
24088
+ _optionalChain([entry, 'access', _464 => _464.onError, 'optionalCall', _465 => _465(
23830
24089
  new MetaError("Optimistic submit timeout - no server confirmation")
23831
24090
  )]);
23832
24091
  }, _nullishCoalesce(errorTimeoutMs, () => ( this.OPTIMISTIC_SUBMIT_ERROR_TIMEOUT_MS)));
@@ -23880,7 +24139,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23880
24139
  }
23881
24140
  }
23882
24141
  this.pendingOptimisticSubmits.delete(externalKey);
23883
- _optionalChain([pending, 'access', _463 => _463.onConfirm, 'optionalCall', _464 => _464()]);
24142
+ _optionalChain([pending, 'access', _466 => _466.onConfirm, 'optionalCall', _467 => _467()]);
23884
24143
  return true;
23885
24144
  }
23886
24145
  /**
@@ -23994,9 +24253,9 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
23994
24253
  const priorMessageIds = new Set(
23995
24254
  manager.getMessages().map((message) => message.id)
23996
24255
  );
23997
- manager.setHasOlderMessages(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _465 => _465.hasOlderMessages]), () => ( false)));
23998
- manager.setLoadedMessageLimit(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _466 => _466.loadedMessageLimit]), () => ( 0)));
23999
- const workingState = _optionalChain([options, 'optionalAccess', _467 => _467.workingState]);
24256
+ manager.setHasOlderMessages(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _468 => _468.hasOlderMessages]), () => ( false)));
24257
+ manager.setLoadedMessageLimit(_nullishCoalesce(_optionalChain([options, 'optionalAccess', _469 => _469.loadedMessageLimit]), () => ( 0)));
24258
+ const workingState = _optionalChain([options, 'optionalAccess', _470 => _470.workingState]);
24000
24259
  if (workingState !== void 0 && manager.getDroidWorkingState() !== workingState) {
24001
24260
  manager.hydrateDroidWorkingState(workingState);
24002
24261
  }
@@ -24057,10 +24316,10 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24057
24316
  if (parentSessionId === childSessionId) {
24058
24317
  return;
24059
24318
  }
24060
- const parentCwd = _nullishCoalesce(_optionalChain([this, 'access', _468 => _468.sessions, 'access', _469 => _469.get, 'call', _470 => _470(parentSessionId), 'optionalAccess', _471 => _471.getStore, 'call', _472 => _472(), 'access', _473 => _473.getCwd, 'call', _474 => _474()]), () => ( null));
24319
+ const parentCwd = _nullishCoalesce(_optionalChain([this, 'access', _471 => _471.sessions, 'access', _472 => _472.get, 'call', _473 => _473(parentSessionId), 'optionalAccess', _474 => _474.getStore, 'call', _475 => _475(), 'access', _476 => _476.getCwd, 'call', _477 => _477()]), () => ( null));
24061
24320
  const existingManager = this.sessions.get(childSessionId);
24062
- const previousLoadState = _optionalChain([existingManager, 'optionalAccess', _475 => _475.getLoadState, 'call', _476 => _476()]);
24063
- const previousWorkingState = _optionalChain([existingManager, 'optionalAccess', _477 => _477.getDroidWorkingState, 'call', _478 => _478()]);
24321
+ const previousLoadState = _optionalChain([existingManager, 'optionalAccess', _478 => _478.getLoadState, 'call', _479 => _479()]);
24322
+ const previousWorkingState = _optionalChain([existingManager, 'optionalAccess', _480 => _480.getDroidWorkingState, 'call', _481 => _481()]);
24064
24323
  const manager = this.ensureSessionManager(childSessionId, machineId);
24065
24324
  const store = manager.getStore();
24066
24325
  if (!store.getCallingSessionId()) {
@@ -24147,6 +24406,11 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24147
24406
  setSubagentInvocationSummary(childSessionId, summary) {
24148
24407
  _MultiSessionStateManager.validateSessionId(childSessionId);
24149
24408
  this.subagentInvocationSummaries.set(childSessionId, summary);
24409
+ this.subagentInvocationSummaryRevision += 1;
24410
+ this.subagentInvocationSummaryLastModifiedRevision.set(
24411
+ childSessionId,
24412
+ this.subagentInvocationSummaryRevision
24413
+ );
24150
24414
  this.emitSessionStateEvent(
24151
24415
  "subagent_invocation_summary_updated" /* SubagentInvocationSummaryUpdated */,
24152
24416
  { sessionId: childSessionId }
@@ -24159,20 +24423,35 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24159
24423
  getSubagentInvocationSummary(childSessionId) {
24160
24424
  return this.subagentInvocationSummaries.get(childSessionId);
24161
24425
  }
24426
+ /**
24427
+ * Capture the epoch/revision pair immediately before loadSession. Pass the
24428
+ * same pair to hydrateSubagentInvocationSummaries so reset and per-child live
24429
+ * updates win over stale load responses without blocking unrelated children.
24430
+ */
24431
+ captureSubagentInvocationSummaryRevision() {
24432
+ return {
24433
+ epoch: this.subagentInvocationSummaryEpoch,
24434
+ revision: this.subagentInvocationSummaryRevision
24435
+ };
24436
+ }
24162
24437
  /**
24163
24438
  * Bulk-hydrate subagent summaries (e.g. from a loadSession response). Existing
24164
24439
  * entries are preserved unless overwritten by a matching child session id.
24165
24440
  */
24166
- hydrateSubagentInvocationSummaries(summaries) {
24441
+ hydrateSubagentInvocationSummaries(summaries, expectedRevision) {
24442
+ if (expectedRevision !== void 0 && expectedRevision.epoch !== this.subagentInvocationSummaryEpoch) {
24443
+ return;
24444
+ }
24167
24445
  for (const summary of summaries) {
24168
24446
  if (!_MultiSessionStateManager.isValidSessionId(summary.childSessionId)) {
24169
24447
  continue;
24170
24448
  }
24171
- this.subagentInvocationSummaries.set(summary.childSessionId, summary);
24172
- this.emitSessionStateEvent(
24173
- "subagent_invocation_summary_updated" /* SubagentInvocationSummaryUpdated */,
24174
- { sessionId: summary.childSessionId }
24175
- );
24449
+ if (expectedRevision !== void 0 && (_nullishCoalesce(this.subagentInvocationSummaryLastModifiedRevision.get(
24450
+ summary.childSessionId
24451
+ ), () => ( 0))) > expectedRevision.revision) {
24452
+ continue;
24453
+ }
24454
+ this.setSubagentInvocationSummary(summary.childSessionId, summary);
24176
24455
  }
24177
24456
  }
24178
24457
  /**
@@ -24242,11 +24521,10 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24242
24521
  }
24243
24522
  /**
24244
24523
  * Roll every session bound to the given machine back to NotLoaded, emitting a
24245
- * state change for each so subscribers re-render. Called just before a forced
24246
- * teardown of the machine's controller: without this, sessions keep MSSM's
24247
- * stale Loaded state and the reconnect/remount path skips the loadSession that
24248
- * would rebind them, leaving them hung "as if disconnected" while the machine
24249
- * is actually still connected.
24524
+ * state change for each so subscribers re-render. Called when a controller
24525
+ * disconnects or is forcibly torn down. Without this, sessions keep MSSM's
24526
+ * stale Loaded state and the reconnect/remount path skips the loadSession
24527
+ * that would rebind them.
24250
24528
  */
24251
24529
  markSessionsNotLoadedForMachine(machineId) {
24252
24530
  for (const [sessionId, manager] of this.sessions.entries()) {
@@ -24278,7 +24556,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24278
24556
  }
24279
24557
  getCurrentTodos(sessionId) {
24280
24558
  _MultiSessionStateManager.validateSessionId(sessionId);
24281
- return _nullishCoalesce(_optionalChain([this, 'access', _479 => _479.sessions, 'access', _480 => _480.get, 'call', _481 => _481(sessionId), 'optionalAccess', _482 => _482.getCurrentTodos, 'call', _483 => _483()]), () => ( null));
24559
+ return _nullishCoalesce(_optionalChain([this, 'access', _482 => _482.sessions, 'access', _483 => _483.get, 'call', _484 => _484(sessionId), 'optionalAccess', _485 => _485.getCurrentTodos, 'call', _486 => _486()]), () => ( null));
24282
24560
  }
24283
24561
  /**
24284
24562
  * Remove a session from management when it is definitively gone (closed,
@@ -24343,6 +24621,9 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24343
24621
  this.sessions.clear();
24344
24622
  this.lastAccessTime.clear();
24345
24623
  this.subagentInvocationSummaries.clear();
24624
+ this.subagentInvocationSummaryLastModifiedRevision.clear();
24625
+ this.subagentInvocationSummaryRevision += 1;
24626
+ this.subagentInvocationSummaryEpoch += 1;
24346
24627
  this.preInitSessions.clear();
24347
24628
  this._askUserRequests.clearAll();
24348
24629
  this._permissionRequests.clearAllPermissions();
@@ -24452,7 +24733,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24452
24733
  }
24453
24734
  if (newUserTexts.size === 0) return;
24454
24735
  for (const entry of pendingForSession) {
24455
- const optimistic = _optionalChain([this, 'access', _484 => _484.sessions, 'access', _485 => _485.get, 'call', _486 => _486(sessionId), 'optionalAccess', _487 => _487.getOptimisticMessage, 'call', _488 => _488(entry.externalKey)]);
24736
+ const optimistic = _optionalChain([this, 'access', _487 => _487.sessions, 'access', _488 => _488.get, 'call', _489 => _489(sessionId), 'optionalAccess', _490 => _490.getOptimisticMessage, 'call', _491 => _491(entry.externalKey)]);
24456
24737
  if (!optimistic) continue;
24457
24738
  const optimisticText = _MultiSessionStateManager.extractUserText(optimistic);
24458
24739
  if (!optimisticText) continue;
@@ -24506,7 +24787,7 @@ var MultiSessionStateManager = (_class19 = class _MultiSessionStateManager {
24506
24787
  getQueuedMessage(sessionId, requestId) {
24507
24788
  _MultiSessionStateManager.validateSessionId(sessionId);
24508
24789
  const manager = this.sessions.get(sessionId);
24509
- return _nullishCoalesce(_optionalChain([manager, 'optionalAccess', _489 => _489.getQueuedMessage, 'call', _490 => _490(requestId)]), () => ( null));
24790
+ return _nullishCoalesce(_optionalChain([manager, 'optionalAccess', _492 => _492.getQueuedMessage, 'call', _493 => _493(requestId)]), () => ( null));
24510
24791
  }
24511
24792
  /**
24512
24793
  * Clear queues for all sessions (called on disconnect)
@@ -25151,7 +25432,7 @@ async function cancelPermissionRequest(controller, sessionId, requestId, onError
25151
25432
  selectedOption: "cancel" /* Cancel */
25152
25433
  });
25153
25434
  } catch (error) {
25154
- _optionalChain([onError, 'optionalCall', _491 => _491(toError2(error))]);
25435
+ _optionalChain([onError, 'optionalCall', _494 => _494(toError2(error))]);
25155
25436
  }
25156
25437
  }
25157
25438
  async function cancelAskUserRequest(controller, sessionId, requestId, onError) {
@@ -25162,12 +25443,12 @@ async function cancelAskUserRequest(controller, sessionId, requestId, onError) {
25162
25443
  result: { cancelled: true, answers: [] }
25163
25444
  });
25164
25445
  } catch (error) {
25165
- _optionalChain([onError, 'optionalCall', _492 => _492(toError2(error))]);
25446
+ _optionalChain([onError, 'optionalCall', _495 => _495(toError2(error))]);
25166
25447
  }
25167
25448
  }
25168
25449
  var ConnectedDroidSessionImpl = (_class20 = class {
25169
25450
  /** @internal */
25170
- constructor(controller, id, handlers, onDetach) {;_class20.prototype.__init169.call(this);_class20.prototype.__init170.call(this);
25451
+ constructor(controller, id, handlers, onDetach) {;_class20.prototype.__init176.call(this);_class20.prototype.__init177.call(this);
25171
25452
  this.controller = controller;
25172
25453
  this.id = id;
25173
25454
  this.handlers = handlers;
@@ -25177,8 +25458,8 @@ var ConnectedDroidSessionImpl = (_class20 = class {
25177
25458
 
25178
25459
 
25179
25460
 
25180
- __init169() {this.activeBridges = /* @__PURE__ */ new Set()}
25181
- __init170() {this.status = "attached"}
25461
+ __init176() {this.activeBridges = /* @__PURE__ */ new Set()}
25462
+ __init177() {this.status = "attached"}
25182
25463
 
25183
25464
 
25184
25465
 
@@ -25333,7 +25614,7 @@ var ConnectedDroidSessionImpl = (_class20 = class {
25333
25614
  ...response
25334
25615
  });
25335
25616
  } catch (error) {
25336
- _optionalChain([this, 'access', _493 => _493.handlers, 'access', _494 => _494.onError, 'optionalCall', _495 => _495(toError2(error))]);
25617
+ _optionalChain([this, 'access', _496 => _496.handlers, 'access', _497 => _497.onError, 'optionalCall', _498 => _498(toError2(error))]);
25337
25618
  await this.cancelPermission(permission.requestId);
25338
25619
  }
25339
25620
  }
@@ -25354,7 +25635,7 @@ var ConnectedDroidSessionImpl = (_class20 = class {
25354
25635
  result
25355
25636
  });
25356
25637
  } catch (error) {
25357
- _optionalChain([this, 'access', _496 => _496.handlers, 'access', _497 => _497.onError, 'optionalCall', _498 => _498(toError2(error))]);
25638
+ _optionalChain([this, 'access', _499 => _499.handlers, 'access', _500 => _500.onError, 'optionalCall', _501 => _501(toError2(error))]);
25358
25639
  await this.cancelAskUser(request.requestId);
25359
25640
  }
25360
25641
  }
@@ -25388,7 +25669,7 @@ var ConnectedDroidSessionImpl = (_class20 = class {
25388
25669
  }
25389
25670
  reportError(error) {
25390
25671
  this.signalError(error);
25391
- _optionalChain([this, 'access', _499 => _499.handlers, 'access', _500 => _500.onError, 'optionalCall', _501 => _501(error)]);
25672
+ _optionalChain([this, 'access', _502 => _502.handlers, 'access', _503 => _503.onError, 'optionalCall', _504 => _504(error)]);
25392
25673
  }
25393
25674
  async runReplacement(operation) {
25394
25675
  this.ensureAttached();
@@ -25488,7 +25769,7 @@ var SessionsResourceImpl = class {
25488
25769
  });
25489
25770
  session.setMetadata(
25490
25771
  result.settings,
25491
- _nullishCoalesce(_optionalChain([result, 'access', _502 => _502.worktree, 'optionalAccess', _503 => _503.path]), () => ( publicSessionOptions.cwd))
25772
+ _nullishCoalesce(_optionalChain([result, 'access', _505 => _505.worktree, 'optionalAccess', _506 => _506.path]), () => ( publicSessionOptions.cwd))
25492
25773
  );
25493
25774
  return session;
25494
25775
  } catch (error) {
@@ -25538,7 +25819,7 @@ var SessionsResourceImpl = class {
25538
25819
  }
25539
25820
  };
25540
25821
  var ConnectedDroidImpl = (_class21 = class {
25541
- constructor(controller, apiKey, handlers) {;_class21.prototype.__init171.call(this);_class21.prototype.__init172.call(this);_class21.prototype.__init173.call(this);_class21.prototype.__init174.call(this);_class21.prototype.__init175.call(this);
25822
+ constructor(controller, apiKey, handlers) {;_class21.prototype.__init178.call(this);_class21.prototype.__init179.call(this);_class21.prototype.__init180.call(this);_class21.prototype.__init181.call(this);_class21.prototype.__init182.call(this);
25542
25823
  this.controller = controller;
25543
25824
  this.sessions = new SessionsResourceImpl(
25544
25825
  controller,
@@ -25571,10 +25852,10 @@ var ConnectedDroidImpl = (_class21 = class {
25571
25852
  }
25572
25853
 
25573
25854
 
25574
- __init171() {this.sessionHandles = /* @__PURE__ */ new Map()}
25575
- __init172() {this.disconnected = false}
25855
+ __init178() {this.sessionHandles = /* @__PURE__ */ new Map()}
25856
+ __init179() {this.disconnected = false}
25576
25857
 
25577
- __init173() {this.permissionHandler = (permission) => {
25858
+ __init180() {this.permissionHandler = (permission) => {
25578
25859
  const session = this.getPermissionSession(permission);
25579
25860
  if (session) {
25580
25861
  void session.respondToPermission(permission);
@@ -25587,7 +25868,7 @@ var ConnectedDroidImpl = (_class21 = class {
25587
25868
  this.errorHandler
25588
25869
  );
25589
25870
  }}
25590
- __init174() {this.askUserHandler = (request) => {
25871
+ __init181() {this.askUserHandler = (request) => {
25591
25872
  const session = this.sessionHandles.get(request.sessionId);
25592
25873
  if (session) {
25593
25874
  void session.respondToAskUser(request);
@@ -25600,8 +25881,8 @@ var ConnectedDroidImpl = (_class21 = class {
25600
25881
  this.errorHandler
25601
25882
  );
25602
25883
  }}
25603
- __init175() {this.sessionNotificationHandler = ({ sessionId, notification }) => {
25604
- _optionalChain([this, 'access', _509 => _509.sessionHandles, 'access', _510 => _510.get, 'call', _511 => _511(sessionId), 'optionalAccess', _512 => _512.handleMetadataNotification, 'call', _513 => _513(notification)]);
25884
+ __init182() {this.sessionNotificationHandler = ({ sessionId, notification }) => {
25885
+ _optionalChain([this, 'access', _512 => _512.sessionHandles, 'access', _513 => _513.get, 'call', _514 => _514(sessionId), 'optionalAccess', _515 => _515.handleMetadataNotification, 'call', _516 => _516(notification)]);
25605
25886
  }}
25606
25887
  disconnect() {
25607
25888
  if (this.disconnected) return;
@@ -25638,7 +25919,7 @@ function createConnectedDroid(controller, apiKey, handlers = {}) {
25638
25919
  return new ConnectedDroidImpl(controller, apiKey, handlers);
25639
25920
  }
25640
25921
  async function connectToDaemon(options) {
25641
- const getAccessToken = () => Promise.resolve(options.auth.apiKey);
25922
+ const getCredential = () => Promise.resolve({ apiKey: options.auth.apiKey });
25642
25923
  const connectionConfig = {
25643
25924
  ...DEFAULT_CONNECTION_CONFIG,
25644
25925
  ...MACHINE_TYPE_CONFIG["local" /* Local */]
@@ -25649,9 +25930,9 @@ async function connectToDaemon(options) {
25649
25930
  machineId: LOCAL_MACHINE_ID,
25650
25931
  machineType: "local" /* Local */,
25651
25932
  url: options.url,
25652
- clientType: "sdk",
25933
+ clientType: "sdk" /* SDK */,
25653
25934
  sdk: SDK_CLIENT_METADATA,
25654
- getAccessToken,
25935
+ getCredential,
25655
25936
  onAuthenticationError: options.onAuthenticationError,
25656
25937
  connectionTimeoutMs: connectionConfig.connectionTimeoutMs,
25657
25938
  requestTimeout: connectionConfig.requestTimeoutMs,
@@ -25759,14 +26040,14 @@ function extractErrorMessage(body, status) {
25759
26040
  }
25760
26041
  async function factoryFetch(path, apiKey, baseUrl, options) {
25761
26042
  const url = `${_nullishCoalesce(baseUrl, () => ( DEFAULT_BASE_URL))}${path}`;
25762
- const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _514 => _514.method]), () => ( "GET"));
26043
+ const method = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _517 => _517.method]), () => ( "GET"));
25763
26044
  const headers = {
25764
26045
  Authorization: `Bearer ${apiKey}`,
25765
26046
  Accept: "application/json",
25766
26047
  [FACTORY_CLIENT_HEADER]: "sdk" /* SDK */,
25767
- [FACTORY_SDK_HEADER]: formatSdkClientMetadata(SDK_CLIENT_METADATA)
26048
+ [FACTORY_SDK_HEADER]: SDK_IDENTITY
25768
26049
  };
25769
- if (_optionalChain([options, 'optionalAccess', _515 => _515.body])) {
26050
+ if (_optionalChain([options, 'optionalAccess', _518 => _518.body])) {
25770
26051
  headers["Content-Type"] = "application/json";
25771
26052
  }
25772
26053
  let response;
@@ -25774,7 +26055,7 @@ async function factoryFetch(path, apiKey, baseUrl, options) {
25774
26055
  response = await fetch(url, {
25775
26056
  method,
25776
26057
  headers,
25777
- ..._optionalChain([options, 'optionalAccess', _516 => _516.body]) ? { body: JSON.stringify(options.body) } : {}
26058
+ ..._optionalChain([options, 'optionalAccess', _519 => _519.body]) ? { body: JSON.stringify(options.body) } : {}
25778
26059
  });
25779
26060
  } catch (error) {
25780
26061
  throw new ConnectionError(
@@ -26376,7 +26657,7 @@ async function listRemoteSessions(options) {
26376
26657
 
26377
26658
 
26378
26659
 
26379
- exports.ToolConfirmationOutcome = ToolConfirmationOutcome; exports.ToolConfirmationType = ToolConfirmationType; exports.DroidServerMethod = DroidServerMethod; exports.DroidClientMethod = DroidClientMethod; exports.SessionNotificationType = SessionNotificationType; exports.McpAuthOutcome = McpAuthOutcome; exports.McpServerStatus = McpServerStatus; exports.McpServerType = McpServerType; exports.McpStatus = McpStatus; exports.DroidErrorType = DroidErrorType; exports.DroidWorkingState = DroidWorkingState; exports.ContextStatsAccuracy = ContextStatsAccuracy; exports.DecompSessionType = DecompSessionType; exports.MissionState = MissionState; exports.FeatureStatus = FeatureStatus; exports.FeatureSuccessState = FeatureSuccessState; exports.IssueSeverity = IssueSeverity; exports.DismissalType = DismissalType; exports.ProgressLogEntryType = ProgressLogEntryType; exports.DroidInteractionMode = DroidInteractionMode; exports.AutonomyLevel = AutonomyLevel; exports.JsonRpcMessageType = JsonRpcMessageType; exports.JsonRpcErrorCode = JsonRpcErrorCode; exports.ReasoningEffort = ReasoningEffort; exports.ModelProvider = ModelProvider; exports.SettingsLevel = SettingsLevel; exports.SkillLocation = SkillLocation; exports.JSONRPC_VERSION = JSONRPC_VERSION; exports.formatSdkClientMetadata = formatSdkClientMetadata; exports.TraceContextMetaSchema = TraceContextMetaSchema; exports.JsonRpcEnvelopeSchema = JsonRpcEnvelopeSchema; exports.JsonRpcErrorSchema = JsonRpcErrorSchema; exports.BaseRequestSchema = BaseRequestSchema; exports.BaseResponseSuccessSchema = BaseResponseSuccessSchema; exports.BaseResponseFailureSchema = BaseResponseFailureSchema; exports.BaseNotificationSchema = BaseNotificationSchema; exports.JsonRpcBaseResponseSchema = JsonRpcBaseResponseSchema; exports.JsonRpcMessageSchema = JsonRpcMessageSchema; exports.MessageVisibility = MessageVisibility; exports.SessionPlatform = SessionPlatform; exports.TextBlockSchema = TextBlockSchema; exports.Base64ImageSourceSchema = Base64ImageSourceSchema; exports.ImageBlockSchema = ImageBlockSchema; exports.ThinkingBlockSchema = ThinkingBlockSchema; exports.RedactedThinkingBlockSchema = RedactedThinkingBlockSchema; exports.ToolUseSchema = ToolUseSchema; exports.DocumentSourceSchema = DocumentSourceSchema; exports.DocumentBlockSchema = DocumentBlockSchema; exports.ToolResultSchema = ToolResultSchema; exports.ContentBlockSchema = ContentBlockSchema; exports.FactoryDroidMessageSchema = FactoryDroidMessageSchema; exports.McpHttpServerConfigFieldsSchema = McpHttpServerConfigFieldsSchema; exports.McpStdioServerConfigFieldsSchema = McpStdioServerConfigFieldsSchema; exports.McpServerStatusInfoSchema = McpServerStatusInfoSchema; exports.McpStatusSummarySchema = McpStatusSummarySchema; exports.McpRegistryServerSchema = McpRegistryServerSchema; exports.McpToolInfoSchema = McpToolInfoSchema; exports.ToolConfirmationListItemSchema = ToolConfirmationListItemSchema; exports.ModelMetadataSchema = ModelMetadataSchema; exports.ModelInfoSchema = ModelInfoSchema; exports.ListModelsOptionsSchema = ListModelsOptionsSchema; exports.ListModelsResultSchema = ListModelsResultSchema; exports.FeatureSuccessStateSchema = FeatureSuccessStateSchema; exports.MissionFeatureSchema = MissionFeatureSchema; exports.DiscoveredIssueSchema = DiscoveredIssueSchema; exports.VerificationCommandSchema = VerificationCommandSchema; exports.InteractiveCheckSchema = InteractiveCheckSchema; exports.VerificationSchema = VerificationSchema; exports.TestCaseSchema = TestCaseSchema; exports.TestFileSchema = TestFileSchema; exports.TestsSchema = TestsSchema; exports.SkillDeviationSchema = SkillDeviationSchema; exports.SkillFeedbackSchema = SkillFeedbackSchema; exports.HandoffSchema = HandoffSchema; exports.DismissalRecordSchema = DismissalRecordSchema; exports.MissionAcceptedEntrySchema = MissionAcceptedEntrySchema; exports.MissionPausedEntrySchema = MissionPausedEntrySchema; exports.MissionResumedEntrySchema = MissionResumedEntrySchema; exports.MissionRunStartedEntrySchema = MissionRunStartedEntrySchema; exports.WorkerStartedEntrySchema = WorkerStartedEntrySchema; exports.WorkerSelectedFeatureEntrySchema = WorkerSelectedFeatureEntrySchema; exports.WorkerCompletedEntrySchema = WorkerCompletedEntrySchema; exports.WorkerFailedEntrySchema = WorkerFailedEntrySchema; exports.WorkerPausedEntrySchema = WorkerPausedEntrySchema; exports.HandoffItemsDismissedEntrySchema = HandoffItemsDismissedEntrySchema; exports.MilestoneValidationTriggeredEntrySchema = MilestoneValidationTriggeredEntrySchema; exports.ProgressLogEntrySchema = ProgressLogEntrySchema; exports.TokenUsageSchema = TokenUsageSchema; exports.SessionTagSchema = SessionTagSchema; exports.ToolProgressUpdateSchema = ToolProgressUpdateSchema; exports.SessionTokenUsageChangedNotificationSchema = SessionTokenUsageChangedNotificationSchema; exports.MissionStateChangedNotificationSchema = MissionStateChangedNotificationSchema; exports.MissionFeaturesChangedNotificationSchema = MissionFeaturesChangedNotificationSchema; exports.MissionProgressEntryNotificationSchema = MissionProgressEntryNotificationSchema; exports.MissionHeartbeatNotificationSchema = MissionHeartbeatNotificationSchema; exports.MissionWorkerStartedNotificationSchema = MissionWorkerStartedNotificationSchema; exports.MissionWorkerCompletedNotificationSchema = MissionWorkerCompletedNotificationSchema; exports.HookCommandSchema = HookCommandSchema; exports.HookResultSchema = HookResultSchema; exports.SessionNotificationSchemaList = SessionNotificationSchemaList; exports.SessionNotificationSchema = SessionNotificationSchema; exports.ToolConfirmationDetailsSchema = ToolConfirmationDetailsSchema; exports.ToolConfirmationInfoSchema = ToolConfirmationInfoSchema; exports.RequestPermissionRequestParamsSchema = RequestPermissionRequestParamsSchema; exports.RequestPermissionRequestSchema = RequestPermissionRequestSchema; exports.AskUserQuestionSchema = AskUserQuestionSchema; exports.AskUserRequestParamsSchema = AskUserRequestParamsSchema; exports.AskUserRequestSchema = AskUserRequestSchema; exports.AskUserCollectedAnswerSchema = AskUserCollectedAnswerSchema; exports.AskUserResultSchema = AskUserResultSchema; exports.AskUserResponseSchema = AskUserResponseSchema; exports.RequestPermissionResultSchema = RequestPermissionResultSchema; exports.RequestPermissionResponseSchema = RequestPermissionResponseSchema; exports.CliRequestOrNotificationSchema = CliRequestOrNotificationSchema; exports.SessionSourceSchema = SessionSourceSchema; exports.AvailableModelConfigSchema = AvailableModelConfigSchema; exports.ContextStatsSchema = ContextStatsSchema; exports.StdioMcpSchema = StdioMcpSchema; exports.HttpHeaderSchema = HttpHeaderSchema; exports.HttpMcpSchema = HttpMcpSchema; exports.SseMcpSchema = SseMcpSchema; exports.McpServerConfigSchema = McpServerConfigSchema; exports.OutputFormatSchema = OutputFormatSchema; exports.AddUserMessageRequestParamsSchema = AddUserMessageRequestParamsSchema; exports.InterruptSessionRequestParamsSchema = InterruptSessionRequestParamsSchema; exports.CloseSessionRequestParamsSchema = CloseSessionRequestParamsSchema; exports.CloseSessionResultSchema = CloseSessionResultSchema; exports.KillWorkerSessionRequestParamsSchema = KillWorkerSessionRequestParamsSchema; exports.KillWorkerSessionResultSchema = KillWorkerSessionResultSchema; exports.GitRepoInfoSchema = GitRepoInfoSchema; exports.InitializeSessionResultSchema = InitializeSessionResultSchema; exports.WorkerStateInfoSchema = WorkerStateInfoSchema; exports.MissionStateSchema = MissionStateSchema; exports.AddUserMessageResultSchema = AddUserMessageResultSchema; exports.InterruptSessionResultSchema = InterruptSessionResultSchema; exports.UpdateSessionSettingsResultSchema = UpdateSessionSettingsResultSchema; exports.AddUserMessageRequestSchema = AddUserMessageRequestSchema; exports.InterruptSessionRequestSchema = InterruptSessionRequestSchema; exports.CloseSessionRequestSchema = CloseSessionRequestSchema; exports.KillWorkerSessionRequestSchema = KillWorkerSessionRequestSchema; exports.ChangeWorkingDirectoryRequestParamsSchema = ChangeWorkingDirectoryRequestParamsSchema; exports.ChangeWorkingDirectoryResultSchema = ChangeWorkingDirectoryResultSchema; exports.ChangeWorkingDirectoryRequestSchema = ChangeWorkingDirectoryRequestSchema; exports.ToggleMcpServerRequestParamsSchema = ToggleMcpServerRequestParamsSchema; exports.ToggleMcpServerResultSchema = ToggleMcpServerResultSchema; exports.ToggleMcpServerRequestSchema = ToggleMcpServerRequestSchema; exports.AuthenticateMcpServerRequestParamsSchema = AuthenticateMcpServerRequestParamsSchema; exports.AuthenticateMcpServerResultSchema = AuthenticateMcpServerResultSchema; exports.AuthenticateMcpServerRequestSchema = AuthenticateMcpServerRequestSchema; exports.CancelMcpAuthRequestParamsSchema = CancelMcpAuthRequestParamsSchema; exports.CancelMcpAuthResultSchema = CancelMcpAuthResultSchema; exports.CancelMcpAuthRequestSchema = CancelMcpAuthRequestSchema; exports.ClearMcpAuthRequestParamsSchema = ClearMcpAuthRequestParamsSchema; exports.ClearMcpAuthResultSchema = ClearMcpAuthResultSchema; exports.ClearMcpAuthRequestSchema = ClearMcpAuthRequestSchema; exports.SubmitMcpAuthCodeRequestParamsSchema = SubmitMcpAuthCodeRequestParamsSchema; exports.SubmitMcpAuthCodeResultSchema = SubmitMcpAuthCodeResultSchema; exports.SubmitMcpAuthCodeRequestSchema = SubmitMcpAuthCodeRequestSchema; exports.SubmitMcpAuthCodeResponseSchema = SubmitMcpAuthCodeResponseSchema; exports.SubmitMcpAuthErrorResponseSchema = SubmitMcpAuthErrorResponseSchema; exports.AddMcpServerRequestParamsSchema = AddMcpServerRequestParamsSchema; exports.AddMcpServerResultSchema = AddMcpServerResultSchema; exports.AddMcpServerRequestSchema = AddMcpServerRequestSchema; exports.RemoveMcpServerRequestParamsSchema = RemoveMcpServerRequestParamsSchema; exports.RemoveMcpServerResultSchema = RemoveMcpServerResultSchema; exports.RemoveMcpServerRequestSchema = RemoveMcpServerRequestSchema; exports.ListMcpRegistryRequestParamsSchema = ListMcpRegistryRequestParamsSchema; exports.ListMcpRegistryResultSchema = ListMcpRegistryResultSchema; exports.ListMcpRegistryRequestSchema = ListMcpRegistryRequestSchema; exports.ListMcpToolsRequestParamsSchema = ListMcpToolsRequestParamsSchema; exports.ListMcpToolsResultSchema = ListMcpToolsResultSchema; exports.ListMcpToolsRequestSchema = ListMcpToolsRequestSchema; exports.ExecToolInfoSchema = ExecToolInfoSchema; exports.ListToolsResultSchema = ListToolsResultSchema; exports.ListMcpServersRequestParamsSchema = ListMcpServersRequestParamsSchema; exports.ListMcpServersResultSchema = ListMcpServersResultSchema; exports.ListMcpServersRequestSchema = ListMcpServersRequestSchema; exports.ToggleMcpToolRequestParamsSchema = ToggleMcpToolRequestParamsSchema; exports.ToggleMcpToolResultSchema = ToggleMcpToolResultSchema; exports.ToggleMcpToolRequestSchema = ToggleMcpToolRequestSchema; exports.ListSkillsRequestParamsSchema = ListSkillsRequestParamsSchema; exports.SkillResourceSchema = SkillResourceSchema; exports.SkillInfoSchema = SkillInfoSchema; exports.ListSkillsResultSchema = ListSkillsResultSchema; exports.ListSkillsRequestSchema = ListSkillsRequestSchema; exports.SetSkillDisabledRequestParamsSchema = SetSkillDisabledRequestParamsSchema; exports.SetSkillDisabledResultSchema = SetSkillDisabledResultSchema; exports.SetSkillDisabledRequestSchema = SetSkillDisabledRequestSchema; exports.GetContextStatsRequestParamsSchema = GetContextStatsRequestParamsSchema; exports.GetContextStatsRequestSchema = GetContextStatsRequestSchema; exports.ContextBreakdownCategorySchema = ContextBreakdownCategorySchema; exports.GetContextBreakdownResultSchema = GetContextBreakdownResultSchema; exports.SubmitBugReportRequestParamsSchema = SubmitBugReportRequestParamsSchema; exports.SubmitBugReportResultSchema = SubmitBugReportResultSchema; exports.SubmitBugReportRequestSchema = SubmitBugReportRequestSchema; exports.GetRewindInfoRequestParamsSchema = GetRewindInfoRequestParamsSchema; exports.RewindFileSnapshotSchema = RewindFileSnapshotSchema; exports.RewindFileCreationSchema = RewindFileCreationSchema; exports.RewindEvictedFileSchema = RewindEvictedFileSchema; exports.GetRewindInfoResultSchema = GetRewindInfoResultSchema; exports.GetRewindInfoRequestSchema = GetRewindInfoRequestSchema; exports.ExecuteRewindRequestParamsSchema = ExecuteRewindRequestParamsSchema; exports.ExecuteRewindResultSchema = ExecuteRewindResultSchema; exports.ExecuteRewindRequestSchema = ExecuteRewindRequestSchema; exports.CompactSessionRequestParamsSchema = CompactSessionRequestParamsSchema; exports.CompactSessionResultSchema = CompactSessionResultSchema; exports.CompactSessionRequestSchema = CompactSessionRequestSchema; exports.CompactSessionResponseSchema = CompactSessionResponseSchema; exports.ForkSessionResultSchema = ForkSessionResultSchema; exports.ForkSessionRequestParamsSchema = ForkSessionRequestParamsSchema; exports.ForkSessionRequestSchema = ForkSessionRequestSchema; exports.ForkSessionResponseSchema = ForkSessionResponseSchema; exports.RenameSessionRequestParamsSchema = RenameSessionRequestParamsSchema; exports.RenameSessionResultSchema = RenameSessionResultSchema; exports.RenameSessionRequestSchema = RenameSessionRequestSchema; exports.RenameSessionResponseSchema = RenameSessionResponseSchema; exports.WarmupCacheResponseSchema = WarmupCacheResponseSchema; exports.ClientRequestSchema = ClientRequestSchema; exports.AddUserMessageResponseSchema = AddUserMessageResponseSchema; exports.AppendMessagesResponseSchema = AppendMessagesResponseSchema; exports.ResolveQueuedUserMessageResponseSchema = ResolveQueuedUserMessageResponseSchema; exports.InterruptSessionResponseSchema = InterruptSessionResponseSchema; exports.CloseSessionResponseSchema = CloseSessionResponseSchema; exports.KillWorkerSessionResponseSchema = KillWorkerSessionResponseSchema; exports.UpdateSessionSettingsResponseSchema = UpdateSessionSettingsResponseSchema; exports.ChangeWorkingDirectoryResponseSchema = ChangeWorkingDirectoryResponseSchema; exports.ToggleMcpServerResponseSchema = ToggleMcpServerResponseSchema; exports.AuthenticateMcpServerResponseSchema = AuthenticateMcpServerResponseSchema; exports.CancelMcpAuthResponseSchema = CancelMcpAuthResponseSchema; exports.ClearMcpAuthResponseSchema = ClearMcpAuthResponseSchema; exports.AddMcpServerResponseSchema = AddMcpServerResponseSchema; exports.RemoveMcpServerResponseSchema = RemoveMcpServerResponseSchema; exports.ListMcpRegistryResponseSchema = ListMcpRegistryResponseSchema; exports.ListMcpToolsResponseSchema = ListMcpToolsResponseSchema; exports.ListToolsResponseSchema = ListToolsResponseSchema; exports.ListModelsResponseSchema = ListModelsResponseSchema; exports.ListMcpServersResponseSchema = ListMcpServersResponseSchema; exports.ToggleMcpToolResponseSchema = ToggleMcpToolResponseSchema; exports.ListSkillsResponseSchema = ListSkillsResponseSchema; exports.SetSkillDisabledResponseSchema = SetSkillDisabledResponseSchema; exports.ListCommandsResponseSchema = ListCommandsResponseSchema; exports.GetContextStatsResponseSchema = GetContextStatsResponseSchema; exports.GetContextBreakdownResponseSchema = GetContextBreakdownResponseSchema; exports.SubmitBugReportResponseSchema = SubmitBugReportResponseSchema; exports.GetRewindInfoResponseSchema = GetRewindInfoResponseSchema; exports.ExecuteRewindResponseSchema = ExecuteRewindResponseSchema; exports.MachineType = MachineType; exports.DaemonDroidEvent = DaemonDroidEvent; exports.FACTORY_PROTOCOL_VERSION = FACTORY_PROTOCOL_VERSION; exports.LEGACY_FACTORY_API_VERSION = LEGACY_FACTORY_API_VERSION2; exports.JSONRPC_VERSION2 = JSONRPC_VERSION2; exports.DaemonRequestPermissionSchema = DaemonRequestPermissionSchema; exports.LOCAL_MACHINE_ID = LOCAL_MACHINE_ID; exports.DEFAULT_LOCAL_DAEMON_WS_URL = DEFAULT_LOCAL_DAEMON_WS_URL; exports.JsonValueSchema = JsonValueSchema; exports.JsonObjectSchema = JsonObjectSchema; exports.JsonArraySchema = JsonArraySchema; exports.ToolSelectionOverridesSchema = ToolSelectionOverridesSchema; exports.InitializeSessionRequestParamsSchema = InitializeSessionRequestParamsSchema2; exports.InitializeSessionRequestSchema = InitializeSessionRequestSchema2; exports.LoadSessionRequestParamsSchema = LoadSessionRequestParamsSchema2; exports.LoadSessionRequestSchema = LoadSessionRequestSchema2; exports.UpdateSessionSettingsRequestParamsSchema = UpdateSessionSettingsRequestParamsSchema2; exports.UpdateSessionSettingsRequestSchema = UpdateSessionSettingsRequestSchema2; exports.ListToolsRequestParamsSchema = ListToolsRequestParamsSchema2; exports.ListToolsRequestSchema = ListToolsRequestSchema2; exports.SessionSettingsSchema = SessionSettingsSchema2; exports.InitializeSessionResultSchema2 = InitializeSessionResultSchema2; exports.InitializeSessionResponseSchema = InitializeSessionResponseSchema2; exports.LoadSessionResultSchema = LoadSessionResultSchema2; exports.LoadSessionResponseSchema = LoadSessionResponseSchema2; exports.EmptyResultSchema = EmptyResultSchema; exports.SuccessResultSchema = SuccessResultSchema; exports.JsonRpcRequestSchema = JsonRpcRequestSchema; exports.JsonRpcResponseSuccessSchema = JsonRpcResponseSuccessSchema; exports.JsonRpcResponseFailureSchema = JsonRpcResponseFailureSchema; exports.JsonRpcNotificationSchema = JsonRpcNotificationSchema; exports.JsonRpcResponseSchema = JsonRpcResponseSchema; exports.createResponseSchema = createResponseSchema2; exports.OutputFormatType = OutputFormatType; exports.ToolResultNotificationSchema = ToolResultNotificationSchema2; exports.ToolProgressUpdateNotificationSchema = ToolProgressUpdateNotificationSchema2; exports.CreateMessageNotificationSchema = CreateMessageNotificationSchema2; exports.ErrorNotificationSchema = ErrorNotificationSchema2; exports.DroidWorkingStateChangedNotificationSchema = DroidWorkingStateChangedNotificationSchema2; exports.PermissionResolvedNotificationSchema = PermissionResolvedNotificationSchema2; exports.SettingsUpdatedNotificationSchema = SettingsUpdatedNotificationSchema2; exports.SessionTitleUpdatedNotificationSchema = SessionTitleUpdatedNotificationSchema2; exports.McpStatusChangedNotificationSchema = McpStatusChangedNotificationSchema2; exports.AssistantTextDeltaNotificationSchema = AssistantTextDeltaNotificationSchema2; exports.AssistantTextCompleteNotificationSchema = AssistantTextCompleteNotificationSchema2; exports.StructuredOutputNotificationSchema = StructuredOutputNotificationSchema2; exports.ThinkingTextDeltaNotificationSchema = ThinkingTextDeltaNotificationSchema2; exports.ThinkingTextCompleteNotificationSchema = ThinkingTextCompleteNotificationSchema2; exports.McpAuthRequiredNotificationSchema = McpAuthRequiredNotificationSchema2; exports.McpAuthCompletedNotificationSchema = McpAuthCompletedNotificationSchema2; exports.HookExecutionStartedNotificationSchema = HookExecutionStartedNotificationSchema2; exports.HookExecutionCompletedNotificationSchema = HookExecutionCompletedNotificationSchema2; exports.ToolCallNotificationSchema = ToolCallNotificationSchema2; exports.EditToolConfirmationDetailsSchema = EditToolConfirmationDetailsSchema2; exports.ExecuteToolConfirmationDetailsSchema = ExecuteToolConfirmationDetailsSchema2; exports.CreateToolConfirmationDetailsSchema = CreateToolConfirmationDetailsSchema2; exports.AskUserConfirmationDetailsSchema = AskUserConfirmationDetailsSchema2; exports.ExitSpecModeConfirmationDetailsSchema = ExitSpecModeConfirmationDetailsSchema2; exports.ProposeMissionConfirmationDetailsSchema = ProposeMissionConfirmationDetailsSchema2; exports.StartMissionRunConfirmationDetailsSchema = StartMissionRunConfirmationDetailsSchema2; exports.ApplyPatchToolConfirmationDetailsSchema = ApplyPatchToolConfirmationDetailsSchema2; exports.McpToolConfirmationDetailsSchema = McpToolConfirmationDetailsSchema2; exports.ErrorDetailSchema = ErrorDetailSchema; exports.SessionNotificationPayloadSchema = SessionNotificationPayloadSchema; exports.SessionNotificationParamsSchema = SessionNotificationParamsSchema2; exports.SettingsUpdatedPayloadSchema = SettingsUpdatedPayloadSchema; exports.StructuredOutputErrorSchema = StructuredOutputErrorSchema; exports.ToolUseSchema2 = ToolUseSchema2; exports.McpSseServerConfigFieldsSchema = McpSseServerConfigFieldsSchema; exports.McpToolInputSchemaSchema = McpToolInputSchemaSchema; exports.FactoryDroidMessageRole = FactoryDroidMessageRole; exports.ServerRequestHandlerType = ServerRequestHandlerType; exports.SDK_VERSION = SDK_VERSION; exports.SDK_CLIENT_METADATA = SDK_CLIENT_METADATA; exports.SDK_REQUEST_ATTRIBUTION = SDK_REQUEST_ATTRIBUTION; exports.SDK_TAG = SDK_TAG; exports.JSONRPC_VERSION3 = JSONRPC_VERSION3; exports.LEGACY_FACTORY_API_VERSION2 = LEGACY_FACTORY_API_VERSION3; exports.FACTORY_CLIENT_HEADER = FACTORY_CLIENT_HEADER2; exports.FACTORY_CLIENT_VERSION = FACTORY_CLIENT_VERSION2; exports.FACTORY_PROTOCOL_VERSION2 = FACTORY_PROTOCOL_VERSION2; exports.COMPACTION_TIMEOUT = COMPACTION_TIMEOUT2; exports.DEFAULT_REQUEST_TIMEOUT = DEFAULT_REQUEST_TIMEOUT2; exports.MCP_AUTH_TIMEOUT = MCP_AUTH_TIMEOUT2; exports.REWIND_TIMEOUT = REWIND_TIMEOUT2; exports.SESSION_INIT_TIMEOUT = SESSION_INIT_TIMEOUT2; exports.DroidClientError = DroidClientError; exports.ConnectionError = ConnectionError; exports.TimeoutError = TimeoutError; exports.ProtocolError = ProtocolError; exports.SessionError = SessionError; exports.SessionNotFoundError = SessionNotFoundError; exports.SessionReplacedError = SessionReplacedError; exports.SessionReplacementError = SessionReplacementError; exports.ConcurrentStreamError = ConcurrentStreamError; exports.InvalidSessionCwdError = InvalidSessionCwdError; exports.ProcessExitError = ProcessExitError; exports.mergeSessionSettings = mergeSessionSettings; exports.withSdkTag = withSdkTag; exports.unwrapResponseResult = unwrapResponseResult; exports.SessionMetadataSchema = SessionMetadataSchema; exports.SessionStartDecompSessionTypeSchema = SessionStartDecompSessionTypeSchema; exports.SessionStartEventSchema = SessionStartEventSchema; exports.SessionSettingsFileSchema = SessionSettingsFileSchema; exports.DroidHookEventSchema = DroidHookEventSchema2; exports.DroidHookSpecificOutputSchema = DroidHookSpecificOutputSchema; exports.DroidHookOutputSchema = DroidHookOutputSchema; exports.DroidHookExecutionResultSchema = DroidHookExecutionResultSchema; exports.DroidMessageType = DroidMessageType; exports.convertNotificationToStreamMessage = convertNotificationToStreamMessage; exports.StreamStateTracker = StreamStateTracker; exports.wireAbortSignal = wireAbortSignal; exports.streamFromClient = streamFromClient; exports.extractInnerNotification = extractInnerNotification; exports.DaemonAuthenticationMode = DaemonAuthenticationMode; exports.ComputerConnectStartType = ComputerConnectStartType; exports.ComputerConnectAttemptTrigger = ComputerConnectAttemptTrigger; exports.MetaError = MetaError; exports.WebSocketConnectionError = WebSocketConnectionError; exports.ConnectionClosedError = ConnectionClosedError; exports.ClientDestroyedError = ClientDestroyedError; exports.JsonRpcRequestError = JsonRpcRequestError; exports.RelayConnectionError = RelayConnectionError; exports.ComputeLimitExceededError = ComputeLimitExceededError; exports.AbortError = AbortError; exports.retryWithLogger = retryWithLogger; exports.defaultDaemonCoreDeps = defaultDaemonCoreDeps; exports.configureDaemonCoreDeps = configureDaemonCoreDeps; exports.getPermissionToolInputForDisplay = getPermissionToolInputForDisplay2; exports.buildUserMessageContentBlocks = buildUserMessageContentBlocks2; exports.inspectJsonRpcEnvelope = inspectJsonRpcEnvelope2; exports.hasDecoupledInteractionSettings = hasDecoupledInteractionSettings2; exports.filterMessagesForUI = filterMessagesForUI2; exports.repairParentChainCorruption = repairParentChainCorruption2; exports.sumTokenUsage = sumTokenUsage2; exports.getSubagentCallingMetadata = getSubagentCallingMetadata2; exports.hasSubagentSessionTag = hasSubagentSessionTag2; exports.summarizeSessionToolUsage = summarizeSessionToolUsage2; exports.machineTypeToMachineConnectionType = machineTypeToMachineConnectionType2; exports.getToolResultBlocks = getToolResultBlocks2; exports.getToolResultToolUseId = getToolResultToolUseId2; exports.isPendingToolResultMarker = isPendingToolResultMarker2; exports.isPersistedHookMessage = isPersistedHookMessage2; exports.orderMessagesByParentChain = orderMessagesByParentChain2; exports.toError = toError2; exports.OtelTracing = OtelTracing; exports.Metric = Metric; exports.SpanName = SpanName; exports.SpanAttribute = SpanAttribute; exports.SpanEvent = SpanEvent; exports.ClientUiSurface = ClientUiSurface; exports.FactoryDaemonTransport = FactoryDaemonTransport; exports.DaemonClient = DaemonClient; exports.connectAndAuthenticate = connectAndAuthenticate; exports.connectWithRetry = connectWithRetry; exports.ConnectionFailureReason = ConnectionFailureReason; exports.DroidEvent = DroidEvent; exports.recordComputerConnectSli = recordComputerConnectSli; exports.TunnelConnection = TunnelConnection; exports.IPC_DAEMON_URL = IPC_DAEMON_URL; exports.MACHINE_TYPE_WEBSOCKET_OVERRIDES = MACHINE_TYPE_WEBSOCKET_OVERRIDES; exports.MANAGED_COMPUTER_MAX_RETRIES = MANAGED_COMPUTER_MAX_RETRIES; exports.SLACK_DELEGATION_MAX_RETRIES = SLACK_DELEGATION_MAX_RETRIES; exports.IpcDaemonClientTransport = IpcDaemonClientTransport; exports.InProcessDaemonClientTransport = InProcessDaemonClientTransport; exports.WebSocketDaemonTransport = WebSocketDaemonTransport; exports.createWebSocketDaemonClient = createWebSocketDaemonClient; exports.QueuedUserMessageKind = QueuedUserMessageKind; exports.QueuedUserMessageDisplayGroup = QueuedUserMessageDisplayGroup; exports.isDaemonQueuedMessageKind = isDaemonQueuedMessageKind; exports.isReviewableQueuedMessageKind = isReviewableQueuedMessageKind; exports.getQueuedUserMessageDisplayGroup = getQueuedUserMessageDisplayGroup; exports.getQueuedUserMessageReviewPriority = getQueuedUserMessageReviewPriority; exports.DaemonSessionController = DaemonSessionController; exports.MultiMissionStateManager = MultiMissionStateManager; exports.MultiSessionStateManager = MultiSessionStateManager; exports.connectToDaemon = connectToDaemon; exports.MachineTemplateBuildStatusSchema = MachineTemplateBuildStatusSchema; exports.MachineTemplateSchema = MachineTemplateSchema; exports.MachineTemplateListResponseSchema = MachineTemplateListResponseSchema; exports.ComputerSchema = ComputerSchema; exports.ComputerListResponseSchema = ComputerListResponseSchema; exports.RefreshComputerResponseSchema = RefreshComputerResponseSchema; exports.ComputerMetricSchema = ComputerMetricSchema; exports.ComputerMetricsResponseSchema = ComputerMetricsResponseSchema; exports.RemoteSessionSchema = RemoteSessionSchema; exports.RemoteSessionListResponseSchema = RemoteSessionListResponseSchema; exports.listMachineTemplates = listMachineTemplates; exports.getMachineTemplate = getMachineTemplate; exports.listComputers = listComputers; exports.getComputer = getComputer; exports.createComputer = createComputer; exports.getComputerByName = getComputerByName; exports.updateComputer = updateComputer; exports.deleteComputer = deleteComputer; exports.restartComputer = restartComputer; exports.refreshComputer = refreshComputer; exports.getComputerMetrics = getComputerMetrics; exports.retryInstallDeps = retryInstallDeps; exports.listRemoteSessions = listRemoteSessions;
26660
+ exports.ToolConfirmationOutcome = ToolConfirmationOutcome; exports.ToolConfirmationType = ToolConfirmationType; exports.DroidServerMethod = DroidServerMethod; exports.DroidClientMethod = DroidClientMethod; exports.SessionNotificationType = SessionNotificationType; exports.McpAuthOutcome = McpAuthOutcome; exports.McpServerStatus = McpServerStatus; exports.McpServerType = McpServerType; exports.McpStatus = McpStatus; exports.DroidErrorType = DroidErrorType; exports.DroidWorkingState = DroidWorkingState; exports.ContextStatsAccuracy = ContextStatsAccuracy; exports.DecompSessionType = DecompSessionType; exports.MissionState = MissionState; exports.FeatureStatus = FeatureStatus; exports.FeatureSuccessState = FeatureSuccessState; exports.IssueSeverity = IssueSeverity; exports.DismissalType = DismissalType; exports.ProgressLogEntryType = ProgressLogEntryType; exports.DroidInteractionMode = DroidInteractionMode; exports.AutonomyLevel = AutonomyLevel; exports.JsonRpcMessageType = JsonRpcMessageType; exports.JsonRpcErrorCode = JsonRpcErrorCode; exports.ReasoningEffort = ReasoningEffort; exports.ModelProvider = ModelProvider; exports.SettingsLevel = SettingsLevel; exports.SkillLocation = SkillLocation; exports.JSONRPC_VERSION = JSONRPC_VERSION; exports.TraceContextMetaSchema = TraceContextMetaSchema; exports.JsonRpcEnvelopeSchema = JsonRpcEnvelopeSchema; exports.JsonRpcErrorSchema = JsonRpcErrorSchema; exports.BaseRequestSchema = BaseRequestSchema; exports.BaseResponseSuccessSchema = BaseResponseSuccessSchema; exports.BaseResponseFailureSchema = BaseResponseFailureSchema; exports.BaseNotificationSchema = BaseNotificationSchema; exports.JsonRpcBaseResponseSchema = JsonRpcBaseResponseSchema; exports.JsonRpcMessageSchema = JsonRpcMessageSchema; exports.MessageVisibility = MessageVisibility; exports.SessionPlatform = SessionPlatform; exports.TextBlockSchema = TextBlockSchema; exports.Base64ImageSourceSchema = Base64ImageSourceSchema; exports.ImageBlockSchema = ImageBlockSchema; exports.ThinkingBlockSchema = ThinkingBlockSchema; exports.RedactedThinkingBlockSchema = RedactedThinkingBlockSchema; exports.ToolUseSchema = ToolUseSchema; exports.DocumentSourceSchema = DocumentSourceSchema; exports.DocumentBlockSchema = DocumentBlockSchema; exports.ToolResultSchema = ToolResultSchema; exports.ContentBlockSchema = ContentBlockSchema; exports.FactoryDroidMessageSchema = FactoryDroidMessageSchema; exports.McpHttpServerConfigFieldsSchema = McpHttpServerConfigFieldsSchema; exports.McpStdioServerConfigFieldsSchema = McpStdioServerConfigFieldsSchema; exports.McpServerStatusInfoSchema = McpServerStatusInfoSchema; exports.McpStatusSummarySchema = McpStatusSummarySchema; exports.McpRegistryServerSchema = McpRegistryServerSchema; exports.McpToolInfoSchema = McpToolInfoSchema; exports.ToolConfirmationListItemSchema = ToolConfirmationListItemSchema; exports.ModelMetadataSchema = ModelMetadataSchema; exports.ModelInfoSchema = ModelInfoSchema; exports.ListModelsOptionsSchema = ListModelsOptionsSchema; exports.ListModelsResultSchema = ListModelsResultSchema; exports.FeatureSuccessStateSchema = FeatureSuccessStateSchema; exports.MissionFeatureSchema = MissionFeatureSchema; exports.DiscoveredIssueSchema = DiscoveredIssueSchema; exports.VerificationCommandSchema = VerificationCommandSchema; exports.InteractiveCheckSchema = InteractiveCheckSchema; exports.VerificationSchema = VerificationSchema; exports.TestCaseSchema = TestCaseSchema; exports.TestFileSchema = TestFileSchema; exports.TestsSchema = TestsSchema; exports.SkillDeviationSchema = SkillDeviationSchema; exports.SkillFeedbackSchema = SkillFeedbackSchema; exports.HandoffSchema = HandoffSchema; exports.DismissalRecordSchema = DismissalRecordSchema; exports.MissionAcceptedEntrySchema = MissionAcceptedEntrySchema; exports.MissionPausedEntrySchema = MissionPausedEntrySchema; exports.MissionResumedEntrySchema = MissionResumedEntrySchema; exports.MissionRunStartedEntrySchema = MissionRunStartedEntrySchema; exports.WorkerStartedEntrySchema = WorkerStartedEntrySchema; exports.WorkerSelectedFeatureEntrySchema = WorkerSelectedFeatureEntrySchema; exports.WorkerCompletedEntrySchema = WorkerCompletedEntrySchema; exports.WorkerFailedEntrySchema = WorkerFailedEntrySchema; exports.WorkerPausedEntrySchema = WorkerPausedEntrySchema; exports.HandoffItemsDismissedEntrySchema = HandoffItemsDismissedEntrySchema; exports.MilestoneValidationTriggeredEntrySchema = MilestoneValidationTriggeredEntrySchema; exports.ProgressLogEntrySchema = ProgressLogEntrySchema; exports.TokenUsageSchema = TokenUsageSchema; exports.SessionTagSchema = SessionTagSchema; exports.ToolProgressUpdateSchema = ToolProgressUpdateSchema; exports.SessionTokenUsageChangedNotificationSchema = SessionTokenUsageChangedNotificationSchema; exports.MissionStateChangedNotificationSchema = MissionStateChangedNotificationSchema; exports.MissionFeaturesChangedNotificationSchema = MissionFeaturesChangedNotificationSchema; exports.MissionProgressEntryNotificationSchema = MissionProgressEntryNotificationSchema; exports.MissionHeartbeatNotificationSchema = MissionHeartbeatNotificationSchema; exports.MissionWorkerStartedNotificationSchema = MissionWorkerStartedNotificationSchema; exports.MissionWorkerCompletedNotificationSchema = MissionWorkerCompletedNotificationSchema; exports.HookCommandSchema = HookCommandSchema; exports.HookResultSchema = HookResultSchema; exports.SessionNotificationSchemaList = SessionNotificationSchemaList; exports.SessionNotificationSchema = SessionNotificationSchema; exports.ToolConfirmationDetailsSchema = ToolConfirmationDetailsSchema; exports.ToolConfirmationInfoSchema = ToolConfirmationInfoSchema; exports.RequestPermissionRequestParamsSchema = RequestPermissionRequestParamsSchema; exports.RequestPermissionRequestSchema = RequestPermissionRequestSchema; exports.AskUserQuestionSchema = AskUserQuestionSchema; exports.AskUserRequestParamsSchema = AskUserRequestParamsSchema; exports.AskUserRequestSchema = AskUserRequestSchema; exports.AskUserCollectedAnswerSchema = AskUserCollectedAnswerSchema; exports.AskUserResultSchema = AskUserResultSchema; exports.AskUserResponseSchema = AskUserResponseSchema; exports.RequestPermissionResultSchema = RequestPermissionResultSchema; exports.RequestPermissionResponseSchema = RequestPermissionResponseSchema; exports.CliRequestOrNotificationSchema = CliRequestOrNotificationSchema; exports.SessionSourceSchema = SessionSourceSchema; exports.AvailableModelConfigSchema = AvailableModelConfigSchema; exports.ContextStatsSchema = ContextStatsSchema; exports.StdioMcpSchema = StdioMcpSchema; exports.HttpHeaderSchema = HttpHeaderSchema; exports.HttpMcpSchema = HttpMcpSchema; exports.SseMcpSchema = SseMcpSchema; exports.McpServerConfigSchema = McpServerConfigSchema; exports.OutputFormatSchema = OutputFormatSchema; exports.AddUserMessageRequestParamsSchema = AddUserMessageRequestParamsSchema; exports.InterruptSessionRequestParamsSchema = InterruptSessionRequestParamsSchema; exports.CloseSessionRequestParamsSchema = CloseSessionRequestParamsSchema; exports.CloseSessionResultSchema = CloseSessionResultSchema; exports.KillWorkerSessionRequestParamsSchema = KillWorkerSessionRequestParamsSchema; exports.KillWorkerSessionResultSchema = KillWorkerSessionResultSchema; exports.GitRepoInfoSchema = GitRepoInfoSchema; exports.InitializeSessionResultSchema = InitializeSessionResultSchema; exports.WorkerStateInfoSchema = WorkerStateInfoSchema; exports.MissionStateSchema = MissionStateSchema; exports.AddUserMessageResultSchema = AddUserMessageResultSchema; exports.InterruptSessionResultSchema = InterruptSessionResultSchema; exports.UpdateSessionSettingsResultSchema = UpdateSessionSettingsResultSchema; exports.AddUserMessageRequestSchema = AddUserMessageRequestSchema; exports.InterruptSessionRequestSchema = InterruptSessionRequestSchema; exports.CloseSessionRequestSchema = CloseSessionRequestSchema; exports.KillWorkerSessionRequestSchema = KillWorkerSessionRequestSchema; exports.ChangeWorkingDirectoryRequestParamsSchema = ChangeWorkingDirectoryRequestParamsSchema; exports.ChangeWorkingDirectoryResultSchema = ChangeWorkingDirectoryResultSchema; exports.ChangeWorkingDirectoryRequestSchema = ChangeWorkingDirectoryRequestSchema; exports.ToggleMcpServerRequestParamsSchema = ToggleMcpServerRequestParamsSchema; exports.ToggleMcpServerResultSchema = ToggleMcpServerResultSchema; exports.ToggleMcpServerRequestSchema = ToggleMcpServerRequestSchema; exports.AuthenticateMcpServerRequestParamsSchema = AuthenticateMcpServerRequestParamsSchema; exports.AuthenticateMcpServerResultSchema = AuthenticateMcpServerResultSchema; exports.AuthenticateMcpServerRequestSchema = AuthenticateMcpServerRequestSchema; exports.CancelMcpAuthRequestParamsSchema = CancelMcpAuthRequestParamsSchema; exports.CancelMcpAuthResultSchema = CancelMcpAuthResultSchema; exports.CancelMcpAuthRequestSchema = CancelMcpAuthRequestSchema; exports.ClearMcpAuthRequestParamsSchema = ClearMcpAuthRequestParamsSchema; exports.ClearMcpAuthResultSchema = ClearMcpAuthResultSchema; exports.ClearMcpAuthRequestSchema = ClearMcpAuthRequestSchema; exports.SubmitMcpAuthCodeRequestParamsSchema = SubmitMcpAuthCodeRequestParamsSchema; exports.SubmitMcpAuthCodeResultSchema = SubmitMcpAuthCodeResultSchema; exports.SubmitMcpAuthCodeRequestSchema = SubmitMcpAuthCodeRequestSchema; exports.SubmitMcpAuthCodeResponseSchema = SubmitMcpAuthCodeResponseSchema; exports.SubmitMcpAuthErrorResponseSchema = SubmitMcpAuthErrorResponseSchema; exports.AddMcpServerRequestParamsSchema = AddMcpServerRequestParamsSchema; exports.AddMcpServerResultSchema = AddMcpServerResultSchema; exports.AddMcpServerRequestSchema = AddMcpServerRequestSchema; exports.RemoveMcpServerRequestParamsSchema = RemoveMcpServerRequestParamsSchema; exports.RemoveMcpServerResultSchema = RemoveMcpServerResultSchema; exports.RemoveMcpServerRequestSchema = RemoveMcpServerRequestSchema; exports.ListMcpRegistryRequestParamsSchema = ListMcpRegistryRequestParamsSchema; exports.ListMcpRegistryResultSchema = ListMcpRegistryResultSchema; exports.ListMcpRegistryRequestSchema = ListMcpRegistryRequestSchema; exports.ListMcpToolsRequestParamsSchema = ListMcpToolsRequestParamsSchema; exports.ListMcpToolsResultSchema = ListMcpToolsResultSchema; exports.ListMcpToolsRequestSchema = ListMcpToolsRequestSchema; exports.ExecToolInfoSchema = ExecToolInfoSchema; exports.ListToolsResultSchema = ListToolsResultSchema; exports.ListMcpServersRequestParamsSchema = ListMcpServersRequestParamsSchema; exports.ListMcpServersResultSchema = ListMcpServersResultSchema; exports.ListMcpServersRequestSchema = ListMcpServersRequestSchema; exports.ToggleMcpToolRequestParamsSchema = ToggleMcpToolRequestParamsSchema; exports.ToggleMcpToolResultSchema = ToggleMcpToolResultSchema; exports.ToggleMcpToolRequestSchema = ToggleMcpToolRequestSchema; exports.ListSkillsRequestParamsSchema = ListSkillsRequestParamsSchema; exports.SkillResourceSchema = SkillResourceSchema; exports.SkillInfoSchema = SkillInfoSchema; exports.ListSkillsResultSchema = ListSkillsResultSchema; exports.ListSkillsRequestSchema = ListSkillsRequestSchema; exports.SetSkillDisabledRequestParamsSchema = SetSkillDisabledRequestParamsSchema; exports.SetSkillDisabledResultSchema = SetSkillDisabledResultSchema; exports.SetSkillDisabledRequestSchema = SetSkillDisabledRequestSchema; exports.GetContextStatsRequestParamsSchema = GetContextStatsRequestParamsSchema; exports.GetContextStatsRequestSchema = GetContextStatsRequestSchema; exports.ContextBreakdownCategorySchema = ContextBreakdownCategorySchema; exports.GetContextBreakdownResultSchema = GetContextBreakdownResultSchema; exports.SubmitBugReportRequestParamsSchema = SubmitBugReportRequestParamsSchema; exports.SubmitBugReportResultSchema = SubmitBugReportResultSchema; exports.SubmitBugReportRequestSchema = SubmitBugReportRequestSchema; exports.GetRewindInfoRequestParamsSchema = GetRewindInfoRequestParamsSchema; exports.RewindFileSnapshotSchema = RewindFileSnapshotSchema; exports.RewindFileCreationSchema = RewindFileCreationSchema; exports.RewindEvictedFileSchema = RewindEvictedFileSchema; exports.GetRewindInfoResultSchema = GetRewindInfoResultSchema; exports.GetRewindInfoRequestSchema = GetRewindInfoRequestSchema; exports.ExecuteRewindRequestParamsSchema = ExecuteRewindRequestParamsSchema; exports.ExecuteRewindResultSchema = ExecuteRewindResultSchema; exports.ExecuteRewindRequestSchema = ExecuteRewindRequestSchema; exports.CompactSessionRequestParamsSchema = CompactSessionRequestParamsSchema; exports.CompactSessionResultSchema = CompactSessionResultSchema; exports.CompactSessionRequestSchema = CompactSessionRequestSchema; exports.CompactSessionResponseSchema = CompactSessionResponseSchema; exports.ForkSessionResultSchema = ForkSessionResultSchema; exports.ForkSessionRequestParamsSchema = ForkSessionRequestParamsSchema; exports.ForkSessionRequestSchema = ForkSessionRequestSchema; exports.ForkSessionResponseSchema = ForkSessionResponseSchema; exports.RenameSessionRequestParamsSchema = RenameSessionRequestParamsSchema; exports.RenameSessionResultSchema = RenameSessionResultSchema; exports.RenameSessionRequestSchema = RenameSessionRequestSchema; exports.RenameSessionResponseSchema = RenameSessionResponseSchema; exports.WarmupCacheResponseSchema = WarmupCacheResponseSchema; exports.ClientRequestSchema = ClientRequestSchema; exports.AddUserMessageResponseSchema = AddUserMessageResponseSchema; exports.AppendMessagesResponseSchema = AppendMessagesResponseSchema; exports.ResolveQueuedUserMessageResponseSchema = ResolveQueuedUserMessageResponseSchema; exports.InterruptSessionResponseSchema = InterruptSessionResponseSchema; exports.CloseSessionResponseSchema = CloseSessionResponseSchema; exports.KillWorkerSessionResponseSchema = KillWorkerSessionResponseSchema; exports.UpdateSessionSettingsResponseSchema = UpdateSessionSettingsResponseSchema; exports.ChangeWorkingDirectoryResponseSchema = ChangeWorkingDirectoryResponseSchema; exports.ToggleMcpServerResponseSchema = ToggleMcpServerResponseSchema; exports.AuthenticateMcpServerResponseSchema = AuthenticateMcpServerResponseSchema; exports.CancelMcpAuthResponseSchema = CancelMcpAuthResponseSchema; exports.ClearMcpAuthResponseSchema = ClearMcpAuthResponseSchema; exports.AddMcpServerResponseSchema = AddMcpServerResponseSchema; exports.RemoveMcpServerResponseSchema = RemoveMcpServerResponseSchema; exports.ListMcpRegistryResponseSchema = ListMcpRegistryResponseSchema; exports.ListMcpToolsResponseSchema = ListMcpToolsResponseSchema; exports.ListToolsResponseSchema = ListToolsResponseSchema; exports.ListModelsResponseSchema = ListModelsResponseSchema; exports.ListMcpServersResponseSchema = ListMcpServersResponseSchema; exports.ToggleMcpToolResponseSchema = ToggleMcpToolResponseSchema; exports.ListSkillsResponseSchema = ListSkillsResponseSchema; exports.SetSkillDisabledResponseSchema = SetSkillDisabledResponseSchema; exports.ListCommandsResponseSchema = ListCommandsResponseSchema; exports.GetContextStatsResponseSchema = GetContextStatsResponseSchema; exports.GetContextBreakdownResponseSchema = GetContextBreakdownResponseSchema; exports.SubmitBugReportResponseSchema = SubmitBugReportResponseSchema; exports.GetRewindInfoResponseSchema = GetRewindInfoResponseSchema; exports.ExecuteRewindResponseSchema = ExecuteRewindResponseSchema; exports.MachineType = MachineType; exports.DaemonDroidEvent = DaemonDroidEvent; exports.FACTORY_PROTOCOL_VERSION = FACTORY_PROTOCOL_VERSION; exports.LEGACY_FACTORY_API_VERSION = LEGACY_FACTORY_API_VERSION2; exports.JSONRPC_VERSION2 = JSONRPC_VERSION2; exports.DaemonRequestPermissionSchema = DaemonRequestPermissionSchema; exports.LOCAL_MACHINE_ID = LOCAL_MACHINE_ID; exports.DEFAULT_LOCAL_DAEMON_WS_URL = DEFAULT_LOCAL_DAEMON_WS_URL; exports.JsonValueSchema = JsonValueSchema; exports.JsonObjectSchema = JsonObjectSchema; exports.JsonArraySchema = JsonArraySchema; exports.ToolSelectionOverridesSchema = ToolSelectionOverridesSchema; exports.InitializeSessionRequestParamsSchema = InitializeSessionRequestParamsSchema2; exports.InitializeSessionRequestSchema = InitializeSessionRequestSchema2; exports.LoadSessionRequestParamsSchema = LoadSessionRequestParamsSchema2; exports.LoadSessionRequestSchema = LoadSessionRequestSchema2; exports.UpdateSessionSettingsRequestParamsSchema = UpdateSessionSettingsRequestParamsSchema2; exports.UpdateSessionSettingsRequestSchema = UpdateSessionSettingsRequestSchema2; exports.ListToolsRequestParamsSchema = ListToolsRequestParamsSchema2; exports.ListToolsRequestSchema = ListToolsRequestSchema2; exports.SessionSettingsSchema = SessionSettingsSchema2; exports.InitializeSessionResultSchema2 = InitializeSessionResultSchema2; exports.InitializeSessionResponseSchema = InitializeSessionResponseSchema2; exports.LoadSessionResultSchema = LoadSessionResultSchema2; exports.LoadSessionResponseSchema = LoadSessionResponseSchema2; exports.EmptyResultSchema = EmptyResultSchema; exports.SuccessResultSchema = SuccessResultSchema; exports.JsonRpcRequestSchema = JsonRpcRequestSchema; exports.JsonRpcResponseSuccessSchema = JsonRpcResponseSuccessSchema; exports.JsonRpcResponseFailureSchema = JsonRpcResponseFailureSchema; exports.JsonRpcNotificationSchema = JsonRpcNotificationSchema; exports.JsonRpcResponseSchema = JsonRpcResponseSchema; exports.createResponseSchema = createResponseSchema2; exports.OutputFormatType = OutputFormatType; exports.ToolResultNotificationSchema = ToolResultNotificationSchema2; exports.ToolProgressUpdateNotificationSchema = ToolProgressUpdateNotificationSchema2; exports.CreateMessageNotificationSchema = CreateMessageNotificationSchema2; exports.ErrorNotificationSchema = ErrorNotificationSchema2; exports.DroidWorkingStateChangedNotificationSchema = DroidWorkingStateChangedNotificationSchema2; exports.PermissionResolvedNotificationSchema = PermissionResolvedNotificationSchema2; exports.SettingsUpdatedNotificationSchema = SettingsUpdatedNotificationSchema2; exports.SessionTitleUpdatedNotificationSchema = SessionTitleUpdatedNotificationSchema2; exports.McpStatusChangedNotificationSchema = McpStatusChangedNotificationSchema2; exports.AssistantTextDeltaNotificationSchema = AssistantTextDeltaNotificationSchema2; exports.AssistantTextCompleteNotificationSchema = AssistantTextCompleteNotificationSchema2; exports.StructuredOutputNotificationSchema = StructuredOutputNotificationSchema2; exports.ThinkingTextDeltaNotificationSchema = ThinkingTextDeltaNotificationSchema2; exports.ThinkingTextCompleteNotificationSchema = ThinkingTextCompleteNotificationSchema2; exports.McpAuthRequiredNotificationSchema = McpAuthRequiredNotificationSchema2; exports.McpAuthCompletedNotificationSchema = McpAuthCompletedNotificationSchema2; exports.HookExecutionStartedNotificationSchema = HookExecutionStartedNotificationSchema2; exports.HookExecutionCompletedNotificationSchema = HookExecutionCompletedNotificationSchema2; exports.ToolCallNotificationSchema = ToolCallNotificationSchema2; exports.AssistantMessageRetractedNotificationSchema = AssistantMessageRetractedNotificationSchema2; exports.EditToolConfirmationDetailsSchema = EditToolConfirmationDetailsSchema2; exports.ExecuteToolConfirmationDetailsSchema = ExecuteToolConfirmationDetailsSchema2; exports.CreateToolConfirmationDetailsSchema = CreateToolConfirmationDetailsSchema2; exports.AskUserConfirmationDetailsSchema = AskUserConfirmationDetailsSchema2; exports.ExitSpecModeConfirmationDetailsSchema = ExitSpecModeConfirmationDetailsSchema2; exports.ProposeMissionConfirmationDetailsSchema = ProposeMissionConfirmationDetailsSchema2; exports.StartMissionRunConfirmationDetailsSchema = StartMissionRunConfirmationDetailsSchema2; exports.ApplyPatchToolConfirmationDetailsSchema = ApplyPatchToolConfirmationDetailsSchema2; exports.McpToolConfirmationDetailsSchema = McpToolConfirmationDetailsSchema2; exports.ErrorDetailSchema = ErrorDetailSchema; exports.SessionNotificationPayloadSchema = SessionNotificationPayloadSchema; exports.SessionNotificationParamsSchema = SessionNotificationParamsSchema2; exports.SettingsUpdatedPayloadSchema = SettingsUpdatedPayloadSchema; exports.StructuredOutputErrorSchema = StructuredOutputErrorSchema; exports.ToolUseSchema2 = ToolUseSchema2; exports.McpSseServerConfigFieldsSchema = McpSseServerConfigFieldsSchema; exports.McpToolInputSchemaSchema = McpToolInputSchemaSchema; exports.FactoryDroidMessageRole = FactoryDroidMessageRole; exports.ServerRequestHandlerType = ServerRequestHandlerType; exports.SDK_VERSION = SDK_VERSION; exports.SDK_IDENTITY = SDK_IDENTITY; exports.SDK_REQUEST_ATTRIBUTION = SDK_REQUEST_ATTRIBUTION; exports.SDK_TAG = SDK_TAG; exports.JSONRPC_VERSION3 = JSONRPC_VERSION3; exports.LEGACY_FACTORY_API_VERSION2 = LEGACY_FACTORY_API_VERSION3; exports.FACTORY_CLIENT_HEADER = FACTORY_CLIENT_HEADER2; exports.FACTORY_CLIENT_VERSION = FACTORY_CLIENT_VERSION2; exports.FACTORY_PROTOCOL_VERSION2 = FACTORY_PROTOCOL_VERSION2; exports.COMPACTION_TIMEOUT = COMPACTION_TIMEOUT2; exports.DEFAULT_REQUEST_TIMEOUT = DEFAULT_REQUEST_TIMEOUT2; exports.MCP_AUTH_TIMEOUT = MCP_AUTH_TIMEOUT2; exports.REWIND_TIMEOUT = REWIND_TIMEOUT2; exports.SESSION_INIT_TIMEOUT = SESSION_INIT_TIMEOUT2; exports.DroidClientError = DroidClientError; exports.ConnectionError = ConnectionError; exports.TimeoutError = TimeoutError; exports.ProtocolError = ProtocolError; exports.SessionError = SessionError; exports.SessionNotFoundError = SessionNotFoundError; exports.SessionReplacedError = SessionReplacedError; exports.SessionReplacementError = SessionReplacementError; exports.ConcurrentStreamError = ConcurrentStreamError; exports.InvalidSessionCwdError = InvalidSessionCwdError; exports.ProcessExitError = ProcessExitError; exports.mergeSessionSettings = mergeSessionSettings; exports.withSdkTag = withSdkTag; exports.unwrapResponseResult = unwrapResponseResult; exports.SessionMetadataSchema = SessionMetadataSchema; exports.SessionStartDecompSessionTypeSchema = SessionStartDecompSessionTypeSchema; exports.SessionStartEventSchema = SessionStartEventSchema; exports.SessionSettingsFileSchema = SessionSettingsFileSchema; exports.DroidHookEventSchema = DroidHookEventSchema2; exports.DroidHookSpecificOutputSchema = DroidHookSpecificOutputSchema; exports.DroidHookOutputSchema = DroidHookOutputSchema; exports.DroidHookExecutionResultSchema = DroidHookExecutionResultSchema; exports.DroidMessageType = DroidMessageType; exports.convertNotificationToStreamMessage = convertNotificationToStreamMessage; exports.StreamStateTracker = StreamStateTracker; exports.wireAbortSignal = wireAbortSignal; exports.streamFromClient = streamFromClient; exports.extractInnerNotification = extractInnerNotification; exports.DaemonAuthenticationMode = DaemonAuthenticationMode; exports.ComputerConnectStartType = ComputerConnectStartType; exports.ComputerConnectAttemptTrigger = ComputerConnectAttemptTrigger; exports.MetaError = MetaError; exports.WebSocketConnectionError = WebSocketConnectionError; exports.ConnectionClosedError = ConnectionClosedError; exports.ClientDestroyedError = ClientDestroyedError; exports.JsonRpcRequestError = JsonRpcRequestError; exports.RelayConnectionError = RelayConnectionError; exports.ComputeLimitExceededError = ComputeLimitExceededError; exports.AbortError = AbortError; exports.retryWithLogger = retryWithLogger; exports.defaultDaemonCoreDeps = defaultDaemonCoreDeps; exports.configureDaemonCoreDeps = configureDaemonCoreDeps; exports.getPermissionToolInputForDisplay = getPermissionToolInputForDisplay2; exports.buildUserMessageContentBlocks = buildUserMessageContentBlocks2; exports.inspectJsonRpcEnvelope = inspectJsonRpcEnvelope2; exports.hasDecoupledInteractionSettings = hasDecoupledInteractionSettings2; exports.filterMessagesForUI = filterMessagesForUI2; exports.repairParentChainCorruption = repairParentChainCorruption2; exports.sumTokenUsage = sumTokenUsage2; exports.getSubagentCallingMetadata = getSubagentCallingMetadata2; exports.hasSubagentSessionTag = hasSubagentSessionTag2; exports.summarizeSessionToolUsage = summarizeSessionToolUsage2; exports.machineTypeToMachineConnectionType = machineTypeToMachineConnectionType2; exports.getToolResultBlocks = getToolResultBlocks2; exports.getToolResultToolUseId = getToolResultToolUseId2; exports.isPendingToolResultMarker = isPendingToolResultMarker2; exports.isPersistedHookMessage = isPersistedHookMessage2; exports.orderMessagesByParentChain = orderMessagesByParentChain2; exports.toError = toError2; exports.OtelTracing = OtelTracing; exports.Metric = Metric; exports.SpanName = SpanName; exports.SpanAttribute = SpanAttribute; exports.SpanEvent = SpanEvent; exports.ClientUiSurface = ClientUiSurface; exports.FactoryDaemonTransport = FactoryDaemonTransport; exports.DaemonClient = DaemonClient; exports.connectAndAuthenticate = connectAndAuthenticate; exports.connectWithRetry = connectWithRetry; exports.ConnectionFailureReason = ConnectionFailureReason; exports.DroidEvent = DroidEvent; exports.recordComputerConnectSli = recordComputerConnectSli; exports.TunnelConnection = TunnelConnection; exports.IPC_DAEMON_URL = IPC_DAEMON_URL; exports.MACHINE_TYPE_WEBSOCKET_OVERRIDES = MACHINE_TYPE_WEBSOCKET_OVERRIDES; exports.MANAGED_COMPUTER_MAX_RETRIES = MANAGED_COMPUTER_MAX_RETRIES; exports.SLACK_DELEGATION_MAX_RETRIES = SLACK_DELEGATION_MAX_RETRIES; exports.IpcDaemonClientTransport = IpcDaemonClientTransport; exports.InProcessDaemonClientTransport = InProcessDaemonClientTransport; exports.WebSocketDaemonTransport = WebSocketDaemonTransport; exports.createWebSocketDaemonClient = createWebSocketDaemonClient; exports.QueuedUserMessageKind = QueuedUserMessageKind; exports.QueuedUserMessageDisplayGroup = QueuedUserMessageDisplayGroup; exports.isDaemonQueuedMessageKind = isDaemonQueuedMessageKind; exports.isReviewableQueuedMessageKind = isReviewableQueuedMessageKind; exports.getQueuedUserMessageDisplayGroup = getQueuedUserMessageDisplayGroup; exports.getQueuedUserMessageReviewPriority = getQueuedUserMessageReviewPriority; exports.DaemonSessionController = DaemonSessionController; exports.MultiMissionStateManager = MultiMissionStateManager; exports.MultiSessionStateManager = MultiSessionStateManager; exports.connectToDaemon = connectToDaemon; exports.MachineTemplateBuildStatusSchema = MachineTemplateBuildStatusSchema; exports.MachineTemplateSchema = MachineTemplateSchema; exports.MachineTemplateListResponseSchema = MachineTemplateListResponseSchema; exports.ComputerSchema = ComputerSchema; exports.ComputerListResponseSchema = ComputerListResponseSchema; exports.RefreshComputerResponseSchema = RefreshComputerResponseSchema; exports.ComputerMetricSchema = ComputerMetricSchema; exports.ComputerMetricsResponseSchema = ComputerMetricsResponseSchema; exports.RemoteSessionSchema = RemoteSessionSchema; exports.RemoteSessionListResponseSchema = RemoteSessionListResponseSchema; exports.listMachineTemplates = listMachineTemplates; exports.getMachineTemplate = getMachineTemplate; exports.listComputers = listComputers; exports.getComputer = getComputer; exports.createComputer = createComputer; exports.getComputerByName = getComputerByName; exports.updateComputer = updateComputer; exports.deleteComputer = deleteComputer; exports.restartComputer = restartComputer; exports.refreshComputer = refreshComputer; exports.getComputerMetrics = getComputerMetrics; exports.retryInstallDeps = retryInstallDeps; exports.listRemoteSessions = listRemoteSessions;
26380
26661
  /*! Bundled license information:
26381
26662
 
26382
26663
  react/cjs/react.production.js:
@@ -26401,4 +26682,4 @@ react/cjs/react.development.js:
26401
26682
  * LICENSE file in the root directory of this source tree.
26402
26683
  *)
26403
26684
  */
26404
- //# sourceMappingURL=chunk-FJP5OKS5.js.map
26685
+ //# sourceMappingURL=chunk-YSKO6SPT.js.map