@cadenza.io/service 2.17.7 → 2.17.9

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.mjs CHANGED
@@ -382,16 +382,16 @@ function normalizeServiceTransportConfig(value) {
382
382
  }
383
383
  function normalizeServiceTransportDescriptor(value) {
384
384
  const raw = value ?? {};
385
- const uuid5 = normalizeString(raw.uuid);
385
+ const uuid6 = normalizeString(raw.uuid);
386
386
  const serviceInstanceId = normalizeString(
387
387
  raw.serviceInstanceId ?? raw.service_instance_id
388
388
  );
389
389
  const config = normalizeServiceTransportConfig(raw);
390
- if (!uuid5 || !serviceInstanceId || !config) {
390
+ if (!uuid6 || !serviceInstanceId || !config) {
391
391
  return null;
392
392
  }
393
393
  return {
394
- uuid: uuid5,
394
+ uuid: uuid6,
395
395
  serviceInstanceId,
396
396
  role: config.role,
397
397
  origin: config.origin,
@@ -453,14 +453,14 @@ function normalizeTransportArray(value, serviceInstanceId) {
453
453
  }
454
454
  function normalizeServiceInstanceDescriptor(value) {
455
455
  const raw = value ?? {};
456
- const uuid5 = normalizeString2(raw.uuid);
456
+ const uuid6 = normalizeString2(raw.uuid);
457
457
  const serviceName = normalizeString2(raw.serviceName ?? raw.service_name);
458
- if (!uuid5 || !serviceName) {
458
+ if (!uuid6 || !serviceName) {
459
459
  return null;
460
460
  }
461
- const transports = normalizeTransportArray(raw.transports, uuid5);
461
+ const transports = normalizeTransportArray(raw.transports, uuid6);
462
462
  return {
463
- uuid: uuid5,
463
+ uuid: uuid6,
464
464
  serviceName,
465
465
  numberOfRunningGraphs: Math.max(
466
466
  0,
@@ -903,15 +903,15 @@ var ServiceRegistry = class _ServiceRegistry {
903
903
  if (!serviceInstance) {
904
904
  return false;
905
905
  }
906
- const uuid5 = serviceInstance.uuid;
906
+ const uuid6 = serviceInstance.uuid;
907
907
  const serviceName = serviceInstance.serviceName;
908
908
  const deleted = Boolean(
909
909
  ctx.deleted ?? ctx.serviceInstance?.deleted ?? ctx.data?.deleted
910
910
  );
911
- if (uuid5 === this.serviceInstanceId) return;
911
+ if (uuid6 === this.serviceInstanceId) return;
912
912
  if (deleted) {
913
- const existingInstance = this.instances.get(serviceName)?.find((instance) => instance.uuid === uuid5);
914
- const indexToDelete = this.instances.get(serviceName)?.findIndex((i) => i.uuid === uuid5) ?? -1;
913
+ const existingInstance = this.instances.get(serviceName)?.find((instance) => instance.uuid === uuid6);
914
+ const indexToDelete = this.instances.get(serviceName)?.findIndex((i) => i.uuid === uuid6) ?? -1;
915
915
  if (indexToDelete >= 0 && existingInstance) {
916
916
  this.instances.get(serviceName)?.splice(indexToDelete, 1);
917
917
  for (const transport of existingInstance.transports) {
@@ -923,13 +923,13 @@ var ServiceRegistry = class _ServiceRegistry {
923
923
  if (this.instances.get(serviceName)?.length === 0) {
924
924
  this.instances.delete(serviceName);
925
925
  }
926
- this.unregisterDependee(uuid5, serviceName);
926
+ this.unregisterDependee(uuid6, serviceName);
927
927
  return;
928
928
  }
929
929
  if (!this.instances.has(serviceName))
930
930
  this.instances.set(serviceName, []);
931
931
  const instances = this.instances.get(serviceName);
932
- const existing = instances.find((i) => i.uuid === uuid5);
932
+ const existing = instances.find((i) => i.uuid === uuid6);
933
933
  if (existing) {
934
934
  Object.assign(existing, {
935
935
  ...serviceInstance,
@@ -939,7 +939,7 @@ var ServiceRegistry = class _ServiceRegistry {
939
939
  } else {
940
940
  instances.push(serviceInstance);
941
941
  }
942
- const trackedInstance = existing ?? instances.find((instance) => instance.uuid === uuid5);
942
+ const trackedInstance = existing ?? instances.find((instance) => instance.uuid === uuid6);
943
943
  if (trackedInstance) {
944
944
  const snapshot = this.resolveRuntimeStatusSnapshot(
945
945
  trackedInstance.numberOfRunningGraphs ?? 0,
@@ -952,7 +952,7 @@ var ServiceRegistry = class _ServiceRegistry {
952
952
  trackedInstance.reportedAt = trackedInstance.reportedAt ?? (/* @__PURE__ */ new Date()).toISOString();
953
953
  }
954
954
  if (!serviceInstance.isBootstrapPlaceholder) {
955
- this.reconcileBootstrapPlaceholderInstance(serviceName, uuid5, emit);
955
+ this.reconcileBootstrapPlaceholderInstance(serviceName, uuid6, emit);
956
956
  }
957
957
  if (this.serviceName === serviceName) {
958
958
  return false;
@@ -978,7 +978,7 @@ var ServiceRegistry = class _ServiceRegistry {
978
978
  if (!clientCreated) {
979
979
  emit("meta.service_registry.dependee_registered", {
980
980
  serviceName,
981
- serviceInstanceId: uuid5,
981
+ serviceInstanceId: uuid6,
982
982
  serviceTransportId: trackedTransport.uuid,
983
983
  serviceOrigin: trackedTransport.origin,
984
984
  transportProtocols: trackedTransport.protocols,
@@ -992,7 +992,7 @@ var ServiceRegistry = class _ServiceRegistry {
992
992
  } else {
993
993
  emit("meta.service_registry.routeable_transport_missing", {
994
994
  serviceName,
995
- serviceInstanceId: uuid5,
995
+ serviceInstanceId: uuid6,
996
996
  requiredRole: this.getRoutingTransportRole(),
997
997
  isFrontend: this.isFrontend
998
998
  });
@@ -3233,6 +3233,7 @@ import http from "http";
3233
3233
  import fs from "fs";
3234
3234
  import https from "https";
3235
3235
  import fetch from "node-fetch";
3236
+ import { v4 as uuid3 } from "uuid";
3236
3237
  var RestController = class _RestController {
3237
3238
  /**
3238
3239
  * Constructor for initializing the REST server and related configurations.
@@ -3594,7 +3595,7 @@ var RestController = class _RestController {
3594
3595
  const internalOrigin = httpOrigin ?? httpsOrigin;
3595
3596
  if (internalOrigin) {
3596
3597
  transportData.unshift({
3597
- uuid: `${ctx.__serviceInstanceId}-internal-auto`,
3598
+ uuid: uuid3(),
3598
3599
  service_instance_id: ctx.__serviceInstanceId,
3599
3600
  role: "internal",
3600
3601
  origin: internalOrigin,
@@ -7955,7 +7956,7 @@ function tableFieldTypeToSchemaType(type) {
7955
7956
  }
7956
7957
 
7957
7958
  // src/Cadenza.ts
7958
- import { v4 as uuid3 } from "uuid";
7959
+ import { v4 as uuid4 } from "uuid";
7959
7960
 
7960
7961
  // src/graph/controllers/GraphSyncController.ts
7961
7962
  var ACTOR_TASK_METADATA = /* @__PURE__ */ Symbol.for("@cadenza.io/core/actor-task-meta");
@@ -8017,10 +8018,29 @@ function buildActorRegistrationData(actor) {
8017
8018
  version: 1
8018
8019
  };
8019
8020
  }
8021
+ function resolveSyncServiceName(task) {
8022
+ const taskServiceName = typeof task?.serviceName === "string" ? task.serviceName.trim() : "";
8023
+ const registryServiceName = typeof CadenzaService.serviceRegistry.serviceName === "string" ? CadenzaService.serviceRegistry.serviceName.trim() : "";
8024
+ return taskServiceName || registryServiceName || void 0;
8025
+ }
8026
+ function buildIntentRegistryData(intent) {
8027
+ const name = String(intent?.name ?? "").trim();
8028
+ if (!name) {
8029
+ return null;
8030
+ }
8031
+ return {
8032
+ name,
8033
+ description: typeof intent?.description === "string" ? intent.description : "",
8034
+ input: intent?.input && typeof intent.input === "object" ? intent.input : { type: "object" },
8035
+ output: intent?.output && typeof intent.output === "object" ? intent.output : { type: "object" },
8036
+ isMeta: isMetaIntentName(name)
8037
+ };
8038
+ }
8020
8039
  var GraphSyncController = class _GraphSyncController {
8021
8040
  constructor() {
8022
8041
  this.registeredActors = /* @__PURE__ */ new Set();
8023
8042
  this.registeredActorTaskMaps = /* @__PURE__ */ new Set();
8043
+ this.registeredIntentDefinitions = /* @__PURE__ */ new Set();
8024
8044
  this.isCadenzaDBReady = false;
8025
8045
  }
8026
8046
  static get instance() {
@@ -8028,11 +8048,27 @@ var GraphSyncController = class _GraphSyncController {
8028
8048
  return this._instance;
8029
8049
  }
8030
8050
  init() {
8051
+ const insertIntentRegistryTask = this.isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(
8052
+ "intent_registry",
8053
+ {
8054
+ onConflict: {
8055
+ target: ["name"],
8056
+ action: {
8057
+ do: "nothing"
8058
+ }
8059
+ }
8060
+ },
8061
+ { concurrency: 30 }
8062
+ ) : CadenzaService.get("dbInsertIntentRegistry");
8031
8063
  this.splitRoutinesTask = CadenzaService.createMetaTask(
8032
8064
  "Split routines for registration",
8033
8065
  async function* (ctx, emit) {
8034
8066
  const { routines } = ctx;
8035
8067
  if (!routines) return;
8068
+ const serviceName = resolveSyncServiceName();
8069
+ if (!serviceName) {
8070
+ return;
8071
+ }
8036
8072
  CadenzaService.debounce("meta.sync_controller.synced_resource", {
8037
8073
  delayMs: 2e3
8038
8074
  });
@@ -8043,7 +8079,7 @@ var GraphSyncController = class _GraphSyncController {
8043
8079
  name: routine.name,
8044
8080
  version: routine.version,
8045
8081
  description: routine.description,
8046
- serviceName: CadenzaService.serviceRegistry.serviceName,
8082
+ serviceName,
8047
8083
  isMeta: routine.isMeta
8048
8084
  },
8049
8085
  __routineName: routine.name
@@ -8085,6 +8121,10 @@ var GraphSyncController = class _GraphSyncController {
8085
8121
  function* (ctx) {
8086
8122
  const { routines } = ctx;
8087
8123
  if (!routines) return;
8124
+ const serviceName = resolveSyncServiceName();
8125
+ if (!serviceName) {
8126
+ return;
8127
+ }
8088
8128
  CadenzaService.debounce("meta.sync_controller.synced_resource", {
8089
8129
  delayMs: 3e3
8090
8130
  });
@@ -8104,7 +8144,7 @@ var GraphSyncController = class _GraphSyncController {
8104
8144
  taskVersion: nextTask.version,
8105
8145
  routineName: routine.name,
8106
8146
  routineVersion: routine.version,
8107
- serviceName: CadenzaService.serviceRegistry.serviceName
8147
+ serviceName
8108
8148
  },
8109
8149
  __routineName: routine.name,
8110
8150
  __taskName: nextTask.name
@@ -8207,6 +8247,10 @@ var GraphSyncController = class _GraphSyncController {
8207
8247
  delayMs: 3e3
8208
8248
  });
8209
8249
  const tasks = ctx.tasks;
8250
+ const serviceName = resolveSyncServiceName();
8251
+ if (!serviceName) {
8252
+ return;
8253
+ }
8210
8254
  for (const task of tasks) {
8211
8255
  if (task.registered) continue;
8212
8256
  const { __functionString, __getTagCallback } = task.export();
@@ -8236,7 +8280,7 @@ var GraphSyncController = class _GraphSyncController {
8236
8280
  retryDelay: task.retryDelay,
8237
8281
  retryDelayMax: task.retryDelayMax,
8238
8282
  retryDelayFactor: task.retryDelayFactor,
8239
- service_name: CadenzaService.serviceRegistry.serviceName,
8283
+ service_name: serviceName,
8240
8284
  signals: {
8241
8285
  emits: Array.from(task.emitsSignals),
8242
8286
  signalsToEmitAfter: Array.from(task.signalsToEmitAfter),
@@ -8284,11 +8328,15 @@ var GraphSyncController = class _GraphSyncController {
8284
8328
  CadenzaService.debounce("meta.sync_controller.synced_resource", {
8285
8329
  delayMs: 3e3
8286
8330
  });
8331
+ const serviceName = resolveSyncServiceName();
8332
+ if (!serviceName) {
8333
+ return;
8334
+ }
8287
8335
  const actors = ctx.actors ?? [];
8288
8336
  for (const actor of actors) {
8289
8337
  const data = {
8290
8338
  ...buildActorRegistrationData(actor),
8291
- service_name: CadenzaService.serviceRegistry.serviceName
8339
+ service_name: serviceName
8292
8340
  };
8293
8341
  if (!data.name) {
8294
8342
  continue;
@@ -8344,7 +8392,11 @@ var GraphSyncController = class _GraphSyncController {
8344
8392
  if (!metadata?.actorName) {
8345
8393
  return;
8346
8394
  }
8347
- const registrationKey = `${metadata.actorName}|${task.name}|${task.version}|${CadenzaService.serviceRegistry.serviceName}`;
8395
+ const serviceName = resolveSyncServiceName(task);
8396
+ if (!serviceName) {
8397
+ return;
8398
+ }
8399
+ const registrationKey = `${metadata.actorName}|${task.name}|${task.version}|${serviceName}`;
8348
8400
  if (this.registeredActorTaskMaps.has(registrationKey)) {
8349
8401
  return;
8350
8402
  }
@@ -8354,7 +8406,7 @@ var GraphSyncController = class _GraphSyncController {
8354
8406
  actor_version: 1,
8355
8407
  task_name: task.name,
8356
8408
  task_version: task.version,
8357
- service_name: CadenzaService.serviceRegistry.serviceName,
8409
+ service_name: serviceName,
8358
8410
  mode: metadata.mode,
8359
8411
  description: task.description ?? metadata.actorDescription ?? "",
8360
8412
  is_meta: metadata.actorKind === "meta" || task.isMeta === true
@@ -8409,6 +8461,10 @@ var GraphSyncController = class _GraphSyncController {
8409
8461
  function* (ctx) {
8410
8462
  const task = ctx.task;
8411
8463
  if (task.hidden || !task.register) return;
8464
+ const serviceName = resolveSyncServiceName(task);
8465
+ if (!serviceName) {
8466
+ return;
8467
+ }
8412
8468
  for (const signal of task.observedSignals) {
8413
8469
  const _signal = signal.split(":")[0];
8414
8470
  if (task.registeredSignals.has(signal)) continue;
@@ -8419,7 +8475,7 @@ var GraphSyncController = class _GraphSyncController {
8419
8475
  isGlobal,
8420
8476
  taskName: task.name,
8421
8477
  taskVersion: task.version,
8422
- serviceName: CadenzaService.serviceRegistry.serviceName
8478
+ serviceName
8423
8479
  },
8424
8480
  __taskName: task.name,
8425
8481
  __signal: signal
@@ -8445,6 +8501,46 @@ var GraphSyncController = class _GraphSyncController {
8445
8501
  { concurrency: 30 }
8446
8502
  ) : CadenzaService.get("dbInsertSignalToTaskMap"))?.then(registerSignalTask)
8447
8503
  );
8504
+ this.splitIntentsTask = CadenzaService.createMetaTask(
8505
+ "Split intents for registration",
8506
+ function* (ctx) {
8507
+ CadenzaService.debounce("meta.sync_controller.synced_resource", {
8508
+ delayMs: 3e3
8509
+ });
8510
+ const intents = Array.isArray(ctx.intents) ? ctx.intents : Array.from(CadenzaService.inquiryBroker.intents.values());
8511
+ for (const intent of intents) {
8512
+ const intentData = buildIntentRegistryData(intent);
8513
+ if (!intentData) {
8514
+ continue;
8515
+ }
8516
+ if (this.registeredIntentDefinitions.has(intentData.name)) {
8517
+ continue;
8518
+ }
8519
+ yield {
8520
+ data: intentData,
8521
+ __intentName: intentData.name
8522
+ };
8523
+ }
8524
+ }.bind(this)
8525
+ ).then(
8526
+ insertIntentRegistryTask?.then(
8527
+ CadenzaService.createMetaTask("Record intent definition registration", (ctx) => {
8528
+ if (!ctx.__syncing) {
8529
+ return;
8530
+ }
8531
+ CadenzaService.debounce("meta.sync_controller.synced_resource", {
8532
+ delayMs: 3e3
8533
+ });
8534
+ this.registeredIntentDefinitions.add(ctx.__intentName);
8535
+ return true;
8536
+ }).then(
8537
+ CadenzaService.createUniqueMetaTask(
8538
+ "Gather intent registration",
8539
+ () => true
8540
+ ).emits("meta.sync_controller.synced_intents")
8541
+ )
8542
+ )
8543
+ );
8448
8544
  const registerIntentTask = CadenzaService.createMetaTask(
8449
8545
  "Record intent registration",
8450
8546
  (ctx) => {
@@ -8464,6 +8560,10 @@ var GraphSyncController = class _GraphSyncController {
8464
8560
  function* (ctx) {
8465
8561
  const task = ctx.task;
8466
8562
  if (task.hidden || !task.register) return;
8563
+ const serviceName = resolveSyncServiceName(task);
8564
+ if (!serviceName) {
8565
+ return;
8566
+ }
8467
8567
  task.__registeredIntents = task.__registeredIntents ?? /* @__PURE__ */ new Set();
8468
8568
  task.__invalidMetaIntentWarnings = task.__invalidMetaIntentWarnings ?? /* @__PURE__ */ new Set();
8469
8569
  for (const intent of task.handlesIntents) {
@@ -8483,36 +8583,75 @@ var GraphSyncController = class _GraphSyncController {
8483
8583
  }
8484
8584
  continue;
8485
8585
  }
8586
+ const intentDefinition = buildIntentRegistryData(CadenzaService.inquiryBroker.intents.get(intent)) ?? buildIntentRegistryData({ name: intent });
8587
+ if (!intentDefinition) {
8588
+ continue;
8589
+ }
8486
8590
  yield {
8487
8591
  data: {
8488
8592
  intentName: intent,
8489
8593
  taskName: task.name,
8490
8594
  taskVersion: task.version,
8491
- serviceName: CadenzaService.serviceRegistry.serviceName
8595
+ serviceName
8492
8596
  },
8493
8597
  __taskName: task.name,
8494
- __intent: intent
8598
+ __intent: intent,
8599
+ __intentDefinition: intentDefinition,
8600
+ __intentMapData: {
8601
+ intentName: intent,
8602
+ taskName: task.name,
8603
+ taskVersion: task.version,
8604
+ serviceName
8605
+ }
8495
8606
  };
8496
8607
  }
8497
8608
  }
8498
8609
  ).then(
8499
- (this.isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(
8500
- "intent_to_task_map",
8501
- {
8502
- onConflict: {
8503
- target: [
8504
- "intent_name",
8505
- "task_name",
8506
- "task_version",
8507
- "service_name"
8508
- ],
8509
- action: {
8510
- do: "nothing"
8511
- }
8610
+ CadenzaService.createMetaTask(
8611
+ "Prepare intent definition for intent-to-task map",
8612
+ (ctx) => {
8613
+ if (!ctx.__intentDefinition || !ctx.__intentMapData) {
8614
+ return false;
8512
8615
  }
8513
- },
8514
- { concurrency: 30 }
8515
- ) : CadenzaService.get("dbInsertIntentToTaskMap"))?.then(registerIntentTask)
8616
+ return {
8617
+ ...ctx,
8618
+ data: ctx.__intentDefinition
8619
+ };
8620
+ }
8621
+ ).then(
8622
+ insertIntentRegistryTask?.then(
8623
+ CadenzaService.createMetaTask(
8624
+ "Restore intent-to-task map payload",
8625
+ (ctx) => {
8626
+ if (!ctx.__intentMapData) {
8627
+ return false;
8628
+ }
8629
+ return {
8630
+ ...ctx,
8631
+ data: ctx.__intentMapData
8632
+ };
8633
+ }
8634
+ ).then(
8635
+ (this.isCadenzaDBReady ? CadenzaService.createCadenzaDBInsertTask(
8636
+ "intent_to_task_map",
8637
+ {
8638
+ onConflict: {
8639
+ target: [
8640
+ "intent_name",
8641
+ "task_name",
8642
+ "task_version",
8643
+ "service_name"
8644
+ ],
8645
+ action: {
8646
+ do: "nothing"
8647
+ }
8648
+ }
8649
+ },
8650
+ { concurrency: 30 }
8651
+ ) : CadenzaService.get("dbInsertIntentToTaskMap"))?.then(registerIntentTask)
8652
+ )
8653
+ )
8654
+ )
8516
8655
  );
8517
8656
  this.registerTaskMapTask = CadenzaService.createMetaTask(
8518
8657
  "Register task map to DB",
@@ -8522,18 +8661,26 @@ var GraphSyncController = class _GraphSyncController {
8522
8661
  delayMs: 3e3
8523
8662
  });
8524
8663
  if (task.hidden || !task.register) return;
8664
+ const predecessorServiceName = resolveSyncServiceName(task);
8665
+ if (!predecessorServiceName) {
8666
+ return;
8667
+ }
8525
8668
  for (const t of task.nextTasks) {
8526
8669
  if (task.taskMapRegistration.has(t.name) || t.hidden || !t.register) {
8527
8670
  continue;
8528
8671
  }
8672
+ const serviceName = resolveSyncServiceName(t);
8673
+ if (!serviceName) {
8674
+ continue;
8675
+ }
8529
8676
  yield {
8530
8677
  data: {
8531
8678
  taskName: t.name,
8532
8679
  taskVersion: t.version,
8533
8680
  predecessorTaskName: task.name,
8534
8681
  predecessorTaskVersion: task.version,
8535
- serviceName: CadenzaService.serviceRegistry.serviceName,
8536
- predecessorServiceName: CadenzaService.serviceRegistry.serviceName
8682
+ serviceName,
8683
+ predecessorServiceName
8537
8684
  },
8538
8685
  __taskName: task.name,
8539
8686
  __nextTaskName: t.name
@@ -8580,14 +8727,19 @@ var GraphSyncController = class _GraphSyncController {
8580
8727
  if (task.hidden || !task.register) return;
8581
8728
  if (task.isDeputy && !task.signalName) {
8582
8729
  if (task.registeredDeputyMap) return;
8730
+ const serviceName = resolveSyncServiceName(task);
8731
+ const predecessorServiceName = resolveSyncServiceName();
8732
+ if (!serviceName || !predecessorServiceName) {
8733
+ return;
8734
+ }
8583
8735
  return {
8584
8736
  data: {
8585
8737
  task_name: task.remoteRoutineName,
8586
8738
  task_version: 1,
8587
- service_name: task.serviceName,
8739
+ service_name: serviceName,
8588
8740
  predecessor_task_name: task.name,
8589
8741
  predecessor_task_version: task.version,
8590
- predecessor_service_name: CadenzaService.serviceRegistry.serviceName
8742
+ predecessor_service_name: predecessorServiceName
8591
8743
  },
8592
8744
  __taskName: task.name
8593
8745
  };
@@ -8632,6 +8784,12 @@ var GraphSyncController = class _GraphSyncController {
8632
8784
  "meta.service_registry.initial_sync_complete"
8633
8785
  ).then(this.splitSignalsTask);
8634
8786
  CadenzaService.registry.getAllTasks.clone().doOn("meta.sync_controller.synced_signals").then(this.splitTasksForRegistration);
8787
+ CadenzaService.createMetaTask("Get all intents", (ctx) => {
8788
+ return {
8789
+ ...ctx,
8790
+ intents: Array.from(CadenzaService.inquiryBroker.intents.values())
8791
+ };
8792
+ }).doOn("meta.sync_controller.synced_tasks").then(this.splitIntentsTask);
8635
8793
  CadenzaService.registry.getAllRoutines.clone().doOn("meta.sync_controller.synced_tasks").then(this.splitRoutinesTask);
8636
8794
  CadenzaService.createMetaTask("Get all actors", (ctx) => {
8637
8795
  return {
@@ -8642,9 +8800,9 @@ var GraphSyncController = class _GraphSyncController {
8642
8800
  CadenzaService.registry.doForEachTask.clone().doOn("meta.sync_controller.synced_tasks").then(
8643
8801
  this.registerTaskMapTask,
8644
8802
  this.registerSignalToTaskMapTask,
8645
- this.registerIntentToTaskMapTask,
8646
8803
  this.registerDeputyRelationshipTask
8647
8804
  );
8805
+ CadenzaService.registry.doForEachTask.clone().doOn("meta.sync_controller.synced_tasks", "meta.sync_controller.synced_intents").then(this.registerIntentToTaskMapTask);
8648
8806
  CadenzaService.registry.doForEachTask.clone().doOn("meta.sync_controller.synced_tasks", "meta.sync_controller.synced_actors").then(this.registerActorTaskMapTask);
8649
8807
  CadenzaService.registry.getAllRoutines.clone().doOn("meta.sync_controller.synced_routines").then(this.splitTasksInRoutines);
8650
8808
  CadenzaService.createMetaTask("Finish sync", (ctx, emit) => {
@@ -8711,6 +8869,15 @@ function readConfiguredPort(value) {
8711
8869
  function buildBootstrapUrl(protocol, address, port) {
8712
8870
  return `${protocol}://${address}:${port}`;
8713
8871
  }
8872
+ function readExplicitPortFromOrigin(raw) {
8873
+ const match = raw.match(
8874
+ /^[a-z]+:\/\/(?:\[[^\]]+\]|[^\/?#:]+):(\d+)(?:\/)?$/i
8875
+ );
8876
+ if (!match?.[1]) {
8877
+ return void 0;
8878
+ }
8879
+ return readConfiguredPort(match[1]);
8880
+ }
8714
8881
  function resolveInjectedBootstrapUrl(injectedGlobalKey) {
8715
8882
  if (typeof globalThis === "undefined") {
8716
8883
  return void 0;
@@ -8800,7 +8967,8 @@ function resolveBootstrapEndpoint(options) {
8800
8967
  "Bootstrap URL must be an origin without a path component."
8801
8968
  );
8802
8969
  }
8803
- const port2 = parsed2.port ? readConfiguredPort(parsed2.port) : fallbackPort;
8970
+ const explicitPort = readExplicitPortFromOrigin(raw);
8971
+ const port2 = explicitPort ?? (parsed2.port ? readConfiguredPort(parsed2.port) : fallbackPort);
8804
8972
  if (!port2) {
8805
8973
  throw new Error(
8806
8974
  "Bootstrap URL must include a port or CADENZA_DB_PORT must be provided."
@@ -8894,9 +9062,9 @@ var CadenzaService = class {
8894
9062
  static normalizeDeclaredTransports(transports, serviceId) {
8895
9063
  return (transports ?? []).map((transport) => normalizeServiceTransportConfig(transport)).filter(
8896
9064
  (transport) => !!transport
8897
- ).map((transport, index) => ({
9065
+ ).map((transport) => ({
8898
9066
  ...transport,
8899
- uuid: `${serviceId}-transport-${index + 1}`
9067
+ uuid: uuid4()
8900
9068
  }));
8901
9069
  }
8902
9070
  static createBootstrapTransport(serviceInstanceId, role, endpoint) {
@@ -9140,7 +9308,7 @@ var CadenzaService = class {
9140
9308
  }
9141
9309
  for (const responder of responders) {
9142
9310
  const { task, descriptor } = responder;
9143
- const inquiryId = uuid3();
9311
+ const inquiryId = uuid4();
9144
9312
  startTimeByTask.set(task, Date.now());
9145
9313
  const resolverTask = this.createEphemeralMetaTask(
9146
9314
  `Resolve inquiry ${inquiry} for ${descriptor.localTaskName}`,
@@ -9629,7 +9797,7 @@ var CadenzaService = class {
9629
9797
  this.bootstrap();
9630
9798
  this.validateName(serviceName);
9631
9799
  this.validateServiceName(serviceName);
9632
- const serviceId = options.customServiceId ?? uuid3();
9800
+ const serviceId = options.customServiceId ?? uuid4();
9633
9801
  this.serviceRegistry.serviceName = serviceName;
9634
9802
  this.serviceRegistry.serviceInstanceId = serviceId;
9635
9803
  this.setHydrationResults(options.hydration);
@@ -10460,7 +10628,7 @@ import {
10460
10628
  } from "@cadenza.io/core";
10461
10629
 
10462
10630
  // src/ssr/createSSRInquiryBridge.ts
10463
- import { v4 as uuid4 } from "uuid";
10631
+ import { v4 as uuid5 } from "uuid";
10464
10632
  function ensureFetch() {
10465
10633
  if (typeof globalThis.fetch !== "function") {
10466
10634
  throw new Error("SSR inquiry bridge requires global fetch support.");
@@ -10536,7 +10704,7 @@ function createSSRInquiryBridge(options = {}) {
10536
10704
  __remoteRoutineName: remoteRoutineName,
10537
10705
  __metadata: {
10538
10706
  ...context.__metadata ?? {},
10539
- __deputyExecId: uuid4()
10707
+ __deputyExecId: uuid5()
10540
10708
  }
10541
10709
  }),
10542
10710
  signal