@talqing/sdk 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1077,6 +1077,36 @@ export class Avatars extends HeyApiClient {
1077
1077
  });
1078
1078
  }
1079
1079
  }
1080
+ export class Models extends HeyApiClient {
1081
+ /**
1082
+ * Search Models
1083
+ *
1084
+ * Search the language models a provider offers too many of to list.
1085
+ *
1086
+ * `GET /catalog` carries every model except these. A provider marked
1087
+ * `browse: "search"` there — OpenRouter — reaches hundreds of models through
1088
+ * one key, so they are searched a page at a time instead. With no `q` the order
1089
+ * is real-world popularity. Everything returned is a valid `llm.model`.
1090
+ */
1091
+ search(parameters, options) {
1092
+ const params = buildClientParams([parameters], [{ args: [
1093
+ { in: 'query', key: 'q' },
1094
+ { in: 'query', key: 'limit' },
1095
+ { in: 'query', key: 'cursor' }
1096
+ ] }]);
1097
+ return (options?.client ?? this.client).get({
1098
+ responseStyle: 'data',
1099
+ security: [{ scheme: 'bearer', type: 'http' }, {
1100
+ in: 'cookie',
1101
+ name: 'talqing_session',
1102
+ type: 'apiKey'
1103
+ }],
1104
+ url: '/v1/catalog/models',
1105
+ ...options,
1106
+ ...params
1107
+ });
1108
+ }
1109
+ }
1080
1110
  export class Elevenlabs extends HeyApiClient {
1081
1111
  /**
1082
1112
  * Add Elevenlabs Voice
@@ -1190,6 +1220,10 @@ export class Catalog extends HeyApiClient {
1190
1220
  * `realtime` lists the speech-to-speech models. One of those replaces `stt`,
1191
1221
  * `llm` and `tts` together, so an agent sets either `realtime` or the three
1192
1222
  * cascade slots, never both.
1223
+ *
1224
+ * One provider's models are NOT here: a `providers` entry whose `browse` is
1225
+ * `search` reaches hundreds of them through one key, and they are searched
1226
+ * through `GET /catalog/models` instead.
1193
1227
  */
1194
1228
  get(options) {
1195
1229
  return (options?.client ?? this.client).get({
@@ -1206,6 +1240,9 @@ export class Catalog extends HeyApiClient {
1206
1240
  get avatars() {
1207
1241
  return this._avatars ?? (this._avatars = new Avatars({ client: this.client }));
1208
1242
  }
1243
+ get models() {
1244
+ return this._models ?? (this._models = new Models({ client: this.client }));
1245
+ }
1209
1246
  get voices() {
1210
1247
  return this._voices ?? (this._voices = new Voices({ client: this.client }));
1211
1248
  }
@@ -1767,6 +1804,38 @@ export class Recipients2 extends HeyApiClient {
1767
1804
  }
1768
1805
  });
1769
1806
  }
1807
+ /**
1808
+ * Redraft Email Batch Recipients
1809
+ *
1810
+ * Draft rows again from scratch. **Each one runs the task and is billed again.**
1811
+ *
1812
+ * `selection` is `failed` (drafting failed), `stale_version` (drafted by an
1813
+ * older published version of the task), `not_sent`, or `all` — which names
1814
+ * every row it refuses. Rows already sent or queued are never redrafted.
1815
+ *
1816
+ * This revives a batch that had finished drafting, and a person's edited cells
1817
+ * survive unless you pass `clear_overrides` — and are what the task is given.
1818
+ * Refused on a canceled batch, whose rows can never draft again.
1819
+ */
1820
+ redraft(parameters, options) {
1821
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'redraftRequest', map: 'body' }] }]);
1822
+ return (options?.client ?? this.client).post({
1823
+ responseStyle: 'data',
1824
+ security: [{ scheme: 'bearer', type: 'http' }, {
1825
+ in: 'cookie',
1826
+ name: 'talqing_session',
1827
+ type: 'apiKey'
1828
+ }],
1829
+ url: '/v1/email/batches/{batch_id}/redraft',
1830
+ ...options,
1831
+ ...params,
1832
+ headers: {
1833
+ 'Content-Type': 'application/json',
1834
+ ...options?.headers,
1835
+ ...params.headers
1836
+ }
1837
+ });
1838
+ }
1770
1839
  /**
1771
1840
  * Restore Email Batch Recipients
1772
1841
  *
@@ -1792,17 +1861,14 @@ export class Recipients2 extends HeyApiClient {
1792
1861
  });
1793
1862
  }
1794
1863
  /**
1795
- * Retry Email Batch Recipients
1864
+ * Skip Email Batch Recipients
1796
1865
  *
1797
- * Draft rows whose first attempt failed, again.
1866
+ * Take rows out of consideration. Reversible with `restore`.
1798
1867
  *
1799
- * `selection: "all_eligible"` means every row whose drafting failed. This is
1800
- * the one action that revives a batch that has already finished drafting: it
1801
- * goes back to `drafting` and picks up exactly the rows you retried — the
1802
- * alternative would be telling you that twelve failed rows are unrecoverable
1803
- * because the other 4 988 finished first.
1868
+ * Accepts drafted rows and rows whose drafting failed. Takes either
1869
+ * `recipient_ids` or `selection: "all_eligible"`, which here means both.
1804
1870
  */
