@modelrelay/sdk 1.10.3 → 1.25.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/README.md +109 -78
- package/dist/index.cjs +5476 -6582
- package/dist/index.d.cts +3527 -355
- package/dist/index.d.ts +3527 -355
- package/dist/index.js +5437 -6584
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -563,7 +563,7 @@ interface RetryMetadata {
|
|
|
563
563
|
lastStatus?: number;
|
|
564
564
|
lastError?: string;
|
|
565
565
|
}
|
|
566
|
-
type TransportErrorKind = "timeout" | "connect" | "request" | "other";
|
|
566
|
+
type TransportErrorKind = "timeout" | "connect" | "request" | "empty_response" | "other";
|
|
567
567
|
interface RequestContext {
|
|
568
568
|
method: string;
|
|
569
569
|
path: string;
|
|
@@ -1714,6 +1714,106 @@ declare class ResponsesClient {
|
|
|
1714
1714
|
* This is a thin wrapper around `ResponseBuilder` and `extractAssistantText`.
|
|
1715
1715
|
*/
|
|
1716
1716
|
text(model: ModelId, system: string, user: string, options?: ResponsesRequestOptions): Promise<string>;
|
|
1717
|
+
/**
|
|
1718
|
+
* Generate a typed object from a Zod schema with a single function call.
|
|
1719
|
+
*
|
|
1720
|
+
* This is the most ergonomic way to get structured output - all configuration
|
|
1721
|
+
* is passed in a single object argument, matching the Vercel AI SDK pattern.
|
|
1722
|
+
*
|
|
1723
|
+
* @example
|
|
1724
|
+
* ```typescript
|
|
1725
|
+
* import { z } from 'zod';
|
|
1726
|
+
*
|
|
1727
|
+
* const review = await client.responses.object({
|
|
1728
|
+
* model: 'claude-sonnet-4-20250514',
|
|
1729
|
+
* schema: z.object({
|
|
1730
|
+
* vulnerabilities: z.array(z.string()),
|
|
1731
|
+
* riskLevel: z.enum(['low', 'medium', 'high']),
|
|
1732
|
+
* }),
|
|
1733
|
+
* system: 'You are a security expert.',
|
|
1734
|
+
* prompt: `Review this code:\n${code}`,
|
|
1735
|
+
* });
|
|
1736
|
+
*
|
|
1737
|
+
* console.log(review.riskLevel); // 'low' | 'medium' | 'high'
|
|
1738
|
+
* ```
|
|
1739
|
+
*
|
|
1740
|
+
* @example Parallel execution with Promise.all
|
|
1741
|
+
* ```typescript
|
|
1742
|
+
* const [security, performance] = await Promise.all([
|
|
1743
|
+
* client.responses.object({
|
|
1744
|
+
* model,
|
|
1745
|
+
* schema: SecuritySchema,
|
|
1746
|
+
* system: 'Security expert...',
|
|
1747
|
+
* prompt: code,
|
|
1748
|
+
* }),
|
|
1749
|
+
* client.responses.object({
|
|
1750
|
+
* model,
|
|
1751
|
+
* schema: PerformanceSchema,
|
|
1752
|
+
* system: 'Performance expert...',
|
|
1753
|
+
* prompt: code,
|
|
1754
|
+
* }),
|
|
1755
|
+
* ]);
|
|
1756
|
+
* ```
|
|
1757
|
+
*/
|
|
1758
|
+
object<T>(args: {
|
|
1759
|
+
/** The model to use for generation. */
|
|
1760
|
+
model: ModelId;
|
|
1761
|
+
/** Zod schema defining the expected output structure. */
|
|
1762
|
+
schema: ZodLikeSchema;
|
|
1763
|
+
/** The user prompt/input to send to the model. */
|
|
1764
|
+
prompt: string;
|
|
1765
|
+
/** Optional system prompt to set context for the model. */
|
|
1766
|
+
system?: string;
|
|
1767
|
+
/** Maximum retry attempts on validation failure (default: 0). */
|
|
1768
|
+
maxRetries?: number;
|
|
1769
|
+
/** Handler for customizing retry messages. */
|
|
1770
|
+
retryHandler?: RetryHandler;
|
|
1771
|
+
/** Override the schema name in the JSON schema (defaults to "response"). */
|
|
1772
|
+
schemaName?: string;
|
|
1773
|
+
/** Customer ID for billing attribution. */
|
|
1774
|
+
customerId?: string;
|
|
1775
|
+
/** Request options (timeout, headers, etc). */
|
|
1776
|
+
options?: ResponsesRequestOptions;
|
|
1777
|
+
}): Promise<T>;
|
|
1778
|
+
/**
|
|
1779
|
+
* Generate a typed object with full result metadata.
|
|
1780
|
+
*
|
|
1781
|
+
* Like `object()` but returns the full `StructuredResult<T>` including
|
|
1782
|
+
* attempt count and request ID.
|
|
1783
|
+
*
|
|
1784
|
+
* @example
|
|
1785
|
+
* ```typescript
|
|
1786
|
+
* const result = await client.responses.objectWithMetadata({
|
|
1787
|
+
* model: 'claude-sonnet-4-20250514',
|
|
1788
|
+
* schema: ReviewSchema,
|
|
1789
|
+
* prompt: 'Review this code...',
|
|
1790
|
+
* });
|
|
1791
|
+
*
|
|
1792
|
+
* console.log(result.value); // The parsed object
|
|
1793
|
+
* console.log(result.attempts); // Number of attempts (1 = first try succeeded)
|
|
1794
|
+
* console.log(result.requestId); // Server request ID
|
|
1795
|
+
* ```
|
|
1796
|
+
*/
|
|
1797
|
+
objectWithMetadata<T>(args: {
|
|
1798
|
+
/** The model to use for generation. */
|
|
1799
|
+
model: ModelId;
|
|
1800
|
+
/** Zod schema defining the expected output structure. */
|
|
1801
|
+
schema: ZodLikeSchema;
|
|
1802
|
+
/** The user prompt/input to send to the model. */
|
|
1803
|
+
prompt: string;
|
|
1804
|
+
/** Optional system prompt to set context for the model. */
|
|
1805
|
+
system?: string;
|
|
1806
|
+
/** Maximum retry attempts on validation failure (default: 0). */
|
|
1807
|
+
maxRetries?: number;
|
|
1808
|
+
/** Handler for customizing retry messages. */
|
|
1809
|
+
retryHandler?: RetryHandler;
|
|
1810
|
+
/** Override the schema name in the JSON schema (defaults to "response"). */
|
|
1811
|
+
schemaName?: string;
|
|
1812
|
+
/** Customer ID for billing attribution. */
|
|
1813
|
+
customerId?: string;
|
|
1814
|
+
/** Request options (timeout, headers, etc). */
|
|
1815
|
+
options?: ResponsesRequestOptions;
|
|
1816
|
+
}): Promise<StructuredResult<T>>;
|
|
1717
1817
|
/**
|
|
1718
1818
|
* Convenience helper for customer-attributed requests where the backend selects the model.
|
|
1719
1819
|
*
|
|
@@ -1766,38 +1866,50 @@ declare class ResponsesClient {
|
|
|
1766
1866
|
}
|
|
1767
1867
|
|
|
1768
1868
|
declare const runIdBrand: unique symbol;
|
|
1769
|
-
type RunId = string & {
|
|
1869
|
+
type RunId$1 = string & {
|
|
1770
1870
|
readonly [runIdBrand]: true;
|
|
1771
1871
|
};
|
|
1772
1872
|
declare const nodeIdBrand: unique symbol;
|
|
1773
|
-
type NodeId = string & {
|
|
1873
|
+
type NodeId$1 = string & {
|
|
1774
1874
|
readonly [nodeIdBrand]: true;
|
|
1775
1875
|
};
|
|
1776
1876
|
declare const planHashBrand: unique symbol;
|
|
1777
|
-
type PlanHash = string & {
|
|
1877
|
+
type PlanHash$1 = string & {
|
|
1778
1878
|
readonly [planHashBrand]: true;
|
|
1779
1879
|
};
|
|
1780
1880
|
declare const outputNameBrand: unique symbol;
|
|
1781
|
-
type OutputName = string & {
|
|
1881
|
+
type OutputName$1 = string & {
|
|
1782
1882
|
readonly [outputNameBrand]: true;
|
|
1783
1883
|
};
|
|
1784
|
-
declare function parseRunId(raw: string): RunId;
|
|
1785
|
-
declare function parseNodeId(raw: string): NodeId;
|
|
1786
|
-
declare function parsePlanHash(raw: string): PlanHash;
|
|
1787
|
-
declare function parseOutputName(raw: string): OutputName;
|
|
1884
|
+
declare function parseRunId(raw: string): RunId$1;
|
|
1885
|
+
declare function parseNodeId(raw: string): NodeId$1;
|
|
1886
|
+
declare function parsePlanHash(raw: string): PlanHash$1;
|
|
1887
|
+
declare function parseOutputName(raw: string): OutputName$1;
|
|
1788
1888
|
|
|
1789
1889
|
declare const WorkflowKinds: {
|
|
1790
1890
|
readonly WorkflowV0: "workflow.v0";
|
|
1891
|
+
readonly WorkflowV1: "workflow.v1";
|
|
1791
1892
|
};
|
|
1792
|
-
type
|
|
1893
|
+
type WorkflowKindV0 = (typeof WorkflowKinds)["WorkflowV0"];
|
|
1894
|
+
type WorkflowKindV1 = (typeof WorkflowKinds)["WorkflowV1"];
|
|
1895
|
+
type WorkflowKind = WorkflowKindV0 | WorkflowKindV1;
|
|
1793
1896
|
declare const WorkflowNodeTypes: {
|
|
1794
1897
|
readonly LLMResponses: "llm.responses";
|
|
1795
1898
|
readonly JoinAll: "join.all";
|
|
1796
1899
|
readonly TransformJSON: "transform.json";
|
|
1797
1900
|
};
|
|
1798
1901
|
type WorkflowNodeType = (typeof WorkflowNodeTypes)[keyof typeof WorkflowNodeTypes];
|
|
1902
|
+
declare const WorkflowNodeTypesV1: {
|
|
1903
|
+
readonly LLMResponses: "llm.responses";
|
|
1904
|
+
readonly RouteSwitch: "route.switch";
|
|
1905
|
+
readonly JoinAll: "join.all";
|
|
1906
|
+
readonly JoinAny: "join.any";
|
|
1907
|
+
readonly JoinCollect: "join.collect";
|
|
1908
|
+
readonly TransformJSON: "transform.json";
|
|
1909
|
+
readonly MapFanout: "map.fanout";
|
|
1910
|
+
};
|
|
1799
1911
|
type WorkflowSpecV0 = {
|
|
1800
|
-
kind:
|
|
1912
|
+
kind: WorkflowKindV0;
|
|
1801
1913
|
name?: string;
|
|
1802
1914
|
execution?: {
|
|
1803
1915
|
max_parallelism?: number;
|
|
@@ -1809,200 +1921,329 @@ type WorkflowSpecV0 = {
|
|
|
1809
1921
|
outputs: ReadonlyArray<WorkflowOutputRefV0>;
|
|
1810
1922
|
};
|
|
1811
1923
|
type WorkflowNodeV0 = {
|
|
1812
|
-
id: NodeId;
|
|
1924
|
+
id: NodeId$1;
|
|
1813
1925
|
type: typeof WorkflowNodeTypes.LLMResponses;
|
|
1814
1926
|
input: {
|
|
1815
1927
|
request: WireResponsesRequest;
|
|
1816
1928
|
stream?: boolean;
|
|
1817
|
-
tool_execution?: ToolExecutionV0;
|
|
1929
|
+
tool_execution?: ToolExecutionV0$1;
|
|
1818
1930
|
tool_limits?: LLMResponsesToolLimitsV0;
|
|
1819
1931
|
bindings?: ReadonlyArray<LLMResponsesBindingV0>;
|
|
1820
1932
|
};
|
|
1821
1933
|
} | {
|
|
1822
|
-
id: NodeId;
|
|
1934
|
+
id: NodeId$1;
|
|
1823
1935
|
type: typeof WorkflowNodeTypes.JoinAll;
|
|
1824
1936
|
input?: Record<string, unknown>;
|
|
1825
1937
|
} | {
|
|
1826
|
-
id: NodeId;
|
|
1938
|
+
id: NodeId$1;
|
|
1827
1939
|
type: typeof WorkflowNodeTypes.TransformJSON;
|
|
1828
1940
|
input: {
|
|
1829
1941
|
object?: Record<string, {
|
|
1830
|
-
from: NodeId;
|
|
1942
|
+
from: NodeId$1;
|
|
1831
1943
|
pointer?: string;
|
|
1832
1944
|
}>;
|
|
1833
1945
|
merge?: Array<{
|
|
1834
|
-
from: NodeId;
|
|
1946
|
+
from: NodeId$1;
|
|
1835
1947
|
pointer?: string;
|
|
1836
1948
|
}>;
|
|
1837
1949
|
};
|
|
1838
1950
|
};
|
|
1839
1951
|
type WorkflowEdgeV0 = {
|
|
1840
|
-
from: NodeId;
|
|
1841
|
-
to: NodeId;
|
|
1952
|
+
from: NodeId$1;
|
|
1953
|
+
to: NodeId$1;
|
|
1842
1954
|
};
|
|
1843
1955
|
type WorkflowOutputRefV0 = {
|
|
1844
|
-
name: OutputName;
|
|
1845
|
-
from: NodeId;
|
|
1956
|
+
name: OutputName$1;
|
|
1957
|
+
from: NodeId$1;
|
|
1846
1958
|
pointer?: string;
|
|
1847
1959
|
};
|
|
1848
1960
|
type LLMResponsesBindingEncodingV0 = "json" | "json_string";
|
|
1849
1961
|
type LLMResponsesBindingV0 = {
|
|
1850
|
-
from: NodeId;
|
|
1962
|
+
from: NodeId$1;
|
|
1851
1963
|
pointer?: string;
|
|
1852
|
-
to
|
|
1964
|
+
to?: string;
|
|
1965
|
+
to_placeholder?: string;
|
|
1853
1966
|
encoding?: LLMResponsesBindingEncodingV0;
|
|
1854
1967
|
};
|
|
1855
|
-
type ToolExecutionModeV0 = "server" | "client";
|
|
1856
|
-
type ToolExecutionV0 = {
|
|
1857
|
-
mode: ToolExecutionModeV0;
|
|
1968
|
+
type ToolExecutionModeV0$1 = "server" | "client";
|
|
1969
|
+
type ToolExecutionV0$1 = {
|
|
1970
|
+
mode: ToolExecutionModeV0$1;
|
|
1858
1971
|
};
|
|
1859
1972
|
type LLMResponsesToolLimitsV0 = {
|
|
1860
1973
|
max_llm_calls?: number;
|
|
1861
1974
|
max_tool_calls_per_step?: number;
|
|
1862
1975
|
wait_ttl_ms?: number;
|
|
1863
1976
|
};
|
|
1977
|
+
type ConditionSourceV1$1 = "node_output" | "node_status";
|
|
1978
|
+
type ConditionOpV1$1 = "equals" | "matches" | "exists";
|
|
1979
|
+
type ConditionV1$1 = {
|
|
1980
|
+
source: ConditionSourceV1$1;
|
|
1981
|
+
op: ConditionOpV1$1;
|
|
1982
|
+
path: string;
|
|
1983
|
+
value?: unknown;
|
|
1984
|
+
};
|
|
1985
|
+
type WorkflowEdgeV1 = {
|
|
1986
|
+
from: NodeId$1;
|
|
1987
|
+
to: NodeId$1;
|
|
1988
|
+
when?: ConditionV1$1;
|
|
1989
|
+
};
|
|
1990
|
+
type WorkflowOutputRefV1 = {
|
|
1991
|
+
name: OutputName$1;
|
|
1992
|
+
from: NodeId$1;
|
|
1993
|
+
pointer?: string;
|
|
1994
|
+
};
|
|
1995
|
+
type WorkflowSpecV1 = {
|
|
1996
|
+
kind: WorkflowKindV1;
|
|
1997
|
+
name?: string;
|
|
1998
|
+
execution?: {
|
|
1999
|
+
max_parallelism?: number;
|
|
2000
|
+
node_timeout_ms?: number;
|
|
2001
|
+
run_timeout_ms?: number;
|
|
2002
|
+
};
|
|
2003
|
+
nodes: ReadonlyArray<WorkflowNodeV1>;
|
|
2004
|
+
edges?: ReadonlyArray<WorkflowEdgeV1>;
|
|
2005
|
+
outputs: ReadonlyArray<WorkflowOutputRefV1>;
|
|
2006
|
+
};
|
|
2007
|
+
type ToolExecutionModeV1$1 = "server" | "client";
|
|
2008
|
+
type ToolExecutionV1$1 = {
|
|
2009
|
+
mode: ToolExecutionModeV1$1;
|
|
2010
|
+
};
|
|
2011
|
+
type LLMResponsesToolLimitsV1 = {
|
|
2012
|
+
max_llm_calls?: number;
|
|
2013
|
+
max_tool_calls_per_step?: number;
|
|
2014
|
+
wait_ttl_ms?: number;
|
|
2015
|
+
};
|
|
2016
|
+
type LLMResponsesBindingEncodingV1 = "json" | "json_string";
|
|
2017
|
+
type LLMResponsesBindingV1 = {
|
|
2018
|
+
from: NodeId$1;
|
|
2019
|
+
pointer?: string;
|
|
2020
|
+
to?: string;
|
|
2021
|
+
to_placeholder?: string;
|
|
2022
|
+
encoding?: LLMResponsesBindingEncodingV1;
|
|
2023
|
+
};
|
|
2024
|
+
type LLMResponsesNodeInputV1 = {
|
|
2025
|
+
request: WireResponsesRequest;
|
|
2026
|
+
stream?: boolean;
|
|
2027
|
+
tool_execution?: ToolExecutionV1$1;
|
|
2028
|
+
tool_limits?: LLMResponsesToolLimitsV1;
|
|
2029
|
+
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
2030
|
+
};
|
|
2031
|
+
type TransformJSONValueV1$1 = {
|
|
2032
|
+
from: NodeId$1;
|
|
2033
|
+
pointer?: string;
|
|
2034
|
+
};
|
|
2035
|
+
type TransformJSONNodeInputV1 = {
|
|
2036
|
+
object?: Record<string, TransformJSONValueV1$1>;
|
|
2037
|
+
merge?: Array<TransformJSONValueV1$1>;
|
|
2038
|
+
};
|
|
2039
|
+
type JoinAnyNodeInputV1 = {
|
|
2040
|
+
predicate?: ConditionV1$1;
|
|
2041
|
+
};
|
|
2042
|
+
type JoinCollectNodeInputV1 = {
|
|
2043
|
+
predicate?: ConditionV1$1;
|
|
2044
|
+
limit?: number;
|
|
2045
|
+
timeout_ms?: number;
|
|
2046
|
+
};
|
|
2047
|
+
type MapFanoutItemsV1 = {
|
|
2048
|
+
from: NodeId$1;
|
|
2049
|
+
path?: string;
|
|
2050
|
+
};
|
|
2051
|
+
type MapFanoutItemBindingV1 = {
|
|
2052
|
+
path?: string;
|
|
2053
|
+
to?: string;
|
|
2054
|
+
to_placeholder?: string;
|
|
2055
|
+
encoding?: LLMResponsesBindingEncodingV1;
|
|
2056
|
+
};
|
|
2057
|
+
type MapFanoutSubNodeV1 = {
|
|
2058
|
+
id: NodeId$1;
|
|
2059
|
+
type: typeof WorkflowNodeTypesV1.LLMResponses;
|
|
2060
|
+
input: LLMResponsesNodeInputV1;
|
|
2061
|
+
} | {
|
|
2062
|
+
id: NodeId$1;
|
|
2063
|
+
type: typeof WorkflowNodeTypesV1.RouteSwitch;
|
|
2064
|
+
input: LLMResponsesNodeInputV1;
|
|
2065
|
+
} | {
|
|
2066
|
+
id: NodeId$1;
|
|
2067
|
+
type: typeof WorkflowNodeTypesV1.TransformJSON;
|
|
2068
|
+
input: TransformJSONNodeInputV1;
|
|
2069
|
+
};
|
|
2070
|
+
type MapFanoutNodeInputV1 = {
|
|
2071
|
+
items: MapFanoutItemsV1;
|
|
2072
|
+
item_bindings?: ReadonlyArray<MapFanoutItemBindingV1>;
|
|
2073
|
+
subnode: MapFanoutSubNodeV1;
|
|
2074
|
+
max_parallelism?: number;
|
|
2075
|
+
};
|
|
2076
|
+
type WorkflowNodeV1 = {
|
|
2077
|
+
id: NodeId$1;
|
|
2078
|
+
type: typeof WorkflowNodeTypesV1.LLMResponses;
|
|
2079
|
+
input: LLMResponsesNodeInputV1;
|
|
2080
|
+
} | {
|
|
2081
|
+
id: NodeId$1;
|
|
2082
|
+
type: typeof WorkflowNodeTypesV1.RouteSwitch;
|
|
2083
|
+
input: LLMResponsesNodeInputV1;
|
|
2084
|
+
} | {
|
|
2085
|
+
id: NodeId$1;
|
|
2086
|
+
type: typeof WorkflowNodeTypesV1.JoinAll;
|
|
2087
|
+
input?: Record<string, unknown>;
|
|
2088
|
+
} | {
|
|
2089
|
+
id: NodeId$1;
|
|
2090
|
+
type: typeof WorkflowNodeTypesV1.JoinAny;
|
|
2091
|
+
input?: JoinAnyNodeInputV1;
|
|
2092
|
+
} | {
|
|
2093
|
+
id: NodeId$1;
|
|
2094
|
+
type: typeof WorkflowNodeTypesV1.JoinCollect;
|
|
2095
|
+
input: JoinCollectNodeInputV1;
|
|
2096
|
+
} | {
|
|
2097
|
+
id: NodeId$1;
|
|
2098
|
+
type: typeof WorkflowNodeTypesV1.TransformJSON;
|
|
2099
|
+
input: TransformJSONNodeInputV1;
|
|
2100
|
+
} | {
|
|
2101
|
+
id: NodeId$1;
|
|
2102
|
+
type: typeof WorkflowNodeTypesV1.MapFanout;
|
|
2103
|
+
input: MapFanoutNodeInputV1;
|
|
2104
|
+
};
|
|
1864
2105
|
type RunStatusV0 = "running" | "waiting" | "succeeded" | "failed" | "canceled";
|
|
1865
|
-
type PayloadInfoV0 = {
|
|
2106
|
+
type PayloadInfoV0$1 = {
|
|
1866
2107
|
bytes: number;
|
|
1867
2108
|
sha256: string;
|
|
1868
2109
|
included: boolean;
|
|
1869
2110
|
};
|
|
1870
2111
|
type RunEventTypeV0 = "run_compiled" | "run_started" | "run_completed" | "run_failed" | "run_canceled" | "node_llm_call" | "node_tool_call" | "node_tool_result" | "node_waiting" | "node_started" | "node_succeeded" | "node_failed" | "node_output_delta" | "node_output";
|
|
1871
|
-
type NodeErrorV0 = {
|
|
2112
|
+
type NodeErrorV0$1 = {
|
|
1872
2113
|
code?: string;
|
|
1873
2114
|
message: string;
|
|
1874
2115
|
};
|
|
1875
2116
|
/**
|
|
1876
2117
|
* Stream event kind from an LLM provider.
|
|
1877
2118
|
*/
|
|
1878
|
-
type StreamEventKind = string;
|
|
1879
|
-
type NodeOutputDeltaV0 = {
|
|
1880
|
-
kind: StreamEventKind;
|
|
2119
|
+
type StreamEventKind$1 = string;
|
|
2120
|
+
type NodeOutputDeltaV0$1 = {
|
|
2121
|
+
kind: StreamEventKind$1;
|
|
1881
2122
|
text_delta?: string;
|
|
1882
2123
|
response_id?: string;
|
|
1883
2124
|
model?: string;
|
|
1884
2125
|
};
|
|
1885
|
-
type TokenUsageV0 = {
|
|
2126
|
+
type TokenUsageV0$1 = {
|
|
1886
2127
|
input_tokens?: number;
|
|
1887
2128
|
output_tokens?: number;
|
|
1888
2129
|
total_tokens?: number;
|
|
1889
2130
|
};
|
|
1890
|
-
type NodeLLMCallV0 = {
|
|
2131
|
+
type NodeLLMCallV0$1 = {
|
|
1891
2132
|
step: number;
|
|
1892
2133
|
request_id: string;
|
|
1893
2134
|
provider?: string;
|
|
1894
2135
|
model?: string;
|
|
1895
2136
|
response_id?: string;
|
|
1896
2137
|
stop_reason?: string;
|
|
1897
|
-
usage?: TokenUsageV0;
|
|
2138
|
+
usage?: TokenUsageV0$1;
|
|
1898
2139
|
};
|
|
1899
|
-
type FunctionToolCallV0 = {
|
|
2140
|
+
type FunctionToolCallV0$1 = {
|
|
1900
2141
|
id: string;
|
|
1901
2142
|
name: string;
|
|
1902
2143
|
arguments: string;
|
|
1903
2144
|
};
|
|
1904
|
-
type NodeToolCallV0 = {
|
|
2145
|
+
type NodeToolCallV0$1 = {
|
|
1905
2146
|
step: number;
|
|
1906
2147
|
request_id: string;
|
|
1907
|
-
tool_call: FunctionToolCallV0;
|
|
2148
|
+
tool_call: FunctionToolCallV0$1;
|
|
1908
2149
|
};
|
|
1909
|
-
type NodeToolResultV0 = {
|
|
2150
|
+
type NodeToolResultV0$1 = {
|
|
1910
2151
|
step: number;
|
|
1911
2152
|
request_id: string;
|
|
1912
2153
|
tool_call_id: string;
|
|
1913
2154
|
name: string;
|
|
1914
2155
|
output: string;
|
|
1915
2156
|
};
|
|
1916
|
-
type PendingToolCallV0 = {
|
|
2157
|
+
type PendingToolCallV0$1 = {
|
|
1917
2158
|
tool_call_id: string;
|
|
1918
2159
|
name: string;
|
|
1919
2160
|
arguments: string;
|
|
1920
2161
|
};
|
|
1921
|
-
type NodeWaitingV0 = {
|
|
2162
|
+
type NodeWaitingV0$1 = {
|
|
1922
2163
|
step: number;
|
|
1923
2164
|
request_id: string;
|
|
1924
|
-
pending_tool_calls: PendingToolCallV0[];
|
|
2165
|
+
pending_tool_calls: PendingToolCallV0$1[];
|
|
1925
2166
|
reason: string;
|
|
1926
2167
|
};
|
|
1927
2168
|
type RunEventBaseV0 = {
|
|
1928
2169
|
envelope_version: "v0";
|
|
1929
|
-
run_id: RunId;
|
|
2170
|
+
run_id: RunId$1;
|
|
1930
2171
|
seq: number;
|
|
1931
2172
|
ts: string;
|
|
1932
2173
|
};
|
|
1933
2174
|
type RunEventRunCompiledV0 = RunEventBaseV0 & {
|
|
1934
2175
|
type: "run_compiled";
|
|
1935
|
-
plan_hash: PlanHash;
|
|
2176
|
+
plan_hash: PlanHash$1;
|
|
1936
2177
|
};
|
|
1937
2178
|
type RunEventRunStartedV0 = RunEventBaseV0 & {
|
|
1938
2179
|
type: "run_started";
|
|
1939
|
-
plan_hash: PlanHash;
|
|
2180
|
+
plan_hash: PlanHash$1;
|
|
1940
2181
|
};
|
|
1941
2182
|
type RunEventRunCompletedV0 = RunEventBaseV0 & {
|
|
1942
2183
|
type: "run_completed";
|
|
1943
|
-
plan_hash: PlanHash;
|
|
2184
|
+
plan_hash: PlanHash$1;
|
|
1944
2185
|
outputs_artifact_key: string;
|
|
1945
|
-
outputs_info: PayloadInfoV0;
|
|
2186
|
+
outputs_info: PayloadInfoV0$1;
|
|
1946
2187
|
};
|
|
1947
2188
|
type RunEventRunFailedV0 = RunEventBaseV0 & {
|
|
1948
2189
|
type: "run_failed";
|
|
1949
|
-
plan_hash: PlanHash;
|
|
1950
|
-
error: NodeErrorV0;
|
|
2190
|
+
plan_hash: PlanHash$1;
|
|
2191
|
+
error: NodeErrorV0$1;
|
|
1951
2192
|
};
|
|
1952
2193
|
type RunEventRunCanceledV0 = RunEventBaseV0 & {
|
|
1953
2194
|
type: "run_canceled";
|
|
1954
|
-
plan_hash: PlanHash;
|
|
1955
|
-
error: NodeErrorV0;
|
|
2195
|
+
plan_hash: PlanHash$1;
|
|
2196
|
+
error: NodeErrorV0$1;
|
|
1956
2197
|
};
|
|
1957
2198
|
type RunEventNodeStartedV0 = RunEventBaseV0 & {
|
|
1958
2199
|
type: "node_started";
|
|
1959
|
-
node_id: NodeId;
|
|
2200
|
+
node_id: NodeId$1;
|
|
1960
2201
|
};
|
|
1961
2202
|
type RunEventNodeSucceededV0 = RunEventBaseV0 & {
|
|
1962
2203
|
type: "node_succeeded";
|
|
1963
|
-
node_id: NodeId;
|
|
2204
|
+
node_id: NodeId$1;
|
|
1964
2205
|
};
|
|
1965
2206
|
type RunEventNodeFailedV0 = RunEventBaseV0 & {
|
|
1966
2207
|
type: "node_failed";
|
|
1967
|
-
node_id: NodeId;
|
|
1968
|
-
error: NodeErrorV0;
|
|
2208
|
+
node_id: NodeId$1;
|
|
2209
|
+
error: NodeErrorV0$1;
|
|
1969
2210
|
};
|
|
1970
2211
|
type RunEventNodeLLMCallV0 = RunEventBaseV0 & {
|
|
1971
2212
|
type: "node_llm_call";
|
|
1972
|
-
node_id: NodeId;
|
|
1973
|
-
llm_call: NodeLLMCallV0;
|
|
2213
|
+
node_id: NodeId$1;
|
|
2214
|
+
llm_call: NodeLLMCallV0$1;
|
|
1974
2215
|
};
|
|
1975
2216
|
type RunEventNodeToolCallV0 = RunEventBaseV0 & {
|
|
1976
2217
|
type: "node_tool_call";
|
|
1977
|
-
node_id: NodeId;
|
|
1978
|
-
tool_call: NodeToolCallV0;
|
|
2218
|
+
node_id: NodeId$1;
|
|
2219
|
+
tool_call: NodeToolCallV0$1;
|
|
1979
2220
|
};
|
|
1980
2221
|
type RunEventNodeToolResultV0 = RunEventBaseV0 & {
|
|
1981
2222
|
type: "node_tool_result";
|
|
1982
|
-
node_id: NodeId;
|
|
1983
|
-
tool_result: NodeToolResultV0;
|
|
2223
|
+
node_id: NodeId$1;
|
|
2224
|
+
tool_result: NodeToolResultV0$1;
|
|
1984
2225
|
};
|
|
1985
2226
|
type RunEventNodeWaitingV0 = RunEventBaseV0 & {
|
|
1986
2227
|
type: "node_waiting";
|
|
1987
|
-
node_id: NodeId;
|
|
1988
|
-
waiting: NodeWaitingV0;
|
|
2228
|
+
node_id: NodeId$1;
|
|
2229
|
+
waiting: NodeWaitingV0$1;
|
|
1989
2230
|
};
|
|
1990
2231
|
type RunEventNodeOutputDeltaV0 = RunEventBaseV0 & {
|
|
1991
2232
|
type: "node_output_delta";
|
|
1992
|
-
node_id: NodeId;
|
|
1993
|
-
delta: NodeOutputDeltaV0;
|
|
2233
|
+
node_id: NodeId$1;
|
|
2234
|
+
delta: NodeOutputDeltaV0$1;
|
|
1994
2235
|
};
|
|
1995
2236
|
type RunEventNodeOutputV0 = RunEventBaseV0 & {
|
|
1996
2237
|
type: "node_output";
|
|
1997
|
-
node_id: NodeId;
|
|
2238
|
+
node_id: NodeId$1;
|
|
1998
2239
|
artifact_key: string;
|
|
1999
|
-
output_info: PayloadInfoV0;
|
|
2240
|
+
output_info: PayloadInfoV0$1;
|
|
2000
2241
|
};
|
|
2001
2242
|
type RunEventV0 = RunEventRunCompiledV0 | RunEventRunStartedV0 | RunEventRunCompletedV0 | RunEventRunFailedV0 | RunEventRunCanceledV0 | RunEventNodeLLMCallV0 | RunEventNodeToolCallV0 | RunEventNodeToolResultV0 | RunEventNodeWaitingV0 | RunEventNodeStartedV0 | RunEventNodeSucceededV0 | RunEventNodeFailedV0 | RunEventNodeOutputDeltaV0 | RunEventNodeOutputV0;
|
|
2002
2243
|
|
|
2003
2244
|
type NodeStatusV0 = "pending" | "running" | "waiting" | "succeeded" | "failed" | "canceled";
|
|
2004
2245
|
type RunsToolResultsRequest = {
|
|
2005
|
-
node_id: NodeId;
|
|
2246
|
+
node_id: NodeId$1;
|
|
2006
2247
|
step: number;
|
|
2007
2248
|
request_id: string;
|
|
2008
2249
|
results: Array<{
|
|
@@ -2016,9 +2257,9 @@ type RunsToolResultsResponse = {
|
|
|
2016
2257
|
status: RunStatusV0;
|
|
2017
2258
|
};
|
|
2018
2259
|
type RunsPendingToolsResponse = {
|
|
2019
|
-
run_id: RunId;
|
|
2260
|
+
run_id: RunId$1;
|
|
2020
2261
|
pending: Array<{
|
|
2021
|
-
node_id: NodeId;
|
|
2262
|
+
node_id: NodeId$1;
|
|
2022
2263
|
step: number;
|
|
2023
2264
|
request_id: string;
|
|
2024
2265
|
tool_calls: Array<{
|
|
@@ -2029,14 +2270,14 @@ type RunsPendingToolsResponse = {
|
|
|
2029
2270
|
}>;
|
|
2030
2271
|
};
|
|
2031
2272
|
type RunsCreateResponse = {
|
|
2032
|
-
run_id: RunId;
|
|
2273
|
+
run_id: RunId$1;
|
|
2033
2274
|
status: RunStatusV0;
|
|
2034
|
-
plan_hash: PlanHash;
|
|
2275
|
+
plan_hash: PlanHash$1;
|
|
2035
2276
|
};
|
|
2036
2277
|
type RunsGetResponse = {
|
|
2037
|
-
run_id: RunId;
|
|
2278
|
+
run_id: RunId$1;
|
|
2038
2279
|
status: RunStatusV0;
|
|
2039
|
-
plan_hash: PlanHash;
|
|
2280
|
+
plan_hash: PlanHash$1;
|
|
2040
2281
|
cost_summary: RunCostSummaryV0;
|
|
2041
2282
|
nodes?: NodeResultV0[];
|
|
2042
2283
|
outputs?: Record<string, unknown>;
|
|
@@ -2054,7 +2295,7 @@ type RunCostLineItemV0 = {
|
|
|
2054
2295
|
usd_cents: number;
|
|
2055
2296
|
};
|
|
2056
2297
|
type NodeResultV0 = {
|
|
2057
|
-
id: NodeId;
|
|
2298
|
+
id: NodeId$1;
|
|
2058
2299
|
type: string;
|
|
2059
2300
|
status: NodeStatusV0;
|
|
2060
2301
|
started_at?: string;
|
|
@@ -2097,6 +2338,7 @@ declare class RunsEventStream implements AsyncIterable<RunEventV0> {
|
|
|
2097
2338
|
|
|
2098
2339
|
type RunsCreateOptions = {
|
|
2099
2340
|
customerId?: string;
|
|
2341
|
+
sessionId?: string;
|
|
2100
2342
|
idempotencyKey?: string;
|
|
2101
2343
|
signal?: AbortSignal;
|
|
2102
2344
|
headers?: Record<string, string>;
|
|
@@ -2177,11 +2419,11 @@ declare class RunsClient {
|
|
|
2177
2419
|
metrics?: MetricsCallbacks;
|
|
2178
2420
|
trace?: TraceCallbacks;
|
|
2179
2421
|
}): Promise<unknown>;
|
|
2180
|
-
get(runId: RunId, options?: RunsGetOptions): Promise<RunsGetResponse>;
|
|
2181
|
-
events(runId: RunId, options?: RunsEventsOptions): Promise<RunsEventStream>;
|
|
2182
|
-
listEvents(runId: RunId, options?: Omit<RunsEventsOptions, "wait">): Promise<RunEventV0[]>;
|
|
2183
|
-
submitToolResults(runId: RunId, req: RunsToolResultsRequest, options?: RunsToolResultsOptions): Promise<RunsToolResultsResponse>;
|
|
2184
|
-
pendingTools(runId: RunId, options?: RunsPendingToolsOptions): Promise<RunsPendingToolsResponse>;
|
|
2422
|
+
get(runId: RunId$1, options?: RunsGetOptions): Promise<RunsGetResponse>;
|
|
2423
|
+
events(runId: RunId$1, options?: RunsEventsOptions): Promise<RunsEventStream>;
|
|
2424
|
+
listEvents(runId: RunId$1, options?: Omit<RunsEventsOptions, "wait">): Promise<RunEventV0[]>;
|
|
2425
|
+
submitToolResults(runId: RunId$1, req: RunsToolResultsRequest, options?: RunsToolResultsOptions): Promise<RunsToolResultsResponse>;
|
|
2426
|
+
pendingTools(runId: RunId$1, options?: RunsPendingToolsOptions): Promise<RunsPendingToolsResponse>;
|
|
2185
2427
|
}
|
|
2186
2428
|
|
|
2187
2429
|
/**
|
|
@@ -2253,8 +2495,8 @@ declare class StreamProtocolError extends TransportError {
|
|
|
2253
2495
|
status: number;
|
|
2254
2496
|
});
|
|
2255
2497
|
}
|
|
2256
|
-
declare class StreamTimeoutError extends
|
|
2257
|
-
|
|
2498
|
+
declare class StreamTimeoutError extends ModelRelayError {
|
|
2499
|
+
kind: StreamTimeoutKind;
|
|
2258
2500
|
timeoutMs: number;
|
|
2259
2501
|
constructor(streamKind: StreamTimeoutKind, timeoutMs: number);
|
|
2260
2502
|
}
|
|
@@ -2385,7 +2627,11 @@ type WorkflowsCompileOptions = {
|
|
|
2385
2627
|
};
|
|
2386
2628
|
type WorkflowsCompileResponseV0 = {
|
|
2387
2629
|
plan_json: unknown;
|
|
2388
|
-
plan_hash: PlanHash;
|
|
2630
|
+
plan_hash: PlanHash$1;
|
|
2631
|
+
};
|
|
2632
|
+
type WorkflowsCompileResponseV1 = {
|
|
2633
|
+
plan_json: unknown;
|
|
2634
|
+
plan_hash: PlanHash$1;
|
|
2389
2635
|
};
|
|
2390
2636
|
type WorkflowsCompileV0Result = ({
|
|
2391
2637
|
ok: true;
|
|
@@ -2401,6 +2647,20 @@ type WorkflowsCompileV0Result = ({
|
|
|
2401
2647
|
code?: string;
|
|
2402
2648
|
requestId?: string;
|
|
2403
2649
|
};
|
|
2650
|
+
type WorkflowsCompileV1Result = ({
|
|
2651
|
+
ok: true;
|
|
2652
|
+
} & WorkflowsCompileResponseV1) | {
|
|
2653
|
+
ok: false;
|
|
2654
|
+
error_type: "validation_error";
|
|
2655
|
+
issues: ReadonlyArray<WorkflowValidationIssue>;
|
|
2656
|
+
} | {
|
|
2657
|
+
ok: false;
|
|
2658
|
+
error_type: "internal_error";
|
|
2659
|
+
status: number;
|
|
2660
|
+
message: string;
|
|
2661
|
+
code?: string;
|
|
2662
|
+
requestId?: string;
|
|
2663
|
+
};
|
|
2404
2664
|
declare class WorkflowsClient {
|
|
2405
2665
|
private readonly http;
|
|
2406
2666
|
private readonly auth;
|
|
@@ -2411,6 +2671,7 @@ declare class WorkflowsClient {
|
|
|
2411
2671
|
trace?: TraceCallbacks;
|
|
2412
2672
|
});
|
|
2413
2673
|
compileV0(spec: WorkflowSpecV0, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileV0Result>;
|
|
2674
|
+
compileV1(spec: WorkflowSpecV1, options?: WorkflowsCompileOptions): Promise<WorkflowsCompileV1Result>;
|
|
2414
2675
|
}
|
|
2415
2676
|
|
|
2416
2677
|
/**
|
|
@@ -2438,6 +2699,26 @@ interface paths {
|
|
|
2438
2699
|
patch?: never;
|
|
2439
2700
|
trace?: never;
|
|
2440
2701
|
};
|
|
2702
|
+
"/schemas/workflow_v1.schema.json": {
|
|
2703
|
+
parameters: {
|
|
2704
|
+
query?: never;
|
|
2705
|
+
header?: never;
|
|
2706
|
+
path?: never;
|
|
2707
|
+
cookie?: never;
|
|
2708
|
+
};
|
|
2709
|
+
/**
|
|
2710
|
+
* Get JSON Schema for workflow.v1
|
|
2711
|
+
* @description Returns the canonical JSON Schema (draft-07) for `workflow.v1`.
|
|
2712
|
+
*/
|
|
2713
|
+
get: operations["getWorkflowV1Schema"];
|
|
2714
|
+
put?: never;
|
|
2715
|
+
post?: never;
|
|
2716
|
+
delete?: never;
|
|
2717
|
+
options?: never;
|
|
2718
|
+
head?: never;
|
|
2719
|
+
patch?: never;
|
|
2720
|
+
trace?: never;
|
|
2721
|
+
};
|
|
2441
2722
|
"/schemas/run_event_v0.schema.json": {
|
|
2442
2723
|
parameters: {
|
|
2443
2724
|
query?: never;
|
|
@@ -3004,7 +3285,10 @@ interface paths {
|
|
|
3004
3285
|
};
|
|
3005
3286
|
get?: never;
|
|
3006
3287
|
put?: never;
|
|
3007
|
-
/**
|
|
3288
|
+
/**
|
|
3289
|
+
* Create a response via the provider-agnostic API
|
|
3290
|
+
* @description Creates a model response. Auth accepts secret API keys or bearer tokens. Bearer tokens may be owner session tokens (dashboard/server) or end-user tokens; publishable keys are not allowed.
|
|
3291
|
+
*/
|
|
3008
3292
|
post: operations["createResponse"];
|
|
3009
3293
|
delete?: never;
|
|
3010
3294
|
options?: never;
|
|
@@ -3049,6 +3333,56 @@ interface paths {
|
|
|
3049
3333
|
patch?: never;
|
|
3050
3334
|
trace?: never;
|
|
3051
3335
|
};
|
|
3336
|
+
"/images/{image_id}": {
|
|
3337
|
+
parameters: {
|
|
3338
|
+
query?: never;
|
|
3339
|
+
header?: never;
|
|
3340
|
+
path: {
|
|
3341
|
+
/** @description Image ID */
|
|
3342
|
+
image_id: string;
|
|
3343
|
+
};
|
|
3344
|
+
cookie?: never;
|
|
3345
|
+
};
|
|
3346
|
+
/**
|
|
3347
|
+
* Get image details
|
|
3348
|
+
* @description Retrieve information about a specific image, including its pinned status and URL.
|
|
3349
|
+
*/
|
|
3350
|
+
get: operations["getImage"];
|
|
3351
|
+
put?: never;
|
|
3352
|
+
post?: never;
|
|
3353
|
+
delete?: never;
|
|
3354
|
+
options?: never;
|
|
3355
|
+
head?: never;
|
|
3356
|
+
patch?: never;
|
|
3357
|
+
trace?: never;
|
|
3358
|
+
};
|
|
3359
|
+
"/images/{image_id}/pin": {
|
|
3360
|
+
parameters: {
|
|
3361
|
+
query?: never;
|
|
3362
|
+
header?: never;
|
|
3363
|
+
path: {
|
|
3364
|
+
/** @description Image ID */
|
|
3365
|
+
image_id: string;
|
|
3366
|
+
};
|
|
3367
|
+
cookie?: never;
|
|
3368
|
+
};
|
|
3369
|
+
get?: never;
|
|
3370
|
+
put?: never;
|
|
3371
|
+
/**
|
|
3372
|
+
* Pin an image
|
|
3373
|
+
* @description Pin an image to prevent it from expiring. Pinned images remain accessible permanently (subject to tier limits).
|
|
3374
|
+
*/
|
|
3375
|
+
post: operations["pinImage"];
|
|
3376
|
+
/**
|
|
3377
|
+
* Unpin an image
|
|
3378
|
+
* @description Unpin an image, setting it to expire after the default ephemeral period (7 days).
|
|
3379
|
+
*/
|
|
3380
|
+
delete: operations["unpinImage"];
|
|
3381
|
+
options?: never;
|
|
3382
|
+
head?: never;
|
|
3383
|
+
patch?: never;
|
|
3384
|
+
trace?: never;
|
|
3385
|
+
};
|
|
3052
3386
|
"/runs": {
|
|
3053
3387
|
parameters: {
|
|
3054
3388
|
query?: never;
|
|
@@ -3059,8 +3393,8 @@ interface paths {
|
|
|
3059
3393
|
get?: never;
|
|
3060
3394
|
put?: never;
|
|
3061
3395
|
/**
|
|
3062
|
-
* Start a workflow run (workflow.v0)
|
|
3063
|
-
* @description Starts a run for a `workflow.v0` spec and returns a `run_id`. Auth matches `/responses` (API key or frontend bearer token). Session owner tokens from `/auth/login` are not accepted.
|
|
3396
|
+
* Start a workflow run (workflow.v0 or workflow.v1)
|
|
3397
|
+
* @description Starts a run for a `workflow.v0` or `workflow.v1` spec and returns a `run_id`. Auth matches `/responses` (API key or frontend bearer token). Session owner tokens from `/auth/login` are not accepted. Provide `session_id` to link the run to a session; when linked, assistant messages are appended to the session on completion.
|
|
3064
3398
|
*/
|
|
3065
3399
|
post: operations["createRun"];
|
|
3066
3400
|
delete?: never;
|
|
@@ -3167,6 +3501,136 @@ interface paths {
|
|
|
3167
3501
|
delete: operations["deleteSession"];
|
|
3168
3502
|
options?: never;
|
|
3169
3503
|
head?: never;
|
|
3504
|
+
/**
|
|
3505
|
+
* Update session metadata
|
|
3506
|
+
* @description Updates session metadata. Keys with null values are removed.
|
|
3507
|
+
*/
|
|
3508
|
+
patch: operations["updateSession"];
|
|
3509
|
+
trace?: never;
|
|
3510
|
+
};
|
|
3511
|
+
"/sessions/{session_id}/messages": {
|
|
3512
|
+
parameters: {
|
|
3513
|
+
query?: never;
|
|
3514
|
+
header?: never;
|
|
3515
|
+
path: {
|
|
3516
|
+
session_id: string;
|
|
3517
|
+
};
|
|
3518
|
+
cookie?: never;
|
|
3519
|
+
};
|
|
3520
|
+
get?: never;
|
|
3521
|
+
put?: never;
|
|
3522
|
+
/**
|
|
3523
|
+
* Append a session message
|
|
3524
|
+
* @description Appends a message to an existing session.
|
|
3525
|
+
*/
|
|
3526
|
+
post: operations["addSessionMessage"];
|
|
3527
|
+
delete?: never;
|
|
3528
|
+
options?: never;
|
|
3529
|
+
head?: never;
|
|
3530
|
+
patch?: never;
|
|
3531
|
+
trace?: never;
|
|
3532
|
+
};
|
|
3533
|
+
"/projects/{id}/tool-hooks": {
|
|
3534
|
+
parameters: {
|
|
3535
|
+
query?: never;
|
|
3536
|
+
header?: never;
|
|
3537
|
+
path: {
|
|
3538
|
+
id: components["parameters"]["ProjectID"];
|
|
3539
|
+
};
|
|
3540
|
+
cookie?: never;
|
|
3541
|
+
};
|
|
3542
|
+
/** List project tool hooks */
|
|
3543
|
+
get: operations["listProjectToolHooks"];
|
|
3544
|
+
put?: never;
|
|
3545
|
+
/** Create a project tool hook */
|
|
3546
|
+
post: operations["createProjectToolHook"];
|
|
3547
|
+
delete?: never;
|
|
3548
|
+
options?: never;
|
|
3549
|
+
head?: never;
|
|
3550
|
+
patch?: never;
|
|
3551
|
+
trace?: never;
|
|
3552
|
+
};
|
|
3553
|
+
"/projects/{id}/tool-hooks/{hook_id}": {
|
|
3554
|
+
parameters: {
|
|
3555
|
+
query?: never;
|
|
3556
|
+
header?: never;
|
|
3557
|
+
path: {
|
|
3558
|
+
id: components["parameters"]["ProjectID"];
|
|
3559
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
3560
|
+
};
|
|
3561
|
+
cookie?: never;
|
|
3562
|
+
};
|
|
3563
|
+
/** Get a project tool hook */
|
|
3564
|
+
get: operations["getProjectToolHook"];
|
|
3565
|
+
/** Update a project tool hook */
|
|
3566
|
+
put: operations["updateProjectToolHook"];
|
|
3567
|
+
post?: never;
|
|
3568
|
+
/** Delete a project tool hook */
|
|
3569
|
+
delete: operations["deleteProjectToolHook"];
|
|
3570
|
+
options?: never;
|
|
3571
|
+
head?: never;
|
|
3572
|
+
patch?: never;
|
|
3573
|
+
trace?: never;
|
|
3574
|
+
};
|
|
3575
|
+
"/projects/{id}/tool-hooks/{hook_id}/events": {
|
|
3576
|
+
parameters: {
|
|
3577
|
+
query?: never;
|
|
3578
|
+
header?: never;
|
|
3579
|
+
path: {
|
|
3580
|
+
id: components["parameters"]["ProjectID"];
|
|
3581
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
3582
|
+
};
|
|
3583
|
+
cookie?: never;
|
|
3584
|
+
};
|
|
3585
|
+
/** List tool hook delivery events */
|
|
3586
|
+
get: operations["listProjectToolHookEvents"];
|
|
3587
|
+
put?: never;
|
|
3588
|
+
post?: never;
|
|
3589
|
+
delete?: never;
|
|
3590
|
+
options?: never;
|
|
3591
|
+
head?: never;
|
|
3592
|
+
patch?: never;
|
|
3593
|
+
trace?: never;
|
|
3594
|
+
};
|
|
3595
|
+
"/projects/{id}/tool-hooks/{hook_id}/test": {
|
|
3596
|
+
parameters: {
|
|
3597
|
+
query?: never;
|
|
3598
|
+
header?: never;
|
|
3599
|
+
path: {
|
|
3600
|
+
id: components["parameters"]["ProjectID"];
|
|
3601
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
3602
|
+
};
|
|
3603
|
+
cookie?: never;
|
|
3604
|
+
};
|
|
3605
|
+
get?: never;
|
|
3606
|
+
put?: never;
|
|
3607
|
+
/** Test a tool hook */
|
|
3608
|
+
post: operations["testProjectToolHook"];
|
|
3609
|
+
delete?: never;
|
|
3610
|
+
options?: never;
|
|
3611
|
+
head?: never;
|
|
3612
|
+
patch?: never;
|
|
3613
|
+
trace?: never;
|
|
3614
|
+
};
|
|
3615
|
+
"/sessions/{session_id}/clear": {
|
|
3616
|
+
parameters: {
|
|
3617
|
+
query?: never;
|
|
3618
|
+
header?: never;
|
|
3619
|
+
path: {
|
|
3620
|
+
session_id: string;
|
|
3621
|
+
};
|
|
3622
|
+
cookie?: never;
|
|
3623
|
+
};
|
|
3624
|
+
get?: never;
|
|
3625
|
+
put?: never;
|
|
3626
|
+
/**
|
|
3627
|
+
* Clear session messages
|
|
3628
|
+
* @description Deletes all messages in the session and returns the updated session.
|
|
3629
|
+
*/
|
|
3630
|
+
post: operations["clearSession"];
|
|
3631
|
+
delete?: never;
|
|
3632
|
+
options?: never;
|
|
3633
|
+
head?: never;
|
|
3170
3634
|
patch?: never;
|
|
3171
3635
|
trace?: never;
|
|
3172
3636
|
};
|
|
@@ -3244,15 +3708,15 @@ interface components {
|
|
|
3244
3708
|
/** @description Whether the model is deprecated */
|
|
3245
3709
|
deprecated: boolean;
|
|
3246
3710
|
/**
|
|
3247
|
-
* Format:
|
|
3248
|
-
* @description
|
|
3711
|
+
* Format: int64
|
|
3712
|
+
* @description Provider input cost in cents per million tokens. Customer price is derived as cost * (1 + platformFeePercent/100).
|
|
3249
3713
|
*/
|
|
3250
|
-
|
|
3714
|
+
model_input_cost_cents: number;
|
|
3251
3715
|
/**
|
|
3252
|
-
* Format:
|
|
3253
|
-
* @description
|
|
3716
|
+
* Format: int64
|
|
3717
|
+
* @description Provider output cost in cents per million tokens. Customer price is derived as cost * (1 + platformFeePercent/100).
|
|
3254
3718
|
*/
|
|
3255
|
-
|
|
3719
|
+
model_output_cost_cents: number;
|
|
3256
3720
|
/** @description Whether this is the default model for the tier */
|
|
3257
3721
|
is_default: boolean;
|
|
3258
3722
|
/** Format: date-time */
|
|
@@ -3260,12 +3724,9 @@ interface components {
|
|
|
3260
3724
|
/** Format: date-time */
|
|
3261
3725
|
updated_at: string;
|
|
3262
3726
|
};
|
|
3727
|
+
/** @description Model to add to a tier. Pricing is derived from the model_pricing table. */
|
|
3263
3728
|
TierModelCreate: {
|
|
3264
3729
|
model_id: components["schemas"]["ModelId"];
|
|
3265
|
-
/** Format: uint64 */
|
|
3266
|
-
input_price_per_million_cents: number;
|
|
3267
|
-
/** Format: uint64 */
|
|
3268
|
-
output_price_per_million_cents: number;
|
|
3269
3730
|
/** @default false */
|
|
3270
3731
|
is_default: boolean;
|
|
3271
3732
|
};
|
|
@@ -3677,12 +4138,21 @@ interface components {
|
|
|
3677
4138
|
WorkflowSpecV0: {
|
|
3678
4139
|
[key: string]: unknown;
|
|
3679
4140
|
};
|
|
4141
|
+
/** @description A `workflow.v1` spec. The canonical JSON Schema is available at `/schemas/workflow_v1.schema.json`. */
|
|
4142
|
+
WorkflowSpecV1: {
|
|
4143
|
+
[key: string]: unknown;
|
|
4144
|
+
};
|
|
3680
4145
|
RunsCreateOptionsV0: {
|
|
3681
4146
|
idempotency_key?: string;
|
|
3682
4147
|
};
|
|
3683
4148
|
RunsCreateRequest: {
|
|
3684
|
-
spec: components["schemas"]["WorkflowSpecV0"];
|
|
3685
|
-
/**
|
|
4149
|
+
spec: components["schemas"]["WorkflowSpecV0"] | components["schemas"]["WorkflowSpecV1"];
|
|
4150
|
+
/**
|
|
4151
|
+
* Format: uuid
|
|
4152
|
+
* @description Optional session ID to link this run to a session.
|
|
4153
|
+
*/
|
|
4154
|
+
session_id?: string;
|
|
4155
|
+
/** @description Runtime inputs for the workflow. Required when the spec uses from_input references (e.g., map.fanout with items.from_input). Each key is the input name, and the value is the JSON data to provide. */
|
|
3686
4156
|
input?: {
|
|
3687
4157
|
[key: string]: unknown;
|
|
3688
4158
|
};
|
|
@@ -3936,7 +4406,7 @@ interface components {
|
|
|
3936
4406
|
* @description Workflow-critical model capability identifier.
|
|
3937
4407
|
* @enum {string}
|
|
3938
4408
|
*/
|
|
3939
|
-
ModelCapability: "tools" | "vision" | "web_search" | "web_fetch" | "computer_use" | "code_execution";
|
|
4409
|
+
ModelCapability: "text_generation" | "tools" | "vision" | "web_search" | "web_fetch" | "computer_use" | "code_execution" | "image_generation";
|
|
3940
4410
|
Model: {
|
|
3941
4411
|
model_id: components["schemas"]["ModelId"];
|
|
3942
4412
|
provider: components["schemas"]["ProviderId"];
|
|
@@ -4058,7 +4528,7 @@ interface components {
|
|
|
4058
4528
|
* @description Type of workflow node.
|
|
4059
4529
|
* @enum {string}
|
|
4060
4530
|
*/
|
|
4061
|
-
NodeTypeV0: "llm.responses" | "join.all" | "transform.json";
|
|
4531
|
+
NodeTypeV0: "llm.responses" | "route.switch" | "join.all" | "join.any" | "join.collect" | "map.fanout" | "transform.json";
|
|
4062
4532
|
/** @description Tier code identifier (e.g., free, pro, enterprise). */
|
|
4063
4533
|
TierCode: string;
|
|
4064
4534
|
/** @description Request to generate images from a text prompt. */
|
|
@@ -4067,6 +4537,11 @@ interface components {
|
|
|
4067
4537
|
model?: string;
|
|
4068
4538
|
/** @description Text description of the image to generate */
|
|
4069
4539
|
prompt: string;
|
|
4540
|
+
/**
|
|
4541
|
+
* @description Number of images to generate (1-10, default 1)
|
|
4542
|
+
* @default 1
|
|
4543
|
+
*/
|
|
4544
|
+
n: number;
|
|
4070
4545
|
response_format?: components["schemas"]["ImageResponseFormat"];
|
|
4071
4546
|
};
|
|
4072
4547
|
/**
|
|
@@ -4093,6 +4568,15 @@ interface components {
|
|
|
4093
4568
|
b64_json?: string;
|
|
4094
4569
|
/** @description MIME type of the image (e.g., 'image/png', 'image/webp') */
|
|
4095
4570
|
mime_type?: string;
|
|
4571
|
+
/** @description Unique identifier for the image (used for pinning) */
|
|
4572
|
+
image_id?: string;
|
|
4573
|
+
/**
|
|
4574
|
+
* Format: date-time
|
|
4575
|
+
* @description When the image URL expires (null if pinned)
|
|
4576
|
+
*/
|
|
4577
|
+
expires_at?: string;
|
|
4578
|
+
/** @description URL to pin this image for permanent storage */
|
|
4579
|
+
pin_url?: string;
|
|
4096
4580
|
};
|
|
4097
4581
|
/** @description Usage statistics for image generation. */
|
|
4098
4582
|
ImageUsage: {
|
|
@@ -4102,10 +4586,24 @@ interface components {
|
|
|
4102
4586
|
*/
|
|
4103
4587
|
images: number;
|
|
4104
4588
|
};
|
|
4105
|
-
/** @description
|
|
4106
|
-
|
|
4589
|
+
/** @description Response from pin/unpin operations. */
|
|
4590
|
+
ImagePinResponse: {
|
|
4591
|
+
/** @description Image ID */
|
|
4592
|
+
id: string;
|
|
4593
|
+
/** @description Whether the image is currently pinned */
|
|
4594
|
+
pinned: boolean;
|
|
4107
4595
|
/**
|
|
4108
|
-
* Format:
|
|
4596
|
+
* Format: date-time
|
|
4597
|
+
* @description When the image expires (null if pinned)
|
|
4598
|
+
*/
|
|
4599
|
+
expires_at?: string;
|
|
4600
|
+
/** @description URL of the image */
|
|
4601
|
+
url: string;
|
|
4602
|
+
};
|
|
4603
|
+
/** @description Request body for creating a session. */
|
|
4604
|
+
SessionCreateRequest: {
|
|
4605
|
+
/**
|
|
4606
|
+
* Format: uuid
|
|
4109
4607
|
* @description Optional end user ID to associate with the session
|
|
4110
4608
|
*/
|
|
4111
4609
|
end_user_id?: string;
|
|
@@ -4192,11 +4690,107 @@ interface components {
|
|
|
4192
4690
|
/** @description Cursor for fetching the next page (if more results exist) */
|
|
4193
4691
|
next_cursor?: string;
|
|
4194
4692
|
};
|
|
4693
|
+
/** @description Request body for appending a message to a session. */
|
|
4694
|
+
SessionMessageCreateRequest: {
|
|
4695
|
+
/** @description Message role (user, assistant, tool) */
|
|
4696
|
+
role: string;
|
|
4697
|
+
/** @description Message content parts */
|
|
4698
|
+
content: {
|
|
4699
|
+
[key: string]: unknown;
|
|
4700
|
+
}[];
|
|
4701
|
+
/**
|
|
4702
|
+
* Format: uuid
|
|
4703
|
+
* @description Run ID that generated this message (for assistant messages)
|
|
4704
|
+
*/
|
|
4705
|
+
run_id?: string;
|
|
4706
|
+
};
|
|
4707
|
+
ToolHookConfig: {
|
|
4708
|
+
/** Format: uuid */
|
|
4709
|
+
id?: string;
|
|
4710
|
+
/** Format: uuid */
|
|
4711
|
+
project_id?: string;
|
|
4712
|
+
/** @enum {string} */
|
|
4713
|
+
hook_type?: "pre_tool_use" | "post_tool_use" | "tool_execute";
|
|
4714
|
+
/** Format: uri */
|
|
4715
|
+
endpoint_url?: string;
|
|
4716
|
+
enabled?: boolean;
|
|
4717
|
+
/** Format: int32 */
|
|
4718
|
+
timeout_ms?: number;
|
|
4719
|
+
/** @enum {string} */
|
|
4720
|
+
fail_behavior?: "fail_closed" | "fail_open";
|
|
4721
|
+
tools_allowlist?: string[];
|
|
4722
|
+
allow_mutation?: boolean;
|
|
4723
|
+
/** Format: date-time */
|
|
4724
|
+
created_at?: string;
|
|
4725
|
+
/** Format: date-time */
|
|
4726
|
+
updated_at?: string;
|
|
4727
|
+
};
|
|
4728
|
+
ToolHookConfigInput: {
|
|
4729
|
+
/** @enum {string} */
|
|
4730
|
+
hook_type: "pre_tool_use" | "post_tool_use" | "tool_execute";
|
|
4731
|
+
/** Format: uri */
|
|
4732
|
+
endpoint_url: string;
|
|
4733
|
+
enabled?: boolean;
|
|
4734
|
+
/** Format: int32 */
|
|
4735
|
+
timeout_ms?: number;
|
|
4736
|
+
/** @enum {string} */
|
|
4737
|
+
fail_behavior?: "fail_closed" | "fail_open";
|
|
4738
|
+
tools_allowlist?: string[];
|
|
4739
|
+
allow_mutation?: boolean;
|
|
4740
|
+
};
|
|
4741
|
+
ToolHookConfigUpdate: {
|
|
4742
|
+
/** Format: uri */
|
|
4743
|
+
endpoint_url?: string;
|
|
4744
|
+
enabled?: boolean;
|
|
4745
|
+
/** Format: int32 */
|
|
4746
|
+
timeout_ms?: number;
|
|
4747
|
+
/** @enum {string} */
|
|
4748
|
+
fail_behavior?: "fail_closed" | "fail_open";
|
|
4749
|
+
tools_allowlist?: string[];
|
|
4750
|
+
allow_mutation?: boolean;
|
|
4751
|
+
rotate_secret?: boolean;
|
|
4752
|
+
};
|
|
4753
|
+
ToolHookEvent: {
|
|
4754
|
+
/** Format: uuid */
|
|
4755
|
+
id?: string;
|
|
4756
|
+
/** Format: uuid */
|
|
4757
|
+
hook_config_id?: string;
|
|
4758
|
+
request_id?: string;
|
|
4759
|
+
tool_call_id?: string;
|
|
4760
|
+
/** @enum {string} */
|
|
4761
|
+
status?: "success" | "blocked" | "timeout" | "error";
|
|
4762
|
+
/** Format: int32 */
|
|
4763
|
+
response_status?: number;
|
|
4764
|
+
response_body?: string;
|
|
4765
|
+
/** Format: int32 */
|
|
4766
|
+
latency_ms?: number;
|
|
4767
|
+
error?: string;
|
|
4768
|
+
/** Format: date-time */
|
|
4769
|
+
created_at?: string;
|
|
4770
|
+
};
|
|
4771
|
+
ToolHookTestResult: {
|
|
4772
|
+
/** @enum {string} */
|
|
4773
|
+
status?: "success" | "blocked" | "timeout" | "error";
|
|
4774
|
+
/** Format: int32 */
|
|
4775
|
+
response_status?: number;
|
|
4776
|
+
response_body?: string;
|
|
4777
|
+
/** Format: int32 */
|
|
4778
|
+
latency_ms?: number;
|
|
4779
|
+
error?: string;
|
|
4780
|
+
};
|
|
4781
|
+
/** @description Request body for updating session metadata. Null values remove keys. */
|
|
4782
|
+
SessionUpdateRequest: {
|
|
4783
|
+
/** @description Metadata fields to set or remove */
|
|
4784
|
+
metadata: {
|
|
4785
|
+
[key: string]: unknown;
|
|
4786
|
+
};
|
|
4787
|
+
};
|
|
4195
4788
|
};
|
|
4196
4789
|
responses: never;
|
|
4197
4790
|
parameters: {
|
|
4198
4791
|
ProjectID: string;
|
|
4199
4792
|
WebhookID: string;
|
|
4793
|
+
ToolHookID: string;
|
|
4200
4794
|
};
|
|
4201
4795
|
requestBodies: never;
|
|
4202
4796
|
headers: never;
|
|
@@ -4224,6 +4818,26 @@ interface operations {
|
|
|
4224
4818
|
};
|
|
4225
4819
|
};
|
|
4226
4820
|
};
|
|
4821
|
+
getWorkflowV1Schema: {
|
|
4822
|
+
parameters: {
|
|
4823
|
+
query?: never;
|
|
4824
|
+
header?: never;
|
|
4825
|
+
path?: never;
|
|
4826
|
+
cookie?: never;
|
|
4827
|
+
};
|
|
4828
|
+
requestBody?: never;
|
|
4829
|
+
responses: {
|
|
4830
|
+
/** @description Schema document */
|
|
4831
|
+
200: {
|
|
4832
|
+
headers: {
|
|
4833
|
+
[name: string]: unknown;
|
|
4834
|
+
};
|
|
4835
|
+
content: {
|
|
4836
|
+
"application/schema+json": Record<string, never>;
|
|
4837
|
+
};
|
|
4838
|
+
};
|
|
4839
|
+
};
|
|
4840
|
+
};
|
|
4227
4841
|
getRunEventV0Schema: {
|
|
4228
4842
|
parameters: {
|
|
4229
4843
|
query?: never;
|
|
@@ -5523,6 +6137,110 @@ interface operations {
|
|
|
5523
6137
|
};
|
|
5524
6138
|
};
|
|
5525
6139
|
};
|
|
6140
|
+
getImage: {
|
|
6141
|
+
parameters: {
|
|
6142
|
+
query?: never;
|
|
6143
|
+
header?: never;
|
|
6144
|
+
path: {
|
|
6145
|
+
/** @description Image ID */
|
|
6146
|
+
image_id: string;
|
|
6147
|
+
};
|
|
6148
|
+
cookie?: never;
|
|
6149
|
+
};
|
|
6150
|
+
requestBody?: never;
|
|
6151
|
+
responses: {
|
|
6152
|
+
/** @description Image details */
|
|
6153
|
+
200: {
|
|
6154
|
+
headers: {
|
|
6155
|
+
[name: string]: unknown;
|
|
6156
|
+
};
|
|
6157
|
+
content: {
|
|
6158
|
+
"application/json": components["schemas"]["ImagePinResponse"];
|
|
6159
|
+
};
|
|
6160
|
+
};
|
|
6161
|
+
/** @description Image not found */
|
|
6162
|
+
404: {
|
|
6163
|
+
headers: {
|
|
6164
|
+
[name: string]: unknown;
|
|
6165
|
+
};
|
|
6166
|
+
content?: never;
|
|
6167
|
+
};
|
|
6168
|
+
};
|
|
6169
|
+
};
|
|
6170
|
+
pinImage: {
|
|
6171
|
+
parameters: {
|
|
6172
|
+
query?: never;
|
|
6173
|
+
header?: never;
|
|
6174
|
+
path: {
|
|
6175
|
+
/** @description Image ID */
|
|
6176
|
+
image_id: string;
|
|
6177
|
+
};
|
|
6178
|
+
cookie?: never;
|
|
6179
|
+
};
|
|
6180
|
+
requestBody?: never;
|
|
6181
|
+
responses: {
|
|
6182
|
+
/** @description Image pinned successfully */
|
|
6183
|
+
200: {
|
|
6184
|
+
headers: {
|
|
6185
|
+
[name: string]: unknown;
|
|
6186
|
+
};
|
|
6187
|
+
content: {
|
|
6188
|
+
"application/json": components["schemas"]["ImagePinResponse"];
|
|
6189
|
+
};
|
|
6190
|
+
};
|
|
6191
|
+
/** @description Quota exceeded */
|
|
6192
|
+
403: {
|
|
6193
|
+
headers: {
|
|
6194
|
+
[name: string]: unknown;
|
|
6195
|
+
};
|
|
6196
|
+
content?: never;
|
|
6197
|
+
};
|
|
6198
|
+
/** @description Image not found */
|
|
6199
|
+
404: {
|
|
6200
|
+
headers: {
|
|
6201
|
+
[name: string]: unknown;
|
|
6202
|
+
};
|
|
6203
|
+
content?: never;
|
|
6204
|
+
};
|
|
6205
|
+
/** @description Image has expired */
|
|
6206
|
+
410: {
|
|
6207
|
+
headers: {
|
|
6208
|
+
[name: string]: unknown;
|
|
6209
|
+
};
|
|
6210
|
+
content?: never;
|
|
6211
|
+
};
|
|
6212
|
+
};
|
|
6213
|
+
};
|
|
6214
|
+
unpinImage: {
|
|
6215
|
+
parameters: {
|
|
6216
|
+
query?: never;
|
|
6217
|
+
header?: never;
|
|
6218
|
+
path: {
|
|
6219
|
+
/** @description Image ID */
|
|
6220
|
+
image_id: string;
|
|
6221
|
+
};
|
|
6222
|
+
cookie?: never;
|
|
6223
|
+
};
|
|
6224
|
+
requestBody?: never;
|
|
6225
|
+
responses: {
|
|
6226
|
+
/** @description Image unpinned successfully */
|
|
6227
|
+
200: {
|
|
6228
|
+
headers: {
|
|
6229
|
+
[name: string]: unknown;
|
|
6230
|
+
};
|
|
6231
|
+
content: {
|
|
6232
|
+
"application/json": components["schemas"]["ImagePinResponse"];
|
|
6233
|
+
};
|
|
6234
|
+
};
|
|
6235
|
+
/** @description Image not found */
|
|
6236
|
+
404: {
|
|
6237
|
+
headers: {
|
|
6238
|
+
[name: string]: unknown;
|
|
6239
|
+
};
|
|
6240
|
+
content?: never;
|
|
6241
|
+
};
|
|
6242
|
+
};
|
|
6243
|
+
};
|
|
5526
6244
|
createRun: {
|
|
5527
6245
|
parameters: {
|
|
5528
6246
|
query?: never;
|
|
@@ -5750,85 +6468,401 @@ interface operations {
|
|
|
5750
6468
|
};
|
|
5751
6469
|
};
|
|
5752
6470
|
};
|
|
6471
|
+
updateSession: {
|
|
6472
|
+
parameters: {
|
|
6473
|
+
query?: never;
|
|
6474
|
+
header?: never;
|
|
6475
|
+
path: {
|
|
6476
|
+
session_id: string;
|
|
6477
|
+
};
|
|
6478
|
+
cookie?: never;
|
|
6479
|
+
};
|
|
6480
|
+
requestBody: {
|
|
6481
|
+
content: {
|
|
6482
|
+
"application/json": components["schemas"]["SessionUpdateRequest"];
|
|
6483
|
+
};
|
|
6484
|
+
};
|
|
6485
|
+
responses: {
|
|
6486
|
+
/** @description Session updated */
|
|
6487
|
+
200: {
|
|
6488
|
+
headers: {
|
|
6489
|
+
[name: string]: unknown;
|
|
6490
|
+
};
|
|
6491
|
+
content: {
|
|
6492
|
+
"application/json": components["schemas"]["SessionResponse"];
|
|
6493
|
+
};
|
|
6494
|
+
};
|
|
6495
|
+
/** @description Invalid request */
|
|
6496
|
+
400: {
|
|
6497
|
+
headers: {
|
|
6498
|
+
[name: string]: unknown;
|
|
6499
|
+
};
|
|
6500
|
+
content?: never;
|
|
6501
|
+
};
|
|
6502
|
+
/** @description API key required */
|
|
6503
|
+
401: {
|
|
6504
|
+
headers: {
|
|
6505
|
+
[name: string]: unknown;
|
|
6506
|
+
};
|
|
6507
|
+
content?: never;
|
|
6508
|
+
};
|
|
6509
|
+
/** @description Session not found */
|
|
6510
|
+
404: {
|
|
6511
|
+
headers: {
|
|
6512
|
+
[name: string]: unknown;
|
|
6513
|
+
};
|
|
6514
|
+
content?: never;
|
|
6515
|
+
};
|
|
6516
|
+
};
|
|
6517
|
+
};
|
|
6518
|
+
addSessionMessage: {
|
|
6519
|
+
parameters: {
|
|
6520
|
+
query?: never;
|
|
6521
|
+
header?: never;
|
|
6522
|
+
path: {
|
|
6523
|
+
session_id: string;
|
|
6524
|
+
};
|
|
6525
|
+
cookie?: never;
|
|
6526
|
+
};
|
|
6527
|
+
requestBody: {
|
|
6528
|
+
content: {
|
|
6529
|
+
"application/json": components["schemas"]["SessionMessageCreateRequest"];
|
|
6530
|
+
};
|
|
6531
|
+
};
|
|
6532
|
+
responses: {
|
|
6533
|
+
/** @description Message appended */
|
|
6534
|
+
201: {
|
|
6535
|
+
headers: {
|
|
6536
|
+
[name: string]: unknown;
|
|
6537
|
+
};
|
|
6538
|
+
content: {
|
|
6539
|
+
"application/json": components["schemas"]["SessionMessageResponse"];
|
|
6540
|
+
};
|
|
6541
|
+
};
|
|
6542
|
+
/** @description Invalid request */
|
|
6543
|
+
400: {
|
|
6544
|
+
headers: {
|
|
6545
|
+
[name: string]: unknown;
|
|
6546
|
+
};
|
|
6547
|
+
content?: never;
|
|
6548
|
+
};
|
|
6549
|
+
/** @description API key required */
|
|
6550
|
+
401: {
|
|
6551
|
+
headers: {
|
|
6552
|
+
[name: string]: unknown;
|
|
6553
|
+
};
|
|
6554
|
+
content?: never;
|
|
6555
|
+
};
|
|
6556
|
+
/** @description Session not found */
|
|
6557
|
+
404: {
|
|
6558
|
+
headers: {
|
|
6559
|
+
[name: string]: unknown;
|
|
6560
|
+
};
|
|
6561
|
+
content?: never;
|
|
6562
|
+
};
|
|
6563
|
+
};
|
|
6564
|
+
};
|
|
6565
|
+
listProjectToolHooks: {
|
|
6566
|
+
parameters: {
|
|
6567
|
+
query?: never;
|
|
6568
|
+
header?: never;
|
|
6569
|
+
path: {
|
|
6570
|
+
id: components["parameters"]["ProjectID"];
|
|
6571
|
+
};
|
|
6572
|
+
cookie?: never;
|
|
6573
|
+
};
|
|
6574
|
+
requestBody?: never;
|
|
6575
|
+
responses: {
|
|
6576
|
+
/** @description Tool hook list */
|
|
6577
|
+
200: {
|
|
6578
|
+
headers: {
|
|
6579
|
+
[name: string]: unknown;
|
|
6580
|
+
};
|
|
6581
|
+
content: {
|
|
6582
|
+
"application/json": {
|
|
6583
|
+
hooks?: components["schemas"]["ToolHookConfig"][];
|
|
6584
|
+
};
|
|
6585
|
+
};
|
|
6586
|
+
};
|
|
6587
|
+
};
|
|
6588
|
+
};
|
|
6589
|
+
createProjectToolHook: {
|
|
6590
|
+
parameters: {
|
|
6591
|
+
query?: never;
|
|
6592
|
+
header?: never;
|
|
6593
|
+
path: {
|
|
6594
|
+
id: components["parameters"]["ProjectID"];
|
|
6595
|
+
};
|
|
6596
|
+
cookie?: never;
|
|
6597
|
+
};
|
|
6598
|
+
requestBody: {
|
|
6599
|
+
content: {
|
|
6600
|
+
"application/json": components["schemas"]["ToolHookConfigInput"];
|
|
6601
|
+
};
|
|
6602
|
+
};
|
|
6603
|
+
responses: {
|
|
6604
|
+
/** @description Tool hook created */
|
|
6605
|
+
201: {
|
|
6606
|
+
headers: {
|
|
6607
|
+
[name: string]: unknown;
|
|
6608
|
+
};
|
|
6609
|
+
content: {
|
|
6610
|
+
"application/json": {
|
|
6611
|
+
hook?: components["schemas"]["ToolHookConfig"];
|
|
6612
|
+
signing_secret?: string;
|
|
6613
|
+
};
|
|
6614
|
+
};
|
|
6615
|
+
};
|
|
6616
|
+
};
|
|
6617
|
+
};
|
|
6618
|
+
getProjectToolHook: {
|
|
6619
|
+
parameters: {
|
|
6620
|
+
query?: never;
|
|
6621
|
+
header?: never;
|
|
6622
|
+
path: {
|
|
6623
|
+
id: components["parameters"]["ProjectID"];
|
|
6624
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
6625
|
+
};
|
|
6626
|
+
cookie?: never;
|
|
6627
|
+
};
|
|
6628
|
+
requestBody?: never;
|
|
6629
|
+
responses: {
|
|
6630
|
+
/** @description Tool hook details */
|
|
6631
|
+
200: {
|
|
6632
|
+
headers: {
|
|
6633
|
+
[name: string]: unknown;
|
|
6634
|
+
};
|
|
6635
|
+
content: {
|
|
6636
|
+
"application/json": {
|
|
6637
|
+
hook?: components["schemas"]["ToolHookConfig"];
|
|
6638
|
+
};
|
|
6639
|
+
};
|
|
6640
|
+
};
|
|
6641
|
+
};
|
|
6642
|
+
};
|
|
6643
|
+
updateProjectToolHook: {
|
|
6644
|
+
parameters: {
|
|
6645
|
+
query?: never;
|
|
6646
|
+
header?: never;
|
|
6647
|
+
path: {
|
|
6648
|
+
id: components["parameters"]["ProjectID"];
|
|
6649
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
6650
|
+
};
|
|
6651
|
+
cookie?: never;
|
|
6652
|
+
};
|
|
6653
|
+
requestBody: {
|
|
6654
|
+
content: {
|
|
6655
|
+
"application/json": components["schemas"]["ToolHookConfigUpdate"];
|
|
6656
|
+
};
|
|
6657
|
+
};
|
|
6658
|
+
responses: {
|
|
6659
|
+
/** @description Tool hook updated */
|
|
6660
|
+
200: {
|
|
6661
|
+
headers: {
|
|
6662
|
+
[name: string]: unknown;
|
|
6663
|
+
};
|
|
6664
|
+
content: {
|
|
6665
|
+
"application/json": {
|
|
6666
|
+
hook?: components["schemas"]["ToolHookConfig"];
|
|
6667
|
+
signing_secret?: string;
|
|
6668
|
+
};
|
|
6669
|
+
};
|
|
6670
|
+
};
|
|
6671
|
+
};
|
|
6672
|
+
};
|
|
6673
|
+
deleteProjectToolHook: {
|
|
6674
|
+
parameters: {
|
|
6675
|
+
query?: never;
|
|
6676
|
+
header?: never;
|
|
6677
|
+
path: {
|
|
6678
|
+
id: components["parameters"]["ProjectID"];
|
|
6679
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
6680
|
+
};
|
|
6681
|
+
cookie?: never;
|
|
6682
|
+
};
|
|
6683
|
+
requestBody?: never;
|
|
6684
|
+
responses: {
|
|
6685
|
+
/** @description Tool hook deleted */
|
|
6686
|
+
204: {
|
|
6687
|
+
headers: {
|
|
6688
|
+
[name: string]: unknown;
|
|
6689
|
+
};
|
|
6690
|
+
content?: never;
|
|
6691
|
+
};
|
|
6692
|
+
};
|
|
6693
|
+
};
|
|
6694
|
+
listProjectToolHookEvents: {
|
|
6695
|
+
parameters: {
|
|
6696
|
+
query?: {
|
|
6697
|
+
limit?: number;
|
|
6698
|
+
};
|
|
6699
|
+
header?: never;
|
|
6700
|
+
path: {
|
|
6701
|
+
id: components["parameters"]["ProjectID"];
|
|
6702
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
6703
|
+
};
|
|
6704
|
+
cookie?: never;
|
|
6705
|
+
};
|
|
6706
|
+
requestBody?: never;
|
|
6707
|
+
responses: {
|
|
6708
|
+
/** @description Tool hook events */
|
|
6709
|
+
200: {
|
|
6710
|
+
headers: {
|
|
6711
|
+
[name: string]: unknown;
|
|
6712
|
+
};
|
|
6713
|
+
content: {
|
|
6714
|
+
"application/json": {
|
|
6715
|
+
events?: components["schemas"]["ToolHookEvent"][];
|
|
6716
|
+
};
|
|
6717
|
+
};
|
|
6718
|
+
};
|
|
6719
|
+
};
|
|
6720
|
+
};
|
|
6721
|
+
testProjectToolHook: {
|
|
6722
|
+
parameters: {
|
|
6723
|
+
query?: never;
|
|
6724
|
+
header?: never;
|
|
6725
|
+
path: {
|
|
6726
|
+
id: components["parameters"]["ProjectID"];
|
|
6727
|
+
hook_id: components["parameters"]["ToolHookID"];
|
|
6728
|
+
};
|
|
6729
|
+
cookie?: never;
|
|
6730
|
+
};
|
|
6731
|
+
requestBody?: never;
|
|
6732
|
+
responses: {
|
|
6733
|
+
/** @description Tool hook test result */
|
|
6734
|
+
200: {
|
|
6735
|
+
headers: {
|
|
6736
|
+
[name: string]: unknown;
|
|
6737
|
+
};
|
|
6738
|
+
content: {
|
|
6739
|
+
"application/json": components["schemas"]["ToolHookTestResult"];
|
|
6740
|
+
};
|
|
6741
|
+
};
|
|
6742
|
+
/** @description Tool hook test failed */
|
|
6743
|
+
502: {
|
|
6744
|
+
headers: {
|
|
6745
|
+
[name: string]: unknown;
|
|
6746
|
+
};
|
|
6747
|
+
content?: never;
|
|
6748
|
+
};
|
|
6749
|
+
};
|
|
6750
|
+
};
|
|
6751
|
+
clearSession: {
|
|
6752
|
+
parameters: {
|
|
6753
|
+
query?: never;
|
|
6754
|
+
header?: never;
|
|
6755
|
+
path: {
|
|
6756
|
+
session_id: string;
|
|
6757
|
+
};
|
|
6758
|
+
cookie?: never;
|
|
6759
|
+
};
|
|
6760
|
+
requestBody?: never;
|
|
6761
|
+
responses: {
|
|
6762
|
+
/** @description Session cleared */
|
|
6763
|
+
200: {
|
|
6764
|
+
headers: {
|
|
6765
|
+
[name: string]: unknown;
|
|
6766
|
+
};
|
|
6767
|
+
content: {
|
|
6768
|
+
"application/json": components["schemas"]["SessionResponse"];
|
|
6769
|
+
};
|
|
6770
|
+
};
|
|
6771
|
+
/** @description API key required */
|
|
6772
|
+
401: {
|
|
6773
|
+
headers: {
|
|
6774
|
+
[name: string]: unknown;
|
|
6775
|
+
};
|
|
6776
|
+
content?: never;
|
|
6777
|
+
};
|
|
6778
|
+
/** @description Session not found */
|
|
6779
|
+
404: {
|
|
6780
|
+
headers: {
|
|
6781
|
+
[name: string]: unknown;
|
|
6782
|
+
};
|
|
6783
|
+
content?: never;
|
|
6784
|
+
};
|
|
6785
|
+
};
|
|
6786
|
+
};
|
|
6787
|
+
}
|
|
6788
|
+
|
|
6789
|
+
/**
|
|
6790
|
+
* Customer represents a customer in a ModelRelay project.
|
|
6791
|
+
*/
|
|
6792
|
+
interface Customer {
|
|
6793
|
+
id: string;
|
|
6794
|
+
project_id: string;
|
|
6795
|
+
external_id: string;
|
|
6796
|
+
email: string;
|
|
6797
|
+
metadata?: CustomerMetadata;
|
|
6798
|
+
created_at: string;
|
|
6799
|
+
updated_at: string;
|
|
6800
|
+
}
|
|
6801
|
+
/**
|
|
6802
|
+
* Subscription represents billing state for a customer.
|
|
6803
|
+
*/
|
|
6804
|
+
interface Subscription {
|
|
6805
|
+
id: string;
|
|
6806
|
+
project_id: string;
|
|
6807
|
+
customer_id: string;
|
|
6808
|
+
tier_id: string;
|
|
6809
|
+
tier_code?: TierCode;
|
|
6810
|
+
billing_provider?: BillingProvider;
|
|
6811
|
+
billing_customer_id?: string;
|
|
6812
|
+
billing_subscription_id?: string;
|
|
6813
|
+
subscription_status?: SubscriptionStatusKind;
|
|
6814
|
+
current_period_start?: string;
|
|
6815
|
+
current_period_end?: string;
|
|
6816
|
+
created_at: string;
|
|
6817
|
+
updated_at: string;
|
|
6818
|
+
}
|
|
6819
|
+
/**
|
|
6820
|
+
* CustomerWithSubscription bundles customer identity with optional subscription state.
|
|
6821
|
+
*/
|
|
6822
|
+
interface CustomerWithSubscription {
|
|
6823
|
+
customer: Customer;
|
|
6824
|
+
subscription?: Subscription;
|
|
6825
|
+
}
|
|
6826
|
+
/**
|
|
6827
|
+
* Request to create a customer.
|
|
6828
|
+
*/
|
|
6829
|
+
interface CustomerCreateRequest {
|
|
6830
|
+
external_id: string;
|
|
6831
|
+
email: string;
|
|
6832
|
+
metadata?: CustomerMetadata;
|
|
6833
|
+
}
|
|
6834
|
+
/**
|
|
6835
|
+
* Request to upsert a customer by external_id.
|
|
6836
|
+
*/
|
|
6837
|
+
interface CustomerUpsertRequest {
|
|
6838
|
+
external_id: string;
|
|
6839
|
+
email: string;
|
|
6840
|
+
metadata?: CustomerMetadata;
|
|
6841
|
+
}
|
|
6842
|
+
/**
|
|
6843
|
+
* Request to link a customer identity to a customer by email.
|
|
6844
|
+
* Used when a customer subscribes via Stripe Checkout (email only) and later authenticates to the app.
|
|
6845
|
+
*/
|
|
6846
|
+
interface CustomerClaimRequest {
|
|
6847
|
+
email: string;
|
|
6848
|
+
provider: string;
|
|
6849
|
+
subject: string;
|
|
6850
|
+
}
|
|
6851
|
+
/**
|
|
6852
|
+
* Request to create a checkout session for a customer subscription.
|
|
6853
|
+
*/
|
|
6854
|
+
interface CustomerSubscribeRequest {
|
|
6855
|
+
tier_id: string;
|
|
6856
|
+
success_url: string;
|
|
6857
|
+
cancel_url: string;
|
|
6858
|
+
}
|
|
6859
|
+
/**
|
|
6860
|
+
* Checkout session response.
|
|
6861
|
+
*/
|
|
6862
|
+
interface CheckoutSession {
|
|
6863
|
+
session_id: string;
|
|
6864
|
+
url: string;
|
|
5753
6865
|
}
|
|
5754
|
-
|
|
5755
|
-
/**
|
|
5756
|
-
* Customer represents a customer in a ModelRelay project.
|
|
5757
|
-
*/
|
|
5758
|
-
interface Customer {
|
|
5759
|
-
id: string;
|
|
5760
|
-
project_id: string;
|
|
5761
|
-
external_id: string;
|
|
5762
|
-
email: string;
|
|
5763
|
-
metadata?: CustomerMetadata;
|
|
5764
|
-
created_at: string;
|
|
5765
|
-
updated_at: string;
|
|
5766
|
-
}
|
|
5767
|
-
/**
|
|
5768
|
-
* Subscription represents billing state for a customer.
|
|
5769
|
-
*/
|
|
5770
|
-
interface Subscription {
|
|
5771
|
-
id: string;
|
|
5772
|
-
project_id: string;
|
|
5773
|
-
customer_id: string;
|
|
5774
|
-
tier_id: string;
|
|
5775
|
-
tier_code?: TierCode;
|
|
5776
|
-
billing_provider?: BillingProvider;
|
|
5777
|
-
billing_customer_id?: string;
|
|
5778
|
-
billing_subscription_id?: string;
|
|
5779
|
-
subscription_status?: SubscriptionStatusKind;
|
|
5780
|
-
current_period_start?: string;
|
|
5781
|
-
current_period_end?: string;
|
|
5782
|
-
created_at: string;
|
|
5783
|
-
updated_at: string;
|
|
5784
|
-
}
|
|
5785
|
-
/**
|
|
5786
|
-
* CustomerWithSubscription bundles customer identity with optional subscription state.
|
|
5787
|
-
*/
|
|
5788
|
-
interface CustomerWithSubscription {
|
|
5789
|
-
customer: Customer;
|
|
5790
|
-
subscription?: Subscription;
|
|
5791
|
-
}
|
|
5792
|
-
/**
|
|
5793
|
-
* Request to create a customer.
|
|
5794
|
-
*/
|
|
5795
|
-
interface CustomerCreateRequest {
|
|
5796
|
-
external_id: string;
|
|
5797
|
-
email: string;
|
|
5798
|
-
metadata?: CustomerMetadata;
|
|
5799
|
-
}
|
|
5800
|
-
/**
|
|
5801
|
-
* Request to upsert a customer by external_id.
|
|
5802
|
-
*/
|
|
5803
|
-
interface CustomerUpsertRequest {
|
|
5804
|
-
external_id: string;
|
|
5805
|
-
email: string;
|
|
5806
|
-
metadata?: CustomerMetadata;
|
|
5807
|
-
}
|
|
5808
|
-
/**
|
|
5809
|
-
* Request to link a customer identity to a customer by email.
|
|
5810
|
-
* Used when a customer subscribes via Stripe Checkout (email only) and later authenticates to the app.
|
|
5811
|
-
*/
|
|
5812
|
-
interface CustomerClaimRequest {
|
|
5813
|
-
email: string;
|
|
5814
|
-
provider: string;
|
|
5815
|
-
subject: string;
|
|
5816
|
-
}
|
|
5817
|
-
/**
|
|
5818
|
-
* Request to create a checkout session for a customer subscription.
|
|
5819
|
-
*/
|
|
5820
|
-
interface CustomerSubscribeRequest {
|
|
5821
|
-
tier_id: string;
|
|
5822
|
-
success_url: string;
|
|
5823
|
-
cancel_url: string;
|
|
5824
|
-
}
|
|
5825
|
-
/**
|
|
5826
|
-
* Checkout session response.
|
|
5827
|
-
*/
|
|
5828
|
-
interface CheckoutSession {
|
|
5829
|
-
session_id: string;
|
|
5830
|
-
url: string;
|
|
5831
|
-
}
|
|
5832
6866
|
interface CustomersClientConfig {
|
|
5833
6867
|
apiKey?: ApiKey;
|
|
5834
6868
|
accessToken?: string;
|
|
@@ -5920,7 +6954,8 @@ declare class CustomersClient {
|
|
|
5920
6954
|
*/
|
|
5921
6955
|
type PriceInterval = "month" | "year";
|
|
5922
6956
|
/**
|
|
5923
|
-
* TierModel represents a model with
|
|
6957
|
+
* TierModel represents a model with cost information in a tier.
|
|
6958
|
+
* Customer prices are derived from model costs: price = cost * (1 + platformFeePercent/100).
|
|
5924
6959
|
*/
|
|
5925
6960
|
interface TierModel {
|
|
5926
6961
|
id: string;
|
|
@@ -5932,8 +6967,10 @@ interface TierModel {
|
|
|
5932
6967
|
context_window: number;
|
|
5933
6968
|
max_output_tokens: number;
|
|
5934
6969
|
deprecated: boolean;
|
|
5935
|
-
|
|
5936
|
-
|
|
6970
|
+
/** Provider input cost in cents per million tokens */
|
|
6971
|
+
model_input_cost_cents: number;
|
|
6972
|
+
/** Provider output cost in cents per million tokens */
|
|
6973
|
+
model_output_cost_cents: number;
|
|
5937
6974
|
is_default: boolean;
|
|
5938
6975
|
created_at: string;
|
|
5939
6976
|
updated_at: string;
|
|
@@ -6055,6 +7092,10 @@ type ImageUsage = components["schemas"]["ImageUsage"];
|
|
|
6055
7092
|
* - "b64_json": Returns base64-encoded data, for testing/development
|
|
6056
7093
|
*/
|
|
6057
7094
|
type ImageResponseFormat = components["schemas"]["ImageResponseFormat"];
|
|
7095
|
+
/**
|
|
7096
|
+
* Response from pin/unpin operations.
|
|
7097
|
+
*/
|
|
7098
|
+
type ImagePinResponse = components["schemas"]["ImagePinResponse"];
|
|
6058
7099
|
/**
|
|
6059
7100
|
* ImagesClient provides methods for generating images using AI models.
|
|
6060
7101
|
*
|
|
@@ -6091,6 +7132,36 @@ declare class ImagesClient {
|
|
|
6091
7132
|
* @throws {Error} If prompt is empty
|
|
6092
7133
|
*/
|
|
6093
7134
|
generate(request: ImageRequest): Promise<ImageResponse>;
|
|
7135
|
+
/**
|
|
7136
|
+
* Get information about a specific image.
|
|
7137
|
+
*
|
|
7138
|
+
* Returns the image's pinned status, expiration time, and URL.
|
|
7139
|
+
*
|
|
7140
|
+
* @param imageId - The image ID to retrieve
|
|
7141
|
+
* @returns Image details including pinned status and URL
|
|
7142
|
+
* @throws {Error} If imageId is empty
|
|
7143
|
+
*/
|
|
7144
|
+
get(imageId: string): Promise<ImagePinResponse>;
|
|
7145
|
+
/**
|
|
7146
|
+
* Pin an image to prevent it from expiring.
|
|
7147
|
+
*
|
|
7148
|
+
* Pinned images remain accessible permanently (subject to tier limits).
|
|
7149
|
+
*
|
|
7150
|
+
* @param imageId - The image ID to pin
|
|
7151
|
+
* @returns Updated image state including permanent URL
|
|
7152
|
+
* @throws {Error} If imageId is empty
|
|
7153
|
+
*/
|
|
7154
|
+
pin(imageId: string): Promise<ImagePinResponse>;
|
|
7155
|
+
/**
|
|
7156
|
+
* Unpin an image, allowing it to expire.
|
|
7157
|
+
*
|
|
7158
|
+
* The image will expire after the default ephemeral period (7 days).
|
|
7159
|
+
*
|
|
7160
|
+
* @param imageId - The image ID to unpin
|
|
7161
|
+
* @returns Updated image state including new expiration time
|
|
7162
|
+
* @throws {Error} If imageId is empty
|
|
7163
|
+
*/
|
|
7164
|
+
unpin(imageId: string): Promise<ImagePinResponse>;
|
|
6094
7165
|
}
|
|
6095
7166
|
|
|
6096
7167
|
/**
|
|
@@ -6131,7 +7202,7 @@ interface SessionMessage extends InputItem {
|
|
|
6131
7202
|
/** When this message was added to the session. */
|
|
6132
7203
|
readonly createdAt: Date;
|
|
6133
7204
|
/** The run ID that produced this message (for assistant messages). */
|
|
6134
|
-
readonly runId?: RunId;
|
|
7205
|
+
readonly runId?: RunId$1;
|
|
6135
7206
|
}
|
|
6136
7207
|
/**
|
|
6137
7208
|
* Artifacts produced during a session (files, code, etc.).
|
|
@@ -6145,6 +7216,14 @@ interface SessionRunOptions {
|
|
|
6145
7216
|
model?: ModelId;
|
|
6146
7217
|
/** Override the provider for this run. */
|
|
6147
7218
|
provider?: ProviderId$1;
|
|
7219
|
+
/** How to manage history when it approaches the model context window. */
|
|
7220
|
+
contextManagement?: SessionContextManagement;
|
|
7221
|
+
/** Max tokens allowed for history (derived from model if not set). */
|
|
7222
|
+
maxHistoryTokens?: number;
|
|
7223
|
+
/** Tokens to reserve for output (defaults to model metadata when available). */
|
|
7224
|
+
reserveOutputTokens?: number;
|
|
7225
|
+
/** Called when history is truncated to fit the context window. */
|
|
7226
|
+
onContextTruncate?: (info: SessionContextTruncateInfo) => void;
|
|
6148
7227
|
/** Additional tools for this run (merged with session defaults). */
|
|
6149
7228
|
tools?: Tool[];
|
|
6150
7229
|
/** Maximum number of LLM turns (for tool loops). */
|
|
@@ -6158,6 +7237,16 @@ interface SessionRunOptions {
|
|
|
6158
7237
|
* Status of a session run.
|
|
6159
7238
|
*/
|
|
6160
7239
|
type SessionRunStatus = "complete" | "waiting_for_tools" | "error" | "canceled";
|
|
7240
|
+
/** Context management strategy for session history. */
|
|
7241
|
+
type SessionContextManagement = "none" | "truncate" | "summarize";
|
|
7242
|
+
/** Metadata for context truncation callbacks. */
|
|
7243
|
+
interface SessionContextTruncateInfo {
|
|
7244
|
+
readonly model: ModelId;
|
|
7245
|
+
readonly originalMessages: number;
|
|
7246
|
+
readonly keptMessages: number;
|
|
7247
|
+
readonly maxHistoryTokens: number;
|
|
7248
|
+
readonly reservedOutputTokens?: number;
|
|
7249
|
+
}
|
|
6161
7250
|
/**
|
|
6162
7251
|
* Pending tool call that needs client-side execution.
|
|
6163
7252
|
*/
|
|
@@ -6189,7 +7278,7 @@ interface SessionRunResult {
|
|
|
6189
7278
|
/** Error message (when status is 'error'). */
|
|
6190
7279
|
readonly error?: string;
|
|
6191
7280
|
/** The run ID from the server. */
|
|
6192
|
-
readonly runId: RunId;
|
|
7281
|
+
readonly runId: RunId$1;
|
|
6193
7282
|
/** Token and call usage. */
|
|
6194
7283
|
readonly usage: SessionUsageSummary;
|
|
6195
7284
|
/** All events from this run. */
|
|
@@ -6342,90 +7431,28 @@ interface SessionStore {
|
|
|
6342
7431
|
/** Close the store and release resources. */
|
|
6343
7432
|
close(): Promise<void>;
|
|
6344
7433
|
}
|
|
6345
|
-
|
|
6346
|
-
/**
|
|
6347
|
-
* Client-managed session implementation.
|
|
6348
|
-
*
|
|
6349
|
-
* LocalSession keeps conversation history on the client side with optional
|
|
6350
|
-
* persistence to memory, file, or SQLite. Use for:
|
|
6351
|
-
* - Local AI coding agents (Claude Code, Cursor)
|
|
6352
|
-
* - Privacy-sensitive workflows (history never leaves device)
|
|
6353
|
-
* - Offline-capable agents
|
|
6354
|
-
*
|
|
6355
|
-
* @module
|
|
6356
|
-
*/
|
|
6357
|
-
|
|
6358
7434
|
/**
|
|
6359
|
-
*
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
*
|
|
6371
|
-
* const result1 = await session.run("Create a file called hello.txt with 'Hello World'");
|
|
6372
|
-
* const result2 = await session.run("Now read that file back to me");
|
|
6373
|
-
* ```
|
|
6374
|
-
*/
|
|
6375
|
-
declare class LocalSession implements Session {
|
|
6376
|
-
readonly type: "local";
|
|
6377
|
-
readonly id: SessionId;
|
|
6378
|
-
private readonly client;
|
|
6379
|
-
private readonly store;
|
|
6380
|
-
private readonly toolRegistry?;
|
|
6381
|
-
private readonly defaultModel?;
|
|
6382
|
-
private readonly defaultProvider?;
|
|
6383
|
-
private readonly defaultTools?;
|
|
6384
|
-
private readonly metadata;
|
|
6385
|
-
private messages;
|
|
6386
|
-
private artifacts;
|
|
6387
|
-
private nextSeq;
|
|
6388
|
-
private createdAt;
|
|
6389
|
-
private updatedAt;
|
|
6390
|
-
private currentRunId?;
|
|
6391
|
-
private currentNodeId?;
|
|
6392
|
-
private currentWaiting?;
|
|
6393
|
-
private currentEvents;
|
|
6394
|
-
private currentUsage;
|
|
6395
|
-
private constructor();
|
|
6396
|
-
/**
|
|
6397
|
-
* Create a new local session.
|
|
6398
|
-
*
|
|
6399
|
-
* @param client - ModelRelay client
|
|
6400
|
-
* @param options - Session configuration
|
|
6401
|
-
* @returns A new LocalSession instance
|
|
6402
|
-
*/
|
|
6403
|
-
static create(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
|
|
6404
|
-
/**
|
|
6405
|
-
* Resume an existing session from storage.
|
|
6406
|
-
*
|
|
6407
|
-
* @param client - ModelRelay client
|
|
6408
|
-
* @param sessionId - ID of the session to resume
|
|
6409
|
-
* @param options - Session configuration (must match original persistence settings)
|
|
6410
|
-
* @returns The resumed LocalSession, or null if not found
|
|
6411
|
-
*/
|
|
6412
|
-
static resume(client: ModelRelay, sessionId: string | SessionId, options?: LocalSessionOptions): Promise<LocalSession | null>;
|
|
6413
|
-
get history(): readonly SessionMessage[];
|
|
6414
|
-
run(prompt: string, options?: SessionRunOptions): Promise<SessionRunResult>;
|
|
6415
|
-
submitToolResults(results: ToolExecutionResult[]): Promise<SessionRunResult>;
|
|
6416
|
-
getArtifacts(): SessionArtifacts;
|
|
6417
|
-
close(): Promise<void>;
|
|
6418
|
-
private addMessage;
|
|
6419
|
-
private buildInput;
|
|
6420
|
-
private processRunEvents;
|
|
6421
|
-
private executeTools;
|
|
6422
|
-
private persist;
|
|
7435
|
+
* Options for syncing a local session to a remote session.
|
|
7436
|
+
*/
|
|
7437
|
+
interface SessionSyncOptions {
|
|
7438
|
+
/**
|
|
7439
|
+
* Called for each message synced. Useful for progress indicators.
|
|
7440
|
+
* @param synced - Number of messages synced so far
|
|
7441
|
+
* @param total - Total messages to sync
|
|
7442
|
+
*/
|
|
7443
|
+
onProgress?: (synced: number, total: number) => void;
|
|
7444
|
+
/** Abort signal for cancellation. */
|
|
7445
|
+
signal?: AbortSignal;
|
|
6423
7446
|
}
|
|
6424
7447
|
/**
|
|
6425
|
-
*
|
|
6426
|
-
* Convenience function for LocalSession.create().
|
|
7448
|
+
* Result of syncing a local session to a remote session.
|
|
6427
7449
|
*/
|
|
6428
|
-
|
|
7450
|
+
interface SessionSyncResult {
|
|
7451
|
+
/** Number of messages synced. */
|
|
7452
|
+
readonly messagesSynced: number;
|
|
7453
|
+
/** The remote session ID messages were synced to. */
|
|
7454
|
+
readonly remoteSessionId: SessionId;
|
|
7455
|
+
}
|
|
6429
7456
|
|
|
6430
7457
|
/**
|
|
6431
7458
|
* Server-managed session implementation.
|
|
@@ -6472,11 +7499,13 @@ declare class RemoteSession implements Session {
|
|
|
6472
7499
|
private readonly defaultTools?;
|
|
6473
7500
|
private metadata;
|
|
6474
7501
|
private endUserId?;
|
|
7502
|
+
private readonly resolveModelContext;
|
|
6475
7503
|
private messages;
|
|
6476
7504
|
private artifacts;
|
|
6477
7505
|
private nextSeq;
|
|
6478
7506
|
private createdAt;
|
|
6479
7507
|
private updatedAt;
|
|
7508
|
+
private pendingMessages;
|
|
6480
7509
|
private currentRunId?;
|
|
6481
7510
|
private currentNodeId?;
|
|
6482
7511
|
private currentWaiting?;
|
|
@@ -6551,7 +7580,124 @@ declare class RemoteSession implements Session {
|
|
|
6551
7580
|
private resetRunState;
|
|
6552
7581
|
private processRunEvents;
|
|
6553
7582
|
private executeToolsLocally;
|
|
7583
|
+
private flushPendingMessages;
|
|
7584
|
+
private appendMessageToServer;
|
|
7585
|
+
private extractOutputText;
|
|
7586
|
+
private extractTextFromOutputValue;
|
|
7587
|
+
private extractTextFromOutputItems;
|
|
7588
|
+
private extractTextFromContentParts;
|
|
7589
|
+
}
|
|
7590
|
+
|
|
7591
|
+
/**
|
|
7592
|
+
* Client-managed session implementation.
|
|
7593
|
+
*
|
|
7594
|
+
* LocalSession keeps conversation history on the client side with optional
|
|
7595
|
+
* persistence to memory, file, or SQLite. Use for:
|
|
7596
|
+
* - Local AI coding agents (Claude Code, Cursor)
|
|
7597
|
+
* - Privacy-sensitive workflows (history never leaves device)
|
|
7598
|
+
* - Offline-capable agents
|
|
7599
|
+
*
|
|
7600
|
+
* @module
|
|
7601
|
+
*/
|
|
7602
|
+
|
|
7603
|
+
/**
|
|
7604
|
+
* Client-managed session with optional persistence.
|
|
7605
|
+
*
|
|
7606
|
+
* @example
|
|
7607
|
+
* ```typescript
|
|
7608
|
+
* import { ModelRelay, LocalSession } from "modelrelay";
|
|
7609
|
+
*
|
|
7610
|
+
* const client = ModelRelay.fromSecretKey(process.env.MODELRELAY_SECRET_KEY!);
|
|
7611
|
+
* const session = LocalSession.create(client, {
|
|
7612
|
+
* toolRegistry: createLocalFSTools({ root: process.cwd() }),
|
|
7613
|
+
* persistence: "sqlite",
|
|
7614
|
+
* });
|
|
7615
|
+
*
|
|
7616
|
+
* const result1 = await session.run("Create a file called hello.txt with 'Hello World'");
|
|
7617
|
+
* const result2 = await session.run("Now read that file back to me");
|
|
7618
|
+
* ```
|
|
7619
|
+
*/
|
|
7620
|
+
declare class LocalSession implements Session {
|
|
7621
|
+
readonly type: "local";
|
|
7622
|
+
readonly id: SessionId;
|
|
7623
|
+
private readonly client;
|
|
7624
|
+
private readonly store;
|
|
7625
|
+
private readonly toolRegistry?;
|
|
7626
|
+
private readonly defaultModel?;
|
|
7627
|
+
private readonly defaultProvider?;
|
|
7628
|
+
private readonly defaultTools?;
|
|
7629
|
+
private readonly metadata;
|
|
7630
|
+
private readonly resolveModelContext;
|
|
7631
|
+
private messages;
|
|
7632
|
+
private artifacts;
|
|
7633
|
+
private nextSeq;
|
|
7634
|
+
private createdAt;
|
|
7635
|
+
private updatedAt;
|
|
7636
|
+
private currentRunId?;
|
|
7637
|
+
private currentNodeId?;
|
|
7638
|
+
private currentWaiting?;
|
|
7639
|
+
private currentEvents;
|
|
7640
|
+
private currentUsage;
|
|
7641
|
+
private constructor();
|
|
7642
|
+
/**
|
|
7643
|
+
* Create a new local session.
|
|
7644
|
+
*
|
|
7645
|
+
* @param client - ModelRelay client
|
|
7646
|
+
* @param options - Session configuration
|
|
7647
|
+
* @returns A new LocalSession instance
|
|
7648
|
+
*/
|
|
7649
|
+
static create(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
|
|
7650
|
+
/**
|
|
7651
|
+
* Resume an existing session from storage.
|
|
7652
|
+
*
|
|
7653
|
+
* @param client - ModelRelay client
|
|
7654
|
+
* @param sessionId - ID of the session to resume
|
|
7655
|
+
* @param options - Session configuration (must match original persistence settings)
|
|
7656
|
+
* @returns The resumed LocalSession, or null if not found
|
|
7657
|
+
*/
|
|
7658
|
+
static resume(client: ModelRelay, sessionId: string | SessionId, options?: LocalSessionOptions): Promise<LocalSession | null>;
|
|
7659
|
+
get history(): readonly SessionMessage[];
|
|
7660
|
+
run(prompt: string, options?: SessionRunOptions): Promise<SessionRunResult>;
|
|
7661
|
+
submitToolResults(results: ToolExecutionResult[]): Promise<SessionRunResult>;
|
|
7662
|
+
getArtifacts(): SessionArtifacts;
|
|
7663
|
+
close(): Promise<void>;
|
|
7664
|
+
/**
|
|
7665
|
+
* Sync this local session's messages to a remote session.
|
|
7666
|
+
*
|
|
7667
|
+
* This uploads all local messages to the remote session, enabling
|
|
7668
|
+
* cross-device access and server-side backup. Messages are synced
|
|
7669
|
+
* in order and the remote session's history will contain all local
|
|
7670
|
+
* messages after sync completes.
|
|
7671
|
+
*
|
|
7672
|
+
* @param remoteSession - The remote session to sync to
|
|
7673
|
+
* @param options - Optional sync configuration
|
|
7674
|
+
* @returns Sync result with message count
|
|
7675
|
+
*
|
|
7676
|
+
* @example
|
|
7677
|
+
* ```typescript
|
|
7678
|
+
* // Create local session and work offline
|
|
7679
|
+
* const local = LocalSession.create(client, { ... });
|
|
7680
|
+
* await local.run("Implement the feature");
|
|
7681
|
+
*
|
|
7682
|
+
* // Later, sync to remote for backup/sharing
|
|
7683
|
+
* const remote = await RemoteSession.create(client);
|
|
7684
|
+
* const result = await local.syncTo(remote, {
|
|
7685
|
+
* onProgress: (synced, total) => console.log(`${synced}/${total}`),
|
|
7686
|
+
* });
|
|
7687
|
+
* ```
|
|
7688
|
+
*/
|
|
7689
|
+
syncTo(remoteSession: RemoteSession, options?: SessionSyncOptions): Promise<SessionSyncResult>;
|
|
7690
|
+
private addMessage;
|
|
7691
|
+
private buildInput;
|
|
7692
|
+
private processRunEvents;
|
|
7693
|
+
private executeTools;
|
|
7694
|
+
private persist;
|
|
6554
7695
|
}
|
|
7696
|
+
/**
|
|
7697
|
+
* Create a new local session.
|
|
7698
|
+
* Convenience function for LocalSession.create().
|
|
7699
|
+
*/
|
|
7700
|
+
declare function createLocalSession(client: ModelRelay, options?: LocalSessionOptions): LocalSession;
|
|
6555
7701
|
|
|
6556
7702
|
/**
|
|
6557
7703
|
* SessionsClient - Entry point for session management.
|
|
@@ -6800,6 +7946,21 @@ interface OAuthDeviceTokenPollRequest {
|
|
|
6800
7946
|
fetch?: typeof fetch;
|
|
6801
7947
|
signal?: AbortSignal;
|
|
6802
7948
|
}
|
|
7949
|
+
type PollUntilResult<T> = {
|
|
7950
|
+
done: true;
|
|
7951
|
+
value: T;
|
|
7952
|
+
} | {
|
|
7953
|
+
done: false;
|
|
7954
|
+
retryAfterMs?: number;
|
|
7955
|
+
};
|
|
7956
|
+
interface PollUntilOptions<T> {
|
|
7957
|
+
intervalMs: number;
|
|
7958
|
+
deadline?: Date;
|
|
7959
|
+
signal?: AbortSignal;
|
|
7960
|
+
poll: (attempt: number) => Promise<PollUntilResult<T>>;
|
|
7961
|
+
onTimeout?: () => Error;
|
|
7962
|
+
}
|
|
7963
|
+
declare function pollUntil<T>(opts: PollUntilOptions<T>): Promise<T>;
|
|
6803
7964
|
declare function startOAuthDeviceAuthorization(req: OAuthDeviceAuthorizationRequest): Promise<OAuthDeviceAuthorization>;
|
|
6804
7965
|
declare function pollOAuthDeviceToken(req: OAuthDeviceTokenPollRequest): Promise<OAuthDeviceToken>;
|
|
6805
7966
|
declare function runOAuthDeviceFlowForIDToken(cfg: {
|
|
@@ -6816,52 +7977,784 @@ declare function runOAuthDeviceFlowForIDToken(cfg: {
|
|
|
6816
7977
|
signal?: AbortSignal;
|
|
6817
7978
|
}): Promise<string>;
|
|
6818
7979
|
|
|
7980
|
+
/** JSON pointer to extract text content from an LLM response output. */
|
|
7981
|
+
declare const LLM_TEXT_OUTPUT: string;
|
|
7982
|
+
/** JSON pointer to inject text into the user message of an LLM request.
|
|
7983
|
+
* The pointer is relative to the request object (not the full node input). */
|
|
7984
|
+
declare const LLM_USER_MESSAGE_TEXT: string;
|
|
6819
7985
|
type TransformJSONValueV0 = {
|
|
6820
|
-
from: NodeId;
|
|
7986
|
+
from: NodeId$1;
|
|
6821
7987
|
pointer?: string;
|
|
6822
7988
|
};
|
|
6823
|
-
declare function transformJSONValue(from: NodeId, pointer?: string): TransformJSONValueV0;
|
|
7989
|
+
declare function transformJSONValue(from: NodeId$1, pointer?: string): TransformJSONValueV0;
|
|
6824
7990
|
declare function transformJSONObject(object: Record<string, TransformJSONValueV0>): {
|
|
6825
7991
|
object: Record<string, TransformJSONValueV0>;
|
|
6826
7992
|
};
|
|
6827
|
-
declare function transformJSONMerge(merge: ReadonlyArray<TransformJSONValueV0>): {
|
|
6828
|
-
merge: Array<TransformJSONValueV0>;
|
|
7993
|
+
declare function transformJSONMerge(merge: ReadonlyArray<TransformJSONValueV0>): {
|
|
7994
|
+
merge: Array<TransformJSONValueV0>;
|
|
7995
|
+
};
|
|
7996
|
+
type TransformJSONValueV1 = TransformJSONValueV0;
|
|
7997
|
+
declare const transformJSONValueV1: typeof transformJSONValue;
|
|
7998
|
+
declare const transformJSONObjectV1: typeof transformJSONObject;
|
|
7999
|
+
declare const transformJSONMergeV1: typeof transformJSONMerge;
|
|
8000
|
+
/**
|
|
8001
|
+
* Error thrown when a binding targets a non-existent path in the request.
|
|
8002
|
+
*/
|
|
8003
|
+
declare class BindingTargetError extends Error {
|
|
8004
|
+
readonly nodeId: NodeId$1;
|
|
8005
|
+
readonly bindingIndex: number;
|
|
8006
|
+
readonly pointer: string;
|
|
8007
|
+
constructor(nodeId: NodeId$1, bindingIndex: number, pointer: string, message: string);
|
|
8008
|
+
}
|
|
8009
|
+
/**
|
|
8010
|
+
* Error thrown when a map.fanout node input is invalid.
|
|
8011
|
+
*/
|
|
8012
|
+
declare class MapFanoutInputError extends Error {
|
|
8013
|
+
readonly nodeId: NodeId$1;
|
|
8014
|
+
constructor(nodeId: NodeId$1, message: string);
|
|
8015
|
+
}
|
|
8016
|
+
type WorkflowBuilderV0State = {
|
|
8017
|
+
readonly name?: string;
|
|
8018
|
+
readonly execution?: WorkflowSpecV0["execution"];
|
|
8019
|
+
readonly nodes: ReadonlyArray<WorkflowNodeV0>;
|
|
8020
|
+
readonly edges: ReadonlyArray<WorkflowEdgeV0>;
|
|
8021
|
+
readonly outputs: ReadonlyArray<WorkflowOutputRefV0>;
|
|
8022
|
+
};
|
|
8023
|
+
declare class WorkflowBuilderV0 {
|
|
8024
|
+
private readonly state;
|
|
8025
|
+
constructor(state?: WorkflowBuilderV0State);
|
|
8026
|
+
static new(): WorkflowBuilderV0;
|
|
8027
|
+
private with;
|
|
8028
|
+
name(name: string): WorkflowBuilderV0;
|
|
8029
|
+
execution(execution: WorkflowSpecV0["execution"]): WorkflowBuilderV0;
|
|
8030
|
+
node(node: WorkflowNodeV0): WorkflowBuilderV0;
|
|
8031
|
+
llmResponses(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
|
|
8032
|
+
stream?: boolean;
|
|
8033
|
+
toolExecution?: ToolExecutionModeV0$1;
|
|
8034
|
+
toolLimits?: LLMResponsesToolLimitsV0;
|
|
8035
|
+
bindings?: ReadonlyArray<LLMResponsesBindingV0>;
|
|
8036
|
+
}): WorkflowBuilderV0;
|
|
8037
|
+
joinAll(id: NodeId$1): WorkflowBuilderV0;
|
|
8038
|
+
transformJSON(id: NodeId$1, input: Extract<WorkflowNodeV0, {
|
|
8039
|
+
type: typeof WorkflowNodeTypes.TransformJSON;
|
|
8040
|
+
}>["input"]): WorkflowBuilderV0;
|
|
8041
|
+
edge(from: NodeId$1, to: NodeId$1): WorkflowBuilderV0;
|
|
8042
|
+
output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV0;
|
|
8043
|
+
build(): WorkflowSpecV0;
|
|
8044
|
+
}
|
|
8045
|
+
declare function workflowV0(): WorkflowBuilderV0;
|
|
8046
|
+
type WorkflowBuilderV1State = {
|
|
8047
|
+
readonly name?: string;
|
|
8048
|
+
readonly execution?: WorkflowSpecV1["execution"];
|
|
8049
|
+
readonly nodes: ReadonlyArray<WorkflowNodeV1>;
|
|
8050
|
+
readonly edges: ReadonlyArray<WorkflowEdgeV1>;
|
|
8051
|
+
readonly outputs: ReadonlyArray<WorkflowOutputRefV1>;
|
|
8052
|
+
};
|
|
8053
|
+
declare class WorkflowBuilderV1 {
|
|
8054
|
+
private readonly state;
|
|
8055
|
+
constructor(state?: WorkflowBuilderV1State);
|
|
8056
|
+
static new(): WorkflowBuilderV1;
|
|
8057
|
+
private with;
|
|
8058
|
+
name(name: string): WorkflowBuilderV1;
|
|
8059
|
+
execution(execution: WorkflowSpecV1["execution"]): WorkflowBuilderV1;
|
|
8060
|
+
node(node: WorkflowNodeV1): WorkflowBuilderV1;
|
|
8061
|
+
llmResponses(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
|
|
8062
|
+
stream?: boolean;
|
|
8063
|
+
toolExecution?: ToolExecutionModeV1$1;
|
|
8064
|
+
toolLimits?: LLMResponsesToolLimitsV1;
|
|
8065
|
+
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
8066
|
+
}): WorkflowBuilderV1;
|
|
8067
|
+
routeSwitch(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest, options?: {
|
|
8068
|
+
stream?: boolean;
|
|
8069
|
+
toolExecution?: ToolExecutionModeV1$1;
|
|
8070
|
+
toolLimits?: LLMResponsesToolLimitsV1;
|
|
8071
|
+
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
8072
|
+
}): WorkflowBuilderV1;
|
|
8073
|
+
joinAll(id: NodeId$1): WorkflowBuilderV1;
|
|
8074
|
+
joinAny(id: NodeId$1, input?: JoinAnyNodeInputV1): WorkflowBuilderV1;
|
|
8075
|
+
joinCollect(id: NodeId$1, input: JoinCollectNodeInputV1): WorkflowBuilderV1;
|
|
8076
|
+
transformJSON(id: NodeId$1, input: TransformJSONNodeInputV1): WorkflowBuilderV1;
|
|
8077
|
+
mapFanout(id: NodeId$1, input: MapFanoutNodeInputV1): WorkflowBuilderV1;
|
|
8078
|
+
edge(from: NodeId$1, to: NodeId$1, when?: ConditionV1$1): WorkflowBuilderV1;
|
|
8079
|
+
output(name: OutputName$1, from: NodeId$1, pointer?: string): WorkflowBuilderV1;
|
|
8080
|
+
build(): WorkflowSpecV1;
|
|
8081
|
+
}
|
|
8082
|
+
declare function workflowV1(): WorkflowBuilderV1;
|
|
8083
|
+
type PendingLLMNode = {
|
|
8084
|
+
id: NodeId$1;
|
|
8085
|
+
request: WireResponsesRequest;
|
|
8086
|
+
stream?: boolean;
|
|
8087
|
+
bindings: LLMResponsesBindingV0[];
|
|
8088
|
+
toolExecution?: ToolExecutionModeV0$1;
|
|
8089
|
+
toolLimits?: LLMResponsesToolLimitsV0;
|
|
8090
|
+
};
|
|
8091
|
+
/**
|
|
8092
|
+
* Ergonomic workflow builder with auto-edge inference from bindings.
|
|
8093
|
+
*
|
|
8094
|
+
* @example
|
|
8095
|
+
* ```typescript
|
|
8096
|
+
* const spec = newWorkflow("tier_generation")
|
|
8097
|
+
* .addLLMNode("tier_generator", tierReq).stream(true)
|
|
8098
|
+
* .addLLMNode("business_summary", summaryReq)
|
|
8099
|
+
* .bindFrom("tier_generator", "/output/0/content/0/text")
|
|
8100
|
+
* .output("tiers", "tier_generator")
|
|
8101
|
+
* .output("summary", "business_summary")
|
|
8102
|
+
* .build();
|
|
8103
|
+
* ```
|
|
8104
|
+
*/
|
|
8105
|
+
declare class Workflow {
|
|
8106
|
+
private _name?;
|
|
8107
|
+
private _execution?;
|
|
8108
|
+
private readonly _nodes;
|
|
8109
|
+
private readonly _edges;
|
|
8110
|
+
private readonly _outputs;
|
|
8111
|
+
private _pendingNode;
|
|
8112
|
+
private constructor();
|
|
8113
|
+
/**
|
|
8114
|
+
* Create a new workflow builder with the given name.
|
|
8115
|
+
*/
|
|
8116
|
+
static create(name?: string): Workflow;
|
|
8117
|
+
/**
|
|
8118
|
+
* Set the workflow execution configuration.
|
|
8119
|
+
*/
|
|
8120
|
+
execution(exec: WorkflowSpecV0["execution"]): Workflow;
|
|
8121
|
+
/**
|
|
8122
|
+
* Add an LLM responses node and return a node builder for configuration.
|
|
8123
|
+
*/
|
|
8124
|
+
addLLMNode(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest): LLMNodeBuilder;
|
|
8125
|
+
/**
|
|
8126
|
+
* Add a join.all node that waits for all incoming edges.
|
|
8127
|
+
*/
|
|
8128
|
+
addJoinAllNode(id: NodeId$1): Workflow;
|
|
8129
|
+
/**
|
|
8130
|
+
* Add a transform.json node and return a builder for configuration.
|
|
8131
|
+
*/
|
|
8132
|
+
addTransformJSONNode(id: NodeId$1): TransformJSONNodeBuilder;
|
|
8133
|
+
/**
|
|
8134
|
+
* Add an output reference extracting the full node output.
|
|
8135
|
+
*/
|
|
8136
|
+
output(name: OutputName$1, from: NodeId$1, pointer?: string): Workflow;
|
|
8137
|
+
/**
|
|
8138
|
+
* Add an output reference extracting text content from an LLM response.
|
|
8139
|
+
* This is a convenience method that uses the LLM_TEXT_OUTPUT pointer.
|
|
8140
|
+
*/
|
|
8141
|
+
outputText(name: OutputName$1, from: NodeId$1): Workflow;
|
|
8142
|
+
/**
|
|
8143
|
+
* Explicitly add an edge between nodes.
|
|
8144
|
+
* Note: edges are automatically inferred from bindings, so this is rarely needed.
|
|
8145
|
+
*/
|
|
8146
|
+
edge(from: NodeId$1, to: NodeId$1): Workflow;
|
|
8147
|
+
/**
|
|
8148
|
+
* Build the workflow specification.
|
|
8149
|
+
*/
|
|
8150
|
+
build(): WorkflowSpecV0;
|
|
8151
|
+
/** @internal */
|
|
8152
|
+
_getPendingNode(): PendingLLMNode | null;
|
|
8153
|
+
/** @internal */
|
|
8154
|
+
_addEdge(from: NodeId$1, to: NodeId$1): void;
|
|
8155
|
+
/** @internal */
|
|
8156
|
+
_addNode(node: WorkflowNodeV0): void;
|
|
8157
|
+
private flushPendingNode;
|
|
8158
|
+
}
|
|
8159
|
+
/**
|
|
8160
|
+
* Builder for configuring an LLM responses node.
|
|
8161
|
+
*/
|
|
8162
|
+
declare class LLMNodeBuilder {
|
|
8163
|
+
private readonly workflow;
|
|
8164
|
+
constructor(workflow: Workflow);
|
|
8165
|
+
/**
|
|
8166
|
+
* Enable or disable streaming for this node.
|
|
8167
|
+
*/
|
|
8168
|
+
stream(enabled: boolean): LLMNodeBuilder;
|
|
8169
|
+
/**
|
|
8170
|
+
* Add a binding from another LLM node's text output to this node's user message.
|
|
8171
|
+
* This is the most common binding pattern: LLM text → user message with json_string encoding.
|
|
8172
|
+
* The edge from the source node is automatically inferred.
|
|
8173
|
+
*/
|
|
8174
|
+
bindTextFrom(from: NodeId$1): LLMNodeBuilder;
|
|
8175
|
+
/**
|
|
8176
|
+
* Add a binding from another node's output to this node's user message text.
|
|
8177
|
+
* Use bindTextFrom for the common case of binding LLM text output.
|
|
8178
|
+
* The edge from the source node is automatically inferred.
|
|
8179
|
+
*/
|
|
8180
|
+
bindFrom(from: NodeId$1, pointer?: string): LLMNodeBuilder;
|
|
8181
|
+
/**
|
|
8182
|
+
* Add a full binding with explicit source/destination pointers and encoding.
|
|
8183
|
+
* The edge from the source node is automatically inferred.
|
|
8184
|
+
*/
|
|
8185
|
+
bindFromTo(from: NodeId$1, fromPointer: string | undefined, toPointer: string, encoding?: LLMResponsesBindingEncodingV0): LLMNodeBuilder;
|
|
8186
|
+
/**
|
|
8187
|
+
* Add a binding that replaces a {{placeholder}} in the prompt text.
|
|
8188
|
+
* This is useful when the prompt contains placeholder markers like {{tier_data}}.
|
|
8189
|
+
* The edge from the source node is automatically inferred.
|
|
8190
|
+
*/
|
|
8191
|
+
bindToPlaceholder(from: NodeId$1, fromPointer: string | undefined, placeholder: string): LLMNodeBuilder;
|
|
8192
|
+
/**
|
|
8193
|
+
* Add a binding from an LLM node's text output to a placeholder.
|
|
8194
|
+
* This is the most common placeholder binding: LLM text → {{placeholder}}.
|
|
8195
|
+
* The edge from the source node is automatically inferred.
|
|
8196
|
+
*/
|
|
8197
|
+
bindTextToPlaceholder(from: NodeId$1, placeholder: string): LLMNodeBuilder;
|
|
8198
|
+
/**
|
|
8199
|
+
* Set the tool execution mode (server or client).
|
|
8200
|
+
*/
|
|
8201
|
+
toolExecution(mode: ToolExecutionModeV0$1): LLMNodeBuilder;
|
|
8202
|
+
/**
|
|
8203
|
+
* Set the tool execution limits.
|
|
8204
|
+
*/
|
|
8205
|
+
toolLimits(limits: LLMResponsesToolLimitsV0): LLMNodeBuilder;
|
|
8206
|
+
addLLMNode(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest): LLMNodeBuilder;
|
|
8207
|
+
addJoinAllNode(id: NodeId$1): Workflow;
|
|
8208
|
+
addTransformJSONNode(id: NodeId$1): TransformJSONNodeBuilder;
|
|
8209
|
+
edge(from: NodeId$1, to: NodeId$1): Workflow;
|
|
8210
|
+
output(name: OutputName$1, from: NodeId$1, pointer?: string): Workflow;
|
|
8211
|
+
outputText(name: OutputName$1, from: NodeId$1): Workflow;
|
|
8212
|
+
execution(exec: WorkflowSpecV0["execution"]): Workflow;
|
|
8213
|
+
build(): WorkflowSpecV0;
|
|
8214
|
+
}
|
|
8215
|
+
/**
|
|
8216
|
+
* Builder for configuring a transform.json node.
|
|
8217
|
+
*/
|
|
8218
|
+
declare class TransformJSONNodeBuilder {
|
|
8219
|
+
private readonly workflow;
|
|
8220
|
+
private readonly id;
|
|
8221
|
+
private _object?;
|
|
8222
|
+
private _merge?;
|
|
8223
|
+
constructor(workflow: Workflow, id: NodeId$1);
|
|
8224
|
+
/**
|
|
8225
|
+
* Set the object transformation with field mappings.
|
|
8226
|
+
*/
|
|
8227
|
+
object(fields: Record<string, TransformJSONValueV0>): TransformJSONNodeBuilder;
|
|
8228
|
+
/**
|
|
8229
|
+
* Set the merge transformation with source references.
|
|
8230
|
+
*/
|
|
8231
|
+
merge(items: TransformJSONValueV0[]): TransformJSONNodeBuilder;
|
|
8232
|
+
private finalize;
|
|
8233
|
+
addLLMNode(id: NodeId$1, request: WireResponsesRequest | ResponsesRequest): LLMNodeBuilder;
|
|
8234
|
+
addJoinAllNode(id: NodeId$1): Workflow;
|
|
8235
|
+
edge(from: NodeId$1, to: NodeId$1): Workflow;
|
|
8236
|
+
output(name: OutputName$1, from: NodeId$1, pointer?: string): Workflow;
|
|
8237
|
+
execution(exec: WorkflowSpecV0["execution"]): Workflow;
|
|
8238
|
+
build(): WorkflowSpecV0;
|
|
8239
|
+
}
|
|
8240
|
+
/**
|
|
8241
|
+
* Create a new ergonomic workflow builder with the given name.
|
|
8242
|
+
*
|
|
8243
|
+
* @example
|
|
8244
|
+
* ```typescript
|
|
8245
|
+
* const spec = newWorkflow("my_workflow")
|
|
8246
|
+
* .addLLMNode("generator", request).stream(true)
|
|
8247
|
+
* .addLLMNode("summarizer", summaryReq)
|
|
8248
|
+
* .bindFrom("generator", "/output/0/content/0/text")
|
|
8249
|
+
* .output("result", "summarizer")
|
|
8250
|
+
* .build();
|
|
8251
|
+
* ```
|
|
8252
|
+
*/
|
|
8253
|
+
declare function newWorkflow(name?: string): Workflow;
|
|
8254
|
+
|
|
8255
|
+
/**
|
|
8256
|
+
* Type-safe JSON pointer construction for LLM request/response paths.
|
|
8257
|
+
*
|
|
8258
|
+
* Use these builders instead of raw strings to get compile-time safety
|
|
8259
|
+
* and IDE autocomplete for common LLM request/response paths.
|
|
8260
|
+
*
|
|
8261
|
+
* @example
|
|
8262
|
+
* ```typescript
|
|
8263
|
+
* // Instead of raw string:
|
|
8264
|
+
* const pointer = "/output/0/content/0/text";
|
|
8265
|
+
*
|
|
8266
|
+
* // Use typed builder:
|
|
8267
|
+
* const pointer = LLMOutput().content(0).text();
|
|
8268
|
+
*
|
|
8269
|
+
* // Or use pre-built paths:
|
|
8270
|
+
* import { LLMOutputText } from "./json_path";
|
|
8271
|
+
* ```
|
|
8272
|
+
*/
|
|
8273
|
+
/** JSON pointer string type for type safety */
|
|
8274
|
+
type JSONPointer = string;
|
|
8275
|
+
/**
|
|
8276
|
+
* Path builder for LLM response output structures.
|
|
8277
|
+
* The output structure is: output[index].content[index].{text|...}
|
|
8278
|
+
*/
|
|
8279
|
+
declare class LLMOutputPath {
|
|
8280
|
+
private readonly path;
|
|
8281
|
+
constructor(path?: string);
|
|
8282
|
+
/** Select an output by index */
|
|
8283
|
+
index(i: number): LLMOutputContentPath;
|
|
8284
|
+
/** Shorthand for index(0).content(i) */
|
|
8285
|
+
content(i: number): LLMOutputContentItemPath;
|
|
8286
|
+
}
|
|
8287
|
+
/** Path builder for output[i] level */
|
|
8288
|
+
declare class LLMOutputContentPath {
|
|
8289
|
+
private readonly path;
|
|
8290
|
+
constructor(path: string);
|
|
8291
|
+
/** Select a content item by index */
|
|
8292
|
+
content(i: number): LLMOutputContentItemPath;
|
|
8293
|
+
}
|
|
8294
|
+
/** Path builder for output[i].content[j] level */
|
|
8295
|
+
declare class LLMOutputContentItemPath {
|
|
8296
|
+
private readonly path;
|
|
8297
|
+
constructor(path: string);
|
|
8298
|
+
/** Get the text field pointer */
|
|
8299
|
+
text(): JSONPointer;
|
|
8300
|
+
/** Get the type field pointer */
|
|
8301
|
+
type(): JSONPointer;
|
|
8302
|
+
/** Get the path as a string */
|
|
8303
|
+
toString(): string;
|
|
8304
|
+
}
|
|
8305
|
+
/**
|
|
8306
|
+
* Path builder for LLM request input structures.
|
|
8307
|
+
* The input structure is: input[message_index].content[content_index].{text|...}
|
|
8308
|
+
*/
|
|
8309
|
+
declare class LLMInputPath {
|
|
8310
|
+
private readonly path;
|
|
8311
|
+
constructor(path?: string);
|
|
8312
|
+
/**
|
|
8313
|
+
* Select a message by index.
|
|
8314
|
+
* Index 0 is typically the system message, index 1 is the first user message.
|
|
8315
|
+
*/
|
|
8316
|
+
message(i: number): LLMInputMessagePath;
|
|
8317
|
+
/** Shorthand for message(0) - the first message slot */
|
|
8318
|
+
systemMessage(): LLMInputMessagePath;
|
|
8319
|
+
/** Shorthand for message(1) - typically the user message after system */
|
|
8320
|
+
userMessage(): LLMInputMessagePath;
|
|
8321
|
+
}
|
|
8322
|
+
/** Path builder for input[i] level */
|
|
8323
|
+
declare class LLMInputMessagePath {
|
|
8324
|
+
private readonly path;
|
|
8325
|
+
constructor(path: string);
|
|
8326
|
+
/** Select a content item by index */
|
|
8327
|
+
content(i: number): LLMInputContentItemPath;
|
|
8328
|
+
/** Shorthand for content(0).text() */
|
|
8329
|
+
text(): JSONPointer;
|
|
8330
|
+
}
|
|
8331
|
+
/** Path builder for input[i].content[j] level */
|
|
8332
|
+
declare class LLMInputContentItemPath {
|
|
8333
|
+
private readonly path;
|
|
8334
|
+
constructor(path: string);
|
|
8335
|
+
/** Get the text field pointer */
|
|
8336
|
+
text(): JSONPointer;
|
|
8337
|
+
/** Get the type field pointer */
|
|
8338
|
+
type(): JSONPointer;
|
|
8339
|
+
/** Get the path as a string */
|
|
8340
|
+
toString(): string;
|
|
8341
|
+
}
|
|
8342
|
+
/** Start building a path into an LLM response output */
|
|
8343
|
+
declare function LLMOutput(): LLMOutputPath;
|
|
8344
|
+
/** Start building a path into an LLM request input */
|
|
8345
|
+
declare function LLMInput(): LLMInputPath;
|
|
8346
|
+
/** Extracts text from the first content item of the first output */
|
|
8347
|
+
declare const LLMOutputText: JSONPointer;
|
|
8348
|
+
/** Targets the system message text (input[0].content[0].text) */
|
|
8349
|
+
declare const LLMInputSystemText: JSONPointer;
|
|
8350
|
+
/** Targets the user message text (input[1].content[0].text) */
|
|
8351
|
+
declare const LLMInputUserText: JSONPointer;
|
|
8352
|
+
/** Targets the first message text (input[0].content[0].text) */
|
|
8353
|
+
declare const LLMInputFirstMessageText: JSONPointer;
|
|
8354
|
+
/**
|
|
8355
|
+
* Path builder for accessing outputs from a join.all node.
|
|
8356
|
+
* A join.all node produces an object keyed by upstream node IDs.
|
|
8357
|
+
*
|
|
8358
|
+
* @example
|
|
8359
|
+
* ```typescript
|
|
8360
|
+
* // Access text from a specific node in the join output:
|
|
8361
|
+
* const pointer = JoinOutput("cost_analyst").text();
|
|
8362
|
+
* // Produces: "/cost_analyst/output/0/content/0/text"
|
|
8363
|
+
* ```
|
|
8364
|
+
*/
|
|
8365
|
+
declare class JoinOutputPath {
|
|
8366
|
+
private readonly path;
|
|
8367
|
+
constructor(path: string);
|
|
8368
|
+
/** Access the output array of the node */
|
|
8369
|
+
output(): LLMOutputPath;
|
|
8370
|
+
/**
|
|
8371
|
+
* Shorthand for accessing the first text content from the node.
|
|
8372
|
+
* Equivalent to: JoinOutput(nodeId).output().content(0).text()
|
|
8373
|
+
*/
|
|
8374
|
+
text(): JSONPointer;
|
|
8375
|
+
/** Get the path as a string */
|
|
8376
|
+
toString(): string;
|
|
8377
|
+
}
|
|
8378
|
+
/**
|
|
8379
|
+
* Start building a path to access a specific node's output from a join.all node.
|
|
8380
|
+
* @param nodeId The ID of the upstream node
|
|
8381
|
+
*/
|
|
8382
|
+
declare function JoinOutput(nodeId: string): JoinOutputPath;
|
|
8383
|
+
|
|
8384
|
+
var $id$1 = "https://modelrelay.ai/schemas/workflow_v0.schema.json";
|
|
8385
|
+
var $schema$1 = "http://json-schema.org/draft-07/schema#";
|
|
8386
|
+
var additionalProperties$1 = false;
|
|
8387
|
+
var definitions$1 = {
|
|
8388
|
+
edge: {
|
|
8389
|
+
additionalProperties: false,
|
|
8390
|
+
properties: {
|
|
8391
|
+
from: {
|
|
8392
|
+
minLength: 1,
|
|
8393
|
+
type: "string"
|
|
8394
|
+
},
|
|
8395
|
+
to: {
|
|
8396
|
+
minLength: 1,
|
|
8397
|
+
type: "string"
|
|
8398
|
+
}
|
|
8399
|
+
},
|
|
8400
|
+
required: [
|
|
8401
|
+
"from",
|
|
8402
|
+
"to"
|
|
8403
|
+
],
|
|
8404
|
+
type: "object"
|
|
8405
|
+
},
|
|
8406
|
+
llmResponsesBinding: {
|
|
8407
|
+
additionalProperties: false,
|
|
8408
|
+
oneOf: [
|
|
8409
|
+
{
|
|
8410
|
+
required: [
|
|
8411
|
+
"to"
|
|
8412
|
+
]
|
|
8413
|
+
},
|
|
8414
|
+
{
|
|
8415
|
+
required: [
|
|
8416
|
+
"to_placeholder"
|
|
8417
|
+
]
|
|
8418
|
+
}
|
|
8419
|
+
],
|
|
8420
|
+
properties: {
|
|
8421
|
+
encoding: {
|
|
8422
|
+
"enum": [
|
|
8423
|
+
"json",
|
|
8424
|
+
"json_string"
|
|
8425
|
+
],
|
|
8426
|
+
type: "string"
|
|
8427
|
+
},
|
|
8428
|
+
from: {
|
|
8429
|
+
minLength: 1,
|
|
8430
|
+
type: "string"
|
|
8431
|
+
},
|
|
8432
|
+
pointer: {
|
|
8433
|
+
pattern: "^(/.*)?$",
|
|
8434
|
+
type: "string"
|
|
8435
|
+
},
|
|
8436
|
+
to: {
|
|
8437
|
+
pattern: "^/.*$",
|
|
8438
|
+
type: "string"
|
|
8439
|
+
},
|
|
8440
|
+
to_placeholder: {
|
|
8441
|
+
minLength: 1,
|
|
8442
|
+
type: "string"
|
|
8443
|
+
}
|
|
8444
|
+
},
|
|
8445
|
+
required: [
|
|
8446
|
+
"from"
|
|
8447
|
+
],
|
|
8448
|
+
type: "object"
|
|
8449
|
+
},
|
|
8450
|
+
node: {
|
|
8451
|
+
additionalProperties: false,
|
|
8452
|
+
oneOf: [
|
|
8453
|
+
{
|
|
8454
|
+
allOf: [
|
|
8455
|
+
{
|
|
8456
|
+
properties: {
|
|
8457
|
+
input: {
|
|
8458
|
+
properties: {
|
|
8459
|
+
bindings: {
|
|
8460
|
+
items: {
|
|
8461
|
+
$ref: "#/definitions/llmResponsesBinding"
|
|
8462
|
+
},
|
|
8463
|
+
type: "array"
|
|
8464
|
+
},
|
|
8465
|
+
request: {
|
|
8466
|
+
type: "object"
|
|
8467
|
+
},
|
|
8468
|
+
stream: {
|
|
8469
|
+
type: "boolean"
|
|
8470
|
+
},
|
|
8471
|
+
tool_execution: {
|
|
8472
|
+
additionalProperties: false,
|
|
8473
|
+
properties: {
|
|
8474
|
+
mode: {
|
|
8475
|
+
"default": "server",
|
|
8476
|
+
"enum": [
|
|
8477
|
+
"server",
|
|
8478
|
+
"client"
|
|
8479
|
+
],
|
|
8480
|
+
type: "string"
|
|
8481
|
+
}
|
|
8482
|
+
},
|
|
8483
|
+
required: [
|
|
8484
|
+
"mode"
|
|
8485
|
+
],
|
|
8486
|
+
type: "object"
|
|
8487
|
+
},
|
|
8488
|
+
tool_limits: {
|
|
8489
|
+
additionalProperties: false,
|
|
8490
|
+
properties: {
|
|
8491
|
+
max_llm_calls: {
|
|
8492
|
+
"default": 8,
|
|
8493
|
+
maximum: 64,
|
|
8494
|
+
minimum: 1,
|
|
8495
|
+
type: "integer"
|
|
8496
|
+
},
|
|
8497
|
+
max_tool_calls_per_step: {
|
|
8498
|
+
"default": 16,
|
|
8499
|
+
maximum: 64,
|
|
8500
|
+
minimum: 1,
|
|
8501
|
+
type: "integer"
|
|
8502
|
+
},
|
|
8503
|
+
wait_ttl_ms: {
|
|
8504
|
+
"default": 900000,
|
|
8505
|
+
maximum: 86400000,
|
|
8506
|
+
minimum: 1,
|
|
8507
|
+
type: "integer"
|
|
8508
|
+
}
|
|
8509
|
+
},
|
|
8510
|
+
type: "object"
|
|
8511
|
+
}
|
|
8512
|
+
},
|
|
8513
|
+
required: [
|
|
8514
|
+
"request"
|
|
8515
|
+
],
|
|
8516
|
+
type: "object"
|
|
8517
|
+
}
|
|
8518
|
+
}
|
|
8519
|
+
}
|
|
8520
|
+
],
|
|
8521
|
+
properties: {
|
|
8522
|
+
type: {
|
|
8523
|
+
"const": "llm.responses"
|
|
8524
|
+
}
|
|
8525
|
+
},
|
|
8526
|
+
required: [
|
|
8527
|
+
"input"
|
|
8528
|
+
]
|
|
8529
|
+
},
|
|
8530
|
+
{
|
|
8531
|
+
properties: {
|
|
8532
|
+
type: {
|
|
8533
|
+
"const": "join.all"
|
|
8534
|
+
}
|
|
8535
|
+
}
|
|
8536
|
+
},
|
|
8537
|
+
{
|
|
8538
|
+
allOf: [
|
|
8539
|
+
{
|
|
8540
|
+
properties: {
|
|
8541
|
+
input: {
|
|
8542
|
+
additionalProperties: false,
|
|
8543
|
+
oneOf: [
|
|
8544
|
+
{
|
|
8545
|
+
not: {
|
|
8546
|
+
required: [
|
|
8547
|
+
"merge"
|
|
8548
|
+
]
|
|
8549
|
+
},
|
|
8550
|
+
required: [
|
|
8551
|
+
"object"
|
|
8552
|
+
]
|
|
8553
|
+
},
|
|
8554
|
+
{
|
|
8555
|
+
not: {
|
|
8556
|
+
required: [
|
|
8557
|
+
"object"
|
|
8558
|
+
]
|
|
8559
|
+
},
|
|
8560
|
+
required: [
|
|
8561
|
+
"merge"
|
|
8562
|
+
]
|
|
8563
|
+
}
|
|
8564
|
+
],
|
|
8565
|
+
properties: {
|
|
8566
|
+
merge: {
|
|
8567
|
+
items: {
|
|
8568
|
+
$ref: "#/definitions/transformValue"
|
|
8569
|
+
},
|
|
8570
|
+
minItems: 1,
|
|
8571
|
+
type: "array"
|
|
8572
|
+
},
|
|
8573
|
+
object: {
|
|
8574
|
+
additionalProperties: {
|
|
8575
|
+
$ref: "#/definitions/transformValue"
|
|
8576
|
+
},
|
|
8577
|
+
minProperties: 1,
|
|
8578
|
+
type: "object"
|
|
8579
|
+
}
|
|
8580
|
+
},
|
|
8581
|
+
type: "object"
|
|
8582
|
+
}
|
|
8583
|
+
}
|
|
8584
|
+
}
|
|
8585
|
+
],
|
|
8586
|
+
properties: {
|
|
8587
|
+
type: {
|
|
8588
|
+
"const": "transform.json"
|
|
8589
|
+
}
|
|
8590
|
+
},
|
|
8591
|
+
required: [
|
|
8592
|
+
"input"
|
|
8593
|
+
]
|
|
8594
|
+
}
|
|
8595
|
+
],
|
|
8596
|
+
properties: {
|
|
8597
|
+
id: {
|
|
8598
|
+
minLength: 1,
|
|
8599
|
+
type: "string"
|
|
8600
|
+
},
|
|
8601
|
+
input: {
|
|
8602
|
+
},
|
|
8603
|
+
type: {
|
|
8604
|
+
"enum": [
|
|
8605
|
+
"llm.responses",
|
|
8606
|
+
"join.all",
|
|
8607
|
+
"transform.json"
|
|
8608
|
+
],
|
|
8609
|
+
type: "string"
|
|
8610
|
+
}
|
|
8611
|
+
},
|
|
8612
|
+
required: [
|
|
8613
|
+
"id",
|
|
8614
|
+
"type"
|
|
8615
|
+
],
|
|
8616
|
+
type: "object"
|
|
8617
|
+
},
|
|
8618
|
+
output: {
|
|
8619
|
+
additionalProperties: false,
|
|
8620
|
+
properties: {
|
|
8621
|
+
from: {
|
|
8622
|
+
minLength: 1,
|
|
8623
|
+
type: "string"
|
|
8624
|
+
},
|
|
8625
|
+
name: {
|
|
8626
|
+
minLength: 1,
|
|
8627
|
+
type: "string"
|
|
8628
|
+
},
|
|
8629
|
+
pointer: {
|
|
8630
|
+
pattern: "^(/.*)?$",
|
|
8631
|
+
type: "string"
|
|
8632
|
+
}
|
|
8633
|
+
},
|
|
8634
|
+
required: [
|
|
8635
|
+
"name",
|
|
8636
|
+
"from"
|
|
8637
|
+
],
|
|
8638
|
+
type: "object"
|
|
8639
|
+
},
|
|
8640
|
+
transformValue: {
|
|
8641
|
+
additionalProperties: false,
|
|
8642
|
+
properties: {
|
|
8643
|
+
from: {
|
|
8644
|
+
minLength: 1,
|
|
8645
|
+
type: "string"
|
|
8646
|
+
},
|
|
8647
|
+
pointer: {
|
|
8648
|
+
pattern: "^(/.*)?$",
|
|
8649
|
+
type: "string"
|
|
8650
|
+
}
|
|
8651
|
+
},
|
|
8652
|
+
required: [
|
|
8653
|
+
"from"
|
|
8654
|
+
],
|
|
8655
|
+
type: "object"
|
|
8656
|
+
}
|
|
8657
|
+
};
|
|
8658
|
+
var properties$1 = {
|
|
8659
|
+
edges: {
|
|
8660
|
+
items: {
|
|
8661
|
+
$ref: "#/definitions/edge"
|
|
8662
|
+
},
|
|
8663
|
+
type: "array"
|
|
8664
|
+
},
|
|
8665
|
+
execution: {
|
|
8666
|
+
additionalProperties: false,
|
|
8667
|
+
properties: {
|
|
8668
|
+
max_parallelism: {
|
|
8669
|
+
minimum: 1,
|
|
8670
|
+
type: "integer"
|
|
8671
|
+
},
|
|
8672
|
+
node_timeout_ms: {
|
|
8673
|
+
minimum: 1,
|
|
8674
|
+
type: "integer"
|
|
8675
|
+
},
|
|
8676
|
+
run_timeout_ms: {
|
|
8677
|
+
minimum: 1,
|
|
8678
|
+
type: "integer"
|
|
8679
|
+
}
|
|
8680
|
+
},
|
|
8681
|
+
type: "object"
|
|
8682
|
+
},
|
|
8683
|
+
kind: {
|
|
8684
|
+
"const": "workflow.v0",
|
|
8685
|
+
type: "string"
|
|
8686
|
+
},
|
|
8687
|
+
name: {
|
|
8688
|
+
type: "string"
|
|
8689
|
+
},
|
|
8690
|
+
nodes: {
|
|
8691
|
+
items: {
|
|
8692
|
+
$ref: "#/definitions/node"
|
|
8693
|
+
},
|
|
8694
|
+
minItems: 1,
|
|
8695
|
+
type: "array"
|
|
8696
|
+
},
|
|
8697
|
+
outputs: {
|
|
8698
|
+
items: {
|
|
8699
|
+
$ref: "#/definitions/output"
|
|
8700
|
+
},
|
|
8701
|
+
minItems: 1,
|
|
8702
|
+
type: "array"
|
|
8703
|
+
}
|
|
6829
8704
|
};
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
8705
|
+
var required$1 = [
|
|
8706
|
+
"kind",
|
|
8707
|
+
"nodes",
|
|
8708
|
+
"outputs"
|
|
8709
|
+
];
|
|
8710
|
+
var title$1 = "ModelRelay workflow.v0";
|
|
8711
|
+
var type$1 = "object";
|
|
8712
|
+
var workflow_v0_schema = {
|
|
8713
|
+
$id: $id$1,
|
|
8714
|
+
$schema: $schema$1,
|
|
8715
|
+
additionalProperties: additionalProperties$1,
|
|
8716
|
+
definitions: definitions$1,
|
|
8717
|
+
properties: properties$1,
|
|
8718
|
+
required: required$1,
|
|
8719
|
+
title: title$1,
|
|
8720
|
+
type: type$1
|
|
6836
8721
|
};
|
|
6837
|
-
declare class WorkflowBuilderV0 {
|
|
6838
|
-
private readonly state;
|
|
6839
|
-
constructor(state?: WorkflowBuilderV0State);
|
|
6840
|
-
static new(): WorkflowBuilderV0;
|
|
6841
|
-
private with;
|
|
6842
|
-
name(name: string): WorkflowBuilderV0;
|
|
6843
|
-
execution(execution: WorkflowSpecV0["execution"]): WorkflowBuilderV0;
|
|
6844
|
-
node(node: WorkflowNodeV0): WorkflowBuilderV0;
|
|
6845
|
-
llmResponses(id: NodeId, request: WireResponsesRequest | ResponsesRequest, options?: {
|
|
6846
|
-
stream?: boolean;
|
|
6847
|
-
toolExecution?: ToolExecutionModeV0;
|
|
6848
|
-
toolLimits?: LLMResponsesToolLimitsV0;
|
|
6849
|
-
bindings?: ReadonlyArray<LLMResponsesBindingV0>;
|
|
6850
|
-
}): WorkflowBuilderV0;
|
|
6851
|
-
joinAll(id: NodeId): WorkflowBuilderV0;
|
|
6852
|
-
transformJSON(id: NodeId, input: Extract<WorkflowNodeV0, {
|
|
6853
|
-
type: typeof WorkflowNodeTypes.TransformJSON;
|
|
6854
|
-
}>["input"]): WorkflowBuilderV0;
|
|
6855
|
-
edge(from: NodeId, to: NodeId): WorkflowBuilderV0;
|
|
6856
|
-
output(name: OutputName, from: NodeId, pointer?: string): WorkflowBuilderV0;
|
|
6857
|
-
build(): WorkflowSpecV0;
|
|
6858
|
-
}
|
|
6859
|
-
declare function workflowV0(): WorkflowBuilderV0;
|
|
6860
8722
|
|
|
6861
|
-
var $id = "https://modelrelay.ai/schemas/
|
|
8723
|
+
var $id = "https://modelrelay.ai/schemas/workflow_v1.schema.json";
|
|
6862
8724
|
var $schema = "http://json-schema.org/draft-07/schema#";
|
|
6863
8725
|
var additionalProperties = false;
|
|
6864
8726
|
var definitions = {
|
|
8727
|
+
condition: {
|
|
8728
|
+
additionalProperties: false,
|
|
8729
|
+
properties: {
|
|
8730
|
+
op: {
|
|
8731
|
+
"enum": [
|
|
8732
|
+
"equals",
|
|
8733
|
+
"matches",
|
|
8734
|
+
"exists"
|
|
8735
|
+
],
|
|
8736
|
+
type: "string"
|
|
8737
|
+
},
|
|
8738
|
+
path: {
|
|
8739
|
+
pattern: "^\\$.*$",
|
|
8740
|
+
type: "string"
|
|
8741
|
+
},
|
|
8742
|
+
source: {
|
|
8743
|
+
"enum": [
|
|
8744
|
+
"node_output",
|
|
8745
|
+
"node_status"
|
|
8746
|
+
],
|
|
8747
|
+
type: "string"
|
|
8748
|
+
},
|
|
8749
|
+
value: {
|
|
8750
|
+
}
|
|
8751
|
+
},
|
|
8752
|
+
required: [
|
|
8753
|
+
"source",
|
|
8754
|
+
"op"
|
|
8755
|
+
],
|
|
8756
|
+
type: "object"
|
|
8757
|
+
},
|
|
6865
8758
|
edge: {
|
|
6866
8759
|
additionalProperties: false,
|
|
6867
8760
|
properties: {
|
|
@@ -6872,6 +8765,9 @@ var definitions = {
|
|
|
6872
8765
|
to: {
|
|
6873
8766
|
minLength: 1,
|
|
6874
8767
|
type: "string"
|
|
8768
|
+
},
|
|
8769
|
+
when: {
|
|
8770
|
+
$ref: "#/definitions/condition"
|
|
6875
8771
|
}
|
|
6876
8772
|
},
|
|
6877
8773
|
required: [
|
|
@@ -6880,38 +8776,271 @@ var definitions = {
|
|
|
6880
8776
|
],
|
|
6881
8777
|
type: "object"
|
|
6882
8778
|
},
|
|
8779
|
+
fragmentBindInput: {
|
|
8780
|
+
additionalProperties: false,
|
|
8781
|
+
oneOf: [
|
|
8782
|
+
{
|
|
8783
|
+
required: [
|
|
8784
|
+
"from_node"
|
|
8785
|
+
]
|
|
8786
|
+
},
|
|
8787
|
+
{
|
|
8788
|
+
required: [
|
|
8789
|
+
"from_input"
|
|
8790
|
+
]
|
|
8791
|
+
}
|
|
8792
|
+
],
|
|
8793
|
+
properties: {
|
|
8794
|
+
from_input: {
|
|
8795
|
+
minLength: 1,
|
|
8796
|
+
type: "string"
|
|
8797
|
+
},
|
|
8798
|
+
from_node: {
|
|
8799
|
+
minLength: 1,
|
|
8800
|
+
type: "string"
|
|
8801
|
+
},
|
|
8802
|
+
pointer: {
|
|
8803
|
+
pattern: "^(/.*)?$",
|
|
8804
|
+
type: "string"
|
|
8805
|
+
}
|
|
8806
|
+
},
|
|
8807
|
+
type: "object"
|
|
8808
|
+
},
|
|
8809
|
+
fragmentDef: {
|
|
8810
|
+
additionalProperties: false,
|
|
8811
|
+
properties: {
|
|
8812
|
+
edges: {
|
|
8813
|
+
items: {
|
|
8814
|
+
$ref: "#/definitions/edge"
|
|
8815
|
+
},
|
|
8816
|
+
type: "array"
|
|
8817
|
+
},
|
|
8818
|
+
inputs: {
|
|
8819
|
+
items: {
|
|
8820
|
+
$ref: "#/definitions/fragmentInput"
|
|
8821
|
+
},
|
|
8822
|
+
type: "array"
|
|
8823
|
+
},
|
|
8824
|
+
nodes: {
|
|
8825
|
+
items: {
|
|
8826
|
+
$ref: "#/definitions/node"
|
|
8827
|
+
},
|
|
8828
|
+
minItems: 1,
|
|
8829
|
+
type: "array"
|
|
8830
|
+
},
|
|
8831
|
+
outputs: {
|
|
8832
|
+
items: {
|
|
8833
|
+
$ref: "#/definitions/fragmentOutput"
|
|
8834
|
+
},
|
|
8835
|
+
minItems: 1,
|
|
8836
|
+
type: "array"
|
|
8837
|
+
}
|
|
8838
|
+
},
|
|
8839
|
+
required: [
|
|
8840
|
+
"outputs",
|
|
8841
|
+
"nodes"
|
|
8842
|
+
],
|
|
8843
|
+
type: "object"
|
|
8844
|
+
},
|
|
8845
|
+
fragmentInput: {
|
|
8846
|
+
additionalProperties: false,
|
|
8847
|
+
properties: {
|
|
8848
|
+
name: {
|
|
8849
|
+
minLength: 1,
|
|
8850
|
+
type: "string"
|
|
8851
|
+
},
|
|
8852
|
+
type: {
|
|
8853
|
+
type: "string"
|
|
8854
|
+
}
|
|
8855
|
+
},
|
|
8856
|
+
required: [
|
|
8857
|
+
"name"
|
|
8858
|
+
],
|
|
8859
|
+
type: "object"
|
|
8860
|
+
},
|
|
8861
|
+
fragmentOutput: {
|
|
8862
|
+
additionalProperties: false,
|
|
8863
|
+
properties: {
|
|
8864
|
+
from_node: {
|
|
8865
|
+
minLength: 1,
|
|
8866
|
+
type: "string"
|
|
8867
|
+
},
|
|
8868
|
+
name: {
|
|
8869
|
+
minLength: 1,
|
|
8870
|
+
type: "string"
|
|
8871
|
+
},
|
|
8872
|
+
pointer: {
|
|
8873
|
+
pattern: "^(/.*)?$",
|
|
8874
|
+
type: "string"
|
|
8875
|
+
}
|
|
8876
|
+
},
|
|
8877
|
+
required: [
|
|
8878
|
+
"name",
|
|
8879
|
+
"from_node"
|
|
8880
|
+
],
|
|
8881
|
+
type: "object"
|
|
8882
|
+
},
|
|
6883
8883
|
llmResponsesBinding: {
|
|
6884
8884
|
additionalProperties: false,
|
|
8885
|
+
oneOf: [
|
|
8886
|
+
{
|
|
8887
|
+
required: [
|
|
8888
|
+
"to"
|
|
8889
|
+
]
|
|
8890
|
+
},
|
|
8891
|
+
{
|
|
8892
|
+
required: [
|
|
8893
|
+
"to_placeholder"
|
|
8894
|
+
]
|
|
8895
|
+
}
|
|
8896
|
+
],
|
|
8897
|
+
properties: {
|
|
8898
|
+
encoding: {
|
|
8899
|
+
"enum": [
|
|
8900
|
+
"json",
|
|
8901
|
+
"json_string"
|
|
8902
|
+
],
|
|
8903
|
+
type: "string"
|
|
8904
|
+
},
|
|
8905
|
+
from: {
|
|
8906
|
+
minLength: 1,
|
|
8907
|
+
type: "string"
|
|
8908
|
+
},
|
|
8909
|
+
pointer: {
|
|
8910
|
+
pattern: "^(/.*)?$",
|
|
8911
|
+
type: "string"
|
|
8912
|
+
},
|
|
8913
|
+
to: {
|
|
8914
|
+
pattern: "^/.*$",
|
|
8915
|
+
type: "string"
|
|
8916
|
+
},
|
|
8917
|
+
to_placeholder: {
|
|
8918
|
+
minLength: 1,
|
|
8919
|
+
type: "string"
|
|
8920
|
+
}
|
|
8921
|
+
},
|
|
8922
|
+
required: [
|
|
8923
|
+
"from"
|
|
8924
|
+
],
|
|
8925
|
+
type: "object"
|
|
8926
|
+
},
|
|
8927
|
+
mapFanoutItemBinding: {
|
|
8928
|
+
additionalProperties: false,
|
|
8929
|
+
oneOf: [
|
|
8930
|
+
{
|
|
8931
|
+
required: [
|
|
8932
|
+
"to"
|
|
8933
|
+
]
|
|
8934
|
+
},
|
|
8935
|
+
{
|
|
8936
|
+
required: [
|
|
8937
|
+
"to_placeholder"
|
|
8938
|
+
]
|
|
8939
|
+
}
|
|
8940
|
+
],
|
|
6885
8941
|
properties: {
|
|
6886
8942
|
encoding: {
|
|
6887
8943
|
"enum": [
|
|
6888
8944
|
"json",
|
|
6889
8945
|
"json_string"
|
|
6890
8946
|
],
|
|
6891
|
-
type: "string"
|
|
6892
|
-
},
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
type: "string"
|
|
6896
|
-
},
|
|
6897
|
-
|
|
6898
|
-
pattern: "
|
|
6899
|
-
type: "string"
|
|
8947
|
+
type: "string"
|
|
8948
|
+
},
|
|
8949
|
+
path: {
|
|
8950
|
+
pattern: "^(/.*)?$",
|
|
8951
|
+
type: "string"
|
|
8952
|
+
},
|
|
8953
|
+
to: {
|
|
8954
|
+
pattern: "^/.*$",
|
|
8955
|
+
type: "string"
|
|
8956
|
+
},
|
|
8957
|
+
to_placeholder: {
|
|
8958
|
+
minLength: 1,
|
|
8959
|
+
type: "string"
|
|
8960
|
+
}
|
|
8961
|
+
},
|
|
8962
|
+
type: "object"
|
|
8963
|
+
},
|
|
8964
|
+
node: {
|
|
8965
|
+
additionalProperties: false,
|
|
8966
|
+
oneOf: [
|
|
8967
|
+
{
|
|
8968
|
+
allOf: [
|
|
8969
|
+
{
|
|
8970
|
+
properties: {
|
|
8971
|
+
input: {
|
|
8972
|
+
properties: {
|
|
8973
|
+
bindings: {
|
|
8974
|
+
items: {
|
|
8975
|
+
$ref: "#/definitions/llmResponsesBinding"
|
|
8976
|
+
},
|
|
8977
|
+
type: "array"
|
|
8978
|
+
},
|
|
8979
|
+
request: {
|
|
8980
|
+
type: "object"
|
|
8981
|
+
},
|
|
8982
|
+
stream: {
|
|
8983
|
+
type: "boolean"
|
|
8984
|
+
},
|
|
8985
|
+
tool_execution: {
|
|
8986
|
+
additionalProperties: false,
|
|
8987
|
+
properties: {
|
|
8988
|
+
mode: {
|
|
8989
|
+
"default": "server",
|
|
8990
|
+
"enum": [
|
|
8991
|
+
"server",
|
|
8992
|
+
"client"
|
|
8993
|
+
],
|
|
8994
|
+
type: "string"
|
|
8995
|
+
}
|
|
8996
|
+
},
|
|
8997
|
+
required: [
|
|
8998
|
+
"mode"
|
|
8999
|
+
],
|
|
9000
|
+
type: "object"
|
|
9001
|
+
},
|
|
9002
|
+
tool_limits: {
|
|
9003
|
+
additionalProperties: false,
|
|
9004
|
+
properties: {
|
|
9005
|
+
max_llm_calls: {
|
|
9006
|
+
"default": 8,
|
|
9007
|
+
maximum: 64,
|
|
9008
|
+
minimum: 1,
|
|
9009
|
+
type: "integer"
|
|
9010
|
+
},
|
|
9011
|
+
max_tool_calls_per_step: {
|
|
9012
|
+
"default": 16,
|
|
9013
|
+
maximum: 64,
|
|
9014
|
+
minimum: 1,
|
|
9015
|
+
type: "integer"
|
|
9016
|
+
},
|
|
9017
|
+
wait_ttl_ms: {
|
|
9018
|
+
"default": 900000,
|
|
9019
|
+
maximum: 86400000,
|
|
9020
|
+
minimum: 1,
|
|
9021
|
+
type: "integer"
|
|
9022
|
+
}
|
|
9023
|
+
},
|
|
9024
|
+
type: "object"
|
|
9025
|
+
}
|
|
9026
|
+
},
|
|
9027
|
+
required: [
|
|
9028
|
+
"request"
|
|
9029
|
+
],
|
|
9030
|
+
type: "object"
|
|
9031
|
+
}
|
|
9032
|
+
}
|
|
9033
|
+
}
|
|
9034
|
+
],
|
|
9035
|
+
properties: {
|
|
9036
|
+
type: {
|
|
9037
|
+
"const": "llm.responses"
|
|
9038
|
+
}
|
|
9039
|
+
},
|
|
9040
|
+
required: [
|
|
9041
|
+
"input"
|
|
9042
|
+
]
|
|
6900
9043
|
},
|
|
6901
|
-
to: {
|
|
6902
|
-
pattern: "^/.*$",
|
|
6903
|
-
type: "string"
|
|
6904
|
-
}
|
|
6905
|
-
},
|
|
6906
|
-
required: [
|
|
6907
|
-
"from",
|
|
6908
|
-
"to"
|
|
6909
|
-
],
|
|
6910
|
-
type: "object"
|
|
6911
|
-
},
|
|
6912
|
-
node: {
|
|
6913
|
-
additionalProperties: false,
|
|
6914
|
-
oneOf: [
|
|
6915
9044
|
{
|
|
6916
9045
|
allOf: [
|
|
6917
9046
|
{
|
|
@@ -6982,7 +9111,7 @@ var definitions = {
|
|
|
6982
9111
|
],
|
|
6983
9112
|
properties: {
|
|
6984
9113
|
type: {
|
|
6985
|
-
"const": "
|
|
9114
|
+
"const": "route.switch"
|
|
6986
9115
|
}
|
|
6987
9116
|
},
|
|
6988
9117
|
required: [
|
|
@@ -6996,6 +9125,61 @@ var definitions = {
|
|
|
6996
9125
|
}
|
|
6997
9126
|
}
|
|
6998
9127
|
},
|
|
9128
|
+
{
|
|
9129
|
+
allOf: [
|
|
9130
|
+
{
|
|
9131
|
+
properties: {
|
|
9132
|
+
input: {
|
|
9133
|
+
additionalProperties: false,
|
|
9134
|
+
properties: {
|
|
9135
|
+
predicate: {
|
|
9136
|
+
$ref: "#/definitions/condition"
|
|
9137
|
+
}
|
|
9138
|
+
},
|
|
9139
|
+
type: "object"
|
|
9140
|
+
}
|
|
9141
|
+
}
|
|
9142
|
+
}
|
|
9143
|
+
],
|
|
9144
|
+
properties: {
|
|
9145
|
+
type: {
|
|
9146
|
+
"const": "join.any"
|
|
9147
|
+
}
|
|
9148
|
+
}
|
|
9149
|
+
},
|
|
9150
|
+
{
|
|
9151
|
+
allOf: [
|
|
9152
|
+
{
|
|
9153
|
+
properties: {
|
|
9154
|
+
input: {
|
|
9155
|
+
additionalProperties: false,
|
|
9156
|
+
properties: {
|
|
9157
|
+
limit: {
|
|
9158
|
+
minimum: 1,
|
|
9159
|
+
type: "integer"
|
|
9160
|
+
},
|
|
9161
|
+
predicate: {
|
|
9162
|
+
$ref: "#/definitions/condition"
|
|
9163
|
+
},
|
|
9164
|
+
timeout_ms: {
|
|
9165
|
+
minimum: 1,
|
|
9166
|
+
type: "integer"
|
|
9167
|
+
}
|
|
9168
|
+
},
|
|
9169
|
+
type: "object"
|
|
9170
|
+
}
|
|
9171
|
+
}
|
|
9172
|
+
}
|
|
9173
|
+
],
|
|
9174
|
+
properties: {
|
|
9175
|
+
type: {
|
|
9176
|
+
"const": "join.collect"
|
|
9177
|
+
}
|
|
9178
|
+
},
|
|
9179
|
+
required: [
|
|
9180
|
+
"input"
|
|
9181
|
+
]
|
|
9182
|
+
},
|
|
6999
9183
|
{
|
|
7000
9184
|
allOf: [
|
|
7001
9185
|
{
|
|
@@ -7053,6 +9237,122 @@ var definitions = {
|
|
|
7053
9237
|
required: [
|
|
7054
9238
|
"input"
|
|
7055
9239
|
]
|
|
9240
|
+
},
|
|
9241
|
+
{
|
|
9242
|
+
allOf: [
|
|
9243
|
+
{
|
|
9244
|
+
properties: {
|
|
9245
|
+
input: {
|
|
9246
|
+
additionalProperties: false,
|
|
9247
|
+
properties: {
|
|
9248
|
+
item_bindings: {
|
|
9249
|
+
items: {
|
|
9250
|
+
$ref: "#/definitions/mapFanoutItemBinding"
|
|
9251
|
+
},
|
|
9252
|
+
type: "array"
|
|
9253
|
+
},
|
|
9254
|
+
items: {
|
|
9255
|
+
additionalProperties: false,
|
|
9256
|
+
properties: {
|
|
9257
|
+
from: {
|
|
9258
|
+
minLength: 1,
|
|
9259
|
+
type: "string"
|
|
9260
|
+
},
|
|
9261
|
+
path: {
|
|
9262
|
+
pattern: "^(/.*)?$",
|
|
9263
|
+
type: "string"
|
|
9264
|
+
},
|
|
9265
|
+
pointer: {
|
|
9266
|
+
pattern: "^(/.*)?$",
|
|
9267
|
+
type: "string"
|
|
9268
|
+
}
|
|
9269
|
+
},
|
|
9270
|
+
required: [
|
|
9271
|
+
"from"
|
|
9272
|
+
],
|
|
9273
|
+
type: "object"
|
|
9274
|
+
},
|
|
9275
|
+
max_parallelism: {
|
|
9276
|
+
minimum: 1,
|
|
9277
|
+
type: "integer"
|
|
9278
|
+
},
|
|
9279
|
+
subnode: {
|
|
9280
|
+
additionalProperties: false,
|
|
9281
|
+
properties: {
|
|
9282
|
+
id: {
|
|
9283
|
+
minLength: 1,
|
|
9284
|
+
type: "string"
|
|
9285
|
+
},
|
|
9286
|
+
input: {
|
|
9287
|
+
},
|
|
9288
|
+
type: {
|
|
9289
|
+
"enum": [
|
|
9290
|
+
"llm.responses",
|
|
9291
|
+
"route.switch",
|
|
9292
|
+
"transform.json"
|
|
9293
|
+
],
|
|
9294
|
+
type: "string"
|
|
9295
|
+
}
|
|
9296
|
+
},
|
|
9297
|
+
required: [
|
|
9298
|
+
"id",
|
|
9299
|
+
"type"
|
|
9300
|
+
],
|
|
9301
|
+
type: "object"
|
|
9302
|
+
}
|
|
9303
|
+
},
|
|
9304
|
+
required: [
|
|
9305
|
+
"items",
|
|
9306
|
+
"subnode"
|
|
9307
|
+
],
|
|
9308
|
+
type: "object"
|
|
9309
|
+
}
|
|
9310
|
+
}
|
|
9311
|
+
}
|
|
9312
|
+
],
|
|
9313
|
+
properties: {
|
|
9314
|
+
type: {
|
|
9315
|
+
"const": "map.fanout"
|
|
9316
|
+
}
|
|
9317
|
+
},
|
|
9318
|
+
required: [
|
|
9319
|
+
"input"
|
|
9320
|
+
]
|
|
9321
|
+
},
|
|
9322
|
+
{
|
|
9323
|
+
allOf: [
|
|
9324
|
+
{
|
|
9325
|
+
properties: {
|
|
9326
|
+
input: {
|
|
9327
|
+
additionalProperties: false,
|
|
9328
|
+
properties: {
|
|
9329
|
+
bind_inputs: {
|
|
9330
|
+
additionalProperties: {
|
|
9331
|
+
$ref: "#/definitions/fragmentBindInput"
|
|
9332
|
+
},
|
|
9333
|
+
type: "object"
|
|
9334
|
+
},
|
|
9335
|
+
ref: {
|
|
9336
|
+
minLength: 1,
|
|
9337
|
+
type: "string"
|
|
9338
|
+
}
|
|
9339
|
+
},
|
|
9340
|
+
required: [
|
|
9341
|
+
"ref"
|
|
9342
|
+
],
|
|
9343
|
+
type: "object"
|
|
9344
|
+
}
|
|
9345
|
+
}
|
|
9346
|
+
}
|
|
9347
|
+
],
|
|
9348
|
+
properties: {
|
|
9349
|
+
type: {
|
|
9350
|
+
"const": "fragment"
|
|
9351
|
+
}
|
|
9352
|
+
},
|
|
9353
|
+
required: [
|
|
9354
|
+
"input"
|
|
9355
|
+
]
|
|
7056
9356
|
}
|
|
7057
9357
|
],
|
|
7058
9358
|
properties: {
|
|
@@ -7065,8 +9365,13 @@ var definitions = {
|
|
|
7065
9365
|
type: {
|
|
7066
9366
|
"enum": [
|
|
7067
9367
|
"llm.responses",
|
|
9368
|
+
"route.switch",
|
|
7068
9369
|
"join.all",
|
|
7069
|
-
"
|
|
9370
|
+
"join.any",
|
|
9371
|
+
"join.collect",
|
|
9372
|
+
"transform.json",
|
|
9373
|
+
"map.fanout",
|
|
9374
|
+
"fragment"
|
|
7070
9375
|
],
|
|
7071
9376
|
type: "string"
|
|
7072
9377
|
}
|
|
@@ -7088,6 +9393,10 @@ var definitions = {
|
|
|
7088
9393
|
minLength: 1,
|
|
7089
9394
|
type: "string"
|
|
7090
9395
|
},
|
|
9396
|
+
output: {
|
|
9397
|
+
minLength: 1,
|
|
9398
|
+
type: "string"
|
|
9399
|
+
},
|
|
7091
9400
|
pointer: {
|
|
7092
9401
|
pattern: "^(/.*)?$",
|
|
7093
9402
|
type: "string"
|
|
@@ -7142,8 +9451,14 @@ var properties = {
|
|
|
7142
9451
|
},
|
|
7143
9452
|
type: "object"
|
|
7144
9453
|
},
|
|
9454
|
+
fragments: {
|
|
9455
|
+
additionalProperties: {
|
|
9456
|
+
$ref: "#/definitions/fragmentDef"
|
|
9457
|
+
},
|
|
9458
|
+
type: "object"
|
|
9459
|
+
},
|
|
7145
9460
|
kind: {
|
|
7146
|
-
"const": "workflow.
|
|
9461
|
+
"const": "workflow.v1",
|
|
7147
9462
|
type: "string"
|
|
7148
9463
|
},
|
|
7149
9464
|
name: {
|
|
@@ -7164,26 +9479,325 @@ var properties = {
|
|
|
7164
9479
|
type: "array"
|
|
7165
9480
|
}
|
|
7166
9481
|
};
|
|
7167
|
-
var required = [
|
|
7168
|
-
"kind",
|
|
7169
|
-
"nodes",
|
|
7170
|
-
"outputs"
|
|
7171
|
-
];
|
|
7172
|
-
var title = "ModelRelay workflow.
|
|
7173
|
-
var type = "object";
|
|
7174
|
-
var
|
|
7175
|
-
$id: $id,
|
|
7176
|
-
$schema: $schema,
|
|
7177
|
-
additionalProperties: additionalProperties,
|
|
7178
|
-
definitions: definitions,
|
|
7179
|
-
properties: properties,
|
|
7180
|
-
required: required,
|
|
7181
|
-
title: title,
|
|
7182
|
-
type: type
|
|
9482
|
+
var required = [
|
|
9483
|
+
"kind",
|
|
9484
|
+
"nodes",
|
|
9485
|
+
"outputs"
|
|
9486
|
+
];
|
|
9487
|
+
var title = "ModelRelay workflow.v1";
|
|
9488
|
+
var type = "object";
|
|
9489
|
+
var workflow_v1_schema = {
|
|
9490
|
+
$id: $id,
|
|
9491
|
+
$schema: $schema,
|
|
9492
|
+
additionalProperties: additionalProperties,
|
|
9493
|
+
definitions: definitions,
|
|
9494
|
+
properties: properties,
|
|
9495
|
+
required: required,
|
|
9496
|
+
title: title,
|
|
9497
|
+
type: type
|
|
9498
|
+
};
|
|
9499
|
+
|
|
9500
|
+
declare const WORKFLOWS_COMPILE_PATH = "/workflows/compile";
|
|
9501
|
+
type WorkflowsCompileRequestV0 = WorkflowSpecV0;
|
|
9502
|
+
type WorkflowsCompileRequestV1 = WorkflowSpecV1;
|
|
9503
|
+
|
|
9504
|
+
/**
|
|
9505
|
+
* High-level workflow pattern helpers for common workflow structures.
|
|
9506
|
+
*
|
|
9507
|
+
* These helpers reduce boilerplate for common patterns like sequential chains,
|
|
9508
|
+
* parallel execution with aggregation, and map-reduce processing.
|
|
9509
|
+
*
|
|
9510
|
+
* All builders are immutable - each method returns a new builder instance.
|
|
9511
|
+
*
|
|
9512
|
+
* @example
|
|
9513
|
+
* ```typescript
|
|
9514
|
+
* import { Chain, Parallel, MapReduce, LLMStep, MapItem } from 'modelrelay';
|
|
9515
|
+
*
|
|
9516
|
+
* // Chain pattern - sequential steps
|
|
9517
|
+
* const chainSpec = Chain('summarize-translate', [
|
|
9518
|
+
* LLMStep('summarize', summarizeReq),
|
|
9519
|
+
* LLMStep('translate', translateReq).withStream(),
|
|
9520
|
+
* ])
|
|
9521
|
+
* .outputLast('result')
|
|
9522
|
+
* .build();
|
|
9523
|
+
*
|
|
9524
|
+
* // Parallel pattern - concurrent steps with aggregation
|
|
9525
|
+
* const parallelSpec = Parallel('multi-model', [
|
|
9526
|
+
* LLMStep('gpt4', gpt4Req),
|
|
9527
|
+
* LLMStep('claude', claudeReq),
|
|
9528
|
+
* ])
|
|
9529
|
+
* .aggregate('synthesize', synthesizeReq)
|
|
9530
|
+
* .output('result', 'synthesize')
|
|
9531
|
+
* .build();
|
|
9532
|
+
*
|
|
9533
|
+
* // MapReduce pattern - parallel mappers with reducer
|
|
9534
|
+
* const mapReduceSpec = MapReduce('process-docs', [
|
|
9535
|
+
* MapItem('doc1', doc1Req),
|
|
9536
|
+
* MapItem('doc2', doc2Req),
|
|
9537
|
+
* ])
|
|
9538
|
+
* .reduce('combine', combineReq)
|
|
9539
|
+
* .output('result', 'combine')
|
|
9540
|
+
* .build();
|
|
9541
|
+
* ```
|
|
9542
|
+
*/
|
|
9543
|
+
|
|
9544
|
+
/**
|
|
9545
|
+
* Configuration for an LLM step in a workflow pattern.
|
|
9546
|
+
*/
|
|
9547
|
+
type LLMStepConfig = {
|
|
9548
|
+
readonly id: NodeId$1;
|
|
9549
|
+
readonly request: WireResponsesRequest;
|
|
9550
|
+
readonly stream: boolean;
|
|
9551
|
+
};
|
|
9552
|
+
/**
|
|
9553
|
+
* Creates an LLM step configuration for use with Chain or Parallel patterns.
|
|
9554
|
+
*
|
|
9555
|
+
* @param id - Unique node identifier
|
|
9556
|
+
* @param request - The LLM request configuration
|
|
9557
|
+
* @returns A step configuration object with fluent methods
|
|
9558
|
+
*
|
|
9559
|
+
* @example
|
|
9560
|
+
* ```typescript
|
|
9561
|
+
* const step = LLMStep('summarize', {
|
|
9562
|
+
* model: 'claude-sonnet-4-20250514',
|
|
9563
|
+
* input: [{ type: 'message', role: 'user', content: [{ type: 'text', text: 'Summarize...' }] }],
|
|
9564
|
+
* });
|
|
9565
|
+
*
|
|
9566
|
+
* // Enable streaming
|
|
9567
|
+
* const streamingStep = step.withStream();
|
|
9568
|
+
* ```
|
|
9569
|
+
*/
|
|
9570
|
+
declare function LLMStep(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): LLMStepConfig & {
|
|
9571
|
+
withStream(): LLMStepConfig;
|
|
9572
|
+
};
|
|
9573
|
+
/**
|
|
9574
|
+
* Immutable builder for sequential workflow where each step's output feeds into the next.
|
|
9575
|
+
*/
|
|
9576
|
+
declare class ChainBuilder {
|
|
9577
|
+
private readonly state;
|
|
9578
|
+
private constructor();
|
|
9579
|
+
static create(name: string, steps: readonly LLMStepConfig[]): ChainBuilder;
|
|
9580
|
+
private with;
|
|
9581
|
+
/**
|
|
9582
|
+
* Sets the workflow execution configuration.
|
|
9583
|
+
*/
|
|
9584
|
+
execution(exec: WorkflowSpecV0["execution"]): ChainBuilder;
|
|
9585
|
+
/**
|
|
9586
|
+
* Adds an output reference from a specific step.
|
|
9587
|
+
*/
|
|
9588
|
+
output(name: OutputName$1 | string, from: NodeId$1 | string): ChainBuilder;
|
|
9589
|
+
/**
|
|
9590
|
+
* Adds an output reference from the last step.
|
|
9591
|
+
*/
|
|
9592
|
+
outputLast(name: OutputName$1 | string): ChainBuilder;
|
|
9593
|
+
/**
|
|
9594
|
+
* Builds and returns the compiled workflow spec.
|
|
9595
|
+
* @throws Error if no steps are provided
|
|
9596
|
+
*/
|
|
9597
|
+
build(): WorkflowSpecV0;
|
|
9598
|
+
}
|
|
9599
|
+
/**
|
|
9600
|
+
* Creates a workflow builder for sequential LLM steps.
|
|
9601
|
+
* Each step after the first automatically binds its input from the previous step's text output.
|
|
9602
|
+
*
|
|
9603
|
+
* @param name - Workflow name
|
|
9604
|
+
* @param steps - Array of LLMStep configurations
|
|
9605
|
+
* @returns A ChainBuilder for further configuration
|
|
9606
|
+
*
|
|
9607
|
+
* @example
|
|
9608
|
+
* ```typescript
|
|
9609
|
+
* const spec = Chain('summarize-translate', [
|
|
9610
|
+
* LLMStep('summarize', summarizeReq),
|
|
9611
|
+
* LLMStep('translate', translateReq).withStream(),
|
|
9612
|
+
* LLMStep('format', formatReq),
|
|
9613
|
+
* ])
|
|
9614
|
+
* .outputLast('result')
|
|
9615
|
+
* .build();
|
|
9616
|
+
* ```
|
|
9617
|
+
*/
|
|
9618
|
+
declare function Chain(name: string, steps: readonly LLMStepConfig[]): ChainBuilder;
|
|
9619
|
+
/**
|
|
9620
|
+
* Immutable builder for workflow where multiple LLM steps execute in parallel,
|
|
9621
|
+
* with optional aggregation.
|
|
9622
|
+
*/
|
|
9623
|
+
declare class ParallelBuilder {
|
|
9624
|
+
private readonly state;
|
|
9625
|
+
private constructor();
|
|
9626
|
+
static create(name: string, steps: readonly LLMStepConfig[]): ParallelBuilder;
|
|
9627
|
+
private with;
|
|
9628
|
+
/**
|
|
9629
|
+
* Sets the workflow execution configuration.
|
|
9630
|
+
*/
|
|
9631
|
+
execution(exec: WorkflowSpecV0["execution"]): ParallelBuilder;
|
|
9632
|
+
/**
|
|
9633
|
+
* Adds a join node that waits for all parallel steps,
|
|
9634
|
+
* followed by an aggregator LLM node that receives the combined output.
|
|
9635
|
+
* The join node ID is automatically generated as "<id>_join".
|
|
9636
|
+
*/
|
|
9637
|
+
aggregate(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): ParallelBuilder;
|
|
9638
|
+
/**
|
|
9639
|
+
* Like aggregate() but enables streaming on the aggregator node.
|
|
9640
|
+
*/
|
|
9641
|
+
aggregateWithStream(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): ParallelBuilder;
|
|
9642
|
+
/**
|
|
9643
|
+
* Adds an output reference from a specific step.
|
|
9644
|
+
*/
|
|
9645
|
+
output(name: OutputName$1 | string, from: NodeId$1 | string): ParallelBuilder;
|
|
9646
|
+
/**
|
|
9647
|
+
* Builds and returns the compiled workflow spec.
|
|
9648
|
+
* @throws Error if no steps are provided
|
|
9649
|
+
*/
|
|
9650
|
+
build(): WorkflowSpecV0;
|
|
9651
|
+
}
|
|
9652
|
+
/**
|
|
9653
|
+
* Creates a workflow builder for parallel LLM steps.
|
|
9654
|
+
* All steps execute concurrently with no dependencies between them.
|
|
9655
|
+
*
|
|
9656
|
+
* @param name - Workflow name
|
|
9657
|
+
* @param steps - Array of LLMStep configurations
|
|
9658
|
+
* @returns A ParallelBuilder for further configuration
|
|
9659
|
+
*
|
|
9660
|
+
* @example
|
|
9661
|
+
* ```typescript
|
|
9662
|
+
* // Without aggregation - just parallel execution
|
|
9663
|
+
* const spec = Parallel('multi-model', [
|
|
9664
|
+
* LLMStep('gpt4', gpt4Req),
|
|
9665
|
+
* LLMStep('claude', claudeReq),
|
|
9666
|
+
* ])
|
|
9667
|
+
* .output('gpt4_result', 'gpt4')
|
|
9668
|
+
* .output('claude_result', 'claude')
|
|
9669
|
+
* .build();
|
|
9670
|
+
*
|
|
9671
|
+
* // With aggregation - parallel then combine
|
|
9672
|
+
* const spec = Parallel('multi-model', [
|
|
9673
|
+
* LLMStep('gpt4', gpt4Req),
|
|
9674
|
+
* LLMStep('claude', claudeReq),
|
|
9675
|
+
* ])
|
|
9676
|
+
* .aggregate('synthesize', synthesizeReq)
|
|
9677
|
+
* .output('result', 'synthesize')
|
|
9678
|
+
* .build();
|
|
9679
|
+
* ```
|
|
9680
|
+
*/
|
|
9681
|
+
declare function Parallel(name: string, steps: readonly LLMStepConfig[]): ParallelBuilder;
|
|
9682
|
+
/**
|
|
9683
|
+
* Configuration for a map item in MapReduce.
|
|
9684
|
+
*/
|
|
9685
|
+
type MapItemConfig = {
|
|
9686
|
+
readonly id: string;
|
|
9687
|
+
readonly request: WireResponsesRequest;
|
|
9688
|
+
readonly stream: boolean;
|
|
9689
|
+
};
|
|
9690
|
+
/**
|
|
9691
|
+
* Creates a map item configuration for use with MapReduce pattern.
|
|
9692
|
+
* Each item becomes a separate mapper node that runs in parallel.
|
|
9693
|
+
*
|
|
9694
|
+
* @param id - Unique identifier for this item (becomes part of node ID: "map_<id>")
|
|
9695
|
+
* @param request - The LLM request for processing this item
|
|
9696
|
+
* @returns A map item configuration object with fluent methods
|
|
9697
|
+
*
|
|
9698
|
+
* @example
|
|
9699
|
+
* ```typescript
|
|
9700
|
+
* const item = MapItem('doc1', {
|
|
9701
|
+
* model: 'claude-sonnet-4-20250514',
|
|
9702
|
+
* input: [{ type: 'message', role: 'user', content: [{ type: 'text', text: 'Summarize doc1...' }] }],
|
|
9703
|
+
* });
|
|
9704
|
+
*
|
|
9705
|
+
* // Enable streaming
|
|
9706
|
+
* const streamingItem = item.withStream();
|
|
9707
|
+
* ```
|
|
9708
|
+
*/
|
|
9709
|
+
declare function MapItem(id: string, request: WireResponsesRequest | ResponsesRequest): MapItemConfig & {
|
|
9710
|
+
withStream(): MapItemConfig;
|
|
7183
9711
|
};
|
|
9712
|
+
/**
|
|
9713
|
+
* Immutable builder for workflow where items are processed in parallel by mapper nodes,
|
|
9714
|
+
* then combined by a reducer node.
|
|
9715
|
+
*
|
|
9716
|
+
* The pattern creates:
|
|
9717
|
+
* - N mapper nodes (one per item), running in parallel
|
|
9718
|
+
* - A join.all node to collect all mapper outputs
|
|
9719
|
+
* - A reducer LLM node that receives the combined outputs
|
|
9720
|
+
*
|
|
9721
|
+
* Note: Items must be known at workflow build time. For dynamic array
|
|
9722
|
+
* processing at runtime, server-side support for dynamic node instantiation
|
|
9723
|
+
* would be required.
|
|
9724
|
+
*/
|
|
9725
|
+
declare class MapReduceBuilder {
|
|
9726
|
+
private readonly state;
|
|
9727
|
+
private constructor();
|
|
9728
|
+
static create(name: string, items: readonly MapItemConfig[]): MapReduceBuilder;
|
|
9729
|
+
private with;
|
|
9730
|
+
/**
|
|
9731
|
+
* Adds a mapper item to the workflow.
|
|
9732
|
+
* Each item becomes a separate LLM node that runs in parallel.
|
|
9733
|
+
*/
|
|
9734
|
+
item(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
|
|
9735
|
+
/**
|
|
9736
|
+
* Adds a mapper item with streaming enabled.
|
|
9737
|
+
*/
|
|
9738
|
+
itemWithStream(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
|
|
9739
|
+
/**
|
|
9740
|
+
* Sets the workflow execution configuration.
|
|
9741
|
+
*/
|
|
9742
|
+
execution(exec: WorkflowSpecV0["execution"]): MapReduceBuilder;
|
|
9743
|
+
/**
|
|
9744
|
+
* Adds a reducer node that receives all mapper outputs.
|
|
9745
|
+
* The reducer receives a JSON object mapping each mapper ID to its text output.
|
|
9746
|
+
* The join node ID is automatically generated as "<id>_join".
|
|
9747
|
+
*/
|
|
9748
|
+
reduce(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
|
|
9749
|
+
/**
|
|
9750
|
+
* Like reduce() but enables streaming on the reducer node.
|
|
9751
|
+
*/
|
|
9752
|
+
reduceWithStream(id: NodeId$1 | string, request: WireResponsesRequest | ResponsesRequest): MapReduceBuilder;
|
|
9753
|
+
/**
|
|
9754
|
+
* Adds an output reference from a specific node.
|
|
9755
|
+
* Typically used to output from the reducer node.
|
|
9756
|
+
*/
|
|
9757
|
+
output(name: OutputName$1 | string, from: NodeId$1 | string): MapReduceBuilder;
|
|
9758
|
+
/**
|
|
9759
|
+
* Builds and returns the compiled workflow spec.
|
|
9760
|
+
* @throws Error if no items are provided or no reducer is configured
|
|
9761
|
+
*/
|
|
9762
|
+
build(): WorkflowSpecV0;
|
|
9763
|
+
}
|
|
9764
|
+
/**
|
|
9765
|
+
* Creates a workflow builder for parallel map-reduce processing.
|
|
9766
|
+
* Each item is processed by a separate mapper node, and results are combined
|
|
9767
|
+
* by a reducer node.
|
|
9768
|
+
*
|
|
9769
|
+
* @param name - Workflow name
|
|
9770
|
+
* @param items - Optional array of MapItem configurations (can also use .item() builder)
|
|
9771
|
+
* @returns A MapReduceBuilder for further configuration
|
|
9772
|
+
*
|
|
9773
|
+
* @example
|
|
9774
|
+
* ```typescript
|
|
9775
|
+
* // Fluent builder pattern (preferred)
|
|
9776
|
+
* const spec = mapReduce('summarize-docs')
|
|
9777
|
+
* .item('doc1', doc1Req)
|
|
9778
|
+
* .item('doc2', doc2Req)
|
|
9779
|
+
* .reduce('combine', combineReq)
|
|
9780
|
+
* .output(parseOutputName('result'), 'combine')
|
|
9781
|
+
* .build();
|
|
9782
|
+
* ```
|
|
9783
|
+
*/
|
|
9784
|
+
declare function MapReduce(name: string, items?: readonly MapItemConfig[]): MapReduceBuilder;
|
|
7184
9785
|
|
|
7185
|
-
|
|
7186
|
-
|
|
9786
|
+
type NDJSONDelayStep = {
|
|
9787
|
+
delayMs: number;
|
|
9788
|
+
line: string;
|
|
9789
|
+
};
|
|
9790
|
+
declare function buildNDJSONResponse(lines: string[], headers?: Record<string, string>, status?: number): Response;
|
|
9791
|
+
declare function buildDelayedNDJSONResponse(steps: NDJSONDelayStep[], headers?: Record<string, string>, status?: number): Response;
|
|
9792
|
+
type MockFetchCall = {
|
|
9793
|
+
url: string;
|
|
9794
|
+
init?: RequestInit;
|
|
9795
|
+
};
|
|
9796
|
+
type MockFetchResponder = Response | ((call: MockFetchCall, index: number) => Response | Promise<Response>);
|
|
9797
|
+
declare function createMockFetchQueue(responses: MockFetchResponder[]): {
|
|
9798
|
+
fetch: typeof fetch;
|
|
9799
|
+
calls: MockFetchCall[];
|
|
9800
|
+
};
|
|
7187
9801
|
|
|
7188
9802
|
declare function parseApiKey(raw: string): ApiKey;
|
|
7189
9803
|
declare function parsePublishableKey(raw: string): PublishableKey;
|
|
@@ -7554,13 +10168,13 @@ interface ToolRunnerOptions {
|
|
|
7554
10168
|
/** Customer ID for attributed requests (optional). */
|
|
7555
10169
|
customerId?: string;
|
|
7556
10170
|
/** Called before executing each tool call (optional). */
|
|
7557
|
-
onBeforeExecute?: (pending: PendingToolCallV0) => void | Promise<void>;
|
|
10171
|
+
onBeforeExecute?: (pending: PendingToolCallV0$1) => void | Promise<void>;
|
|
7558
10172
|
/** Called after each tool execution (optional). */
|
|
7559
10173
|
onAfterExecute?: (result: ToolExecutionResult) => void | Promise<void>;
|
|
7560
10174
|
/** Called when results are successfully submitted (optional). */
|
|
7561
|
-
onSubmitted?: (runId: RunId, count: number, status: RunStatusV0) => void | Promise<void>;
|
|
10175
|
+
onSubmitted?: (runId: RunId$1, count: number, status: RunStatusV0) => void | Promise<void>;
|
|
7562
10176
|
/** Called when an error occurs during execution (optional). */
|
|
7563
|
-
onError?: (error: Error, pending?: PendingToolCallV0) => void | Promise<void>;
|
|
10177
|
+
onError?: (error: Error, pending?: PendingToolCallV0$1) => void | Promise<void>;
|
|
7564
10178
|
}
|
|
7565
10179
|
/** Response from handling a node_waiting event. */
|
|
7566
10180
|
interface HandleWaitingResult {
|
|
@@ -7628,7 +10242,7 @@ declare class ToolRunner {
|
|
|
7628
10242
|
* }
|
|
7629
10243
|
* ```
|
|
7630
10244
|
*/
|
|
7631
|
-
handleNodeWaiting(runId: RunId, nodeId: NodeId, waiting: NodeWaitingV0): Promise<HandleWaitingResult>;
|
|
10245
|
+
handleNodeWaiting(runId: RunId$1, nodeId: NodeId$1, waiting: NodeWaitingV0$1): Promise<HandleWaitingResult>;
|
|
7632
10246
|
/**
|
|
7633
10247
|
* Processes a stream of run events, automatically handling node_waiting events.
|
|
7634
10248
|
*
|
|
@@ -7659,7 +10273,7 @@ declare class ToolRunner {
|
|
|
7659
10273
|
* }
|
|
7660
10274
|
* ```
|
|
7661
10275
|
*/
|
|
7662
|
-
processEvents(runId: RunId, events: AsyncIterable<RunEventV0>): AsyncGenerator<RunEventV0, void, undefined>;
|
|
10276
|
+
processEvents(runId: RunId$1, events: AsyncIterable<RunEventV0>): AsyncGenerator<RunEventV0, void, undefined>;
|
|
7663
10277
|
/**
|
|
7664
10278
|
* Checks if a run event is a node_waiting event.
|
|
7665
10279
|
* Utility for filtering events when not using processEvents().
|
|
@@ -7686,13 +10300,569 @@ declare class ToolRunner {
|
|
|
7686
10300
|
*/
|
|
7687
10301
|
declare function createToolRunner(options: ToolRunnerOptions): ToolRunner;
|
|
7688
10302
|
|
|
7689
|
-
type
|
|
7690
|
-
type
|
|
7691
|
-
type
|
|
7692
|
-
type
|
|
7693
|
-
type
|
|
10303
|
+
type index$1_$defs = $defs;
|
|
10304
|
+
type index$1_components = components;
|
|
10305
|
+
type index$1_operations = operations;
|
|
10306
|
+
type index$1_paths = paths;
|
|
10307
|
+
type index$1_webhooks = webhooks;
|
|
10308
|
+
declare namespace index$1 {
|
|
10309
|
+
export type { index$1_$defs as $defs, index$1_components as components, index$1_operations as operations, index$1_paths as paths, index$1_webhooks as webhooks };
|
|
10310
|
+
}
|
|
10311
|
+
|
|
10312
|
+
/**
|
|
10313
|
+
* Helper functions for constructing workflow.v1 conditions and bindings.
|
|
10314
|
+
*
|
|
10315
|
+
* These factory functions reduce boilerplate when building conditional edges
|
|
10316
|
+
* and node bindings.
|
|
10317
|
+
*
|
|
10318
|
+
* @example
|
|
10319
|
+
* ```typescript
|
|
10320
|
+
* import { workflow, workflowV1 } from "@modelrelay/sdk";
|
|
10321
|
+
* import { whenOutputEquals, bindToPlaceholder } from "@modelrelay/sdk/workflow";
|
|
10322
|
+
*
|
|
10323
|
+
* const spec = workflowV1()
|
|
10324
|
+
* .routeSwitch("router", request)
|
|
10325
|
+
* .llmResponses("billing", billingReq, {
|
|
10326
|
+
* bindings: [bindToPlaceholder("router", "route_data")]
|
|
10327
|
+
* })
|
|
10328
|
+
* .edge("router", "billing", whenOutputEquals("$.route", "billing"))
|
|
10329
|
+
* .build();
|
|
10330
|
+
* ```
|
|
10331
|
+
*/
|
|
10332
|
+
|
|
10333
|
+
/**
|
|
10334
|
+
* Create a condition that matches when a node's output equals a specific value.
|
|
10335
|
+
*
|
|
10336
|
+
* @param path - JSONPath expression to extract the value (must start with $)
|
|
10337
|
+
* @param value - The value to compare against
|
|
10338
|
+
* @returns A condition for use in edge `when` clauses
|
|
10339
|
+
*
|
|
10340
|
+
* @example
|
|
10341
|
+
* ```typescript
|
|
10342
|
+
* builder.edge("router", "billing", whenOutputEquals("$.route", "billing"))
|
|
10343
|
+
* ```
|
|
10344
|
+
*/
|
|
10345
|
+
declare function whenOutputEquals(path: string, value: unknown): ConditionV1$1;
|
|
10346
|
+
/**
|
|
10347
|
+
* Create a condition that matches when a node's output matches a regex pattern.
|
|
10348
|
+
*
|
|
10349
|
+
* @param path - JSONPath expression to extract the value (must start with $)
|
|
10350
|
+
* @param pattern - Regular expression pattern to match
|
|
10351
|
+
* @returns A condition for use in edge `when` clauses
|
|
10352
|
+
*
|
|
10353
|
+
* @example
|
|
10354
|
+
* ```typescript
|
|
10355
|
+
* builder.edge("router", "handler", whenOutputMatches("$.category", "billing|support"))
|
|
10356
|
+
* ```
|
|
10357
|
+
*/
|
|
10358
|
+
declare function whenOutputMatches(path: string, pattern: string): ConditionV1$1;
|
|
10359
|
+
/**
|
|
10360
|
+
* Create a condition that matches when a path exists in the node's output.
|
|
10361
|
+
*
|
|
10362
|
+
* @param path - JSONPath expression to check for existence (must start with $)
|
|
10363
|
+
* @returns A condition for use in edge `when` clauses
|
|
10364
|
+
*
|
|
10365
|
+
* @example
|
|
10366
|
+
* ```typescript
|
|
10367
|
+
* builder.edge("router", "handler", whenOutputExists("$.special_case"))
|
|
10368
|
+
* ```
|
|
10369
|
+
*/
|
|
10370
|
+
declare function whenOutputExists(path: string): ConditionV1$1;
|
|
10371
|
+
/**
|
|
10372
|
+
* Create a condition that matches when a node's status equals a specific value.
|
|
10373
|
+
*
|
|
10374
|
+
* @param path - JSONPath expression to extract the status value (must start with $)
|
|
10375
|
+
* @param value - The status value to compare against
|
|
10376
|
+
* @returns A condition for use in edge `when` clauses
|
|
10377
|
+
*
|
|
10378
|
+
* @example
|
|
10379
|
+
* ```typescript
|
|
10380
|
+
* builder.edge("node", "handler", whenStatusEquals("$.status", "succeeded"))
|
|
10381
|
+
* ```
|
|
10382
|
+
*/
|
|
10383
|
+
declare function whenStatusEquals(path: string, value: unknown): ConditionV1$1;
|
|
10384
|
+
/**
|
|
10385
|
+
* Create a condition that matches when a node's status matches a regex pattern.
|
|
10386
|
+
*
|
|
10387
|
+
* @param path - JSONPath expression to extract the status value (must start with $)
|
|
10388
|
+
* @param pattern - Regular expression pattern to match
|
|
10389
|
+
* @returns A condition for use in edge `when` clauses
|
|
10390
|
+
*/
|
|
10391
|
+
declare function whenStatusMatches(path: string, pattern: string): ConditionV1$1;
|
|
10392
|
+
/**
|
|
10393
|
+
* Create a condition that matches when a path exists in the node's status.
|
|
10394
|
+
*
|
|
10395
|
+
* @param path - JSONPath expression to check for existence (must start with $)
|
|
10396
|
+
* @returns A condition for use in edge `when` clauses
|
|
10397
|
+
*/
|
|
10398
|
+
declare function whenStatusExists(path: string): ConditionV1$1;
|
|
10399
|
+
/**
|
|
10400
|
+
* Options for binding factory functions.
|
|
10401
|
+
*/
|
|
10402
|
+
interface BindingOptions {
|
|
10403
|
+
/** JSON pointer to extract from the source node's output */
|
|
10404
|
+
pointer?: string;
|
|
10405
|
+
/** Encoding to use (defaults to "json_string") */
|
|
10406
|
+
encoding?: LLMResponsesBindingEncodingV1;
|
|
10407
|
+
}
|
|
10408
|
+
/**
|
|
10409
|
+
* Create a binding that injects a value into a {{placeholder}} in the prompt.
|
|
10410
|
+
*
|
|
10411
|
+
* @param from - Source node ID
|
|
10412
|
+
* @param placeholder - Placeholder name (without the {{ }} delimiters)
|
|
10413
|
+
* @param opts - Optional pointer and encoding settings
|
|
10414
|
+
* @returns A binding for use in node input
|
|
10415
|
+
*
|
|
10416
|
+
* @example
|
|
10417
|
+
* ```typescript
|
|
10418
|
+
* builder.llmResponses("aggregate", request, {
|
|
10419
|
+
* bindings: [
|
|
10420
|
+
* bindToPlaceholder("join", "route_output"),
|
|
10421
|
+
* bindToPlaceholder("data", "user_data", { pointer: "/results" })
|
|
10422
|
+
* ]
|
|
10423
|
+
* })
|
|
10424
|
+
* ```
|
|
10425
|
+
*/
|
|
10426
|
+
declare function bindToPlaceholder(from: NodeId$1, placeholder: string, opts?: BindingOptions): LLMResponsesBindingV1;
|
|
10427
|
+
/**
|
|
10428
|
+
* Create a binding that injects a value at a specific JSON pointer in the request.
|
|
10429
|
+
*
|
|
10430
|
+
* @param from - Source node ID
|
|
10431
|
+
* @param to - JSON pointer in the request to inject the value
|
|
10432
|
+
* @param opts - Optional pointer and encoding settings
|
|
10433
|
+
* @returns A binding for use in node input
|
|
10434
|
+
*
|
|
10435
|
+
* @example
|
|
10436
|
+
* ```typescript
|
|
10437
|
+
* builder.llmResponses("processor", request, {
|
|
10438
|
+
* bindings: [
|
|
10439
|
+
* bindToPointer("source", "/input/0/content/0/text")
|
|
10440
|
+
* ]
|
|
10441
|
+
* })
|
|
10442
|
+
* ```
|
|
10443
|
+
*/
|
|
10444
|
+
declare function bindToPointer(from: NodeId$1, to: string, opts?: BindingOptions): LLMResponsesBindingV1;
|
|
10445
|
+
/**
|
|
10446
|
+
* Create a binding from a source node with full control over all fields.
|
|
10447
|
+
*
|
|
10448
|
+
* @param from - Source node ID
|
|
10449
|
+
* @returns A builder for fluent binding construction
|
|
10450
|
+
*
|
|
10451
|
+
* @example
|
|
10452
|
+
* ```typescript
|
|
10453
|
+
* const binding = bindFrom("source")
|
|
10454
|
+
* .pointer("/output/text")
|
|
10455
|
+
* .toPlaceholder("data")
|
|
10456
|
+
* .encoding("json")
|
|
10457
|
+
* .build();
|
|
10458
|
+
* ```
|
|
10459
|
+
*/
|
|
10460
|
+
declare function bindFrom(from: NodeId$1): BindingBuilder;
|
|
10461
|
+
/**
|
|
10462
|
+
* Fluent builder for constructing bindings.
|
|
10463
|
+
*/
|
|
10464
|
+
declare class BindingBuilder {
|
|
10465
|
+
private _from;
|
|
10466
|
+
private _pointer?;
|
|
10467
|
+
private _to?;
|
|
10468
|
+
private _toPlaceholder?;
|
|
10469
|
+
private _encoding;
|
|
10470
|
+
constructor(from: NodeId$1);
|
|
10471
|
+
/**
|
|
10472
|
+
* Set the source pointer to extract from the node's output.
|
|
10473
|
+
*/
|
|
10474
|
+
pointer(ptr: string): BindingBuilder;
|
|
10475
|
+
/**
|
|
10476
|
+
* Set the destination JSON pointer in the request.
|
|
10477
|
+
*/
|
|
10478
|
+
to(ptr: string): BindingBuilder;
|
|
10479
|
+
/**
|
|
10480
|
+
* Set the destination placeholder name.
|
|
10481
|
+
*/
|
|
10482
|
+
toPlaceholder(name: string): BindingBuilder;
|
|
10483
|
+
/**
|
|
10484
|
+
* Set the encoding for the binding value.
|
|
10485
|
+
*/
|
|
10486
|
+
encoding(enc: LLMResponsesBindingEncodingV1): BindingBuilder;
|
|
10487
|
+
/**
|
|
10488
|
+
* Build the binding object.
|
|
10489
|
+
*/
|
|
10490
|
+
build(): LLMResponsesBindingV1;
|
|
10491
|
+
}
|
|
10492
|
+
|
|
10493
|
+
/**
|
|
10494
|
+
* High-level pattern builders for workflow.v1.
|
|
10495
|
+
*
|
|
10496
|
+
* These builders provide ergonomic construction of common workflow patterns
|
|
10497
|
+
* like routing and fan-out/reduce, similar to the v0 Chain/Parallel/MapReduce patterns.
|
|
10498
|
+
*
|
|
10499
|
+
* @example
|
|
10500
|
+
* ```typescript
|
|
10501
|
+
* import { RouterV1, FanoutReduceV1 } from "@modelrelay/sdk/workflow";
|
|
10502
|
+
*
|
|
10503
|
+
* // Router pattern: classify input and route to specialized handlers
|
|
10504
|
+
* const routerSpec = new RouterV1({
|
|
10505
|
+
* classifier: { model: "gpt-4o-mini", input: [...] },
|
|
10506
|
+
* routes: [
|
|
10507
|
+
* { value: "billing", handler: { model: "gpt-4o", input: [...] } },
|
|
10508
|
+
* { value: "support", handler: { model: "gpt-4o", input: [...] } },
|
|
10509
|
+
* ]
|
|
10510
|
+
* }).build();
|
|
10511
|
+
*
|
|
10512
|
+
* // FanoutReduce pattern: generate items, process each, aggregate
|
|
10513
|
+
* const fanoutSpec = new FanoutReduceV1({
|
|
10514
|
+
* generator: { model: "gpt-4o-mini", input: [...] },
|
|
10515
|
+
* itemsPath: "/questions",
|
|
10516
|
+
* mapperPlaceholder: "question",
|
|
10517
|
+
* mapper: { model: "gpt-4o", input: [...] },
|
|
10518
|
+
* reducer: { model: "gpt-4o", input: [...] },
|
|
10519
|
+
* }).build();
|
|
10520
|
+
* ```
|
|
10521
|
+
*/
|
|
10522
|
+
|
|
10523
|
+
/**
|
|
10524
|
+
* A route definition for the router pattern.
|
|
10525
|
+
*/
|
|
10526
|
+
interface RouterRouteV1 {
|
|
10527
|
+
/** The value to match in the router output (at routePath) */
|
|
10528
|
+
value: string;
|
|
10529
|
+
/** The handler node ID (auto-generated if not provided) */
|
|
10530
|
+
id?: NodeId$1;
|
|
10531
|
+
/** The LLM request for this route's handler */
|
|
10532
|
+
handler: WireResponsesRequest | ResponsesRequest;
|
|
10533
|
+
/** Optional bindings for the handler */
|
|
10534
|
+
bindings?: ReadonlyArray<LLMResponsesBindingV1>;
|
|
10535
|
+
}
|
|
10536
|
+
/**
|
|
10537
|
+
* Configuration for the RouterV1 pattern builder.
|
|
10538
|
+
*/
|
|
10539
|
+
interface RouterConfigV1 {
|
|
10540
|
+
/** Optional workflow name */
|
|
10541
|
+
name?: string;
|
|
10542
|
+
/** The classifier/router node configuration */
|
|
10543
|
+
classifier: WireResponsesRequest | ResponsesRequest;
|
|
10544
|
+
/** Optional classifier node ID (defaults to "router") */
|
|
10545
|
+
classifierId?: NodeId$1;
|
|
10546
|
+
/** JSONPath to extract the route value from classifier output (defaults to "$.route") */
|
|
10547
|
+
routePath?: string;
|
|
10548
|
+
/** Route definitions mapping values to handlers */
|
|
10549
|
+
routes: RouterRouteV1[];
|
|
10550
|
+
/** Optional aggregator node to combine results */
|
|
10551
|
+
aggregator?: {
|
|
10552
|
+
/** Aggregator node ID (defaults to "aggregate") */
|
|
10553
|
+
id?: NodeId$1;
|
|
10554
|
+
/** The LLM request for aggregation */
|
|
10555
|
+
request: WireResponsesRequest | ResponsesRequest;
|
|
10556
|
+
/** Placeholder name for injecting the routed result (defaults to "route_output") */
|
|
10557
|
+
placeholder?: string;
|
|
10558
|
+
};
|
|
10559
|
+
/** Output name (defaults to "final") */
|
|
10560
|
+
outputName?: OutputName$1;
|
|
10561
|
+
}
|
|
10562
|
+
/**
|
|
10563
|
+
* Builder for the Router pattern in workflow.v1.
|
|
10564
|
+
*
|
|
10565
|
+
* The router pattern classifies input and routes to specialized handlers
|
|
10566
|
+
* based on the classification result. A join.any node collects the first
|
|
10567
|
+
* successful handler response.
|
|
10568
|
+
*
|
|
10569
|
+
* Topology:
|
|
10570
|
+
* ```
|
|
10571
|
+
* classifier --[when=billing]--> billing_handler --\
|
|
10572
|
+
* --[when=support]--> support_handler --> join.any --> [aggregator]
|
|
10573
|
+
* --[when=sales]--> sales_handler ----/
|
|
10574
|
+
* ```
|
|
10575
|
+
*
|
|
10576
|
+
* @example
|
|
10577
|
+
* ```typescript
|
|
10578
|
+
* const spec = new RouterV1({
|
|
10579
|
+
* classifier: {
|
|
10580
|
+
* model: "gpt-4o-mini",
|
|
10581
|
+
* input: [{ role: "user", content: "Classify: {{query}}" }]
|
|
10582
|
+
* },
|
|
10583
|
+
* routes: [
|
|
10584
|
+
* { value: "billing", handler: { model: "gpt-4o", input: [...] } },
|
|
10585
|
+
* { value: "support", handler: { model: "gpt-4o", input: [...] } },
|
|
10586
|
+
* ],
|
|
10587
|
+
* aggregator: {
|
|
10588
|
+
* request: { model: "gpt-4o", input: [...] },
|
|
10589
|
+
* placeholder: "route_output"
|
|
10590
|
+
* }
|
|
10591
|
+
* }).build();
|
|
10592
|
+
* ```
|
|
10593
|
+
*/
|
|
10594
|
+
declare class RouterV1 {
|
|
10595
|
+
private readonly config;
|
|
10596
|
+
constructor(config: RouterConfigV1);
|
|
10597
|
+
/**
|
|
10598
|
+
* Build the workflow specification.
|
|
10599
|
+
*/
|
|
10600
|
+
build(): WorkflowSpecV1;
|
|
10601
|
+
}
|
|
10602
|
+
/**
|
|
10603
|
+
* Configuration for the FanoutReduceV1 pattern builder.
|
|
10604
|
+
*/
|
|
10605
|
+
interface FanoutReduceConfigV1 {
|
|
10606
|
+
/** Optional workflow name */
|
|
10607
|
+
name?: string;
|
|
10608
|
+
/** The generator node that produces items to process */
|
|
10609
|
+
generator: WireResponsesRequest | ResponsesRequest;
|
|
10610
|
+
/** Generator node ID (defaults to "generator") */
|
|
10611
|
+
generatorId?: NodeId$1;
|
|
10612
|
+
/** JSON Pointer to extract items array from generator output (defaults to "/items") */
|
|
10613
|
+
itemsPath?: string;
|
|
10614
|
+
/** The mapper subnode template (processes each item) */
|
|
10615
|
+
mapper: WireResponsesRequest | ResponsesRequest;
|
|
10616
|
+
/** Placeholder name for item injection in mapper (defaults to "item") */
|
|
10617
|
+
mapperPlaceholder?: string;
|
|
10618
|
+
/** Maximum parallel mapper executions (defaults to 4) */
|
|
10619
|
+
maxParallelism?: number;
|
|
10620
|
+
/** The reducer node that aggregates results */
|
|
10621
|
+
reducer: WireResponsesRequest | ResponsesRequest;
|
|
10622
|
+
/** Reducer node ID (defaults to "reducer") */
|
|
10623
|
+
reducerId?: NodeId$1;
|
|
10624
|
+
/** How to inject fanout results into reducer */
|
|
10625
|
+
reducerBinding?: {
|
|
10626
|
+
/** Pointer to extract from fanout output (defaults to "/results") */
|
|
10627
|
+
pointer?: string;
|
|
10628
|
+
/** Placeholder name for injection (uses to_placeholder if set) */
|
|
10629
|
+
placeholder?: string;
|
|
10630
|
+
/** JSON pointer for injection (uses to if set, defaults to user message text) */
|
|
10631
|
+
to?: string;
|
|
10632
|
+
};
|
|
10633
|
+
/** Output name (defaults to "final") */
|
|
10634
|
+
outputName?: OutputName$1;
|
|
10635
|
+
}
|
|
10636
|
+
/**
|
|
10637
|
+
* Builder for the FanoutReduce pattern in workflow.v1.
|
|
10638
|
+
*
|
|
10639
|
+
* The fanout/reduce pattern generates a list of items, processes each item
|
|
10640
|
+
* in parallel using a mapper node, then aggregates all results.
|
|
10641
|
+
*
|
|
10642
|
+
* Topology:
|
|
10643
|
+
* ```
|
|
10644
|
+
* generator --> map.fanout(mapper) --> reducer
|
|
10645
|
+
* ```
|
|
10646
|
+
*
|
|
10647
|
+
* @example
|
|
10648
|
+
* ```typescript
|
|
10649
|
+
* const spec = new FanoutReduceV1({
|
|
10650
|
+
* generator: {
|
|
10651
|
+
* model: "gpt-4o-mini",
|
|
10652
|
+
* input: [{ role: "user", content: "Generate 3 questions about {{topic}}" }]
|
|
10653
|
+
* },
|
|
10654
|
+
* itemsPath: "/questions",
|
|
10655
|
+
* mapperPlaceholder: "question",
|
|
10656
|
+
* mapper: {
|
|
10657
|
+
* model: "gpt-4o",
|
|
10658
|
+
* input: [{ role: "system", content: "Answer: {{question}}" }]
|
|
10659
|
+
* },
|
|
10660
|
+
* reducer: {
|
|
10661
|
+
* model: "gpt-4o",
|
|
10662
|
+
* input: [{ role: "system", content: "Combine answers: {{results}}" }]
|
|
10663
|
+
* },
|
|
10664
|
+
* reducerBinding: { placeholder: "results" },
|
|
10665
|
+
* maxParallelism: 4,
|
|
10666
|
+
* }).build();
|
|
10667
|
+
* ```
|
|
10668
|
+
*/
|
|
10669
|
+
declare class FanoutReduceV1 {
|
|
10670
|
+
private readonly config;
|
|
10671
|
+
constructor(config: FanoutReduceConfigV1);
|
|
10672
|
+
/**
|
|
10673
|
+
* Build the workflow specification.
|
|
10674
|
+
*/
|
|
10675
|
+
build(): WorkflowSpecV1;
|
|
10676
|
+
}
|
|
10677
|
+
|
|
10678
|
+
/**
|
|
10679
|
+
* Workflow types with clean naming (no Workflow prefix).
|
|
10680
|
+
*
|
|
10681
|
+
* @example
|
|
10682
|
+
* ```typescript
|
|
10683
|
+
* import { workflow } from "@modelrelay/sdk";
|
|
10684
|
+
*
|
|
10685
|
+
* const spec: workflow.SpecV0 = {
|
|
10686
|
+
* kind: workflow.KindV0,
|
|
10687
|
+
* nodes: [{ id: "my_node", type: workflow.NodeTypes.LLMResponses, input: {...} }],
|
|
10688
|
+
* outputs: [],
|
|
10689
|
+
* };
|
|
10690
|
+
* ```
|
|
10691
|
+
*/
|
|
10692
|
+
|
|
10693
|
+
type NodeId = NodeId$1;
|
|
10694
|
+
type OutputName = OutputName$1;
|
|
10695
|
+
type RunId = RunId$1;
|
|
10696
|
+
type PlanHash = PlanHash$1;
|
|
10697
|
+
|
|
10698
|
+
type Kind = WorkflowKind;
|
|
10699
|
+
type SpecV0 = WorkflowSpecV0;
|
|
10700
|
+
type SpecV1 = WorkflowSpecV1;
|
|
10701
|
+
type NodeV0 = WorkflowNodeV0;
|
|
10702
|
+
type NodeV1 = WorkflowNodeV1;
|
|
10703
|
+
type EdgeV0 = WorkflowEdgeV0;
|
|
10704
|
+
type EdgeV1 = WorkflowEdgeV1;
|
|
10705
|
+
type OutputRefV0 = WorkflowOutputRefV0;
|
|
10706
|
+
type OutputRefV1 = WorkflowOutputRefV1;
|
|
10707
|
+
type BindingV0 = LLMResponsesBindingV0;
|
|
10708
|
+
type BindingV1 = LLMResponsesBindingV1;
|
|
10709
|
+
type BindingEncodingV0 = LLMResponsesBindingEncodingV0;
|
|
10710
|
+
type BindingEncodingV1 = LLMResponsesBindingEncodingV1;
|
|
10711
|
+
type ToolLimitsV0 = LLMResponsesToolLimitsV0;
|
|
10712
|
+
type ToolLimitsV1 = LLMResponsesToolLimitsV1;
|
|
10713
|
+
type ToolExecutionV0 = ToolExecutionV0$1;
|
|
10714
|
+
type ToolExecutionV1 = ToolExecutionV1$1;
|
|
10715
|
+
type ToolExecutionModeV0 = ToolExecutionModeV0$1;
|
|
10716
|
+
type ToolExecutionModeV1 = ToolExecutionModeV1$1;
|
|
10717
|
+
type ConditionV1 = ConditionV1$1;
|
|
10718
|
+
type ConditionOpV1 = ConditionOpV1$1;
|
|
10719
|
+
type ConditionSourceV1 = ConditionSourceV1$1;
|
|
10720
|
+
type StatusV0 = RunStatusV0;
|
|
10721
|
+
type EventTypeV0 = RunEventTypeV0;
|
|
10722
|
+
type EventV0 = RunEventV0;
|
|
10723
|
+
type EventBaseV0 = RunEventBaseV0;
|
|
10724
|
+
type EventRunCompiledV0 = RunEventRunCompiledV0;
|
|
10725
|
+
type EventRunStartedV0 = RunEventRunStartedV0;
|
|
10726
|
+
type EventRunCompletedV0 = RunEventRunCompletedV0;
|
|
10727
|
+
type EventRunFailedV0 = RunEventRunFailedV0;
|
|
10728
|
+
type EventRunCanceledV0 = RunEventRunCanceledV0;
|
|
10729
|
+
type EventNodeStartedV0 = RunEventNodeStartedV0;
|
|
10730
|
+
type EventNodeSucceededV0 = RunEventNodeSucceededV0;
|
|
10731
|
+
type EventNodeFailedV0 = RunEventNodeFailedV0;
|
|
10732
|
+
type EventNodeLLMCallV0 = RunEventNodeLLMCallV0;
|
|
10733
|
+
type EventNodeToolCallV0 = RunEventNodeToolCallV0;
|
|
10734
|
+
type EventNodeToolResultV0 = RunEventNodeToolResultV0;
|
|
10735
|
+
type EventNodeWaitingV0 = RunEventNodeWaitingV0;
|
|
10736
|
+
type EventNodeOutputDeltaV0 = RunEventNodeOutputDeltaV0;
|
|
10737
|
+
type EventNodeOutputV0 = RunEventNodeOutputV0;
|
|
10738
|
+
type NodeErrorV0 = NodeErrorV0$1;
|
|
10739
|
+
type NodeOutputDeltaV0 = NodeOutputDeltaV0$1;
|
|
10740
|
+
type NodeLLMCallV0 = NodeLLMCallV0$1;
|
|
10741
|
+
type NodeToolCallV0 = NodeToolCallV0$1;
|
|
10742
|
+
type NodeToolResultV0 = NodeToolResultV0$1;
|
|
10743
|
+
type NodeWaitingV0 = NodeWaitingV0$1;
|
|
10744
|
+
type PendingToolCallV0 = PendingToolCallV0$1;
|
|
10745
|
+
type FunctionToolCallV0 = FunctionToolCallV0$1;
|
|
10746
|
+
type TokenUsageV0 = TokenUsageV0$1;
|
|
10747
|
+
type PayloadInfoV0 = PayloadInfoV0$1;
|
|
10748
|
+
type StreamEventKind = StreamEventKind$1;
|
|
10749
|
+
declare const KindV0: "workflow.v0";
|
|
10750
|
+
declare const KindV1: "workflow.v1";
|
|
10751
|
+
declare const NodeTypes: {
|
|
10752
|
+
readonly LLMResponses: "llm.responses";
|
|
10753
|
+
readonly JoinAll: "join.all";
|
|
10754
|
+
readonly TransformJSON: "transform.json";
|
|
10755
|
+
};
|
|
10756
|
+
type NodeType = (typeof NodeTypes)[keyof typeof NodeTypes];
|
|
10757
|
+
declare const NodeTypesV1: {
|
|
10758
|
+
readonly LLMResponses: "llm.responses";
|
|
10759
|
+
readonly RouteSwitch: "route.switch";
|
|
10760
|
+
readonly JoinAll: "join.all";
|
|
10761
|
+
readonly JoinAny: "join.any";
|
|
10762
|
+
readonly JoinCollect: "join.collect";
|
|
10763
|
+
readonly TransformJSON: "transform.json";
|
|
10764
|
+
readonly MapFanout: "map.fanout";
|
|
10765
|
+
};
|
|
10766
|
+
type NodeTypeV1 = (typeof NodeTypesV1)[keyof typeof NodeTypesV1];
|
|
10767
|
+
declare const BindingEncodings: {
|
|
10768
|
+
readonly JSON: "json";
|
|
10769
|
+
readonly JSONString: "json_string";
|
|
10770
|
+
};
|
|
10771
|
+
declare const ToolExecutionModes: {
|
|
10772
|
+
readonly Server: "server";
|
|
10773
|
+
readonly Client: "client";
|
|
10774
|
+
};
|
|
10775
|
+
|
|
10776
|
+
type index_BindingBuilder = BindingBuilder;
|
|
10777
|
+
declare const index_BindingBuilder: typeof BindingBuilder;
|
|
10778
|
+
type index_BindingEncodingV0 = BindingEncodingV0;
|
|
10779
|
+
type index_BindingEncodingV1 = BindingEncodingV1;
|
|
10780
|
+
declare const index_BindingEncodings: typeof BindingEncodings;
|
|
10781
|
+
type index_BindingOptions = BindingOptions;
|
|
10782
|
+
type index_BindingV0 = BindingV0;
|
|
10783
|
+
type index_BindingV1 = BindingV1;
|
|
10784
|
+
type index_ConditionOpV1 = ConditionOpV1;
|
|
10785
|
+
type index_ConditionSourceV1 = ConditionSourceV1;
|
|
10786
|
+
type index_ConditionV1 = ConditionV1;
|
|
10787
|
+
type index_EdgeV0 = EdgeV0;
|
|
10788
|
+
type index_EdgeV1 = EdgeV1;
|
|
10789
|
+
type index_EventBaseV0 = EventBaseV0;
|
|
10790
|
+
type index_EventNodeFailedV0 = EventNodeFailedV0;
|
|
10791
|
+
type index_EventNodeLLMCallV0 = EventNodeLLMCallV0;
|
|
10792
|
+
type index_EventNodeOutputDeltaV0 = EventNodeOutputDeltaV0;
|
|
10793
|
+
type index_EventNodeOutputV0 = EventNodeOutputV0;
|
|
10794
|
+
type index_EventNodeStartedV0 = EventNodeStartedV0;
|
|
10795
|
+
type index_EventNodeSucceededV0 = EventNodeSucceededV0;
|
|
10796
|
+
type index_EventNodeToolCallV0 = EventNodeToolCallV0;
|
|
10797
|
+
type index_EventNodeToolResultV0 = EventNodeToolResultV0;
|
|
10798
|
+
type index_EventNodeWaitingV0 = EventNodeWaitingV0;
|
|
10799
|
+
type index_EventRunCanceledV0 = EventRunCanceledV0;
|
|
10800
|
+
type index_EventRunCompiledV0 = EventRunCompiledV0;
|
|
10801
|
+
type index_EventRunCompletedV0 = EventRunCompletedV0;
|
|
10802
|
+
type index_EventRunFailedV0 = EventRunFailedV0;
|
|
10803
|
+
type index_EventRunStartedV0 = EventRunStartedV0;
|
|
10804
|
+
type index_EventTypeV0 = EventTypeV0;
|
|
10805
|
+
type index_EventV0 = EventV0;
|
|
10806
|
+
type index_FanoutReduceConfigV1 = FanoutReduceConfigV1;
|
|
10807
|
+
type index_FanoutReduceV1 = FanoutReduceV1;
|
|
10808
|
+
declare const index_FanoutReduceV1: typeof FanoutReduceV1;
|
|
10809
|
+
type index_FunctionToolCallV0 = FunctionToolCallV0;
|
|
10810
|
+
type index_Kind = Kind;
|
|
10811
|
+
declare const index_KindV0: typeof KindV0;
|
|
10812
|
+
declare const index_KindV1: typeof KindV1;
|
|
10813
|
+
declare const index_LLM_TEXT_OUTPUT: typeof LLM_TEXT_OUTPUT;
|
|
10814
|
+
declare const index_LLM_USER_MESSAGE_TEXT: typeof LLM_USER_MESSAGE_TEXT;
|
|
10815
|
+
type index_NodeErrorV0 = NodeErrorV0;
|
|
10816
|
+
type index_NodeId = NodeId;
|
|
10817
|
+
type index_NodeLLMCallV0 = NodeLLMCallV0;
|
|
10818
|
+
type index_NodeOutputDeltaV0 = NodeOutputDeltaV0;
|
|
10819
|
+
type index_NodeToolCallV0 = NodeToolCallV0;
|
|
10820
|
+
type index_NodeToolResultV0 = NodeToolResultV0;
|
|
10821
|
+
type index_NodeType = NodeType;
|
|
10822
|
+
type index_NodeTypeV1 = NodeTypeV1;
|
|
10823
|
+
declare const index_NodeTypes: typeof NodeTypes;
|
|
10824
|
+
declare const index_NodeTypesV1: typeof NodeTypesV1;
|
|
10825
|
+
type index_NodeV0 = NodeV0;
|
|
10826
|
+
type index_NodeV1 = NodeV1;
|
|
10827
|
+
type index_NodeWaitingV0 = NodeWaitingV0;
|
|
10828
|
+
type index_OutputName = OutputName;
|
|
10829
|
+
type index_OutputRefV0 = OutputRefV0;
|
|
10830
|
+
type index_OutputRefV1 = OutputRefV1;
|
|
10831
|
+
type index_PayloadInfoV0 = PayloadInfoV0;
|
|
10832
|
+
type index_PendingToolCallV0 = PendingToolCallV0;
|
|
10833
|
+
type index_PlanHash = PlanHash;
|
|
10834
|
+
type index_RouterConfigV1 = RouterConfigV1;
|
|
10835
|
+
type index_RouterRouteV1 = RouterRouteV1;
|
|
10836
|
+
type index_RouterV1 = RouterV1;
|
|
10837
|
+
declare const index_RouterV1: typeof RouterV1;
|
|
10838
|
+
type index_RunId = RunId;
|
|
10839
|
+
type index_SpecV0 = SpecV0;
|
|
10840
|
+
type index_SpecV1 = SpecV1;
|
|
10841
|
+
type index_StatusV0 = StatusV0;
|
|
10842
|
+
type index_StreamEventKind = StreamEventKind;
|
|
10843
|
+
type index_TokenUsageV0 = TokenUsageV0;
|
|
10844
|
+
type index_ToolExecutionModeV0 = ToolExecutionModeV0;
|
|
10845
|
+
type index_ToolExecutionModeV1 = ToolExecutionModeV1;
|
|
10846
|
+
declare const index_ToolExecutionModes: typeof ToolExecutionModes;
|
|
10847
|
+
type index_ToolExecutionV0 = ToolExecutionV0;
|
|
10848
|
+
type index_ToolExecutionV1 = ToolExecutionV1;
|
|
10849
|
+
type index_ToolLimitsV0 = ToolLimitsV0;
|
|
10850
|
+
type index_ToolLimitsV1 = ToolLimitsV1;
|
|
10851
|
+
declare const index_bindFrom: typeof bindFrom;
|
|
10852
|
+
declare const index_bindToPlaceholder: typeof bindToPlaceholder;
|
|
10853
|
+
declare const index_bindToPointer: typeof bindToPointer;
|
|
10854
|
+
declare const index_parseNodeId: typeof parseNodeId;
|
|
10855
|
+
declare const index_parseOutputName: typeof parseOutputName;
|
|
10856
|
+
declare const index_parsePlanHash: typeof parsePlanHash;
|
|
10857
|
+
declare const index_parseRunId: typeof parseRunId;
|
|
10858
|
+
declare const index_whenOutputEquals: typeof whenOutputEquals;
|
|
10859
|
+
declare const index_whenOutputExists: typeof whenOutputExists;
|
|
10860
|
+
declare const index_whenOutputMatches: typeof whenOutputMatches;
|
|
10861
|
+
declare const index_whenStatusEquals: typeof whenStatusEquals;
|
|
10862
|
+
declare const index_whenStatusExists: typeof whenStatusExists;
|
|
10863
|
+
declare const index_whenStatusMatches: typeof whenStatusMatches;
|
|
7694
10864
|
declare namespace index {
|
|
7695
|
-
export type
|
|
10865
|
+
export { index_BindingBuilder as BindingBuilder, type index_BindingEncodingV0 as BindingEncodingV0, type index_BindingEncodingV1 as BindingEncodingV1, index_BindingEncodings as BindingEncodings, type index_BindingOptions as BindingOptions, type index_BindingV0 as BindingV0, type index_BindingV1 as BindingV1, type index_ConditionOpV1 as ConditionOpV1, type index_ConditionSourceV1 as ConditionSourceV1, type index_ConditionV1 as ConditionV1, type index_EdgeV0 as EdgeV0, type index_EdgeV1 as EdgeV1, type index_EventBaseV0 as EventBaseV0, type index_EventNodeFailedV0 as EventNodeFailedV0, type index_EventNodeLLMCallV0 as EventNodeLLMCallV0, type index_EventNodeOutputDeltaV0 as EventNodeOutputDeltaV0, type index_EventNodeOutputV0 as EventNodeOutputV0, type index_EventNodeStartedV0 as EventNodeStartedV0, type index_EventNodeSucceededV0 as EventNodeSucceededV0, type index_EventNodeToolCallV0 as EventNodeToolCallV0, type index_EventNodeToolResultV0 as EventNodeToolResultV0, type index_EventNodeWaitingV0 as EventNodeWaitingV0, type index_EventRunCanceledV0 as EventRunCanceledV0, type index_EventRunCompiledV0 as EventRunCompiledV0, type index_EventRunCompletedV0 as EventRunCompletedV0, type index_EventRunFailedV0 as EventRunFailedV0, type index_EventRunStartedV0 as EventRunStartedV0, type index_EventTypeV0 as EventTypeV0, type index_EventV0 as EventV0, type index_FanoutReduceConfigV1 as FanoutReduceConfigV1, index_FanoutReduceV1 as FanoutReduceV1, type index_FunctionToolCallV0 as FunctionToolCallV0, type index_Kind as Kind, index_KindV0 as KindV0, index_KindV1 as KindV1, index_LLM_TEXT_OUTPUT as LLM_TEXT_OUTPUT, index_LLM_USER_MESSAGE_TEXT as LLM_USER_MESSAGE_TEXT, type index_NodeErrorV0 as NodeErrorV0, type index_NodeId as NodeId, type index_NodeLLMCallV0 as NodeLLMCallV0, type index_NodeOutputDeltaV0 as NodeOutputDeltaV0, type index_NodeToolCallV0 as NodeToolCallV0, type index_NodeToolResultV0 as NodeToolResultV0, type index_NodeType as NodeType, type index_NodeTypeV1 as NodeTypeV1, index_NodeTypes as NodeTypes, index_NodeTypesV1 as NodeTypesV1, type index_NodeV0 as NodeV0, type index_NodeV1 as NodeV1, type index_NodeWaitingV0 as NodeWaitingV0, type index_OutputName as OutputName, type index_OutputRefV0 as OutputRefV0, type index_OutputRefV1 as OutputRefV1, type index_PayloadInfoV0 as PayloadInfoV0, type index_PendingToolCallV0 as PendingToolCallV0, type index_PlanHash as PlanHash, type index_RouterConfigV1 as RouterConfigV1, type index_RouterRouteV1 as RouterRouteV1, index_RouterV1 as RouterV1, type index_RunId as RunId, type index_SpecV0 as SpecV0, type index_SpecV1 as SpecV1, type index_StatusV0 as StatusV0, type index_StreamEventKind as StreamEventKind, type index_TokenUsageV0 as TokenUsageV0, type index_ToolExecutionModeV0 as ToolExecutionModeV0, type index_ToolExecutionModeV1 as ToolExecutionModeV1, index_ToolExecutionModes as ToolExecutionModes, type index_ToolExecutionV0 as ToolExecutionV0, type index_ToolExecutionV1 as ToolExecutionV1, type index_ToolLimitsV0 as ToolLimitsV0, type index_ToolLimitsV1 as ToolLimitsV1, index_bindFrom as bindFrom, index_bindToPlaceholder as bindToPlaceholder, index_bindToPointer as bindToPointer, index_parseNodeId as parseNodeId, index_parseOutputName as parseOutputName, index_parsePlanHash as parsePlanHash, index_parseRunId as parseRunId, index_whenOutputEquals as whenOutputEquals, index_whenOutputExists as whenOutputExists, index_whenOutputMatches as whenOutputMatches, index_whenStatusEquals as whenStatusEquals, index_whenStatusExists as whenStatusExists, index_whenStatusMatches as whenStatusMatches };
|
|
7696
10866
|
}
|
|
7697
10867
|
|
|
7698
10868
|
/**
|
|
@@ -7740,6 +10910,8 @@ declare class ModelRelay {
|
|
|
7740
10910
|
readonly models: ModelsClient;
|
|
7741
10911
|
readonly sessions: SessionsClient;
|
|
7742
10912
|
readonly baseUrl: string;
|
|
10913
|
+
/** @internal HTTP client for internal use by session sync */
|
|
10914
|
+
readonly http: HTTPClient;
|
|
7743
10915
|
static fromSecretKey(secretKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
|
|
7744
10916
|
static fromPublishableKey(publishableKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
|
|
7745
10917
|
static fromApiKey(apiKey: string, options?: Omit<ModelRelayKeyOptions, "key">): ModelRelay;
|
|
@@ -7747,4 +10919,4 @@ declare class ModelRelay {
|
|
|
7747
10919
|
forCustomer(customerId: string): CustomerScopedModelRelay;
|
|
7748
10920
|
}
|
|
7749
10921
|
|
|
7750
|
-
export { type APICheckoutSession, type APICustomerRef, APIError, type APIFrontendToken, type APIKey, type APIResponsesResponse, type APIUsage, type ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, type BillingProvider, BillingProviders, BrowserDefaults, BrowserToolNames, BrowserToolPack, type BrowserToolPackOptions, type CatalogModel, type CheckoutSession, type Citation, type CodeExecConfig, ConfigError, type ContentPart, type ContentPartType, ContentPartTypes, type Customer, type CustomerClaimRequest, type CustomerCreateRequest, type CustomerMetadata, CustomerResponsesClient, CustomerScopedModelRelay, type CustomerSubscribeRequest, type CustomerToken, CustomerTokenProvider, type CustomerTokenRequest, type CustomerUpsertRequest, type CustomerWithSubscription, CustomersClient, DEFAULT_BASE_URL, DEFAULT_CLIENT_HEADER, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_IGNORE_DIRS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepPartial, type DeviceStartRequest, type DeviceStartResponse, type DeviceTokenPending, type DeviceTokenResponse, type DeviceTokenResult, type ErrorCategory, type ErrorCode, ErrorCodes, FSDefaults, ToolNames as FSToolNames, type FieldError, type FrontendCustomer, type FrontendToken, type FrontendTokenAutoProvisionRequest, FrontendTokenProvider, type FrontendTokenRequest, type FunctionCall, type FunctionCallDelta, type FunctionTool, type HandleWaitingResult, type HttpRequestMetrics, type ImageData, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, type InputItem, type InputItemType, InputItemTypes, type JSONSchemaFormat, type JsonSchemaOptions, type KnownStopReason, type ListSessionsOptions, type ListSessionsResponse, LocalFSToolPack, type LocalFSToolPackOptions, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MemorySessionStore, type MessageDeltaData, type MessageRole, MessageRoles, type MessageStartData, type MessageStopData, type MetricsCallbacks, type ModelCapability, type ModelId, ModelRelay, type ModelRelayBaseOptions, ModelRelayError, type ModelRelayKeyOptions, type ModelRelayOptions, type ModelRelayTokenOptions, type ModelRelayTokenProviderOptions, ModelsClient, type NodeErrorV0, type NodeId, type NonEmptyArray, type OAuthDeviceAuthorization, type OAuthDeviceAuthorizationRequest, type OAuthDeviceToken, type OAuthDeviceTokenPollRequest, type OIDCExchangeRequest, OIDCExchangeTokenProvider, type OutputFormat, type OutputFormatType, OutputFormatTypes, type OutputItem, type OutputItemType, OutputItemTypes, type OutputName, PathEscapeError, type PayloadInfoV0, type PlanHash, type PriceInterval, type Project, type ProviderId, type PublishableKey, type RemoteSessionInfo, type RemoteSessionOptions, type RequestContext, type Response$1 as Response, type ResponseEvent, type ResponseEventType, ResponsesClient, ResponsesStream, type RetryConfig, type RetryHandler, type RetryMetadata, type RetryOptions, type RunEventTypeV0, type RunEventV0, type RunId, type RunStatusV0, RunsClient, RunsEventStream, SDK_VERSION, type Schema, type SecretKey, type Session, type SessionArtifacts, type SessionId, type SessionMessage, type SessionPendingToolCall, type SessionRunOptions, type SessionRunResult, type SessionRunStatus, type SessionState, type SessionStore, type SessionType, type SessionUsageSummary, SessionsClient, type StopReason, StopReasons, type StreamFirstTokenMetrics, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, type StructuredJSONEvent, type StructuredJSONRecordType, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Subscription, type SubscriptionStatusKind, SubscriptionStatuses, type Tier, type TierCheckoutRequest, type TierCheckoutSession, type TierCode, TiersClient, type TokenProvider, type TokenType, type TokenUsageMetrics, type Tool, ToolArgsError, ToolArgumentError, type ToolCall, ToolCallAccumulator, type ToolCallDelta, type ToolChoice, type ToolChoiceType, ToolChoiceTypes, type ToolExecutionResult, type ToolHandler, ToolRegistry, ToolRunner, type ToolRunnerOptions, type ToolType, ToolTypes, type TraceCallbacks, type TransformJSONValueV0, TransportError, type TransportErrorKind, type Usage, type UsageSummary, type ValidationIssue, WORKFLOWS_COMPILE_PATH, type WebSearchConfig, type WebToolMode, WebToolModes, WorkflowBuilderV0, type WorkflowBuilderV0State, type WorkflowEdgeV0, type WorkflowKind, WorkflowKinds, type WorkflowNodeType, WorkflowNodeTypes, type WorkflowNodeV0, type WorkflowOutputRefV0, type WorkflowSpecV0, WorkflowValidationError, type WorkflowValidationIssue, WorkflowsClient, type WorkflowsCompileOptions, type WorkflowsCompileRequestV0, type WorkflowsCompileResponseV0, type WorkflowsCompileV0Result, type XSearchConfig, type ZodLikeSchema, asModelId, asProviderId, asSessionId, asTierCode, assistantMessageWithToolCalls, createAccessTokenAuth, createApiKeyAuth, createAssistantMessage, createBrowserToolPack, createBrowserTools, createFunctionCall, createFunctionTool, createFunctionToolFromSchema, createLocalFSToolPack, createLocalFSTools, createLocalSession, createMemorySessionStore, createRetryMessages, createSystemMessage, createToolCall, createToolRunner, createUsage, createUserMessage, createWebTool, defaultRetryHandler, executeWithRetry, firstToolCall, formatToolErrorForModel, generateSessionId, index as generated, getRetryableErrors, hasRetryableErrors, hasToolCalls, isAutoProvisionDisabled, isAutoProvisionMisconfigured, isEmailRequired, isIdentityRequired, isProvisioningError, isPublishableKey, isSecretKey, mergeMetrics, mergeTrace, modelToString, normalizeModelId, normalizeStopReason, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parsePublishableKey, parseRunId, parseSecretKey, parseToolArgs, parseToolArgsRaw, pollOAuthDeviceToken, respondToToolCall, runOAuthDeviceFlowForIDToken, startOAuthDeviceAuthorization, stopReasonToString, toolChoiceAuto, toolChoiceNone, toolChoiceRequired, toolResultMessage, transformJSONMerge, transformJSONObject, transformJSONValue, tryParseToolArgs, validateWithZod, workflowV0, workflow_v0_schema as workflowV0Schema, zodToJsonSchema };
|
|
10922
|
+
export { type APICheckoutSession, type APICustomerRef, APIError, type APIFrontendToken, type APIKey, type APIResponsesResponse, type APIUsage, type ApiKey, type AttemptRecord, AuthClient, type AuthHeaders, type BillingProvider, BillingProviders, BindingTargetError, BrowserDefaults, BrowserToolNames, BrowserToolPack, type BrowserToolPackOptions, type CatalogModel, Chain, ChainBuilder, type CheckoutSession, type Citation, type CodeExecConfig, ConfigError, type ContentPart, type ContentPartType, ContentPartTypes, type Customer, type CustomerClaimRequest, type CustomerCreateRequest, type CustomerMetadata, CustomerResponsesClient, CustomerScopedModelRelay, type CustomerSubscribeRequest, type CustomerToken, CustomerTokenProvider, type CustomerTokenRequest, type CustomerUpsertRequest, type CustomerWithSubscription, CustomersClient, DEFAULT_BASE_URL, DEFAULT_CLIENT_HEADER, DEFAULT_CONNECT_TIMEOUT_MS, DEFAULT_IGNORE_DIRS, DEFAULT_REQUEST_TIMEOUT_MS, type DeepPartial, type DeviceStartRequest, type DeviceStartResponse, type DeviceTokenPending, type DeviceTokenResponse, type DeviceTokenResult, type ErrorCategory, type ErrorCode, ErrorCodes, FSDefaults, ToolNames as FSToolNames, type FieldError, type FrontendCustomer, type FrontendToken, type FrontendTokenAutoProvisionRequest, FrontendTokenProvider, type FrontendTokenRequest, type FunctionCall, type FunctionCallDelta, type FunctionTool, type HandleWaitingResult, type HttpRequestMetrics, type ImageData, type ImagePinResponse, type ImageRequest, type ImageResponse, type ImageResponseFormat, type ImageUsage, ImagesClient, type InputItem, type InputItemType, InputItemTypes, type JSONPointer, type JSONSchemaFormat, JoinOutput, JoinOutputPath, type JsonSchemaOptions, type KnownStopReason, LLMInput, LLMInputContentItemPath, LLMInputFirstMessageText, LLMInputMessagePath, LLMInputPath, LLMInputSystemText, LLMInputUserText, LLMNodeBuilder, LLMOutput, LLMOutputContentItemPath, LLMOutputContentPath, LLMOutputPath, LLMOutputText, LLMStep, type LLMStepConfig, LLM_TEXT_OUTPUT, LLM_USER_MESSAGE_TEXT, type ListSessionsOptions, type ListSessionsResponse, LocalFSToolPack, type LocalFSToolPackOptions, LocalSession, type LocalSessionOptions, type LocalSessionPersistence, MapFanoutInputError, MapItem, type MapItemConfig, MapReduce, MapReduceBuilder, MemorySessionStore, type MessageDeltaData, type MessageRole, MessageRoles, type MessageStartData, type MessageStopData, type MetricsCallbacks, type MockFetchCall, type MockFetchResponder, type ModelCapability, type ModelId, ModelRelay, type ModelRelayBaseOptions, ModelRelayError, type ModelRelayKeyOptions, type ModelRelayOptions, type ModelRelayTokenOptions, type ModelRelayTokenProviderOptions, ModelsClient, type NDJSONDelayStep, type NodeErrorV0$1 as NodeErrorV0, type NodeId$1 as NodeId, type NonEmptyArray, type OAuthDeviceAuthorization, type OAuthDeviceAuthorizationRequest, type OAuthDeviceToken, type OAuthDeviceTokenPollRequest, type OIDCExchangeRequest, OIDCExchangeTokenProvider, type OutputFormat, type OutputFormatType, OutputFormatTypes, type OutputItem, type OutputItemType, OutputItemTypes, type OutputName$1 as OutputName, Parallel, ParallelBuilder, PathEscapeError, type PayloadInfoV0$1 as PayloadInfoV0, type PlanHash$1 as PlanHash, type PollUntilOptions, type PollUntilResult, type PriceInterval, type Project, type ProviderId, type PublishableKey, type RemoteSessionInfo, type RemoteSessionOptions, type RequestContext, type Response$1 as Response, type ResponseEvent, type ResponseEventType, ResponsesClient, ResponsesStream, type RetryConfig, type RetryHandler, type RetryMetadata, type RetryOptions, type RunEventTypeV0, type RunEventV0, type RunId$1 as RunId, type RunStatusV0, RunsClient, RunsEventStream, SDK_VERSION, type Schema, type SecretKey, type Session, type SessionArtifacts, type SessionContextManagement, type SessionContextTruncateInfo, type SessionId, type SessionMessage, type SessionPendingToolCall, type SessionRunOptions, type SessionRunResult, type SessionRunStatus, type SessionState, type SessionStore, type SessionSyncOptions, type SessionSyncResult, type SessionType, type SessionUsageSummary, SessionsClient, type StopReason, StopReasons, type StreamFirstTokenMetrics, StreamProtocolError, StreamTimeoutError, type StreamTimeoutKind, StructuredDecodeError, type StructuredErrorKind, StructuredExhaustedError, type StructuredJSONEvent, type StructuredJSONRecordType, StructuredJSONStream, type StructuredOptions, type StructuredResult, type Subscription, type SubscriptionStatusKind, SubscriptionStatuses, type Tier, type TierCheckoutRequest, type TierCheckoutSession, type TierCode, TiersClient, type TokenProvider, type TokenType, type TokenUsageMetrics, type Tool, ToolArgsError, ToolArgumentError, type ToolCall, ToolCallAccumulator, type ToolCallDelta, type ToolChoice, type ToolChoiceType, ToolChoiceTypes, type ToolExecutionResult, type ToolHandler, ToolRegistry, ToolRunner, type ToolRunnerOptions, type ToolType, ToolTypes, type TraceCallbacks, TransformJSONNodeBuilder, type TransformJSONValueV0, type TransformJSONValueV1, TransportError, type TransportErrorKind, type Usage, type UsageSummary, type ValidationIssue, WORKFLOWS_COMPILE_PATH, type WebSearchConfig, type WebToolMode, WebToolModes, Workflow, WorkflowBuilderV0, type WorkflowBuilderV0State, WorkflowBuilderV1, type WorkflowBuilderV1State, type WorkflowEdgeV0, type WorkflowKind, WorkflowKinds, type WorkflowNodeType, WorkflowNodeTypes, type WorkflowNodeV0, type WorkflowOutputRefV0, type WorkflowSpecV0, WorkflowValidationError, type WorkflowValidationIssue, WorkflowsClient, type WorkflowsCompileOptions, type WorkflowsCompileRequestV0, type WorkflowsCompileRequestV1, type WorkflowsCompileResponseV0, type WorkflowsCompileResponseV1, type WorkflowsCompileV0Result, type WorkflowsCompileV1Result, type XSearchConfig, type ZodLikeSchema, asModelId, asProviderId, asSessionId, asTierCode, assistantMessageWithToolCalls, buildDelayedNDJSONResponse, buildNDJSONResponse, createAccessTokenAuth, createApiKeyAuth, createAssistantMessage, createBrowserToolPack, createBrowserTools, createFunctionCall, createFunctionTool, createFunctionToolFromSchema, createLocalFSToolPack, createLocalFSTools, createLocalSession, createMemorySessionStore, createMockFetchQueue, createRetryMessages, createSystemMessage, createToolCall, createToolRunner, createUsage, createUserMessage, createWebTool, defaultRetryHandler, executeWithRetry, firstToolCall, formatToolErrorForModel, generateSessionId, index$1 as generated, getRetryableErrors, hasRetryableErrors, hasToolCalls, isAutoProvisionDisabled, isAutoProvisionMisconfigured, isEmailRequired, isIdentityRequired, isProvisioningError, isPublishableKey, isSecretKey, mergeMetrics, mergeTrace, modelToString, newWorkflow, normalizeModelId, normalizeStopReason, outputFormatFromZod, parseApiKey, parseErrorResponse, parseNodeId, parseOutputName, parsePlanHash, parsePublishableKey, parseRunId, parseSecretKey, parseToolArgs, parseToolArgsRaw, pollOAuthDeviceToken, pollUntil, respondToToolCall, runOAuthDeviceFlowForIDToken, startOAuthDeviceAuthorization, stopReasonToString, toolChoiceAuto, toolChoiceNone, toolChoiceRequired, toolResultMessage, transformJSONMerge, transformJSONMergeV1, transformJSONObject, transformJSONObjectV1, transformJSONValue, transformJSONValueV1, tryParseToolArgs, validateWithZod, index as workflow, workflowV0, workflow_v0_schema as workflowV0Schema, workflowV1, workflow_v1_schema as workflowV1Schema, zodToJsonSchema };
|