@indexnetwork/protocol 18.0.0-rc.481.1 → 20.0.0-rc.483.1

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 (52) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/IMPLEMENTATION.md +27 -10
  3. package/dist/contacts/application/contact.tools.js +1 -3
  4. package/dist/contacts/domain/contact.types.d.ts +0 -2
  5. package/dist/contexts/application/index.d.ts +0 -1
  6. package/dist/contexts/application/index.js +0 -1
  7. package/dist/enrichment/enrichment.graph.js +1 -36
  8. package/dist/index.d.ts +2 -3
  9. package/dist/index.js +4 -3
  10. package/dist/networks/{application/indexer.graph.d.ts → indexer.graph.d.ts} +11 -7
  11. package/dist/networks/{application/indexer.graph.js → indexer.graph.js} +6 -6
  12. package/dist/networks/{application/indexer.state.d.ts → indexer.state.d.ts} +7 -17
  13. package/dist/networks/{application/indexer.state.js → indexer.state.js} +6 -10
  14. package/dist/networks/{application/membership.graph.d.ts → membership.graph.d.ts} +2 -4
  15. package/dist/networks/{application/membership.graph.js → membership.graph.js} +3 -3
  16. package/dist/networks/{domain/membership.state.d.ts → membership.state.d.ts} +0 -2
  17. package/dist/networks/{domain/membership.state.js → membership.state.js} +0 -2
  18. package/dist/networks/{application/network.graph.d.ts → network.graph.d.ts} +2 -4
  19. package/dist/networks/{application/network.graph.js → network.graph.js} +3 -3
  20. package/dist/networks/network.module.d.ts +1314 -0
  21. package/dist/networks/network.module.js +83 -0
  22. package/dist/networks/{application/network.recommender.d.ts → network.recommender.d.ts} +0 -2
  23. package/dist/networks/{application/network.recommender.js → network.recommender.js} +4 -6
  24. package/dist/networks/{domain/network.state.d.ts → network.state.d.ts} +0 -2
  25. package/dist/networks/{domain/network.state.js → network.state.js} +0 -2
  26. package/dist/networks/{application/network.tools.d.ts → network.tools.d.ts} +5 -4
  27. package/dist/networks/{application/network.tools.js → network.tools.js} +5 -7
  28. package/dist/opportunities/application/opportunity.tools.cards.d.ts +1 -2
  29. package/dist/opportunities/application/opportunity.tools.cards.js +1 -2
  30. package/dist/opportunities/application/opportunity.tools.list.js +0 -4
  31. package/dist/opportunities/radar/radar.graph.js +0 -4
  32. package/dist/opportunities/radar/radar.state.d.ts +0 -2
  33. package/dist/shared/agent/tool.factory.js +6 -6
  34. package/dist/shared/agent/tool.registry.js +2 -2
  35. package/dist/shared/agent/utility.tools.js +1 -2
  36. package/dist/shared/interfaces/database.capabilities.d.ts +2 -2
  37. package/dist/shared/interfaces/database.entities.d.ts +0 -3
  38. package/dist/shared/interfaces/database.identity-queries.d.ts +0 -28
  39. package/dist/shared/interfaces/database.member-queries.d.ts +0 -2
  40. package/package.json +1 -1
  41. package/dist/enrichment/enrichment.enricher.d.ts +0 -18
  42. package/dist/enrichment/enrichment.enricher.js +0 -30
  43. package/dist/networks/application/index.d.ts +0 -45
  44. package/dist/networks/application/index.js +0 -50
  45. package/dist/networks/domain/index.d.ts +0 -29
  46. package/dist/networks/domain/index.js +0 -31
  47. package/dist/networks/index.d.ts +0 -9
  48. package/dist/networks/index.js +0 -8
  49. package/dist/networks/ports/communities.tools.port.d.ts +0 -5
  50. package/dist/networks/ports/communities.tools.port.js +0 -1
  51. package/dist/networks/ports/index.d.ts +0 -27
  52. package/dist/networks/ports/index.js +0 -23
package/CHANGELOG.md CHANGED
@@ -20,6 +20,60 @@ went 6.7.1 → 8.0.2 with no 7.x in between because the whole 7.x line shipped a
20
20
  prereleases between the two promotions. To track every change, read `rc`; to
21
21
  pin a supported release, use `latest`.
22
22
 
