@camstack/server 1.2.192 → 1.2.195

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.
@@ -524,6 +524,14 @@ async function startAgent(configPath) {
524
524
  // cap). A pin to ANOTHER node still bypasses the sibling → onUnownedCall.
525
525
  ownNodeId: agentNodeId,
526
526
  onUnownedCall,
527
+ // NO `capUsageObserver` here, deliberately. `getCapUsageRegistry()` is a
528
+ // per-process singleton and the reader (`nodes.getCapUsageGraph`) runs on
529
+ // hub-main; recording in the agent would produce a map nobody ever reads,
530
+ // which is exactly the shape that made this graph return `[]` for
531
+ // months. An agent's addon traffic is a KNOWN blind spot of the graph —
532
+ // see `LocalChildRegistryOptions.capUsageObserver`. Closing it needs the
533
+ // caller identity to survive `$hub-cap-fwd`'s envelope, which today it
534
+ // does not.
527
535
  });
528
536
  await agentUdsRegistry.start();
529
537
  // E1: apply child manifest + cleanup from the UDS lifecycle (agent-local children).
@@ -623,8 +623,34 @@ function buildNodesProvider(agentRegistry, moleculer, addonRegistry, getNodeRoot
623
623
  }
624
624
  return result;
625
625
  },
626
+ /**
627
+ * Observed caller → provider → cap edges over the last `windowSeconds`.
628
+ *
629
+ * **Read the blind spots before drawing a conclusion.** This reads
630
+ * hub-main's `CapUsageRegistry`, written by the hub's `LocalChildRegistry`
631
+ * on every `cap-call-out` a hub-local forked addon sends. It therefore does
632
+ * NOT contain: hub-main → hub-main in-process calls (one shared `ctx.api`
633
+ * client, no per-caller identity), a runner's own co-located calls, or any
634
+ * traffic originating on an agent. An edge missing here means "not seen on
635
+ * this plane", never "did not happen" — the full list is on
636
+ * `LocalChildRegistryOptions.capUsageObserver`.
637
+ */
626
638
  getCapUsageGraph: async (input) => {
627
639
  const reg = (0, system_1.getCapUsageRegistry)();
640
+ const stats = reg.getStats();
641
+ if (stats.droppedTriples > 0) {
642
+ // The registry is bounded (it lives on hub-main — D181). If it ever
643
+ // truncates, the operator asking this question is told, because a
644
+ // silently incomplete diagnostic is the defect this surface exists to
645
+ // fix (D237).
646
+ logger?.warn('cap-usage graph is truncated — the triple ceiling was reached', {
647
+ meta: {
648
+ triples: stats.triples,
649
+ maxTriples: stats.maxTriples,
650
+ droppedTriples: stats.droppedTriples,
651
+ },
652
+ });
653
+ }
628
654
  return reg.getGraph({ windowSeconds: input.windowSeconds, nowMs: Date.now() });
629
655
  },
630
656
  setProcessLogLevel: async (input) => {
@@ -6103,6 +6103,15 @@ function createCapRouter_pipelineAnalytics(getProvider, createRemoteProxy) {
6103
6103
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
6104
6104
  return p.countUnstampedEventMedia(methodInput);
6105
6105
  }),
6106
+ countRelocatableMedia: trpc_middleware_js_1.adminProcedure
6107
+ .input(types_85.pipelineAnalyticsCapability.methods.countRelocatableMedia.input.loose())
6108
+ .output(types_85.pipelineAnalyticsCapability.methods.countRelocatableMedia.output)
6109
+ .query(async ({ input, ctx }) => {
6110
+ const { nodeId, ...methodInput } = input;
6111
+ const p = resolveProvider('pipeline-analytics', nodeId, () => getProvider(ctx), createRemoteProxy);
6112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
6113
+ return p.countRelocatableMedia(methodInput);
6114
+ }),
6106
6115
  listRelocateMediaJobs: trpc_middleware_js_1.adminProcedure
