@codemation/core 0.13.0 → 0.13.2

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 (42) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{ItemsInputNormalizer-BWtlwdVI.d.ts → ItemsInputNormalizer-BYljnXU0.d.ts} +9 -1
  3. package/dist/{ItemsInputNormalizer-57EdA1ad.cjs → ItemsInputNormalizer-BbQTSEkZ.cjs} +2 -2
  4. package/dist/{ItemsInputNormalizer-57EdA1ad.cjs.map → ItemsInputNormalizer-BbQTSEkZ.cjs.map} +1 -1
  5. package/dist/{ItemsInputNormalizer-pLrWwUAP.d.cts → ItemsInputNormalizer-Bi8m-Ijs.d.cts} +9 -1
  6. package/dist/{ItemsInputNormalizer-BkSvmfAW.js → ItemsInputNormalizer-CSZGMgl3.js} +2 -2
  7. package/dist/{ItemsInputNormalizer-BkSvmfAW.js.map → ItemsInputNormalizer-CSZGMgl3.js.map} +1 -1
  8. package/dist/bootstrap/index.cjs +3 -3
  9. package/dist/bootstrap/index.d.cts +11 -0
  10. package/dist/bootstrap/index.d.ts +2 -2
  11. package/dist/bootstrap/index.js +3 -3
  12. package/dist/{bootstrap-CSeInbj1.js → bootstrap-Bkd-Nfbn.js} +3 -3
  13. package/dist/{bootstrap-CSeInbj1.js.map → bootstrap-Bkd-Nfbn.js.map} +1 -1
  14. package/dist/{bootstrap-BEu1fJBM.cjs → bootstrap-DIv-vloi.cjs} +3 -3
  15. package/dist/{bootstrap-BEu1fJBM.cjs.map → bootstrap-DIv-vloi.cjs.map} +1 -1
  16. package/dist/browser.cjs +2 -2
  17. package/dist/browser.d.cts +1 -1
  18. package/dist/browser.d.ts +1 -1
  19. package/dist/browser.js +2 -2
  20. package/dist/{di-C-2ep8NZ.cjs → di-LP2qSHkY.cjs} +3 -1
  21. package/dist/di-LP2qSHkY.cjs.map +1 -0
  22. package/dist/{di-D9Mv3kF3.js → di-tom0pM2h.js} +3 -1
  23. package/dist/di-tom0pM2h.js.map +1 -0
  24. package/dist/{index-CqZeNGAp.d.ts → index-BSQ2LoIh.d.ts} +13 -2
  25. package/dist/index.cjs +3 -3
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +1 -1
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +3 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/{runtime-6-U2Cou5.js → runtime-CWPdvJpC.js} +22 -4
  32. package/dist/{runtime-6-U2Cou5.js.map → runtime-CWPdvJpC.js.map} +1 -1
  33. package/dist/{runtime-DjYXgOo0.cjs → runtime-_VdHwGkJ.cjs} +22 -4
  34. package/dist/{runtime-DjYXgOo0.cjs.map → runtime-_VdHwGkJ.cjs.map} +1 -1
  35. package/dist/testing.cjs +3 -3
  36. package/dist/testing.js +3 -3
  37. package/package.json +1 -1
  38. package/src/ai/AiHost.ts +7 -0
  39. package/src/ai/NodeBackedToolConfig.ts +2 -0
  40. package/src/scheduler/InlineDrivingScheduler.ts +23 -2
  41. package/dist/di-C-2ep8NZ.cjs.map +0 -1
  42. package/dist/di-D9Mv3kF3.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_di = require('./di-C-2ep8NZ.cjs');
1
+ const require_di = require('./di-LP2qSHkY.cjs');
2
2
  let zod = require("zod");
3
3
  zod = require_di.__toESM(zod);
4
4
  let node_stream_web = require("node:stream/web");
@@ -5003,12 +5003,26 @@ var InlineDrivingScheduler = class {
5003
5003
  drainingRuns = /* @__PURE__ */ new Set();
5004
5004
  queuesByRunId = /* @__PURE__ */ new Map();
5005
5005
  scheduledRuns = /* @__PURE__ */ new Set();
5006
+ stopped = false;
5007
+ activeDrainPromises = /* @__PURE__ */ new Set();
5006
5008
  constructor(nodeExecutor) {
5007
5009
  this.nodeExecutor = nodeExecutor;
5008
5010
  }
5009
5011
  setContinuation(continuation) {
5010
5012
  this.continuation = continuation;
5011
5013
  }
5014
+ /**
5015
+ * Prevents new drain cycles from being scheduled and waits for all currently-running
5016
+ * drains to complete. Call before closing the DB connection or rolling back test transactions
5017
+ * to ensure no in-flight writes hit a closed/rolled-back connection.
5018
+ *
5019
+ * Bounded: only the drains already in-flight at call time are awaited. Runs that keep
5020
+ * re-scheduling will not schedule new work once stopped is set.
5021
+ */
5022
+ async stop() {
5023
+ this.stopped = true;
5024
+ if (this.activeDrainPromises.size > 0) await Promise.allSettled(this.activeDrainPromises);
5025
+ }
5012
5026
  async prepareDispatch(request) {
5013
5027
  const receipt = {
5014
5028
  receiptId: request.activationId,
@@ -5058,11 +5072,15 @@ var InlineDrivingScheduler = class {
5058
5072
  }
5059
5073
  }
5060
5074
  scheduleDrain(runId) {
5061
- if (this.drainingRuns.has(runId) || this.scheduledRuns.has(runId)) return;
5075
+ if (this.stopped || this.drainingRuns.has(runId) || this.scheduledRuns.has(runId)) return;
5062
5076
  this.scheduledRuns.add(runId);
5063
5077
  setImmediate(() => {
5064
5078
  this.scheduledRuns.delete(runId);
5065
- this.drainRun(runId);
5079
+ if (this.stopped) return;
5080
+ const p = this.drainRun(runId).finally(() => {
5081
+ this.activeDrainPromises.delete(p);
5082
+ });
5083
+ this.activeDrainPromises.add(p);
5066
5084
  });
5067
5085
  }
5068
5086
  async resumeAfterExecutionResult(continuation, request, outputs) {
@@ -7133,4 +7151,4 @@ Object.defineProperty(exports, 'tool', {
7133
7151
  return tool;
7134
7152
  }
7135
7153
  });
7136
- //# sourceMappingURL=runtime-DjYXgOo0.cjs.map
7154
+ //# sourceMappingURL=runtime-_VdHwGkJ.cjs.map