@axiom-lattice/gateway 2.1.83 → 2.1.85

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/gateway@2.1.83 build /home/runner/work/agentic/agentic/packages/gateway
2
+ > @axiom-lattice/gateway@2.1.85 build /home/runner/work/agentic/agentic/packages/gateway
3
3
  > tsup src/index.ts --format cjs,esm --dts --clean --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -18,15 +18,15 @@
18
18
  You need to set the output format to "esm" for "import.meta" to work correctly.
19
19
 
20
20
 
21
- CJS dist/index.js 242.67 KB
22
- CJS dist/index.js.map 508.08 KB
23
- CJS ⚡️ Build success in 369ms
21
+ CJS dist/index.js 242.46 KB
22
+ CJS dist/index.js.map 507.89 KB
23
+ CJS ⚡️ Build success in 428ms
24
+ ESM dist/index.mjs 237.76 KB
24
25
  ESM dist/sender-PX32VSHB.mjs 873.00 B
25
- ESM dist/index.mjs 237.97 KB
26
+ ESM dist/index.mjs.map 506.38 KB
26
27
  ESM dist/sender-PX32VSHB.mjs.map 2.07 KB
27
- ESM dist/index.mjs.map 506.56 KB
28
- ESM ⚡️ Build success in 372ms
28
+ ESM ⚡️ Build success in 452ms
29
29
  DTS Build start
30
- DTS ⚡️ Build success in 13970ms
31
- DTS dist/index.d.ts 5.04 KB
32
- DTS dist/index.d.mts 5.04 KB
30
+ DTS ⚡️ Build success in 14776ms
31
+ DTS dist/index.d.ts 5.01 KB
32
+ DTS dist/index.d.mts 5.01 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @axiom-lattice/gateway
2
2
 
3
+ ## 2.1.85
4
+
5
+ ### Patch Changes
6
+
7
+ - 65aa22a: up allinone sandbox and mysql
8
+ - Updated dependencies [65aa22a]
9
+ - @axiom-lattice/core@2.1.74
10
+ - @axiom-lattice/agent-eval@2.1.68
11
+ - @axiom-lattice/pg-stores@1.0.64
12
+ - @axiom-lattice/protocols@2.1.38
13
+ - @axiom-lattice/queue-redis@1.0.37
14
+
15
+ ## 2.1.84
16
+
17
+ ### Patch Changes
18
+
19
+ - 2699e03: up flow
20
+ - Updated dependencies [2699e03]
21
+ - @axiom-lattice/core@2.1.73
22
+ - @axiom-lattice/agent-eval@2.1.67
23
+ - @axiom-lattice/pg-stores@1.0.63
24
+
3
25
  ## 2.1.83
4
26
 
5
27
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -67,14 +67,12 @@ interface MessageRouterConfig {
67
67
  bindingRegistry: BindingRegistry;
68
68
  adapterRegistry: ChannelAdapterRegistry;
69
69
  installationStore: ChannelInstallationStore;
70
- logger?: any;
71
70
  }
