@moxxy/cli 0.49.1 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -8,13 +8,13 @@ import path3__default, { dirname, join, posix, resolve, relative, sep, isAbsolut
8
8
  import { utf8Locale, ensurePrivateDir, moxxyHome, pruneStaleTempFiles, moxxyPath, hasProxy, installEgressProxy, readProxyEnv, writeFileAtomic, ensurePrivateFile, killTree as killTree$1, liveChannelStatus, spawnDedicatedChannel, stopDedicatedChannel, clearChannelStatus, findExecutable, PRIVATE_FILE_MODE, resolveOsPrincipal, redactProxyUrl, resolveExecutableTarget, spawnExecutableTarget, listLiveChannelStatuses, rotateChannelToken, writeSignedNetworkCacheAtomic, CrossProcessFireLock, fetchNpmLatest, writeChannelStatus, withFileLock, writeBoundedNetworkCacheAtomicSync, writeBoundedDataCacheAtomic, readRequestBody, bearerTokenMatches } from '@moxxy/sdk/server';
9
9
  import { spawn, spawnSync, execFile } from 'child_process';
10
10
  import { fileURLToPath, pathToFileURL } from 'url';
11
- import { MoxxyError, createMutex, defineChannel, definePlugin, defineViewRenderer, DEFAULT_VIEW_TAGS, defineTunnelProvider, defineAuditExporter, defineAuditSink, z as z$1, withAgentConduct, questionAnswersSchema, defineTool, defineEmbedder, defineMode, asPluginId, computerControlSnapshotSchema, createDeferredPermissionResolver, isSafeViewUrl, redactSecrets, questionAnswerDisplay, describeQuestionAnswers, searchConversation, conversationTurns, asTurnId, waitFor, unfinishedWorkCheckpoint, unfinishedStepCheckpoint, runReactLoop, defineCompactor, abortError, activeCompactionRanges, defineCacheStrategy, runManualCompaction, assertDefined, defineWorkflowExecutor, MOXXY_PCM16_24KHZ_MIME, isAgentNoReplyEvent, AGENT_NO_REPLY_TEXT, accountLimitOfEvent, isFileDiffDisplay, questionAnswerLines, stepListProgress, startingModel, fileDiffFromText, findAttachment, listAttachments, summarizeWithProvider, toolResultBytes, isSelectableMode, summarizeSessionTokensFromEvents, summarizeTokensByModel, getInstallHint, toDiffRows, diffGutterNo, fileDiffVerb, fileDiffSummary, openQuestionsFromEvents, emptyDraft, questionAnswersProblem, draftAnswers, computeElisionState, toolResultStubbed, toolResultStubText, conversationalStubbed, conversationalStub, chooseOption, typeOwnAnswer, isFirstPartyPackage, REDACTED_PLACEHOLDER, isSecretKey, addModelTotals, skillFrontmatterSchema, asSkillId, parseFrontmatter, denyByDefaultResolver, createCallbackResolver, createAllowListResolver, countNodes, autoAllowResolver, SESSION_SOURCES, startChannelWith, EXIT_AFTER_PAIR_FLAG, renderFrontmatter, formatPrincipal, aggregateCapabilitySpecs, hostCredentialName, verifyEd25519, mentionedSkills, skillAttachment, withoutTools, toolsForMode, moxxyPackageSchema, auditActionOf, asToolCallId, dispatchToolCall, matchLoadableTools, defineSecretProvider, encodeLoginAuthUrl, redactSecretText, encodeLoginPrompt, defineCommand, ISOLATION_RANK, sleepWithAbort, asSessionId, migrateModeName, autoApproveFromEvents, AUTO_APPROVE_SUBTYPE, AUTO_APPROVE_PLUGIN_ID, autoApproveFromAgent, autoApproveRecorded, agentActivityRecord, withRecordedContextWindows, recordedContextWindows, parseFrontmatterFile, createJsonFileStore, eventForClient, autoApproveSwitch, computerControlCommandSchema, historyPageForClient, readAttachmentChunk, computerApprovalFocusSchema, workflowApprovalItemsSchema, evaluateToolRule, asEventId, QUESTION_ASKED, questionCloseNote, QUESTION_RESOLVED, QUESTION_CLOSED_NEW_MESSAGE as QUESTION_CLOSED_NEW_MESSAGE$1, questionRecord as questionRecord$1, QUESTION_PLUGIN_ID } from '@moxxy/sdk';
11
+ import { MoxxyError, createMutex, defineChannel, definePlugin, defineViewRenderer, DEFAULT_VIEW_TAGS, defineTunnelProvider, defineAuditExporter, defineAuditSink, z as z$1, withAgentConduct, questionAnswersSchema, defineTool, defineEmbedder, defineMode, asPluginId, computerControlSnapshotSchema, createDeferredPermissionResolver, isSafeViewUrl, redactSecrets, questionAnswerDisplay, describeQuestionAnswers, searchConversation, conversationTurns, asTurnId, waitFor, unfinishedWorkCheckpoint, unfinishedStepCheckpoint, runReactLoop, defineCompactor, abortError, activeCompactionRanges, defineCacheStrategy, runManualCompaction, assertDefined, defineWorkflowExecutor, MOXXY_PCM16_24KHZ_MIME, isAgentNoReplyEvent, AGENT_NO_REPLY_TEXT, accountLimitOfEvent, isFileDiffDisplay, questionAnswerLines, stepListProgress, startingModel, fileDiffFromText, findAttachment, listAttachments, summarizeWithProvider, toolResultBytes, isSelectableMode, summarizeSessionTokensFromEvents, summarizeTokensByModel, getInstallHint, toDiffRows, diffGutterNo, fileDiffVerb, fileDiffSummary, openQuestionsFromEvents, emptyDraft, questionAnswersProblem, draftAnswers, computeElisionState, toolResultStubbed, toolResultStubText, conversationalStubbed, conversationalStub, chooseOption, typeOwnAnswer, isFirstPartyPackage, REDACTED_PLACEHOLDER, isSecretKey, addModelTotals, skillFrontmatterSchema, asSkillId, parseFrontmatter, denyByDefaultResolver, createCallbackResolver, createAllowListResolver, countNodes, autoAllowResolver, SESSION_SOURCES, startChannelWith, EXIT_AFTER_PAIR_FLAG, renderFrontmatter, envShareNameSchema, formatPrincipal, aggregateCapabilitySpecs, hostCredentialName, verifyEd25519, mentionedSkills, skillAttachment, withoutTools, toolsForMode, moxxyPackageSchema, auditActionOf, asToolCallId, dispatchToolCall, matchLoadableTools, defineSecretProvider, encodeLoginAuthUrl, redactSecretText, encodeLoginPrompt, defineCommand, ISOLATION_RANK, sleepWithAbort, asSessionId, migrateModeName, autoApproveFromEvents, AUTO_APPROVE_SUBTYPE, AUTO_APPROVE_PLUGIN_ID, autoApproveFromAgent, autoApproveRecorded, agentActivityRecord, withRecordedContextWindows, recordedContextWindows, parseFrontmatterFile, createJsonFileStore, eventForClient, autoApproveSwitch, computerControlCommandSchema, historyPageForClient, readAttachmentChunk, computerApprovalFocusSchema, workflowApprovalItemsSchema, evaluateToolRule, asEventId, QUESTION_ASKED, questionCloseNote, QUESTION_RESOLVED, QUESTION_CLOSED_NEW_MESSAGE as QUESTION_CLOSED_NEW_MESSAGE$1, questionRecord as questionRecord$1, QUESTION_PLUGIN_ID } from '@moxxy/sdk';
12
12
  import { createRequire as createRequire$1 } from 'module';
13
13
  import { z } from 'zod/v3';
14
14
  import { AsyncLocalStorage } from 'async_hooks';
15
15
  import { readFile, rm, mkdtemp, writeFile, mkdir, open, readdir, unlink, link, rename, stat, access, constants as constants$2, realpath } from 'fs/promises';
16
16
  import { setTimeout as setTimeout$1, setImmediate as setImmediate$1 } from 'timers/promises';
17
- import { styleText, promisify, stripVTControlCharacters } from 'util';
17
+ import { styleText, promisify, debuglog, stripVTControlCharacters } from 'util';
18
18
  import * as readline from 'readline/promises';
19
19
  import { isValidCron, isValidTimeZone, firstFireBetween, nextFireTime } from '@moxxy/sdk/cron';
20
20
  import { createServer } from 'http';
@@ -32,7 +32,7 @@ import { isAgentWorkEvent } from '@moxxy/sdk/agent-work';
32
32
  import { isFileDiffDisplay as isFileDiffDisplay$1, isQuestionAnswerDisplay, toolImagesOf, stepsAllDone, isToolDisplayResult, isStepListDisplay } from '@moxxy/sdk/tool-display';
33
33
  import { isGoalMetEvent } from '@moxxy/sdk/agent-step';
34
34
  import { agentComputerUseOf } from '@moxxy/sdk/agent-computer-use';
35
- import { questionRecord, QUESTION_CLOSED_AGENT_WENT_ON, QUESTION_CLOSED_NEW_MESSAGE } from '@moxxy/sdk/questions';
35
+ import { questionRecord, QUESTION_CLOSED_AGENT_WENT_ON, QUESTION_CLOSED_NEW_MESSAGE, ENV_SHARE_PRIVACY_NOTE } from '@moxxy/sdk/questions';
36
36
  import { accountLimitInForce, recordedAccountLimit } from '@moxxy/sdk/agent-account-limit';
37
37
  import * as l from 'readline';
38
38
  import l__default, { createInterface } from 'readline';
@@ -15933,28 +15933,34 @@ var init_session_questions = __esm({
15933
15933
  SessionQuestionsImpl = class {
15934
15934
  deps;
15935
15935
  surfaces = 0;
15936
+ envSurfaces = 0;
15936
15937
  /** Questions an asker in this process still waits on; one left in the log by an earlier run is dead. */
15937
15938
  waiting = /* @__PURE__ */ new Set();
15939
+ saving = /* @__PURE__ */ new Set();
15938
15940
  constructor(deps) {
15939
15941
  this.deps = deps;
15940
15942
  }
15941
15943
  get surfaceCount() {
15942
15944
  return this.surfaces;
15943
15945
  }
15944
- attachSurface() {
15946
+ attachSurface({ envShare = false } = {}) {
15945
15947
  this.surfaces += 1;
15948
+ if (envShare)
15949
+ this.envSurfaces += 1;
15946
15950
  let attached = true;
15947
15951
  return () => {
15948
15952
  if (!attached)
15949
15953
  return;
15950
15954
  attached = false;
15951
15955
  this.surfaces -= 1;
15956
+ if (envShare)
15957
+ this.envSurfaces -= 1;
15952
15958
  };
15953
15959
  }
15954
15960
  ask = async ({ turnId, questions, signal }) => {
15955
15961
  if (signal.aborted)
15956
15962
  return { kind: "dismissed", reason: "cancelled" };
15957
- if (this.surfaces === 0)
15963
+ if (this.surfaces === 0 || this.envSurfaces === 0 && questions.some((item) => item.vaultName))
15958
15964
  return { kind: "unanswerable" };
15959
15965
  const questionId = ulid();
15960
15966
  const { log: log2 } = this.deps;
@@ -15977,14 +15983,49 @@ var init_session_questions = __esm({
15977
15983
  }
15978
15984
  };
15979
15985
  async answer(questionId, answers) {
15980
- const open3 = this.waiting.has(questionId) ? openQuestionsFromEvents(this.deps.log.ofType("plugin_event")).find((q) => q.questionId === questionId) : void 0;
15981
- if (!open3)
15982
- throw new Error("This question is no longer open.");
15986
+ const open3 = this.pending(questionId);
15987
+ if (open3.questions.some((item) => item.vaultName)) {
15988
+ throw new Error("Open Env Share in the Moxxy desktop or TUI.");
15989
+ }
15983
15990
  const problem = questionAnswersProblem(open3.questions, answers);
15984
15991
  if (problem)
15985
15992
  throw new Error(problem);
15986
15993
  await this.record(asTurnId(open3.turnId), QUESTION_RESOLVED, { questionId, answers });
15987
15994
  }
15995
+ pending(questionId) {
15996
+ const open3 = this.waiting.has(questionId) ? openQuestionsFromEvents(this.deps.log.ofType("plugin_event")).find((q) => q.questionId === questionId) : void 0;
15997
+ if (!open3)
15998
+ throw new Error("This question is no longer open.");
15999
+ if (this.saving.has(questionId))
16000
+ throw new Error("Env Share is already saving.");
16001
+ return open3;
16002
+ }
16003
+ async shareEnv(questionId, value2) {
16004
+ const open3 = this.pending(questionId);
16005
+ const name = open3.questions[0]?.vaultName;
16006
+ if (!name || open3.questions.length !== 1)
16007
+ throw new Error("No Env Share request is open here.");
16008
+ this.saving.add(questionId);
16009
+ try {
16010
+ if (value2 !== null) {
16011
+ if (!value2.length || value2.length > 65536)
16012
+ throw new Error("Enter a value of up to 65536 characters.");
16013
+ if (!this.deps.saveShared)
16014
+ throw new Error("Vault unavailable.");
16015
+ try {
16016
+ await this.deps.saveShared(name, value2);
16017
+ } catch {
16018
+ throw new Error("Could not save to the Moxxy vault.");
16019
+ }
16020
+ }
16021
+ if (this.isOpen(questionId)) {
16022
+ const answers = { env: { selected: [value2 === null ? "skip" : "saved"] } };
16023
+ await this.record(asTurnId(open3.turnId), QUESTION_RESOLVED, { questionId, answers });
16024
+ }
16025
+ } finally {
16026
+ this.saving.delete(questionId);
16027
+ }
16028
+ }
15988
16029
  /**
15989
16030
  * Close every question nobody in this process waits on: on a resumed log
15990
16031
  * those were left open by a run that stopped mid-question. Recording the
@@ -20546,7 +20587,11 @@ var init_session = __esm({
20546
20587
  if (opts.governance)
20547
20588
  this.governance = Object.freeze({ ...opts.governance });
20548
20589
  this.log = opts.log ?? new EventLog();
20549
- this.questions = new SessionQuestionsImpl({ log: this.log, sessionId: this.id });
20590
+ this.questions = new SessionQuestionsImpl({
20591
+ log: this.log,
20592
+ sessionId: this.id,
20593
+ saveShared: (name, value2) => this.services.require("vault").setShared(name, value2)
20594
+ });
20550
20595
  if (opts.log) {
20551
20596
  this.questions.closeLeftOver().catch((err) => {
20552
20597
  this.logger.warn("could not close questions left open by an earlier run", { err: String(err) });
@@ -23211,37 +23256,50 @@ var init_store = __esm({
23211
23256
  * rename is atomic, so a crash mid-write leaves the previous vault intact
23212
23257
  * rather than truncated. mode 0o600 keeps the secret store owner-only.
23213
23258
  */
23214
- async persist() {
23215
- if (!this.file)
23259
+ async persist(next = this.file) {
23260
+ if (!next)
23216
23261
  return;
23217
- await writeFileAtomic(this.filePath, JSON.stringify(this.file, null, 2), { mode: 384 });
23262
+ await writeFileAtomic(this.filePath, JSON.stringify(next, null, 2), { mode: 384 });
23263
+ this.file = next;
23218
23264
  this.lastSynced = null;
23219
23265
  }
23220
23266
  async set(name, value2, tags) {
23267
+ await this.setMany([{ name, value: value2, tags }]);
23268
+ }
23269
+ async setShared(name, value2) {
23270
+ await this.setMany([{ name, value: value2, referenceOnly: true }]);
23271
+ }
23272
+ /** Install a set of credentials with one encrypted-file commit. */
23273
+ async setMany(updates) {
23274
+ if (!updates.length)
23275
+ return;
23221
23276
  await this.open();
23222
- return this.mutex.run(async () => {
23277
+ await this.mutex.run(async () => {
23223
23278
  if (!this.file || !this.masterKey)
23224
23279
  throw new Error("vault not open");
23225
23280
  await this.syncFromDisk();
23226
23281
  const now = (/* @__PURE__ */ new Date()).toISOString();
23227
- const existing = this.file.entries[name];
23228
- const blob = encrypt(value2, this.masterKey);
23229
- this.file = {
23230
- ...this.file,
23231
- entries: {
23232
- ...this.file.entries,
23233
- [name]: {
23234
- ...blob,
23235
- createdAt: existing?.createdAt ?? now,
23236
- updatedAt: now,
23237
- tags: tags ?? existing?.tags
23238
- }
23239
- }
23240
- };
23241
- await this.persist();
23282
+ const entries = Object.assign(/* @__PURE__ */ Object.create(null), this.file.entries);
23283
+ for (const { name, value: value2, tags, referenceOnly } of updates) {
23284
+ const existing = entries[name];
23285
+ entries[name] = {
23286
+ ...encrypt(value2, this.masterKey),
23287
+ ...referenceOnly || existing?.referenceOnly ? { referenceOnly: true } : {},
23288
+ createdAt: existing?.createdAt ?? now,
23289
+ updatedAt: now,
23290
+ tags: tags ?? existing?.tags
23291
+ };
23292
+ }
23293
+ await this.persist({ ...this.file, entries });
23242
23294
  });
23243
23295
  }
23244
23296
  async get(name) {
23297
+ return this.readEntry(name, false);
23298
+ }
23299
+ async getForModel(name) {
23300
+ return this.readEntry(name, true);
23301
+ }
23302
+ async readEntry(name, forModel) {
23245
23303
  await this.open();
23246
23304
  return this.mutex.run(async () => {
23247
23305
  await this.syncFromDisk();
@@ -23250,6 +23308,8 @@ var init_store = __esm({
23250
23308
  const entry = this.file.entries[name];
23251
23309
  if (!entry)
23252
23310
  return null;
23311
+ if (forModel && entry.referenceOnly)
23312
+ throw new Error("Use the vault reference for this shared secret.");
23253
23313
  return this.decryptEntry(name, entry);
23254
23314
  });
23255
23315
  }
@@ -23332,6 +23392,17 @@ var init_store = __esm({
23332
23392
  };
23333
23393
  }
23334
23394
  });
23395
+ function envQuestion(name, purpose) {
23396
+ return {
23397
+ id: "env",
23398
+ vaultName: name,
23399
+ header: "Env Share",
23400
+ question: name + " \u2014 " + purpose,
23401
+ options: [{ id: "saved", label: "Saved to vault" }, { id: "skip", label: "Skip" }],
23402
+ multiSelect: false,
23403
+ allowOther: false
23404
+ };
23405
+ }
23335
23406
  function defaultVaultPath() {
23336
23407
  return moxxyPath("vault.json");
23337
23408
  }
@@ -23417,11 +23488,45 @@ ${vaultCommandUsage()}` };
23417
23488
  ctx.services.register("resolveSecrets", (value2) => resolveString(value2, vault));
23418
23489
  }
23419
23490
  },
23420
- commands: [vaultCmd],
23491
+ commands: [vaultCmd, {
23492
+ name: "env",
23493
+ channels: ["tui"],
23494
+ description: "Open Env Share to store a credential privately",
23495
+ argumentHint: "share <NAME>",
23496
+ handler: async (ctx) => {
23497
+ const [action, name, ...extra] = ctx.args.trim().split(/\s+/);
23498
+ if (action !== "share" || !name || extra.length || !envShareNameSchema.safeParse(name).success) {
23499
+ return { kind: "error", message: "Usage: /env share <NAME>. Enter the value in the private prompt." };
23500
+ }
23501
+ const session = ctx.session;
23502
+ const outcome = await session.questions.ask({
23503
+ turnId: session.startTurn().turnId,
23504
+ signal: new AbortController().signal,
23505
+ questions: [envQuestion(name, "Save a credential for your integrations")]
23506
+ });
23507
+ return { kind: "text", text: outcome.kind === "answered" && outcome.answers.env?.selected.includes("saved") ? "Saved. Reference: ${vault:" + name + "}" : "Env Share closed without a credential." };
23508
+ }
23509
+ }],
23421
23510
  tools: [
23511
+ defineTool({
23512
+ name: "env_share",
23513
+ description: "Request a missing user credential or environment variable by name and purpose. Use this whenever an integration needs a user secret. Only use its vault reference afterwards.",
23514
+ inputSchema: z$1.object({ name: envShareNameSchema, purpose: z$1.string().trim().min(1).max(300) }).strict(),
23515
+ permission: { action: "allow" },
23516
+ isolation: { required: "inproc", capabilities: { net: { mode: "none" } } },
23517
+ async handler({ name, purpose }, ctx) {
23518
+ const outcome = await ctx.ask?.([envQuestion(name, purpose)]);
23519
+ if (outcome?.kind === "answered" && outcome.answers.env?.selected.includes("saved")) {
23520
+ return "Saved to the Moxxy vault. Reference: ${vault:" + name + "}";
23521
+ }
23522
+ if (!outcome || outcome.kind === "unanswerable")
23523
+ return `Ask the person to run moxxy env share ${name} in their terminal. Never request the value in chat.`;
23524
+ return "Env Share closed without a credential. Stop work that requires it.";
23525
+ }
23526
+ }),
23422
23527
  defineTool({
23423
23528
  name: "vault_set",
23424
- description: "Store a secret in the encrypted vault. Overwrites if name exists. IMPORTANT: do NOT use this for a secret the USER supplies \u2014 that would route the plaintext through the conversation. Instead tell the user to run `/vault set <name> <value>` themselves; you only receive a ${vault:<name>} reference. Use this tool only for a value you legitimately already hold and may see.",
23529
+ description: "Store a secret in the encrypted vault. Overwrites if name exists. IMPORTANT: do NOT use this for a secret the USER supplies \u2014 that would route the plaintext through the conversation. Use env_share for a user credential. Use vault_set only for a value you legitimately already hold and may see.",
23425
23530
  inputSchema: z$1.object({
23426
23531
  name: z$1.string().min(1).regex(/^[A-Za-z0-9_.-]+$/),
23427
23532
  value: z$1.string().min(1),
@@ -23453,7 +23558,7 @@ ${vaultCommandUsage()}` };
23453
23558
  }
23454
23559
  },
23455
23560
  handler: async ({ name }) => {
23456
- const value2 = await vault.get(name);
23561
+ const value2 = await vault.getForModel(name);
23457
23562
  if (value2 === null) {
23458
23563
  throw new MoxxyError({
23459
23564
  code: "TOOL_ERROR",
@@ -37452,7 +37557,7 @@ var init_ask_user = __esm({
37452
37557
  askUserTool = defineTool({
37453
37558
  name: "ask_user",
37454
37559
  icon: "chat",
37455
- description: "Ask the user one to four questions and wait for the answers. Use it only when a decision is genuinely the user's to make and you cannot settle it from the request, the code, or a sensible default \u2014 which of two designs, which scope, which name. Offer two to four concrete answers per question; the user can always answer in their own words instead. Do not ask leave to run a tool (the user is asked for that separately) or whether to continue.",
37560
+ description: "Ask the user one to four questions and wait for the answers. Use it only when a decision is genuinely the user's to make and you cannot settle it from the request, the code, or a sensible default \u2014 which of two designs, which scope, which name. Offer two to four concrete answers per question; the user can always answer in their own words instead. Do not ask leave to run a tool (the user is asked for that separately) or whether to continue. For credentials use env_share.",
37456
37561
  inputSchema: z$1.object({
37457
37562
  questions: z$1.array(z$1.object({
37458
37563
  question: z$1.string().trim().min(1).describe("The full question, ending with a question mark."),
@@ -41245,7 +41350,7 @@ var require_react_development = __commonJS({
41245
41350
  }
41246
41351
  return dispatcher.useContext(Context);
41247
41352
  }
41248
- function useState20(initialState) {
41353
+ function useState21(initialState) {
41249
41354
  var dispatcher = resolveDispatcher();
41250
41355
  return dispatcher.useState(initialState);
41251
41356
  }
@@ -41253,7 +41358,7 @@ var require_react_development = __commonJS({
41253
41358
  var dispatcher = resolveDispatcher();
41254
41359
  return dispatcher.useReducer(reducer2, initialArg, init);
41255
41360
  }
41256
- function useRef11(initialValue) {
41361
+ function useRef12(initialValue) {
41257
41362
  var dispatcher = resolveDispatcher();
41258
41363
  return dispatcher.useRef(initialValue);
41259
41364
  }
@@ -42047,8 +42152,8 @@ var require_react_development = __commonJS({
42047
42152
  exports.useLayoutEffect = useLayoutEffect2;
42048
42153
  exports.useMemo = useMemo10;
42049
42154
  exports.useReducer = useReducer2;
42050
- exports.useRef = useRef11;
42051
- exports.useState = useState20;
42155
+ exports.useRef = useRef12;
42156
+ exports.useState = useState21;
42052
42157
  exports.useSyncExternalStore = useSyncExternalStore;
42053
42158
  exports.useTransition = useTransition;
42054
42159
  exports.version = ReactVersion;
@@ -49724,9 +49829,9 @@ var require_react_reconciler_development = __commonJS({
49724
49829
  if (process.env.NODE_ENV !== "production") {
49725
49830
  module.exports = function $$$reconciler($$$hostConfig) {
49726
49831
  var exports2 = {};
49727
- var React60 = require_react();
49832
+ var React61 = require_react();
49728
49833
  var Scheduler = require_scheduler();
49729
- var ReactSharedInternals = React60.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
49834
+ var ReactSharedInternals = React61.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
49730
49835
  var suppressWarning = false;
49731
49836
  function setSuppressWarning(newSuppressWarning) {
49732
49837
  {
@@ -69641,7 +69746,7 @@ var require_react_jsx_runtime_development = __commonJS({
69641
69746
  "../../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
69642
69747
  if (process.env.NODE_ENV !== "production") {
69643
69748
  (function() {
69644
- var React60 = require_react();
69749
+ var React61 = require_react();
69645
69750
  var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
69646
69751
  var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
69647
69752
  var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
@@ -69667,7 +69772,7 @@ var require_react_jsx_runtime_development = __commonJS({
69667
69772
  }
69668
69773
  return null;
69669
69774
  }
69670
- var ReactSharedInternals = React60.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
69775
+ var ReactSharedInternals = React61.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
69671
69776
  function error(format) {
69672
69777
  {
69673
69778
  {
@@ -75292,7 +75397,7 @@ var init_question_flow = __esm({
75292
75397
  }
75293
75398
  });
75294
75399
  function attachQuestions(session) {
75295
- return session.questions ? session.questions.attachSurface() : () => void 0;
75400
+ return session.questions ? session.questions.attachSurface({ envShare: true }) : () => void 0;
75296
75401
  }
75297
75402
  function openQuestionIn(events) {
75298
75403
  return openQuestionsFromEvents(events).at(-1) ?? null;
@@ -78738,12 +78843,58 @@ var init_PermissionDialog = __esm({
78738
78843
  };
78739
78844
  }
78740
78845
  });
78846
+ function EnvShareDialog({ item, submit }) {
78847
+ const value2 = (0, import_react69.useRef)("");
78848
+ const locked = (0, import_react69.useRef)(false);
78849
+ const [length, setLength] = (0, import_react69.useState)(0);
78850
+ const [error, setError] = (0, import_react69.useState)("");
78851
+ use_input_default((input, key) => {
78852
+ if (locked.current)
78853
+ return;
78854
+ if (key.return || key.escape) {
78855
+ if (!key.escape && !value2.current)
78856
+ return;
78857
+ locked.current = true;
78858
+ void submit(key.escape ? null : value2.current).then(() => {
78859
+ value2.current = "";
78860
+ }).catch(() => {
78861
+ locked.current = false;
78862
+ setError("Could not finish Env Share. Check the vault and try again.");
78863
+ });
78864
+ return;
78865
+ }
78866
+ if (key.backspace || key.delete)
78867
+ value2.current = value2.current.slice(0, -1);
78868
+ else if (!key.ctrl && !key.meta && input && !/[\x00-\x1f\x7f]/.test(input)) {
78869
+ if (value2.current.length + input.length > 65536) {
78870
+ value2.current = "";
78871
+ setLength(0);
78872
+ setError("The value exceeds 65536 characters.");
78873
+ return;
78874
+ }
78875
+ value2.current += input;
78876
+ }
78877
+ setLength(value2.current.length);
78878
+ setError("");
78879
+ });
78880
+ return (0, import_jsx_runtime38.jsxs)(Modal, { title: "Env Share", hints: "Enter save \xB7 Esc skip", children: [(0, import_jsx_runtime38.jsx)(Text, { children: terminalSafeText(item.question, 440) }), (0, import_jsx_runtime38.jsxs)(Text, { dimColor: true, children: ["Save or replace ", item.vaultName, " in your vault."] }), (0, import_jsx_runtime38.jsx)(Text, { children: "\u2022".repeat(Math.min(length, 32)) }), error ? (0, import_jsx_runtime38.jsx)(Text, { children: error }) : null, (0, import_jsx_runtime38.jsx)(Text, { dimColor: true, children: ENV_SHARE_PRIVACY_NOTE })] });
78881
+ }
78882
+ var import_jsx_runtime38, import_react69;
78883
+ var init_EnvShareDialog = __esm({
78884
+ async "../plugin-cli/dist/components/EnvShareDialog.js"() {
78885
+ import_jsx_runtime38 = __toESM(require_jsx_runtime());
78886
+ import_react69 = __toESM(require_react());
78887
+ await init_build2();
78888
+ init_terminal_text();
78889
+ await init_Modal();
78890
+ }
78891
+ });
78741
78892
 
78742
78893
  // ../plugin-cli/dist/components/QuestionDialog.js
78743
- var import_jsx_runtime38, QuestionDialog;
78894
+ var import_jsx_runtime39, QuestionDialog;
78744
78895
  var init_QuestionDialog = __esm({
78745
78896
  async "../plugin-cli/dist/components/QuestionDialog.js"() {
78746
- import_jsx_runtime38 = __toESM(require_jsx_runtime());
78897
+ import_jsx_runtime39 = __toESM(require_jsx_runtime());
78747
78898
  __toESM(require_react());
78748
78899
  await init_build2();
78749
78900
  init_theme();
@@ -78772,12 +78923,12 @@ var init_QuestionDialog = __esm({
78772
78923
  const total = question.questions.length;
78773
78924
  const picked = flow.draft[item.id];
78774
78925
  const hints = flow.typing !== null ? "Enter answer \xB7 Esc back" : `\u2191\u2193 move \xB7 ${item.multiSelect ? "Space choose \xB7 Enter next" : "Enter choose"}${flow.step > 0 ? " \xB7 Esc previous" : ""}`;
78775
- return (0, import_jsx_runtime38.jsxs)(Modal, { title: total > 1 ? `Question ${flow.step + 1} of ${total}` : "Question", hints, children: [(0, import_jsx_runtime38.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [item.header ? (0, import_jsx_runtime38.jsx)(Text, { color: Colors.mode, children: item.header }) : null, (0, import_jsx_runtime38.jsx)(Text, { bold: true, children: item.question }), item.multiSelect ? (0, import_jsx_runtime38.jsx)(Text, { dimColor: true, children: "Choose any" }) : null] }), flow.typing !== null ? (0, import_jsx_runtime38.jsxs)(Box_default, { children: [(0, import_jsx_runtime38.jsx)(Text, { children: "\u203A " }), (0, import_jsx_runtime38.jsx)(Text, { children: flow.typing }), (0, import_jsx_runtime38.jsx)(Text, { inverse: true, children: " " })] }) : (0, import_jsx_runtime38.jsx)(Box_default, { flexDirection: "column", children: questionRows(item).map((row, i2) => {
78926
+ return (0, import_jsx_runtime39.jsxs)(Modal, { title: total > 1 ? `Question ${flow.step + 1} of ${total}` : "Question", hints, children: [(0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", marginBottom: 1, children: [item.header ? (0, import_jsx_runtime39.jsx)(Text, { color: Colors.mode, children: item.header }) : null, (0, import_jsx_runtime39.jsx)(Text, { bold: true, children: item.question }), item.multiSelect ? (0, import_jsx_runtime39.jsx)(Text, { dimColor: true, children: "Choose any" }) : null] }), flow.typing !== null ? (0, import_jsx_runtime39.jsxs)(Box_default, { children: [(0, import_jsx_runtime39.jsx)(Text, { children: "\u203A " }), (0, import_jsx_runtime39.jsx)(Text, { children: flow.typing }), (0, import_jsx_runtime39.jsx)(Text, { inverse: true, children: " " })] }) : (0, import_jsx_runtime39.jsx)(Box_default, { flexDirection: "column", children: questionRows(item).map((row, i2) => {
78776
78927
  const active = i2 === flow.cursor;
78777
78928
  const chosen = row.id === OWN_ANSWER_ROW ? Boolean(picked && picked.other.trim() !== "") : Boolean(picked && picked.selected.includes(row.id));
78778
78929
  const mark = item.multiSelect ? chosen ? "[x]" : "[ ]" : chosen ? "(\u25CF)" : "( )";
78779
- return (0, import_jsx_runtime38.jsxs)(Box_default, { children: [(0, import_jsx_runtime38.jsx)(Text, { ...active ? { color: Colors.active } : { dimColor: true }, children: active ? "\u203A " : " " }), (0, import_jsx_runtime38.jsx)(Text, { ...active ? {} : { dimColor: true }, children: `${mark} ` }), (0, import_jsx_runtime38.jsx)(Text, { bold: active, children: row.id === OWN_ANSWER_ROW && picked && picked.other.trim() !== "" ? `${row.label}: ${picked.other}` : row.label }), row.description ? (0, import_jsx_runtime38.jsx)(Text, { dimColor: true, children: ` ${row.description}` }) : null] }, row.id);
78780
- }) }), sending ? (0, import_jsx_runtime38.jsx)(Text, { dimColor: true, children: "Sending the answer\u2026" }) : null, error ? (0, import_jsx_runtime38.jsx)(Text, { color: Colors.danger, children: error }) : null] });
78930
+ return (0, import_jsx_runtime39.jsxs)(Box_default, { children: [(0, import_jsx_runtime39.jsx)(Text, { ...active ? { color: Colors.active } : { dimColor: true }, children: active ? "\u203A " : " " }), (0, import_jsx_runtime39.jsx)(Text, { ...active ? {} : { dimColor: true }, children: `${mark} ` }), (0, import_jsx_runtime39.jsx)(Text, { bold: active, children: row.id === OWN_ANSWER_ROW && picked && picked.other.trim() !== "" ? `${row.label}: ${picked.other}` : row.label }), row.description ? (0, import_jsx_runtime39.jsx)(Text, { dimColor: true, children: ` ${row.description}` }) : null] }, row.id);
78931
+ }) }), sending ? (0, import_jsx_runtime39.jsx)(Text, { dimColor: true, children: "Sending the answer\u2026" }) : null, error ? (0, import_jsx_runtime39.jsx)(Text, { color: Colors.danger, children: error }) : null] });
78781
78932
  };
78782
78933
  }
78783
78934
  });
@@ -78918,20 +79069,20 @@ var init_provider_connect_flow = __esm({
78918
79069
  });
78919
79070
 
78920
79071
  // ../plugin-cli/dist/components/ProviderConnectDialog.js
78921
- var import_jsx_runtime39, import_react70, ProviderConnectDialog;
79072
+ var import_jsx_runtime40, import_react71, ProviderConnectDialog;
78922
79073
  var init_ProviderConnectDialog = __esm({
78923
79074
  async "../plugin-cli/dist/components/ProviderConnectDialog.js"() {
78924
- import_jsx_runtime39 = __toESM(require_jsx_runtime());
78925
- import_react70 = __toESM(require_react());
79075
+ import_jsx_runtime40 = __toESM(require_jsx_runtime());
79076
+ import_react71 = __toESM(require_react());
78926
79077
  await init_build2();
78927
79078
  init_theme();
78928
79079
  await init_Modal();
78929
79080
  init_provider_connect_flow();
78930
79081
  ProviderConnectDialog = ({ providerId, setup, onSuccess, onCancel }) => {
78931
- const [phase, setPhase] = import_react70.default.useState({ kind: "installing" });
78932
- const [buffer, setBuffer] = import_react70.default.useState("");
78933
- const flowRef = import_react70.default.useRef(null);
78934
- import_react70.default.useEffect(() => {
79082
+ const [phase, setPhase] = import_react71.default.useState({ kind: "installing" });
79083
+ const [buffer, setBuffer] = import_react71.default.useState("");
79084
+ const flowRef = import_react71.default.useRef(null);
79085
+ import_react71.default.useEffect(() => {
78935
79086
  const flow = createConnectFlow({
78936
79087
  setup,
78937
79088
  providerId,
@@ -78979,7 +79130,7 @@ var init_ProviderConnectDialog = __esm({
78979
79130
  });
78980
79131
  const masked = phase.kind === "key-entry" || phase.kind === "oauth" && phase.prompt?.mask === true;
78981
79132
  const echo = masked ? "\u2022".repeat(buffer.length) : buffer;
78982
- return (0, import_jsx_runtime39.jsxs)(Modal, { title: `connect ${providerId}`, children: [phase.kind === "installing" ? (0, import_jsx_runtime39.jsxs)(Text, { color: Colors.chrome, children: ["installing ", providerId, " \u2014 this can take a minute\u2026"] }) : null, phase.kind === "key-entry" ? (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", children: [phase.error ? (0, import_jsx_runtime39.jsx)(Text, { color: Colors.danger, children: phase.error }) : null, phase.validating ? (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, children: "validating key\u2026" }) : (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [(0, import_jsx_runtime39.jsxs)(Text, { children: ["API key: ", (0, import_jsx_runtime39.jsx)(Text, { color: Colors.active, children: echo }), (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, children: "\u258F" })] }), (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, children: "enter save \xB7 esc cancel \u2014 stored in the vault, never in config" })] })] }) : null, phase.kind === "oauth" ? (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", children: [phase.lines.slice(-8).map((line, i2) => (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, wrap: "truncate-end", children: line }, `${i2}-${line.slice(0, 12)}`)), phase.prompt ? (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [(0, import_jsx_runtime39.jsx)(Text, { children: phase.prompt.question }), (0, import_jsx_runtime39.jsxs)(Text, { children: [(0, import_jsx_runtime39.jsx)(Text, { color: Colors.active, children: echo }), (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, children: "\u258F" })] })] }) : (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, children: "waiting for sign-in to complete\u2026 esc to cancel" })] }) : null, phase.kind === "done" ? (0, import_jsx_runtime39.jsxs)(Text, { color: Colors.active, children: ["\u2713 connected", phase.note ? ` \u2014 ${phase.note}` : ""] }) : null, phase.kind === "failed" ? (0, import_jsx_runtime39.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime39.jsx)(Text, { color: Colors.danger, children: phase.message }), (0, import_jsx_runtime39.jsx)(Text, { color: Colors.chrome, children: phase.retryable ? "r retry \xB7 esc close" : "esc close" })] }) : null] });
79133
+ return (0, import_jsx_runtime40.jsxs)(Modal, { title: `connect ${providerId}`, children: [phase.kind === "installing" ? (0, import_jsx_runtime40.jsxs)(Text, { color: Colors.chrome, children: ["installing ", providerId, " \u2014 this can take a minute\u2026"] }) : null, phase.kind === "key-entry" ? (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", children: [phase.error ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.danger, children: phase.error }) : null, phase.validating ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "validating key\u2026" }) : (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [(0, import_jsx_runtime40.jsxs)(Text, { children: ["API key: ", (0, import_jsx_runtime40.jsx)(Text, { color: Colors.active, children: echo }), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "\u258F" })] }), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "enter save \xB7 esc cancel \u2014 stored in the vault, never in config" })] })] }) : null, phase.kind === "oauth" ? (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", children: [phase.lines.slice(-8).map((line, i2) => (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, wrap: "truncate-end", children: line }, `${i2}-${line.slice(0, 12)}`)), phase.prompt ? (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [(0, import_jsx_runtime40.jsx)(Text, { children: phase.prompt.question }), (0, import_jsx_runtime40.jsxs)(Text, { children: [(0, import_jsx_runtime40.jsx)(Text, { color: Colors.active, children: echo }), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "\u258F" })] })] }) : (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "waiting for sign-in to complete\u2026 esc to cancel" })] }) : null, phase.kind === "done" ? (0, import_jsx_runtime40.jsxs)(Text, { color: Colors.active, children: ["\u2713 connected", phase.note ? ` \u2014 ${phase.note}` : ""] }) : null, phase.kind === "failed" ? (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime40.jsx)(Text, { color: Colors.danger, children: phase.message }), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: phase.retryable ? "r retry \xB7 esc close" : "esc close" })] }) : null] });
78983
79134
  };
78984
79135
  }
78985
79136
  });
@@ -79046,24 +79197,24 @@ var init_plugin_setup_flow = __esm({
79046
79197
  });
79047
79198
 
79048
79199
  // ../plugin-cli/dist/components/PluginSetupDialog.js
79049
- var import_jsx_runtime40, import_react71, PluginSetupDialog;
79200
+ var import_jsx_runtime41, import_react72, PluginSetupDialog;
79050
79201
  var init_PluginSetupDialog = __esm({
79051
79202
  async "../plugin-cli/dist/components/PluginSetupDialog.js"() {
79052
- import_jsx_runtime40 = __toESM(require_jsx_runtime());
79053
- import_react71 = __toESM(require_react());
79203
+ import_jsx_runtime41 = __toESM(require_jsx_runtime());
79204
+ import_react72 = __toESM(require_react());
79054
79205
  await init_build2();
79055
79206
  init_theme();
79056
79207
  await init_Modal();
79057
79208
  init_plugin_setup_flow();
79058
79209
  PluginSetupDialog = ({ packageName, spec, onFinish }) => {
79059
- const flowRef = import_react71.default.useRef(null);
79210
+ const flowRef = import_react72.default.useRef(null);
79060
79211
  if (flowRef.current === null) {
79061
79212
  flowRef.current = createPluginSetupFlow(spec, onFinish);
79062
79213
  }
79063
79214
  const flow = flowRef.current;
79064
- const [, bump] = import_react71.default.useReducer((n3) => n3 + 1, 0);
79065
- const [buffer, setBuffer] = import_react71.default.useState("");
79066
- const [selectIndex, setSelectIndex] = import_react71.default.useState(0);
79215
+ const [, bump] = import_react72.default.useReducer((n3) => n3 + 1, 0);
79216
+ const [buffer, setBuffer] = import_react72.default.useState("");
79217
+ const [selectIndex, setSelectIndex] = import_react72.default.useState(0);
79067
79218
  const field = flow.current();
79068
79219
  const state = flow.state();
79069
79220
  use_input_default((input, key) => {
@@ -79119,7 +79270,7 @@ var init_PluginSetupDialog = __esm({
79119
79270
  }
79120
79271
  });
79121
79272
  const progress2 = `${Math.min(state.index + 1, spec.fields.length)}/${spec.fields.length}`;
79122
- return (0, import_jsx_runtime40.jsxs)(Modal, { title: `setup ${packageName}`, subtitle: spec.title, children: [spec.description ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: spec.description }) : null, field ? (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", children: [state.error ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.danger, children: state.error }) : null, (0, import_jsx_runtime40.jsxs)(Text, { children: [(0, import_jsx_runtime40.jsxs)(Text, { color: Colors.chrome, children: ["[", progress2, "] "] }), field.label, field.required === false ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: " (optional)" }) : null] }), field.description ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: field.description }) : null, field.kind === "boolean" ? (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "y yes \xB7 n no \xB7 tab skip \xB7 esc cancel" }) : field.kind === "select" ? (0, import_jsx_runtime40.jsxs)(Box_default, { flexDirection: "column", children: [(field.options ?? []).map((c3, i2) => (0, import_jsx_runtime40.jsxs)(Text, { color: i2 === selectIndex ? Colors.active : void 0, children: [i2 === selectIndex ? "\u203A " : " ", c3] }, c3)), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "\u2191\u2193 choose \xB7 enter confirm \xB7 esc cancel" })] }) : (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [(0, import_jsx_runtime40.jsxs)(Text, { children: [(0, import_jsx_runtime40.jsx)(Text, { color: Colors.active, children: field.kind === "secret" ? "\u2022".repeat(buffer.length) : buffer }), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "\u258F" })] }), (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: field.kind === "secret" ? "enter save (empty keeps an existing value) \xB7 esc cancel" : "enter save \xB7 tab skip \xB7 esc cancel" })] })] }) : (0, import_jsx_runtime40.jsx)(Text, { color: Colors.chrome, children: "saving\u2026" })] });
79273
+ return (0, import_jsx_runtime41.jsxs)(Modal, { title: `setup ${packageName}`, subtitle: spec.title, children: [spec.description ? (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: spec.description }) : null, field ? (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", children: [state.error ? (0, import_jsx_runtime41.jsx)(Text, { color: Colors.danger, children: state.error }) : null, (0, import_jsx_runtime41.jsxs)(Text, { children: [(0, import_jsx_runtime41.jsxs)(Text, { color: Colors.chrome, children: ["[", progress2, "] "] }), field.label, field.required === false ? (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: " (optional)" }) : null] }), field.description ? (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: field.description }) : null, field.kind === "boolean" ? (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: "y yes \xB7 n no \xB7 tab skip \xB7 esc cancel" }) : field.kind === "select" ? (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", children: [(field.options ?? []).map((c3, i2) => (0, import_jsx_runtime41.jsxs)(Text, { color: i2 === selectIndex ? Colors.active : void 0, children: [i2 === selectIndex ? "\u203A " : " ", c3] }, c3)), (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: "\u2191\u2193 choose \xB7 enter confirm \xB7 esc cancel" })] }) : (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [(0, import_jsx_runtime41.jsxs)(Text, { children: [(0, import_jsx_runtime41.jsx)(Text, { color: Colors.active, children: field.kind === "secret" ? "\u2022".repeat(buffer.length) : buffer }), (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: "\u258F" })] }), (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: field.kind === "secret" ? "enter save (empty keeps an existing value) \xB7 esc cancel" : "enter save \xB7 tab skip \xB7 esc cancel" })] })] }) : (0, import_jsx_runtime41.jsx)(Text, { color: Colors.chrome, children: "saving\u2026" })] });
79123
79274
  };
79124
79275
  }
79125
79276
  });
@@ -79145,11 +79296,11 @@ function buildHints(searchable) {
79145
79296
  parts.push("Esc close");
79146
79297
  return parts.join(" \xB7 ");
79147
79298
  }
79148
- var import_jsx_runtime41, import_react72, EMPTY_TABS, EMPTY_OPTIONS, ListPicker, SearchBar;
79299
+ var import_jsx_runtime42, import_react73, EMPTY_TABS, EMPTY_OPTIONS, ListPicker, SearchBar;
79149
79300
  var init_ListPicker = __esm({
79150
79301
  async "../plugin-cli/dist/components/ListPicker.js"() {
79151
- import_jsx_runtime41 = __toESM(require_jsx_runtime());
79152
- import_react72 = __toESM(require_react());
79302
+ import_jsx_runtime42 = __toESM(require_jsx_runtime());
79303
+ import_react73 = __toESM(require_react());
79153
79304
  await init_build2();
79154
79305
  init_theme();
79155
79306
  await init_Modal();
@@ -79159,7 +79310,7 @@ var init_ListPicker = __esm({
79159
79310
  ListPicker = ({ title, options, tabs, initialTabId, searchable, searchPlaceholder, onSelect, onCancel }) => {
79160
79311
  const tabItems = tabs ?? EMPTY_TABS;
79161
79312
  const hasTabs = tabItems.length > 0;
79162
- const defaultTabId = (0, import_react72.useMemo)(() => {
79313
+ const defaultTabId = (0, import_react73.useMemo)(() => {
79163
79314
  if (!hasTabs)
79164
79315
  return void 0;
79165
79316
  if (initialTabId && tabItems.some((tab2) => tab2.id === initialTabId))
@@ -79167,13 +79318,13 @@ var init_ListPicker = __esm({
79167
79318
  const tabWithCurrent = tabItems.find((tab2) => tab2.options.some((option) => option.current));
79168
79319
  return tabWithCurrent?.id ?? tabItems[0]?.id;
79169
79320
  }, [hasTabs, initialTabId, tabItems]);
79170
- const [activeTabId, setActiveTabId] = (0, import_react72.useState)(defaultTabId);
79171
- const [query, setQuery] = (0, import_react72.useState)("");
79172
- const [cursor3, setCursor] = (0, import_react72.useState)(0);
79173
- const [noSelectNotice, setNoSelectNotice] = (0, import_react72.useState)(false);
79174
- const activeTab = (0, import_react72.useMemo)(() => hasTabs ? tabItems.find((tab2) => tab2.id === activeTabId) ?? tabItems[0] ?? null : null, [hasTabs, tabItems, activeTabId]);
79321
+ const [activeTabId, setActiveTabId] = (0, import_react73.useState)(defaultTabId);
79322
+ const [query, setQuery] = (0, import_react73.useState)("");
79323
+ const [cursor3, setCursor] = (0, import_react73.useState)(0);
79324
+ const [noSelectNotice, setNoSelectNotice] = (0, import_react73.useState)(false);
79325
+ const activeTab = (0, import_react73.useMemo)(() => hasTabs ? tabItems.find((tab2) => tab2.id === activeTabId) ?? tabItems[0] ?? null : null, [hasTabs, tabItems, activeTabId]);
79175
79326
  const sourceOptions = activeTab?.options ?? options ?? EMPTY_OPTIONS;
79176
- const filtered = (0, import_react72.useMemo)(() => {
79327
+ const filtered = (0, import_react73.useMemo)(() => {
79177
79328
  if (!searchable || !query.trim())
79178
79329
  return sourceOptions;
79179
79330
  const q = query.trim().toLowerCase();
@@ -79187,19 +79338,19 @@ var init_ListPicker = __esm({
79187
79338
  return false;
79188
79339
  });
79189
79340
  }, [searchable, query, sourceOptions]);
79190
- (0, import_react72.useEffect)(() => {
79341
+ (0, import_react73.useEffect)(() => {
79191
79342
  setQuery("");
79192
79343
  setCursor(0);
79193
79344
  }, [activeTabId]);
79194
- (0, import_react72.useEffect)(() => {
79345
+ (0, import_react73.useEffect)(() => {
79195
79346
  if (cursor3 >= filtered.length)
79196
79347
  setCursor(Math.max(0, filtered.length - 1));
79197
79348
  }, [filtered.length, cursor3]);
79198
- (0, import_react72.useEffect)(() => {
79349
+ (0, import_react73.useEffect)(() => {
79199
79350
  if (noSelectNotice)
79200
79351
  setNoSelectNotice(false);
79201
79352
  }, [query, filtered.length]);
79202
- (0, import_react72.useEffect)(() => {
79353
+ (0, import_react73.useEffect)(() => {
79203
79354
  if (query)
79204
79355
  return;
79205
79356
  const idx = filtered.findIndex((o2) => o2.current);
@@ -79262,16 +79413,16 @@ var init_ListPicker = __esm({
79262
79413
  const subtitle = filtered.length === 0 ? query ? `no matches for "${query}"` : "no options" : `${cursor3 + 1} of ${filtered.length}` + (searchable && query ? ` \xB7 filtered from ${sourceOptions.length}` : "");
79263
79414
  const hints = buildHints(searchable);
79264
79415
  const modalTabs = hasTabs ? tabItems.map((tab2) => ({ id: tab2.id, label: tab2.label })) : void 0;
79265
- return (0, import_jsx_runtime41.jsxs)(Modal, { title, subtitle, hints, ...modalTabs ? { tabs: modalTabs, activeTabId, onTabChange: setActiveTabId } : {}, children: [searchable ? (0, import_jsx_runtime41.jsx)(SearchBar, { query, placeholder: searchPlaceholder ?? "type to filter" }) : null, (0, import_jsx_runtime41.jsxs)(Box_default, { flexDirection: "column", children: [filtered.length === 0 ? (0, import_jsx_runtime41.jsx)(Text, { ...noSelectNotice ? { color: Colors.busy } : { dimColor: true }, children: noSelectNotice ? "nothing to select \u2014 clear the filter or press Esc" : query ? `(no options match "${query}")` : "(no options)" }) : null, moreAbove > 0 ? (0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: ` \u2191 ${moreAbove} more` }) : null, filtered.slice(start, end).map((opt, idx) => {
79416
+ return (0, import_jsx_runtime42.jsxs)(Modal, { title, subtitle, hints, ...modalTabs ? { tabs: modalTabs, activeTabId, onTabChange: setActiveTabId } : {}, children: [searchable ? (0, import_jsx_runtime42.jsx)(SearchBar, { query, placeholder: searchPlaceholder ?? "type to filter" }) : null, (0, import_jsx_runtime42.jsxs)(Box_default, { flexDirection: "column", children: [filtered.length === 0 ? (0, import_jsx_runtime42.jsx)(Text, { ...noSelectNotice ? { color: Colors.busy } : { dimColor: true }, children: noSelectNotice ? "nothing to select \u2014 clear the filter or press Esc" : query ? `(no options match "${query}")` : "(no options)" }) : null, moreAbove > 0 ? (0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: ` \u2191 ${moreAbove} more` }) : null, filtered.slice(start, end).map((opt, idx) => {
79266
79417
  const i2 = start + idx;
79267
79418
  const fitted = fitPickerOption(opt, Math.max(24, termColumns - 8));
79268
79419
  const prevGroup = i2 > 0 ? filtered[i2 - 1]?.group : void 0;
79269
79420
  const showHeader = !hasTabs && opt.group != null && opt.group !== prevGroup;
79270
79421
  const focused = i2 === cursor3;
79271
- return (0, import_jsx_runtime41.jsxs)(import_react72.default.Fragment, { children: [showHeader ? (0, import_jsx_runtime41.jsx)(Box_default, { marginTop: idx === 0 ? 0 : 1, children: (0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: opt.group }) }) : null, (0, import_jsx_runtime41.jsxs)(Box_default, { children: [(0, import_jsx_runtime41.jsx)(Text, { ...focused ? {} : { dimColor: true }, children: focused ? "\u203A " : " " }), (0, import_jsx_runtime41.jsx)(Text, { ...focused ? { bold: true } : {}, children: fitted.label }), fitted.current ? (0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: fitted.current }) : null, opt.badge ? (0, import_jsx_runtime41.jsx)(Text, { color: opt.badgeColor === "red" ? Colors.danger : opt.badgeColor ?? Colors.danger, children: ` [${opt.badge}]` }) : null, fitted.description ? (0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: ` \u2014 ${fitted.description}` }) : null] })] }, opt.id);
79272
- }), moreBelow > 0 ? (0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: ` \u2193 ${moreBelow} more` }) : null] })] });
79422
+ return (0, import_jsx_runtime42.jsxs)(import_react73.default.Fragment, { children: [showHeader ? (0, import_jsx_runtime42.jsx)(Box_default, { marginTop: idx === 0 ? 0 : 1, children: (0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: opt.group }) }) : null, (0, import_jsx_runtime42.jsxs)(Box_default, { children: [(0, import_jsx_runtime42.jsx)(Text, { ...focused ? {} : { dimColor: true }, children: focused ? "\u203A " : " " }), (0, import_jsx_runtime42.jsx)(Text, { ...focused ? { bold: true } : {}, children: fitted.label }), fitted.current ? (0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: fitted.current }) : null, opt.badge ? (0, import_jsx_runtime42.jsx)(Text, { color: opt.badgeColor === "red" ? Colors.danger : opt.badgeColor ?? Colors.danger, children: ` [${opt.badge}]` }) : null, fitted.description ? (0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: ` \u2014 ${fitted.description}` }) : null] })] }, opt.id);
79423
+ }), moreBelow > 0 ? (0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: ` \u2193 ${moreBelow} more` }) : null] })] });
79273
79424
  };
79274
- SearchBar = ({ query, placeholder }) => (0, import_jsx_runtime41.jsxs)(Box_default, { marginBottom: 1, children: [(0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: "/ " }), query ? (0, import_jsx_runtime41.jsx)(Text, { children: query }) : (0, import_jsx_runtime41.jsx)(Text, { dimColor: true, children: placeholder }), (0, import_jsx_runtime41.jsx)(Text, { children: "\u258C" })] });
79425
+ SearchBar = ({ query, placeholder }) => (0, import_jsx_runtime42.jsxs)(Box_default, { marginBottom: 1, children: [(0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: "/ " }), query ? (0, import_jsx_runtime42.jsx)(Text, { children: query }) : (0, import_jsx_runtime42.jsx)(Text, { dimColor: true, children: placeholder }), (0, import_jsx_runtime42.jsx)(Text, { children: "\u258C" })] });
79275
79426
  }
79276
79427
  });
79277
79428
 
@@ -79280,10 +79431,10 @@ function oneLinePreview(s) {
79280
79431
  const flat = s.replace(/\s+/g, " ").trim();
79281
79432
  return flat.length <= PREVIEW_MAX ? flat : flat.slice(0, PREVIEW_MAX) + "\u2026";
79282
79433
  }
79283
- var import_jsx_runtime42, PREVIEW_MAX, QueueView;
79434
+ var import_jsx_runtime43, PREVIEW_MAX, QueueView;
79284
79435
  var init_QueueView = __esm({
79285
79436
  async "../plugin-cli/dist/components/QueueView.js"() {
79286
- import_jsx_runtime42 = __toESM(require_jsx_runtime());
79437
+ import_jsx_runtime43 = __toESM(require_jsx_runtime());
79287
79438
  __toESM(require_react());
79288
79439
  await init_build2();
79289
79440
  init_theme();
@@ -79304,7 +79455,7 @@ var init_QueueView = __esm({
79304
79455
  restCount = messages.length - 1;
79305
79456
  }
79306
79457
  const restPart = restCount > 0 ? ` \xB7 +${restCount} more` : "";
79307
- return (0, import_jsx_runtime42.jsx)(Box_default, { flexDirection: "column", borderStyle: "single", borderBottom: false, borderLeft: false, borderRight: false, borderColor: "blackBright", borderDimColor: true, children: (0, import_jsx_runtime42.jsxs)(Box_default, { children: [(0, import_jsx_runtime42.jsxs)(Text, { color: "blackBright", dimColor: true, children: [Glyphs.contextUp, " "] }), (0, import_jsx_runtime42.jsxs)(Text, { dimColor: true, children: [headLabel, ": ", oneLinePreview(headText), restPart, " \xB7 \u2303t send \xB7 \u2303b drop"] })] }) });
79458
+ return (0, import_jsx_runtime43.jsx)(Box_default, { flexDirection: "column", borderStyle: "single", borderBottom: false, borderLeft: false, borderRight: false, borderColor: "blackBright", borderDimColor: true, children: (0, import_jsx_runtime43.jsxs)(Box_default, { children: [(0, import_jsx_runtime43.jsxs)(Text, { color: "blackBright", dimColor: true, children: [Glyphs.contextUp, " "] }), (0, import_jsx_runtime43.jsxs)(Text, { dimColor: true, children: [headLabel, ": ", oneLinePreview(headText), restPart, " \xB7 \u2303t send \xB7 \u2303b drop"] })] }) });
79308
79459
  };
79309
79460
  }
79310
79461
  });
@@ -79315,14 +79466,15 @@ function buildPromptPlaceholder(busy2, voiceReady = true) {
79315
79466
  return "add a follow-up \u2014 it will run after the current response";
79316
79467
  return voiceReady ? "ask about this workspace\u2026 / commands \xB7 Ctrl+R voice" : "ask about this workspace\u2026 / commands";
79317
79468
  }
79318
- var import_jsx_runtime43, InteractiveZone;
79469
+ var import_jsx_runtime44, InteractiveZone;
79319
79470
  var init_InteractiveZone = __esm({
79320
79471
  async "../plugin-cli/dist/session/InteractiveZone.js"() {
79321
- import_jsx_runtime43 = __toESM(require_jsx_runtime());
79472
+ import_jsx_runtime44 = __toESM(require_jsx_runtime());
79322
79473
  __toESM(require_react());
79323
79474
  await init_build2();
79324
79475
  await init_PermissionDialog();
79325
79476
  await init_ApprovalDialog();
79477
+ await init_EnvShareDialog();
79326
79478
  await init_QuestionDialog();
79327
79479
  await init_ProviderConnectDialog();
79328
79480
  await init_PluginSetupDialog();
@@ -79331,32 +79483,41 @@ var init_InteractiveZone = __esm({
79331
79483
  await init_QueueView();
79332
79484
  InteractiveZone = ({ session, pendingPermission, pendingPermissionDepth, pendingApproval, question, picker, pluginSetup, onPluginSetupFinish, providerConnect, onProviderConnectSuccess, onProviderConnectCancel, busy: busy2, voiceReady, voicePhase, yolo, slashCommands, queueMessages, priorityMessage, commandHotkeys, onShiftTab, externalInsert, onPermissionDecide, onApprovalDecide, onPickerSelect, onPickerCancel, onSubmit, onPasteText }) => {
79333
79485
  if (pendingPermission) {
79334
- return (0, import_jsx_runtime43.jsx)(PermissionDialog, { call: pendingPermission.call, ctx: pendingPermission.ctx, workspace: session.cwd, queueDepth: pendingPermissionDepth, onDecide: (decision) => onPermissionDecide(pendingPermission, decision) });
79486
+ return (0, import_jsx_runtime44.jsx)(PermissionDialog, { call: pendingPermission.call, ctx: pendingPermission.ctx, workspace: session.cwd, queueDepth: pendingPermissionDepth, onDecide: (decision) => onPermissionDecide(pendingPermission, decision) });
79335
79487
  }
79336
79488
  if (pendingApproval) {
79337
- return (0, import_jsx_runtime43.jsx)(ApprovalDialog, { request: pendingApproval.request, onDecide: (decision) => onApprovalDecide(decision) });
79489
+ return (0, import_jsx_runtime44.jsx)(ApprovalDialog, { request: pendingApproval.request, onDecide: (decision) => onApprovalDecide(decision) });
79338
79490
  }
79339
79491
  if (question) {
79340
- return (0, import_jsx_runtime43.jsx)(QuestionDialog, { question: question.question, flow: question.flow, sending: question.sending, error: question.error, onKey: question.press });
79492
+ const item = question.question.questions[0];
79493
+ if (item?.vaultName) {
79494
+ const { questionId } = question.question;
79495
+ return (0, import_jsx_runtime44.jsx)(EnvShareDialog, { item, submit: async (value2) => {
79496
+ if (!session.questions?.shareEnv)
79497
+ throw new Error("Env Share unavailable.");
79498
+ await session.questions.shareEnv(questionId, value2);
79499
+ } }, questionId);
79500
+ }
79501
+ return (0, import_jsx_runtime44.jsx)(QuestionDialog, { question: question.question, flow: question.flow, sending: question.sending, error: question.error, onKey: question.press });
79341
79502
  }
79342
79503
  if (pluginSetup) {
79343
- return (0, import_jsx_runtime43.jsx)(PluginSetupDialog, { packageName: pluginSetup.packageName, spec: pluginSetup.spec, onFinish: onPluginSetupFinish }, pluginSetup.packageName);
79504
+ return (0, import_jsx_runtime44.jsx)(PluginSetupDialog, { packageName: pluginSetup.packageName, spec: pluginSetup.spec, onFinish: onPluginSetupFinish }, pluginSetup.packageName);
79344
79505
  }
79345
79506
  if (providerConnect && session.providerSetup) {
79346
- return (0, import_jsx_runtime43.jsx)(ProviderConnectDialog, { providerId: providerConnect.providerId, setup: session.providerSetup, onSuccess: onProviderConnectSuccess, onCancel: onProviderConnectCancel }, providerConnect.providerId);
79507
+ return (0, import_jsx_runtime44.jsx)(ProviderConnectDialog, { providerId: providerConnect.providerId, setup: session.providerSetup, onSuccess: onProviderConnectSuccess, onCancel: onProviderConnectCancel }, providerConnect.providerId);
79347
79508
  }
79348
79509
  if (picker) {
79349
- return picker.kind === "model" || picker.kind === "plugins" ? (0, import_jsx_runtime43.jsx)(ListPicker, { title: picker.title, tabs: picker.tabs, ...picker.initialTabId ? { initialTabId: picker.initialTabId } : {}, searchable: picker.searchable ?? true, ...picker.searchPlaceholder ? { searchPlaceholder: picker.searchPlaceholder } : {}, onSelect: (id) => onPickerSelect(picker, id), onCancel: onPickerCancel }) : (0, import_jsx_runtime43.jsx)(ListPicker, { title: picker.title, options: picker.options, ...picker.kind === "sessions" && picker.searchable ? { searchable: true } : {}, ...picker.kind === "sessions" && picker.searchPlaceholder ? { searchPlaceholder: picker.searchPlaceholder } : {}, onSelect: (id) => onPickerSelect(picker, id), onCancel: onPickerCancel });
79510
+ return picker.kind === "model" || picker.kind === "plugins" ? (0, import_jsx_runtime44.jsx)(ListPicker, { title: picker.title, tabs: picker.tabs, ...picker.initialTabId ? { initialTabId: picker.initialTabId } : {}, searchable: picker.searchable ?? true, ...picker.searchPlaceholder ? { searchPlaceholder: picker.searchPlaceholder } : {}, onSelect: (id) => onPickerSelect(picker, id), onCancel: onPickerCancel }) : (0, import_jsx_runtime44.jsx)(ListPicker, { title: picker.title, options: picker.options, ...picker.kind === "sessions" && picker.searchable ? { searchable: true } : {}, ...picker.kind === "sessions" && picker.searchPlaceholder ? { searchPlaceholder: picker.searchPlaceholder } : {}, onSelect: (id) => onPickerSelect(picker, id), onCancel: onPickerCancel });
79350
79511
  }
79351
- return (0, import_jsx_runtime43.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [(0, import_jsx_runtime43.jsx)(QueueView, { messages: queueMessages, priority: priorityMessage }), (0, import_jsx_runtime43.jsx)(InputBox, { onSubmit, disabled: false, yolo, voicePhase, slashCommands, placeholder: buildPromptPlaceholder(busy2, voiceReady), onPasteText, commandHotkeys, onShiftTab, externalInsert })] });
79512
+ return (0, import_jsx_runtime44.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [(0, import_jsx_runtime44.jsx)(QueueView, { messages: queueMessages, priority: priorityMessage }), (0, import_jsx_runtime44.jsx)(InputBox, { onSubmit, disabled: false, yolo, voicePhase, slashCommands, placeholder: buildPromptPlaceholder(busy2, voiceReady), onPasteText, commandHotkeys, onShiftTab, externalInsert })] });
79352
79513
  };
79353
79514
  }
79354
79515
  });
79355
- var import_jsx_runtime44, import_react75, SessionView;
79516
+ var import_jsx_runtime45, import_react76, SessionView;
79356
79517
  var init_SessionView = __esm({
79357
79518
  async "../plugin-cli/dist/session/SessionView.js"() {
79358
- import_jsx_runtime44 = __toESM(require_jsx_runtime());
79359
- import_react75 = __toESM(require_react());
79519
+ import_jsx_runtime45 = __toESM(require_jsx_runtime());
79520
+ import_react76 = __toESM(require_react());
79360
79521
  await init_build2();
79361
79522
  await init_build2();
79362
79523
  init_dist2();
@@ -79385,18 +79546,18 @@ var init_SessionView = __esm({
79385
79546
  SessionView = ({ session, registerInteractiveResolver, getVault, getChannels, model, version, updateAvailable, initialPrompt, initialNotice, canSwitchSession, onSwitchSession }) => {
79386
79547
  const { exit } = use_app_default();
79387
79548
  const stream2 = useEventStream(session);
79388
- const [systemNotice, setSystemNotice] = (0, import_react75.useState)(initialNotice ?? null);
79389
- const [overlay, setOverlay] = (0, import_react75.useState)(null);
79390
- const [expandToolOutputs, setExpandToolOutputs] = (0, import_react75.useState)(false);
79391
- const [yolo, setYolo] = (0, import_react75.useState)(false);
79549
+ const [systemNotice, setSystemNotice] = (0, import_react76.useState)(initialNotice ?? null);
79550
+ const [overlay, setOverlay] = (0, import_react76.useState)(null);
79551
+ const [expandToolOutputs, setExpandToolOutputs] = (0, import_react76.useState)(false);
79552
+ const [yolo, setYolo] = (0, import_react76.useState)(false);
79392
79553
  const { refreshMcpStatus } = useMcpStatus(session);
79393
- const [activeModelOverride, setActiveModelOverride] = (0, import_react75.useState)(null);
79394
- const [picker, setPicker] = (0, import_react75.useState)(null);
79554
+ const [activeModelOverride, setActiveModelOverride] = (0, import_react76.useState)(null);
79555
+ const [picker, setPicker] = (0, import_react76.useState)(null);
79395
79556
  const permissions = usePermissionQueue(session, registerInteractiveResolver);
79396
79557
  const images = useImageAttachments((msg) => setSystemNotice(msg));
79397
79558
  const voice = useVoiceInput({ session, setSystemNotice });
79398
79559
  const readAloud = useReadAloud({ session, setSystemNotice });
79399
- (0, import_react75.useEffect)(() => {
79560
+ (0, import_react76.useEffect)(() => {
79400
79561
  permissions.yoloRef.current = yolo;
79401
79562
  }, [yolo, permissions.yoloRef]);
79402
79563
  const turn = useTurnRunner({
@@ -79452,7 +79613,7 @@ var init_SessionView = __esm({
79452
79613
  },
79453
79614
  r: voice.toggleVoiceInput
79454
79615
  };
79455
- const compactTools = (0, import_react75.useMemo)(() => {
79616
+ const compactTools = (0, import_react76.useMemo)(() => {
79456
79617
  const m3 = /* @__PURE__ */ new Map();
79457
79618
  for (const tool of session.tools.list()) {
79458
79619
  if (tool.compact)
@@ -79472,15 +79633,15 @@ var init_SessionView = __esm({
79472
79633
  const nowMs = Date.now();
79473
79634
  const accountLimit = conversationAccountLimit(stream2.events, sessionInfo.activeProvider, nowMs);
79474
79635
  const agentCliNotice2 = useAgentCliNotice(session);
79475
- const slashSuggestions = import_react75.default.useMemo(() => buildSlashSuggestions(session, {
79636
+ const slashSuggestions = import_react76.default.useMemo(() => buildSlashSuggestions(session, {
79476
79637
  canSwitchRuns: canSwitchSession ?? false,
79477
79638
  canManageExtensions: Boolean(session.pluginsAdmin)
79478
79639
  }), [session, canSwitchSession]);
79479
- const installInFlightRef = import_react75.default.useRef(false);
79480
- const [providerConnect, setProviderConnect] = import_react75.default.useState(null);
79481
- const [pluginSetup, setPluginSetup] = import_react75.default.useState(null);
79482
- const rerunSlashRef = import_react75.default.useRef(() => void 0);
79483
- const handlePickerSelect = import_react75.default.useMemo(() => makePickerHandler({
79640
+ const installInFlightRef = import_react76.default.useRef(false);
79641
+ const [providerConnect, setProviderConnect] = import_react76.default.useState(null);
79642
+ const [pluginSetup, setPluginSetup] = import_react76.default.useState(null);
79643
+ const rerunSlashRef = import_react76.default.useRef(() => void 0);
79644
+ const handlePickerSelect = import_react76.default.useMemo(() => makePickerHandler({
79484
79645
  session,
79485
79646
  providerName,
79486
79647
  setPicker,
@@ -79597,8 +79758,8 @@ var init_SessionView = __esm({
79597
79758
  rerunSlashRef.current = (line) => {
79598
79759
  void handleSubmit(line);
79599
79760
  };
79600
- const firedInitial = (0, import_react75.useRef)(false);
79601
- (0, import_react75.useEffect)(() => {
79761
+ const firedInitial = (0, import_react76.useRef)(false);
79762
+ (0, import_react76.useEffect)(() => {
79602
79763
  if (firedInitial.current)
79603
79764
  return;
79604
79765
  if (!initialPrompt)
@@ -79606,14 +79767,14 @@ var init_SessionView = __esm({
79606
79767
  firedInitial.current = true;
79607
79768
  void handleSubmit(initialPrompt);
79608
79769
  }, [initialPrompt]);
79609
- const firedUpdateNotice = (0, import_react75.useRef)(false);
79610
- (0, import_react75.useEffect)(() => {
79770
+ const firedUpdateNotice = (0, import_react76.useRef)(false);
79771
+ (0, import_react76.useEffect)(() => {
79611
79772
  if (firedUpdateNotice.current || !updateAvailable || initialPrompt)
79612
79773
  return;
79613
79774
  firedUpdateNotice.current = true;
79614
79775
  setSystemNotice(`\u2728 moxxy ${updateAvailable.latest} available \u2014 run \`moxxy update\``);
79615
79776
  }, [updateAvailable, initialPrompt]);
79616
- return (0, import_jsx_runtime44.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime44.jsx)(ChatView, { events: stream2.events, expandToolOutputs, compactTools, hideLive: overlay != null || picker != null || pendingPermission != null || pendingApproval != null || question != null }), (0, import_jsx_runtime44.jsx)(OverlayOrNotice, { overlay, systemNotice, session, events: stream2.events, contextWindow, contextTokens: contextUsed, ...getVault ? { getVault } : {}, ...getChannels ? { getChannels } : {}, onClose: () => setOverlay(null) }), agentCliNotice2 ? (0, import_jsx_runtime44.jsx)(AgentCliLine, { notice: agentCliNotice2 }) : null, accountLimit ? (0, import_jsx_runtime44.jsx)(AccountLimitLine, { limit: accountLimit, nowMs }) : null, agentComputer ? (0, import_jsx_runtime44.jsx)(AgentComputerLine, { use: agentComputer, agentName }) : null, (0, import_jsx_runtime44.jsx)(InteractiveZone, { session, pendingPermission, pendingPermissionDepth: Math.max(0, permissions.pendingPermissions.length - 1), pendingApproval, question, picker, pluginSetup, onPluginSetupFinish: (values) => {
79777
+ return (0, import_jsx_runtime45.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime45.jsx)(ChatView, { events: stream2.events, expandToolOutputs, compactTools, hideLive: overlay != null || picker != null || pendingPermission != null || pendingApproval != null || question != null }), (0, import_jsx_runtime45.jsx)(OverlayOrNotice, { overlay, systemNotice, session, events: stream2.events, contextWindow, contextTokens: contextUsed, ...getVault ? { getVault } : {}, ...getChannels ? { getChannels } : {}, onClose: () => setOverlay(null) }), agentCliNotice2 ? (0, import_jsx_runtime45.jsx)(AgentCliLine, { notice: agentCliNotice2 }) : null, accountLimit ? (0, import_jsx_runtime45.jsx)(AccountLimitLine, { limit: accountLimit, nowMs }) : null, agentComputer ? (0, import_jsx_runtime45.jsx)(AgentComputerLine, { use: agentComputer, agentName }) : null, (0, import_jsx_runtime45.jsx)(InteractiveZone, { session, pendingPermission, pendingPermissionDepth: Math.max(0, permissions.pendingPermissions.length - 1), pendingApproval, question, picker, pluginSetup, onPluginSetupFinish: (values) => {
79617
79778
  const target = pluginSetup;
79618
79779
  setPluginSetup(null);
79619
79780
  if (!target)
@@ -79666,7 +79827,7 @@ var init_SessionView = __esm({
79666
79827
  return;
79667
79828
  }
79668
79829
  setPicker(null);
79669
- }, onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime44.jsx)(StatusLine, { modeBadge, modeName, modelName: activeModel2, contextUsed, contextWindow, governance: sessionInfo.governance ?? null })] });
79830
+ }, onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime45.jsx)(StatusLine, { modeBadge, modeName, modelName: activeModel2, contextUsed, contextWindow, governance: sessionInfo.governance ?? null })] });
79670
79831
  };
79671
79832
  }
79672
79833
  });
@@ -79675,11 +79836,11 @@ var init_SessionView = __esm({
79675
79836
  function buildBootPlaceholder(voiceReady) {
79676
79837
  return voiceReady ? "ask about this workspace\u2026 / commands \xB7 Ctrl+R voice" : "ask about this workspace\u2026 / commands";
79677
79838
  }
79678
- var import_jsx_runtime45, import_react76, InteractiveSession, BootInputArea, DisabledBootInput;
79839
+ var import_jsx_runtime46, import_react77, InteractiveSession, BootInputArea, DisabledBootInput;
79679
79840
  var init_BootShell = __esm({
79680
79841
  async "../plugin-cli/dist/session/BootShell.js"() {
79681
- import_jsx_runtime45 = __toESM(require_jsx_runtime());
79682
- import_react76 = __toESM(require_react());
79842
+ import_jsx_runtime46 = __toESM(require_jsx_runtime());
79843
+ import_react77 = __toESM(require_react());
79683
79844
  await init_build2();
79684
79845
  await init_BootScreen();
79685
79846
  await init_InputBox();
@@ -79689,15 +79850,15 @@ var init_BootShell = __esm({
79689
79850
  init_use_voice_input();
79690
79851
  await init_helpers();
79691
79852
  InteractiveSession = ({ session: eagerSession, bootstrap, registerInteractiveResolver, getVault, getChannels, model, version, updateAvailable, firstRun = false, resumed, switchSession }) => {
79692
- const [session, setSession] = (0, import_react76.useState)(eagerSession ?? null);
79693
- const [bootEvents, setBootEvents] = (0, import_react76.useState)([]);
79694
- const [bootError, setBootError] = (0, import_react76.useState)(null);
79695
- const [initialPrompt, setInitialPrompt] = (0, import_react76.useState)(null);
79696
- const [landedViaSwitch, setLandedViaSwitch] = (0, import_react76.useState)(false);
79697
- const switchingRef = (0, import_react76.useRef)(false);
79698
- const [switchNotice, setSwitchNotice] = (0, import_react76.useState)(null);
79699
- const startedAt = import_react76.default.useMemo(() => Date.now(), []);
79700
- const handleSwitchSession = (0, import_react76.useCallback)(async (target) => {
79853
+ const [session, setSession] = (0, import_react77.useState)(eagerSession ?? null);
79854
+ const [bootEvents, setBootEvents] = (0, import_react77.useState)([]);
79855
+ const [bootError, setBootError] = (0, import_react77.useState)(null);
79856
+ const [initialPrompt, setInitialPrompt] = (0, import_react77.useState)(null);
79857
+ const [landedViaSwitch, setLandedViaSwitch] = (0, import_react77.useState)(false);
79858
+ const switchingRef = (0, import_react77.useRef)(false);
79859
+ const [switchNotice, setSwitchNotice] = (0, import_react77.useState)(null);
79860
+ const startedAt = import_react77.default.useMemo(() => Date.now(), []);
79861
+ const handleSwitchSession = (0, import_react77.useCallback)(async (target) => {
79701
79862
  if (!switchSession)
79702
79863
  throw new Error("switching runs is not available");
79703
79864
  if (switchingRef.current)
@@ -79714,7 +79875,7 @@ var init_BootShell = __esm({
79714
79875
  switchingRef.current = false;
79715
79876
  }
79716
79877
  }, [switchSession]);
79717
- (0, import_react76.useEffect)(() => {
79878
+ (0, import_react77.useEffect)(() => {
79718
79879
  if (eagerSession || !bootstrap)
79719
79880
  return;
79720
79881
  let cancelled = false;
@@ -79759,23 +79920,23 @@ var init_BootShell = __esm({
79759
79920
  }, [eagerSession, bootstrap]);
79760
79921
  const showWelcome = firstRun && initialPrompt == null && !resumed && !landedViaSwitch;
79761
79922
  if (!session || showWelcome) {
79762
- return (0, import_jsx_runtime45.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime45.jsx)(BootScreen, { events: bootEvents, startedAt, ...session ? { workspace: session.cwd } : {}, ...bootError ? { error: bootError } : {}, welcome: firstRun }), session ? (0, import_jsx_runtime45.jsx)(BootInputArea, { session, ready: bootError == null, bootError, onSubmit: (text3) => setInitialPrompt(text3) }) : (0, import_jsx_runtime45.jsx)(DisabledBootInput, { placeholder: bootError ? "Start failed \u2014 run `moxxy doctor --check-keys`" : "Initializing\u2026" })] });
79923
+ return (0, import_jsx_runtime46.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime46.jsx)(BootScreen, { events: bootEvents, startedAt, ...session ? { workspace: session.cwd } : {}, ...bootError ? { error: bootError } : {}, welcome: firstRun }), session ? (0, import_jsx_runtime46.jsx)(BootInputArea, { session, ready: bootError == null, bootError, onSubmit: (text3) => setInitialPrompt(text3) }) : (0, import_jsx_runtime46.jsx)(DisabledBootInput, { placeholder: bootError ? "Start failed \u2014 run `moxxy doctor --check-keys`" : "Initializing\u2026" })] });
79763
79924
  }
79764
- return (0, import_jsx_runtime45.jsx)(SessionView, { session, registerInteractiveResolver, ...getVault ? { getVault } : {}, ...getChannels ? { getChannels } : {}, ...initialPrompt ? { initialPrompt } : {}, ...switchNotice ? { initialNotice: switchNotice } : {}, ...model ? { model } : {}, ...version ? { version } : {}, ...updateAvailable ? { updateAvailable } : {}, canSwitchSession: Boolean(switchSession), onSwitchSession: handleSwitchSession }, session.id);
79925
+ return (0, import_jsx_runtime46.jsx)(SessionView, { session, registerInteractiveResolver, ...getVault ? { getVault } : {}, ...getChannels ? { getChannels } : {}, ...initialPrompt ? { initialPrompt } : {}, ...switchNotice ? { initialNotice: switchNotice } : {}, ...model ? { model } : {}, ...version ? { version } : {}, ...updateAvailable ? { updateAvailable } : {}, canSwitchSession: Boolean(switchSession), onSwitchSession: handleSwitchSession }, session.id);
79765
79926
  };
79766
79927
  BootInputArea = ({ session, ready, bootError, onSubmit }) => {
79767
- const [systemNotice, setSystemNotice] = (0, import_react76.useState)(null);
79928
+ const [systemNotice, setSystemNotice] = (0, import_react77.useState)(null);
79768
79929
  const voice = useVoiceInput({ session, setSystemNotice });
79769
79930
  const commandHotkeys = ready ? { r: voice.toggleVoiceInput } : {};
79770
- return (0, import_jsx_runtime45.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime45.jsx)(Box_default, { marginTop: 1, children: (0, import_jsx_runtime45.jsx)(InputBox, { disabled: !ready, voicePhase: voice.phase, externalInsert: voice.externalInsert, commandHotkeys, placeholder: ready ? buildBootPlaceholder(voice.ready) : bootError ? "Start failed \u2014 run `moxxy doctor --check-keys`" : "Initializing\u2026", onSubmit: (text3) => {
79931
+ return (0, import_jsx_runtime46.jsxs)(Box_default, { flexDirection: "column", children: [(0, import_jsx_runtime46.jsx)(Box_default, { marginTop: 1, children: (0, import_jsx_runtime46.jsx)(InputBox, { disabled: !ready, voicePhase: voice.phase, externalInsert: voice.externalInsert, commandHotkeys, placeholder: ready ? buildBootPlaceholder(voice.ready) : bootError ? "Start failed \u2014 run `moxxy doctor --check-keys`" : "Initializing\u2026", onSubmit: (text3) => {
79771
79932
  if (!ready)
79772
79933
  return;
79773
79934
  const trimmed = text3.trim();
79774
79935
  if (trimmed)
79775
79936
  onSubmit(trimmed);
79776
- } }) }), systemNotice ? (0, import_jsx_runtime45.jsx)(SystemNotice, { notice: systemNotice }) : null, (0, import_jsx_runtime45.jsx)(Box_default, { children: (0, import_jsx_runtime45.jsx)(FooterHints, { mode: "boot", voiceReady: voice.ready }) })] });
79937
+ } }) }), systemNotice ? (0, import_jsx_runtime46.jsx)(SystemNotice, { notice: systemNotice }) : null, (0, import_jsx_runtime46.jsx)(Box_default, { children: (0, import_jsx_runtime46.jsx)(FooterHints, { mode: "boot", voiceReady: voice.ready }) })] });
79777
79938
  };
79778
- DisabledBootInput = ({ placeholder }) => (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [(0, import_jsx_runtime45.jsx)(Box_default, { marginTop: 1, children: (0, import_jsx_runtime45.jsx)(InputBox, { disabled: true, placeholder, onSubmit: () => void 0 }) }), (0, import_jsx_runtime45.jsx)(Box_default, { children: (0, import_jsx_runtime45.jsx)(FooterHints, { mode: "boot" }) })] });
79939
+ DisabledBootInput = ({ placeholder }) => (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [(0, import_jsx_runtime46.jsx)(Box_default, { marginTop: 1, children: (0, import_jsx_runtime46.jsx)(InputBox, { disabled: true, placeholder, onSubmit: () => void 0 }) }), (0, import_jsx_runtime46.jsx)(Box_default, { children: (0, import_jsx_runtime46.jsx)(FooterHints, { mode: "boot" }) })] });
79779
79940
  }
79780
79941
  });
79781
79942
 
@@ -79787,10 +79948,10 @@ var init_InteractiveSession = __esm({
79787
79948
  });
79788
79949
 
79789
79950
  // ../plugin-cli/dist/TuiChannel.js
79790
- var import_react77, TuiChannel;
79951
+ var import_react78, TuiChannel;
79791
79952
  var init_TuiChannel = __esm({
79792
79953
  async "../plugin-cli/dist/TuiChannel.js"() {
79793
- import_react77 = __toESM(require_react());
79954
+ import_react78 = __toESM(require_react());
79794
79955
  await init_build2();
79795
79956
  init_resolver();
79796
79957
  await init_InteractiveSession();
@@ -79817,7 +79978,7 @@ var init_TuiChannel = __esm({
79817
79978
  const registerInteractiveResolver = (handler) => {
79818
79979
  this.promptHandler = handler;
79819
79980
  };
79820
- this.inkInstance = render_default(import_react77.default.createElement(InteractiveSession, {
79981
+ this.inkInstance = render_default(import_react78.default.createElement(InteractiveSession, {
79821
79982
  ...opts.session ? { session: opts.session } : {},
79822
79983
  ...opts.bootstrap ? { bootstrap: opts.bootstrap } : {},
79823
79984
  registerInteractiveResolver,
@@ -79866,22 +80027,22 @@ function toRows(engine) {
79866
80027
  out.push({ kind: "allow", name: r2.name, reason: r2.reason });
79867
80028
  return out;
79868
80029
  }
79869
- var import_jsx_runtime46, import_react78, PermissionEditor;
80030
+ var import_jsx_runtime47, import_react79, PermissionEditor;
79870
80031
  var init_PermissionEditor = __esm({
79871
80032
  async "../plugin-cli/dist/components/PermissionEditor.js"() {
79872
- import_jsx_runtime46 = __toESM(require_jsx_runtime());
79873
- import_react78 = __toESM(require_react());
80033
+ import_jsx_runtime47 = __toESM(require_jsx_runtime());
80034
+ import_react79 = __toESM(require_react());
79874
80035
  await init_build2();
79875
80036
  init_dist3();
79876
80037
  PermissionEditor = ({ policyPath }) => {
79877
80038
  const { exit } = use_app_default();
79878
- const [engine, setEngine] = (0, import_react78.useState)(null);
79879
- const [rows, setRows] = (0, import_react78.useState)([]);
79880
- const [cursor3, setCursor] = (0, import_react78.useState)(0);
79881
- const [dirty, setDirty] = (0, import_react78.useState)(false);
79882
- const [mode, setMode] = (0, import_react78.useState)({ kind: "list" });
79883
- const [status, setStatus] = (0, import_react78.useState)("");
79884
- (0, import_react78.useEffect)(() => {
80039
+ const [engine, setEngine] = (0, import_react79.useState)(null);
80040
+ const [rows, setRows] = (0, import_react79.useState)([]);
80041
+ const [cursor3, setCursor] = (0, import_react79.useState)(0);
80042
+ const [dirty, setDirty] = (0, import_react79.useState)(false);
80043
+ const [mode, setMode] = (0, import_react79.useState)({ kind: "list" });
80044
+ const [status, setStatus] = (0, import_react79.useState)("");
80045
+ (0, import_react79.useEffect)(() => {
79885
80046
  let cancelled = false;
79886
80047
  (async () => {
79887
80048
  const e = await PermissionEngine.load(policyPath);
@@ -80008,10 +80169,10 @@ var init_PermissionEditor = __esm({
80008
80169
  exit();
80009
80170
  }
80010
80171
  });
80011
- return (0, import_jsx_runtime46.jsxs)(Box_default, { flexDirection: "column", padding: 1, children: [(0, import_jsx_runtime46.jsxs)(Box_default, { marginBottom: 1, children: [(0, import_jsx_runtime46.jsx)(Text, { bold: true, color: "magenta", children: "moxxy perms editor" }), (0, import_jsx_runtime46.jsxs)(Text, { dimColor: true, children: [" (", policyPath, ")"] })] }), rows.length === 0 ? (0, import_jsx_runtime46.jsx)(Text, { dimColor: true, children: "(no rules \u2014 press `a` to add an allow rule, `D` for deny)" }) : rows.map((row, i2) => {
80172
+ return (0, import_jsx_runtime47.jsxs)(Box_default, { flexDirection: "column", padding: 1, children: [(0, import_jsx_runtime47.jsxs)(Box_default, { marginBottom: 1, children: [(0, import_jsx_runtime47.jsx)(Text, { bold: true, color: "magenta", children: "moxxy perms editor" }), (0, import_jsx_runtime47.jsxs)(Text, { dimColor: true, children: [" (", policyPath, ")"] })] }), rows.length === 0 ? (0, import_jsx_runtime47.jsx)(Text, { dimColor: true, children: "(no rules \u2014 press `a` to add an allow rule, `D` for deny)" }) : rows.map((row, i2) => {
80012
80173
  const focused = i2 === cursor3;
80013
- return (0, import_jsx_runtime46.jsxs)(Box_default, { children: [(0, import_jsx_runtime46.jsx)(Text, { color: focused ? "cyan" : void 0, children: focused ? "\u203A " : " " }), (0, import_jsx_runtime46.jsx)(Text, { color: row.kind === "allow" ? "green" : "red", children: row.kind.padEnd(5) }), (0, import_jsx_runtime46.jsxs)(Text, { children: [" ", row.name] }), row.reason ? (0, import_jsx_runtime46.jsxs)(Text, { dimColor: true, children: [" \u2014 ", row.reason] }) : null] }, `${row.kind}:${row.name}:${i2}`);
80014
- }), (0, import_jsx_runtime46.jsx)(Box_default, { marginTop: 1, children: mode.kind === "add" ? (0, import_jsx_runtime46.jsxs)(Text, { children: ["new ", mode.bucket, " rule: ", (0, import_jsx_runtime46.jsx)(Text, { color: "cyan", children: mode.buffer }), (0, import_jsx_runtime46.jsx)(Text, { dimColor: true, children: " (enter to confirm, esc to cancel)" })] }) : mode.kind === "confirm-delete" ? (0, import_jsx_runtime46.jsxs)(Text, { color: "yellow", children: ["delete `", mode.row.name, "` (", mode.row.kind, ")? [y/N]"] }) : mode.kind === "message" ? (0, import_jsx_runtime46.jsxs)(Text, { color: /FAILED/i.test(mode.text) ? "red" : "green", children: [mode.text, " (press any key)"] }) : (0, import_jsx_runtime46.jsxs)(Text, { dimColor: true, children: ["\u2191/\u2193 move \xB7 space/enter flip \xB7 a add allow \xB7 D add deny \xB7 d delete \xB7 q quit", dirty || /FAILED/i.test(status) ? (0, import_jsx_runtime46.jsx)(Text, { color: /FAILED/i.test(status) ? "red" : "green", children: ` \xB7 ${status}` }) : null] }) })] });
80174
+ return (0, import_jsx_runtime47.jsxs)(Box_default, { children: [(0, import_jsx_runtime47.jsx)(Text, { color: focused ? "cyan" : void 0, children: focused ? "\u203A " : " " }), (0, import_jsx_runtime47.jsx)(Text, { color: row.kind === "allow" ? "green" : "red", children: row.kind.padEnd(5) }), (0, import_jsx_runtime47.jsxs)(Text, { children: [" ", row.name] }), row.reason ? (0, import_jsx_runtime47.jsxs)(Text, { dimColor: true, children: [" \u2014 ", row.reason] }) : null] }, `${row.kind}:${row.name}:${i2}`);
80175
+ }), (0, import_jsx_runtime47.jsx)(Box_default, { marginTop: 1, children: mode.kind === "add" ? (0, import_jsx_runtime47.jsxs)(Text, { children: ["new ", mode.bucket, " rule: ", (0, import_jsx_runtime47.jsx)(Text, { color: "cyan", children: mode.buffer }), (0, import_jsx_runtime47.jsx)(Text, { dimColor: true, children: " (enter to confirm, esc to cancel)" })] }) : mode.kind === "confirm-delete" ? (0, import_jsx_runtime47.jsxs)(Text, { color: "yellow", children: ["delete `", mode.row.name, "` (", mode.row.kind, ")? [y/N]"] }) : mode.kind === "message" ? (0, import_jsx_runtime47.jsxs)(Text, { color: /FAILED/i.test(mode.text) ? "red" : "green", children: [mode.text, " (press any key)"] }) : (0, import_jsx_runtime47.jsxs)(Text, { dimColor: true, children: ["\u2191/\u2193 move \xB7 space/enter flip \xB7 a add allow \xB7 D add deny \xB7 d delete \xB7 q quit", dirty || /FAILED/i.test(status) ? (0, import_jsx_runtime47.jsx)(Text, { color: /FAILED/i.test(status) ? "red" : "green", children: ` \xB7 ${status}` }) : null] }) })] });
80015
80176
  };
80016
80177
  }
80017
80178
  });
@@ -89660,10 +89821,10 @@ function surfaceInputWithinCap(m3) {
89660
89821
  return true;
89661
89822
  return JSON.stringify(m3).length <= MAX_SURFACE_INPUT_BYTES;
89662
89823
  }
89663
- var RUNNER_PROTOCOL_VERSION, MIN_COMPATIBLE_PROTOCOL_VERSION, RunnerMethod, RunnerNotification, attachmentSchema, principalSchema, attachParamsSchema, runTurnParamsSchema, abortParamsSchema, setResolverParamsSchema, questionAnswerParamsSchema, modeSetActiveParamsSchema, sessionSetReasoningParamsSchema, sessionSetFastParamsSchema, MAX_HISTORY_PAGE_LIMIT, sessionLoadHistoryParamsSchema, sessionReadAttachmentParamsSchema, MAX_RECORDED_EXCHANGE_CHARS, recordedText, sessionRecordExchangeParamsSchema, sessionSetAutoApproveParamsSchema, sessionStopBackgroundWorkParamsSchema, providerSetActiveParamsSchema, providerCloseAgentSessionsParamsSchema, providerSetEnabledParamsSchema, providerConfigureParamsSchema, permissionAddAllowParamsSchema, commandRunParamsSchema, MAX_TRANSCRIBE_AUDIO_B64_BYTES, MAX_SYNTHESIZE_TEXT_BYTES, MEDIA_DESCRIPTOR_MAX, transcribeParamsSchema, synthesizeParamsSchema, cancelSynthesizeParamsSchema, mcpEnableAndAttachParamsSchema, mcpDetachParamsSchema, workflowSetEnabledParamsSchema, workflowRunParamsSchema, workflowValidateDraftParamsSchema, workflowSaveParamsSchema, workflowGetRunParamsSchema, workflowResumeParamsSchema, surfaceOpenParamsSchema, MAX_SURFACE_INPUT_BYTES, surfaceInputParamsSchema, surfaceResizeParamsSchema, surfaceCloseParamsSchema;
89824
+ var RUNNER_PROTOCOL_VERSION, MIN_COMPATIBLE_PROTOCOL_VERSION, RunnerMethod, RunnerNotification, attachmentSchema, principalSchema, attachParamsSchema, runTurnParamsSchema, abortParamsSchema, setResolverParamsSchema, shareEnvParamsSchema, questionAnswerParamsSchema, modeSetActiveParamsSchema, sessionSetReasoningParamsSchema, sessionSetFastParamsSchema, MAX_HISTORY_PAGE_LIMIT, sessionLoadHistoryParamsSchema, sessionReadAttachmentParamsSchema, MAX_RECORDED_EXCHANGE_CHARS, recordedText, sessionRecordExchangeParamsSchema, sessionSetAutoApproveParamsSchema, sessionStopBackgroundWorkParamsSchema, providerSetActiveParamsSchema, providerCloseAgentSessionsParamsSchema, providerSetEnabledParamsSchema, providerConfigureParamsSchema, permissionAddAllowParamsSchema, commandRunParamsSchema, MAX_TRANSCRIBE_AUDIO_B64_BYTES, MAX_SYNTHESIZE_TEXT_BYTES, MEDIA_DESCRIPTOR_MAX, transcribeParamsSchema, synthesizeParamsSchema, cancelSynthesizeParamsSchema, mcpEnableAndAttachParamsSchema, mcpDetachParamsSchema, workflowSetEnabledParamsSchema, workflowRunParamsSchema, workflowValidateDraftParamsSchema, workflowSaveParamsSchema, workflowGetRunParamsSchema, workflowResumeParamsSchema, surfaceOpenParamsSchema, MAX_SURFACE_INPUT_BYTES, surfaceInputParamsSchema, surfaceResizeParamsSchema, surfaceCloseParamsSchema;
89664
89825
  var init_protocol2 = __esm({
89665
89826
  "../runner/dist/protocol.js"() {
89666
- RUNNER_PROTOCOL_VERSION = 34;
89827
+ RUNNER_PROTOCOL_VERSION = 35;
89667
89828
  MIN_COMPATIBLE_PROTOCOL_VERSION = 1;
89668
89829
  RunnerMethod = {
89669
89830
  /** client->server: handshake; returns the initial info snapshot. */
@@ -89720,6 +89881,7 @@ var init_protocol2 = __esm({
89720
89881
  SetResolver: "setResolver",
89721
89882
  /** client->server: answer an open Question the session recorded (v27). */
89722
89883
  QuestionAnswer: "question.answer",
89884
+ QuestionShareEnv: "question.shareEnv",
89723
89885
  /** client->server: switch the active mode. */
89724
89886
  ModeSetActive: "mode.setActive",
89725
89887
  /** client->server: set the session's reasoning/thinking effort (v9). */
@@ -89862,8 +90024,13 @@ var init_protocol2 = __esm({
89862
90024
  setResolverParamsSchema = z.object({
89863
90025
  permission: z.boolean().optional(),
89864
90026
  approval: z.boolean().optional(),
89865
- question: z.boolean().optional()
90027
+ question: z.boolean().optional(),
90028
+ envShare: z.boolean().optional()
89866
90029
  });
90030
+ shareEnvParamsSchema = z.object({
90031
+ questionId: z.string().min(1).max(128),
90032
+ value: z.string().min(1).max(65536).nullable()
90033
+ }).strict();
89867
90034
  questionAnswerParamsSchema = z.object({ questionId: z.string().min(1), answers: questionAnswersSchema }).strict();
89868
90035
  modeSetActiveParamsSchema = z.object({ name: z.string() });
89869
90036
  sessionSetReasoningParamsSchema = z.object({
@@ -90720,6 +90887,11 @@ var init_server2 = __esm({
90720
90887
  peer.handle(RunnerMethod.SessionSetAutoApprove, (raw) => handleSessionSetAutoApprove(ctx, raw));
90721
90888
  peer.handle(RunnerMethod.SessionStopBackgroundWork, (raw) => handleSessionStopBackgroundWork(ctx, raw));
90722
90889
  peer.handle(RunnerMethod.SetResolver, (raw) => this.handleSetResolver(client, raw));
90890
+ peer.handle(RunnerMethod.QuestionShareEnv, async (raw) => {
90891
+ const { questionId, value: value2 } = shareEnvParamsSchema.parse(raw);
90892
+ await this.session.questions.shareEnv(questionId, value2);
90893
+ return {};
90894
+ });
90723
90895
  peer.handle(RunnerMethod.QuestionAnswer, (raw) => this.handleQuestionAnswer(raw));
90724
90896
  peer.handle(RunnerMethod.ModeSetActive, (raw) => handleModeSetActive(ctx, raw));
90725
90897
  peer.handle(RunnerMethod.SessionSetReasoning, (raw) => handleSessionSetReasoning(ctx, raw));
@@ -90929,8 +91101,9 @@ var init_server2 = __esm({
90929
91101
  client.handlesPermission = params.permission;
90930
91102
  if (params.approval !== void 0)
90931
91103
  client.handlesApproval = params.approval;
90932
- if (params.question === true && !client.detachQuestions) {
90933
- client.detachQuestions = this.session.questions.attachSurface();
91104
+ if (params.question === true) {
91105
+ client.detachQuestions?.();
91106
+ client.detachQuestions = this.session.questions.attachSurface({ envShare: params.envShare === true });
90934
91107
  } else if (params.question === false && client.detachQuestions) {
90935
91108
  client.detachQuestions();
90936
91109
  delete client.detachQuestions;
@@ -91067,12 +91240,15 @@ var init_remote_questions = __esm({
91067
91240
  RemoteQuestions = class {
91068
91241
  deps;
91069
91242
  surfaces = 0;
91243
+ envSurfaces = 0;
91070
91244
  constructor(deps) {
91071
91245
  this.deps = deps;
91072
91246
  }
91073
- attachSurface() {
91247
+ attachSurface({ envShare = false } = {}) {
91074
91248
  this.surfaces += 1;
91075
- if (this.surfaces === 1)
91249
+ if (envShare)
91250
+ this.envSurfaces += 1;
91251
+ if (this.surfaces === 1 || envShare && this.envSurfaces === 1)
91076
91252
  this.announce(true);
91077
91253
  let attached = true;
91078
91254
  return () => {
@@ -91080,8 +91256,10 @@ var init_remote_questions = __esm({
91080
91256
  return;
91081
91257
  attached = false;
91082
91258
  this.surfaces -= 1;
91083
- if (this.surfaces === 0)
91084
- this.announce(false);
91259
+ if (envShare)
91260
+ this.envSurfaces -= 1;
91261
+ if (this.surfaces === 0 || envShare && this.envSurfaces === 0)
91262
+ this.announce(this.surfaces > 0);
91085
91263
  };
91086
91264
  }
91087
91265
  async answer(questionId, answers) {
@@ -91089,8 +91267,12 @@ var init_remote_questions = __esm({
91089
91267
  const params = { questionId, answers };
91090
91268
  await this.deps.request(RunnerMethod.QuestionAnswer, params);
91091
91269
  }
91270
+ async shareEnv(questionId, value2) {
91271
+ this.deps.requireServerProtocol(35, "Env Share");
91272
+ await this.deps.request(RunnerMethod.QuestionShareEnv, { questionId, value: value2 });
91273
+ }
91092
91274
  announce(question) {
91093
- void this.deps.request(RunnerMethod.SetResolver, { question }).catch(() => void 0);
91275
+ void this.deps.request(RunnerMethod.SetResolver, { question, envShare: this.envSurfaces > 0 }).catch(() => void 0);
91094
91276
  }
91095
91277
  };
91096
91278
  }
@@ -92603,7 +92785,7 @@ async function runAttachedTui(argv, tuiOpts) {
92603
92785
  await remote.close().catch(() => void 0);
92604
92786
  };
92605
92787
  const instance = render_default(
92606
- import_react79.default.createElement(InteractiveSession, {
92788
+ import_react80.default.createElement(InteractiveSession, {
92607
92789
  session: remote,
92608
92790
  registerInteractiveResolver: (handler) => {
92609
92791
  promptHandler = handler;
@@ -92756,7 +92938,7 @@ async function runSelfHostedTui(argv, tuiOpts, standalone) {
92756
92938
  }
92757
92939
  };
92758
92940
  const { waitUntilExit } = render_default(
92759
- import_react79.default.createElement(InteractiveSession, {
92941
+ import_react80.default.createElement(InteractiveSession, {
92760
92942
  bootstrap: async (progress2) => bootSession2(
92761
92943
  tuiOpts.resumeSessionId ? { resumeSessionId: tuiOpts.resumeSessionId } : {},
92762
92944
  progress2
@@ -92807,13 +92989,13 @@ function toInteractiveStep(step) {
92807
92989
  return { kind: "ready" };
92808
92990
  }
92809
92991
  }
92810
- var import_react79;
92992
+ var import_react80;
92811
92993
  var init_run_tui = __esm({
92812
92994
  async "src/commands/run-tui.ts"() {
92813
92995
  await init_dist26();
92814
92996
  init_dist2();
92815
92997
  await init_build2();
92816
- import_react79 = __toESM(require_react());
92998
+ import_react80 = __toESM(require_react());
92817
92999
  init_web_surface();
92818
93000
  init_dist2();
92819
93001
  init_dist33();
@@ -94705,8 +94887,14 @@ var init_moxxy_tools = __esm({
94705
94887
  init_tool_catalog();
94706
94888
  }
94707
94889
  });
94890
+ var init_lines = __esm({
94891
+ "../agent-connection-kit/dist/lines.js"() {
94892
+ }
94893
+ });
94708
94894
  var init_json_rpc = __esm({
94709
94895
  "../agent-connection-kit/dist/json-rpc.js"() {
94896
+ init_lines();
94897
+ debuglog("moxxy");
94710
94898
  }
94711
94899
  });
94712
94900
  var init_session_pool = __esm({
@@ -95679,6 +95867,7 @@ var init_dist34 = __esm({
95679
95867
  init_agent_skills();
95680
95868
  init_moxxy_tools();
95681
95869
  init_json_rpc();
95870
+ init_lines();
95682
95871
  init_session_pool();
95683
95872
  init_modes3();
95684
95873
  init_cli_version();
@@ -95822,13 +96011,13 @@ async function runPermsCommand(argv) {
95822
96011
  }
95823
96012
  const sub = argv.positional[0];
95824
96013
  if (!sub && process.stdin.isTTY) {
95825
- const [{ render: render4 }, React60, { PermissionEditor: PermissionEditor2 }] = await Promise.all([
96014
+ const [{ render: render4 }, React61, { PermissionEditor: PermissionEditor2 }] = await Promise.all([
95826
96015
  init_build2().then(() => build_exports),
95827
96016
  Promise.resolve().then(() => __toESM(require_react())),
95828
96017
  init_dist26().then(() => dist_exports3)
95829
96018
  ]);
95830
96019
  const { waitUntilExit } = render4(
95831
- React60.createElement(PermissionEditor2, { policyPath: userPolicyPath() })
96020
+ React61.createElement(PermissionEditor2, { policyPath: userPolicyPath() })
95832
96021
  );
95833
96022
  await waitUntilExit();
95834
96023
  return 0;
@@ -98501,6 +98690,60 @@ var init_schedule = __esm({
98501
98690
  }
98502
98691
  });
98503
98692
 
98693
+ // src/commands/env.ts
98694
+ var env_exports = {};
98695
+ __export(env_exports, {
98696
+ runEnvCommand: () => runEnvCommand
98697
+ });
98698
+ async function runEnvCommand(argv) {
98699
+ const [action, name] = argv.positional;
98700
+ const usage = "Usage: moxxy env share <NAME>\nEnter the value in the private prompt.\n";
98701
+ if (argv.flags.help || argv.flags.h) {
98702
+ process.stdout.write(usage);
98703
+ return 0;
98704
+ }
98705
+ if (action !== "share" || argv.positional.length !== 2 || !name || !envShareNameSchema.safeParse(name).success) {
98706
+ process.stderr.write(usage);
98707
+ return 2;
98708
+ }
98709
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
98710
+ process.stderr.write("Env Share requires an interactive terminal.\n");
98711
+ return 1;
98712
+ }
98713
+ const { rawConfig } = await loadRawConfig({
98714
+ cwd: process.cwd(),
98715
+ configPath: typeof argv.flags.config === "string" ? argv.flags.config : void 0
98716
+ });
98717
+ const { vault } = buildVaultPlugin({
98718
+ requirePassphrase: rawConfig.vault?.requirePassphrase === true,
98719
+ passphrasePrompt: async () => {
98720
+ const phrase = await password({ message: "Vault passphrase" });
98721
+ if (isCancel(phrase) || !phrase) throw new Error("Vault unlock cancelled.");
98722
+ return phrase;
98723
+ }
98724
+ });
98725
+ try {
98726
+ process.stdout.write(ENV_SHARE_PRIVACY_NOTE + "\n");
98727
+ const value2 = await password({
98728
+ message: "Save or replace " + name + " in your Moxxy vault",
98729
+ validate: (v) => v && v.length <= 65536 ? void 0 : "Enter 1 to 65536 characters."
98730
+ });
98731
+ if (isCancel(value2) || !value2) return 1;
98732
+ await vault.setShared(name, value2);
98733
+ process.stdout.write("Saved. Reference: ${vault:" + name + "}\n");
98734
+ return 0;
98735
+ } finally {
98736
+ vault.close();
98737
+ }
98738
+ }
98739
+ var init_env = __esm({
98740
+ "src/commands/env.ts"() {
98741
+ init_dist32();
98742
+ init_dist5();
98743
+ init_load_config();
98744
+ }
98745
+ });
98746
+
98504
98747
  // src/commands/doctor.ts
98505
98748
  var doctor_exports = {};
98506
98749
  __export(doctor_exports, {
@@ -102649,6 +102892,7 @@ var ADVANCED_SECTIONS = [
102649
102892
  {
102650
102893
  title: "CONNECT",
102651
102894
  rows: [
102895
+ ["env share <NAME>", "save a credential through a private vault prompt"],
102652
102896
  ["login <provider>", "OAuth sign-in for providers that don't use API keys"],
102653
102897
  ["login <action>", "inspect or remove stored OAuth credentials"],
102654
102898
  ["browser <action>", "sign the terminal's browser in to sites, or forget them"],
@@ -102821,6 +103065,7 @@ var COMMANDS = {
102821
103065
  memory: async () => (await init_memory().then(() => memory_exports)).runMemoryCommand,
102822
103066
  mcp: async () => (await init_mcp().then(() => mcp_exports)).runMcpCommand,
102823
103067
  schedule: async () => (await init_schedule().then(() => schedule_exports)).runScheduleCommand,
103068
+ env: async () => (await Promise.resolve().then(() => (init_env(), env_exports))).runEnvCommand,
102824
103069
  doctor: async () => (await init_doctor().then(() => doctor_exports)).runDoctorCommand,
102825
103070
  update: async () => (await init_update2().then(() => update_exports)).runUpdateCommand,
102826
103071
  prompt: async () => (await init_prompt().then(() => prompt_exports)).runPromptCommand,