23
+ ## 20.0.0 - 2026-08-17
24
+
25
+ ### Changed
26
+
27
+ - **BREAKING**: The communities capability ships as one class, `Networks`,
28
+ mirroring `Intents`. `NetworkGraphFactory`, `NetworkMembershipGraphFactory`
29
+ and `IntentNetworkGraphFactory` are no longer exported from the package root;
30
+ construct `new Networks({ database, indexer })` and call `createGraph()`,
31
+ `createMembershipGraph()` or `createAssignmentGraph()`. `createNetworkTools`
32
+ is now `Networks.createTools`. Graph behaviour is unchanged.
33
+
34
+ ```typescript
35
+ // before
36
+ const indexGraph = new NetworkGraphFactory(database).createGraph();
37
+ const membershipGraph = new NetworkMembershipGraphFactory(database).createGraph();
38
+ const assignmentGraph = new IntentNetworkGraphFactory(database, intents).createGraph();
39
+
40
+ // after
41
+ const networks = new Networks({ database, indexer: intents });
42
+ const indexGraph = networks.createGraph();
43
+ const membershipGraph = networks.createMembershipGraph();
44
+ const assignmentGraph = networks.createAssignmentGraph();
45
+ ```
46
+
47
+ - `networks/` is flat: the `application/`, `domain/` and `ports/` directories are
48
+ gone, and `network.module.ts` is the capability's only public surface.
49
+ `NetworkToolDeps` now comes from that module rather than
50
+ `networks/ports/communities.tools.port.ts`, and the narrowed indexer port is
51
+ exported as `IntentNetworkIndexer`.
52
+
53
+ ## 19.0.0 - 2026-08-17
54
+
55
+ ### Removed
56
+
57
+ - **BREAKING**: Retire ghost users. `softDeleteGhost`, `mergeGhostUser` and
58
+ `findDuplicateUser` are gone from the database port, along with `isGhost` on
59
+ every entity, contact payload, member row and opportunity card.
60
+ - **BREAKING**: Remove `shouldEnrichGhostDisplayNameFromParallel` and
61
+ `isEnrichedNameMeaningful` (and the `enrichment.enricher` module). Both were
62
+ ghost-only: the first returned `false` for every real account.
63
+ - **BREAKING**: `buildMinimalOpportunityCard` loses its trailing
64
+ `isCounterpartGhost` parameter and the `isGhost` field on its result. The
65
+ primary action label was never derived from it — it reads `viewerRole` alone —
66
+ so labels are unchanged.
67
+
68
+ ### Changed
69
+
70
+ - The enrichment graph no longer soft-deletes or merges on the ghost paths. A
71
+ non-human enrichment result still aborts with `"Non-human entity detected"`;
72
+ it previously also called `softDeleteGhost`, which the host implemented as a
73
+ no-op for any non-ghost, so behaviour for real accounts is identical.
74
+ - Low-confidence and failed enrichment now always fall through to basic info.
75
+ That was already the real-account path; only the ghost early-return is gone.
76
+
23
77
  ## 18.0.0 - 2026-08-17
24
78
 
25
79
  ### Changed
package/IMPLEMENTATION.md CHANGED
@@ -148,9 +148,6 @@ import {
148
148
  PremiseGraphFactory,
149
149
  NegotiationGraphFactory,
150
150
  HydeGraphFactory,
151
- NetworkGraphFactory,
152
- NetworkMembershipGraphFactory,
153
- IntentNetworkGraphFactory,
154
151
  RadarGraphFactory,
155
152
  MaintenanceGraphFactory,
156
153
  } from "@indexnetwork/protocol";
