@sprawling/mei 0.0.0-stage → 0.0.17-pre.261115

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/bin/mei.cmd ADDED
@@ -0,0 +1,20 @@
1
+ :; runtime=$(command -v bun); if test -z "$runtime"; then runtime=$(command -v node); fi; if test -z "$runtime"; then echo "mei: install Bun or Node.js to run this package"; exit 1; fi ; if test $# -eq 0; then echo "mei: package entry file missing; reinstall this package"; exit 1; fi; exec "$runtime" "$@" # Ignore the batch line ending after the shell dispatch.
2
+ : <<'WINDOWS'
3
+ @echo off
4
+ if "%~1"=="" goto noentry
5
+ where bun >nul 2>nul
6
+ if errorlevel 1 goto node
7
+ bun %*
8
+ exit /b %errorlevel%
9
+ :node
10
+ where node >nul 2>nul
11
+ if errorlevel 1 goto missing
12
+ node %*
13
+ exit /b %errorlevel%
14
+ :missing
15
+ echo mei: install Bun or Node.js to run this package 1>&2
16
+ exit /b 1
17
+ :noentry
18
+ echo mei: package entry file missing; reinstall this package 1>&2
19
+ exit /b 1
20
+ WINDOWS
package/bin/mei.js ADDED
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env mei-runtime
2
+ // This Source Code Form is subject to the terms of the Mozilla Public
3
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
4
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
5
+ // Copyright (c) 2026 2youg1 and the sprawling contributors
6
+ //
7
+ // The npm channel's entry point: find the binary for this machine and
8
+ // become it.
9
+ //
10
+ // **This script never installs anything.** Where a downloaded archive
11
+ // puts the binary, and what happens to PATH, belongs to `sprawling
12
+ // install`; where an npm package puts it belongs to npm or bun. Two
13
+ // installers choosing a directory would be two authorities for one
14
+ // rule, so this one resolves, execs, and passes the exit code back.
15
+ //
16
+ // One package per platform, listed as optional dependencies of the root
17
+ // package: npm and bun install only the row whose `os` and `cpu` match,
18
+ // so a Windows machine never downloads a macOS binary.
19
+
20
+ "use strict";
21
+
22
+ const { spawn } = require("node:child_process");
23
+
24
+ // The platforms the release builds, keyed the way node spells them.
25
+ // A machine outside this table is told what is built rather than handed
26
+ // a binary that cannot run, and the answer names the download page,
27
+ // which carries every archive whether or not npm has a package for it.
28
+ const PLATFORMS = {
29
+ "win32 x64": { package: "@sprawling/sprawling-windows-x64", binary: "sprawling.exe" },
30
+ "darwin arm64": { package: "@sprawling/sprawling-darwin-arm64", binary: "sprawling" },
31
+ "linux x64": { package: "@sprawling/sprawling-linux-x64-musl", binary: "sprawling" },
32
+ };
33
+
34
+ const MEI_PLATFORMS = {
35
+ "darwin arm64": { package: "@sprawling/mei-darwin-arm64", binary: "mei" },
36
+ "linux x64": { package: "@sprawling/mei-linux-x64-musl", binary: "mei" },
37
+ };
38
+
39
+ const RELEASES = "https://github.com/2youg1/sprawling-agents/releases";
40
+
41
+ // Both root packages carry this same selector. Their own manifest, not
42
+ // the current machine or a second generated script, chooses the product.
43
+ const packageManifest = (() => {
44
+ try {
45
+ return require("../package.json");
46
+ } catch {
47
+ return {};
48
+ }
49
+ })();
50
+ const product =
51
+ packageManifest.name === "@sprawling/mei"
52
+ ? { command: "mei", root: packageManifest.name, platforms: MEI_PLATFORMS }
53
+ : { command: "sprawling", root: "sprawling", platforms: PLATFORMS };
54
+
55
+ function die(message) {
56
+ process.stderr.write(`${product.command}: ${message}\n`);
57
+ process.exit(1);
58
+ }
59
+
60
+ // A package named at the version this run resolves it to, as npm spells
61
+ // that pair. npm pins every optional dependency to the root package's
62
+ // own version, so the root manifest is the one authority for which
63
+ // release is being looked for; in the published package it sits one
64
+ // directory above `bin/sprawling.js`. Where it cannot be read the name
65
+ // is given alone, so a failure still reports everything it knows.
66
+ function spec(name) {
67
+ return typeof packageManifest.version === "string" ? `${name}@${packageManifest.version}` : name;
68
+ }
69
+
70
+ const key = `${process.platform} ${process.arch}`;
71
+ const row = product.platforms[key];
72
+ if (row === undefined) {
73
+ die(
74
+ `no binary is published for ${key}, so ${spec(product.root)} has ` +
75
+ `nothing to run here. What is published: ` +
76
+ `${Object.keys(product.platforms).join(", ")}. ` +
77
+ `Build from source, or see ${RELEASES}.`,
78
+ );
79
+ }
80
+
81
+ let binary;
82
+ try {
83
+ binary = require.resolve(`${row.package}/bin/${row.binary}`);
84
+ } catch {
85
+ // The optional dependency did not install. The usual causes are an
86
+ // `--omit=optional` install and a lockfile copied from another
87
+ // platform, and both are fixed the same way, so the message says the
88
+ // fix rather than guessing which one happened.
89
+ die(
90
+ `${spec(row.package)} is not installed, so there is no binary for ` +
91
+ `${key}. Reinstall without omitting optional dependencies, ` +
92
+ `or see ${RELEASES}.`,
93
+ );
94
+ }
95
+
96
+ // `inherit`, so the city's console is this console: the process serves
97
+ // until Ctrl-C, and its output is not something to collect and reprint.
98
+ const child = spawn(binary, process.argv.slice(2), {
99
+ stdio: "inherit",
100
+ env: {
101
+ ...process.env,
102
+ SPRAWLING_INSTALL_CHANNEL: ["npm", "bun"].includes(process.env.SPRAWLING_INSTALL_CHANNEL)
103
+ ? process.env.SPRAWLING_INSTALL_CHANNEL
104
+ : __dirname.split(/[\\/]/).includes(".bun")
105
+ ? "bun"
106
+ : __dirname.split(/[\\/]/).includes("_npx")
107
+ ? "npm"
108
+ : "package",
109
+ },
110
+ });
111
+ const signals = ["SIGINT", "SIGTERM", "SIGHUP"];
112
+ const forwards = new Map(signals.map((signal) => [signal, () => child.kill(signal)]));
113
+ for (const [signal, forward] of forwards) process.on(signal, forward);
114
+ child.on("error", (error) => die(`could not run ${binary}: ${error.message}`));
115
+ child.on("exit", (status, signal) => {
116
+ for (const [name, forward] of forwards) process.removeListener(name, forward);
117
+ if (signal !== null && process.platform !== "win32") {
118
+ process.kill(process.pid, signal);
119
+ } else {
120
+ process.exit(status === null ? 1 : status);
121
+ }
122
+ });
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "@sprawling/mei",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.17-pre.261115",
4
+ "description": "Archetype:Mei, an academic minimal Agent Harness prototype for secondary development and technical discussion.",
5
+ "license": "MPL-2.0",
6
+ "repository": { "type": "git", "url": "git+https://github.com/2youg1/sprawling-agents.git" },
7
+ "homepage": "https://github.com/2youg1/sprawling-agents",
8
+ "bin": { "mei": "bin/mei.js", "mei-runtime": "bin/mei.cmd" },
9
+ "files": ["bin"],
10
+ "optionalDependencies": {
11
+ "@sprawling/mei-darwin-arm64": "0.0.17-pre.261115",
12
+ "@sprawling/mei-linux-x64-musl": "0.0.17-pre.261115"
13
+ }
14
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.