6107
6116
  .input(types_85.pipelineAnalyticsCapability.methods.listRelocateMediaJobs.input.loose())
6108
6117
  .output(types_85.pipelineAnalyticsCapability.methods.listRelocateMediaJobs.output)
@@ -7813,6 +7822,15 @@ function createCapRouter_recording(getProvider, createRemoteProxy) {
7813
7822
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7814
7823
  return p.listRelocateJobs(methodInput);
7815
7824
  }),
7825
+ getRelocateResidue: trpc_middleware_js_1.adminProcedure
7826
+ .input(types_95.recordingCapability.methods.getRelocateResidue.input.loose())
7827
+ .output(types_95.recordingCapability.methods.getRelocateResidue.output)
7828
+ .query(async ({ input, ctx }) => {
7829
+ const { nodeId, ...methodInput } = input;
7830
+ const p = resolveProvider('recording', nodeId, () => getProvider(ctx), createRemoteProxy);
7831
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
7832
+ return p.getRelocateResidue(methodInput);
7833
+ }),
7816
7834
  cancelRelocateJob: trpc_middleware_js_1.adminProcedure
7817
7835
  .input(types_95.recordingCapability.methods.cancelRelocateJob.input.loose())
7818
7836
  .output(types_95.recordingCapability.methods.cancelRelocateJob.output)
@@ -8601,6 +8619,33 @@ function createCapRouter_storageMigration(getProvider, createRemoteProxy) {
8601
8619
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
8602
8620
  return p.cancel(methodInput);
8603
8621
  }),
8622
+ movers: trpc_middleware_js_1.adminProcedure
8623
+ .input(types_106.storageMigrationCapability.methods.movers.input.loose())
8624
+ .output(types_106.storageMigrationCapability.methods.movers.output)
8625
+ .query(async ({ input, ctx }) => {
8626
+ const { nodeId, ...methodInput } = input;
8627
+ const p = resolveProvider('storage-migration', nodeId, () => getProvider(ctx), createRemoteProxy);
8628
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
8629
+ return p.movers(methodInput);
8630
+ }),
8631
+ residue: trpc_middleware_js_1.adminProcedure
8632
+ .input(types_106.storageMigrationCapability.methods.residue.input.loose())
8633
+ .output(types_106.storageMigrationCapability.methods.residue.output)
8634
+ .query(async ({ input, ctx }) => {
8635
+ const { nodeId, ...methodInput } = input;
8636
+ const p = resolveProvider('storage-migration', nodeId, () => getProvider(ctx), createRemoteProxy);
8637
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
8638
+ return p.residue(methodInput);
8639
+ }),
8640
+ drain: trpc_middleware_js_1.adminProcedure
8641
+ .input(types_106.storageMigrationCapability.methods.drain.input.loose())
8642
+ .output(types_106.storageMigrationCapability.methods.drain.output)
8643
+ .mutation(async ({ input, ctx }) => {
8644
+ const { nodeId, ...methodInput } = input;
8645
+ const p = resolveProvider('storage-migration', nodeId, () => getProvider(ctx), createRemoteProxy);
8646
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
8647
+ return p.drain(methodInput);
8648
+ }),
8604
8649
  });
8605
8650
  }
8606
8651
  function createCapRouter_storageProvider(getProvider, createRemoteProxy) {
@@ -9948,6 +9993,24 @@ function createCapRouter_vectorStore(getProvider, createRemoteProxy) {
9948
9993
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
9949
9994
  return p.getByIds(methodInput);
9950
9995
  }),