@@ -159,8 +156,9 @@ import {
159
156
  Each factory takes its typed dependencies in the constructor and exposes a
160
157
  `.createGraph()` method that returns a compiled LangGraph ready for `.invoke()`.
161
158
 
162
- The intent lifecycle graph is the exception: it is reached through the `Intents`
163
- module rather than a factory of its own (see [Intents](#intents) below).
159
+ The intent and community graphs are the exceptions: they are reached through the
160
+ `Intents` and `Networks` module classes rather than factories of their own (see
161
+ [Intents](#intents) and [Networks](#networks) below).
164
162
 
165
163
  | Factory | Workflow |
166
164
  |---|---|
@@ -170,9 +168,6 @@ module rather than a factory of its own (see [Intents](#intents) below).
170
168
  | `PremiseGraphFactory` | Decompose and index a user's premises |
171
169
  | `NegotiationGraphFactory` | Multi-turn bilateral negotiation flows |
172
170
  | `HydeGraphFactory` | Generate hypothetical documents and embed them (cache-aware) |
173
- | `NetworkGraphFactory` | Manage network/network CRUD |
174
- | `NetworkMembershipGraphFactory` | Manage network/network member join/leave |
175
- | `IntentNetworkGraphFactory` | Evaluate and assign/unassign intents to indexes |
176
171
  | `RadarGraphFactory` | Build the radar view: flat presenter-card list, optionally intent-scoped |
177
172
  | `MaintenanceGraphFactory` | Periodic maintenance (feed health, opportunity expiration) |
178
173
 
@@ -213,12 +208,34 @@ first use, so an unused method costs nothing.
213
208
  | `Intents.normalizeDescription(description)` | Normalize a description to its persisted form |
214
209
  | `Intents.FALLBACK_INTAKE_QUESTION` | The static round-1 question used when generation is unavailable |
215
210
 
216
- `IntentNetworkGraphFactory` takes an `Intents` instance as its evaluator:
211
+ ## Networks
212
+
213
+ Communities ship the same way: one class covering the community lifecycle graph,
214
+ the membership graph, signal↔community assignment, and the agent-facing
215
+ community tools.
217
216
 
218
217
  ```typescript
219
- const intentNetworkGraph = new IntentNetworkGraphFactory(database, intents).createGraph();
218
+ import { Networks } from "@indexnetwork/protocol";
219
+
220
+ const networks = new Networks({
221
+ database, // community, roster, and assignment persistence
222
+ indexer: intents, // an `Intents` instance — scores a signal against a community
223
+ });
220
224
  ```
221
225
 
226
+ Both dependencies are optional; each method names what it requires, so a host
227
+ that only registers tools can construct `new Networks()` with nothing.
228
+
229
+ | Method | Purpose |
230
+ |---|---|
231
+ | `createGraph()` | Compile the community lifecycle graph — create, read, update, delete. Requires `database` |
232
+ | `createMembershipGraph()` | Compile the roster graph — add, list, remove members. Requires `database` |
233
+ | `createAssignmentGraph()` | Compile signal↔community assignment, direct or model-evaluated. Requires `database` and `indexer` |
234
+ | `Networks.createTools(defineTool, deps)` | Register the agent-facing community tools |
235
+
236
+ Assignment takes an `Intents` instance as its evaluator — the `indexer`
237
+ dependency is narrowed to the single `indexIntent` method it calls.
238
+
222
239
  ## MCP server
223
240
 
224
241
  The package exports a factory that registers every chat tool over the Model Context Protocol and attaches a canonical `instructions` block (`MCP_INSTRUCTIONS`) that every connecting runtime follows. The factory takes three arguments:
@@ -43,7 +43,6 @@ export function createContactTools(defineTool, deps) {
43
43
  name: c.user.name,
44
44
  email: c.user.email,
45
45
  avatar: c.user.avatar,
46
- isGhost: c.user.isGhost,
47
46
  })),
48
47
  });
49
48
  }
@@ -81,7 +80,7 @@ export function createContactTools(defineTool, deps) {
81
80
  "Use when the user refers to a contact by partial name or email and you need their userId for another tool " +
82
81
  "(e.g. read_user_contexts).\n\n" +
83
82
  "**When to use:** Before list_contacts when the network is large — returns only matching contacts, bounded by limit.\n\n" +
84
- "**Returns:** Array of matching contacts: userId, name, email, avatar, isGhost.",
83
+ "**Returns:** Array of matching contacts: userId, name, email, avatar.",
85
84
  querySchema: z.object({
86
85
  query: z.string().trim().min(1).describe('Free-text query matched against contact name and email (case-insensitive, substring).'),
87
86
  limit: z.number().int().positive().max(100).optional().describe('Maximum rows to return. Defaults to 25.'),
@@ -96,7 +95,6 @@ export function createContactTools(defineTool, deps) {
96
95
  name: r.name,
97
96
  email: r.email,
98
97
  avatar: r.avatar,
99
- isGhost: r.isGhost,
100
98
  })),
101
99
  });
102
100
  }
@@ -13,7 +13,6 @@ export interface ContactEntry {
13
13
  name: string;
14
14
  email: string;
15
15
  avatar: string | null;
16
- isGhost: boolean;
17
16
  };
18
17
  }
19
18
  /** Flat contact row returned by searchContacts. */
@@ -22,5 +21,4 @@ export interface ContactSearchResult {
22
21
  name: string;
23
22
  email: string;
24
23
  avatar: string | null;
25
- isGhost: boolean;
26
24
  }
