toolsplice 0.0.0-stage → 0.0.2

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 (172) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -2
  3. package/dist/abortable.d.ts +6 -0
  4. package/dist/abortable.js +50 -0
  5. package/dist/adaptive-read.d.ts +50 -0
  6. package/dist/adaptive-read.js +780 -0
  7. package/dist/answer-wait.d.ts +7 -0
  8. package/dist/answer-wait.js +45 -0
  9. package/dist/cache-reads.d.ts +18 -0
  10. package/dist/cache-reads.js +89 -0
  11. package/dist/calibration-ledger.d.ts +37 -0
  12. package/dist/calibration-ledger.js +148 -0
  13. package/dist/calibration-marker.d.ts +4 -0
  14. package/dist/calibration-marker.js +77 -0
  15. package/dist/catalog-setup.d.ts +33 -0
  16. package/dist/catalog-setup.js +89 -0
  17. package/dist/catalog.d.ts +10 -0
  18. package/dist/catalog.js +42 -0
  19. package/dist/checkpoint-files.d.ts +15 -0
  20. package/dist/checkpoint-files.js +99 -0
  21. package/dist/cli.d.ts +2 -0
  22. package/dist/cli.js +1454 -0
  23. package/dist/coalesce-reads.d.ts +6 -0
  24. package/dist/coalesce-reads.js +33 -0
  25. package/dist/codegen.d.ts +44 -0
  26. package/dist/codegen.js +479 -0
  27. package/dist/contract-caller.d.ts +23 -0
  28. package/dist/contract-caller.js +326 -0
  29. package/dist/contract-corrections.d.ts +35 -0
  30. package/dist/contract-corrections.js +159 -0
  31. package/dist/contract-schema.d.ts +7 -0
  32. package/dist/contract-schema.js +156 -0
  33. package/dist/contracts.d.ts +72 -0
  34. package/dist/contracts.js +370 -0
  35. package/dist/core.d.ts +44 -0
  36. package/dist/core.js +43 -0
  37. package/dist/db-final-answer.d.ts +9 -0
  38. package/dist/db-final-answer.js +62 -0
  39. package/dist/define.d.ts +78 -0
  40. package/dist/define.js +14 -0
  41. package/dist/doctor.d.ts +22 -0
  42. package/dist/doctor.js +91 -0
  43. package/dist/drift.d.ts +23 -0
  44. package/dist/drift.js +111 -0
  45. package/dist/execution.d.ts +38 -0
  46. package/dist/execution.js +66 -0
  47. package/dist/extract.d.ts +34 -0
  48. package/dist/extract.js +73 -0
  49. package/dist/final-answer-stores.d.ts +71 -0
  50. package/dist/final-answer-stores.js +72 -0
  51. package/dist/final-answer.d.ts +32 -0
  52. package/dist/final-answer.js +104 -0
  53. package/dist/impact.d.ts +48 -0
  54. package/dist/impact.js +71 -0
  55. package/dist/index.d.ts +51 -0
  56. package/dist/index.js +47 -0
  57. package/dist/local-tool.d.ts +18 -0
  58. package/dist/local-tool.js +32 -0
  59. package/dist/mcp-apps.d.ts +53 -0
  60. package/dist/mcp-apps.js +32 -0
  61. package/dist/mcp-event-delivery.d.ts +98 -0
  62. package/dist/mcp-event-delivery.js +211 -0
  63. package/dist/mcp-extensions.d.ts +46 -0
  64. package/dist/mcp-extensions.js +200 -0
  65. package/dist/mcp-peer.d.ts +45 -0
  66. package/dist/mcp-peer.js +207 -0
  67. package/dist/mcp-server-card.d.ts +21 -0
  68. package/dist/mcp-server-card.js +54 -0
  69. package/dist/ordered-transport.d.ts +12 -0
  70. package/dist/ordered-transport.js +106 -0
  71. package/dist/page-checkpoint.d.ts +71 -0
  72. package/dist/page-checkpoint.js +286 -0
  73. package/dist/page-read-gate.d.ts +15 -0
  74. package/dist/page-read-gate.js +48 -0
  75. package/dist/pattern.d.ts +3 -0
  76. package/dist/pattern.js +54 -0
  77. package/dist/postgres.d.ts +41 -0
  78. package/dist/postgres.js +264 -0
  79. package/dist/probe.d.ts +29 -0
  80. package/dist/probe.js +121 -0
  81. package/dist/proxy.d.ts +40 -0
  82. package/dist/proxy.js +436 -0
  83. package/dist/read-pages.d.ts +25 -0
  84. package/dist/read-pages.js +85 -0
  85. package/dist/read-policy.d.ts +6 -0
  86. package/dist/read-policy.js +16 -0
  87. package/dist/read-steps.d.ts +12 -0
  88. package/dist/read-steps.js +36 -0
  89. package/dist/result-session.d.ts +109 -0
  90. package/dist/result-session.js +620 -0
  91. package/dist/route-checkpoint.d.ts +3 -0
  92. package/dist/route-checkpoint.js +80 -0
  93. package/dist/route-driver-cli.d.ts +3 -0
  94. package/dist/route-driver-cli.js +43 -0
  95. package/dist/route-evaluation.d.ts +141 -0
  96. package/dist/route-evaluation.js +329 -0
  97. package/dist/row-groups.d.ts +17 -0
  98. package/dist/row-groups.js +79 -0
  99. package/dist/row-query.d.ts +62 -0
  100. package/dist/row-query.js +172 -0
  101. package/dist/rules.d.ts +30 -0
  102. package/dist/rules.js +72 -0
  103. package/dist/run-diagnostics.d.ts +75 -0
  104. package/dist/run-diagnostics.js +212 -0
  105. package/dist/runtime.d.ts +6 -0
  106. package/dist/runtime.js +26 -0
  107. package/dist/schema.d.ts +17 -0
  108. package/dist/schema.js +299 -0
  109. package/dist/search-fetch.d.ts +50 -0
  110. package/dist/search-fetch.js +264 -0
  111. package/dist/shape.d.ts +91 -0
  112. package/dist/shape.js +499 -0
  113. package/dist/skill-files.d.ts +9 -0
  114. package/dist/skill-files.js +49 -0
  115. package/dist/splice-diagnostics.d.ts +44 -0
  116. package/dist/splice-diagnostics.js +88 -0
  117. package/dist/splice-measure.d.ts +33 -0
  118. package/dist/splice-measure.js +55 -0
  119. package/dist/splice-project.d.ts +125 -0
  120. package/dist/splice-project.js +348 -0
  121. package/dist/splice-recording.d.ts +132 -0
  122. package/dist/splice-recording.js +481 -0
  123. package/dist/splice.d.ts +181 -0
  124. package/dist/splice.js +1263 -0
  125. package/dist/sqlite-checkpoint-store.d.ts +5 -0
  126. package/dist/sqlite-checkpoint-store.js +91 -0
  127. package/dist/sqlite-checkpoint-worker.d.ts +1 -0
  128. package/dist/sqlite-checkpoint-worker.js +115 -0
  129. package/dist/storage.d.ts +17 -0
  130. package/dist/storage.js +1 -0
  131. package/dist/store.d.ts +151 -0
  132. package/dist/store.js +735 -0
  133. package/dist/test-difference.d.ts +13 -0
  134. package/dist/test-difference.js +42 -0
  135. package/dist/testing.d.ts +122 -0
  136. package/dist/testing.js +261 -0
  137. package/dist/text-pages.d.ts +24 -0
  138. package/dist/text-pages.js +36 -0
  139. package/dist/tool-discovery.d.ts +59 -0
  140. package/dist/tool-discovery.js +136 -0
  141. package/dist/unevaluated.d.ts +7 -0
  142. package/dist/unevaluated.js +156 -0
  143. package/dist/v2.d.ts +49 -0
  144. package/dist/v2.js +413 -0
  145. package/dist/validate-output.d.ts +3 -0
  146. package/dist/validate-output.js +73 -0
  147. package/dist/version.d.ts +1 -0
  148. package/dist/version.js +1 -0
  149. package/dist/workflow-json.d.ts +8 -0
  150. package/dist/workflow-json.js +74 -0
  151. package/docs/AGENT-FRAMEWORKS.md +431 -0
  152. package/docs/BENCHMARKS.md +43 -0
  153. package/docs/INTEGRATION-QUICKSTART.md +859 -0
  154. package/docs/LEARNING-AND-STORAGE.md +393 -0
  155. package/docs/MCP.md +204 -0
  156. package/docs/PROJECTS-AND-UPGRADES.md +173 -0
  157. package/docs/PYTHON-REFERENCE.md +348 -0
  158. package/docs/PYTHON.md +120 -0
  159. package/docs/RECORDING-AND-CORRECTIONS.md +205 -0
  160. package/docs/TESTING.md +259 -0
  161. package/examples/mcp-app/build.mjs +11 -0
  162. package/examples/mcp-app/view.mjs +22 -0
  163. package/examples/quickstart.mjs +43 -0
  164. package/examples/route-driver.mjs +67 -0
  165. package/integrations/ai.d.mts +36 -0
  166. package/integrations/ai.mjs +178 -0
  167. package/integrations/call-options.mjs +9 -0
  168. package/integrations/langchain.d.mts +31 -0
  169. package/integrations/langchain.mjs +114 -0
  170. package/integrations/managed.mjs +154 -0
  171. package/integrations/types.d.mts +13 -0
  172. package/package.json +139 -4
