@sema-agent/cli 1.0.100 → 1.0.101

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/sema.js CHANGED
@@ -71,9 +71,53 @@ function installBootSignalTailFrame(argv2 = process.argv.slice(2)) {
71
71
  installBootSignalTailFrame();
72
72
 
73
73
  // build-src/src/sema/preludeEntry.ts
74
- var versionLine = "sema 1.0.100" ? "sema 1.0.100" : "";
74
+ var versionLine = "sema 1.0.101" ? "sema 1.0.101" : "";
75
75
  var argv = process.argv.slice(2);
76
76
  var wantsVersionFastPath = argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v");
77
+ var EARLY_INPUT_PRELUDE_SLOT = /* @__PURE__ */ Symbol.for("sema.earlyInputPrelude");
78
+ if (!wantsVersionFastPath && process.stdin.isTTY && !argv.includes("-p") && !argv.includes("--print") && typeof process.stdin.setRawMode === "function") {
79
+ try {
80
+ const chunks = [];
81
+ let stopped = false;
82
+ const onReadable = () => {
83
+ let chunk = process.stdin.read();
84
+ while (chunk !== null) {
85
+ let str = typeof chunk === "string" ? chunk : chunk.toString("utf8");
86
+ if (str.includes("")) {
87
+ try {
88
+ process.stdin.setRawMode(false);
89
+ } catch {
90
+ }
91
+ process.exit(130);
92
+ }
93
+ const eof = str.indexOf("");
94
+ if (eof >= 0) {
95
+ const rest = str.slice(eof + 1);
96
+ str = str.slice(0, eof + 1);
97
+ chunks.push({ s: str, t: Date.now() });
98
+ stopped = true;
99
+ process.stdin.removeListener("readable", onReadable);
100
+ if (rest.length > 0) process.stdin.unshift(rest);
101
+ return;
102
+ }
103
+ chunks.push({ s: str, t: Date.now() });
104
+ chunk = process.stdin.read();
105
+ }
106
+ };
107
+ process.stdin.setEncoding("utf8");
108
+ process.stdin.setRawMode(true);
109
+ process.stdin.ref();
110
+ process.stdin.on("readable", onReadable);
111
+ globalThis[EARLY_INPUT_PRELUDE_SLOT] = {
112
+ /** 主模块接管时调:摘掉微入口的监听,把攒下的字节(带到达时间)交出去;raw 模式保持,由接管方持有。 */
113
+ detach() {
114
+ process.stdin.removeListener("readable", onReadable);
115
+ return { chunks: chunks.splice(0, chunks.length), stopped };
116
+ }
117
+ };
118
+ } catch {
119
+ }
120
+ }
77
121
  if (wantsVersionFastPath && versionLine) {
78
122
  process.stdout.write(versionLine + "\n");
79
123
  } else {