@automagik/omni 2.260430.10 → 2.260430.12

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.10",
114082
+ version: "2.260430.12",
114083
114083
  description: "LLM-optimized CLI for Omni",
114084
114084
  type: "module",
114085
114085
  bin: {
@@ -126191,6 +126191,59 @@ function createWhereCommand() {
126191
126191
  init_config();
126192
126192
  init_output();
126193
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
+
126194
126247
  // src/status.ts
126195
126248
  init_source();
126196
126249
  init_config();
@@ -126782,6 +126835,7 @@ program2.configureOutput({
126782
126835
  originalWriteErr(str);
126783
126836
  }
126784
126837
  });
126838
+ selfHealManifestPin();
126785
126839
  var argv = process.argv.slice(2);
126786
126840
  var isRootVersionOnly = argv.length > 0 && argv.every((arg) => arg === "--version" || arg === "-V");
126787
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.10",
224559
+ version: "2.260430.12",
224560
224560
  type: "module",
224561
224561
  exports: {
224562
224562
  ".": {
@@ -284814,13 +284814,13 @@ async function applyCloseContactGate(services, chatRecordId, instanceId, chatId,
284814
284814
  if (!Number.isFinite(closeUntilMs))
284815
284815
  return "pass";
284816
284816
  if (Date.now() < closeUntilMs) {
284817
- log95.debug("Chat in close cooldown, skipping dispatch", {
284817
+ log95.debug("Chat in soft close cooldown, follow-up disarmed but agent reactive", {
284818
284818
  instanceId,
284819
284819
  chatId,
284820
284820
  closeUntil: chatSettings.closeUntil,
284821
284821
  outcome: chatSettings.closeOutcome ?? null
284822
284822
  });
284823
- return "skip";
284823
+ return "pass";
284824
284824
  }
284825
284825
  if (!chatRecordId)
284826
284826
  return "pass";
@@ -284833,7 +284833,7 @@ async function applyCloseContactGate(services, chatRecordId, instanceId, chatId,
284833
284833
  agentResumedAt: new Date().toISOString()
284834
284834
  }
284835
284835
  });
284836
- log95.info("Close cooldown expired, agent reopened", {
284836
+ log95.info("Close cooldown expired, state cleaned", {
284837
284837
  instanceId,
284838
284838
  chatId,
284839
284839
  closeOutcome: chatSettings.closeOutcome ?? null
@@ -301417,10 +301417,11 @@ var init_messages5 = __esm(() => {
301417
301417
  }
301418
301418
  }).returning();
301419
301419
  const { terminal, escalated, closeUntil } = await computeCloseContactTerminalState(db2, data.chatId, outcome, auditRow?.id ?? null);
301420
+ const shouldPauseAgent = outcome === "lost";
301420
301421
  const closedAt = new Date;
301421
301422
  await services.chats.update(data.chatId, {
301422
301423
  settings: {
301423
- agentPaused: true,
301424
+ ...shouldPauseAgent ? { agentPaused: true } : {},
301424
301425
  closed: terminal,
301425
301426
  closeUntil: closeUntil?.toISOString() ?? null,
301426
301427
  closeOutcome: outcome
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260430.10",
3
+ "version": "2.260430.12",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,15 +51,15 @@
51
51
  "qrcode-terminal": "^0.12.0"
52
52
  },
53
53
  "devDependencies": {
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",
54
+ "@omni/api": "2.260430.11",
55
+ "@omni/channel-discord": "2.260430.11",
56
+ "@omni/channel-gupshup": "2.260430.11",
57
+ "@omni/channel-sdk": "2.260430.11",
58
+ "@omni/channel-slack": "2.260430.11",
59
+ "@omni/channel-telegram": "2.260430.11",
60
+ "@omni/channel-whatsapp": "2.260430.11",
61
+ "@omni/core": "2.260430.11",
62
+ "@omni/sdk": "2.260430.11",
63
63
  "@types/node": "^22.10.3",
64
64
  "@types/qrcode-terminal": "^0.12.2",
65
65
  "typescript": "^5.7.3"