@axiom-lattice/gateway 4.2.4 → 4.3.0

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 (28) hide show
  1. package/dist/embed/agent-chat-loader.js +1 -1
  2. package/dist/embed/{embed-page-AgentDetailSideApp-3LBCEKFU.js → embed-page-AgentDetailSideApp-7FH2JSZI.js} +1 -1
  3. package/dist/embed/{embed-page-AgentGovernanceWorkbench-K3JUQNBW.js → embed-page-AgentGovernanceWorkbench-Y5F3ZPYC.js} +1 -1
  4. package/dist/embed/{embed-page-MessageGraph-3X4ROEN6.js → embed-page-MessageGraph-ONODQPG4.js} +1 -1
  5. package/dist/embed/{embed-page-ReactChart-F6VYCIYY.js → embed-page-ReactChart-GZQSKCUG.js} +1 -1
  6. package/dist/embed/{embed-page-SkillFlow-3CF7R3CW.js → embed-page-SkillFlow-TPESM4DI.js} +1 -1
  7. package/dist/embed/{embed-page-TasksSideApp-3WRDBZU3.js → embed-page-TasksSideApp-HYKCJ356.js} +1 -1
  8. package/dist/embed/{embed-page-TeamWorkspace-6JSMZYUF.js → embed-page-TeamWorkspace-IOHS4RJV.js} +1 -1
  9. package/dist/embed/{embed-page-TopologyRuntimeView-YDFENLHH.js → embed-page-TopologyRuntimeView-QLMZ4OE7.js} +1 -1
  10. package/dist/embed/{embed-page-WorkflowAutomationView-MP5B7Q2Q.js → embed-page-WorkflowAutomationView-FJJSGY7Z.js} +1 -1
  11. package/dist/embed/{embed-page-chunk-QEYWJHEK.js → embed-page-chunk-6LL6YULZ.js} +1 -1
  12. package/dist/embed/{embed-page-chunk-UOL6CUAL.js → embed-page-chunk-D3NRIME3.js} +1 -1
  13. package/dist/embed/embed-page-chunk-EMPMOO53.js +466 -0
  14. package/dist/embed/{embed-page-chunk-GDTBDOUE.js → embed-page-chunk-FXTSVMPN.js} +89 -38
  15. package/dist/embed/embed-page-chunk-KFUAWYJ7.js +5 -0
  16. package/dist/embed/{embed-page-chunk-IRP6JSSX.js → embed-page-chunk-L7RMIQ7C.js} +9 -9
  17. package/dist/embed/{embed-page-chunk-YMJGPA3F.js → embed-page-chunk-MCUFFMAW.js} +116 -124
  18. package/dist/embed/{embed-page-chunk-PAJ5NG2Z.js → embed-page-chunk-SMQZEZYG.js} +1 -1
  19. package/dist/embed/{embed-page-chunk-FFO7CAYL.js → embed-page-chunk-VVYB3C4O.js} +1 -1
  20. package/dist/embed/{embed-page-chunk-RVXX5HKF.js → embed-page-chunk-ZTRCHYWV.js} +1 -1
  21. package/dist/embed/embed-page.js +3 -3
  22. package/dist/index.js +239 -144
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +117 -22
  25. package/dist/index.mjs.map +1 -1
  26. package/package.json +7 -7
  27. package/dist/embed/embed-page-chunk-B2E2XOH2.js +0 -467
  28. package/dist/embed/embed-page-chunk-URNZX66S.js +0 -5