1805
- retry(parameters, options) {
1871
+ skip(parameters, options) {
1806
1872
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
1807
1873
  return (options?.client ?? this.client).post({
1808
1874
  responseStyle: 'data',
@@ -1811,7 +1877,7 @@ export class Recipients2 extends HeyApiClient {
1811
1877
  name: 'talqing_session',
1812
1878
  type: 'apiKey'
1813
1879
  }],
1814
- url: '/v1/email/batches/{batch_id}/retry',
1880
+ url: '/v1/email/batches/{batch_id}/skip',
1815
1881
  ...options,
1816
1882
  ...params,
1817
1883
  headers: {
@@ -1821,21 +1887,47 @@ export class Recipients2 extends HeyApiClient {
1821
1887
  }
1822
1888
  });
1823
1889
  }
1890
+ }
1891
+ export class Sends extends HeyApiClient {
1892
+ /**
1893
+ * List Email Sends
1894
+ *
1895
+ * Every send on this batch, newest first, with its counts and its schedule.
1896
+ */
1897
+ list(parameters, options) {
1898
+ const params = buildClientParams([parameters], [{ args: [
1899
+ { in: 'path', key: 'batch_id' },
1900
+ { in: 'query', key: 'limit' },
1901
+ { in: 'query', key: 'offset' }
1902
+ ] }]);
1903
+ return (options?.client ?? this.client).get({
1904
+ responseStyle: 'data',
1905
+ security: [{ scheme: 'bearer', type: 'http' }, {
1906
+ in: 'cookie',
1907
+ name: 'talqing_session',
1908
+ type: 'apiKey'
1909
+ }],
1910
+ url: '/v1/email/batches/{batch_id}/sends',
1911
+ ...options,
1912
+ ...params
1913
+ });
1914
+ }
1824
1915
  /**
1825
- * Send Email Batch Recipients
1916
+ * Create Email Send
1826
1917
  *
1827
- * Send the rows you name. **This mails real people and cannot be undone.**
1918
+ * Send these rows. **This mails real people and cannot be undone.**
1828
1919
  *
1829
- * At most 50 rows per call, named one by one — there is no "select all" and no
1830
- * bulk form of this. A row whose `to`, `subject` or `body` does not resolve
1831
- * comes back in `rejected` and stays a draft; fix it with
1832
- * `patch_email_batch_recipient` and try again.
1920
+ * Name `recipient_ids`, or pass `selection: "all_drafts"` for every reviewed
1921
+ * draft. A row whose `to`, `subject` or `body` does not resolve comes back in
1922
+ * `rejected` and stays a draft; fix it with `patch_email_batch_recipient`.
1833
1923
  *
1834
- * `from_email`, `from_name` and `reply_to` override the sender for this call
1835
- * only, and must be on a domain verified on the same Resend account.
1924
+ * The send is a row you can steer: `start_at` schedules it, `window` holds it
1925
+ * to business hours, `send_gap_seconds` paces it and `send_daily_cap` bounds
1926
+ * how many leave per day. Everything omitted comes from the batch. Cancel it
1927
+ * and every unsent row comes back as a draft.
1836
1928
  */
1837
- send(parameters, options) {
1838
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendEmailBatchRequest', map: 'body' }] }]);
1929
+ create(parameters, options) {
1930
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'createEmailSendRequest', map: 'body' }] }]);
1839
1931
  return (options?.client ?? this.client).post({
1840
1932
  responseStyle: 'data',
1841
1933
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -1843,7 +1935,7 @@ export class Recipients2 extends HeyApiClient {
1843
1935
  name: 'talqing_session',
1844
1936
  type: 'apiKey'
1845
1937
  }],
1846
- url: '/v1/email/batches/{batch_id}/send',
1938
+ url: '/v1/email/batches/{batch_id}/sends',
1847
1939
  ...options,
1848
1940
  ...params,
1849
1941
  headers: {
@@ -1854,24 +1946,49 @@ export class Recipients2 extends HeyApiClient {
1854
1946
  });
1855
1947
  }
1856
1948
  /**
1857
- * Skip Email Batch Recipients
1949
+ * Get Email Send
1858
1950
  *
1859
- * Take drafted rows out of consideration. Reversible with `restore`.
1951
+ * One send: where its rows are, and when it next does something.
1860
1952
  *
1861
- * Takes either `recipient_ids` or `selection: "all_eligible"`, which here means
1862
- * every row that has a draft. The reversible verbs keep that shorthand while
1863
- * `send` does not, because the rule is about irreversibility rather than bulk.
1953
+ * `next_send_reason` says which gate is holding it — `start`, `window`,
1954
+ * `daily_cap`, `retry` or `gap`.
1864
1955
  */
