@automagik/omni 2.260430.9 → 2.260430.10
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/index.js +3 -2
- package/dist/server/index.js +1 -1
- package/package.json +12 -11
- package/scripts/postinstall-pin-version.cjs +187 -0
package/dist/index.js
CHANGED
|
@@ -114079,7 +114079,7 @@ import { fileURLToPath } from "url";
|
|
|
114079
114079
|
// package.json
|
|
114080
114080
|
var package_default = {
|
|
114081
114081
|
name: "@automagik/omni",
|
|
114082
|
-
version: "2.260430.
|
|
114082
|
+
version: "2.260430.10",
|
|
114083
114083
|
description: "LLM-optimized CLI for Omni",
|
|
114084
114084
|
type: "module",
|
|
114085
114085
|
bin: {
|
|
@@ -114097,7 +114097,7 @@ var package_default = {
|
|
|
114097
114097
|
import: "./dist/sdk/index.js"
|
|
114098
114098
|
}
|
|
114099
114099
|
},
|
|
114100
|
-
files: ["dist", "bin", "db"],
|
|
114100
|
+
files: ["dist", "bin", "db", "scripts/postinstall-pin-version.cjs"],
|
|
114101
114101
|
publishConfig: {
|
|
114102
114102
|
access: "public"
|
|
114103
114103
|
},
|
|
@@ -114108,6 +114108,7 @@ var package_default = {
|
|
|
114108
114108
|
dev: "echo 'CLI package - no dev server (use: bun run ./src/index.ts <command>)'",
|
|
114109
114109
|
typecheck: "tsc --noEmit",
|
|
114110
114110
|
test: "bun test",
|
|
114111
|
+
postinstall: "node scripts/postinstall-pin-version.cjs",
|
|
114111
114112
|
"test:integration": "RUN_INTEGRATION_TESTS=1 bun test",
|
|
114112
114113
|
clean: "rm -rf dist db",
|
|
114113
114114
|
"build:server": "bun build src/bundled-server-entry.ts --outdir dist/server --entry-naming 'index.[ext]' --asset-naming '[name].[ext]' --target bun --external @anthropic-ai/claude-agent-sdk --external @snazzah/davey --external libsodium-wrappers --external opusscript --external pdf-parse --external mammoth --external exceljs",
|
package/dist/server/index.js
CHANGED
|
@@ -224556,7 +224556,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
224556
224556
|
var require_package8 = __commonJS((exports, module) => {
|
|
224557
224557
|
module.exports = {
|
|
224558
224558
|
name: "@omni/api",
|
|
224559
|
-
version: "2.260430.
|
|
224559
|
+
version: "2.260430.10",
|
|
224560
224560
|
type: "module",
|
|
224561
224561
|
exports: {
|
|
224562
224562
|
".": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automagik/omni",
|
|
3
|
-
"version": "2.260430.
|
|
3
|
+
"version": "2.260430.10",
|
|
4
4
|
"description": "LLM-optimized CLI for Omni",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"import": "./dist/sdk/index.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"files": ["dist", "bin", "db"],
|
|
21
|
+
"files": ["dist", "bin", "db", "scripts/postinstall-pin-version.cjs"],
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dev": "echo 'CLI package - no dev server (use: bun run ./src/index.ts <command>)'",
|
|
30
30
|
"typecheck": "tsc --noEmit",
|
|
31
31
|
"test": "bun test",
|
|
32
|
+
"postinstall": "node scripts/postinstall-pin-version.cjs",
|
|
32
33
|
"test:integration": "RUN_INTEGRATION_TESTS=1 bun test",
|
|
33
34
|
"clean": "rm -rf dist db",
|
|
34
35
|
"build:server": "bun build src/bundled-server-entry.ts --outdir dist/server --entry-naming 'index.[ext]' --asset-naming '[name].[ext]' --target bun --external @anthropic-ai/claude-agent-sdk --external @snazzah/davey --external libsodium-wrappers --external opusscript --external pdf-parse --external mammoth --external exceljs",
|
|
@@ -50,15 +51,15 @@
|
|
|
50
51
|
"qrcode-terminal": "^0.12.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
|
-
"@omni/api": "2.260430.
|
|
54
|
-
"@omni/channel-discord": "2.260430.
|
|
55
|
-
"@omni/channel-gupshup": "2.260430.
|
|
56
|
-
"@omni/channel-sdk": "2.260430.
|
|
57
|
-
"@omni/channel-slack": "2.260430.
|
|
58
|
-
"@omni/channel-telegram": "2.260430.
|
|
59
|
-
"@omni/channel-whatsapp": "2.260430.
|
|
60
|
-
"@omni/core": "2.260430.
|
|
61
|
-
"@omni/sdk": "2.260430.
|
|
54
|
+
"@omni/api": "2.260430.9",
|
|
55
|
+
"@omni/channel-discord": "2.260430.9",
|
|
56
|
+
"@omni/channel-gupshup": "2.260430.9",
|
|
57
|
+
"@omni/channel-sdk": "2.260430.9",
|
|
58
|
+
"@omni/channel-slack": "2.260430.9",
|
|
59
|
+
"@omni/channel-telegram": "2.260430.9",
|
|
60
|
+
"@omni/channel-whatsapp": "2.260430.9",
|
|
61
|
+
"@omni/core": "2.260430.9",
|
|
62
|
+
"@omni/sdk": "2.260430.9",
|
|
62
63
|
"@types/node": "^22.10.3",
|
|
63
64
|
"@types/qrcode-terminal": "^0.12.2",
|
|
64
65
|
"typescript": "^5.7.3"
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* postinstall-pin-version.cjs
|
|
4
|
+
*
|
|
5
|
+
* Self-heal the global package.json caret range that triggers the
|
|
6
|
+
* "version drift back to 2.20260221.x" footgun.
|
|
7
|
+
*
|
|
8
|
+
* Background
|
|
9
|
+
* ----------
|
|
10
|
+
* Omni's version scheme is `2.YYMMDD.X` (e.g. `2.260430.7`). The legacy
|
|
11
|
+
* scheme used 8-digit YYYYMMDD minors (e.g. `2.20260221.1`). Semver
|
|
12
|
+
* compares minors numerically:
|
|
13
|
+
*
|
|
14
|
+
* 2.260430.7 → MINOR = 260430
|
|
15
|
+
* 2.20260221.1 → MINOR = 20260221 ← 77× larger
|
|
16
|
+
*
|
|
17
|
+
* So `^2.260430.7` in a package.json semver-resolves to
|
|
18
|
+
* `2.20260221.1` (legacy version still on the registry). Every range-
|
|
19
|
+
* resolving install (e.g. plain `bun install -g`, or any tool that
|
|
20
|
+
* re-resolves the global manifest) flips the install backward.
|
|
21
|
+
*
|
|
22
|
+
* What this script does
|
|
23
|
+
* ---------------------
|
|
24
|
+
* On every `bun add -g @automagik/omni` / `npm install -g
|
|
25
|
+
* @automagik/omni`, this postinstall runs and rewrites the
|
|
26
|
+
* `@automagik/omni` entry in the global manifest from a caret range to
|
|
27
|
+
* an exact pin (`"2.260430.7"` no `^`). That stops the drift at the
|
|
28
|
+
* source — operators don't need to remember `--exact`, and any later
|
|
29
|
+
* range-resolve sees the exact version they last installed.
|
|
30
|
+
*
|
|
31
|
+
* Where this script writes
|
|
32
|
+
* ------------------------
|
|
33
|
+
* - `~/.bun/install/global/package.json` (bun's global manifest)
|
|
34
|
+
* - `<npm root -g>/package.json` (only if it exists; npm's global
|
|
35
|
+
* install layout doesn't always include this file)
|
|
36
|
+
*
|
|
37
|
+
* Hardening
|
|
38
|
+
* ---------
|
|
39
|
+
* - Best-effort: NEVER fails the install. Any error → log to stderr
|
|
40
|
+
* and exit 0. The install proceeds; the operator can still pin
|
|
41
|
+
* manually.
|
|
42
|
+
* - Idempotent: writing the same file twice is a no-op.
|
|
43
|
+
* - Touches ONLY `@automagik/omni` — leaves other dependencies alone.
|
|
44
|
+
* - No-op when run inside the package's own dev tree (workspace
|
|
45
|
+
* install): we detect via the absence of the global manifest path.
|
|
46
|
+
* - No-op when env `OMNI_SKIP_POSTINSTALL_PIN=1` (escape hatch for
|
|
47
|
+
* CI / testers / downstream packagers who pin via their own tooling).
|
|
48
|
+
*
|
|
49
|
+
* Removal
|
|
50
|
+
* -------
|
|
51
|
+
* When the legacy `2.20260218–2.20260221` versions are deprecated or
|
|
52
|
+
* unpublished from the registry (the proper fix), this script becomes a
|
|
53
|
+
* no-op safely. It can be removed at that point.
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
'use strict';
|
|
57
|
+
|
|
58
|
+
const fs = require('node:fs');
|
|
59
|
+
const path = require('node:path');
|
|
60
|
+
const os = require('node:os');
|
|
61
|
+
|
|
62
|
+
const PACKAGE_NAME = '@automagik/omni';
|
|
63
|
+
|
|
64
|
+
function log(msg) {
|
|
65
|
+
// Stderr only so JSON tooling consuming stdout stays clean.
|
|
66
|
+
process.stderr.write(`[omni postinstall] ${msg}\n`);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function readJson(filePath) {
|
|
70
|
+
try {
|
|
71
|
+
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
72
|
+
} catch (_err) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function writeJsonAtomic(filePath, data) {
|
|
78
|
+
const tmp = `${filePath}.tmp.${process.pid}`;
|
|
79
|
+
fs.writeFileSync(tmp, `${JSON.stringify(data, null, 2)}\n`, { mode: 0o644 });
|
|
80
|
+
fs.renameSync(tmp, filePath);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Replace `"@automagik/omni": "^X.Y.Z"` with the exact version. Returns
|
|
85
|
+
* true when a change was applied, false otherwise.
|
|
86
|
+
*/
|
|
87
|
+
function pinInManifest(manifestPath, exactVersion) {
|
|
88
|
+
if (!fs.existsSync(manifestPath)) return false;
|
|
89
|
+
const manifest = readJson(manifestPath);
|
|
90
|
+
if (!manifest || typeof manifest !== 'object') return false;
|
|
91
|
+
|
|
92
|
+
let changed = false;
|
|
93
|
+
for (const field of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
|
|
94
|
+
const deps = manifest[field];
|
|
95
|
+
if (!deps || typeof deps !== 'object') continue;
|
|
96
|
+
const current = deps[PACKAGE_NAME];
|
|
97
|
+
if (typeof current !== 'string') continue;
|
|
98
|
+
// Skip when already exact OR when not a caret range (e.g. a tarball
|
|
99
|
+
// URL, git ref, file: spec, or workspace marker — none of these are
|
|
100
|
+
// affected by the legacy-version-resolve-up bug).
|
|
101
|
+
if (!current.startsWith('^') && !current.startsWith('~')) continue;
|
|
102
|
+
if (current === exactVersion) continue;
|
|
103
|
+
deps[PACKAGE_NAME] = exactVersion;
|
|
104
|
+
changed = true;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (changed) {
|
|
108
|
+
writeJsonAtomic(manifestPath, manifest);
|
|
109
|
+
}
|
|
110
|
+
return changed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function getOurVersion() {
|
|
114
|
+
// package.json sits one directory up from this script (packages/cli/
|
|
115
|
+
// when running from source, or the package root when running from
|
|
116
|
+
// npm-installed tarball — same relative layout in both).
|
|
117
|
+
const pkgPath = path.resolve(__dirname, '..', 'package.json');
|
|
118
|
+
const pkg = readJson(pkgPath);
|
|
119
|
+
if (!pkg || typeof pkg.version !== 'string') return null;
|
|
120
|
+
return pkg.version;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function getNpmGlobalRoot() {
|
|
124
|
+
// Best-effort: shell out to npm root -g. Cap a short timeout so a
|
|
125
|
+
// hung npm doesn't block the install pipeline.
|
|
126
|
+
try {
|
|
127
|
+
const { execFileSync } = require('node:child_process');
|
|
128
|
+
const out = execFileSync('npm', ['root', '-g'], { encoding: 'utf8', timeout: 3000 });
|
|
129
|
+
return out.trim();
|
|
130
|
+
} catch {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function main() {
|
|
136
|
+
if (process.env.OMNI_SKIP_POSTINSTALL_PIN === '1') {
|
|
137
|
+
return; // operator opt-out
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const ourVersion = getOurVersion();
|
|
141
|
+
if (!ourVersion) {
|
|
142
|
+
log('skipped: could not read own package version');
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const targets = [];
|
|
147
|
+
|
|
148
|
+
// bun global manifest
|
|
149
|
+
const bunGlobalManifest = path.join(os.homedir(), '.bun', 'install', 'global', 'package.json');
|
|
150
|
+
targets.push({ label: 'bun', path: bunGlobalManifest });
|
|
151
|
+
|
|
152
|
+
// npm global manifest (only if `npm` is installed)
|
|
153
|
+
const npmRoot = getNpmGlobalRoot();
|
|
154
|
+
if (npmRoot) {
|
|
155
|
+
targets.push({ label: 'npm', path: path.join(npmRoot, '..', 'package.json') });
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
let pinned = 0;
|
|
159
|
+
for (const target of targets) {
|
|
160
|
+
try {
|
|
161
|
+
if (pinInManifest(target.path, ourVersion)) {
|
|
162
|
+
log(`pinned ${PACKAGE_NAME} to ${ourVersion} in ${target.label} global manifest (${target.path})`);
|
|
163
|
+
pinned += 1;
|
|
164
|
+
}
|
|
165
|
+
} catch (err) {
|
|
166
|
+
// Never fail the install. Surface the reason for diagnosis but
|
|
167
|
+
// exit 0 below.
|
|
168
|
+
log(`warning: could not pin ${target.label} manifest at ${target.path}: ${err?.message ? err.message : err}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (pinned === 0) {
|
|
173
|
+
// Either no global manifest had a caret entry (already pinned, or
|
|
174
|
+
// installed via a path that doesn't write to package.json), or the
|
|
175
|
+
// package isn't in any global manifest. Either way: no-op is fine.
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
try {
|
|
180
|
+
main();
|
|
181
|
+
} catch (err) {
|
|
182
|
+
// Last-resort safety net. The install MUST NOT fail because of this
|
|
183
|
+
// script.
|
|
184
|
+
process.stderr.write(`[omni postinstall] unexpected error (non-fatal): ${err?.stack ? err.stack : err}\n`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
process.exit(0);
|