@sema-agent/cli 1.0.136 → 1.0.138

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
@@ -88,10 +88,68 @@ function installBootSignalTailFrame(argv2 = process.argv.slice(2)) {
88
88
  }
89
89
  installBootSignalTailFrame();
90
90
 
91
+ // build-src/src/sema/nodeEnginesRange.ts
92
+ function parseVer(raw) {
93
+ const m = /^v?(\d+)(?:\.(\d+))?(?:\.(\d+))?$/.exec(raw.trim());
94
+ if (m === null) return void 0;
95
+ return [Number(m[1]), Number(m[2] ?? 0), Number(m[3] ?? 0)];
96
+ }
97
+ function cmp(a, b) {
98
+ for (let i = 0; i < 3; i++) {
99
+ if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1;
100
+ }
101
+ return 0;
102
+ }
103
+ function comparator(token) {
104
+ const m = /^(\^|>=|<=|>|<|=)?(.+)$/.exec(token);
105
+ if (m === null) return void 0;
106
+ const op = m[1] ?? "=";
107
+ const bound = parseVer(m[2] ?? "");
108
+ if (bound === void 0) return void 0;
109
+ switch (op) {
110
+ case "^": {
111
+ if (bound[0] === 0) return void 0;
112
+ const ceil = [bound[0] + 1, 0, 0];
113
+ return (v) => cmp(v, bound) >= 0 && cmp(v, ceil) < 0;
114
+ }
115
+ case ">=":
116
+ return (v) => cmp(v, bound) >= 0;
117
+ case ">":
118
+ return (v) => cmp(v, bound) > 0;
119
+ case "<=":
120
+ return (v) => cmp(v, bound) <= 0;
121
+ case "<":
122
+ return (v) => cmp(v, bound) < 0;
123
+ default:
124
+ return (v) => cmp(v, bound) === 0;
125
+ }
126
+ }
127
+ function nodeVersionSatisfies(version, range) {
128
+ const v = parseVer(version);
129
+ if (v === void 0) return void 0;
130
+ const branches = range.split("||").map((b) => b.trim());
131
+ if (branches.length === 0 || branches.some((b) => b === "")) return void 0;
132
+ let any = false;
133
+ for (const branch of branches) {
134
+ const tests = branch.split(/\s+/).map(comparator);
135
+ if (tests.some((t) => t === void 0)) return void 0;
136
+ if (tests.every((t) => t(v))) any = true;
137
+ }
138
+ return any;
139
+ }
140
+ function nodeFloorRefusalLine(version, range) {
141
+ return `sema needs Node.js ${range} \u2014 this machine is running Node.js ${version}, which is outside that range (sema's bundled engine does not support it). Install a supported Node.js release and run sema again.`;
142
+ }
143
+
91
144
  // build-src/src/sema/preludeEntry.ts
92
- var versionLine = "sema 1.0.136" ? "sema 1.0.136" : "";
145
+ var versionLine = "sema 1.0.138" ? "sema 1.0.138" : "";
93
146
  var argv = process.argv.slice(2);
94
147
  var wantsVersionFastPath = argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v");
148
+ var nodeEnginesRange = "^20.19.0 || >=22.12.0" ? "^20.19.0 || >=22.12.0" : "";
149
+ if (!wantsVersionFastPath && nodeEnginesRange && nodeVersionSatisfies(process.versions.node, nodeEnginesRange) === false) {
150
+ process.stderr.write(nodeFloorRefusalLine(process.versions.node, nodeEnginesRange) + "\n");
151
+ process.exit(1);
152
+ }
95
153
  var EARLY_INPUT_PRELUDE_SLOT = /* @__PURE__ */ Symbol.for("sema.earlyInputPrelude");
96
154
  if (!wantsVersionFastPath && process.stdin.isTTY && !argv.includes("-p") && !argv.includes("--print") && typeof process.stdin.setRawMode === "function") {
97
155
  try {