import * as _ from "os";
import * as H from "path";
import * as z from "@agentclientprotocol/sdk";
import { ContextProviderRegistry as $, FileTreeContextProvider as V, CurrentlyOpenFilesContextProvider as Q } from "@kiro/context-providers";
import { A as X, C as J } from "./chat-agent-BAdndn_h.js";
import { S as x } from "./index-D89vEqep.js";
import { I as Kt, O as jt, b as Ht, a as zt, c as $t, g as Vt, i as Qt, m as Xt, u as Jt } from "./index-D89vEqep.js";
import { h as Z, i as q, m as Y, j as ee, b as te } from "./acp-remote-mcp-client-C5iglUrp.js";
import { c as qt } from "./acp-remote-mcp-client-C5iglUrp.js";
import { S as oe, P as se, N as re } from "./node-progressive-context-source-DZE-KhrH.js";
import { B as eo, a as to, b as oo } from "./node-progressive-context-source-DZE-KhrH.js";
import "fs";
import { URI as ie } from "vscode-uri";
import "minimatch";
import { a as ro } from "./steering-Dcn_tjkT.js";
import "./index-C-CV5vnh.js";
import { a as d, s as ae } from "./logger-CTb8_yz9.js";
import { P as ne } from "./powers-manager-CbGmy5n_.js";
import { I as v, S } from "./errors-1JFcQdts.js";
import { A as ao, F as no, M as co, a as lo, P as po, T as mo, b as go } from "./errors-1JFcQdts.js";
import { A as C } from "./sub-agent-BpZpYDp-.js";
import { a as ho, b as fo, E as So, F as vo, S as Co, c as Mo, e as Eo, g as To, p as Io } from "./sub-agent-BpZpYDp-.js";
import { i as ce, a as le } from "./actions-Dng4pati.js";
import { c as xo } from "./actions-Dng4pati.js";
import { Q as A, g as de } from "./model-config-BdfVU6dY.js";
import { F as yo, f as wo, a as Fo, b as Ro, c as ko, d as _o, e as bo, i as Oo, s as No, h as Do } from "./model-config-BdfVU6dY.js";
import { S as pe, m as me, b as ge } from "./message-replay-Cjyo5CAH.js";
import { a as Lo, c as Go } from "./message-replay-Cjyo5CAH.js";
import { b as ue } from "./telemetry-Bf0GI6nJ.js";
import { N as Bo, T as Ko, c as jo, g as Ho, a as zo, d as $o, r as Vo, s as Qo, e as Xo, f as Jo } from "./telemetry-Bf0GI6nJ.js";
import { d as he } from "./shared-types-CIxCt9tj.js";
import { O as qo, T as Yo } from "./shared-types-CIxCt9tj.js";
import { b as fe } from "./session-update-utils-S4kmZ2as.js";
import { a as ts } from "./session-update-utils-S4kmZ2as.js";
import "fs/promises";
import { s as b } from "./pending-changes-BF3vCKkj.js";
import { P as ss, g as rs, a as is, b as as, c as ns } from "./pending-changes-BF3vCKkj.js";
import { s as O } from "./execution-log-controller-BGxzu20b.js";
import { g as ls } from "./execution-log-controller-BGxzu20b.js";
import { b as M, s as N } from "./autonomy-mode-CooE4oAK.js";
import { A as ps, a as ms, g as gs } from "./autonomy-mode-CooE4oAK.js";
import { s as D } from "./q-client-DsNNqt3G.js";
import { c as hs } from "./q-client-DsNNqt3G.js";
import { b as U } from "./spec-agent-OdZ7esxm.js";
import { g as Ss, m as vs, a as Cs, s as Ms } from "./spec-agent-OdZ7esxm.js";
import { s as L } from "./spec-platform-361SGdHa.js";
import { g as Ts, m as Is } from "./spec-platform-361SGdHa.js";
import { s as G } from "./command-approval-MQd-5ajF.js";
import { g as xs } from "./command-approval-MQd-5ajF.js";
import { C as Se } from "./custom-agent-registry-DF7phCBA.js";
import { G as ve, C as Ce, b as Me } from "./custom-agent-parser-DbpwC6qc.js";
import { a as ys, c as ws, d as Fs, e as Rs, p as ks, f as _s, s as bs } from "./custom-agent-parser-DbpwC6qc.js";
import { C as Ns, a as Ds, J as Us, g as Ls } from "./types-DThkhnH-.js";
import { c as Ee } from "./index-BozN4iRQ.js";
import { B as Ws, F as Bs, a as Ks } from "./index-BozN4iRQ.js";
import { e as Te, a as Ie } from "./mcp-config-manager-DMXiTPN3.js";
import { f as Hs, n as zs, v as $s } from "./mcp-config-manager-DMXiTPN3.js";
import { s as Pe } from "./prompt-DuC9mWRH.js";
import { D as Qs, a as Xs, b as Js, d as Zs, c as qs, g as Ys } from "./prompt-DuC9mWRH.js";
import "crypto";
import "zod";
import "dedent";
import { i as xe } from "./prompts-DfcXHzAI.js";
import { b as tr, g as or } from "./prompts-DfcXHzAI.js";
import "./message-analyzer-BAqw8PNp.js";
import { c as rr } from "./number-coercion-CeAOJ7Po.js";
import "@aws/codewhisperer-streaming-client";
import "axios";
import "axios-retry";
import "@mozilla/readability";
import "jsdom";
import { A as ar, a as nr, C as cr, b as lr, c as dr, D as pr, G as mr, I as gr, d as ur, K as hr, M as fr, N as Sr, e as vr, O as Cr, f as Mr, Q as Er, g as Tr, S as Ir, T as Pr, U as xr, h as Ar, i as yr, j as wr, m as Fr } from "./q-developer-converse-BT9F76b_.js";
import "./types-CkvOiUfs.js";
import { A as kr, M as _r, P as br, R as Or, j as Nr, p as Dr, r as Ur } from "./prompt-template-C_Mn10zi.js";
import { i as Gr } from "./session-C-gUzvZx.js";
import { p as Br } from "./message-parts-D8WKxpG9.js";
import { ListSessionsResponseSchema as jr } from "./session/schemas/index.js";
import { C as zr, f as $r, a as Vr, g as Qr, o as Xr, s as Jr, b as Zr, c as qr, d as Yr } from "./context-chat-message-DzjJbTBD.js";
import { N as ti, a as oi, b as si } from "./node-background-process-manager-_8U2gTa-.js";
import { s as Ae, g as ye, f as we } from "./hooks-Dmyvf9cL.js";
import { e as ii, a as ai, b as ni, c as ci, n as li, d as di } from "./hooks-Dmyvf9cL.js";
import { g as mi, s as gi, a as ui, t as hi } from "./terminal-dGJDGXey.js";
import { s as Fe } from "./file-context-ClFefQMc.js";
import { l as Si, a as vi } from "./file-context-ClFefQMc.js";
import { g as Mi, h as Ei, i as Ti, s as Ii } from "./auth-DCPC05L9.js";
import { g as xi, a as Ai, s as yi, b as wi } from "./remote-tools-C9QNKWUJ.js";
import { n as Ri, s as ki } from "./dev-inspector-CF526NYm.js";
import { B as bi, C as Oi, D as Ni, M as Di, S as Ui, T as Li, g as Gi, a as Wi, b as Bi, c as Ki, d as ji, e as Hi, f as zi, r as $i, h as Vi, i as Qi, j as Xi, u as Ji, k as Zi, l as qi } from "./token-monitor-QTYxqQ8j.js";
import { SimpleStrategy as ea, compactIfNeeded as ta, estimateTokens as oa, initializeCompaction as sa, initializeCompactionSystem as ra, needsCompaction as ia, registerStrategy as aa, setDefaultStrategy as na } from "./agent-context/compaction/index.js";
import { T as la, A as da, C as pa, a as ma, b as ga, D as ua, c as ha, d as fa, E as Sa, e as va, F as Ca, f as Ma, X as Ea, g as Ta, h as Ia, G as Pa, i as xa, j as Aa, k as ya, l as wa, m as Fa, I as Ra, I as ka, L as _a, n as ba, o as Oa, p as Na, M as Da, R as Ua, q as La, r as Ga, s as Wa, t as Ba, S as Ka, u as ja, V as Ha, U as za, W as $a, v as Va, w as Qa, x as Xa, y as Ja, z as Za, B as qa, H as Ya, J as en, K as tn, N as on, O as sn, P as rn, Q as an } from "./disclose-context-DwhVRwE7.js";
import { I as cn, W as ln, a as dn } from "./workspace-object-CspubCq6.js";
import { M as mn, U as gn, W as un } from "./workspace-connection-impl-Dee9nf40.js";
import { I as fn, f as Sn, s as vn } from "./intent-detection-service-DV14tv5n.js";
import { C as Mn, P as En } from "./pruning-service-DJ-mli7u.js";
import { p as In } from "./prompt-processor-Dw_f2vjD.js";
import { s as xn } from "./strip-json-comments-BVnY24gX.js";
import { G as yn, I as wn, a as Fn, M as Rn, b as kn, S as _n, c as bn, d as On, e as Nn, f as Dn, g as Un, h as Ln, U as Gn, W as Wn } from "./get-user-input-Cyvfzkny.js";
import { T as Kn, a as jn, i as Hn } from "./tool-tags-NGeoUHCI.js";
import { f as $n, a as Vn, g as Qn, i as Xn, m as Jn, u as Zn } from "./tool-filter-CS5Fsu0N.js";
import { R as Yn } from "./remote-tools-discovery-B_VU91vn.js";
import { C as tc } from "./config-file-watcher-DbLp_qKw.js";
import { c as sc, l as rc } from "./model-provider-DwyIQZZf.js";
import { F as ac, M as nc, a as cc, c as lc, T as dc, W as pc, d as mc, e as gc, f as uc, g as hc, h as fc, i as Sc, j as vc, k as Cc, l as Mc, m as Ec, n as Tc, o as Ic, p as Pc, q as xc, s as Ac, t as yc, u as wc, v as Fc, w as Rc, x as kc, y as _c } from "./web-fetch-utils-C1Z4KMmp.js";
import { a as Oc } from "./cancellation-C60foDZK.js";
import { s as Dc, f as Uc } from "./validator-ClHWtYX0.js";
import { F as Gc } from "./file-lock-D4f90hJ2.js";
import { T as Bc } from "./tool-message-list-B1XEM-VL.js";
import { AsyncStream as jc } from "./async-stream/index.js";
import { AsyncDeliveredObject as zc } from "./async-delivered-object/index.js";
import { StreamedDataObject as Vc } from "./streamed-data-object/index.js";
import { RemoteToolRecorder as Xc, WebFetchRecorder as Jc, createToolTelemetry as Zc, initializeRemoteToolCounters as qc, setToolTelemetryFactory as Yc } from "./telemetry/index.js";
import { a as tl, T as ol, b as sl, i as rl, m as il } from "./tool-usage-meter-CBzE-MaZ.js";
import { F as nl, h as cl, p as ll, a as dl, s as pl } from "./parse-front-matter-CXai4UYs.js";
import { c as gl, h as ul, i as hl, n as fl } from "./command-approval-18pCaXN7.js";
import { R as vl, g as Cl, i as Ml, v as El } from "./validate-file-modification-DmMrabti.js";
import { I as Il, T as Pl, U as xl, g as Al } from "./index-BNsRGrU_.js";
import { NodeTaskService as wl, parseMarkdownTasks as Fl } from "./spec/tasks/index.js";
import "./string-BZO3_EzG.js";
import "http";
import { C as kl, S as _l, T as bl, a as Ol } from "./token-estimator-B45EKs9J.js";
import { L as Dl } from "./orchestrator-prompt-BJ3tHECQ.js";
function Re({ uri: i, mimeType: e, data: t }) {
  return i ?? `data:${e};base64,${t}`;
}
const y = ue(he.Agent, "SessionEviction");
async function ke(i, e, t) {
  const o = await i.evictOldSessions(e, t);
  return y.reportCountMetrics({ SessionsEvicted: o.evicted }), o.evicted > 0 && y.reportHistogramMetrics({ FreedBytes: o.freedBytes }), o;
}
class _e {
  constructor(e) {
    this.connection = e;
  }
  /** Retrieves a secret value by key. Returns undefined if not found or on error. */
  async get(e) {
    try {
      return (await this.connection.extMethod("_kiro/secret/get", { key: e })).value ?? void 0;
    } catch {
      d.warn("[AcpSecretStorage] Failed to retrieve secret");
      return;
    }
  }
  /** Stores a secret value by key. Throws on failure. */
  async store(e, t) {
    try {
      await this.connection.extMethod("_kiro/secret/store", { key: e, value: t });
    } catch (o) {
      throw d.warn("[AcpSecretStorage] Failed to store secret"), o;
    }
  }
  /** Deletes a secret by key. Throws on failure. */
  async delete(e) {
    try {
      await this.connection.extMethod("_kiro/secret/delete", { key: e });
    } catch (t) {
      throw d.warn("[AcpSecretStorage] Failed to delete secret"), t;
    }
  }
}
function be(i) {
  return async () => xe(i) ? "" : Pe({ paths: [], workspace: i, target: 50 });
}
const Oe = (i) => typeof i == "object" && i !== null && "path" in i;
function Ne(i, e) {
  const t = "_kiro/workspace/active_file";
  return async () => {
    const o = await i.extMethod(t, { sessionId: e });
    if (Oe(o))
      return o.path;
  };
}
const De = (i) => "paths" in i;
function Ue(i, e) {
  const t = "_kiro/workspace/currently_open_files";
  return async () => {
    const o = await i.extMethod(t, { sessionId: e });
    return De(o) ? o.paths : [];
  };
}
const W = ["vibe", "spec"];
function E(i) {
  return W.includes(i);
}
function w(i) {
  if (typeof i != "object" || i === null) return !1;
  const e = i;
  return (e.modeId === void 0 || typeof e.modeId == "string") && (e.modelId === void 0 || typeof e.modelId == "string") && (e.overrideSessionId === void 0 || typeof e.overrideSessionId == "string") && (e.workspaceFolders === void 0 || Array.isArray(e.workspaceFolders) && e.workspaceFolders.every((t) => typeof t == "string"));
}
function Le() {
  return `sess_${crypto.randomUUID()}`;
}
const F = [
  "Swift",
  "Bright",
  "Calm",
  "Bold",
  "Keen",
  "Warm",
  "Sharp",
  "Clear",
  "Fresh",
  "Vivid",
  "Steady",
  "Quick",
  "Nimble",
  "Clever",
  "Gentle",
  "Crisp",
  "Lively",
  "Smooth",
  "Witty",
  "Agile",
  "Deft",
  "Lucid",
  "Mellow",
  "Plucky",
  "Snappy",
  "Tidy",
  "Zesty",
  "Breezy",
  "Cozy",
  "Eager",
  "Fancy",
  "Grand",
  "Happy",
  "Jolly",
  "Lucky",
  "Noble"
], R = [
  "Falcon",
  "Maple",
  "Prism",
  "Spark",
  "Coral",
  "Orbit",
  "Cedar",
  "Flint",
  "Quill",
  "Bloom",
  "Ridge",
  "Ember",
  "Frost",
  "Glyph",
  "Haven",
  "Latch",
  "Nexus",
  "Pixel",
  "Raven",
  "Slate",
  "Torch",
  "Vault",
  "Wren",
  "Zenith",
  "Anchor",
  "Birch",
  "Crest",
  "Drift",
  "Echo",
  "Forge",
  "Grove",
  "Haze",
  "Iris",
  "Jade",
  "Knot",
  "Loom"
];
function Ge() {
  const i = F[Math.floor(Math.random() * F.length)], e = R[Math.floor(Math.random() * R.length)];
  return `${i} ${e}`;
}
const k = [
  { id: "vibe", name: "Vibe", description: "General coding assistance" },
  { id: "spec", name: "Spec", description: "Structured feature development" }
], We = H.join(_.homedir(), ".kiro", "sessions"), Be = 500 * 1024 * 1024;
function Ke(i) {
  return i === "vibe" ? "agent" : "spec";
}
function T(i) {
  return i.map((e) => {
    const t = e._meta?.kiro, o = je(e);
    return t?.disabledTools?.length && (o.disabledTools = t.disabledTools), { name: e.name, options: o };
  });
}
function je(i) {
  if ("command" in i) {
    const t = {};
    for (const o of i.env)
      t[o.name] = o.value;
    return { command: i.command, args: i.args, env: t, disabled: !1 };
  }
  const e = {};
  for (const t of i.headers)
    e[t.name] = t.value;
  return { url: i.url, headers: e, disabled: !1 };
}
const B = "model", K = "mode", j = "autopilot";
function He(i) {
  return {
    type: "select",
    id: K,
    name: "Mode",
    category: "mode",
    currentValue: i,
    options: W.map((e) => ({
      value: e,
      name: e === "vibe" ? "Vibe" : "Spec"
    }))
  };
}
function ze(i) {
  const { models: e, defaultModel: t } = de();
  if (e.length !== 0)
    return {
      type: "select",
      id: B,
      name: "Model",
      category: "model",
      currentValue: i ?? t?.id ?? e[0].id,
      options: e.map((o) => {
        const s = o.rateMultiplier != null ? { rateMultiplier: o.rateMultiplier, rateUnit: o.rateUnit } : void 0;
        return {
          value: o.id,
          name: o.name,
          description: o.description ?? void 0,
          _meta: s ? { kiro: s } : void 0
        };
      })
    };
}
function I(i, e, t) {
  const o = [He(i)], s = ze(e);
  return s && o.push(s), o.push({
    type: "select",
    id: j,
    name: "Autopilot",
    currentValue: t === !1 ? "off" : "on",
    options: [
      { value: "on", name: "Autopilot", description: "Agent executes tools without confirmation" },
      { value: "off", name: "Supervised", description: "Agent asks for approval before file changes" }
    ]
  }), o;
}
class P {
  connection;
  controller;
  persistence;
  sessionsPath;
  contentCollectionEnabled;
  authProvider;
  endpoint;
  region;
  clientTools;
  secretStorage;
  onOpenExternalUrl;
  customUserAgent;
  homeDir;
  contextProviderRegistry;
  commandApprovalProvider;
  sessions = /* @__PURE__ */ new Map();
  currentAutonomyMode = M.Autopilot;
  initPromise;
  static platformInitialized = !1;
  remoteToolsDiscovery;
  steeringManager;
  progressiveContextManager;
  powersManager;
  storageChecked = !1;
  diskBudgetBytes;
  mcpConfigManager;
  mcpPool;
  workspaceFolders;
  constructor(e, t) {
    this.connection = new z.AgentSideConnection(() => this, e), this.controller = new X(), this.authProvider = t.authProvider, this.endpoint = t.endpoint, this.region = t.region, this.sessionsPath = t.sessionsPath ?? We, this.diskBudgetBytes = t.diskBudgetBytes ?? Be, this.contentCollectionEnabled = t.contentCollectionEnabled ?? !1, this.clientTools = t.clientTools ?? [], this.customUserAgent = t.customUserAgent, this.homeDir = t.homeDir ?? _.homedir(), this.commandApprovalProvider = t.commandApprovalProvider, this.persistence = new pe(), this.initPromise = this.initializePlatform(), this.contextProviderRegistry = new $(), this.workspaceFolders = t.workspaceFolders ?? [], this.steeringManager = new oe({
      // Cast required: ACP SDK expects Record<string, unknown> but we use typed notifications
      emitExtNotification: (s, r) => this.connection.extNotification(s, r),
      workspaceFolders: t.workspaceFolders ?? [],
      homeDir: this.homeDir,
      workspaceTrusted: t.workspaceTrusted
    }), this.progressiveContextManager = new se({
      source: new re(),
      // Cast required: ACP SDK expects Record<string, unknown> but we use typed notifications
      emitExtNotification: (s, r) => this.connection.extNotification(s, r),
      homeDir: this.homeDir
    }), this.powersManager = new ne({
      homeDir: this.homeDir,
      emitExtNotification: (s, r) => this.connection.extNotification(s, r)
    });
    const o = {
      onOpenExternalUrl: (s) => (this.onOpenExternalUrl ?? (() => Promise.resolve()))(s),
      onStatusChanged: () => {
        for (const s of this.sessions.keys())
          this.emitMcpStatus(s);
      }
    };
    this.mcpPool = new Te(this.secretStorage, o), this.mcpConfigManager = new Ie({
      homeDir: this.homeDir,
      onConfigChanged: (s) => {
        for (const [, r] of this.sessions) {
          const a = this.mergeServers(s, r.clientMcpServers);
          this.updateMcp(a);
        }
      }
    }), this.connection.closed.then(() => this.disposeAllSessions());
  }
  async initializePlatform() {
    if (d.info(`[KiroAgent] Initializing persistence at ${this.sessionsPath}`), await this.persistence.initialize(this.sessionsPath), d.info("[KiroAgent] Persistence initialized"), P.platformInitialized)
      return;
    const e = Z(this.authProvider, {
      contentCollectionEnabled: this.contentCollectionEnabled,
      endpoint: this.endpoint,
      region: this.region,
      customUserAgent: this.customUserAgent
    });
    D(e), N({ getAutonomyMode: () => this.currentAutonomyMode });
    const t = this.connection, o = () => {
      for (const [s] of this.sessions)
        return s;
      return "global";
    };
    b({
      getLogger: () => ({
        awaitApproval: async (s) => {
          try {
            const r = await t.requestPermission({
              sessionId: o(),
              toolCall: {
                toolCallId: s ?? `turn_approval_${Date.now()}`,
                status: "pending",
                title: "Review changes"
              },
              options: [
                { optionId: "accept", name: "Accept changes", kind: "allow_once" },
                { optionId: "reject", name: "Reject changes", kind: "reject_once" }
              ]
            });
            return r.outcome.outcome === "selected" ? r.outcome.optionId === "accept" : !1;
          } catch {
            return !0;
          }
        }
      })
    }), L({
      parseMarkdownRequirements: () => [],
      validateFileAccess: () => {
      },
      loadOpenEditorFiles: () => [],
      loadCurrentFile: () => {
      },
      asRelativePath: (s) => s,
      getMachineId: () => "acp-agent",
      runPreTaskExecutionHooks: (s, r, a) => Promise.resolve(a),
      runPostTaskExecutionHooks: (s, r, a) => Promise.resolve(a)
    }), U({
      mapChatMessagesToExecutionIds: () => [],
      mapExecutionIdsToMessages: () => Promise.resolve([])
    }), O({
      getExecution: () => Promise.resolve(void 0)
    }), this.commandApprovalProvider && G(this.commandApprovalProvider), P.platformInitialized = !0, d.info("[KiroAgent] Platform initialized");
    try {
      const s = q(this.authProvider, {
        endpoint: this.endpoint,
        region: this.region,
        customUserAgent: this.customUserAgent
      });
      this.remoteToolsDiscovery = Y(s), this.remoteToolsDiscovery.discoverTools().catch((r) => {
        d.warn("[KiroAgent] Remote tools discovery failed on startup:", r);
      });
    } catch (s) {
      d.warn("[KiroAgent] Failed to initialize remote tools discovery:", s);
    }
  }
  /** Run a one-time storage budget check and evict least recently modified sessions if over limit. */
  async checkStorageBudget(e) {
    if (!this.storageChecked) {
      this.storageChecked = !0;
      try {
        await this.initPromise;
        const t = await ke(this.persistence, e, this.diskBudgetBytes);
        t.evicted > 0 && d.info(`[KiroAgent] Session eviction: evicted=${t.evicted} freed=${t.freedBytes}`);
      } catch (t) {
        d.warn("[KiroAgent] Storage budget check failed:", t);
      }
    }
  }
  /** Returns the ACP connection for this agent. */
  getConnection() {
    return this.connection;
  }
  /** @inheritdoc */
  initialize(e) {
    const t = e.clientCapabilities?._meta?.kiro;
    return t?.secretStorage && (this.secretStorage = new _e(this.connection), this.mcpPool.updateSecretStorage(this.secretStorage), d.info("[KiroAgent] Client supports ACP secret storage")), t?.openExternalUrl && (this.onOpenExternalUrl = async (o) => {
      try {
        await this.connection.extMethod("_kiro/openExternalUrl", { url: o });
      } catch (s) {
        throw d.warn("[KiroAgent] Failed to open external URL"), s;
      }
    }, d.info("[KiroAgent] Client supports ACP openExternalUrl")), Promise.resolve({
      protocolVersion: e.protocolVersion,
      agentCapabilities: {
        loadSession: !0,
        promptCapabilities: { image: !0, embeddedContext: !0 },
        mcpCapabilities: { http: !0, sse: !0 },
        _meta: {
          kiro: {
            checkpoints: !0,
            sessionList: !0
          }
        }
      },
      authMethods: [
        { id: "aws-builder-id", name: "AWS Builder ID" },
        { id: "aws-iam-identity-center", name: "AWS IAM Identity Center" }
      ]
    });
  }
  /** Typed capability handlers — each entry is validated against AgentCapabilityTypes at compile time. */
  capabilityHandlers = {
    "_kiro/session/list": () => this.handleListSessions(),
    "_kiro/session/delete": (e) => this.handleDeleteSession(e),
    "_kiro/checkpoint/revert": (e) => this.handleCheckpointRevert(e),
    "_kiro/mcp/resetServer": (e) => this.handleResetMcpServer(e)
  };
  /** Handles extension method calls from the client. */
  async extMethod(e, t) {
    if (e in this.capabilityHandlers) {
      const o = e;
      return this.capabilityHandlers[o](t);
    }
    throw new Error(`Unknown ext method: ${e}`);
  }
  /** Lists sessions for the agent's workspace. */
  async handleListSessions() {
    return await this.initPromise, this.workspaceFolders.length === 0 ? { sessions: [] } : { sessions: await this.persistence.listSessions(this.workspaceFolders, {
      sortBy: "lastModifiedAt",
      sortOrder: "desc"
    }) };
  }
  /** Deletes a session by ID from the given workspace. */
  async handleDeleteSession(e) {
    return await this.initPromise, await this.persistence.deleteSession(e.sessionId, this.workspaceFolders), { success: !0 };
  }
  /** @inheritdoc */
  async authenticate(e) {
    if (!await this.authProvider.getToken())
      throw new Error("Failed to obtain access token from auth provider");
    return {};
  }
  /** @inheritdoc */
  async newSession(e) {
    await this.initPromise;
    const t = e._meta?.kiro, o = w(t) ? t : void 0, s = o?.overrideSessionId ?? Le(), r = o?.modeId ?? "vibe";
    if (this.sessions.has(s))
      return Promise.reject(new v(`Session already exists: ${s}`));
    if (!E(r))
      return Promise.reject(new v(`Invalid mode: ${r}`));
    const a = o?.workspaceFolders?.length ? o.workspaceFolders : [e.cwd], l = this.createSessionState(s, a, r, o?.modelId);
    l.clientMcpServers = T(e.mcpServers), this.sessions.set(s, l);
    const c = this.mcpConfigManager.getServers(), n = this.mergeServers(c, l.clientMcpServers);
    this.updateMcp(n), this.emitMcpStatus(s);
    const p = (/* @__PURE__ */ new Date()).toISOString(), m = Ge(), g = {
      metadata: {
        schemaVersion: "1.0.0",
        id: s,
        title: m,
        agentMode: Ke(r),
        workspacePaths: a,
        createdAt: p,
        lastModifiedAt: p
      },
      messages: []
    };
    d.info(`[KiroAgent] Saving session ${s} to ${this.sessionsPath}`);
    try {
      await this.persistence.saveSession(g), d.info(`[KiroAgent] Session ${s} saved successfully`);
    } catch (u) {
      d.error(`[KiroAgent] Failed to save session ${s}:`, u);
    }
    return this.checkStorageBudget(a), {
      sessionId: s,
      modes: {
        availableModes: k,
        currentModeId: r
      },
      configOptions: I(r, o?.modelId, !0)
    };
  }
  /** @inheritdoc */
  setSessionMode(e) {
    const t = this.sessions.get(e.sessionId);
    return t ? E(e.modeId) ? (t.mode = e.modeId, Promise.resolve({})) : Promise.reject(new v(`Invalid mode: ${e.modeId}`)) : Promise.reject(new S(e.sessionId));
  }
  /** @inheritdoc */
  async prompt(e) {
    const t = this.sessions.get(e.sessionId);
    if (!t)
      return Promise.reject(new S(e.sessionId));
    const { text: o, images: s, documents: r } = this.extractContentFromPrompt(e.prompt);
    if (!o.trim() && s.length === 0 && r.length === 0)
      return { stopReason: "end_turn" };
    const a = fe({
      content: o,
      images: s,
      documents: r.map((c) => ({ data: c.data, name: c.name, mimeType: c.mimeType }))
    });
    await this.persistence.appendMessages(e.sessionId, t.workspacePaths, [a]), t.abortController = new AbortController(), this.currentAutonomyMode = t.autopilot ? M.Autopilot : M.Supervised;
    let l = "end_turn";
    try {
      const c = s.map((f) => f.dataUrl), n = r.map((f) => ({
        data: f.data,
        name: f.name,
        mimeType: f.mimeType
      })), p = {
        chatSessionId: e.sessionId,
        agentMode: t.mode,
        imageBase64Urls: c,
        documentAttachments: n
      }, m = t.mode === "spec" ? new x({
        ...p,
        input: { userPrompt: o, previousMessages: t.previousMessages }
      }) : new J({
        ...p,
        input: { prompt: o, previousMessages: t.previousMessages }
      }), g = m instanceof x ? this.controller.trigger(m, t.abortController.signal) : this.controller.trigger(m, t.abortController.signal);
      t.eventAdapter.setOwnedExecutionId(g.executionId);
      const u = await g.waitForCompletion(), h = await g.getState();
      t.previousMessages = h.context?.messages, l = this.mapStopReason(u.status);
    } catch (c) {
      const n = this.controller.getCurrentExecution();
      if (n) {
        const p = await n.getState();
        p.context?.messages && (t.previousMessages = p.context.messages);
      }
      if (t.abortController.signal.aborted)
        l = "cancelled";
      else
        throw d.error("[KiroAgent] Error processing prompt:", c), t.abortController = void 0, await t.eventAdapter.onPromptComplete("end_turn"), c;
    }
    return t.abortController = void 0, await t.eventAdapter.onPromptComplete(l), { stopReason: l };
  }
  /**
   * Loads an existing session by ID.
   * Per ACP spec, replays persisted conversation history as session/update
   * notifications before resolving.
   */
  async loadSession(e) {
    await this.initPromise;
    let t = this.sessions.get(e.sessionId);
    if (!t) {
      const s = e._meta?.kiro, r = w(s) ? s : void 0, a = r?.workspaceFolders?.length ? r.workspaceFolders : [e.cwd], l = await this.persistence.loadSession(e.sessionId, a), c = l?.metadata.agentMode === "spec" ? "spec" : "vibe";
      t = this.createSessionState(e.sessionId, a, c, r?.modelId), t.clientMcpServers = T(e.mcpServers), this.sessions.set(e.sessionId, t);
      const n = this.mcpConfigManager.getServers(), p = this.mergeServers(n, t.clientMcpServers);
      if (this.updateMcp(p), this.emitMcpStatus(e.sessionId), !l) {
        const m = (/* @__PURE__ */ new Date()).toISOString();
        await this.persistence.saveSession({
          metadata: {
            schemaVersion: "1.0.0",
            id: e.sessionId,
            title: "Restored Session",
            agentMode: "agent",
            workspacePaths: a,
            createdAt: m,
            lastModifiedAt: m
          },
          messages: []
        });
      }
    }
    const o = await this.persistence.loadSession(e.sessionId, t.workspacePaths);
    if (o) {
      const s = me(o.messages);
      for (const r of s)
        await this.connection.sessionUpdate({ sessionId: e.sessionId, update: r });
      o.messages.length > 0 && (t.previousMessages = ge(o.messages));
    }
    return {
      modes: {
        availableModes: k,
        currentModeId: t.mode
      },
      configOptions: I(t.mode, t.modelId, t.autopilot)
    };
  }
  /** @inheritdoc */
  cancel(e) {
    return this.sessions.get(e.sessionId)?.abortController?.abort(), Promise.resolve();
  }
  /** Handles extension notifications from the client. */
  extNotification(e, t) {
    return e === "_kiro/powers/refresh" && this.powersManager.refresh(), Promise.resolve();
  }
  /**
   * Handles mid-session config changes from the client.
   * MCP server updates are passed via `_meta.kiro.mcpServers`.
   */
  async setSessionConfigOption(e) {
    const t = this.sessions.get(e.sessionId);
    if (!t)
      return Promise.reject(new S(e.sessionId));
    e.configId === B && (t.modelId = e.value, this.controller.configure({
      workspace: t.workspace,
      model: {
        provider: A,
        modelId: e.value
      }
    })), e.configId === K && E(e.value) && (t.mode = e.value), e.configId === j && (t.autopilot = e.value === "on");
    const o = e._meta?.kiro;
    if (o?.mcpServers) {
      t.clientMcpServers = T(o.mcpServers);
      const s = this.mcpConfigManager.getServers(), r = this.mergeServers(s, t.clientMcpServers);
      this.updateMcp(r);
    }
    return { configOptions: I(t.mode, t.modelId, t.autopilot) };
  }
  /** Disposes a single session's state and removes it from the map. The shared MCP pool is NOT disposed. */
  disposeSession(e) {
    this.sessions.get(e) && (this.steeringManager.onSessionDestroyed(e), this.progressiveContextManager.onSessionDestroyed(e), this.powersManager.onSessionDestroyed(e), this.sessions.delete(e));
  }
  /**
   * Creates and wires up a new SessionState for the given session ID.
   * Shared by newSession and loadSession to avoid duplicating workspace/controller setup.
   */
  createSessionState(e, t, o, s) {
    const r = new Se();
    r.register(ve), r.register(Ce), r.register(Me);
    for (const u of Ee()())
      r.register(u);
    this.mcpPool.setCwd(t[0]);
    const a = this.steeringManager.onSessionCreated(e, t), { workspace: l, executionLog: c } = ee({
      connection: this.connection,
      sessionId: e,
      workspacePaths: t,
      machineId: "acp-client",
      customAgentRegistry: r,
      clientTools: this.clientTools,
      mcpManager: this.mcpPool,
      steeringProvider: a,
      remoteToolsDiscovery: this.remoteToolsDiscovery,
      persistence: this.persistence,
      contextProviderRegistry: this.contextProviderRegistry,
      progressiveContextManager: this.progressiveContextManager,
      powersManager: this.powersManager,
      homeDir: this.homeDir
    }), n = be(l), p = Ne(this.connection, e), m = Ue(this.connection, e);
    this.contextProviderRegistry.register(new V(n)), this.contextProviderRegistry.register(
      new Q({ activeFileResolver: p, currentlyOpenFilesResolver: m })
    );
    const g = new te({
      connection: this.connection,
      sessionId: e,
      workspacePaths: t,
      persistence: this.persistence
    });
    return g.subscribe(this.controller), this.controller.subscribeToEvents((u) => {
      if (u.type !== "AgentExecutionAction") return;
      const h = u;
      (ce(h) || le(h)) && c.trackAction(u.executionId, h);
    }), this.controller.configure({
      workspace: l,
      model: {
        provider: A,
        modelId: s ?? "auto"
      }
    }), this.progressiveContextManager.onSessionCreated(e, t), this.powersManager.onSessionCreated(e), this.mcpConfigManager.setWorkspacePaths(t), {
      workspacePaths: t,
      mode: o,
      modelId: s,
      autopilot: !0,
      workspace: l,
      eventAdapter: g,
      executionLog: c,
      clientMcpServers: []
    };
  }
  // TODO: Resource blocks are currently serialized as text and concatenated into the prompt.
  // Ideally, they should be mapped to contextItems on the persisted message and plumbed
  // through the execution pipeline (ChatAgentDefinition/SpecGenerationDefinition) so the
  // LLM receives them as structured context rather than inline text.
  extractContentFromPrompt(e) {
    const t = [], o = [], s = [];
    for (const r of e)
      r.type === "text" ? t.push(r.text) : r.type === "image" ? o.push({
        data: r.data,
        mimeType: r.mimeType,
        dataUrl: Re(r)
      }) : r.type === "resource" && "text" in r.resource && t.push(r.resource.text);
    return { text: t.join(`
`), images: o, documents: s };
  }
  mapStopReason(e) {
    switch (e) {
      case C.Success:
        return "end_turn";
      case C.UserAborted:
        return "cancelled";
      case C.Fault:
      default:
        return "end_turn";
    }
  }
  /**
   * Applies the desired MCP server list to the shared pool.
   * The pool diffs against existing connections: new servers connect,
   * removed servers disconnect, existing ones stay untouched.
   */
  async updateMcp(e) {
    try {
      await this.mcpPool.updateServers(e);
    } catch (t) {
      d.error("[KiroAgent] MCP update failed:", t);
    }
  }
  /** Notifies the client about available MCP servers and tools. */
  async emitMcpStatus(e) {
    const t = this.mcpPool.getStatus(), o = {
      sessionId: e,
      servers: t.servers
    };
    await this.connection.extNotification("_kiro/mcp/status", o);
  }
  /**
   * Merges file-based servers with client-provided servers.
   * Client servers win by name (override file-based ones).
   */
  mergeServers(e, t) {
    if (t.length === 0) return e;
    if (e.length === 0) return t;
    const o = new Set(t.map((r) => r.name)), s = e.filter((r) => !o.has(r.name));
    return s.push(...t), s;
  }
  /**
   * Reverts a file to its pre-change state using a stored snapshot.
   * Parses the kiro-snapshot:// URI to extract snapshotId and sessionId,
   * reads the snapshot content from SessionPersistence, and writes it back.
   */
  async handleCheckpointRevert(e) {
    const { sessionId: t, snapshotUri: o, filePath: s, toolCallId: r } = e;
    if (!t || !o || !s)
      throw new Error("Missing required params: sessionId, snapshotUri, filePath");
    const a = this.sessions.get(t);
    if (!a)
      throw new S(t);
    const l = decodeURIComponent(o), c = new URL(l), n = c.searchParams.get("snapshotId");
    if (!n)
      throw new Error(`Invalid snapshot URI: missing snapshotId in ${o}`);
    const p = c.pathname.replace(/^\/+/, ""), m = await this.persistence.getSnapshotContent(
      t,
      a.workspacePaths,
      n,
      p
    );
    if (m === null)
      throw new Error(`Snapshot content not found for ${n}/${p}`);
    const g = s.startsWith("file://") ? ie.parse(s).fsPath : s;
    await a.workspace.fs.writeTextFile({ path: g, content: m }), d.info(`[KiroAgent] Reverted ${g} to snapshot ${n}`), r && await this.connection.sessionUpdate({
      sessionId: t,
      update: {
        sessionUpdate: "tool_call_update",
        toolCallId: r,
        status: "completed",
        _meta: {
          kiro: {
            reverted: !0,
            snapshotId: n,
            snapshotUri: o,
            filePath: s
          }
        }
      }
    });
    const u = {
      id: `revert_${r ?? n}_${Date.now()}`,
      timestamp: (/* @__PURE__ */ new Date()).toISOString(),
      payload: {
        type: "tool_result",
        toolCallId: r ?? n,
        content: `Reverted ${p} to snapshot ${n}`,
        success: !0,
        metadata: {
          reverted: !0,
          snapshotId: n,
          snapshotUri: o,
          filePath: g
        }
      }
    };
    return await this.persistence.appendMessages(t, a.workspacePaths, [u]), { success: !0 };
  }
  /** Resets an MCP server connection via the shared pool. */
  async handleResetMcpServer(e) {
    const { serverName: t, useOAuth: o } = e;
    return await this.mcpPool.resetServer(t, o ?? !1), { success: !0 };
  }
  async disposeAllSessions() {
    this.steeringManager.dispose(), this.progressiveContextManager.dispose(), this.powersManager.dispose(), this.mcpConfigManager.dispose(), this.sessions.clear(), await this.mcpPool.dispose();
  }
}
function Gt({
  qClientFactory: i,
  logger: e,
  autonomyModeProvider: t,
  hooksProvider: o,
  preToolUseHookExecutor: s,
  postToolUseHookExecutor: r,
  executionLoggerProvider: a,
  executionLogController: l,
  fileContextProvider: c,
  specPlatformProvider: n,
  specMessageMappingProvider: p,
  commandApprovalProvider: m
}) {
  D(i), ae(e), N(t), Ae(o), s && ye(s), r && we(r), b(a), O(l), Fe(c), L(n), U(p), m && G(m);
}
export {
  te as ACPEventAdapter,
  qt as ACPExecutionLogOperations,
  ar as AccessDeniedError,
  nr as AccountNotSupportedError,
  kr as AgentAbortedException,
  X as AgentController,
  ao as AgentError,
  la as AgentExecution,
  ps as AgentExecutionStatus,
  ho as AgentGraphState,
  fo as AgentGraphStateAnnotation,
  C as AgentStopReason,
  ms as AgentType,
  da as AllFilesReadFailedError,
  zc as AsyncDeliveredObject,
  jc as AsyncStream,
  M as AutonomyMode,
  Ws as BUGFIX_WORKFLOW_ID,
  eo as BUILTIN_STEERING_DOCUMENTS,
  bi as BaseCompactionStrategy,
  to as BuiltinSteeringDocumentSource,
  Ns as CLI_ONLY_FIELDS,
  pa as CONFIG,
  Ce as CONTEXT_GATHERER_DEFINITION,
  ys as CONTEXT_GATHERER_PROMPT,
  ma as CONTROL_PROCESS_TOOL_ID,
  Me as CUSTOM_AGENT_CREATOR_DEFINITION,
  ws as CUSTOM_AGENT_CREATOR_PROMPT,
  J as ChatAgentDefinition,
  cr as ClientNetworkError,
  lr as ClientThrottleError,
  kl as CompactionError,
  Oi as Compactor,
  tc as ConfigFileWatcher,
  Mn as ContentType,
  zr as ContextChatMessage,
  dr as ContextWindowExceededError,
  ga as ControlProcess,
  Ds as CustomAgentFileFrontMatterSchema,
  Se as CustomAgentRegistry,
  Ni as DEFAULT_COMPACTION_CONFIG,
  Qs as DEFAULT_IGNORE,
  Xs as DEFAULT_IGNORE_DIRS,
  Js as DEFAULT_IGNORE_FILETYPES,
  ua as DeleteFile,
  ha as DirectoryNotFoundError,
  fa as DiscloseContext,
  pr as DocumentValidationError,
  Sa as EmptyPathsError,
  va as ExecuteBash,
  So as ExecutionDefinition,
  yo as FAST_MODEL,
  Bs as FEATURE_DESIGN_FIRST_WORKFLOW_ID,
  Ks as FEATURE_REQUIREMENTS_FIRST_WORKFLOW_ID,
  ac as FETCH_TIMEOUT_MS,
  Ca as FILE_MAX_RESULT_COUNT,
  vo as FILE_TREE_MESSAGE_ID,
  Gc as FileLock,
  no as FileNotFoundError,
  Ma as FileSearch,
  Ea as FileType,
  nl as FrontMatterLoadError,
  Ta as FsAppend,
  Ia as FsWrite,
  ve as GENERAL_TASK_EXECUTION_DEFINITION,
  Fs as GENERAL_TASK_EXECUTION_PROMPT,
  Pa as GREP_MAX_CONTEXT_CHARS,
  xa as GREP_MAX_RESULT_COUNT,
  Aa as GREP_MAX_TOTAL_OUTPUT_SIZE,
  mr as GenericValidationError,
  ya as GetProcessOutput,
  wa as GetProcessOutputInput,
  yn as GetUserInput,
  Fa as GrepSearch,
  Kt as ImplicitRules,
  fn as IntentDetectionService,
  v as InvalidClientError,
  gr as InvalidModelError,
  Il as InvalidPBTStatusError,
  wn as InvalidSchemaError,
  Fn as InvalidToolArgumentsError,
  ur as InvalidToolFormatError,
  cn as InvalidWorkspacePathError,
  Ra as InvokeSubAgent,
  ka as InvokeSubAgentImpl,
  Us as JsonAgentFileSchema,
  P as KiroAgent,
  hr as KiroQError,
  _a as LONG_RUNNING_PATTERNS,
  Dl as LONG_RUNNING_PBT_WARNING,
  ba as ListDirectory,
  Oa as ListProcesses,
  Na as ListProcessesInput,
  jr as ListSessionsResponseSchema,
  nc as MAX_CONTENT_SIZE,
  cc as MAX_RETRY_ATTEMPTS,
  Ie as MCPConfigManager,
  co as MCPConnectionError,
  Te as MCPServerPool,
  lo as MCPToolExecutionError,
  mn as MissingExecutionContextError,
  Rn as MissingPathError,
  Da as MissingPathsError,
  _r as MissingRequiredKeysError,
  kn as MissingTextError,
  Di as ModelContext,
  fr as ModelThrottleError,
  Sr as NewUserAccessPausedError,
  Bo as NoOpMetricReporter,
  vr as NoResponseError,
  ti as NodeBackgroundProcessManager,
  oi as NodeFileSystem,
  re as NodeProgressiveContextSource,
  oo as NodeSteeringDocumentSource,
  wl as NodeTaskService,
  si as NodeTerminalManager,
  jt as OPEN_FILES_MESSAGE_ID,
  qo as OperationStatus,
  Cr as OutputParseError,
  Mr as OverageLimitReachedError,
  ss as PendingChangesService,
  po as PermissionDeniedError,
  ne as PowersManager,
  se as ProgressiveContextManager,
  br as PromptTemplateKeyError,
  En as PruningService,
  Er as QClientRetryStrategy,
  Tr as QDeveloperConverse,
  A as Q_CLIENT_NAMESPACE,
  Ua as ReadFile,
  La as ReadMultipleFiles,
  vl as RemoteJsonSchemaError,
  Xc as RemoteToolRecorder,
  Yn as RemoteToolsDiscovery,
  Ga as RemoteWrapper,
  Wa as ReportProgress,
  Or as RunCommandNoWorkingDirectoryError,
  Ba as RunCommandUsedCDError,
  Ht as SYSTEM_PROMPT_MESSAGE_ID,
  Ir as ServiceThrottleError,
  S as SessionNotFoundError,
  pe as SessionPersistence,
  Lo as SessionPersistenceError,
  lc as SignalCancellationError,
  ea as SimpleStrategy,
  x as SpecGenerationDefinition,
  zt as SpecGenerationGraph,
  ro as SteeringContextFrontMatterSchema,
  oe as SteeringManager,
  Ka as StrReplace,
  _l as StrategyNotFoundError,
  Ui as StrategyRegistry,
  Vc as StreamedDataObject,
  _n as StreamingTool,
  bn as StringNotFoundError,
  On as StringReplaceMissingInputError,
  Nn as StringReplaceMissingNewStringError,
  Dn as StringReplaceMissingOldStringError,
  Un as StringReplaceMultipleMatchesError,
  Co as SubAgentDefinition,
  ja as SubagentResponse,
  Ln as SyncTool,
  Kn as TAG_REGISTRY,
  dc as TRUNCATED_CONTENT_SIZE,
  Yo as TaskStatus,
  Pl as TaskStatusValidationError,
  Ko as Telemetry,
  Pr as TemporarilySuspendedError,
  bl as TokenEstimationError,
  Ol as TokenEstimator,
  mo as TokenExpiredError,
  go as TokenInvalidError,
  Li as TokenMonitor,
  tl as Tool,
  Bc as ToolMessageList,
  ol as ToolRecorder,
  jn as ToolTags,
  Ha as UnknownExecutionError,
  xr as UnsupportedClientVersionError,
  Ar as UnsupportedMessageTypeError,
  gn as UnsupportedWorkspaceOperationError,
  xl as UpdateTaskStatus,
  yr as UsageLimitReachedError,
  wr as UsageLimitReasonCode,
  za as UserRejectedDeleteError,
  Gn as UserRejectedProtectedFileError,
  Wn as WRITE_LIMIT,
  $a as WebFetch,
  pc as WebFetchClient,
  mc as WebFetchContentTooLargeError,
  gc as WebFetchHttpError,
  uc as WebFetchInvalidInputError,
  hc as WebFetchNetworkError,
  Jc as WebFetchRecorder,
  fc as WebFetchRejectedError,
  Sc as WebFetchRendererError,
  vc as WebFetchTimeoutError,
  Cc as WebFetchUnsafeRedirectError,
  Mc as WebFetchUnsupportedContentTypeError,
  un as WorkspaceConnectionImpl,
  ln as WorkspaceObject,
  dn as WorkspaceUriNotFoundError,
  Oc as abortable,
  ts as actionToMessages,
  sc as clearModelCache,
  rr as coerceNumbersInSchema,
  ta as compactIfNeeded,
  Go as computeWorkspaceHash,
  ee as createACPWorkspaceConnection,
  gl as createCommandAcceptedChecker,
  Mo as createContinuationId,
  jo as createMetricReporter,
  hs as createQDeveloperConverse,
  $t as createSpecAgent,
  Ee as createSpecAgentProvider,
  Zc as createToolTelemetry,
  fe as createUserMessage,
  Zs as defaultIgnoreDir,
  qs as defaultIgnoreFile,
  Rs as detectCliOnlyFields,
  Va as detectLongRunningCommand,
  oa as estimateTokens,
  Qa as executeBashSchema,
  ii as executeHookAction,
  ai as executePostToolUseHooks,
  ni as executePreToolUseHooks,
  Hs as expandEnvironmentVariables,
  Eo as extractGraphSavepoint,
  ci as extractHooks,
  Ec as extractHtmlContent,
  Tc as extractPlainTextContent,
  Ic as extractSelectiveContent,
  Pc as extractSelectivePlainText,
  $n as filterTools,
  Vn as filterToolsWithFlags,
  Sn as findMaxIntent,
  Xa as findStringWithLineEndingNormalization,
  $r as formatFileContent,
  Ja as formatGrepResults,
  wo as formatModelIdentifier,
  xc as formatResult,
  Vr as formatWorkspaceFile,
  Ls as generateCustomAgentId,
  Za as generateLongRunningWarning,
  rs as generateOperationId,
  Mi as getAuthErrorHandler,
  gs as getAutonomyMode,
  de as getAvailableModels,
  tr as getBasePrompt,
  qa as getCategoryAdvice,
  xs as getCommandApprovalProvider,
  Gi as getCompactor,
  Wi as getConfig,
  Ya as getControlProcessToolId,
  ls as getExecutionLogController,
  is as getExecutionLogger,
  Ho as getFeatureReporter,
  en as getFileSearchExclude,
  tn as getFileSearchPattern,
  To as getFileTreeContext,
  Qr as getId,
  zo as getMetricReporterFactory,
  ue as getMetricReporterOrNoOp,
  Fo as getModelConfigProvider,
  Ro as getModelConfiguration,
  ko as getModelIdentifier,
  Bi as getModelMaxTokens,
  Vt as getOpenFilesContext,
  or as getOperatingSystem,
  as as getPendingChangesService,
  xi as getRemoteMCPClient,
  _o as getSelectedModel,
  bo as getSelectedModelId,
  Ss as getSessionPersistenceIntegration,
  Ts as getSpecPlatformProvider,
  Al as getSpecTools,
  Ki as getStrategyConfig,
  ji as getStrategyRegistry,
  Cl as getStreamingTextPadForValidation,
  $o as getTelemetryDecorators,
  mi as getTerminalManager,
  Hi as getTokenEstimationConfig,
  zi as getTokenMonitor,
  Ai as getToolTrustManager,
  Ys as gitIgnoreArrayFromFile,
  Qn as globMatch,
  Ei as handleAuthError,
  cl as hasFrontMatter,
  ul as hasTrustMatch,
  sa as initializeCompaction,
  ra as initializeCompactionSystem,
  Gt as initializeKiroAgent,
  qc as initializeRemoteToolCounters,
  sl as initializeToolCounters,
  rl as isAbortError,
  Ti as isAuthError,
  hl as isCommandAccepted,
  xe as isEmptyWorkspace,
  Oo as isExperimentsFeatureEnabled,
  ce as isFileChangeAction,
  Xn as isGlobPattern,
  Ac as isHtmlContentType,
  on as isLikelyQuickCommand,
  Qt as isMessagesInput,
  le as isMoveAction,
  Ml as isProtectedPath,
  xo as isSemanticRenameAction,
  yc as isSupportedContentType,
  Gr as isValidAgentMode,
  Hn as isValidTag,
  wc as isValidUrl,
  Nr as joinPrompts,
  sn as limitGrepOutputSize,
  Si as loadCurrentFile,
  rc as loadModel,
  vi as loadOpenEditorFiles,
  Xt as manageSpecImplicitRules,
  vs as mapChatMessagesToExecutionIds,
  Cs as mapExecutionIdsToMessages,
  Fr as mapQError,
  Is as mapSpecContextItemToContextDocuments,
  il as mapUnknownToErrorType,
  Jn as matchesPattern,
  ia as needsCompaction,
  zs as noOpPoolCallbacks,
  li as noOpPostToolUseHook,
  di as noOpPreToolUseHook,
  fl as normalizeCommand,
  Ri as notifyDevInspector,
  Xr as objectToXML,
  ks as parseCustomAgentFile,
  ll as parseFrontMatter,
  dl as parseFrontMatterRaw,
  _s as parseJsonAgentFile,
  Fl as parseMarkdownTasks,
  Br as parseMessagePartArray,
  Fc as parseMimeType,
  Io as populateMatchedSteering,
  rn as positionAt,
  In as processPromptWithContext,
  Dr as promptTemplate,
  Ur as rawPromptString,
  aa as registerStrategy,
  Vo as reportFeatureUsage,
  $i as resetCompactor,
  Vi as resetConfig,
  Qi as resetStrategyRegistry,
  Xi as resetTokenMonitor,
  Dc as sanitizeConversation,
  Pe as serializeFileTree,
  Jr as serializeSteeringDocument,
  Zr as serializeZodSchemaIntoJsonString,
  qr as serializeZodSchemaIntoObject,
  Yr as serializeZodSchemaIntoXMLString,
  Ii as setAuthErrorHandler,
  N as setAutonomyModeProvider,
  G as setCommandApprovalProvider,
  na as setDefaultStrategy,
  ki as setDevInspectorHook,
  O as setExecutionLogController,
  b as setExecutionLoggerProvider,
  bs as setFastModel,
  Qo as setFeatureReporter,
  Fe as setFileContextProvider,
  Ae as setHooksProvider,
  Xo as setMetricReporterFactory,
  No as setModelConfigProvider,
  ns as setPendingChangesService,
  we as setPostToolUseHookExecutor,
  ye as setPreToolUseHookExecutor,
  D as setQClientFactory,
  yi as setRemoteMCPClient,
  Do as setSelectedModelId,
  Ms as setSessionPersistenceIntegration,
  gi as setShellTypeInfoProvider,
  U as setSpecMessageMappingProvider,
  L as setSpecPlatformProvider,
  Jo as setTelemetryDecorators,
  ui as setTerminalManager,
  Yc as setToolTelemetryFactory,
  wi as setToolTrustManager,
  Rc as stopAgentResponseStreamsInGraphState,
  pl as stripFrontMatter,
  xn as stripJsonComments,
  vn as stripMarkdownCodeFences,
  kc as stripQueryParameters,
  hi as terminalManager,
  _c as truncateContent,
  Zn as unionTools,
  Ji as updateConfig,
  an as updateModifiedFilesList,
  Zi as updateStrategyConfig,
  qi as updateTokenEstimationConfig,
  Jt as userHookNode,
  El as validateContent,
  Uc as validateConversation,
  $s as validateMCPServerOptions
};
//# sourceMappingURL=index.js.map