9996
+ fetchByIds: trpc_middleware_js_1.adminProcedure
9997
+ .input(types_121.vectorStoreCapability.methods.fetchByIds.input.loose())
9998
+ .output(types_121.vectorStoreCapability.methods.fetchByIds.output)
9999
+ .query(async ({ input, ctx }) => {
10000
+ const { nodeId, ...methodInput } = input;
10001
+ const p = resolveProvider('vector-store', nodeId, () => getProvider(ctx), createRemoteProxy);
10002
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
10003
+ return p.fetchByIds(methodInput);
10004
+ }),
10005
+ scan: trpc_middleware_js_1.adminProcedure
10006
+ .input(types_121.vectorStoreCapability.methods.scan.input.loose())
10007
+ .output(types_121.vectorStoreCapability.methods.scan.output)
10008
+ .query(async ({ input, ctx }) => {
10009
+ const { nodeId, ...methodInput } = input;
10010
+ const p = resolveProvider('vector-store', nodeId, () => getProvider(ctx), createRemoteProxy);
10011
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
10012
+ return p.scan(methodInput);
10013
+ }),
9951
10014
  deleteByIds: trpc_middleware_js_1.adminProcedure
9952
10015
  .input(types_121.vectorStoreCapability.methods.deleteByIds.input.loose())
9953
10016
  .output(types_121.vectorStoreCapability.methods.deleteByIds.output)
@@ -3244,7 +3244,7 @@ class AddonRegistryService {
3244
3244
  //
3245
3245
  // The purge mutates the PROCESS-GLOBAL require cache, so purge-then-import
3246
3246
  // must stay atomic per BUNDLE now that the boot plan overlaps (D171):
3247
- // `@camstack/addon-remote-storage` ships three addon ids whose entries all
3247
+ // `@camstack/addon-remote-storage` ships four addon ids whose entries all
3248
3248
  // resolve into one `dist/`, and a sibling's purge landing mid-import would
3249
3249
  // evict a module graph while it is being evaluated. Different bundles
3250
3250
  // still load concurrently.
@@ -68,10 +68,10 @@ async function spawnPlanConcurrently(plan, spawnOne, concurrency = exports.RUNNE
68
68
  * same directory is still resolving, evicting half of a module graph that is
69
69
  * being evaluated — duplicate module instances, or a partially-purged one.
70
70
  *
71
- * It is not hypothetical: `@camstack/addon-remote-storage` ships three addon
72
- * ids (`sftp-storage`, `s3-storage`, `webdav-storage`) whose entries all
73
- * resolve into the same `dist/` directory, each on its own runner, all in the
74
- * same plan.
71
+ * It is not hypothetical: `@camstack/addon-remote-storage` ships four addon
72
+ * ids (`sftp-storage`, `s3-storage`, `webdav-storage`, `smb-storage`) whose
73
+ * entries all resolve into the same `dist/` directory, each on its own runner,
74
+ * all in the same plan.
75
75
  *
76
76
  * Keyed by the purge scope, so the bound above still applies across packages
77
77
  * and only true siblings queue behind each other.
@@ -396,6 +396,14 @@ class MoleculerService {
396
396
  // across a socket too — and one that hangs is cut off on both.
397
397
  capTimeoutMs: (capName, method) => this.capabilityService.getRegistry()?.getDefinition(capName)?.methods?.[method]
398
398
  ?.timeoutMs,
399
+ // Feed the cap-usage graph from the one place that sees a forked
400
+ // addon's outbound `ctx.api` traffic AND runs in the process that reads
401
+ // it back (`nodes.getCapUsageGraph` → `cap-providers.ts`). The
402
+ // runner-side observer in `addon-context-factory.ts` writes to the
403
+ // RUNNER's own module singleton, which hub-main never sees — which is
404
+ // why the graph answered `[]` on a hub running 64 addons. Blind spots
405
+ // that remain are listed on `LocalChildRegistryOptions.capUsageObserver`.
406
+ capUsageObserver: (obs) => (0, system_1.getCapUsageRegistry)().recordCall(obs),
399
407
  logger: {
400
408
  info: (msg, meta) => logger.info(msg, meta !== null && meta !== undefined
401
409
  ? { meta: meta }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/server",
3
- "version": "1.2.192",
3
+ "version": "1.2.195",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",