1865
- skip(parameters, options) {
1866
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
1867
- return (options?.client ?? this.client).post({
1956
+ get(parameters, options) {
1957
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
1958
+ return (options?.client ?? this.client).get({
1868
1959
  responseStyle: 'data',
1869
1960
  security: [{ scheme: 'bearer', type: 'http' }, {
1870
1961
  in: 'cookie',
1871
1962
  name: 'talqing_session',
1872
1963
  type: 'apiKey'
1873
1964
  }],
1874
- url: '/v1/email/batches/{batch_id}/skip',
1965
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}',
1966
+ ...options,
1967
+ ...params
1968
+ });
1969
+ }
1970
+ /**
1971
+ * Patch Email Send
1972
+ *
1973
+ * Re-steer one send: its pace, its hours, its daily cap, its start time.
1974
+ *
1975
+ * Never its sender, and never which rows it holds — to change that, cancel it
1976
+ * and create another. `start_at` moves only before the send has begun.
1977
+ */
1978
+ update(parameters, options) {
1979
+ const params = buildClientParams([parameters], [{ args: [
1980
+ { in: 'path', key: 'batch_id' },
1981
+ { in: 'path', key: 'send_id' },
1982
+ { key: 'patchEmailSendRequest', map: 'body' }
1983
+ ] }]);
1984
+ return (options?.client ?? this.client).patch({
1985
+ responseStyle: 'data',
1986
+ security: [{ scheme: 'bearer', type: 'http' }, {
1987
+ in: 'cookie',
1988
+ name: 'talqing_session',
1989
+ type: 'apiKey'
1990
+ }],
1991
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}',
1875
1992
  ...options,
1876
1993
  ...params,
1877
1994
  headers: {
@@ -1881,6 +1998,68 @@ export class Recipients2 extends HeyApiClient {
1881
1998
  }
1882
1999
  });
1883
2000
  }
2001
+ /**
2002
+ * Cancel Email Send
2003
+ *
2004
+ * Stop this send, and give every row it has not sent back as a draft.
2005
+ *
2006
+ * Not a destructive action: the drafts come back exactly as they were, ready
2007
+ * for another send. It is also the only way to change what a scheduled send
2008
+ * contains — a send's rows are fixed once it exists.
2009
+ */
2010
+ cancel(parameters, options) {
2011
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2012
+ return (options?.client ?? this.client).post({
2013
+ responseStyle: 'data',
2014
+ security: [{ scheme: 'bearer', type: 'http' }, {
2015
+ in: 'cookie',
2016
+ name: 'talqing_session',
2017
+ type: 'apiKey'
2018
+ }],
2019
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/cancel',
2020
+ ...options,
2021
+ ...params
2022
+ });
2023
+ }
2024
+ /**
2025
+ * Pause Email Send
2026
+ *
2027
+ * Stop sending. It takes hold on the next email, and nothing is lost —
2028
+ * the rows stay queued for whenever you resume.
2029
+ */
2030
+ pause(parameters, options) {
2031
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2032
+ return (options?.client ?? this.client).post({
2033
+ responseStyle: 'data',
2034
+ security: [{ scheme: 'bearer', type: 'http' }, {
2035
+ in: 'cookie',
2036
+ name: 'talqing_session',
2037
+ type: 'apiKey'
2038
+ }],
2039
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/pause',
2040
+ ...options,
2041
+ ...params
2042
+ });
2043
+ }
2044
+ /**
2045
+ * Resume Email Send
2046
+ *
2047
+ * Undo a pause and carry on from where it stopped.
2048
+ */
2049
+ resume(parameters, options) {
2050
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2051
+ return (options?.client ?? this.client).post({
2052
+ responseStyle: 'data',
2053
+ security: [{ scheme: 'bearer', type: 'http' }, {
2054
+ in: 'cookie',
2055
+ name: 'talqing_session',
2056
+ type: 'apiKey'
2057
+ }],
2058
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/resume',
2059
+ ...options,
2060
+ ...params
2061
+ });
2062
+ }
1884
2063
  }
1885
2064
  export class Batches2 extends HeyApiClient {
1886
2065
  /**
@@ -1922,13 +2101,16 @@ export class Batches2 extends HeyApiClient {
1922
2101
  * scraped contacts — and this runs on your account under your agreement.
1923
2102
  *
1924
2103
  * **Nothing is sent that a person has not selected.** Creating a batch only
1925
- * starts drafting; sending is a separate call over at most 50 named rows.
2104
+ * starts drafting; sending is a separate call that creates a send you can
2105
+ * schedule, pace, pause and cancel.
1926
2106
  *
1927
- * **Every row runs your task as it stands right now** — a task has no
1928
- * versions, so editing it mid-batch changes every row drafted after that.
2107
+ * **Every row runs the task's CURRENT published version**, re-read every pass,
2108
+ * so publishing a better prompt mid-batch changes every row drafted after it.
1929
2109
  *
1930
2110
  * `field_map` points `to`, `subject` and `body` at a column of your list or at
1931
- * a field the task produces. An invalid batch is a 400 listing every problem.
2111
+ * a field the task produces. `window` is when email may LEAVE, inherited by
2112
+ * every send; drafting is not restricted by hours. An invalid batch is a 400
2113
+ * listing every problem.
1932
2114
  *
1933
2115
  * There is no spend cap: every row runs the task and is billed, so a 5 000-row
1934
2116
  * batch doing research costs 5 000 task runs whether or not anything is sent.
@@ -1957,8 +2139,8 @@ export class Batches2 extends HeyApiClient {
1957
2139
  *
1958
2140
  * One batch: its policy, its per-status counts and what drafting has cost.
1959
2141
  *
1960
- * While the batch is waiting on a start time or a closed window, the response
1961
- * also carries `next_draft_at`.
2142
+ * `drafted_versions` says which published version of the task wrote how many
2143
+ * rows, and `sent_today` how much of `send_daily_cap` is left today.
1962
2144
  */
1963
2145
  get(parameters, options) {
1964
2146
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
@@ -1979,10 +2161,12 @@ export class Batches2 extends HeyApiClient {
1979
2161
  *
1980
2162
  * Edit a batch's policy. The next drafting pass reads the new row.
1981
2163
  *
1982
- * Pacing and the calling window are editable at any time. The sender, the body
1983
- * format and the field map freeze once the batch has sent anything changing
1984
- * them then would make the rows already delivered no longer describe what they
1985
- * were sent as. `start_at` moves only while the batch is still scheduled.
2164
+ * Pacing, the window and the daily cap are editable at any time; the sending
2165
+ * half is the DEFAULT for the next send, and a send already created carries its
2166
+ * own copy. The sender, the body format and the field map freeze once the batch
2167
+ * has sent anything changing them then would make the rows already delivered
2168
+ * no longer describe what they were sent as. `start_at` moves only while the
2169
+ * batch is still scheduled.
1986
2170
  */
1987
2171
  update(parameters, options) {
1988
2172
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchEmailBatchRequest', map: 'body' }] }]);
@@ -2006,12 +2190,12 @@ export class Batches2 extends HeyApiClient {
2006
2190
  /**
2007
2191
  * Cancel Email Batch
2008
2192
  *
2009
- * Stop drafting for good. This is the only terminal action a batch cannot
2010
- * be deleted, because it is the record of what was sent to whom.
2193
+ * Stop drafting for good. A batch cannot be deleted, because it is the
2194
+ * record of what was sent to whom.
2011
2195
  *
2012
- * Rows already drafted are **not** touched: cancelling stops drafting, and
2013
- * drafts already produced are still worth reviewing and sending. Rows never
2014
- * reached report as `canceled`.
2196
+ * Rows already drafted are **not** touched and neither is any send: cancelling
2197
+ * stops drafting, and drafts already produced are still worth reviewing and
2198
+ * sending. Rows never reached report as `canceled`.
2015
2199
  */
2016
2200
  cancel(parameters, options) {
2017
2201
  const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
@@ -2071,6 +2255,9 @@ export class Batches2 extends HeyApiClient {
2071
2255
  get recipients() {
2072
2256
  return this._recipients ?? (this._recipients = new Recipients2({ client: this.client }));
2073
2257
  }
2258
+ get sends() {
2259
+ return this._sends ?? (this._sends = new Sends({ client: this.client }));
2260
+ }
2074
2261
  }
2075
2262
  export class Senders extends HeyApiClient {
2076
2263
  /**
@@ -2886,102 +3073,11 @@ export class Secrets extends HeyApiClient {
2886
3073
  });
2887
3074
  }
2888
3075
  }
2889
- export class Runs extends HeyApiClient {
2890
- /**
2891
- * List Task Runs
2892
- *
2893
- * This task's runs, newest first, each with its output, trace and cost.
2894
- *
2895
- * A run records the task's *name* and nothing else about the definition it ran
2896
- * under, so two runs either side of an edit are indistinguishable here.
2897
- */
2898
- list(parameters, options) {
2899
- const params = buildClientParams([parameters], [{ args: [
2900
- { in: 'path', key: 'task_id' },
2901
- { in: 'query', key: 'limit' },
2902
- { in: 'query', key: 'offset' }
2903
- ] }]);
2904
- return (options?.client ?? this.client).get({
2905
- responseStyle: 'data',
2906
- security: [{ scheme: 'bearer', type: 'http' }, {
2907
- in: 'cookie',
2908
- name: 'talqing_session',
2909
- type: 'apiKey'
2910
- }],
2911
- url: '/v1/tasks/{task_id}/runs',
2912
- ...options,
2913
- ...params
2914
- });
2915
- }
2916
- /**
2917
- * Run Task
2918
- *
2919
- * Run the task once with the variables you supply, and wait for the result.
2920
- *
2921
- * **This executes for real**: the tools call your endpoints with your secrets,
2922
- * the MCP servers spend your credits, and the model spends your tokens. A task
2923
- * that books a slot, charges a card or sends a message will do so.
2924
- *
2925
- * `vars` must match what the task declares — an unknown name is refused rather
2926
- * than dropped. The response is the whole run: the structured `output`, a
2927
- * `trace` of every tool call, the steps used and what the tokens cost. On
2928
- * failure `error.type` says whose problem it is. Secrets are redacted.
2929
- */
2930
- create(parameters, options) {
2931
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
2932
- return (options?.client ?? this.client).post({
2933
- responseStyle: 'data',
2934
- security: [{ scheme: 'bearer', type: 'http' }, {
2935
- in: 'cookie',
2936
- name: 'talqing_session',
2937
- type: 'apiKey'
2938
- }],
2939
- url: '/v1/tasks/{task_id}/runs',
2940
- ...options,
2941
- ...params,
2942
- headers: {
2943
- 'Content-Type': 'application/json',
2944
- ...options?.headers,
2945
- ...params.headers
2946
- }
2947
- });
2948
- }
2949
- /**
2950
- * Get Task Run
2951
- *
2952
- * One run in full: what it produced, every tool it called on the way, and
2953
- * what it cost.
2954
- *
2955
- * This is what answers "why did it write that" for a caller holding one run id
2956
- * — an email batch's review table links each drafted row here. Secret values
2957
- * are redacted from the trace, and a trace that was cut reports it.
2958
- */
2959
- get(parameters, options) {
2960
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'run_id' }] }]);
2961
- return (options?.client ?? this.client).get({
2962
- responseStyle: 'data',
2963
- security: [{ scheme: 'bearer', type: 'http' }, {
2964
- in: 'cookie',
2965
- name: 'talqing_session',
2966
- type: 'apiKey'
2967
- }],
2968
- url: '/v1/tasks/{task_id}/runs/{run_id}',
2969
- ...options,
2970
- ...params
2971
- });
2972
- }
2973
- }
2974
- export class Tasks2 extends HeyApiClient {
3076
+ export class Streams extends HeyApiClient {
2975
3077
  /**
2976
- * List Tasks
2977
- *
2978
- * List the workspace's agent tasks.
3078
+ * List Stream Connections
2979
3079
  *
2980
- * A task is an agent nobody talks to: a prompt, one LLM, tools and MCP
2981
- * servers, the variables it takes as input, and the typed result it must
2982
- * produce. `last_run` says how the most recent run of each one went, so a
2983
- * task whose prompt stopped calling `submit_result` is visible here rather
2984
- * than only in its own history.
3080
+ * List WebSocket media-stream connections a partner can dial.
2985
3081
  */
2986
3082
  list(parameters, options) {
2987
3083
  const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
@@ -2992,30 +3088,21 @@ export class Tasks2 extends HeyApiClient {
2992
3088
  name: 'talqing_session',
2993
3089
  type: 'apiKey'
2994
3090
  }],
2995
- url: '/v1/tasks',
3091
+ url: '/v1/streams',
2996
3092
  ...options,
2997
3093
  ...params
2998
3094
  });
2999
3095
  }
3000
3096
  /**
3001
- * Create Task
3002
- *
3003
- * Create an agent task: an agent nobody talks to, which takes named inputs
3004
- * and returns a typed result.
3005
- *
3006
- * A task has no draft and no publish step: it is valid the moment it saves and
3007
- * callable immediately. An invalid config is a 400 listing every problem and
3008
- * nothing is stored.
3097
+ * Create Stream Connection
3009
3098
  *
3010
- * `output` is what makes this a task rather than a chat agent declare the
3011
- * fields the model must produce and it is given a `submit_result` tool built
3012
- * from them. `vars` are its inputs, read as `{{vars.name}}`.
3099
+ * Create a connection a streaming partner can dial.
3013
3100
  *
3014
- * `warnings` reports the non-fatal problems. There is no publish screen to
3015
- * show them on, so read them here.
3101
+ * One connection per agent per dialect: the URL names both, so a second would
3102
+ * only be the same URL again.
3016
3103
  */
3017
3104
  create(parameters, options) {
3018
- const params = buildClientParams([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
3105
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createStreamConnectionRequest', map: 'body' }] }]);
3019
3106
  return (options?.client ?? this.client).post({
3020
3107
  responseStyle: 'data',
3021
3108
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3023,7 +3110,7 @@ export class Tasks2 extends HeyApiClient {
3023
3110
  name: 'talqing_session',
3024
3111
  type: 'apiKey'
3025
3112
  }],
3026
- url: '/v1/tasks',
3113
+ url: '/v1/streams',
3027
3114
  ...options,
3028
3115
  ...params,
3029
3116
  headers: {
@@ -3034,12 +3121,12 @@ export class Tasks2 extends HeyApiClient {
3034
3121
  });
3035
3122
  }
3036
3123
  /**
3037
- * Delete Task
3124
+ * Delete Stream Connection
3038
3125
  *
3039
- * Delete a task. Its run history survives, still named after it.
3126
+ * Delete a stream connection. Calls it already carried are kept.
3040
3127
  */
3041
3128
  delete(parameters, options) {
3042
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3129
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'connection_id' }] }]);
3043
3130
  return (options?.client ?? this.client).delete({
3044
3131
  responseStyle: 'data',
3045
3132
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3047,18 +3134,18 @@ export class Tasks2 extends HeyApiClient {
3047
3134
  name: 'talqing_session',
3048
3135
  type: 'apiKey'
3049
3136
  }],
3050
- url: '/v1/tasks/{task_id}',
3137
+ url: '/v1/streams/{connection_id}',
3051
3138
  ...options,
3052
3139
  ...params
3053
3140
  });