72
71
  declare class MessageRouter {
73
72
  private middlewares;
74
73
  private bindingRegistry;
75
74
  private adapterRegistry;
76
75
  private installationStore;
77
- private logger?;
78
76
  constructor(config: MessageRouterConfig);
79
77
  use(middleware: MessageMiddleware): void;
80
78
  dispatch(message: InboundMessage): Promise<DispatchResult>;
package/dist/index.d.ts CHANGED
@@ -67,14 +67,12 @@ interface MessageRouterConfig {
67
67
  bindingRegistry: BindingRegistry;
68
68
  adapterRegistry: ChannelAdapterRegistry;
69
69
  installationStore: ChannelInstallationStore;
70
- logger?: any;
71
70
  }
72
71
  declare class MessageRouter {
73
72
  private middlewares;
74
73
  private bindingRegistry;
75
74
  private adapterRegistry;
76
75
  private installationStore;
77
- private logger?;
78
76
  constructor(config: MessageRouterConfig);
79
77
  use(middleware: MessageMiddleware): void;
80
78
  dispatch(message: InboundMessage): Promise<DispatchResult>;
package/dist/index.js CHANGED
@@ -6637,8 +6637,10 @@ var registerLatticeRoutes = (app2, channelDeps) => {
6637
6637
  displayName: msg.sender.displayName
6638
6638
  },
6639
6639
  content: {
6640
- text: msg.content.text
6640
+ text: msg.content.text,
6641
+ metadata: msg.content.metadata
6641
6642
  },
6643
+ conversation: msg.conversation,
6642
6644
  replyTarget: msg.replyTarget
6643
6645
  };
6644
6646
  await router.dispatch(inboundMessage).catch((error) => {
@@ -6702,7 +6704,6 @@ var MessageRouter = class {
6702
6704
  this.bindingRegistry = config.bindingRegistry;
6703
6705
  this.adapterRegistry = config.adapterRegistry;
6704
6706
  this.installationStore = config.installationStore;
6705
- this.logger = config.logger;
6706
6707
  }
6707
6708
  use(middleware) {
6708
6709
  this.middlewares.push(middleware);
@@ -6716,7 +6717,7 @@ var MessageRouter = class {
6716
6717
  await this.runMiddlewares(ctx, async () => {
6717
6718
  const tenantId = message.tenantId || (await this.installationStore.getInstallationById(message.channelInstallationId))?.tenantId;
6718
6719
  if (!tenantId) {
6719
- this.logger?.error({
6720
+ console.error({
6720
6721
  event: "dispatch:error",
6721
6722
  error: "tenantId missing",
6722
6723
  channel: message.channel,
@@ -6727,7 +6728,7 @@ var MessageRouter = class {
6727
6728
  "tenantId is required: provide it in the message or ensure the channelInstallation has a tenantId"
6728
6729
  );
6729
6730
  }
6730
- this.logger?.info({ event: "dispatch:start", channel: message.channel, senderId: message.sender.id, tenantId }, "Message dispatch started");
6731
+ console.log({ event: "dispatch:start", channel: message.channel, senderId: message.sender.id, tenantId }, "Message dispatch started");
6731
6732
  let binding = await this.bindingRegistry.resolve({
6732
6733
  channel: message.channel,
6733
6734
  senderId: message.sender.id,
@@ -6739,7 +6740,7 @@ var MessageRouter = class {
6739
6740
  message.channelInstallationId
6740
6741
  );
6741
6742
  if (installation?.rejectWhenNoBinding) {
6742
- this.logger?.warn({
6743
+ console.warn({
6743
6744
  event: "dispatch:no_binding",
6744
6745
  channel: message.channel,
6745
6746
  senderId: message.sender.id,
@@ -6751,7 +6752,7 @@ var MessageRouter = class {
6751
6752
  );
6752
6753
  }
6753
6754
  if (installation?.fallbackAgentId) {
6754
- this.logger?.warn({
6755
+ console.warn({
6755
6756
  event: "dispatch:fallback",
6756
6757
  channel: message.channel,
6757
6758
  senderId: message.sender.id,
@@ -6771,7 +6772,7 @@ var MessageRouter = class {
6771
6772
  updatedAt: /* @__PURE__ */ new Date()
6772
6773
  };
6773
6774
  } else {
6774
- this.logger?.error({
6775
+ console.error({
6775
6776
  event: "dispatch:no_fallback",
6776
6777
  channel: message.channel,
6777
6778
  senderId: message.sender.id,
@@ -6783,7 +6784,7 @@ var MessageRouter = class {
6783
6784
  }
6784
6785
  }
6785
6786
  ctx.binding = binding;
6786
- this.logger?.info({
6787
+ console.log({
6787
6788
  event: "dispatch:binding",
6788
6789
  bindingId: binding.id,
6789
6790
  agentId: binding.agentId,
@@ -6792,15 +6793,8 @@ var MessageRouter = class {
6792
6793
  workspaceId: binding.workspaceId,
6793
6794
  projectId: binding.projectId
6794
6795
  }, "Binding resolved");
6795
- if (binding.threadMode === "per_conversation") {
6796
- this.logger?.warn({
6797
- event: "dispatch:per_conversation",
6798
- bindingId: binding.id,
6799
- conversationId: message.conversation?.id
6800
- }, "per_conversation mode active \u2014 thread lookup by conversation not yet implemented, using binding.threadId");
6801
- }
6802
6796
  if (!binding.enabled) {
6803
- this.logger?.warn({
6797
+ console.warn({
6804
6798
  event: "dispatch:binding_disabled",
6805
6799
  bindingId: binding.id,
6806
6800
  agentId: binding.agentId,
@@ -6810,11 +6804,11 @@ var MessageRouter = class {
6810
6804
  `Binding for sender "${message.sender.id}" is disabled`
6811
6805
  );
6812
6806
  }
6813
- let threadId = ctx.binding.threadId;
6807
+ let threadId = ctx.binding.threadMode === "per_conversation" ? void 0 : ctx.binding.threadId;
6814
6808
  if (!threadId) {
6815
6809
  const threadStore = (0, import_core28.getStoreLattice)("default", "thread").store;
6816
6810
  const newThreadId = (0, import_crypto8.randomUUID)();
6817
- this.logger?.info({
6811
+ console.log({
6818
6812
  event: "dispatch:thread:create",
6819
6813
  agentId: ctx.binding.agentId,
6820
6814
  newThreadId,
@@ -6829,7 +6823,11 @@ var MessageRouter = class {
6829
6823
  channel: message.channel,
6830
6824
  channelInstallationId: message.channelInstallationId,
6831
6825
  senderId: message.sender.id,
6832
- bindingId: ctx.binding.id
6826
+ bindingId: ctx.binding.id,
6827
+ ...message.conversation ? {
6828
+ conversationId: message.conversation.id,
6829
+ conversationType: message.conversation.type
6830
+ } : {}
6833
6831
  }
6834
6832
  }
6835
6833
  );
@@ -6841,7 +6839,7 @@ var MessageRouter = class {
6841
6839
  ctx.binding.threadId = threadId;
6842
6840
  }
6843
6841
  }
6844
- this.logger?.info({
6842
+ console.log({
6845
6843
  event: "dispatch:agent",
6846
6844
  agentId: ctx.binding.agentId,
6847
6845
  threadId,
@@ -6860,7 +6858,7 @@ var MessageRouter = class {
6860
6858
  input: { message: message.content.text },
6861
6859
  custom_run_config: message.content.metadata || {}
6862
6860
  });
6863
- this.logger?.info({
6861
+ console.log({
6864
6862
  event: "dispatch:complete",
6865
6863
  agentId: ctx.binding.agentId,
6866
6864
  threadId,
@@ -6891,7 +6889,7 @@ var MessageRouter = class {
6891
6889
  };
6892
6890
  } catch (error) {
6893
6891
  ctx.error = error instanceof Error ? error : new Error(String(error));
6894
- this.logger?.error({ event: "dispatch:error", error: ctx.error.message, channel: message.channel, senderId: message.sender.id }, "Message dispatch failed");
6892
+ console.error({ event: "dispatch:error", error: ctx.error.message, channel: message.channel, senderId: message.sender.id }, "Message dispatch failed");
6895
6893
  return {
6896
6894
  success: false,
6897
6895
  bindingId: ctx.binding?.id,
@@ -6933,7 +6931,7 @@ var ChannelAdapterRegistry = class {
6933
6931
 
6934
6932
  // src/router/middlewares/deduplication.ts
6935
6933
  var processedMessages = /* @__PURE__ */ new Map();
6936
- function createDeduplicationMiddleware(ttlMs = 5 * 60 * 1e3, logger4) {
6934
+ function createDeduplicationMiddleware(ttlMs = 5 * 60 * 1e3) {
6937
6935
  return async (ctx, next) => {
6938
6936
  const msg = ctx.inboundMessage;
6939
6937
  const msgId = msg.content.metadata?.messageId;
@@ -6942,7 +6940,7 @@ function createDeduplicationMiddleware(ttlMs = 5 * 60 * 1e3, logger4) {
6942
6940
  const now = Date.now();
6943
6941
  const lastProcessed = processedMessages.get(key);
6944
6942
  if (lastProcessed && now - lastProcessed < ttlMs) {
6945
- logger4?.warn({
6943
+ console.warn({
6946
6944
  event: "dedup:blocked",
6947
6945
  channel: msg.channel,
6948
6946
  senderId: msg.sender.id,
@@ -6968,7 +6966,7 @@ var RateLimitError = class extends Error {
6968
6966
  }
6969
6967
  };
6970
6968
  var rateCounters = /* @__PURE__ */ new Map();
6971
- function createRateLimitMiddleware(maxRequests = 10, windowMs = 60 * 1e3, maxEntries = 1e4, logger4) {
6969
+ function createRateLimitMiddleware(maxRequests = 10, windowMs = 60 * 1e3, maxEntries = 1e4) {
6972
6970
  return async (ctx, next) => {
6973
6971
  const senderKey = `${ctx.inboundMessage.channel}:${ctx.inboundMessage.sender.id}`;
6974
6972
  const now = Date.now();
@@ -6983,7 +6981,7 @@ function createRateLimitMiddleware(maxRequests = 10, windowMs = 60 * 1e3, maxEnt
6983
6981
  if (oldest) rateCounters.delete(oldest[0]);
6984
6982
  }
6985
6983
  if (counter.count > maxRequests) {
6986
- logger4?.warn({
6984
+ console.warn({
6987
6985
  event: "ratelimit:blocked",
6988
6986
  channel: ctx.inboundMessage.channel,
6989
6987
  senderId: ctx.inboundMessage.sender.id,
@@ -7513,14 +7511,13 @@ var start = async (config) => {
7513
7511
  adapterRegistry.register(larkChannelAdapter);
7514
7512
  const router = new MessageRouter({
7515
7513
  middlewares: [
7516
- createDeduplicationMiddleware(void 0, logger3),
7517
- createRateLimitMiddleware(void 0, void 0, void 0, logger3),
7514
+ createDeduplicationMiddleware(),
7515
+ createRateLimitMiddleware(),
7518
7516
  createAuditLoggerMiddleware()
7519
7517
  ],
7520
7518
  bindingRegistry: bindingStore,
7521
7519
  adapterRegistry,
7522
- installationStore,
7523
- logger: logger3
7520
+ installationStore
7524
7521
  });
7525
7522
  channelDeps = { router, installationStore };
7526
7523
  } catch {