package/dist/index.mjs CHANGED
@@ -5306,7 +5306,7 @@ var NoopRoomBindingLifecycle = class {
5306
5306
  // src/services/collaboration/WorkspacePublicRoomService.ts
5307
5307
  import { createHash } from "crypto";
5308
5308
  import { randomUUID as randomUUID6 } from "crypto";
5309
- var WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX = "workspace_public_";
5309
+ import { WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX } from "@axiom-lattice/protocols";
5310
5310
  var PUBLIC_ROOM_PROJECT_NAME = "General";
5311
5311
  var PUBLIC_ROOM_PROJECT_DESCRIPTION = "Public room for everyone in the workspace";
5312
5312
  function workspacePublicRoomProjectId(tenantId, workspaceId) {
@@ -5484,7 +5484,7 @@ function createProjectCollaborationInitializer(deps) {
5484
5484
  } catch {
5485
5485
  throw new ProjectCollaborationInitializationError("room");
5486
5486
  }
5487
- if (project.kind === "business" && deps.ensureCoordinator) {
5487
+ if ((project.kind === "business" || project.kind === "public") && deps.ensureCoordinator) {
5488
5488
  try {
5489
5489
  await deps.ensureCoordinator({
5490
5490
  tenantId,
@@ -5652,12 +5652,6 @@ var WorkspaceController = class {
5652
5652
  message: CAPABILITY_BUNDLE_CONFIG_MESSAGE
5653
5653
  });
5654
5654
  }
5655
- if (data.kind === "public") {
5656
- return reply.status(409).send({
5657
- success: false,
5658
- error: "The public room project is managed automatically"
5659
- });
5660
- }
5661
5655
  if (user?.id && this.projectCollaboration) {
5662
5656
  try {
5663
5657
  const authorized = await this.projectCollaboration.authorizeCreator({ tenantId, userId: user.id });
@@ -5735,16 +5729,10 @@ var WorkspaceController = class {
5735
5729
  }
5736
5730
  if (updates.kind !== void 0) {
5737
5731
  const existingProject = await this.projectStore.getProjectById(tenantId, projectId);
5738
- if (existingProject && updates.kind === "public") {
5739
- return reply.status(409).send({
5740
- success: false,
5741
- error: "kind public is reserved for the workspace public room"
5742
- });
5743
- }
5744
- if (existingProject?.kind === "public") {
5732
+ if (existingProject && existingProject.id === workspacePublicRoomProjectId(tenantId, existingProject.workspaceId)) {
5745
5733
  return reply.status(409).send({
5746
5734
  success: false,
5747
- error: "The public room project classification cannot be changed"
5735
+ error: "The workspace public room classification cannot be changed"
5748
5736
  });
5749
5737
  }
5750
5738
  }
@@ -5778,10 +5766,10 @@ var WorkspaceController = class {
5778
5766
  });
5779
5767
  }
5780
5768
  }
5781
- if (project.kind === "public") {
5769
+ if (project.id === workspacePublicRoomProjectId(tenantId, project.workspaceId ?? workspaceId)) {
5782
5770
  return reply.status(409).send({
5783
5771
  success: false,
5784
- error: "The public room project cannot be deleted"
5772
+ error: "The workspace public room cannot be deleted"
5785
5773
  });
5786
5774
  }
5787
5775
  const deleted = await this.projectStore.deleteProject(tenantId, projectId);
@@ -11963,10 +11951,15 @@ var agentWebAppFeaturesSchema = z4.object({
11963
11951
  genUI: z4.boolean(),
11964
11952
  files: z4.boolean().optional()
11965
11953
  }).strict();
11954
+ var agentWebAppQuickPromptSchema = z4.object({
11955
+ label: z4.string().min(1).max(40),
11956
+ text: z4.string().min(1).max(500)
11957
+ }).strict();
11966
11958
  var agentWebAppAppearanceSchema = z4.object({
11967
11959
  title: z4.string().max(120).optional(),
11968
11960
  welcomeMessage: z4.string().max(1e3).optional(),
11969
- primaryColor: z4.string().regex(/^#[0-9A-Fa-f]{6}$/).optional()
11961
+ primaryColor: z4.string().regex(/^#[0-9A-Fa-f]{6}$/).optional(),
11962
+ quickPrompts: z4.array(agentWebAppQuickPromptSchema).max(6).optional()
11970
11963
  }).strict();
11971
11964
  var agentWebAppIssuerSchema = z4.object({
11972
11965
  iss: z4.string().min(1).max(255),
@@ -13719,7 +13712,7 @@ var ProjectRoomService = class {
13719
13712
  */
13720
13713
  async ensureMainRoomWithCoordinator(input) {
13721
13714
  const { project, room } = await this.authorizedRoom(input);
13722
- if (project.kind === "business" && this.deps.ensureCoordinator) {
13715
+ if ((project.kind === "business" || project.kind === "public") && this.deps.ensureCoordinator) {
13723
13716
  try {
13724
13717
  await this.deps.ensureCoordinator({
13725
13718
  tenantId: input.tenantId,
@@ -14861,13 +14854,13 @@ function registerCoSpaceRoutes(app2, deps) {
14861
14854
  );
14862
14855
  const accessibleProjects = [];
14863
14856
  for (const project of allProjects) {
14864
- if (project.kind === "public") continue;
14857
+ if (project.id.startsWith(WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX)) continue;
14865
14858
  const membership = await deps.membershipStore.findByUser(
14866
14859
  actor3.tenantId,
14867
14860
  project.id,
14868
14861
  actor3.userId
14869
14862
  );
14870
- if (membership && membership.status === "active") {
14863
+ if (project.kind === "public" || membership && membership.status === "active") {
14871
14864
  accessibleProjects.push(project);
14872
14865
  }
14873
14866
  }
@@ -14910,6 +14903,7 @@ function registerCoSpaceRoutes(app2, deps) {
14910
14903
  ).length,
14911
14904
  participantNames,
14912
14905
  ...displayName === void 0 ? {} : { displayName },
14906
+ ...project.kind === "public" ? { isPublic: true } : {},
14913
14907
  unreadCount: await computeUnread(
14914
14908
  deps,
14915
14909
  actor3.tenantId,
@@ -15991,6 +15985,98 @@ function readSourceMessageId(context) {
15991
15985
  return typeof value === "string" && value.length > 0 ? value : void 0;
15992
15986
  }
15993
15987
 
15988
+ // src/services/collaboration/RoomMessageRetentionJob.ts
15989
+ var DAY_MS = 24 * 60 * 60 * 1e3;
15990
+ var DEFAULT_INTERVAL_MS = 6 * 60 * 60 * 1e3;
15991
+ var DEFAULT_INITIAL_DELAY_MS = 6e4;
15992
+ var DEFAULT_BATCH_SIZE = 500;
15993
+ var MAX_BATCHES_PER_RUN = 1e3;
15994
+ var DEFAULT_RETENTION_DAYS = 60;
15995
+ function parseRetentionDays(value) {
15996
+ if (value === void 0 || value === null) return DEFAULT_RETENTION_DAYS;
15997
+ if (typeof value !== "string") return void 0;
15998
+ const trimmed = value.trim();
15999
+ if (trimmed.length === 0) return DEFAULT_RETENTION_DAYS;
16000
+ const parsed = Number(trimmed);
16001
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : void 0;
16002
+ }
16003
+ var RoomMessageRetentionJob = class {
16004
+ /**
16005
+ * Creates a retention sweep job.
16006
+ *
16007
+ * @param deps Message store slice, positive retention days, and logger.
16008
+ * @param options Optional interval, initial delay, batch size, and clock overrides.
16009
+ */
16010
+ constructor(deps, options = {}) {
16011
+ this.deps = deps;
16012
+ this.disposed = false;
16013
+ this.running = false;
16014
+ this.intervalMs = options.intervalMs ?? DEFAULT_INTERVAL_MS;
16015
+ this.initialDelayMs = options.initialDelayMs ?? DEFAULT_INITIAL_DELAY_MS;
16016
+ this.batchSize = options.batchSize ?? DEFAULT_BATCH_SIZE;
16017
+ this.now = options.now ?? (() => /* @__PURE__ */ new Date());
16018
+ for (const [name, value] of Object.entries({ intervalMs: this.intervalMs, initialDelayMs: this.initialDelayMs, batchSize: this.batchSize })) {
16019
+ if (!Number.isSafeInteger(value) || value < 1) throw new RangeError(`Room message retention ${name} must be a positive safe integer`);
16020
+ }
16021
+ }
16022
+ /** Schedules one delayed initial sweep plus the recurring interval (both unref'd). */
16023
+ start() {
16024
+ if (this.disposed || this.initial !== void 0 || this.interval !== void 0) return;
16025
+ this.initial = setTimeout(() => {
16026
+ this.initial = void 0;
16027
+ void this.runOnce();
16028
+ }, this.initialDelayMs);
16029
+ this.initial.unref?.();
16030
+ this.interval = setInterval(() => void this.runOnce(), this.intervalMs);
16031
+ this.interval.unref?.();
16032
+ }
16033
+ /**
16034
+ * Runs one bounded sweep: batches until a short batch or the per-run batch cap.
16035
+ *
16036
+ * @returns The number of deleted rows (0 on disabled/overlapping runs or failures).
16037
+ */
16038
+ async runOnce() {
16039
+ if (this.disposed || this.running) return 0;
16040
+ this.running = true;
16041
+ try {
16042
+ const before = new Date(this.now().getTime() - this.deps.days * DAY_MS);
16043
+ let deleted = 0;
16044
+ for (let batch = 0; batch < MAX_BATCHES_PER_RUN; batch += 1) {
16045
+ const removed = await this.deps.messages.deleteChatOlderThan({ before, limit: this.batchSize });
16046
+ deleted += removed;
16047
+ if (removed < this.batchSize) break;
16048
+ }
16049
+ if (deleted > 0) this.deps.log.info?.("project-room:message-retention-swept", { deleted, days: this.deps.days });
16050
+ return deleted;
16051
+ } catch (error) {
16052
+ this.deps.log.warn("project-room:message-retention-failed", {
16053
+ days: this.deps.days,
16054
+ error: error instanceof Error ? error.name : "UnknownError"
16055
+ });
16056
+ return 0;
16057
+ } finally {
16058
+ this.running = false;
16059
+ }
16060
+ }
16061
+ /** Stops the timers; an in-flight sweep finishes on its own. */
16062
+ dispose() {
16063
+ this.disposed = true;
16064
+ if (this.initial !== void 0) {
16065
+ clearTimeout(this.initial);
16066
+ this.initial = void 0;
16067
+ }
16068
+ if (this.interval !== void 0) {
16069
+ clearInterval(this.interval);
16070
+ this.interval = void 0;
16071
+ }
16072
+ }
16073
+ };
16074
+ function createRoomMessageRetentionJob(input) {
16075
+ const days = parseRetentionDays(input.days);
16076
+ if (days === void 0) return void 0;
16077
+ return new RoomMessageRetentionJob({ messages: input.messages, days, log: input.log }, input.options);
16078
+ }
16079
+
15994
16080
  // src/services/collaboration/ProjectTaskExecutionMutex.ts
15995
16081
  import { snapshotExactRecord as snapshotExactRecord7 } from "@axiom-lattice/protocols";
15996
16082
  function machineKey(scope) {
@@ -19304,6 +19390,15 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
19304
19390
  const accessService = new ProjectAccessService({ projectStore, membershipStore: projectMembershipStore, userTenantLinkStore });
19305
19391
  const realtimeMode = resolveProjectRoomRealtimeMode();
19306
19392
  const realtimeLog = options.projectTaskLog ?? { warn: () => void 0 };
19393
+ const roomMessageRetention = createRoomMessageRetentionJob({
19394
+ messages: projectRoomMessageStore,
19395
+ days: process.env.PROJECT_ROOM_MESSAGE_RETENTION_DAYS,
19396
+ log: realtimeLog
19397
+ });
19398
+ if (roomMessageRetention) {
19399
+ roomMessageRetention.start();
19400
+ app2.addHook("onClose", () => roomMessageRetention.dispose());
19401
+ }
19307
19402
  const roomPushNotifier = createRoomPushNotifier({
19308
19403
  subscriptionStore: userPushSubscriptionStore,
19309
19404
  membershipStore: projectMembershipStore,