@ironbee-ai/cli 0.5.3 → 0.6.1

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.
Files changed (135) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/clients/claude/hooks/require-verification.d.ts.map +1 -1
  3. package/dist/clients/claude/hooks/require-verification.js +21 -2
  4. package/dist/clients/claude/hooks/require-verification.js.map +1 -1
  5. package/dist/clients/claude/hooks/session-end.d.ts.map +1 -1
  6. package/dist/clients/claude/hooks/session-end.js +4 -0
  7. package/dist/clients/claude/hooks/session-end.js.map +1 -1
  8. package/dist/clients/claude/hooks/session-start.d.ts.map +1 -1
  9. package/dist/clients/claude/hooks/session-start.js +14 -4
  10. package/dist/clients/claude/hooks/session-start.js.map +1 -1
  11. package/dist/clients/claude/hooks/track-action.d.ts +25 -4
  12. package/dist/clients/claude/hooks/track-action.d.ts.map +1 -1
  13. package/dist/clients/claude/hooks/track-action.js +145 -25
  14. package/dist/clients/claude/hooks/track-action.js.map +1 -1
  15. package/dist/clients/claude/hooks/verify-gate.d.ts.map +1 -1
  16. package/dist/clients/claude/hooks/verify-gate.js +5 -0
  17. package/dist/clients/claude/hooks/verify-gate.js.map +1 -1
  18. package/dist/clients/claude/index.d.ts.map +1 -1
  19. package/dist/clients/claude/index.js +18 -1
  20. package/dist/clients/claude/index.js.map +1 -1
  21. package/dist/clients/claude/util.d.ts +74 -0
  22. package/dist/clients/claude/util.d.ts.map +1 -0
  23. package/dist/clients/claude/util.js +352 -0
  24. package/dist/clients/claude/util.js.map +1 -0
  25. package/dist/clients/cursor/hooks/require-verification.d.ts.map +1 -1
  26. package/dist/clients/cursor/hooks/require-verification.js +18 -2
  27. package/dist/clients/cursor/hooks/require-verification.js.map +1 -1
  28. package/dist/clients/cursor/hooks/session-end.d.ts.map +1 -1
  29. package/dist/clients/cursor/hooks/session-end.js +4 -0
  30. package/dist/clients/cursor/hooks/session-end.js.map +1 -1
  31. package/dist/clients/cursor/hooks/session-start.d.ts.map +1 -1
  32. package/dist/clients/cursor/hooks/session-start.js +4 -1
  33. package/dist/clients/cursor/hooks/session-start.js.map +1 -1
  34. package/dist/clients/cursor/hooks/track-action.d.ts +30 -8
  35. package/dist/clients/cursor/hooks/track-action.d.ts.map +1 -1
  36. package/dist/clients/cursor/hooks/track-action.js +179 -52
  37. package/dist/clients/cursor/hooks/track-action.js.map +1 -1
  38. package/dist/clients/cursor/hooks/verify-gate.d.ts.map +1 -1
  39. package/dist/clients/cursor/hooks/verify-gate.js +4 -0
  40. package/dist/clients/cursor/hooks/verify-gate.js.map +1 -1
  41. package/dist/clients/cursor/index.d.ts.map +1 -1
  42. package/dist/clients/cursor/index.js +13 -2
  43. package/dist/clients/cursor/index.js.map +1 -1
  44. package/dist/clients/cursor/util.d.ts +52 -0
  45. package/dist/clients/cursor/util.d.ts.map +1 -0
  46. package/dist/clients/cursor/util.js +264 -0
  47. package/dist/clients/cursor/util.js.map +1 -0
  48. package/dist/commands/hook.js +1 -2
  49. package/dist/commands/hook.js.map +1 -1
  50. package/dist/commands/process-job-file.d.ts +10 -0
  51. package/dist/commands/process-job-file.d.ts.map +1 -0
  52. package/dist/commands/process-job-file.js +19 -0
  53. package/dist/commands/process-job-file.js.map +1 -0
  54. package/dist/commands/queue.d.ts +12 -0
  55. package/dist/commands/queue.d.ts.map +1 -0
  56. package/dist/commands/queue.js +495 -0
  57. package/dist/commands/queue.js.map +1 -0
  58. package/dist/hooks/core/actions.d.ts +73 -2
  59. package/dist/hooks/core/actions.d.ts.map +1 -1
  60. package/dist/hooks/core/actions.js +36 -2
  61. package/dist/hooks/core/actions.js.map +1 -1
  62. package/dist/hooks/core/session-state.d.ts +27 -0
  63. package/dist/hooks/core/session-state.d.ts.map +1 -1
  64. package/dist/hooks/core/session-state.js +97 -0
  65. package/dist/hooks/core/session-state.js.map +1 -1
  66. package/dist/hooks/core/verify-gate.d.ts.map +1 -1
  67. package/dist/hooks/core/verify-gate.js +13 -5
  68. package/dist/hooks/core/verify-gate.js.map +1 -1
  69. package/dist/index.js +12 -3
  70. package/dist/index.js.map +1 -1
  71. package/dist/lib/collector.d.ts +62 -3
  72. package/dist/lib/collector.d.ts.map +1 -1
  73. package/dist/lib/collector.js +107 -35
  74. package/dist/lib/collector.js.map +1 -1
  75. package/dist/lib/config.d.ts +72 -8
  76. package/dist/lib/config.d.ts.map +1 -1
  77. package/dist/lib/config.js +40 -0
  78. package/dist/lib/config.js.map +1 -1
  79. package/dist/queue/dead-letter.d.ts +26 -0
  80. package/dist/queue/dead-letter.d.ts.map +1 -0
  81. package/dist/queue/dead-letter.js +233 -0
  82. package/dist/queue/dead-letter.js.map +1 -0
  83. package/dist/queue/drain.d.ts +36 -0
  84. package/dist/queue/drain.d.ts.map +1 -0
  85. package/dist/queue/drain.js +170 -0
  86. package/dist/queue/drain.js.map +1 -0
  87. package/dist/queue/flush.d.ts +64 -0
  88. package/dist/queue/flush.d.ts.map +1 -0
  89. package/dist/queue/flush.js +119 -0
  90. package/dist/queue/flush.js.map +1 -0
  91. package/dist/queue/handlers/send-event.d.ts +23 -0
  92. package/dist/queue/handlers/send-event.d.ts.map +1 -0
  93. package/dist/queue/handlers/send-event.js +131 -0
  94. package/dist/queue/handlers/send-event.js.map +1 -0
  95. package/dist/queue/index.d.ts +30 -0
  96. package/dist/queue/index.d.ts.map +1 -0
  97. package/dist/queue/index.js +71 -0
  98. package/dist/queue/index.js.map +1 -0
  99. package/dist/queue/paths.d.ts +40 -0
  100. package/dist/queue/paths.d.ts.map +1 -0
  101. package/dist/queue/paths.js +107 -0
  102. package/dist/queue/paths.js.map +1 -0
  103. package/dist/queue/process-file.d.ts +22 -0
  104. package/dist/queue/process-file.d.ts.map +1 -0
  105. package/dist/queue/process-file.js +257 -0
  106. package/dist/queue/process-file.js.map +1 -0
  107. package/dist/queue/register-handlers.d.ts +26 -0
  108. package/dist/queue/register-handlers.d.ts.map +1 -0
  109. package/dist/queue/register-handlers.js +36 -0
  110. package/dist/queue/register-handlers.js.map +1 -0
  111. package/dist/queue/registry.d.ts +42 -0
  112. package/dist/queue/registry.d.ts.map +1 -0
  113. package/dist/queue/registry.js +36 -0
  114. package/dist/queue/registry.js.map +1 -0
  115. package/dist/queue/snapshot.d.ts +16 -0
  116. package/dist/queue/snapshot.d.ts.map +1 -0
  117. package/dist/queue/snapshot.js +39 -0
  118. package/dist/queue/snapshot.js.map +1 -0
  119. package/dist/queue/spawn.d.ts +15 -0
  120. package/dist/queue/spawn.d.ts.map +1 -0
  121. package/dist/queue/spawn.js +45 -0
  122. package/dist/queue/spawn.js.map +1 -0
  123. package/dist/queue/submit.d.ts +19 -0
  124. package/dist/queue/submit.d.ts.map +1 -0
  125. package/dist/queue/submit.js +94 -0
  126. package/dist/queue/submit.js.map +1 -0
  127. package/dist/queue/types.d.ts +77 -0
  128. package/dist/queue/types.d.ts.map +1 -0
  129. package/dist/queue/types.js +83 -0
  130. package/dist/queue/types.js.map +1 -0
  131. package/dist/queue/worker-log.d.ts +21 -0
  132. package/dist/queue/worker-log.d.ts.map +1 -0
  133. package/dist/queue/worker-log.js +140 -0
  134. package/dist/queue/worker-log.js.map +1 -0
  135. package/package.json +1 -1
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * IronBee CLI — Queue Module
4
+ *
5
+ * File-backed, crash-safe, concurrency-safe background job queue.
6
+ * Canonical spec: docs/job-queue.md.
7
+ *
8
+ * Public API:
9
+ * - submit(projectDir, sessionId, type, data, opts?) → job_id
10
+ * - snapshot(projectDir, sessionId) → snapshot_path | null
11
+ * - processFile(path, opts?) → void
12
+ * - drain(projectDir, sessionId, opts?) → DrainResult
13
+ * - register(type, handler) / unregister(type)
14
+ * - spawnDetachedWorker(snapshotPath)
15
+ *
16
+ * Error classes:
17
+ * InvalidSessionIdError, JobTooLargeError, IOError,
18
+ * TransientError, AuthError, BadRequestError, BadRequestBatchError
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.readDeadLetterEntries = exports.WORKER_LOG_ROTATED_REGEX = exports.DEAD_LETTER_ROTATED_REGEX = exports.SNAPSHOT_FILENAME_REGEX = exports.parseSnapshotPath = exports.workerLogFile = exports.deadLetterFile = exports.snapshotFile = exports.liveQueueFile = exports.queueDir = exports.sessionDir = exports.sessionsRoot = exports.validateSessionId = exports.resolveProjectDir = exports.MAX_LINE_BYTES = exports.BadRequestBatchError = exports.BadRequestError = exports.AuthError = exports.TransientError = exports.IOError = exports.JobTooLargeError = exports.InvalidSessionIdError = exports.snapshotRegistry = exports.getHandler = exports.clearRegistry = exports.unregister = exports.register = exports.SEND_EVENT_TYPE = exports.registerQueueHandlers = exports.DEFAULT_AUTO_FLUSH_SIZE_BYTES = exports.maybeAutoFlush = exports.flushSynchronously = exports.flushInBackground = exports.spawnDetachedWorker = exports.drain = exports.processFile = exports.snapshot = exports.submit = void 0;
22
+ var submit_1 = require("./submit");
23
+ Object.defineProperty(exports, "submit", { enumerable: true, get: function () { return submit_1.submit; } });
24
+ var snapshot_1 = require("./snapshot");
25
+ Object.defineProperty(exports, "snapshot", { enumerable: true, get: function () { return snapshot_1.snapshot; } });
26
+ var process_file_1 = require("./process-file");
27
+ Object.defineProperty(exports, "processFile", { enumerable: true, get: function () { return process_file_1.processFile; } });
28
+ var drain_1 = require("./drain");
29
+ Object.defineProperty(exports, "drain", { enumerable: true, get: function () { return drain_1.drain; } });
30
+ var spawn_1 = require("./spawn");
31
+ Object.defineProperty(exports, "spawnDetachedWorker", { enumerable: true, get: function () { return spawn_1.spawnDetachedWorker; } });
32
+ var flush_1 = require("./flush");
33
+ Object.defineProperty(exports, "flushInBackground", { enumerable: true, get: function () { return flush_1.flushInBackground; } });
34
+ Object.defineProperty(exports, "flushSynchronously", { enumerable: true, get: function () { return flush_1.flushSynchronously; } });
35
+ Object.defineProperty(exports, "maybeAutoFlush", { enumerable: true, get: function () { return flush_1.maybeAutoFlush; } });
36
+ Object.defineProperty(exports, "DEFAULT_AUTO_FLUSH_SIZE_BYTES", { enumerable: true, get: function () { return flush_1.DEFAULT_AUTO_FLUSH_SIZE_BYTES; } });
37
+ var register_handlers_1 = require("./register-handlers");
38
+ Object.defineProperty(exports, "registerQueueHandlers", { enumerable: true, get: function () { return register_handlers_1.registerQueueHandlers; } });
39
+ Object.defineProperty(exports, "SEND_EVENT_TYPE", { enumerable: true, get: function () { return register_handlers_1.SEND_EVENT_TYPE; } });
40
+ var registry_1 = require("./registry");
41
+ Object.defineProperty(exports, "register", { enumerable: true, get: function () { return registry_1.register; } });
42
+ Object.defineProperty(exports, "unregister", { enumerable: true, get: function () { return registry_1.unregister; } });
43
+ Object.defineProperty(exports, "clearRegistry", { enumerable: true, get: function () { return registry_1.clear; } });
44
+ Object.defineProperty(exports, "getHandler", { enumerable: true, get: function () { return registry_1.get; } });
45
+ Object.defineProperty(exports, "snapshotRegistry", { enumerable: true, get: function () { return registry_1.snapshotRegistry; } });
46
+ var types_1 = require("./types");
47
+ Object.defineProperty(exports, "InvalidSessionIdError", { enumerable: true, get: function () { return types_1.InvalidSessionIdError; } });
48
+ Object.defineProperty(exports, "JobTooLargeError", { enumerable: true, get: function () { return types_1.JobTooLargeError; } });
49
+ Object.defineProperty(exports, "IOError", { enumerable: true, get: function () { return types_1.IOError; } });
50
+ Object.defineProperty(exports, "TransientError", { enumerable: true, get: function () { return types_1.TransientError; } });
51
+ Object.defineProperty(exports, "AuthError", { enumerable: true, get: function () { return types_1.AuthError; } });
52
+ Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return types_1.BadRequestError; } });
53
+ Object.defineProperty(exports, "BadRequestBatchError", { enumerable: true, get: function () { return types_1.BadRequestBatchError; } });
54
+ Object.defineProperty(exports, "MAX_LINE_BYTES", { enumerable: true, get: function () { return types_1.MAX_LINE_BYTES; } });
55
+ var paths_1 = require("./paths");
56
+ Object.defineProperty(exports, "resolveProjectDir", { enumerable: true, get: function () { return paths_1.resolveProjectDir; } });
57
+ Object.defineProperty(exports, "validateSessionId", { enumerable: true, get: function () { return paths_1.validateSessionId; } });
58
+ Object.defineProperty(exports, "sessionsRoot", { enumerable: true, get: function () { return paths_1.sessionsRoot; } });
59
+ Object.defineProperty(exports, "sessionDir", { enumerable: true, get: function () { return paths_1.sessionDir; } });
60
+ Object.defineProperty(exports, "queueDir", { enumerable: true, get: function () { return paths_1.queueDir; } });
61
+ Object.defineProperty(exports, "liveQueueFile", { enumerable: true, get: function () { return paths_1.liveQueueFile; } });
62
+ Object.defineProperty(exports, "snapshotFile", { enumerable: true, get: function () { return paths_1.snapshotFile; } });
63
+ Object.defineProperty(exports, "deadLetterFile", { enumerable: true, get: function () { return paths_1.deadLetterFile; } });
64
+ Object.defineProperty(exports, "workerLogFile", { enumerable: true, get: function () { return paths_1.workerLogFile; } });
65
+ Object.defineProperty(exports, "parseSnapshotPath", { enumerable: true, get: function () { return paths_1.parseSnapshotPath; } });
66
+ Object.defineProperty(exports, "SNAPSHOT_FILENAME_REGEX", { enumerable: true, get: function () { return paths_1.SNAPSHOT_FILENAME_REGEX; } });
67
+ Object.defineProperty(exports, "DEAD_LETTER_ROTATED_REGEX", { enumerable: true, get: function () { return paths_1.DEAD_LETTER_ROTATED_REGEX; } });
68
+ Object.defineProperty(exports, "WORKER_LOG_ROTATED_REGEX", { enumerable: true, get: function () { return paths_1.WORKER_LOG_ROTATED_REGEX; } });
69
+ var dead_letter_1 = require("./dead-letter");
70
+ Object.defineProperty(exports, "readDeadLetterEntries", { enumerable: true, get: function () { return dead_letter_1.readDeadLetterEntries; } });
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/queue/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,mCAAiD;AAAxC,gGAAA,MAAM,OAAA;AACf,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAAiE;AAAxD,2GAAA,WAAW,OAAA;AACpB,iCAA2D;AAAlD,8FAAA,KAAK,OAAA;AACd,iCAA8C;AAArC,4GAAA,mBAAmB,OAAA;AAC5B,iCAA+G;AAAtG,0GAAA,iBAAiB,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,sHAAA,6BAA6B,OAAA;AAC7F,yDAA6E;AAApE,0HAAA,qBAAqB,OAAA;AAAE,oHAAA,eAAe,OAAA;AAC/C,uCAQoB;AALhB,oGAAA,QAAQ,OAAA;AACR,sGAAA,UAAU,OAAA;AACV,yGAAA,KAAK,OAAiB;AACtB,sGAAA,GAAG,OAAc;AACjB,4GAAA,gBAAgB,OAAA;AAEpB,iCAaiB;AAZb,8GAAA,qBAAqB,OAAA;AACrB,yGAAA,gBAAgB,OAAA;AAChB,gGAAA,OAAO,OAAA;AACP,uGAAA,cAAc,OAAA;AACd,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,6GAAA,oBAAoB,OAAA;AAKpB,uGAAA,cAAc,OAAA;AAElB,iCAciB;AAbb,0GAAA,iBAAiB,OAAA;AACjB,0GAAA,iBAAiB,OAAA;AACjB,qGAAA,YAAY,OAAA;AACZ,mGAAA,UAAU,OAAA;AACV,iGAAA,QAAQ,OAAA;AACR,sGAAA,aAAa,OAAA;AACb,qGAAA,YAAY,OAAA;AACZ,uGAAA,cAAc,OAAA;AACd,sGAAA,aAAa,OAAA;AACb,0GAAA,iBAAiB,OAAA;AACjB,gHAAA,uBAAuB,OAAA;AACvB,kHAAA,yBAAyB,OAAA;AACzB,iHAAA,wBAAwB,OAAA;AAE5B,6CAAsD;AAA7C,oHAAA,qBAAqB,OAAA"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * IronBee CLI — Queue Path Resolution & Session Validation
3
+ *
4
+ * See docs/job-queue.md §2.1 (session dir), §5.1 step 1 (sessionId rules),
5
+ * §5.5 (snapshot filename regex), §9.4 (project dir resolution).
6
+ */
7
+ export declare const SNAPSHOT_FILENAME_REGEX: RegExp;
8
+ export declare const DEAD_LETTER_ROTATED_REGEX: RegExp;
9
+ export declare const WORKER_LOG_ROTATED_REGEX: RegExp;
10
+ export declare const SESSION_ID_MAX_LEN: number;
11
+ /**
12
+ * Resolve the project directory using the same convention as the CLI's
13
+ * existing hooks: env-var overrides → cwd().
14
+ */
15
+ export declare function resolveProjectDir(override?: string): string;
16
+ /**
17
+ * Validate a session identifier per §5.1 step 1. Throws InvalidSessionIdError
18
+ * on any rule violation to prevent path-escape attacks.
19
+ */
20
+ export declare function validateSessionId(sessionId: string): void;
21
+ export declare function sessionsRoot(projectDir: string): string;
22
+ export declare function sessionDir(projectDir: string, sessionId: string): string;
23
+ export declare function queueDir(projectDir: string, sessionId: string): string;
24
+ export declare function liveQueueFile(projectDir: string, sessionId: string): string;
25
+ export declare function snapshotFile(projectDir: string, sessionId: string, snapshotId: string): string;
26
+ export declare function deadLetterFile(projectDir: string, sessionId: string): string;
27
+ export declare function workerLogFile(projectDir: string, sessionId: string): string;
28
+ /**
29
+ * Given an absolute snapshot path, derive (projectDir, sessionId, filename).
30
+ * Path shape: `<projectDir>/.ironbee/sessions/<sessionId>/queue/jobs-<UUID>.jsonl`.
31
+ *
32
+ * Uses `path.dirname` so both POSIX ("/a/b") and Windows ("C:\a\b")
33
+ * separators round-trip cleanly without mangling into forward-slashes.
34
+ */
35
+ export declare function parseSnapshotPath(snapshotPath: string): {
36
+ projectDir: string;
37
+ sessionId: string;
38
+ filename: string;
39
+ };
40
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/queue/paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,eAAO,MAAM,uBAAuB,EAAE,MAA4F,CAAC;AACnI,eAAO,MAAM,yBAAyB,EAAE,MAAmG,CAAC;AAC5I,eAAO,MAAM,wBAAwB,EAAE,MAA4F,CAAC;AACpI,eAAO,MAAM,kBAAkB,EAAE,MAAY,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAmBzD;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE9F;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAoBnH"}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * IronBee CLI — Queue Path Resolution & Session Validation
4
+ *
5
+ * See docs/job-queue.md §2.1 (session dir), §5.1 step 1 (sessionId rules),
6
+ * §5.5 (snapshot filename regex), §9.4 (project dir resolution).
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.SESSION_ID_MAX_LEN = exports.WORKER_LOG_ROTATED_REGEX = exports.DEAD_LETTER_ROTATED_REGEX = exports.SNAPSHOT_FILENAME_REGEX = void 0;
10
+ exports.resolveProjectDir = resolveProjectDir;
11
+ exports.validateSessionId = validateSessionId;
12
+ exports.sessionsRoot = sessionsRoot;
13
+ exports.sessionDir = sessionDir;
14
+ exports.queueDir = queueDir;
15
+ exports.liveQueueFile = liveQueueFile;
16
+ exports.snapshotFile = snapshotFile;
17
+ exports.deadLetterFile = deadLetterFile;
18
+ exports.workerLogFile = workerLogFile;
19
+ exports.parseSnapshotPath = parseSnapshotPath;
20
+ const path_1 = require("path");
21
+ const types_1 = require("./types");
22
+ exports.SNAPSHOT_FILENAME_REGEX = /^jobs-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.jsonl$/;
23
+ exports.DEAD_LETTER_ROTATED_REGEX = /^dead-letter-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.jsonl$/;
24
+ exports.WORKER_LOG_ROTATED_REGEX = /^worker-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\.log$/;
25
+ exports.SESSION_ID_MAX_LEN = 128;
26
+ /**
27
+ * Resolve the project directory using the same convention as the CLI's
28
+ * existing hooks: env-var overrides → cwd().
29
+ */
30
+ function resolveProjectDir(override) {
31
+ return override
32
+ ?? process.env.IRONBEE_PROJECT_DIR
33
+ ?? process.env.CLAUDE_PROJECT_DIR
34
+ ?? process.env.CURSOR_PROJECT_DIR
35
+ ?? process.cwd();
36
+ }
37
+ /**
38
+ * Validate a session identifier per §5.1 step 1. Throws InvalidSessionIdError
39
+ * on any rule violation to prevent path-escape attacks.
40
+ */
41
+ function validateSessionId(sessionId) {
42
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
43
+ throw new types_1.InvalidSessionIdError("session id is empty");
44
+ }
45
+ if (sessionId.length > exports.SESSION_ID_MAX_LEN) {
46
+ throw new types_1.InvalidSessionIdError(`session id exceeds ${exports.SESSION_ID_MAX_LEN} chars`);
47
+ }
48
+ if (sessionId === "." || sessionId === "..") {
49
+ throw new types_1.InvalidSessionIdError("session id is a reserved path component");
50
+ }
51
+ for (let i = 0; i < sessionId.length; i++) {
52
+ const code = sessionId.charCodeAt(i);
53
+ if (code < 0x20 || code === 0x7f) {
54
+ throw new types_1.InvalidSessionIdError("session id contains ASCII control character");
55
+ }
56
+ }
57
+ if (sessionId.includes("/") || sessionId.includes("\\") || sessionId.includes("\0")) {
58
+ throw new types_1.InvalidSessionIdError("session id contains path separator or null byte");
59
+ }
60
+ }
61
+ function sessionsRoot(projectDir) {
62
+ return (0, path_1.join)(projectDir, ".ironbee", "sessions");
63
+ }
64
+ function sessionDir(projectDir, sessionId) {
65
+ return (0, path_1.join)(sessionsRoot(projectDir), sessionId);
66
+ }
67
+ function queueDir(projectDir, sessionId) {
68
+ return (0, path_1.join)(sessionDir(projectDir, sessionId), "queue");
69
+ }
70
+ function liveQueueFile(projectDir, sessionId) {
71
+ return (0, path_1.join)(queueDir(projectDir, sessionId), "jobs.jsonl");
72
+ }
73
+ function snapshotFile(projectDir, sessionId, snapshotId) {
74
+ return (0, path_1.join)(queueDir(projectDir, sessionId), `jobs-${snapshotId}.jsonl`);
75
+ }
76
+ function deadLetterFile(projectDir, sessionId) {
77
+ return (0, path_1.join)(queueDir(projectDir, sessionId), "dead-letter.jsonl");
78
+ }
79
+ function workerLogFile(projectDir, sessionId) {
80
+ return (0, path_1.join)(queueDir(projectDir, sessionId), "worker.log");
81
+ }
82
+ /**
83
+ * Given an absolute snapshot path, derive (projectDir, sessionId, filename).
84
+ * Path shape: `<projectDir>/.ironbee/sessions/<sessionId>/queue/jobs-<UUID>.jsonl`.
85
+ *
86
+ * Uses `path.dirname` so both POSIX ("/a/b") and Windows ("C:\a\b")
87
+ * separators round-trip cleanly without mangling into forward-slashes.
88
+ */
89
+ function parseSnapshotPath(snapshotPath) {
90
+ const filename = (0, path_1.basename)(snapshotPath);
91
+ const queueSegmentDir = (0, path_1.dirname)(snapshotPath);
92
+ const sessionSegmentDir = (0, path_1.dirname)(queueSegmentDir);
93
+ const sessionsSegmentDir = (0, path_1.dirname)(sessionSegmentDir);
94
+ const ironbeeSegmentDir = (0, path_1.dirname)(sessionsSegmentDir);
95
+ const projectDir = (0, path_1.dirname)(ironbeeSegmentDir);
96
+ if ((0, path_1.basename)(queueSegmentDir) !== "queue"
97
+ || (0, path_1.basename)(sessionsSegmentDir) !== "sessions"
98
+ || (0, path_1.basename)(ironbeeSegmentDir) !== ".ironbee") {
99
+ throw new Error(`snapshot path is not under a valid session queue dir: ${snapshotPath}`);
100
+ }
101
+ const sessionId = (0, path_1.basename)(sessionSegmentDir);
102
+ if (sessionId.length === 0 || sessionId === ".") {
103
+ throw new Error(`snapshot path is not under a valid session queue dir: ${snapshotPath}`);
104
+ }
105
+ return { projectDir, sessionId, filename };
106
+ }
107
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/queue/paths.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAcH,8CAMC;AAMD,8CAmBC;AAED,oCAEC;AAED,gCAEC;AAED,4BAEC;AAED,sCAEC;AAED,oCAEC;AAED,wCAEC;AAED,sCAEC;AASD,8CAoBC;AApGD,+BAA+C;AAC/C,mCAAgD;AAEnC,QAAA,uBAAuB,GAAW,mFAAmF,CAAC;AACtH,QAAA,yBAAyB,GAAW,0FAA0F,CAAC;AAC/H,QAAA,wBAAwB,GAAW,mFAAmF,CAAC;AACvH,QAAA,kBAAkB,GAAW,GAAG,CAAC;AAE9C;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,QAAiB;IAC/C,OAAO,QAAQ;WACR,OAAO,CAAC,GAAG,CAAC,mBAAmB;WAC/B,OAAO,CAAC,GAAG,CAAC,kBAAkB;WAC9B,OAAO,CAAC,GAAG,CAAC,kBAAkB;WAC9B,OA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AW,IAAA,cAAO,EAAC,iBAAiB,CAAC,CAAC;IAEtD,IAAI,IAAA,eAAQ,EAAC,eAAe,CAAC,KAAK,OAAO;WAClC,IAAA,eAAQ,EAAC,kBAAkB,CAAC,KAAK,UAAU;WAC3C,IAAA,eAAQ,EAAC,iBAAiB,CAAC,KAAK,UAAU,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,yDAAyD,YAAY,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED,MAAM,SAAS,GAAW,IAAA,eAAQ,EAAC,iBAAiB,CAAC,CAAC;IACtD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,KAAK,GAAG,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,yDAAyD,YAAY,EAAE,CAAC,CAAC;IAC7F,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * IronBee CLI — Queue processFile() worker
3
+ *
4
+ * See docs/job-queue.md §5.3.
5
+ */
6
+ import { HandlerRegistry } from "./registry";
7
+ export interface ProcessFileOptions {
8
+ /** Override the registry for tests. Falls back to the global snapshot. */
9
+ registry?: HandlerRegistry;
10
+ }
11
+ /**
12
+ * Process one snapshot file end-to-end.
13
+ *
14
+ * Deletes the file only when every line has reached a terminal state
15
+ * (delivered OR dead-lettered). On transient/auth failure or a transient
16
+ * during per-job fallback, the file is left on disk for later retry.
17
+ *
18
+ * Never throws — all errors are logged to worker.log and classified
19
+ * per §5.3.
20
+ */
21
+ export declare function processFile(path: string, opts?: ProcessFileOptions): Promise<void>;
22
+ //# sourceMappingURL=process-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-file.d.ts","sourceRoot":"","sources":["../../src/queue/process-file.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EAAW,eAAe,EAAoB,MAAM,YAAY,CAAC;AASxE,MAAM,WAAW,kBAAkB;IAC/B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8JxF"}
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ /**
3
+ * IronBee CLI — Queue processFile() worker
4
+ *
5
+ * See docs/job-queue.md §5.3.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.processFile = processFile;
9
+ const fs_1 = require("fs");
10
+ const path_1 = require("path");
11
+ const readline_1 = require("readline");
12
+ const types_1 = require("./types");
13
+ const paths_1 = require("./paths");
14
+ const registry_1 = require("./registry");
15
+ const dead_letter_1 = require("./dead-letter");
16
+ const worker_log_1 = require("./worker-log");
17
+ /**
18
+ * Process one snapshot file end-to-end.
19
+ *
20
+ * Deletes the file only when every line has reached a terminal state
21
+ * (delivered OR dead-lettered). On transient/auth failure or a transient
22
+ * during per-job fallback, the file is left on disk for later retry.
23
+ *
24
+ * Never throws — all errors are logged to worker.log and classified
25
+ * per §5.3.
26
+ */
27
+ async function processFile(path, opts) {
28
+ if (!(0, fs_1.existsSync)(path)) {
29
+ return;
30
+ }
31
+ const { projectDir, sessionId } = (0, paths_1.parseSnapshotPath)(path);
32
+ const log = new worker_log_1.WorkerLog(projectDir, sessionId);
33
+ const registry = opts?.registry ?? (0, registry_1.snapshotRegistry)();
34
+ // Phase 1: streaming read + parse
35
+ const parsed = [];
36
+ const parseErrors = [];
37
+ try {
38
+ await readLinesStreaming(path, (line) => {
39
+ if (line.length === 0) {
40
+ return;
41
+ }
42
+ try {
43
+ const obj = JSON.parse(line);
44
+ if (!isJob(obj)) {
45
+ parseErrors.push({ raw: line, message: "not a valid job envelope" });
46
+ return;
47
+ }
48
+ parsed.push(obj);
49
+ }
50
+ catch (e) {
51
+ const msg = e instanceof Error ? e.message : String(e);
52
+ parseErrors.push({ raw: line, message: msg });
53
+ }
54
+ });
55
+ }
56
+ catch (e) {
57
+ const msg = e instanceof Error ? e.message : String(e);
58
+ log.error(`failed to read ${path}: ${msg}; leaving file`);
59
+ return;
60
+ }
61
+ log.info(`START path=${path} lines=${parsed.length + parseErrors.length} parse_errors=${parseErrors.length}`);
62
+ // Empty registry + non-empty snapshot is almost always a wiring bug (the
63
+ // CLI entry point forgot to call registerQueueHandlers). Every job is
64
+ // about to be dead-lettered as `no-handler-registered:<type>`. Surface a
65
+ // loud warning so it's not mistaken for a silent success. This matches
66
+ // spec §7.9 (no-handler dead-letters are a legitimate path for obsolete
67
+ // types) but flags the common mistake path.
68
+ if (registry.size === 0 && parsed.length > 0) {
69
+ const msg = `registry is empty but snapshot has ${parsed.length} job(s) — every job will be dead-lettered. Did registerQueueHandlers() fail to wire handlers?`;
70
+ log.warn(msg);
71
+ try {
72
+ process.stderr.write(`ironbee queue WARN: ${msg}\n`);
73
+ }
74
+ catch {
75
+ // ignore — worker.log already has it
76
+ }
77
+ }
78
+ // Phase 2: flush parse errors to dead-letter
79
+ for (const err of parseErrors) {
80
+ try {
81
+ (0, dead_letter_1.deadLetterParseError)({ projectDir, sessionId, sourceFile: path }, err.raw, `parse-error: ${err.message}`);
82
+ log.info(`DEAD_LETTER parse-error from=${(0, path_1.basename)(path)}`);
83
+ }
84
+ catch (e) {
85
+ const msg = e instanceof Error ? e.message : String(e);
86
+ log.error(`failed to dead-letter parse-error: ${msg}; leaving file`);
87
+ return;
88
+ }
89
+ }
90
+ // Phase 3: group by type, iterate sorted for determinism
91
+ const groups = new Map();
92
+ for (const job of parsed) {
93
+ const existing = groups.get(job.type);
94
+ if (existing) {
95
+ existing.push(job);
96
+ }
97
+ else {
98
+ groups.set(job.type, [job]);
99
+ }
100
+ }
101
+ const types = [...groups.keys()].sort();
102
+ let deadCount = parseErrors.length;
103
+ let okCount = 0;
104
+ for (const type of types) {
105
+ const jobs = groups.get(type);
106
+ const handler = registry.get(type);
107
+ if (!handler) {
108
+ for (const job of jobs) {
109
+ try {
110
+ (0, dead_letter_1.deadLetterParsed)({ projectDir, sessionId, sourceFile: path }, job, `no-handler-registered:${type}`);
111
+ deadCount++;
112
+ }
113
+ catch (e) {
114
+ const msg = e instanceof Error ? e.message : String(e);
115
+ log.error(`failed to dead-letter unhandled job ${job.id}: ${msg}; leaving file`);
116
+ return;
117
+ }
118
+ }
119
+ log.info(`NO_HANDLER type=${type} count=${jobs.length}`);
120
+ continue;
121
+ }
122
+ try {
123
+ await handler.dispatch(jobs);
124
+ okCount += jobs.length;
125
+ log.info(`BATCH_OK type=${type} count=${jobs.length}`);
126
+ }
127
+ catch (e) {
128
+ if (e instanceof types_1.TransientError) {
129
+ log.warn(`TRANSIENT type=${type}: ${e.message}; leaving file for retry`);
130
+ return;
131
+ }
132
+ if (e instanceof types_1.AuthError) {
133
+ log.error(`AUTH type=${type}: ${e.message}; leaving file; operator must fix credentials`);
134
+ return;
135
+ }
136
+ if (e instanceof types_1.BadRequestBatchError) {
137
+ log.warn(`BATCH_400 type=${type}: ${e.message}; falling back to per-job dispatch`);
138
+ const result = await fallbackPerJob(handler, jobs, path, projectDir, sessionId, log);
139
+ if (result.bailed) {
140
+ return; // file left on disk
141
+ }
142
+ okCount += result.ok;
143
+ deadCount += result.dead;
144
+ continue;
145
+ }
146
+ // Unexpected batch-level error: dead-letter every job in the batch and keep going.
147
+ const msg = e instanceof Error ? e.message : String(e);
148
+ log.error(`BATCH_UNEXPECTED type=${type}: ${msg}`);
149
+ for (const job of jobs) {
150
+ try {
151
+ (0, dead_letter_1.deadLetterParsed)({ projectDir, sessionId, sourceFile: path }, job, `unexpected:${msg}`);
152
+ deadCount++;
153
+ }
154
+ catch (e2) {
155
+ const msg2 = e2 instanceof Error ? e2.message : String(e2);
156
+ log.error(`failed to dead-letter unexpected-batch job ${job.id}: ${msg2}; leaving file`);
157
+ return;
158
+ }
159
+ }
160
+ }
161
+ }
162
+ // Phase 4: every line is terminal → delete the snapshot
163
+ try {
164
+ (0, fs_1.unlinkSync)(path);
165
+ log.info(`DONE path=${(0, path_1.basename)(path)} lines_ok=${okCount} lines_dead=${deadCount}`);
166
+ }
167
+ catch (e) {
168
+ const msg = e instanceof Error ? e.message : String(e);
169
+ // §7.14 — next drain will re-process; downstream dedupes on id
170
+ log.warn(`UNLINK_FAILED path=${path}: ${msg}; leaving file for re-processing`);
171
+ }
172
+ }
173
+ async function fallbackPerJob(handler, jobs, sourcePath, projectDir, sessionId, log) {
174
+ let ok = 0;
175
+ let dead = 0;
176
+ for (const job of jobs) {
177
+ try {
178
+ await handler.dispatchSingle(job);
179
+ ok++;
180
+ }
181
+ catch (e) {
182
+ if (e instanceof types_1.BadRequestError) {
183
+ try {
184
+ (0, dead_letter_1.deadLetterParsed)({ projectDir, sessionId, sourceFile: sourcePath }, job, e.message);
185
+ dead++;
186
+ }
187
+ catch (e2) {
188
+ const msg = e2 instanceof Error ? e2.message : String(e2);
189
+ log.error(`failed to dead-letter bad-request job ${job.id}: ${msg}; leaving file`);
190
+ return { ok, dead, bailed: true };
191
+ }
192
+ continue;
193
+ }
194
+ if (e instanceof types_1.TransientError) {
195
+ log.warn(`TRANSIENT_DURING_FALLBACK job=${job.id}: ${e.message}; leaving file`);
196
+ return { ok, dead, bailed: true };
197
+ }
198
+ if (e instanceof types_1.AuthError) {
199
+ log.error(`AUTH_DURING_FALLBACK job=${job.id}: ${e.message}; leaving file`);
200
+ return { ok, dead, bailed: true };
201
+ }
202
+ const msg = e instanceof Error ? e.message : String(e);
203
+ try {
204
+ (0, dead_letter_1.deadLetterParsed)({ projectDir, sessionId, sourceFile: sourcePath }, job, `unexpected:${msg}`);
205
+ dead++;
206
+ }
207
+ catch (e2) {
208
+ const msg2 = e2 instanceof Error ? e2.message : String(e2);
209
+ log.error(`failed to dead-letter unexpected job ${job.id}: ${msg2}; leaving file`);
210
+ return { ok, dead, bailed: true };
211
+ }
212
+ }
213
+ }
214
+ return { ok, dead, bailed: false };
215
+ }
216
+ function readLinesStreaming(path, onLine) {
217
+ return new Promise((resolve, reject) => {
218
+ const stream = (0, fs_1.createReadStream)(path, { encoding: "utf-8" });
219
+ const rl = (0, readline_1.createInterface)({ input: stream, crlfDelay: Infinity });
220
+ let inlineErr = null;
221
+ rl.on("line", (line) => {
222
+ if (inlineErr) {
223
+ return;
224
+ }
225
+ try {
226
+ onLine(line);
227
+ }
228
+ catch (e) {
229
+ inlineErr = e instanceof Error ? e : new Error(String(e));
230
+ rl.close();
231
+ stream.destroy();
232
+ }
233
+ });
234
+ rl.on("close", () => {
235
+ if (inlineErr) {
236
+ reject(inlineErr);
237
+ }
238
+ else {
239
+ resolve();
240
+ }
241
+ });
242
+ stream.on("error", (err) => {
243
+ reject(err);
244
+ });
245
+ });
246
+ }
247
+ function isJob(obj) {
248
+ if (typeof obj !== "object" || obj === null) {
249
+ return false;
250
+ }
251
+ const o = obj;
252
+ return typeof o.id === "string"
253
+ && typeof o.type === "string"
254
+ && typeof o.created_at === "string"
255
+ && "data" in o;
256
+ }
257
+ //# sourceMappingURL=process-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-file.js","sourceRoot":"","sources":["../../src/queue/process-file.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAqCH,kCA8JC;AAjMD,2BAA8D;AAC9D,+BAAgC;AAChC,uCAA2E;AAC3E,mCAMiB;AACjB,mCAA4C;AAC5C,yCAAwE;AACxE,+CAAuE;AACvE,6CAAyC;AAYzC;;;;;;;;;GASG;AACI,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,IAAyB;IACrE,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO;IACX,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAA,yBAAiB,EAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAc,IAAI,sBAAS,CAAC,UAAU,EAAE,SAAS,CAAC,CA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/index.ts` before `program.parse()` so that any CLI entry point
6
+ * (`ironbee queue drain`, `ironbee process-job-file`, or a hook-driven
7
+ * flushSynchronously) sees a fully-populated global registry.
8
+ *
9
+ * Currently empty — no concrete consumer exists yet. When a producer is
10
+ * added (e.g. a `send_event` producer on top of the tool_call hook), its
11
+ * handler MUST be registered here. Forgetting to do so means every job of
12
+ * that type will silently be written to dead-letter as
13
+ * `no-handler-registered:<type>` (§7.9).
14
+ *
15
+ * Why not register inside each producer module's top-level code?
16
+ * - Side-effectful top-level imports are hard to reason about.
17
+ * - A detached worker spawned via `spawnDetachedWorker` starts a fresh
18
+ * Node process and imports the CLI entry point — it will only see
19
+ * handlers registered via this bootstrap.
20
+ *
21
+ * Keep registrations idempotent — this function may be called more than
22
+ * once in tests.
23
+ */
24
+ export declare const SEND_EVENT_TYPE: string;
25
+ export declare function registerQueueHandlers(): void;
26
+ //# sourceMappingURL=register-handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-handlers.d.ts","sourceRoot":"","sources":["../../src/queue/register-handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAKH,eAAO,MAAM,eAAe,EAAE,MAAqB,CAAC;AAEpD,wBAAgB,qBAAqB,IAAI,IAAI,CAI5C"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * IronBee CLI — Queue Handler Bootstrap
4
+ *
5
+ * Single wiring point for all queue job-type handlers. Imported and invoked
6
+ * by `src/index.ts` before `program.parse()` so that any CLI entry point
7
+ * (`ironbee queue drain`, `ironbee process-job-file`, or a hook-driven
8
+ * flushSynchronously) sees a fully-populated global registry.
9
+ *
10
+ * Currently empty — no concrete consumer exists yet. When a producer is
11
+ * added (e.g. a `send_event` producer on top of the tool_call hook), its
12
+ * handler MUST be registered here. Forgetting to do so means every job of
13
+ * that type will silently be written to dead-letter as
14
+ * `no-handler-registered:<type>` (§7.9).
15
+ *
16
+ * Why not register inside each producer module's top-level code?
17
+ * - Side-effectful top-level imports are hard to reason about.
18
+ * - A detached worker spawned via `spawnDetachedWorker` starts a fresh
19
+ * Node process and imports the CLI entry point — it will only see
20
+ * handlers registered via this bootstrap.
21
+ *
22
+ * Keep registrations idempotent — this function may be called more than
23
+ * once in tests.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.SEND_EVENT_TYPE = void 0;
27
+ exports.registerQueueHandlers = registerQueueHandlers;
28
+ const registry_1 = require("./registry");
29
+ const send_event_1 = require("./handlers/send-event");
30
+ exports.SEND_EVENT_TYPE = "send_event";
31
+ function registerQueueHandlers() {
32
+ // send_event — POST event envelopes (tool_call, session_start, …) to
33
+ // the IronBee Collector. See src/queue/handlers/send-event.ts.
34
+ (0, registry_1.register)(exports.SEND_EVENT_TYPE, send_event_1.sendEventHandler);
35
+ }
36
+ //# sourceMappingURL=register-handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-handlers.js","sourceRoot":"","sources":["../../src/queue/register-handlers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AAOH,sDAIC;AATD,yCAAsC;AACtC,sDAAyD;AAE5C,QAAA,eAAe,GAAW,YAAY,CAAC;AAEpD,SAAgB,qBAAqB;IACjC,qEAAqE;IACrE,+DAA+D;IAC/D,IAAA,mBAAQ,EAAC,uBAAe,EAAE,6BAAgB,CAAC,CAAC;AAChD,CAAC"}