@automagik/omni 2.260430.9 → 2.260430.11

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 CHANGED
@@ -78097,7 +78097,7 @@ var require_path = __commonJS((exports) => {
78097
78097
  function isAbsolute(path) {
78098
78098
  return path.charAt(0) === "/";
78099
78099
  }
78100
- function join14(...args) {
78100
+ function join15(...args) {
78101
78101
  return normalizePath(args.join("/"));
78102
78102
  }
78103
78103
  function dirname6(path) {
@@ -78122,7 +78122,7 @@ var require_path = __commonJS((exports) => {
78122
78122
  exports.basename = basename6;
78123
78123
  exports.dirname = dirname6;
78124
78124
  exports.isAbsolute = isAbsolute;
78125
- exports.join = join14;
78125
+ exports.join = join15;
78126
78126
  exports.normalizePath = normalizePath;
78127
78127
  exports.relative = relative;
78128
78128
  exports.resolve = resolve4;
@@ -98883,7 +98883,7 @@ var require_otel = __commonJS((exports, module) => {
98883
98883
  var { InstrumentationBase } = require_src16();
98884
98884
  var {
98885
98885
  version: PACKAGE_VERSION,
98886
- name: PACKAGE_NAME2
98886
+ name: PACKAGE_NAME3
98887
98887
  } = require_package();
98888
98888
  var SUPPORTED_VERSIONS = ">=4.0.0 <6";
98889
98889
  var FASTIFY_HOOKS = [
@@ -98921,8 +98921,8 @@ var require_otel = __commonJS((exports, module) => {
98921
98921
  _requestHook = null;
98922
98922
  _lifecycleHook = null;
98923
98923
  constructor(config2) {
98924
- super(PACKAGE_NAME2, PACKAGE_VERSION, config2);
98925
- this.logger = diag.createComponentLogger({ namespace: PACKAGE_NAME2 });
98924
+ super(PACKAGE_NAME3, PACKAGE_VERSION, config2);
98925
+ this.logger = diag.createComponentLogger({ namespace: PACKAGE_NAME3 });
98926
98926
  this[kIgnorePaths] = null;
98927
98927
  this[kRecordExceptions] = true;
98928
98928
  if (config2?.recordExceptions != null) {
@@ -99376,7 +99376,7 @@ var require_instrumentation7 = __commonJS((exports) => {
99376
99376
  var AttributeNames = require_AttributeNames3();
99377
99377
  var utils4 = require_utils22();
99378
99378
  var PACKAGE_VERSION = "0.1.0";
99379
- var PACKAGE_NAME2 = "@sentry/instrumentation-fastify-v3";
99379
+ var PACKAGE_NAME3 = "@sentry/instrumentation-fastify-v3";
99380
99380
  var ANONYMOUS_NAME = "anonymous";
99381
99381
  var hooksNamesToWrap = new Set([
99382
99382
  "onTimeout",
@@ -99392,7 +99392,7 @@ var require_instrumentation7 = __commonJS((exports) => {
99392
99392
 
99393
99393
  class FastifyInstrumentationV3 extends instrumentation.InstrumentationBase {
99394
99394
  constructor(config2 = {}) {
99395
- super(PACKAGE_NAME2, PACKAGE_VERSION, config2);
99395
+ super(PACKAGE_NAME3, PACKAGE_VERSION, config2);
99396
99396
  }
99397
99397
  init() {
99398
99398
  return [
@@ -107256,12 +107256,12 @@ var require_instrumentation21 = __commonJS((exports) => {
107256
107256
  var instrumentation = require_src6();
107257
107257
  var core = require_cjs();
107258
107258
  var constants = require_constants14();
107259
- var PACKAGE_NAME2 = "@sentry/instrumentation-hono";
107259
+ var PACKAGE_NAME3 = "@sentry/instrumentation-hono";
107260
107260
  var PACKAGE_VERSION = "0.0.1";
107261
107261
 
107262
107262
  class HonoInstrumentation extends instrumentation.InstrumentationBase {
107263
107263
  constructor(config2 = {}) {
107264
- super(PACKAGE_NAME2, PACKAGE_VERSION, config2);
107264
+ super(PACKAGE_NAME3, PACKAGE_VERSION, config2);
107265
107265
  }
107266
107266
  init() {
107267
107267
  return [
@@ -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.9",
114082
+ version: "2.260430.11",
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",
@@ -126190,6 +126191,59 @@ function createWhereCommand() {
126190
126191
  init_config();
126191
126192
  init_output();
126192
126193
 
126194
+ // src/manifest-pin.ts
126195
+ import { existsSync as existsSync15, readFileSync as readFileSync10, renameSync as renameSync2, writeFileSync as writeFileSync8 } from "fs";
126196
+ import { homedir as homedir10 } from "os";
126197
+ import { join as join14 } from "path";
126198
+ var PACKAGE_NAME2 = "@automagik/omni";
126199
+ var BUN_GLOBAL_MANIFEST = join14(homedir10(), ".bun", "install", "global", "package.json");
126200
+ function pinManifestEntry(manifestPath, exactVersion) {
126201
+ if (!existsSync15(manifestPath))
126202
+ return false;
126203
+ let manifest;
126204
+ try {
126205
+ manifest = JSON.parse(readFileSync10(manifestPath, "utf-8"));
126206
+ } catch {
126207
+ return false;
126208
+ }
126209
+ if (!manifest || typeof manifest !== "object" || Array.isArray(manifest))
126210
+ return false;
126211
+ let changed = false;
126212
+ for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
126213
+ const deps = manifest[field];
126214
+ if (!deps || typeof deps !== "object" || Array.isArray(deps))
126215
+ continue;
126216
+ const depMap = deps;
126217
+ const current = depMap[PACKAGE_NAME2];
126218
+ if (typeof current !== "string")
126219
+ continue;
126220
+ if (!current.startsWith("^") && !current.startsWith("~"))
126221
+ continue;
126222
+ if (current === exactVersion)
126223
+ continue;
126224
+ depMap[PACKAGE_NAME2] = exactVersion;
126225
+ changed = true;
126226
+ }
126227
+ if (!changed)
126228
+ return false;
126229
+ const tmp = `${manifestPath}.tmp.${process.pid}`;
126230
+ try {
126231
+ writeFileSync8(tmp, `${JSON.stringify(manifest, null, 2)}
126232
+ `, { mode: 420 });
126233
+ renameSync2(tmp, manifestPath);
126234
+ } catch {
126235
+ return false;
126236
+ }
126237
+ return true;
126238
+ }
126239
+ function selfHealManifestPin() {
126240
+ if (process.env.OMNI_SKIP_POSTINSTALL_PIN === "1")
126241
+ return;
126242
+ try {
126243
+ pinManifestEntry(BUN_GLOBAL_MANIFEST, VERSION);
126244
+ } catch {}
126245
+ }
126246
+
126193
126247
  // src/status.ts
126194
126248
  init_source();
126195
126249
  init_config();
@@ -126781,6 +126835,7 @@ program2.configureOutput({
126781
126835
  originalWriteErr(str);
126782
126836
  }
126783
126837
  });
126838
+ selfHealManifestPin();
126784
126839
  var argv = process.argv.slice(2);
126785
126840
  var isRootVersionOnly = argv.length > 0 && argv.every((arg) => arg === "--version" || arg === "-V");
126786
126841
  if (isRootVersionOnly) {
@@ -0,0 +1,63 @@
1
+ /**
2
+ * CLI startup self-heal for the @automagik/omni semver-drift footgun.
3
+ *
4
+ * Background
5
+ * ----------
6
+ * Omni's version scheme is `2.YYMMDD.X`. The legacy scheme used 8-digit
7
+ * `YYYYMMDD` minors (`2.20260221.x`). Semver compares minors as integers,
8
+ * so `^2.260430.10` resolves to `2.20260221.1` because 20260221 > 260430.
9
+ *
10
+ * The package's own `postinstall` hook (scripts/postinstall-pin-version.cjs)
11
+ * tries to rewrite the global manifest from `^2.260430.10` to
12
+ * `2.260430.10` (exact). But bun's install lifecycle writes the final
13
+ * manifest entry AFTER running postinstall, so the postinstall pin gets
14
+ * overwritten by the original install. Empirically:
15
+ *
16
+ * T+0 bun resolves @automagik/omni@next → 2.260430.10
17
+ * T+1 bun extracts tarball
18
+ * T+2 postinstall fires; rewrites manifest to "2.260430.10" ✅
19
+ * T+3 bun finalizes, writes manifest "@automagik/omni": "^2.260430.10" ❌
20
+ *
21
+ * This module is the second leg: every time the omni CLI starts, it
22
+ * checks the global manifest and self-pins if it sees a caret/tilde
23
+ * range. The pin happens NATURALLY after install because the operator's
24
+ * very first `omni …` invocation post-install fires this code. From
25
+ * that point on, no range is ever in the manifest.
26
+ *
27
+ * Why not just spawn a detached subprocess from postinstall?
28
+ * - Race-prone: relies on guessing how long bun's manifest write takes.
29
+ * - Confusing in logs: a stray child process appears to outlive the
30
+ * parent shell.
31
+ * - Less observable: the operator doesn't see what's happening.
32
+ *
33
+ * The CLI-startup approach is deterministic, observable (logs to stderr
34
+ * once), and idempotent (a no-op when the pin is already exact).
35
+ *
36
+ * Performance
37
+ * -----------
38
+ * - One stat + one JSON parse on every invocation. ~1ms typical.
39
+ * - When a pin needs writing, one tmp-write + rename. <5ms typical.
40
+ * - Bypassed entirely when env `OMNI_SKIP_POSTINSTALL_PIN=1` is set
41
+ * (same opt-out as the postinstall hook).
42
+ *
43
+ * Removal
44
+ * -------
45
+ * When the legacy `2.20260218–2.20260221` versions are deprecated /
46
+ * unpublished, this becomes a no-op safely. Delete the file at that
47
+ * point and remove the call from index.ts.
48
+ */
49
+ /**
50
+ * Replace `"@automagik/omni": "^X.Y.Z"` with the exact version in the
51
+ * given manifest path. No-op when the entry is already exact, missing,
52
+ * or a non-range spec (file:, git+, tarball URL).
53
+ *
54
+ * Returns true when a write occurred. Exported for tests.
55
+ */
56
+ export declare function pinManifestEntry(manifestPath: string, exactVersion: string): boolean;
57
+ /**
58
+ * Run the self-heal on omni CLI startup. Best-effort, never throws,
59
+ * never blocks. Safe to call early in `index.ts` before commander
60
+ * parses argv.
61
+ */
62
+ export declare function selfHealManifestPin(): void;
63
+ //# sourceMappingURL=manifest-pin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-pin.d.ts","sourceRoot":"","sources":["../src/manifest-pin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAUH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CA2CpF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAO1C"}
@@ -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.9",
224559
+ version: "2.260430.11",
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.9",
3
+ "version": "2.260430.11",
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.8",
54
- "@omni/channel-discord": "2.260430.8",
55
- "@omni/channel-gupshup": "2.260430.8",
56
- "@omni/channel-sdk": "2.260430.8",
57
- "@omni/channel-slack": "2.260430.8",
58
- "@omni/channel-telegram": "2.260430.8",
59
- "@omni/channel-whatsapp": "2.260430.8",
60
- "@omni/core": "2.260430.8",
61
- "@omni/sdk": "2.260430.8",
54
+ "@omni/api": "2.260430.10",
55
+ "@omni/channel-discord": "2.260430.10",
56
+ "@omni/channel-gupshup": "2.260430.10",
57
+ "@omni/channel-sdk": "2.260430.10",
58
+ "@omni/channel-slack": "2.260430.10",
59
+ "@omni/channel-telegram": "2.260430.10",
60
+ "@omni/channel-whatsapp": "2.260430.10",
61
+ "@omni/core": "2.260430.10",
62
+ "@omni/sdk": "2.260430.10",
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);