@@ -59,7 +59,6 @@ export { PremiseAnalyzer, type PremiseAnalyzerOutput, } from "../../premises/pre
59
59
  export { PremiseIndexer, type PremiseIndexerOutput, } from "../../premises/premise.indexer.js";
60
60
  export { EnrichmentGraphFactory, type CompiledPremiseGraph, } from "../../enrichment/enrichment.graph.js";
61
61
  export { EnrichmentGenerator, type GeneratedProfile } from "../../enrichment/enrichment.generator.js";
62
- export { shouldEnrichGhostDisplayNameFromParallel, isEnrichedNameMeaningful, } from "../../enrichment/enrichment.enricher.js";
63
62
  export { createEnrichmentTools } from "../../enrichment/enrichment.tools.js";
64
63
  export { createPremiseTools } from "../../premises/premise.tools.js";
65
64
  export { UserContextGenerator } from "../../contexts/context.generator.js";
@@ -62,7 +62,6 @@ export { PremiseIndexer, } from "../../premises/premise.indexer.js";
62
62
  // ── Enrichment graph + service classes ───────────────────────────────────────
63
63
  export { EnrichmentGraphFactory, } from "../../enrichment/enrichment.graph.js";
64
64
  export { EnrichmentGenerator } from "../../enrichment/enrichment.generator.js";
65
- export { shouldEnrichGhostDisplayNameFromParallel, isEnrichedNameMeaningful, } from "../../enrichment/enrichment.enricher.js";
66
65
  // ── Tool factories (foreground adapters) ──────────────────────────────────────
67
66
  // These are foreground adapter entry points consumed by the tool composition root (shared/agent)
68
67
  // composition. They accept compiled graphs and host deps through the tool-dep
@@ -1,6 +1,5 @@
1
1
  import { StateGraph, START, END } from "@langchain/langgraph";
2
2
  import { EnrichmentGraphState } from "./enrichment.state.js";
3
- import { shouldEnrichGhostDisplayNameFromParallel, isEnrichedNameMeaningful } from "./enrichment.enricher.js";
4
3
  import { socialsToEnrichmentRequest } from "../shared/utils/social-label.js";
5
4
  import { protocolLogger } from "../shared/observability/protocol.logger.js";
6
5
  import { timed } from "../shared/observability/performance.js";
