@datagrout/conduit 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -461,6 +461,203 @@ interface MCPPrompt {
461
461
  }>;
462
462
  }
463
463
 
464
+ /**
465
+ * Prism namespace — data transformation, charting, rendering, and export.
466
+ */
467
+
468
+ declare class PrismNamespace {
469
+ private callDg;
470
+ private warn;
471
+ /** @internal */
472
+ constructor(callDg: (tool: string, params: Record<string, any>) => Promise<any>, warn: (method: string) => void);
473
+ /** AI-driven data transformation (`data-grout/prism.refract`). */
474
+ refract(options: RefractOptions): Promise<any>;
475
+ /** AI-driven charting (`data-grout/prism.chart`). */
476
+ chart(options: ChartOptions): Promise<any>;
477
+ /** Generate a document toward a natural-language goal (`data-grout/prism.render`). */
478
+ render(options: {
479
+ goal: string;
480
+ payload?: any;
481
+ format?: string;
482
+ sections?: any[];
483
+ [k: string]: any;
484
+ }): Promise<any>;
485
+ /** Convert content to another format without LLM (`data-grout/prism.export`). */
486
+ export(options: {
487
+ content: any;
488
+ format: string;
489
+ style?: Record<string, any>;
490
+ metadata?: Record<string, any>;
491
+ [k: string]: any;
492
+ }): Promise<any>;
493
+ /** Semantic type transformation (`data-grout/prism.focus`). */
494
+ focus(options: PrismFocusOptions): Promise<any>;
495
+ }
496
+
497
+ /**
498
+ * Logic Cell namespace — agent memory, facts, constraints, and hypotheticals.
499
+ */
500
+
501
+ declare class LogicNamespace {
502
+ private callDg;
503
+ private warn;
504
+ /** @internal */
505
+ constructor(callDg: (tool: string, params: Record<string, any>) => Promise<any>, warn: (method: string) => void);
506
+ /** Assert facts into the logic cell (`data-grout/logic.remember`). */
507
+ remember(statement: string, options?: RememberOptions): Promise<{
508
+ handles: string[];
509
+ facts: any[];
510
+ count: number;
511
+ message: string;
512
+ }>;
513
+ remember(options: RememberOptions): Promise<{
514
+ handles: string[];
515
+ facts: any[];
516
+ count: number;
517
+ message: string;
518
+ }>;
519
+ /** Query the logic cell with natural language (`data-grout/logic.query`). */
520
+ query(question: string, options?: QueryCellOptions): Promise<{
521
+ results: any[];
522
+ total: number;
523
+ description: string;
524
+ message: string;
525
+ }>;
526
+ query(options: QueryCellOptions): Promise<{
527
+ results: any[];
528
+ total: number;
529
+ description: string;
530
+ message: string;
531
+ }>;
532
+ /** Retract facts from the logic cell (`data-grout/logic.forget`). */
533
+ forget(options: ForgetOptions): Promise<{
534
+ retracted: number;
535
+ handles: string[];
536
+ message: string;
537
+ }>;
538
+ /** Reflect on the logic cell (`data-grout/logic.reflect`). */
539
+ reflect(options?: ReflectOptions): Promise<{
540
+ total: number;
541
+ summary?: any;
542
+ entity?: string;
543
+ facts?: any[];
544
+ message: string;
545
+ }>;
546
+ /** Add a constraint rule (`data-grout/logic.constrain`). */
547
+ constrain(rule: string, options?: ConstrainOptions): Promise<{
548
+ handle: string;
549
+ name: string;
550
+ rule: string;
551
+ message: string;
552
+ }>;
553
+ /** Hydrate the logic cell from external data (`data-grout/logic.hydrate`). */
554
+ hydrate(params: Record<string, any>): Promise<any>;
555
+ /** Export the logic cell contents (`data-grout/logic.export`). */
556
+ exportCell(params?: Record<string, any>): Promise<any>;
557
+ /** Import facts into the logic cell (`data-grout/logic.import`). */
558
+ importCell(params: Record<string, any>): Promise<any>;
559
+ /** Tabulate logic cell contents (`data-grout/logic.tabulate`). */
560
+ tabulate(params?: Record<string, any>): Promise<any>;
561
+ /** Manage hypothetical worlds (`data-grout/logic.worlds`). */
562
+ worlds(params: Record<string, any>): Promise<any>;
563
+ }
564
+
565
+ /**
566
+ * Warden namespace — safety checks, intent verification, and consensus.
567
+ */
568
+ declare class WardenNamespace {
569
+ private callDg;
570
+ private warn;
571
+ /** @internal */
572
+ constructor(callDg: (tool: string, params: Record<string, any>) => Promise<any>, warn: (method: string) => void);
573
+ /** Run a canary safety check (`data-grout/warden.canary`). */
574
+ canary(params: Record<string, any>): Promise<any>;
575
+ /** Verify intent before executing an action (`data-grout/warden.intent`). */
576
+ verifyIntent(params: Record<string, any>): Promise<any>;
577
+ /** Adjudicate a dispute or ambiguity (`data-grout/warden.adjudicate`). */
578
+ adjudicate(params: Record<string, any>): Promise<any>;
579
+ /** Multi-model ensemble consensus check (`data-grout/warden.ensemble`). */
580
+ ensemble(params: Record<string, any>): Promise<any>;
581
+ }
582
+
583
+ /**
584
+ * Deliverables namespace — work product tracking and retrieval.
585
+ */
586
+ declare class DeliverablesNamespace {
587
+ private callDg;
588
+ private warn;
589
+ /** @internal */
590
+ constructor(callDg: (tool: string, params: Record<string, any>) => Promise<any>, warn: (method: string) => void);
591
+ /** Register a work product (`data-grout/deliverables.register`). */
592
+ register(params: Record<string, any>): Promise<any>;
593
+ /** List deliverables with optional semantic search (`data-grout/deliverables.list`). */
594
+ list(params?: Record<string, any>): Promise<any>;
595
+ /** Get a specific deliverable by reference (`data-grout/deliverables.get`). */
596
+ get(refId: string): Promise<any>;
597
+ }
598
+
599
+ /**
600
+ * Ephemerals namespace — cache management and inspection.
601
+ */
602
+ declare class EphemeralsNamespace {
603
+ private callDg;
604
+ private warn;
605
+ /** @internal */
606
+ constructor(callDg: (tool: string, params: Record<string, any>) => Promise<any>, warn: (method: string) => void);
607
+ /** List cached results (`data-grout/ephemerals.list`). */
608
+ list(params?: Record<string, any>): Promise<any>;
609
+ /** Inspect a specific cache entry (`data-grout/ephemerals.inspect`). */
610
+ inspect(cacheRef: string): Promise<any>;
611
+ }
612
+
613
+ /**
614
+ * Flow namespace — orchestration, routing, approvals, and execution history.
615
+ */
616
+
617
+ declare class FlowNamespace {
618
+ private callDg;
619
+ private warn;
620
+ /** @internal */
621
+ constructor(callDg: (tool: string, params: Record<string, any>) => Promise<any>, warn: (method: string) => void);
622
+ /** Execute a multi-step workflow plan (`data-grout/flow.into`). */
623
+ run(options: FlowOptions): Promise<any>;
624
+ /** Conditional dispatch with predicate-based branching (`data-grout/flow.route`). */
625
+ route(options: {
626
+ branches: Array<Record<string, any>>;
627
+ payload?: any;
628
+ cacheRef?: string;
629
+ else?: any;
630
+ [k: string]: any;
631
+ }): Promise<any>;
632
+ /** Pause workflow for human approval (`data-grout/flow.request-approval`). */
633
+ requestApproval(options: {
634
+ action: string;
635
+ details?: Record<string, any>;
636
+ reason?: string;
637
+ context?: Record<string, any>;
638
+ [k: string]: any;
639
+ }): Promise<any>;
640
+ /** Request user clarification for missing fields (`data-grout/flow.request-feedback`). */
641
+ requestFeedback(options: {
642
+ missing_fields: string[];
643
+ reason: string;
644
+ current_data?: Record<string, any>;
645
+ suggestions?: Record<string, any>;
646
+ context?: Record<string, any>;
647
+ [k: string]: any;
648
+ }): Promise<any>;
649
+ /** List recent tool executions (`data-grout/inspect.execution-history`). */
650
+ history(options?: {
651
+ limit?: number;
652
+ offset?: number;
653
+ status?: string;
654
+ refractions_only?: boolean;
655
+ [k: string]: any;
656
+ }): Promise<any>;
657
+ /** Get details for a specific execution (`data-grout/inspect.execution-details`). */
658
+ details(executionId: string): Promise<any>;
659
+ }
660
+
464
661
  /**
465
662
  * Stateful guided workflow session returned by `Client.guide()`.
466
663
  *
@@ -583,6 +780,19 @@ declare class Client {
583
780
  * `maxRetries` times with 500ms backoff between attempts.
584
781
  */