@@ -0,0 +1,181 @@
1
+ import { type ContractSchema, type ContractSnapshot } from "./contracts.js";
2
+ import { type BindingCallOptions, type ToolCaller } from "./execution.js";
3
+ import { type SpliceRule } from "./rules.js";
4
+ import { type McpToolUi } from "./mcp-apps.js";
5
+ export interface SpliceEndpoint {
6
+ server: string;
7
+ tool: string;
8
+ }
9
+ export type SpliceBinding = {
10
+ to: string;
11
+ from: string;
12
+ } | {
13
+ to: string;
14
+ value: unknown;
15
+ } | {
16
+ to: string;
17
+ fromContext: string;
18
+ };
19
+ export interface SpliceSpec {
20
+ format: "toolsplice-splice";
21
+ formatVersion: 1;
22
+ source: SpliceEndpoint & {
23
+ path?: string;
24
+ parseJson?: boolean;
25
+ /** Consumer requirement on the selected/parsed value, before forEach. */
26
+ valueSchema?: ContractSchema;
27
+ expect?: {
28
+ path: string;
29
+ equals: unknown;
30
+ }[];
31
+ /** Select exactly one candidate by a scalar key after source value validation. */
32
+ matchOne?: {
33
+ path: string;
34
+ } & ({
35
+ equals: string | number | boolean | null;
36
+ } | {
37
+ fromContext: string;
38
+ });
39
+ };
40
+ target: SpliceEndpoint & {
41
+ /** Reject duplicate destination-key tuples within this batch, before any target call. */
42
+ uniqueBy?: string[];
43
+ /** Return this field from each validated destination response. Empty selects the full result. */
44
+ resultPath?: string;
45
+ /** Build an object from named JSON pointers into the validated destination response. */
46
+ resultFields?: Record<string, string>;
47
+ };
48
+ forEach?: boolean;
49
+ maxItems?: number;
50
+ /** UTF-8 JSON bytes of the final result array; default 5 MiB, maximum 64 MiB. */
51
+ maxResultBytes?: number;
52
+ bindings: SpliceBinding[];
53
+ /** Per-row application rules checked before any destination call. */
54
+ rules?: SpliceRule[];
55
+ /** Application-supplied values, validated before any source call. */
56
+ contextSchema?: Record<string, unknown>;
57
+ }
58
+ export interface SpliceToolOptions {
59
+ /** Enable ordered read waves with an application-owned concurrency bound. */
60
+ readConcurrency?: number;
61
+ assumeReadOnly?: boolean;
62
+ /** Link an explicitly registered MCP Apps resource to the outer tool. */
63
+ ui?: McpToolUi;
64
+ name: string;
65
+ description?: string;
66
+ source: ToolCaller;
67
+ target: ToolCaller;
68
+ }
69
+ export interface SpliceIssue {
70
+ severity: "error" | "warning";
71
+ code: string;
72
+ path: string;
73
+ message: string;
74
+ }
75
+ export interface SpliceReport {
76
+ status: "ready" | "review" | "blocked";
77
+ source: SpliceEndpoint;
78
+ target: SpliceEndpoint;
79
+ issues: SpliceIssue[];
80
+ maxTargetCalls: number;
81
+ maxResultBytes: number;
82
+ fingerprints: {
83
+ source: string;
84
+ target: string;
85
+ plan: string;
86
+ };
87
+ note: string;
88
+ }
89
+ export interface SpliceMappingOptions {
90
+ context?: unknown;
91
+ }
92
+ export interface SpliceRunOptions extends BindingCallOptions, SpliceMappingOptions {
93
+ /** Explicitly allow uncertain static checks; runtime validation still applies to every row. */
94
+ allowReview?: boolean;
95
+ }
96
+ export interface SpliceReadOptions extends SpliceRunOptions {
97
+ /** Maximum independent destination calls in each ordered wave. Default 4. */
98
+ concurrency?: number;
99
+ /** Application confirmation for read-only tools that omit the MCP readOnlyHint. */
100
+ assumeReadOnly?: boolean;
101
+ }
102
+ export declare class SpliceError extends Error {
103
+ readonly stage: "preflight" | "context" | "source" | "mapping" | "target";
104
+ readonly completedTargets: number;
105
+ /** Rows submitted in read waves, possibly beyond the successful in-order prefix. */
106
+ scheduledTargets?: number;
107
+ readonly issues: SpliceIssue[];
108
+ constructor(stage: "preflight" | "context" | "source" | "mapping" | "target", completedTargets: number, cause?: unknown, details?: SpliceIssue[]);
109
+ }
110
+ export declare function readSplicePath(value: unknown, pointer: string): {
111
+ found: boolean;
112
+ value: unknown;
113
+ };
114
+ export declare function parseSpliceSpec(source: string | unknown): SpliceSpec;
115
+ export declare function preflightSplice(plan: SpliceSpec, source: ContractSnapshot, target: ContractSnapshot): SpliceReport;
116
+ export declare function prepareSplice(plan: SpliceSpec, source: ContractSnapshot, target: ContractSnapshot): {
117
+ report: SpliceReport;
118
+ mapOutput: (output: unknown, options?: SpliceMappingOptions) => Promise<Record<string, unknown>[]>;
119
+ run: (source: ToolCaller, target: ToolCaller, args: unknown, options?: SpliceRunOptions) => Promise<unknown[]>;
120
+ runReads: (source: ToolCaller, target: ToolCaller, args: unknown, options?: SpliceReadOptions) => Promise<unknown[]>;
121
+ asTool: ({ name, description, source, target, ui, readConcurrency: requested, assumeReadOnly }: SpliceToolOptions) => {
122
+ definition: {
123
+ name: string;
124
+ description?: string | undefined;
125
+ _meta?: {
126
+ ui: McpToolUi;
127
+ } | undefined;
128
+ inputSchema: {
129
+ type: "object";
130
+ };
131
+ outputSchema: {
132
+ type: "object";
133
+ properties: {
134
+ results: {
135
+ type: string;
136
+ items: {
137
+ type: string;
138
+ properties: {
139
+ [k: string]: {};
140
+ };
141
+ required: string[];
142
+ additionalProperties: boolean;
143
+ } | {
144
+ type?: undefined;
145
+ properties?: undefined;
146
+ required?: undefined;
147
+ additionalProperties?: undefined;
148
+ };
149
+ };
150
+ };
151
+ required: string[];
152
+ additionalProperties: boolean;
153
+ };
154
+ };
155
+ call: (args: Record<string, unknown>, options?: SpliceRunOptions) => Promise<{
156
+ resultType: "complete";
157
+ structuredContent: {
158
+ results: unknown[];
159
+ };
160
+ content: {
161
+ type: "text";
162
+ text: string;
163
+ }[];
164
+ isError?: undefined;
165
+ } | {
166
+ structuredContent?: undefined;
167
+ resultType: "complete";
168
+ isError: true;
169
+ content: {
170
+ type: "text";
171
+ text: string;
172
+ }[];
173
+ }>;
174
+ execute: (args: Record<string, unknown>, options?: SpliceRunOptions) => Promise<{
175
+ results: unknown[];
176
+ }>;
177
+ };
178
+ };
179
+ export declare function emitSpliceModule(plan: SpliceSpec, source: ContractSnapshot, target: ContractSnapshot, options?: {
180
+ runtimeImport?: string;
181
+ }): string;