@@ -376,8 +375,7 @@ export async function autoGenerateNode(state, deps) {
376
375
  try {
377
376
  const enrichment = await deps.enricher.enrichUserProfile(request);
378
377
  if (enrichment && !enrichment.isHuman) {
379
- logger.info("Enrichment detected non-human entity, soft-deleting ghost", { userId: state.userId });
380
- await deps.database.softDeleteGhost(state.userId);
378
+ logger.info("Enrichment detected non-human entity, aborting", { userId: state.userId });
381
379
  return { error: "Non-human entity detected" };
382
380
  }
383
381
  const hasMeaningfulEnrichment = !!enrichment &&
@@ -387,11 +385,6 @@ export async function autoGenerateNode(state, deps) {
387
385
  enrichment.attributes.skills.length > 0 ||
388
386
  enrichment.attributes.interests.length > 0);
389
387
  if (hasMeaningfulEnrichment) {
390
- if (user.isGhost && !isEnrichedNameMeaningful(user.email || '', enrichment.identity.name || '')) {
391
- logger.info("Enrichment has content but no real name for ghost, soft-deleting", { userId: state.userId });
392
- await deps.database.softDeleteGhost(state.userId);
393
- return { error: "No real name found for ghost user" };
394
- }
395
388
  logger.verbose("Chat API enrichment succeeded", {
396
389
  userId: state.userId,
397
390
  skillsCount: enrichment.attributes.skills.length,
@@ -399,11 +392,6 @@ export async function autoGenerateNode(state, deps) {
399
392
  });
400
393
  // Update user record with enriched data
401
394
  const updatePayload = {};
402
- const enrichedName = enrichment.identity.name?.trim();
403
- if (enrichedName &&
404
- shouldEnrichGhostDisplayNameFromParallel({ isGhost: !!user.isGhost, name: user.name ?? '', email: user.email ?? '' }, enrichedName)) {
405
- updatePayload.name = enrichedName;
406
- }
407
395
  if (enrichment.identity.bio?.trim())
408
396
  updatePayload.intro = enrichment.identity.bio.trim();
409
397
  if (enrichment.identity.location?.trim())
@@ -435,19 +423,6 @@ export async function autoGenerateNode(state, deps) {
435
423
  if (Object.keys(updatePayload).length > 0) {
436
424
  await deps.database.updateUser(state.userId, updatePayload);
437
425
  }
438
- // Post-enrichment dedup: check if this ghost matches an existing user
439
- if (user.isGhost) {
440
- const currentSocials = await deps.database.getUserSocials(state.userId);
441
- const duplicate = await deps.database.findDuplicateUser(state.userId, currentSocials);
442
- if (duplicate) {
443
- logger.info("Post-enrichment dedup: merging ghost into existing user", {
444
- ghostId: state.userId,
445
- targetId: duplicate.id,
446
- });
447
- await deps.database.mergeGhostUser(state.userId, duplicate.id);
448
- return { error: `Merged as duplicate of user ${duplicate.id}` };
449
- }
450
- }
451
426
  // Build a text blob from the enrichment result so it flows
452
427
  // through premise decomposition (when available) rather than
453
428
  // bypassing premises via prePopulatedProfile.
@@ -468,19 +443,9 @@ export async function autoGenerateNode(state, deps) {
468
443
  operationsPerformed: { scraped: true },
469
444
  };
470
445
  }
471
- if (user.isGhost) {
472
- logger.info("Low-confidence enrichment for ghost, soft-deleting", { userId: state.userId });
473
- await deps.database.softDeleteGhost(state.userId);
474
- return { error: "Enrichment not confident for ghost user" };
475
- }
476
446
  logger.warn("Chat API returned low-signal enrichment, falling back to basic info", { userId: state.userId });
477
447
  }
478
448
  catch (enrichErr) {
479
- if (user.isGhost) {
480
- logger.info("Enrichment failed for ghost, soft-deleting", { userId: state.userId });
481
- await deps.database.softDeleteGhost(state.userId);
482
- return { error: "Enrichment failed for ghost user" };
483
- }
484
449
  logger.warn("Chat API enrichment failed, falling back to basic info", {
485
450
  userId: state.userId,
486
451
  error: enrichErr instanceof Error ? enrichErr.message : String(enrichErr),
package/dist/index.d.ts CHANGED
@@ -39,9 +39,8 @@ export { REPORTER_PERSONA_ID, REPORTER_PERSONA, REPORTER_BRIEFING_KICKOFF, } fro
39
39
  export { ONBOARDING_PERSONA_ID, ONBOARDING_PERSONA, } from "./agents/index.js";
40
40
  export { RadarGraphFactory } from "./opportunities/index.js";
41
41
  export { HydeGraphFactory } from "./discovery/index.js";
42
- export { NetworkGraphFactory } from "./networks/index.js";
43
- export { NetworkMembershipGraphFactory } from "./networks/index.js";
44
- export { IntentNetworkGraphFactory } from "./networks/index.js";
42
+ export { Networks } from "./networks/network.module.js";
43
+ export type { IntentNetworkIndexer, NetworksDeps, NetworkToolDeps, } from "./networks/network.module.js";
45
44
  export { Intents } from "./intents/intent.module.js";
46
45
  export type { FollowUpPlan, FollowUpPlanInput, IntakeAnswer, IntakePack, IntakePackInput, IntakePackQuestion, IntakePackQuestionOption, IntakeRound, IntentIndexerOutput, IntentsDeps, IntentToolDeps, SynthesisInput, SynthesisResult, } from "./intents/intent.module.js";
47
46
  export { MaintenanceGraphFactory } from "./maintenance/maintenance.graph.js";
package/dist/index.js CHANGED
@@ -35,9 +35,10 @@ export { REPORTER_PERSONA_ID, REPORTER_PERSONA, REPORTER_BRIEFING_KICKOFF, } fro
35
35
  export { ONBOARDING_PERSONA_ID, ONBOARDING_PERSONA, } from "./agents/index.js";
36
36
  export { RadarGraphFactory } from "./opportunities/index.js";
37
37
  export { HydeGraphFactory } from "./discovery/index.js";
38
- export { NetworkGraphFactory } from "./networks/index.js";
39
- export { NetworkMembershipGraphFactory } from "./networks/index.js";
40
- export { IntentNetworkGraphFactory } from "./networks/index.js";
38
+ // ─── Networks ─────────────────────────────────────────────────────────────────
39
+ // The whole capability behind one class: the community lifecycle graph, the
40
+ // membership graph, signal assignment, and the agent-facing tools.
41
+ export { Networks } from "./networks/network.module.js";
41
42
  // ─── Intents ──────────────────────────────────────────────────────────────────
42
43
  // The whole capability behind one class: lifecycle graph, verification,
43
44
  // network indexing, guided intake, and the agent-facing tools.
@@ -1,7 +1,14 @@
1
- import type { IntentNetworkGraphDatabase } from "../ports/index.js";
2
- import type { DebugMetaAgent } from "../../agents/index.js";
3
- import type { IntentNetworkIndexer } from "../ports/index.js";
1
+ import type { IntentNetworkGraphDatabase } from "../shared/interfaces/database.interface.js";
2
+ import type { DebugMetaAgent } from "../agents/index.js";
3
+ import type { Intents } from "../intents/intent.module.js";
4
4
  import { IntentNetworkGraphState, type AssignmentResult } from "./indexer.state.js";
5
+ /**
6
+ * The one intents method assignment calls: score a signal against a network.
7
+ *
8
+ * Naming the single method rather than accepting the whole capability keeps the
9
+ * injected surface auditable, and lets a test pass a one-method stub.
10
+ */
11
+ export type IntentNetworkIndexer = Pick<Intents, "indexIntent">;
5
12
  /**
6
13
  * Factory class to build and compile the Intent–Network (indexer) Graph.
7
14
  *
@@ -12,7 +19,7 @@ import { IntentNetworkGraphState, type AssignmentResult } from "./indexer.state.
12
19
  *
13
20
  * ## Signal assignment policy
14
21
  *
15
- * The indexer is injected at construction time via the communities ports layer,
22
+ * The indexer is injected at construction time as {@link IntentNetworkIndexer},
16
23
  * which narrows the intents module to the one method used here — this factory
17
24
  * never reaches intents internals directly.
18
25
  *
@@ -40,9 +47,6 @@ import { IntentNetworkGraphState, type AssignmentResult } from "./indexer.state.
40
47
  * read: readNode → END
41
48
  * delete: unassignNode → END
42
49
  * }
43
- *
44
- * IND-546: canonical home — previously network/indexer/indexer.graph.ts.
45
- * Signals dependency consumed via capabilities/signals.facade.ts (through ports).
46
50
  */
47
51
  /** The graph's channel state, as every node sees it. */
48
52
  export type IntentNetworkState = typeof IntentNetworkGraphState.State;
@@ -1,9 +1,9 @@
1
1
  import { StateGraph, START, END } from "@langchain/langgraph";
2
- import { buildNetworkAssignmentDecision } from "../../shared/assignment/network-assignment.policy.js";
3
- import { protocolLogger } from "../../shared/observability/protocol.logger.js";
4
- import { timed } from "../../shared/observability/performance.js";
5
- import { requestContext } from "../../shared/observability/request-context.js";
6
- import { renderNetworkContext } from "../../shared/network/metadata.renderer.js";
2
+ import { buildNetworkAssignmentDecision } from "../shared/assignment/network-assignment.policy.js";
3
+ import { protocolLogger } from "../shared/observability/protocol.logger.js";
4
+ import { timed } from "../shared/observability/performance.js";
5
+ import { requestContext } from "../shared/observability/request-context.js";
6
+ import { renderNetworkContext } from "../shared/network/metadata.renderer.js";
7
7
  import { IntentNetworkGraphState } from "./indexer.state.js";
8
8
  const logger = protocolLogger("IntentNetworkGraphFactory");
9
9
  export class IntentNetworkGraphFactory {
@@ -141,7 +141,7 @@ export async function assignNode(state, deps) {
141
141
  const sourceName = intentForIndexing.sourceType
142
142
  ? `${intentForIndexing.sourceType}:${intentForIndexing.sourceId ?? ""}`
143
143
  : undefined;
144
- // Score the signal against the network (intents module, injected via ports)
144
+ // Score the signal against the network (intents module, injected as IntentNetworkIndexer)
145
145
  const _traceEmitter = requestContext.getStore()?.traceEmitter;
146
146
  const _indexerStart = Date.now();
147
147
  _traceEmitter?.({ type: "agent_start", name: "intent-networker" });
@@ -1,9 +1,7 @@
1
- import type { DebugMetaAgent } from "../../agents/index.js";
1
+ import type { DebugMetaAgent } from "../agents/index.js";
2
2
  /**
3
3
  * Intent payload and metadata loaded for network evaluation.
4
4
  * Loaded from the database before LLM-based assignment scoring.
5
- *
6
- * IND-546: canonical home — previously network/indexer/indexer.state.ts.
7
5
  */
8
6
  export interface IntentForIndexing {
9
7
  id: string;
@@ -15,8 +13,6 @@ export interface IntentForIndexing {
15
13
  /**
16
14
  * Index and member prompts for a single network (user must be member with autoAssign).
17
15
  * Used by the evaluated assignment path in IntentNetworkGraphFactory.
18
- *
19
- * IND-546: canonical home — previously network/indexer/indexer.state.ts.
20
16
  */
21
17
  export interface IndexMemberContext {
22
18
  networkId: string;
@@ -26,8 +22,6 @@ export interface IndexMemberContext {
26
22
  /**
27
23
  * Result of executing an assignment decision.
28
24
  * Returned from the assign node as a structured output alongside mutationResult.
29
- *
30
- * IND-546: canonical home — previously network/indexer/indexer.state.ts.
31
25
  */
32
26
  export interface AssignmentResult {
33
27
  networkId: string;
@@ -44,13 +38,13 @@ export interface AssignmentResult {
44
38
  * Two assignment paths, selected via `skipEvaluation`:
45
39
  * - `true` (direct / manual_override): writes the link immediately with a fixed
46
40
  * score of 1 and mode `manual_override`. No LLM call.
47
- * - `false` (automatic / evaluated): loads intent + network context, calls
48
- * IntentIndexer from the signals public facade, then applies
49
- * `buildNetworkAssignmentDecision` to produce the threshold / metadata.
50
- * A no-prompt fast path skips the LLM when both prompts are absent.
41
+ * - `false` (automatic / evaluated): loads intent + network context, calls the
42
+ * injected indexer, then applies `buildNetworkAssignmentDecision` to produce
43
+ * the threshold / metadata. A no-prompt fast path skips the LLM when both
44
+ * prompts are absent.
51
45
  *
52
- * The IntentIndexer is injected as a constructor argument — communities never
53
- * imports signals internals directly.
46
+ * The indexer is injected as a constructor argument — communities never imports
47
+ * signals internals directly.
54
48
  *
55
49
  * Flow:
56
50
  * START → router → {
@@ -58,10 +52,6 @@ export interface AssignmentResult {
58
52
  * read: readNode → END
59
53
  * delete: unassignNode → END
60
54
  * }
61
- *
62
- * IND-546: canonical home — previously network/indexer/indexer.state.ts.
63
- * LangGraph state carries IntentIndexerOutput and DebugMetaAgent which are
64
- * cross-capability types; this file therefore belongs in the application layer.
65
55
  */
66
56
  export declare const IntentNetworkGraphState: import("@langchain/langgraph").AnnotationRoot<{
67
57
  /** User performing the action. Always required. */
@@ -8,13 +8,13 @@ import { Annotation } from "@langchain/langgraph";
8
8
  * Two assignment paths, selected via `skipEvaluation`:
9
9
  * - `true` (direct / manual_override): writes the link immediately with a fixed
10
10
  * score of 1 and mode `manual_override`. No LLM call.
11
- * - `false` (automatic / evaluated): loads intent + network context, calls
12
- * IntentIndexer from the signals public facade, then applies
13
- * `buildNetworkAssignmentDecision` to produce the threshold / metadata.
14
- * A no-prompt fast path skips the LLM when both prompts are absent.
11
+ * - `false` (automatic / evaluated): loads intent + network context, calls the
12
+ * injected indexer, then applies `buildNetworkAssignmentDecision` to produce
13
+ * the threshold / metadata. A no-prompt fast path skips the LLM when both
14
+ * prompts are absent.
15
15
  *
16
- * The IntentIndexer is injected as a constructor argument — communities never
17
- * imports signals internals directly.
16
+ * The indexer is injected as a constructor argument — communities never imports
17
+ * signals internals directly.
18
18
  *
19
19
  * Flow:
20
20
  * START → router → {
@@ -22,10 +22,6 @@ import { Annotation } from "@langchain/langgraph";
22
22
  * read: readNode → END
23
23
  * delete: unassignNode → END
24
24
  * }
25
- *
26
- * IND-546: canonical home — previously network/indexer/indexer.state.ts.
27
- * LangGraph state carries IntentIndexerOutput and DebugMetaAgent which are
28
- * cross-capability types; this file therefore belongs in the application layer.
29
25
  */
30
26
  export const IntentNetworkGraphState = Annotation.Root({
31
27
  // --- Core Inputs (from ChatGraph via ToolContext) ---
@@ -1,5 +1,5 @@
1
- import type { NetworkMembershipGraphDatabase } from "../ports/index.js";
2
- import { NetworkMembershipGraphState } from "../domain/index.js";
1
+ import type { NetworkMembershipGraphDatabase } from "../shared/interfaces/database.interface.js";
2
+ import { NetworkMembershipGraphState } from "./membership.state.js";
3
3
  /**
4
4
  * Factory class to build and compile the Network Membership Graph.
5
5
  *
@@ -26,8 +26,6 @@ import { NetworkMembershipGraphState } from "../domain/index.js";
26
26
  *
27
27
  * Flow:
28
28
  * START → routerNode → {addMemberNode | listMembersNode | removeMemberNode} → END
29
- *
30
- * IND-546: canonical home — previously network/membership/membership.graph.ts.
31
29
  */
32
30
  /** The graph's channel state, as every node sees it. */
33
31
  export type NetworkMembershipState = typeof NetworkMembershipGraphState.State;
@@ -1,7 +1,7 @@
1
1
  import { StateGraph, START, END } from "@langchain/langgraph";
2
- import { protocolLogger } from "../../shared/observability/protocol.logger.js";
3
- import { timed } from "../../shared/observability/performance.js";
4
- import { NetworkMembershipGraphState } from "../domain/index.js";
2
+ import { protocolLogger } from "../shared/observability/protocol.logger.js";
3
+ import { timed } from "../shared/observability/performance.js";
4
+ import { NetworkMembershipGraphState } from "./membership.state.js";
5
5
  const logger = protocolLogger("NetworkMembershipGraphFactory");
6
6
  export class NetworkMembershipGraphFactory {
7
7
  constructor(database) {
@@ -13,8 +13,6 @@
13
13
  *
14
14
  * Flow:
15
15
  * START → routerNode → {addMemberNode | listMembersNode | removeMemberNode} → END
16
- *
17
- * IND-546: canonical home — previously network/membership/membership.state.ts.
18
16
  */
19
17
  export declare const NetworkMembershipGraphState: import("@langchain/langgraph").AnnotationRoot<{
20
18
  /** User performing the action (the actor). Always required. */
@@ -14,8 +14,6 @@ import { Annotation } from "@langchain/langgraph";
14
14
  *
15
15
  * Flow:
16
16
  * START → routerNode → {addMemberNode | listMembersNode | removeMemberNode} → END
17
- *
18
- * IND-546: canonical home — previously network/membership/membership.state.ts.
19
17
  */
20
18
  export const NetworkMembershipGraphState = Annotation.Root({
21
19
  // --- Core Inputs (from ChatGraph via ToolContext) ---
@@ -1,5 +1,5 @@
1
- import type { NetworkGraphDatabase } from "../ports/index.js";
2
- import { NetworkGraphState } from "../domain/index.js";
1
+ import type { NetworkGraphDatabase } from "../shared/interfaces/database.interface.js";
2
+ import { NetworkGraphState } from "./network.state.js";
3
3
  /**
4
4
  * Factory class to build and compile the Network (community) lifecycle graph.
5
5
  *
@@ -25,8 +25,6 @@ import { NetworkGraphState } from "../domain/index.js";
25
25
  *
26
26
  * Flow:
27
27
  * START → routerNode → {createNode | readNode | updateNode | deleteNode} → END
28
- *
29
- * IND-546: canonical home — previously network/network.graph.ts.
30
28
  */
31
29
  /** The graph's channel state, as every node sees it. */
32
30
  export type NetworkState = typeof NetworkGraphState.State;
@@ -1,7 +1,7 @@
1
1
  import { StateGraph, START, END } from "@langchain/langgraph";
2
- import { protocolLogger } from "../../shared/observability/protocol.logger.js";
3
- import { timed } from "../../shared/observability/performance.js";
4
- import { NetworkGraphState } from "../domain/index.js";
2
+ import { protocolLogger } from "../shared/observability/protocol.logger.js";
3
+ import { timed } from "../shared/observability/performance.js";
4
+ import { NetworkGraphState } from "./network.state.js";
5
5
  const logger = protocolLogger("NetworkGraphFactory");
6
6
  export class NetworkGraphFactory {
7
7
  constructor(database) {