585
782
  private sendWithRetry;
783
+ private callDgTool;
784
+ /** Data transformation, charting, rendering, and type bridging. */
785
+ get prism(): PrismNamespace;
786
+ /** Persistent agent memory backed by a Prolog logic cell. */
787
+ get logic(): LogicNamespace;
788
+ /** Safety gates, intent verification, and multi-model consensus. */
789
+ get warden(): WardenNamespace;
790
+ /** Work product registration, listing, and retrieval. */
791
+ get deliverables(): DeliverablesNamespace;
792
+ /** Cache listing and inspection. */
793
+ get ephemerals(): EphemeralsNamespace;
794
+ /** Multi-step orchestration, routing, approvals, and execution history. */
795
+ get flow(): FlowNamespace;
586
796
  /**
587
797
  * List all tools exposed by the connected MCP server.
588
798
  *
@@ -691,32 +901,6 @@ declare class Client {
691
901
  * @param options.choice - Option ID selected at the current step.
692
902
  */
693
903
  guide(options: GuideRequestOptions): Promise<GuidedSession>;
694
- /**
695
- * Execute a pre-planned sequence of tool calls (a "flow") through the
696
- * DataGrout gateway.
697
- *
698
- * JSON-RPC method: `tools/call` → `data-grout/flow.into`
699
- *
700
- * @param options.plan - Ordered list of tool call descriptors.
701
- * @param options.validateCtc - Validate each call against its CTC schema (default: `true`).
702
- * @param options.saveAsSkill - Persist the flow as a reusable skill (default: `false`).
703
- * @param options.inputData - Runtime input data for the flow.
704
- */
705
- flowInto(options: FlowOptions): Promise<any>;
706
- /**
707
- * Transform data from one annotated type to another using the DataGrout
708
- * Prism semantic mapping engine.
709
- *
710
- * JSON-RPC method: `tools/call` → `data-grout/prism.focus`
711
- *
712
- * @param options.data - Source payload to transform.
713
- * @param options.sourceType - Semantic type of the source data.
714
- * @param options.targetType - Desired semantic type for the output.
715
- * @param options.sourceAnnotations - Additional schema hints for the source.
716
- * @param options.targetAnnotations - Additional schema hints for the target.
717
- * @param options.context - Free-text context to guide the mapping.
718
- */
719
- prismFocus(options: PrismFocusOptions): Promise<any>;
720
904
  /**
721
905
  * Generate an execution plan for a goal using DataGrout's planning engine.
722
906
  *
@@ -737,89 +921,6 @@ declare class Client {
737
921
  * @param options.modelOverrides - Override LLM model settings.
738
922
  */
