mindgraph 0.3.0 → 0.4.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.
- package/README.md +22 -14
- package/dist/index.d.mts +129 -1
- package/dist/index.d.ts +129 -1
- package/dist/index.js +30 -0
- package/dist/index.mjs +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,16 +52,16 @@ new MindGraph({ baseUrl: string, apiKey?: string, jwt?: string })
|
|
|
52
52
|
|--------|-------------|
|
|
53
53
|
| `capture(req)` | Capture a source, snippet, or observation |
|
|
54
54
|
| `entity(req)` | Create, alias, resolve, or merge entities |
|
|
55
|
-
| `findOrCreateEntity(label,
|
|
55
|
+
| `findOrCreateEntity(label, props?, agentId?)` | Convenience: create or find an entity by label (generic fallback) |
|
|
56
56
|
| `findOrCreatePerson(label, props?, agentId?)` | Find or create a Person entity |
|
|
57
57
|
| `findOrCreateOrganization(label, props?, agentId?)` | Find or create an Organization entity |
|
|
58
58
|
| `findOrCreateNation(label, props?, agentId?)` | Find or create a Nation entity |
|
|
59
59
|
| `findOrCreateEvent(label, props?, agentId?)` | Find or create an Event entity |
|
|
60
60
|
| `findOrCreatePlace(label, props?, agentId?)` | Find or create a Place entity |
|
|
61
61
|
| `findOrCreateConcept(label, props?, agentId?)` | Find or create a Concept entity |
|
|
62
|
-
| `addClaim(label,
|
|
63
|
-
| `addEvidence(label,
|
|
64
|
-
| `addObservation(label,
|
|
62
|
+
| `addClaim(label, content, confidence?, agentId?)` | Add a Claim node via the argument endpoint |
|
|
63
|
+
| `addEvidence(label, description, agentId?)` | Add an Evidence node attached to a claim |
|
|
64
|
+
| `addObservation(label, description, agentId?)` | Add an Observation node |
|
|
65
65
|
|
|
66
66
|
**Typed entity example:**
|
|
67
67
|
|
|
@@ -113,6 +113,23 @@ const entity = await graph.findOrCreateEntity("Some Entity");
|
|
|
113
113
|
| `governance(req)` | Create policies, set safety budgets, request/resolve approvals |
|
|
114
114
|
| `execution(req)` | Track execution lifecycle and register agents |
|
|
115
115
|
|
|
116
|
+
### Synthesis (Projects)
|
|
117
|
+
|
|
118
|
+
Scope a corpus to a `Project` (via `commit({ action: "project", ... })` then link documents with `PartOfProject`), then mine cross-document signals and generate synthesis articles.
|
|
119
|
+
|
|
120
|
+
| Method | Description |
|
|
121
|
+
|--------|-------------|
|
|
122
|
+
| `signals(projectUid, opts?)` | Mine cross-document structural signals for a project (entity bridges, claim hubs, theory gaps, concept clusters, analogies, dialectical pairs) |
|
|
123
|
+
| `runSynthesis(projectUid)` | Spawn an async synthesis job that turns top clusters into Article nodes; returns a `job_id` to poll via `getJob()` |
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
const project = await graph.commit({ action: "project", label: "Q2 China strategy" });
|
|
127
|
+
// ...link documents to the project via PartOfProject edges...
|
|
128
|
+
const signals = await graph.signals(project.uid, { signals: "clustered_claim_hubs,dialectical_pairs" });
|
|
129
|
+
const { job_id } = await graph.runSynthesis(project.uid);
|
|
130
|
+
const job = await graph.getJob(job_id);
|
|
131
|
+
```
|
|
132
|
+
|
|
116
133
|
### CRUD
|
|
117
134
|
|
|
118
135
|
| Method | Description |
|
|
@@ -171,16 +188,7 @@ const entity = await graph.findOrCreateEntity("Some Entity");
|
|
|
171
188
|
| `health()` | Health check |
|
|
172
189
|
| `stats()` | Graph-wide statistics |
|
|
173
190
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| Method | Description |
|
|
177
|
-
|--------|-------------|
|
|
178
|
-
| `signup(email, password)` | Create a new account |
|
|
179
|
-
| `login(email, password)` | Login and receive JWT |
|
|
180
|
-
| `createApiKey(name?)` | Create an API key |
|
|
181
|
-
| `listApiKeys()` | List all API keys |
|
|
182
|
-
| `revokeApiKey(id)` | Revoke an API key |
|
|
183
|
-
| `getUsage()` | Get usage statistics |
|
|
191
|
+
> Account sign-up, login, and API key management live in the [MindGraph dashboard](https://mindgraph.cloud/dashboard) — not the SDK. Get your API key there, then pass it to the `MindGraph` constructor.
|
|
184
192
|
|
|
185
193
|
## Examples
|
|
186
194
|
|
package/dist/index.d.mts
CHANGED
|
@@ -498,10 +498,120 @@ interface DecayRequest {
|
|
|
498
498
|
interface PurgeRequest {
|
|
499
499
|
before?: number;
|
|
500
500
|
}
|
|
501
|
+
interface SignalsQuery {
|
|
502
|
+
/**
|
|
503
|
+
* Comma-separated subset of signal names to compute, e.g.
|
|
504
|
+
* `"documents,entity_bridges,claim_hubs"`. If omitted, all signals run.
|
|
505
|
+
*/
|
|
506
|
+
signals?: string;
|
|
507
|
+
/**
|
|
508
|
+
* Comma-separated node types used as filters for `entity_bridges` and
|
|
509
|
+
* `claim_hubs`. Defaults to the server's built-in target set
|
|
510
|
+
* (Person, Organization, Nation, Event, Place, Theory, Hypothesis,
|
|
511
|
+
* Pattern, Mechanism, Model, Analogy).
|
|
512
|
+
*/
|
|
513
|
+
target_types?: string;
|
|
514
|
+
}
|
|
515
|
+
interface DocumentRef {
|
|
516
|
+
uid: string;
|
|
517
|
+
label: string;
|
|
518
|
+
}
|
|
519
|
+
interface EntityBridge {
|
|
520
|
+
uid: string;
|
|
521
|
+
label: string;
|
|
522
|
+
node_type: string;
|
|
523
|
+
doc_count: number;
|
|
524
|
+
}
|
|
525
|
+
interface ClaimHub {
|
|
526
|
+
target_uid: string;
|
|
527
|
+
target_label: string;
|
|
528
|
+
target_type: string;
|
|
529
|
+
claim_count: number;
|
|
530
|
+
}
|
|
531
|
+
interface RankedClaimHub {
|
|
532
|
+
target_uid: string;
|
|
533
|
+
target_label: string;
|
|
534
|
+
target_type: string;
|
|
535
|
+
claim_count: number;
|
|
536
|
+
distinct_doc_count: number;
|
|
537
|
+
project_doc_count: number;
|
|
538
|
+
dialectical_count: number;
|
|
539
|
+
score: number;
|
|
540
|
+
breadth_score: number;
|
|
541
|
+
tension_score: number;
|
|
542
|
+
density_score: number;
|
|
543
|
+
}
|
|
544
|
+
interface ClusterClaimSample {
|
|
545
|
+
uid: string;
|
|
546
|
+
label: string;
|
|
547
|
+
source_doc_label: string;
|
|
548
|
+
}
|
|
549
|
+
interface EpistemicCounts {
|
|
550
|
+
evidence: number;
|
|
551
|
+
arguments: number;
|
|
552
|
+
warrants: number;
|
|
553
|
+
theories_hypotheses: number;
|
|
554
|
+
contradicts_edges: number;
|
|
555
|
+
}
|
|
556
|
+
interface ClusteredClaimHub {
|
|
557
|
+
cluster_id: number;
|
|
558
|
+
size: number;
|
|
559
|
+
distinct_doc_count: number;
|
|
560
|
+
project_doc_count: number;
|
|
561
|
+
cohesion_score: number;
|
|
562
|
+
epistemic_density: number;
|
|
563
|
+
score: number;
|
|
564
|
+
breadth_score: number;
|
|
565
|
+
size_score: number;
|
|
566
|
+
dominant_entity_uid: string | null;
|
|
567
|
+
dominant_entity_label: string | null;
|
|
568
|
+
dominant_entity_type: string | null;
|
|
569
|
+
sample_claims: ClusterClaimSample[];
|
|
570
|
+
epistemic_counts: EpistemicCounts;
|
|
571
|
+
}
|
|
572
|
+
interface TheorySupportGap {
|
|
573
|
+
uid: string;
|
|
574
|
+
label: string;
|
|
575
|
+
node_type: string;
|
|
576
|
+
support_count: number;
|
|
577
|
+
}
|
|
578
|
+
interface ConceptCluster {
|
|
579
|
+
uid: string;
|
|
580
|
+
label: string;
|
|
581
|
+
doc_count: number;
|
|
582
|
+
}
|
|
583
|
+
interface AnalogyCandidate {
|
|
584
|
+
uid: string;
|
|
585
|
+
label: string;
|
|
586
|
+
summary: string;
|
|
587
|
+
}
|
|
588
|
+
interface DialecticalPair {
|
|
589
|
+
edge_type: string;
|
|
590
|
+
from_uid: string;
|
|
591
|
+
from_label: string;
|
|
592
|
+
to_uid: string;
|
|
593
|
+
to_label: string;
|
|
594
|
+
}
|
|
595
|
+
interface SignalsResponse {
|
|
596
|
+
project_uid: string;
|
|
597
|
+
documents: DocumentRef[];
|
|
598
|
+
entity_bridges: EntityBridge[];
|
|
599
|
+
claim_hubs: ClaimHub[];
|
|
600
|
+
ranked_claim_hubs: RankedClaimHub[];
|
|
601
|
+
clustered_claim_hubs: ClusteredClaimHub[];
|
|
602
|
+
theory_support_gaps: TheorySupportGap[];
|
|
603
|
+
concept_clusters: ConceptCluster[];
|
|
604
|
+
analogy_candidates: AnalogyCandidate[];
|
|
605
|
+
dialectical_pairs: DialecticalPair[];
|
|
606
|
+
}
|
|
607
|
+
interface SynthesisJobResponse {
|
|
608
|
+
job_id: string;
|
|
609
|
+
}
|
|
501
610
|
interface MindGraphConfig {
|
|
502
611
|
baseUrl: string;
|
|
503
612
|
apiKey?: string;
|
|
504
613
|
jwt?: string;
|
|
614
|
+
orgId?: string;
|
|
505
615
|
/** Max retries for 503 (server warming up) responses. Default: 3. Set to 0 to disable. */
|
|
506
616
|
maxRetries?: number;
|
|
507
617
|
/** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
|
|
@@ -852,6 +962,24 @@ declare class MindGraph {
|
|
|
852
962
|
compileAll(): Promise<{
|
|
853
963
|
job_id: string;
|
|
854
964
|
}>;
|
|
965
|
+
/**
|
|
966
|
+
* Mine structural synthesis signals for a project's document corpus.
|
|
967
|
+
*
|
|
968
|
+
* Returns candidate surface for downstream synthesis — entity bridges
|
|
969
|
+
* across documents, claim hubs, clustered claim hubs, theory support
|
|
970
|
+
* gaps, concept clusters, analogy candidates, and dialectical pairs.
|
|
971
|
+
*
|
|
972
|
+
* Blocking operation. No LLM calls; Datalog + embedding clustering only.
|
|
973
|
+
*/
|
|
974
|
+
signals(projectUid: string, opts?: SignalsQuery): Promise<SignalsResponse>;
|
|
975
|
+
/**
|
|
976
|
+
* Spawn a background synthesis job for a project: mines signals,
|
|
977
|
+
* selects top idea clusters, runs LLM synthesis, and persists
|
|
978
|
+
* candidate Article nodes linked via `Covers` edges.
|
|
979
|
+
*
|
|
980
|
+
* Returns a `job_id` immediately; poll `getJob(id)` for progress.
|
|
981
|
+
*/
|
|
982
|
+
runSynthesis(projectUid: string): Promise<SynthesisJobResponse>;
|
|
855
983
|
}
|
|
856
984
|
|
|
857
|
-
export { type ArgumentRequest, type ArticleResult, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EnrichedSearchResponse, type EntityRequest, type EventProps, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
|
|
985
|
+
export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, type EventProps, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RankedClaimHub, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type SignalsQuery, type SignalsResponse, type StructureRequest, type SynthesisJobResponse, type TheorySupportGap, type TraverseRequest };
|
package/dist/index.d.ts
CHANGED
|
@@ -498,10 +498,120 @@ interface DecayRequest {
|
|
|
498
498
|
interface PurgeRequest {
|
|
499
499
|
before?: number;
|
|
500
500
|
}
|
|
501
|
+
interface SignalsQuery {
|
|
502
|
+
/**
|
|
503
|
+
* Comma-separated subset of signal names to compute, e.g.
|
|
504
|
+
* `"documents,entity_bridges,claim_hubs"`. If omitted, all signals run.
|
|
505
|
+
*/
|
|
506
|
+
signals?: string;
|
|
507
|
+
/**
|
|
508
|
+
* Comma-separated node types used as filters for `entity_bridges` and
|
|
509
|
+
* `claim_hubs`. Defaults to the server's built-in target set
|
|
510
|
+
* (Person, Organization, Nation, Event, Place, Theory, Hypothesis,
|
|
511
|
+
* Pattern, Mechanism, Model, Analogy).
|
|
512
|
+
*/
|
|
513
|
+
target_types?: string;
|
|
514
|
+
}
|
|
515
|
+
interface DocumentRef {
|
|
516
|
+
uid: string;
|
|
517
|
+
label: string;
|
|
518
|
+
}
|
|
519
|
+
interface EntityBridge {
|
|
520
|
+
uid: string;
|
|
521
|
+
label: string;
|
|
522
|
+
node_type: string;
|
|
523
|
+
doc_count: number;
|
|
524
|
+
}
|
|
525
|
+
interface ClaimHub {
|
|
526
|
+
target_uid: string;
|
|
527
|
+
target_label: string;
|
|
528
|
+
target_type: string;
|
|
529
|
+
claim_count: number;
|
|
530
|
+
}
|
|
531
|
+
interface RankedClaimHub {
|
|
532
|
+
target_uid: string;
|
|
533
|
+
target_label: string;
|
|
534
|
+
target_type: string;
|
|
535
|
+
claim_count: number;
|
|
536
|
+
distinct_doc_count: number;
|
|
537
|
+
project_doc_count: number;
|
|
538
|
+
dialectical_count: number;
|
|
539
|
+
score: number;
|
|
540
|
+
breadth_score: number;
|
|
541
|
+
tension_score: number;
|
|
542
|
+
density_score: number;
|
|
543
|
+
}
|
|
544
|
+
interface ClusterClaimSample {
|
|
545
|
+
uid: string;
|
|
546
|
+
label: string;
|
|
547
|
+
source_doc_label: string;
|
|
548
|
+
}
|
|
549
|
+
interface EpistemicCounts {
|
|
550
|
+
evidence: number;
|
|
551
|
+
arguments: number;
|
|
552
|
+
warrants: number;
|
|
553
|
+
theories_hypotheses: number;
|
|
554
|
+
contradicts_edges: number;
|
|
555
|
+
}
|
|
556
|
+
interface ClusteredClaimHub {
|
|
557
|
+
cluster_id: number;
|
|
558
|
+
size: number;
|
|
559
|
+
distinct_doc_count: number;
|
|
560
|
+
project_doc_count: number;
|
|
561
|
+
cohesion_score: number;
|
|
562
|
+
epistemic_density: number;
|
|
563
|
+
score: number;
|
|
564
|
+
breadth_score: number;
|
|
565
|
+
size_score: number;
|
|
566
|
+
dominant_entity_uid: string | null;
|
|
567
|
+
dominant_entity_label: string | null;
|
|
568
|
+
dominant_entity_type: string | null;
|
|
569
|
+
sample_claims: ClusterClaimSample[];
|
|
570
|
+
epistemic_counts: EpistemicCounts;
|
|
571
|
+
}
|
|
572
|
+
interface TheorySupportGap {
|
|
573
|
+
uid: string;
|
|
574
|
+
label: string;
|
|
575
|
+
node_type: string;
|
|
576
|
+
support_count: number;
|
|
577
|
+
}
|
|
578
|
+
interface ConceptCluster {
|
|
579
|
+
uid: string;
|
|
580
|
+
label: string;
|
|
581
|
+
doc_count: number;
|
|
582
|
+
}
|
|
583
|
+
interface AnalogyCandidate {
|
|
584
|
+
uid: string;
|
|
585
|
+
label: string;
|
|
586
|
+
summary: string;
|
|
587
|
+
}
|
|
588
|
+
interface DialecticalPair {
|
|
589
|
+
edge_type: string;
|
|
590
|
+
from_uid: string;
|
|
591
|
+
from_label: string;
|
|
592
|
+
to_uid: string;
|
|
593
|
+
to_label: string;
|
|
594
|
+
}
|
|
595
|
+
interface SignalsResponse {
|
|
596
|
+
project_uid: string;
|
|
597
|
+
documents: DocumentRef[];
|
|
598
|
+
entity_bridges: EntityBridge[];
|
|
599
|
+
claim_hubs: ClaimHub[];
|
|
600
|
+
ranked_claim_hubs: RankedClaimHub[];
|
|
601
|
+
clustered_claim_hubs: ClusteredClaimHub[];
|
|
602
|
+
theory_support_gaps: TheorySupportGap[];
|
|
603
|
+
concept_clusters: ConceptCluster[];
|
|
604
|
+
analogy_candidates: AnalogyCandidate[];
|
|
605
|
+
dialectical_pairs: DialecticalPair[];
|
|
606
|
+
}
|
|
607
|
+
interface SynthesisJobResponse {
|
|
608
|
+
job_id: string;
|
|
609
|
+
}
|
|
501
610
|
interface MindGraphConfig {
|
|
502
611
|
baseUrl: string;
|
|
503
612
|
apiKey?: string;
|
|
504
613
|
jwt?: string;
|
|
614
|
+
orgId?: string;
|
|
505
615
|
/** Max retries for 503 (server warming up) responses. Default: 3. Set to 0 to disable. */
|
|
506
616
|
maxRetries?: number;
|
|
507
617
|
/** Initial backoff in ms before first retry. Doubles each attempt. Default: 1000. */
|
|
@@ -852,6 +962,24 @@ declare class MindGraph {
|
|
|
852
962
|
compileAll(): Promise<{
|
|
853
963
|
job_id: string;
|
|
854
964
|
}>;
|
|
965
|
+
/**
|
|
966
|
+
* Mine structural synthesis signals for a project's document corpus.
|
|
967
|
+
*
|
|
968
|
+
* Returns candidate surface for downstream synthesis — entity bridges
|
|
969
|
+
* across documents, claim hubs, clustered claim hubs, theory support
|
|
970
|
+
* gaps, concept clusters, analogy candidates, and dialectical pairs.
|
|
971
|
+
*
|
|
972
|
+
* Blocking operation. No LLM calls; Datalog + embedding clustering only.
|
|
973
|
+
*/
|
|
974
|
+
signals(projectUid: string, opts?: SignalsQuery): Promise<SignalsResponse>;
|
|
975
|
+
/**
|
|
976
|
+
* Spawn a background synthesis job for a project: mines signals,
|
|
977
|
+
* selects top idea clusters, runs LLM synthesis, and persists
|
|
978
|
+
* candidate Article nodes linked via `Covers` edges.
|
|
979
|
+
*
|
|
980
|
+
* Returns a `job_id` immediately; poll `getJob(id)` for progress.
|
|
981
|
+
*/
|
|
982
|
+
runSynthesis(projectUid: string): Promise<SynthesisJobResponse>;
|
|
855
983
|
}
|
|
856
984
|
|
|
857
|
-
export { type ArgumentRequest, type ArticleResult, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EnrichedSearchResponse, type EntityRequest, type EventProps, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
|
|
985
|
+
export { type AnalogyCandidate, type ArgumentRequest, type ArticleResult, type BatchRequest, type CaptureRequest, type ClaimHub, type ClearResponse, type ClusterClaimSample, type ClusteredClaimHub, type CommitmentRequest, type ConceptCluster, type DecayRequest, type DeliberationRequest, type DialecticalPair, type DistillRequest, type DocumentRef, type EnrichedSearchResponse, type EntityBridge, type EntityRequest, type EpistemicCounts, type EventProps, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type ListArticlesResponse, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RankedClaimHub, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchChunk, type SearchResult, type SessionRequest, type SignalsQuery, type SignalsResponse, type StructureRequest, type SynthesisJobResponse, type TheorySupportGap, type TraverseRequest };
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,9 @@ var MindGraph = class {
|
|
|
43
43
|
} else if (config.jwt) {
|
|
44
44
|
this.headers["Authorization"] = `Bearer ${config.jwt}`;
|
|
45
45
|
}
|
|
46
|
+
if (config.orgId) {
|
|
47
|
+
this.headers["X-MindGraph-Org"] = config.orgId;
|
|
48
|
+
}
|
|
46
49
|
this.maxRetries = config.maxRetries ?? 3;
|
|
47
50
|
this.retryBackoffMs = config.retryBackoffMs ?? 1e3;
|
|
48
51
|
}
|
|
@@ -609,6 +612,33 @@ var MindGraph = class {
|
|
|
609
612
|
async compileAll() {
|
|
610
613
|
return this.post("/wiki/compile/all", {});
|
|
611
614
|
}
|
|
615
|
+
// ── Synthesis (Projects) ──────────────────────────────────────────────
|
|
616
|
+
/**
|
|
617
|
+
* Mine structural synthesis signals for a project's document corpus.
|
|
618
|
+
*
|
|
619
|
+
* Returns candidate surface for downstream synthesis — entity bridges
|
|
620
|
+
* across documents, claim hubs, clustered claim hubs, theory support
|
|
621
|
+
* gaps, concept clusters, analogy candidates, and dialectical pairs.
|
|
622
|
+
*
|
|
623
|
+
* Blocking operation. No LLM calls; Datalog + embedding clustering only.
|
|
624
|
+
*/
|
|
625
|
+
async signals(projectUid, opts) {
|
|
626
|
+
const q = new URLSearchParams();
|
|
627
|
+
if (opts?.signals) q.set("signals", opts.signals);
|
|
628
|
+
if (opts?.target_types) q.set("target_types", opts.target_types);
|
|
629
|
+
const qs = q.toString();
|
|
630
|
+
return this.get(`/synthesis/signals/${projectUid}${qs ? `?${qs}` : ""}`);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Spawn a background synthesis job for a project: mines signals,
|
|
634
|
+
* selects top idea clusters, runs LLM synthesis, and persists
|
|
635
|
+
* candidate Article nodes linked via `Covers` edges.
|
|
636
|
+
*
|
|
637
|
+
* Returns a `job_id` immediately; poll `getJob(id)` for progress.
|
|
638
|
+
*/
|
|
639
|
+
async runSynthesis(projectUid) {
|
|
640
|
+
return this.post(`/synthesis/run/${projectUid}`, {});
|
|
641
|
+
}
|
|
612
642
|
};
|
|
613
643
|
// Annotate the CommonJS export names for ESM import in node:
|
|
614
644
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,9 @@ var MindGraph = class {
|
|
|
16
16
|
} else if (config.jwt) {
|
|
17
17
|
this.headers["Authorization"] = `Bearer ${config.jwt}`;
|
|
18
18
|
}
|
|
19
|
+
if (config.orgId) {
|
|
20
|
+
this.headers["X-MindGraph-Org"] = config.orgId;
|
|
21
|
+
}
|
|
19
22
|
this.maxRetries = config.maxRetries ?? 3;
|
|
20
23
|
this.retryBackoffMs = config.retryBackoffMs ?? 1e3;
|
|
21
24
|
}
|
|
@@ -582,6 +585,33 @@ var MindGraph = class {
|
|
|
582
585
|
async compileAll() {
|
|
583
586
|
return this.post("/wiki/compile/all", {});
|
|
584
587
|
}
|
|
588
|
+
// ── Synthesis (Projects) ──────────────────────────────────────────────
|
|
589
|
+
/**
|
|
590
|
+
* Mine structural synthesis signals for a project's document corpus.
|
|
591
|
+
*
|
|
592
|
+
* Returns candidate surface for downstream synthesis — entity bridges
|
|
593
|
+
* across documents, claim hubs, clustered claim hubs, theory support
|
|
594
|
+
* gaps, concept clusters, analogy candidates, and dialectical pairs.
|
|
595
|
+
*
|
|
596
|
+
* Blocking operation. No LLM calls; Datalog + embedding clustering only.
|
|
597
|
+
*/
|
|
598
|
+
async signals(projectUid, opts) {
|
|
599
|
+
const q = new URLSearchParams();
|
|
600
|
+
if (opts?.signals) q.set("signals", opts.signals);
|
|
601
|
+
if (opts?.target_types) q.set("target_types", opts.target_types);
|
|
602
|
+
const qs = q.toString();
|
|
603
|
+
return this.get(`/synthesis/signals/${projectUid}${qs ? `?${qs}` : ""}`);
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Spawn a background synthesis job for a project: mines signals,
|
|
607
|
+
* selects top idea clusters, runs LLM synthesis, and persists
|
|
608
|
+
* candidate Article nodes linked via `Covers` edges.
|
|
609
|
+
*
|
|
610
|
+
* Returns a `job_id` immediately; poll `getJob(id)` for progress.
|
|
611
|
+
*/
|
|
612
|
+
async runSynthesis(projectUid) {
|
|
613
|
+
return this.post(`/synthesis/run/${projectUid}`, {});
|
|
614
|
+
}
|
|
585
615
|
};
|
|
586
616
|
export {
|
|
587
617
|
MindGraph,
|