3054
3141
  }
3055
3142
  /**
3056
- * Get Task
3143
+ * Get Stream Connection
3057
3144
  *
3058
- * Fetch one task's config and how its last run went.
3145
+ * One stream connection, with the URL to hand the partner.
3059
3146
  */
3060
3147
  get(parameters, options) {
3061
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3148
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'connection_id' }] }]);
3062
3149
  return (options?.client ?? this.client).get({
3063
3150
  responseStyle: 'data',
3064
3151
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3066,23 +3153,21 @@ export class Tasks2 extends HeyApiClient {
3066
3153
  name: 'talqing_session',
3067
3154
  type: 'apiKey'
3068
3155
  }],
3069
- url: '/v1/tasks/{task_id}',
3156
+ url: '/v1/streams/{connection_id}',
3070
3157
  ...options,
3071
3158
  ...params
3072
3159
  });
3073
3160
  }
3074
3161
  /**
3075
- * Update Task
3162
+ * Patch Stream Connection
3076
3163
  *
3077
- * Replace a task's config.
3164
+ * Rename a connection, point it at another agent, or disable it.
3078
3165
  *
3079
- * The whole config is sent, so include every field you mean to keep, and it is
3080
- * validated exactly as `create_task` is. The edit takes effect on the next run
3081
- * — a task has no versions, so there is no old wording to go back to and no
3082
- * record of which definition produced an earlier run.
3166
+ * Disabling refuses new calls immediately and is the only way to stop a URL
3167
+ * answering; calls already running are untouched.
3083
3168
  */