739
923
  plan(options: PlanOptions): Promise<any>;
740
- /**
741
- * Analyse and summarise a payload using the DataGrout Prism refraction engine.
742
- *
743
- * JSON-RPC method: `tools/call` → `data-grout/prism.refract`
744
- *
745
- * @param options.goal - Description of what to extract or summarise.
746
- * @param options.payload - Input data to analyse (any JSON-serializable value).
747
- * @param options.verbose - Include detailed processing trace in the response.
748
- * @param options.chart - Also generate a chart representation.
749
- */
750
- refract(options: RefractOptions): Promise<any>;
751
- /**
752
- * Generate a chart from a data payload using the DataGrout Prism engine.
753
- *
754
- * JSON-RPC method: `tools/call` → `data-grout/prism.chart`
755
- *
756
- * @param options.goal - What the chart should visualise.
757
- * @param options.payload - Input data (any JSON-serializable value).
758
- * @param options.format - Output format (e.g. `"png"`, `"svg"`).
759
- * @param options.chartType - Chart type (e.g. `"bar"`, `"line"`, `"pie"`).
760
- * @param options.title - Chart title.
761
- * @param options.xLabel - X-axis label.
762
- * @param options.yLabel - Y-axis label.
763
- * @param options.width - Chart width in pixels.
764
- * @param options.height - Chart height in pixels.
765
- */
766
- chart(options: ChartOptions): Promise<any>;
767
- /**
768
- * Generate a document toward a natural-language goal.
769
- * Supported formats: markdown, html, pdf, json.
770
- */
771
- render(options: {
772
- goal: string;
773
- payload?: any;
774
- format?: string;
775
- sections?: any[];
776
- [k: string]: any;
777
- }): Promise<any>;
778
- /**
779
- * Convert content to another format (no LLM). Supports csv, xlsx, pdf, json, html, markdown, etc.
780
- */
781
- export(options: {
782
- content: any;
783
- format: string;
784
- style?: Record<string, any>;
785
- metadata?: Record<string, any>;
786
- [k: string]: any;
787
- }): Promise<any>;
788
- /**
789
- * Pause workflow for human approval. Use for destructive or policy-gated actions.
790
- */
791
- requestApproval(options: {
792
- action: string;
793
- details?: Record<string, any>;
794
- reason?: string;
795
- context?: Record<string, any>;
796
- [k: string]: any;
797
- }): Promise<any>;
798
- /**
799
- * Request user clarification for missing fields. Pauses until user provides values.
800
- */
801
- requestFeedback(options: {
802
- missing_fields: string[];
803
- reason: string;
804
- current_data?: Record<string, any>;
805
- suggestions?: Record<string, any>;
806
- context?: Record<string, any>;
807
- [k: string]: any;
808
- }): Promise<any>;
809
- /**
810
- * List recent tool executions for the current server.
811
- */
812
- executionHistory(options?: {
813
- limit?: number;
814
- offset?: number;
815
- status?: string;
816
- refractions_only?: boolean;
817
- [k: string]: any;
818
- }): Promise<any>;
819
- /**
820
- * Get details and transcript for a specific execution.
821
- */
822
- executionDetails(executionId: string): Promise<any>;
823
924
  /**
824
925
  * Call any DataGrout first-party tool by its short name.
825
926
  *
@@ -832,121 +933,6 @@ declare class Client {
832
933
  * @param params - Tool input arguments.
833
934
  */
