context-mode 2.0.1 → 2.1.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.
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "context-mode",
15
- "version": "2.0.1"
15
+ "version": "2.1.0"
16
16
  }
package/run.mjs CHANGED
@@ -359,8 +359,8 @@ var DB_SIBLING_SUFFIXES = Object.freeze(["", DB_WAL_SUFFIX, DB_SHM_SUFFIX]);
359
359
  var UPGRADE_HOST_COMMAND = Object.freeze({
360
360
  "claude-code": "claude plugin marketplace update context-mode && claude plugin update context-mode@context-mode",
361
361
  codex: "rewrite config.toml's [mcp_servers.context-mode*] block to the v2 entry, then restart Codex",
362
- gemini: "gemini extensions install https://github.com/mksglu/context-mode --ref release --auto-update",
363
- qwen: "qwen extensions install https://github.com/mksglu/context-mode --ref release --auto-update"
362
+ gemini: "gemini extensions install https://github.com/mksglu/context-mode --auto-update",
363
+ qwen: "qwen extensions install https://github.com/mksglu/context-mode --auto-update"
364
364
  });
365
365
  var V1_SCRIPT_NAMES = Object.freeze([
366
366
  "afteragentresponse.mjs",
@@ -385,6 +385,7 @@ var VSCODE_MCP_FILE = "mcp.json";
385
385
  var KIRO_AGENT_FILE = Object.freeze(["agents", "default.json"]);
386
386
  var KIRO_STEERING_FILE = Object.freeze(["steering", "KIRO.md"]);
387
387
  var OPENCODE_CONFIG_FILES = Object.freeze(["opencode.jsonc", "opencode.json"]);
388
+ var OPENCODE_NPM_SPEC_PREFIX = `${SERVER_KEY}@`;
388
389
  var V1_DATA_ROOT_ENTRIES = Object.freeze(["content", "platform.json"]);
389
390
  var PI_ROLE = "custom";
390
391
  var V1_PATH_SEPS = Object.freeze(["/", "\\"]);
@@ -438,6 +439,7 @@ var DOCTOR_DOCS_LABEL = "Docs: ";
438
439
  var DOCTOR_REPORT_LINE = "Report file: ";
439
440
  var DOCTOR_GH_LINE = "File it: ";
440
441
  var DOCTOR_URL_LINE = "Or open: ";
442
+ var DOCTOR_RULES_LINE = "Rules: ";
441
443
  var DOCTOR_GH_NEXT = " --";
442
444
  var DOCTOR_NOTE_PREFIXES = Object.freeze([
443
445
  DOCTOR_ENV_PREFIX,
@@ -445,10 +447,23 @@ var DOCTOR_NOTE_PREFIXES = Object.freeze([
445
447
  DOCTOR_REPORT_LINE,
446
448
  DOCTOR_GH_LINE,
447
449
  DOCTOR_GH_NEXT.trim(),
448
- DOCTOR_URL_LINE
450
+ DOCTOR_URL_LINE,
451
+ DOCTOR_RULES_LINE
449
452
  ]);
450
453
  var ISSUE_REPO_SLUG = "mksglu/context-mode";
451
454
  var ISSUE_FORM_FILE = "agent-report.yml";
455
+ var ISSUE_GUIDE_URL = `https://github.com/${ISSUE_REPO_SLUG}/blob/main/.github/AGENT_ISSUE.md`;
456
+ var ISSUE_AGENT_RULES = Object.freeze([
457
+ 'Search for the same problem first: `gh issue list -R mksglu/context-mode --state all --search "<check id or error>"`. When one matches, add your facts there as a comment.',
458
+ "File one bug per issue.",
459
+ "Call the `ctx_doctor` tool and paste its full output unchanged in the `ctx-report` field.",
460
+ "Give the versions: context-mode, the agent, the OS and arch, and Node.",
461
+ "Write numbered repro steps that start from a fresh project (`mktemp -d`) and the agent's own install command.",
462
+ "Give the exact command and its exact output in a fenced code block.",
463
+ "Say what you expected and what happened instead.",
464
+ "Name the source file and line when you found the cause.",
465
+ "Replace every secret with `<masked>` and the home folder with `~` before you send."
466
+ ]);
452
467
  var ISSUE_FORM_HEADINGS = Object.freeze([
453
468
  "Summary",
454
469
  "ctx-report",
@@ -474,16 +489,16 @@ var DOCTOR_ENV_NAMES = Object.freeze([
474
489
  var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
475
490
  var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
476
491
  var NATIVE_INSTALL = Object.freeze({
477
- "claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
478
- codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
479
- gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
480
- qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
481
- opencode: ["opencode plugin add context-mode@next"],
482
- pi: ["pi install npm:context-mode@next"],
483
- "copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
484
- vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
485
- kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
486
- zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
492
+ "claude-code": ["claude plugin marketplace add mksglu/context-mode", "claude plugin install context-mode@context-mode"],
493
+ codex: ["codex plugin marketplace add mksglu/context-mode", "codex plugin add context-mode@context-mode"],
494
+ gemini: ["gemini extensions install https://github.com/mksglu/context-mode"],
495
+ qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode"],
496
+ opencode: ["opencode plugin add context-mode"],
497
+ pi: ["pi install npm:context-mode"],
498
+ "copilot-cli": ["npm i -g context-mode", "context-mode setup --agents copilot-cli"],
499
+ vscode: ["npm i -g context-mode", "context-mode setup --agents vscode"],
500
+ kiro: ["npm i -g context-mode", "context-mode setup --agents kiro"],
501
+ zcode: ["npm i -g context-mode", "context-mode setup --agents zcode"]
487
502
  });
488
503
  var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
489
504
 
@@ -520,9 +535,28 @@ function outputOf(resp) {
520
535
  return err === "" ? out : out === "" ? err : out + "\n" + err;
521
536
  }
522
537
  }
523
- if (typeof resp === "object" && resp !== null && isGrepContent(resp)) return resp.content;
538
+ if (typeof resp === "object" && resp !== null && !Array.isArray(resp)) {
539
+ const slot = textSlot(resp);
540
+ if (slot !== null) return slot.text;
541
+ }
524
542
  return JSON.stringify(resp);
525
543
  }
544
+ function textSlot(r) {
545
+ const file = r.file;
546
+ if (r.type === "text" && typeof file === "object" && file !== null && typeof file.content === "string") {
547
+ return { text: file.content, put: (o, output) => ({ ...o, file: { ...o.file, content: output } }) };
548
+ }
549
+ if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
550
+ if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
551
+ return { text: r.filenames.join("\n"), put: (o, output) => ({ ...o, filenames: output.split("\n") }) };
552
+ }
553
+ if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
554
+ return null;
555
+ }
556
+ function isShellShape(resp) {
557
+ const r = resp;
558
+ return typeof r.stdout === "string" || typeof r.stderr === "string";
559
+ }
526
560
  function isGrepContent(resp) {
527
561
  const r = resp;
528
562
  return r.mode === "content" && typeof r.content === "string";
@@ -541,7 +575,10 @@ function readResult(resp) {
541
575
  const text = outputOf(resp);
542
576
  const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
543
577
  const info = { isError, bytes: Buffer.byteLength(text), text };
544
- if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isGrepContent(resp)) info.shape = resp;
578
+ if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
579
+ if (textSlot(resp) !== null) info.shape = resp;
580
+ else info.keep = true;
581
+ }
545
582
  if (Array.isArray(resp)) {
546
583
  info.blocks = true;
547
584
  if (blocksOf(resp).keep) info.keep = true;
@@ -578,7 +615,9 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
578
615
  }
579
616
  function replaceShape(ev, output) {
580
617
  if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
581
- if (ev.result?.shape !== void 0) return { ...ev.result.shape, content: output };
618
+ const shape = ev.result?.shape;
619
+ const slot = shape === void 0 ? null : textSlot(shape);
620
+ if (shape !== void 0 && slot !== null) return slot.put(shape, output);
582
621
  if (ev.result?.blocks === true) return [{ type: "text", text: output }];
583
622
  return output;
584
623
  }
@@ -971,7 +1010,8 @@ function encode6(ev, d, _extra) {
971
1010
  }
972
1011
 
973
1012
  // src/adapters/kiro.ts
974
- var TOOL_NAME_PREFIX7 = "mcp_context-mode_";
1013
+ var TOOL_NAME_PREFIX7 = "mcp_context_mode_";
1014
+ var LEGACY_TOOL_NAME_PREFIX = "mcp_context-mode_";
975
1015
  var KIRO_EVENTS = {
976
1016
  SessionStart: "SessionStart",
977
1017
  agentSpawn: "SessionStart",
@@ -983,6 +1023,7 @@ var KIRO_EVENTS = {
983
1023
  PostToolUse: "PostToolUse",
984
1024
  postToolUse: "PostToolUse"
985
1025
  };
1026
+ var PROMPT_FIELD = "prompt";
986
1027
  var PROMPT_ENV = "USER_PROMPT";
987
1028
  var MCP_PREFIX3 = "mcp_";
988
1029
  var SHELL_TOOL_NAMES4 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
@@ -991,6 +1032,7 @@ var MCP_SEP3 = "_";
991
1032
  var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
992
1033
  function canonicalName5(name) {
993
1034
  if (name.startsWith(TOOL_NAME_PREFIX7)) return name.slice(TOOL_NAME_PREFIX7.length);
1035
+ if (name.startsWith(LEGACY_TOOL_NAME_PREFIX)) return name.slice(LEGACY_TOOL_NAME_PREFIX.length);
994
1036
  if (Object.hasOwn(NATIVE_TO_CANONICAL5, name)) return NATIVE_TO_CANONICAL5[name];
995
1037
  if (!name.startsWith(MCP_PREFIX3)) return name;
996
1038
  const rest = name.slice(MCP_PREFIX3.length);
@@ -1011,7 +1053,8 @@ function decode7(raw) {
1011
1053
  const ev = { event, agent: "kiro", sessionId: String(p.session_id ?? ""), cwd: String(p.cwd ?? "") };
1012
1054
  if (event === "SessionStart" && typeof p.source === "string" && KIRO_SOURCES[p.source] !== void 0) ev.source = KIRO_SOURCES[p.source];
1013
1055
  if (event === "UserPromptSubmit") {
1014
- const prompt = process.env[PROMPT_ENV];
1056
+ const field = p[PROMPT_FIELD];
1057
+ const prompt = typeof field === "string" ? field : process.env[PROMPT_ENV];
1015
1058
  if (prompt !== void 0) ev.prompt = prompt;
1016
1059
  }
1017
1060
  if (event === "PreToolUse" || event === "PostToolUse") {
@@ -1023,7 +1066,7 @@ function decode7(raw) {
1023
1066
  return ev;
1024
1067
  }
1025
1068
  function encode7(ev, d, _extra) {
1026
- if (ev.event === "UserPromptSubmit") return { stdout: "", exitCode: 0 };
1069
+ if (ev.event === "UserPromptSubmit") return { stdout: d.kind === "hint" ? d.text : "", exitCode: 0 };
1027
1070
  switch (d.kind) {
1028
1071
  case "allow":
1029
1072
  return { stdout: "", exitCode: 0 };
package/search.mjs CHANGED
@@ -359,8 +359,8 @@ var DB_SIBLING_SUFFIXES = Object.freeze(["", DB_WAL_SUFFIX, DB_SHM_SUFFIX]);
359
359
  var UPGRADE_HOST_COMMAND = Object.freeze({
360
360
  "claude-code": "claude plugin marketplace update context-mode && claude plugin update context-mode@context-mode",
361
361
  codex: "rewrite config.toml's [mcp_servers.context-mode*] block to the v2 entry, then restart Codex",
362
- gemini: "gemini extensions install https://github.com/mksglu/context-mode --ref release --auto-update",
363
- qwen: "qwen extensions install https://github.com/mksglu/context-mode --ref release --auto-update"
362
+ gemini: "gemini extensions install https://github.com/mksglu/context-mode --auto-update",
363
+ qwen: "qwen extensions install https://github.com/mksglu/context-mode --auto-update"
364
364
  });
365
365
  var V1_SCRIPT_NAMES = Object.freeze([
366
366
  "afteragentresponse.mjs",
@@ -385,6 +385,7 @@ var VSCODE_MCP_FILE = "mcp.json";
385
385
  var KIRO_AGENT_FILE = Object.freeze(["agents", "default.json"]);
386
386
  var KIRO_STEERING_FILE = Object.freeze(["steering", "KIRO.md"]);
387
387
  var OPENCODE_CONFIG_FILES = Object.freeze(["opencode.jsonc", "opencode.json"]);
388
+ var OPENCODE_NPM_SPEC_PREFIX = `${SERVER_KEY}@`;
388
389
  var V1_DATA_ROOT_ENTRIES = Object.freeze(["content", "platform.json"]);
389
390
  var PI_ROLE = "custom";
390
391
  var V1_PATH_SEPS = Object.freeze(["/", "\\"]);
@@ -438,6 +439,7 @@ var DOCTOR_DOCS_LABEL = "Docs: ";
438
439
  var DOCTOR_REPORT_LINE = "Report file: ";
439
440
  var DOCTOR_GH_LINE = "File it: ";
440
441
  var DOCTOR_URL_LINE = "Or open: ";
442
+ var DOCTOR_RULES_LINE = "Rules: ";
441
443
  var DOCTOR_GH_NEXT = " --";
442
444
  var DOCTOR_NOTE_PREFIXES = Object.freeze([
443
445
  DOCTOR_ENV_PREFIX,
@@ -445,10 +447,23 @@ var DOCTOR_NOTE_PREFIXES = Object.freeze([
445
447
  DOCTOR_REPORT_LINE,
446
448
  DOCTOR_GH_LINE,
447
449
  DOCTOR_GH_NEXT.trim(),
448
- DOCTOR_URL_LINE
450
+ DOCTOR_URL_LINE,
451
+ DOCTOR_RULES_LINE
449
452
  ]);
450
453
  var ISSUE_REPO_SLUG = "mksglu/context-mode";
451
454
  var ISSUE_FORM_FILE = "agent-report.yml";
455
+ var ISSUE_GUIDE_URL = `https://github.com/${ISSUE_REPO_SLUG}/blob/main/.github/AGENT_ISSUE.md`;
456
+ var ISSUE_AGENT_RULES = Object.freeze([
457
+ 'Search for the same problem first: `gh issue list -R mksglu/context-mode --state all --search "<check id or error>"`. When one matches, add your facts there as a comment.',
458
+ "File one bug per issue.",
459
+ "Call the `ctx_doctor` tool and paste its full output unchanged in the `ctx-report` field.",
460
+ "Give the versions: context-mode, the agent, the OS and arch, and Node.",
461
+ "Write numbered repro steps that start from a fresh project (`mktemp -d`) and the agent's own install command.",
462
+ "Give the exact command and its exact output in a fenced code block.",
463
+ "Say what you expected and what happened instead.",
464
+ "Name the source file and line when you found the cause.",
465
+ "Replace every secret with `<masked>` and the home folder with `~` before you send."
466
+ ]);
452
467
  var ISSUE_FORM_HEADINGS = Object.freeze([
453
468
  "Summary",
454
469
  "ctx-report",
@@ -474,16 +489,16 @@ var DOCTOR_ENV_NAMES = Object.freeze([
474
489
  var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
475
490
  var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
476
491
  var NATIVE_INSTALL = Object.freeze({
477
- "claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
478
- codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
479
- gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
480
- qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
481
- opencode: ["opencode plugin add context-mode@next"],
482
- pi: ["pi install npm:context-mode@next"],
483
- "copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
484
- vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
485
- kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
486
- zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
492
+ "claude-code": ["claude plugin marketplace add mksglu/context-mode", "claude plugin install context-mode@context-mode"],
493
+ codex: ["codex plugin marketplace add mksglu/context-mode", "codex plugin add context-mode@context-mode"],
494
+ gemini: ["gemini extensions install https://github.com/mksglu/context-mode"],
495
+ qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode"],
496
+ opencode: ["opencode plugin add context-mode"],
497
+ pi: ["pi install npm:context-mode"],
498
+ "copilot-cli": ["npm i -g context-mode", "context-mode setup --agents copilot-cli"],
499
+ vscode: ["npm i -g context-mode", "context-mode setup --agents vscode"],
500
+ kiro: ["npm i -g context-mode", "context-mode setup --agents kiro"],
501
+ zcode: ["npm i -g context-mode", "context-mode setup --agents zcode"]
487
502
  });
488
503
  var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
489
504
 
@@ -520,9 +535,28 @@ function outputOf(resp) {
520
535
  return err === "" ? out : out === "" ? err : out + "\n" + err;
521
536
  }
522
537
  }
523
- if (typeof resp === "object" && resp !== null && isGrepContent(resp)) return resp.content;
538
+ if (typeof resp === "object" && resp !== null && !Array.isArray(resp)) {
539
+ const slot = textSlot(resp);
540
+ if (slot !== null) return slot.text;
541
+ }
524
542
  return JSON.stringify(resp);
525
543
  }
544
+ function textSlot(r) {
545
+ const file = r.file;
546
+ if (r.type === "text" && typeof file === "object" && file !== null && typeof file.content === "string") {
547
+ return { text: file.content, put: (o, output) => ({ ...o, file: { ...o.file, content: output } }) };
548
+ }
549
+ if (isGrepContent(r)) return { text: r.content, put: (o, output) => ({ ...o, content: output }) };
550
+ if (Array.isArray(r.filenames) && r.filenames.every((f) => typeof f === "string")) {
551
+ return { text: r.filenames.join("\n"), put: (o, output) => ({ ...o, filenames: output.split("\n") }) };
552
+ }
553
+ if (typeof r.result === "string") return { text: r.result, put: (o, output) => ({ ...o, result: output }) };
554
+ return null;
555
+ }
556
+ function isShellShape(resp) {
557
+ const r = resp;
558
+ return typeof r.stdout === "string" || typeof r.stderr === "string";
559
+ }
526
560
  function isGrepContent(resp) {
527
561
  const r = resp;
528
562
  return r.mode === "content" && typeof r.content === "string";
@@ -541,7 +575,10 @@ function readResult(resp) {
541
575
  const text = outputOf(resp);
542
576
  const isError = typeof resp === "object" && resp !== null && resp.is_error === true;
543
577
  const info = { isError, bytes: Buffer.byteLength(text), text };
544
- if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && isGrepContent(resp)) info.shape = resp;
578
+ if (typeof resp === "object" && resp !== null && !Array.isArray(resp) && !isShellShape(resp)) {
579
+ if (textSlot(resp) !== null) info.shape = resp;
580
+ else info.keep = true;
581
+ }
545
582
  if (Array.isArray(resp)) {
546
583
  info.blocks = true;
547
584
  if (blocksOf(resp).keep) info.keep = true;
@@ -578,7 +615,9 @@ function decodeClaudeShape(raw, agent, ownPrefix, sources) {
578
615
  }
579
616
  function replaceShape(ev, output) {
580
617
  if (ev.tool?.canonicalName === "Bash") return { stdout: output, stderr: "", interrupted: false };
581
- if (ev.result?.shape !== void 0) return { ...ev.result.shape, content: output };
618
+ const shape = ev.result?.shape;
619
+ const slot = shape === void 0 ? null : textSlot(shape);
620
+ if (shape !== void 0 && slot !== null) return slot.put(shape, output);
582
621
  if (ev.result?.blocks === true) return [{ type: "text", text: output }];
583
622
  return output;
584
623
  }
@@ -971,7 +1010,8 @@ function encode6(ev, d, _extra) {
971
1010
  }
972
1011
 
973
1012
  // src/adapters/kiro.ts
974
- var TOOL_NAME_PREFIX7 = "mcp_context-mode_";
1013
+ var TOOL_NAME_PREFIX7 = "mcp_context_mode_";
1014
+ var LEGACY_TOOL_NAME_PREFIX = "mcp_context-mode_";
975
1015
  var KIRO_EVENTS = {
976
1016
  SessionStart: "SessionStart",
977
1017
  agentSpawn: "SessionStart",
@@ -983,6 +1023,7 @@ var KIRO_EVENTS = {
983
1023
  PostToolUse: "PostToolUse",
984
1024
  postToolUse: "PostToolUse"
985
1025
  };
1026
+ var PROMPT_FIELD = "prompt";
986
1027
  var PROMPT_ENV = "USER_PROMPT";
987
1028
  var MCP_PREFIX3 = "mcp_";
988
1029
  var SHELL_TOOL_NAMES4 = Object.freeze(["execute_bash", "execute_pwsh", "shell"]);
@@ -991,6 +1032,7 @@ var MCP_SEP3 = "_";
991
1032
  var KIRO_SOURCES = { startup: "startup", resume: "resume", clear: "clear", compact: "compact" };
992
1033
  function canonicalName5(name) {
993
1034
  if (name.startsWith(TOOL_NAME_PREFIX7)) return name.slice(TOOL_NAME_PREFIX7.length);
1035
+ if (name.startsWith(LEGACY_TOOL_NAME_PREFIX)) return name.slice(LEGACY_TOOL_NAME_PREFIX.length);
994
1036
  if (Object.hasOwn(NATIVE_TO_CANONICAL5, name)) return NATIVE_TO_CANONICAL5[name];
995
1037
  if (!name.startsWith(MCP_PREFIX3)) return name;
996
1038
  const rest = name.slice(MCP_PREFIX3.length);
@@ -1011,7 +1053,8 @@ function decode7(raw) {
1011
1053
  const ev = { event, agent: "kiro", sessionId: String(p.session_id ?? ""), cwd: String(p.cwd ?? "") };
1012
1054
  if (event === "SessionStart" && typeof p.source === "string" && KIRO_SOURCES[p.source] !== void 0) ev.source = KIRO_SOURCES[p.source];
1013
1055
  if (event === "UserPromptSubmit") {
1014
- const prompt = process.env[PROMPT_ENV];
1056
+ const field = p[PROMPT_FIELD];
1057
+ const prompt = typeof field === "string" ? field : process.env[PROMPT_ENV];
1015
1058
  if (prompt !== void 0) ev.prompt = prompt;
1016
1059
  }
1017
1060
  if (event === "PreToolUse" || event === "PostToolUse") {
@@ -1023,7 +1066,7 @@ function decode7(raw) {
1023
1066
  return ev;
1024
1067
  }
1025
1068
  function encode7(ev, d, _extra) {
1026
- if (ev.event === "UserPromptSubmit") return { stdout: "", exitCode: 0 };
1069
+ if (ev.event === "UserPromptSubmit") return { stdout: d.kind === "hint" ? d.text : "", exitCode: 0 };
1027
1070
  switch (d.kind) {
1028
1071
  case "allow":
1029
1072
  return { stdout: "", exitCode: 0 };