3084
3169
  update(parameters, options) {
3085
- const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'patchTaskRequest', map: 'body' }] }]);
3170
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'connection_id' }, { key: 'patchStreamConnectionRequest', map: 'body' }] }]);
3086
3171
  return (options?.client ?? this.client).patch({
3087
3172
  responseStyle: 'data',
3088
3173
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -3090,7 +3175,7 @@ export class Tasks2 extends HeyApiClient {
3090
3175
  name: 'talqing_session',
3091
3176
  type: 'apiKey'
3092
3177
  }],
3093
- url: '/v1/tasks/{task_id}',
3178
+ url: '/v1/streams/{connection_id}',
3094
3179
  ...options,
3095
3180
  ...params,
3096
3181
  headers: {
@@ -3100,9 +3185,6 @@ export class Tasks2 extends HeyApiClient {
3100
3185
  }
3101
3186
  });
3102
3187
  }
3103
- get runs() {
3104
- return this._runs ?? (this._runs = new Runs({ client: this.client }));
3105
- }
3106
3188
  }
3107
3189
  export class Accounts extends HeyApiClient {
3108
3190
  /**
@@ -3494,6 +3576,9 @@ export class Providers extends HeyApiClient {
3494
3576
  }
3495
3577
  }
3496
3578
  export class Telephony extends HeyApiClient {
3579
+ get streams() {
3580
+ return this._streams ?? (this._streams = new Streams({ client: this.client }));
3581
+ }
3497
3582
  get accounts() {
3498
3583
  return this._accounts ?? (this._accounts = new Accounts({ client: this.client }));
3499
3584
  }
@@ -3504,13 +3589,325 @@ export class Telephony extends HeyApiClient {
3504
3589
  return this._providers ?? (this._providers = new Providers({ client: this.client }));
3505
3590
  }
3506
3591
  }
3507
- export class Versions2 extends HeyApiClient {
3592
+ export class Runs extends HeyApiClient {
3508
3593
  /**
3509
- * Get Tool Version
3594
+ * List Task Runs
3510
3595
  *
3511
- * Fetch what one published version of a tool actually contains.
3596
+ * This task's runs, newest first, each with its output, trace and cost.
3512
3597
  *
3513
- * `get_tool` lists the versions and when each was published; this returns the
3598
+ * `task_version` says which published definition each one ran, and is null for
3599
+ * a run of the draft.
3600
+ */
3601
+ list(parameters, options) {
3602
+ const params = buildClientParams([parameters], [{ args: [
3603
+ { in: 'path', key: 'task_id' },
3604
+ { in: 'query', key: 'limit' },
3605
+ { in: 'query', key: 'offset' }
3606
+ ] }]);
3607
+ return (options?.client ?? this.client).get({
3608
+ responseStyle: 'data',
3609
+ security: [{ scheme: 'bearer', type: 'http' }, {
3610
+ in: 'cookie',
3611
+ name: 'talqing_session',
3612
+ type: 'apiKey'
3613
+ }],
3614
+ url: '/v1/tasks/{task_id}/runs',
3615
+ ...options,
3616
+ ...params
3617
+ });
3618
+ }
3619
+ /**
3620
+ * Run Task
3621
+ *
3622
+ * Run the task once with the variables you supply, and wait for the result.
3623
+ *
3624
+ * **This executes for real**: the tools call your endpoints with your secrets,
3625
+ * the MCP servers spend your credits, and the model spends your tokens. A task
3626
+ * that books a slot, charges a card or sends a message will do so.
3627
+ *
3628
+ * Runs the published version unless `version` names another one, or `"draft"`
3629
+ * to run the unpublished config. `vars` must match what that version declares
3630
+ * — an unknown name is refused rather than dropped. The response is the whole
3631
+ * run: the structured `output`, a `trace` of every tool call, the steps used
3632
+ * and what the tokens cost. On failure `error.type` says whose problem it is.
3633
+ * Secrets are redacted.
3634
+ */
3635
+ create(parameters, options) {
3636
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
3637
+ return (options?.client ?? this.client).post({
3638
+ responseStyle: 'data',
3639
+ security: [{ scheme: 'bearer', type: 'http' }, {
3640
+ in: 'cookie',
3641
+ name: 'talqing_session',
3642
+ type: 'apiKey'
3643
+ }],
3644
+ url: '/v1/tasks/{task_id}/runs',
3645
+ ...options,
3646
+ ...params,
3647
+ headers: {
3648
+ 'Content-Type': 'application/json',
3649
+ ...options?.headers,
3650
+ ...params.headers
3651
+ }
3652
+ });
3653
+ }
3654
+ /**
3655
+ * Get Task Run
3656
+ *
3657
+ * One run in full: what it produced, every tool it called on the way, and
3658
+ * what it cost.
3659
+ *
3660
+ * This is what answers "why did it write that" for a caller holding one run id
3661
+ * — an email batch's review table links each drafted row here. Secret values
3662
+ * are redacted from the trace, and a trace that was cut reports it.
3663
+ */
3664
+ get(parameters, options) {
3665
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'run_id' }] }]);
3666
+ return (options?.client ?? this.client).get({
3667
+ responseStyle: 'data',
3668
+ security: [{ scheme: 'bearer', type: 'http' }, {
3669
+ in: 'cookie',
3670
+ name: 'talqing_session',
3671
+ type: 'apiKey'
3672
+ }],
3673
+ url: '/v1/tasks/{task_id}/runs/{run_id}',
3674
+ ...options,
3675
+ ...params
3676
+ });
3677
+ }
3678
+ }
3679
+ export class Versions2 extends HeyApiClient {
3680
+ /**
3681
+ * Get Task Version
3682
+ *
3683
+ * Fetch what one published version of a task actually contains.
3684
+ *
3685
+ * `get_task` lists the versions and when each was published; this returns the
3686
+ * frozen definition itself — prompt, model, output fields and the tool
3687
+ * versions it pinned, exactly as they were at that publish.
3688
+ */
3689
+ get(parameters, options) {
3690
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'version' }] }]);
3691
+ return (options?.client ?? this.client).get({
3692
+ responseStyle: 'data',
3693
+ security: [{ scheme: 'bearer', type: 'http' }, {
3694
+ in: 'cookie',
3695
+ name: 'talqing_session',
3696
+ type: 'apiKey'
3697
+ }],
3698
+ url: '/v1/tasks/{task_id}/versions/{version}',
3699
+ ...options,
3700
+ ...params
3701
+ });
3702
+ }
3703
+ /**
3704
+ * Rollback Task Version
3705
+ *
3706
+ * Put an earlier published version of a task back into production.
3707
+ *
3708
+ * That version becomes live **immediately** and **replaces the current draft**,
3709
+ * so any unpublished edits are lost. No new version is created. The restored
3710
+ * draft tracks each tool's latest published version, not the ones this version
3711
+ * pinned.
3712
+ */
3713
+ rollback(parameters, options) {
3714
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'version' }] }]);
3715
+ return (options?.client ?? this.client).post({
3716
+ responseStyle: 'data',
3717
+ security: [{ scheme: 'bearer', type: 'http' }, {
3718
+ in: 'cookie',
3719
+ name: 'talqing_session',
3720
+ type: 'apiKey'
3721
+ }],
3722
+ url: '/v1/tasks/{task_id}/versions/{version}/rollback',
3723
+ ...options,
3724
+ ...params
3725
+ });
3726
+ }
3727
+ }
3728
+ export class Tasks2 extends HeyApiClient {
3729
+ /**
3730
+ * List Tasks
3731
+ *
3732
+ * List the workspace's agent tasks.
3733
+ *
3734
+ * A task is an agent nobody talks to: a prompt, one LLM, tools and MCP
3735
+ * servers, the variables it takes as input, and the typed result it must
3736
+ * produce. Each item carries the full draft config, the published version
3737
+ * number (null while it has never been published), and `last_run`.
3738
+ */
3739
+ list(parameters, options) {
3740
+ const params = buildClientParams([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
3741
+ return (options?.client ?? this.client).get({
3742
+ responseStyle: 'data',
3743
+ security: [{ scheme: 'bearer', type: 'http' }, {
3744
+ in: 'cookie',
3745
+ name: 'talqing_session',
3746
+ type: 'apiKey'
3747
+ }],
3748
+ url: '/v1/tasks',
3749
+ ...options,
3750
+ ...params
3751
+ });
3752
+ }
3753
+ /**
3754
+ * Create Task
3755
+ *
3756
+ * Create an agent task: an agent nobody talks to, which takes named inputs
3757
+ * and returns a typed result.
3758
+ *
3759
+ * `output` is what makes this a task rather than a chat agent — declare the
3760
+ * fields the model must produce and it is given a `submit_result` tool built
3761
+ * from them. `vars` are its inputs, read as `{{vars.name}}`. The task starts
3762
+ * unpublished; publish it before running it.
3763
+ */
3764
+ create(parameters, options) {
3765
+ const params = buildClientParams([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
3766
+ return (options?.client ?? this.client).post({
3767
+ responseStyle: 'data',
3768
+ security: [{ scheme: 'bearer', type: 'http' }, {
3769
+ in: 'cookie',
3770
+ name: 'talqing_session',
3771
+ type: 'apiKey'
3772
+ }],
3773
+ url: '/v1/tasks',
3774
+ ...options,
3775
+ ...params,
3776
+ headers: {
3777
+ 'Content-Type': 'application/json',
3778
+ ...options?.headers,
3779
+ ...params.headers
3780
+ }
3781
+ });
3782
+ }
3783
+ /**
3784
+ * Delete Task
3785
+ *
3786
+ * Delete a task and its published versions. Its runs survive, still named
3787
+ * after it.
3788
+ */
3789
+ delete(parameters, options) {
3790
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3791
+ return (options?.client ?? this.client).delete({
3792
+ responseStyle: 'data',
3793
+ security: [{ scheme: 'bearer', type: 'http' }, {
3794
+ in: 'cookie',
3795
+ name: 'talqing_session',
3796
+ type: 'apiKey'
3797
+ }],
3798
+ url: '/v1/tasks/{task_id}',
3799
+ ...options,
3800
+ ...params
3801
+ });
3802
+ }
3803
+ /**
3804
+ * Get Task
3805
+ *
3806
+ * Fetch one task's draft config, published version, history and last run.
3807
+ */
3808
+ get(parameters, options) {
3809
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3810
+ return (options?.client ?? this.client).get({
3811
+ responseStyle: 'data',
3812
+ security: [{ scheme: 'bearer', type: 'http' }, {
3813
+ in: 'cookie',
3814
+ name: 'talqing_session',
3815
+ type: 'apiKey'
3816
+ }],
3817
+ url: '/v1/tasks/{task_id}',
3818
+ ...options,
3819
+ ...params
3820
+ });
3821
+ }
3822
+ /**
3823
+ * Update Task
3824
+ *
3825
+ * Replace the task's draft config with the one supplied.
3826
+ *
3827
+ * The whole config is sent, so include every field you mean to keep. Writes
3828
+ * land on the draft only — runs and email batches keep using the published
3829
+ * version until you publish again.
3830
+ */
3831
+ update(parameters, options) {
3832
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'patchTaskRequest', map: 'body' }] }]);
3833
+ return (options?.client ?? this.client).patch({
3834
+ responseStyle: 'data',
3835
+ security: [{ scheme: 'bearer', type: 'http' }, {
3836
+ in: 'cookie',
3837
+ name: 'talqing_session',
3838
+ type: 'apiKey'
3839
+ }],
3840
+ url: '/v1/tasks/{task_id}',
3841
+ ...options,
3842
+ ...params,
3843
+ headers: {
3844
+ 'Content-Type': 'application/json',
3845
+ ...options?.headers,
3846
+ ...params.headers
3847
+ }
3848
+ });
3849
+ }
3850
+ /**
3851
+ * Publish Task
3852
+ *
3853
+ * Freeze the current draft as a new immutable version and make it live.
3854
+ *
3855
+ * Validation must pass. Publishing pins every attached tool to the tool
3856
+ * version live right now, so republishing a tool does not change this task
3857
+ * until the task is published again.
3858
+ */
3859
+ publish(parameters, options) {
3860
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3861
+ return (options?.client ?? this.client).post({
3862
+ responseStyle: 'data',
3863
+ security: [{ scheme: 'bearer', type: 'http' }, {
3864
+ in: 'cookie',
3865
+ name: 'talqing_session',
3866
+ type: 'apiKey'
3867
+ }],
3868
+ url: '/v1/tasks/{task_id}/publish',
3869
+ ...options,
3870
+ ...params
3871
+ });
3872
+ }
3873
+ /**
3874
+ * Validate Task
3875
+ *
3876
+ * Run publish-grade validation on the draft without publishing it.
3877
+ *
3878
+ * Covers everything a draft write checks plus what publishing adds: a
3879
+ * workspace API key for the model, at least one output field, the operation
3880
+ * trees of the attached tools, and the email batches already drafting with
3881
+ * this task. Returns errors (blocking) and warnings (advisory).
3882
+ */
3883
+ validate(parameters, options) {
3884
+ const params = buildClientParams([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3885
+ return (options?.client ?? this.client).post({
3886
+ responseStyle: 'data',
3887
+ security: [{ scheme: 'bearer', type: 'http' }, {
3888
+ in: 'cookie',
3889
+ name: 'talqing_session',
3890
+ type: 'apiKey'
3891
+ }],
3892
+ url: '/v1/tasks/{task_id}/validate',
3893
+ ...options,
3894
+ ...params
3895
+ });
3896
+ }
3897
+ get runs() {
3898
+ return this._runs ?? (this._runs = new Runs({ client: this.client }));
3899
+ }
3900
+ get versions() {
3901
+ return this._versions ?? (this._versions = new Versions2({ client: this.client }));
3902
+ }
3903
+ }
3904
+ export class Versions3 extends HeyApiClient {
3905
+ /**
3906
+ * Get Tool Version
3907
+ *
3908
+ * Fetch what one published version of a tool actually contains.
3909
+ *
3910
+ * `get_tool` lists the versions and when each was published; this returns the
3514
3911
  * frozen definition itself — the arguments, behaviour flags and operation tree
3515
3912
  * exactly as they were at that publish. Use it to see what changed between two
3516
3913
  * versions, or between a version and the current draft.
@@ -3760,7 +4157,7 @@ export class Tools2 extends HeyApiClient {
3760
4157
  });
3761
4158
  }
3762
4159
  get versions() {
3763
- return this._versions ?? (this._versions = new Versions2({ client: this.client }));
4160
+ return this._versions ?? (this._versions = new Versions3({ client: this.client }));
3764
4161
  }
3765
4162
  }
3766
4163
  export class Webhooks extends HeyApiClient {
@@ -3951,7 +4348,9 @@ export class TalqingApi extends HeyApiClient {
3951
4348
  * Liveness probe: `200` once this process is serving. Unauthenticated.
3952
4349
  *
3953
4350
  * It answers for the API process, not its dependencies — a `200` here does
3954
- * not promise Postgres, Redis or LiveKit are reachable.
4351
+ * not promise Postgres, Redis or LiveKit are reachable. The one thing it
4352
+ * does report is `model_registry`, because that snapshot lives in this
4353
+ * process's memory and nothing else can see how old it is.
3955
4354
  */
3956
4355
  health(options) {
3957
4356
  return (options?.client ?? this.client).get({
@@ -3999,12 +4398,12 @@ export class TalqingApi extends HeyApiClient {
3999
4398
  get secrets() {
4000
4399
  return this._secrets ?? (this._secrets = new Secrets({ client: this.client }));
4001
4400
  }
4002
- get tasks() {
4003
- return this._tasks ?? (this._tasks = new Tasks2({ client: this.client }));
4004
- }
4005
4401
  get telephony() {
4006
4402
  return this._telephony ?? (this._telephony = new Telephony({ client: this.client }));
4007
4403
  }
4404
+ get tasks() {
4405
+ return this._tasks ?? (this._tasks = new Tasks2({ client: this.client }));
4406
+ }
4008
4407
  get tools() {
4009
4408
  return this._tools ?? (this._tools = new Tools2({ client: this.client }));
4010
4409
  }