834
935
  dg(toolShortName: string, params?: Record<string, any>): Promise<any>;
835
- /**
836
- * Store facts in the agent's persistent logic cell.
837
- *
838
- * Converts natural language to symbolic facts and stores them
839
- * durably across sessions. Accepts either a natural language `statement`
840
- * (positional or via options) or a pre-structured `facts` array.
841
- *
842
- * Throws `InvalidConfigError` if neither `statement` nor `facts` is provided.
843
- *
844
- * JSON-RPC method: `tools/call` → `data-grout/logic.remember`
845
- *
846
- * @param statement - Natural language statement to remember.
847
- * @param options.tag - Tag/namespace for grouping facts (default: `"default"`).
848
- * @param options.facts - Optional pre-structured fact list (skips NL conversion).
849
- */
850
- remember(statement: string, options?: RememberOptions): Promise<{
851
- handles: string[];
852
- facts: any[];
853
- count: number;
854
- message: string;
855
- }>;
856
- /**
857
- * Store facts in the agent's persistent logic cell using an options object.
858
- *
859
- * Throws `InvalidConfigError` if neither `statement` nor `facts` is provided.
860
- *
861
- * JSON-RPC method: `tools/call` → `data-grout/logic.remember`
862
- */
863
- remember(options: RememberOptions): Promise<{
864
- handles: string[];
865
- facts: any[];
866
- count: number;
867
- message: string;
868
- }>;
869
- /**
870
- * Query the agent's logic cell with a natural language question.
871
- *
872
- * Translates the question to query patterns and retrieves matching facts.
873
- * Accepts either a natural language `question` (positional or via options)
874
- * or a pre-built `patterns` array.
875
- *
876
- * Throws `InvalidConfigError` if neither `question` nor `patterns` is provided.
877
- *
878
- * JSON-RPC method: `tools/call` → `data-grout/logic.query`
879
- *
880
- * @param question - Natural language question.
881
- * @param options.limit - Maximum results to return (default: 50).
882
- * @param options.patterns - Optional pre-built pattern list (skips NL translation).
883
- */
884
- queryCell(question: string, options?: QueryCellOptions): Promise<{
885
- results: any[];
886
- total: number;
887
- description: string;
888
- message: string;
889
- }>;
890
- /**
891
- * Query the agent's logic cell using an options object.
892
- *
893
- * Throws `InvalidConfigError` if neither `question` nor `patterns` is provided.
894
- *
895
- * JSON-RPC method: `tools/call` → `data-grout/logic.query`
896
- */
897
- queryCell(options: QueryCellOptions): Promise<{
898
- results: any[];
899
- total: number;
900
- description: string;
901
- message: string;
902
- }>;
903
- /**
904
- * Retract facts from the agent's logic cell.
905
- *
906
- * Throws `InvalidConfigError` if neither `handles` nor `pattern` is provided.
907
- *
908
- * JSON-RPC method: `tools/call` → `data-grout/logic.forget`
909
- *
910
- * @param options.handles - Specific fact handles to retract.
911
- * @param options.pattern - Natural language pattern — retract all matching facts.
912
- */
913
- forget(options: ForgetOptions): Promise<{
914
- retracted: number;
915
- handles: string[];
916
- message: string;
917
- }>;
918
- /**
919
- * Reflect on the agent's logic cell — returns a full snapshot or a
920
- * per-entity view of all stored facts.
921
- *
922
- * JSON-RPC method: `tools/call` → `data-grout/logic.reflect`
923
- *
924
- * @param options.entity - Optional entity name to scope reflection.
925
- * @param options.summaryOnly - When `true`, return only counts (default: `false`).
926
- */
927
- reflect(options?: ReflectOptions): Promise<{
928
- total: number;
929
- summary?: any;
930
- entity?: string;
931
- facts?: any[];
932
- message: string;
933
- }>;
934
- /**
935
- * Store a logical rule or policy in the agent's logic cell.
936
- *
937
- * Rules are permanent constraints evaluated during `queryCell()` calls.
938
- *
939
- * JSON-RPC method: `tools/call` → `data-grout/logic.constrain`
940
- *
941
- * @param rule - Natural language rule (e.g. `"VIP customers have ARR > $500K"`).
942
- * @param options.tag - Tag/namespace for this constraint (default: `"constraint"`).
943
- */
944
- constrain(rule: string, options?: ConstrainOptions): Promise<{
945
- handle: string;
946
- name: string;
947
- rule: string;
948
- message: string;
949
- }>;
950
936
  /**
951
937
  * Estimate the credit cost of a tool call without executing it.
952
938
  *