@talqing/sdk 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // This file is auto-generated by @hey-api/openapi-ts
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TalqingApi = exports.Webhooks = exports.Tools2 = exports.Versions2 = exports.Telephony = exports.Providers = exports.PhoneNumbers = exports.Accounts = exports.Tasks2 = exports.Runs = exports.Secrets = exports.Schemas = exports.Observability = exports.Knowledge2 = exports.Pages = exports.Nodes = exports.Integrations = exports.Triggers = exports.McpTools = exports.Email = exports.Senders = exports.Batches2 = exports.Recipients2 = exports.Copilot = exports.Tools = exports.Tasks = exports.Knowledge = exports.Agents2 = exports.Conversations = exports.Sessions = exports.Items = exports.Messages = exports.Catalog = exports.Voices = exports.Elevenlabs = exports.Avatars = exports.Calls = exports.ScreenRecording = exports.Recording = exports.Batches = exports.Recipients = exports.Analysis = exports.ProviderKeys = exports.Billing = exports.Credits = exports.Agents = exports.Versions = void 0;
4
+ exports.TalqingApi = exports.Webhooks = exports.Tools2 = exports.Versions3 = exports.Telephony = exports.Providers = exports.PhoneNumbers = exports.Accounts = exports.Tasks2 = exports.Versions2 = exports.Runs = exports.Secrets = exports.Schemas = exports.Functions = exports.Observability = exports.Knowledge2 = exports.Pages = exports.Nodes = exports.Integrations = exports.Triggers = exports.McpTools = exports.Email = exports.Senders = exports.Batches2 = exports.Sends = exports.Recipients2 = exports.Copilot = exports.Tools = exports.Tasks = exports.Knowledge = exports.Agents2 = exports.Conversations = exports.Sessions = exports.Items = exports.Messages = exports.Catalog = exports.Voices = exports.Elevenlabs = exports.Avatars = exports.Calls = exports.ScreenRecording = exports.Recording = exports.Batches = exports.Recipients = exports.Analysis = exports.ProviderKeys = exports.Billing = exports.Credits = exports.Agents = exports.Versions = void 0;
5
5
  const client_gen_js_1 = require("./client.gen.js");
6
6
  const index_js_1 = require("./client/index.js");
7
7
  class HeyApiClient {
@@ -1794,6 +1794,37 @@ class Recipients2 extends HeyApiClient {
1794
1794
  }
1795
1795
  });
1796
1796
  }
1797
+ /**
1798
+ * Redraft Email Batch Recipients
1799
+ *
1800
+ * Draft rows again from scratch. **Each one runs the task and is billed again.**
1801
+ *
1802
+ * `selection` is `failed` (drafting failed), `stale_version` (drafted by an
1803
+ * older published version of the task), `not_sent`, or `all` — which names
1804
+ * every row it refuses. Rows already sent or queued are never redrafted.
1805
+ *
1806
+ * This revives a batch that had finished drafting, and a person's edited cells
1807
+ * survive unless you pass `clear_overrides`.
1808
+ */
1809
+ redraft(parameters, options) {
1810
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'redraftRequest', map: 'body' }] }]);
1811
+ return (options?.client ?? this.client).post({
1812
+ responseStyle: 'data',
1813
+ security: [{ scheme: 'bearer', type: 'http' }, {
1814
+ in: 'cookie',
1815
+ name: 'talqing_session',
1816
+ type: 'apiKey'
1817
+ }],
1818
+ url: '/v1/email/batches/{batch_id}/redraft',
1819
+ ...options,
1820
+ ...params,
1821
+ headers: {
1822
+ 'Content-Type': 'application/json',
1823
+ ...options?.headers,
1824
+ ...params.headers
1825
+ }
1826
+ });
1827
+ }
1797
1828
  /**
1798
1829
  * Restore Email Batch Recipients
1799
1830
  *
@@ -1819,17 +1850,15 @@ class Recipients2 extends HeyApiClient {
1819
1850
  });
1820
1851
  }
1821
1852
  /**
1822
- * Retry Email Batch Recipients
1853
+ * Skip Email Batch Recipients
1823
1854
  *
1824
- * Draft rows whose first attempt failed, again.
1855
+ * Take drafted rows out of consideration. Reversible with `restore`.
1825
1856
  *
1826
- * `selection: "all_eligible"` means every row whose drafting failed. This is
1827
- * the one action that revives a batch that has already finished drafting: it
1828
- * goes back to `drafting` and picks up exactly the rows you retried the
1829
- * alternative would be telling you that twelve failed rows are unrecoverable
1830
- * because the other 4 988 finished first.
1857
+ * Takes either `recipient_ids` or `selection: "all_eligible"`, which here means
1858
+ * every row that has a draft. The reversible verbs keep that shorthand while
1859
+ * `send` does not, because the rule is about irreversibility rather than bulk.
1831
1860
  */
1832
- retry(parameters, options) {
1861
+ skip(parameters, options) {
1833
1862
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
1834
1863
  return (options?.client ?? this.client).post({
1835
1864
  responseStyle: 'data',
@@ -1838,7 +1867,7 @@ class Recipients2 extends HeyApiClient {
1838
1867
  name: 'talqing_session',
1839
1868
  type: 'apiKey'
1840
1869
  }],
1841
- url: '/v1/email/batches/{batch_id}/retry',
1870
+ url: '/v1/email/batches/{batch_id}/skip',
1842
1871
  ...options,
1843
1872
  ...params,
1844
1873
  headers: {
@@ -1848,21 +1877,48 @@ class Recipients2 extends HeyApiClient {
1848
1877
  }
1849
1878
  });
1850
1879
  }
1880
+ }
1881
+ exports.Recipients2 = Recipients2;
1882
+ class Sends extends HeyApiClient {
1883
+ /**
1884
+ * List Email Sends
1885
+ *
1886
+ * Every send on this batch, newest first, with its counts and its schedule.
1887
+ */
1888
+ list(parameters, options) {
1889
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
1890
+ { in: 'path', key: 'batch_id' },
1891
+ { in: 'query', key: 'limit' },
1892
+ { in: 'query', key: 'offset' }
1893
+ ] }]);
1894
+ return (options?.client ?? this.client).get({
1895
+ responseStyle: 'data',
1896
+ security: [{ scheme: 'bearer', type: 'http' }, {
1897
+ in: 'cookie',
1898
+ name: 'talqing_session',
1899
+ type: 'apiKey'
1900
+ }],
1901
+ url: '/v1/email/batches/{batch_id}/sends',
1902
+ ...options,
1903
+ ...params
1904
+ });
1905
+ }
1851
1906
  /**
1852
- * Send Email Batch Recipients
1907
+ * Create Email Send
1853
1908
  *
1854
- * Send the rows you name. **This mails real people and cannot be undone.**
1909
+ * Send these rows. **This mails real people and cannot be undone.**
1855
1910
  *
1856
- * At most 50 rows per call, named one by one — there is no "select all" and no
1857
- * bulk form of this. A row whose `to`, `subject` or `body` does not resolve
1858
- * comes back in `rejected` and stays a draft; fix it with
1859
- * `patch_email_batch_recipient` and try again.
1911
+ * Name `recipient_ids`, or pass `selection: "all_drafts"` for every reviewed
1912
+ * draft. A row whose `to`, `subject` or `body` does not resolve comes back in
1913
+ * `rejected` and stays a draft; fix it with `patch_email_batch_recipient`.
1860
1914
  *
1861
- * `from_email`, `from_name` and `reply_to` override the sender for this call
1862
- * only, and must be on a domain verified on the same Resend account.
1915
+ * The send is a row you can steer: `start_at` schedules it, `window` holds it
1916
+ * to business hours, `send_gap_seconds` paces it and `send_daily_cap` bounds
1917
+ * how many leave per day. Everything omitted comes from the batch. Cancel it
1918
+ * and every unsent row comes back as a draft.
1863
1919
  */
1864
- send(parameters, options) {
1865
- const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'sendEmailBatchRequest', map: 'body' }] }]);
1920
+ create(parameters, options) {
1921
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'createEmailSendRequest', map: 'body' }] }]);
1866
1922
  return (options?.client ?? this.client).post({
1867
1923
  responseStyle: 'data',
1868
1924
  security: [{ scheme: 'bearer', type: 'http' }, {
@@ -1870,7 +1926,7 @@ class Recipients2 extends HeyApiClient {
1870
1926
  name: 'talqing_session',
1871
1927
  type: 'apiKey'
1872
1928
  }],
1873
- url: '/v1/email/batches/{batch_id}/send',
1929
+ url: '/v1/email/batches/{batch_id}/sends',
1874
1930
  ...options,
1875
1931
  ...params,
1876
1932
  headers: {
@@ -1881,24 +1937,49 @@ class Recipients2 extends HeyApiClient {
1881
1937
  });
1882
1938
  }
1883
1939
  /**
1884
- * Skip Email Batch Recipients
1940
+ * Get Email Send
1885
1941
  *
1886
- * Take drafted rows out of consideration. Reversible with `restore`.
1942
+ * One send: where its rows are, and when it next does something.
1887
1943
  *
1888
- * Takes either `recipient_ids` or `selection: "all_eligible"`, which here means
1889
- * every row that has a draft. The reversible verbs keep that shorthand while
1890
- * `send` does not, because the rule is about irreversibility rather than bulk.
1944
+ * `next_send_at` covers all three reasons a send waits — a start time, a closed
1945
+ * window, and a daily cap already spent.
1891
1946
  */
1892
- skip(parameters, options) {
1893
- const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'selectRecipientsRequest', map: 'body' }] }]);
1894
- return (options?.client ?? this.client).post({
1947
+ get(parameters, options) {
1948
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
1949
+ return (options?.client ?? this.client).get({
1895
1950
  responseStyle: 'data',
1896
1951
  security: [{ scheme: 'bearer', type: 'http' }, {
1897
1952
  in: 'cookie',
1898
1953
  name: 'talqing_session',
1899
1954
  type: 'apiKey'
1900
1955
  }],
1901
- url: '/v1/email/batches/{batch_id}/skip',
1956
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}',
1957
+ ...options,
1958
+ ...params
1959
+ });
1960
+ }
1961
+ /**
1962
+ * Patch Email Send
1963
+ *
1964
+ * Re-steer one send: its pace, its hours, its daily cap, its start time.
1965
+ *
1966
+ * Never its sender, and never which rows it holds — to change that, cancel it
1967
+ * and create another. `start_at` moves only before the send has begun.
1968
+ */
1969
+ update(parameters, options) {
1970
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
1971
+ { in: 'path', key: 'batch_id' },
1972
+ { in: 'path', key: 'send_id' },
1973
+ { key: 'patchEmailSendRequest', map: 'body' }
1974
+ ] }]);
1975
+ return (options?.client ?? this.client).patch({
1976
+ responseStyle: 'data',
1977
+ security: [{ scheme: 'bearer', type: 'http' }, {
1978
+ in: 'cookie',
1979
+ name: 'talqing_session',
1980
+ type: 'apiKey'
1981
+ }],
1982
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}',
1902
1983
  ...options,
1903
1984
  ...params,
1904
1985
  headers: {
@@ -1908,8 +1989,70 @@ class Recipients2 extends HeyApiClient {
1908
1989
  }
1909
1990
  });
1910
1991
  }
1992
+ /**
1993
+ * Cancel Email Send
1994
+ *
1995
+ * Stop this send, and give every row it has not sent back as a draft.
1996
+ *
1997
+ * Not a destructive action: the drafts come back exactly as they were, ready
1998
+ * for another send. It is also the only way to change what a scheduled send
1999
+ * contains — a send's rows are fixed once it exists.
2000
+ */
2001
+ cancel(parameters, options) {
2002
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2003
+ return (options?.client ?? this.client).post({
2004
+ responseStyle: 'data',
2005
+ security: [{ scheme: 'bearer', type: 'http' }, {
2006
+ in: 'cookie',
2007
+ name: 'talqing_session',
2008
+ type: 'apiKey'
2009
+ }],
2010
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/cancel',
2011
+ ...options,
2012
+ ...params
2013
+ });
2014
+ }
2015
+ /**
2016
+ * Pause Email Send
2017
+ *
2018
+ * Stop sending. It takes hold on the next email, and nothing is lost —
2019
+ * the rows stay queued for whenever you resume.
2020
+ */
2021
+ pause(parameters, options) {
2022
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2023
+ return (options?.client ?? this.client).post({
2024
+ responseStyle: 'data',
2025
+ security: [{ scheme: 'bearer', type: 'http' }, {
2026
+ in: 'cookie',
2027
+ name: 'talqing_session',
2028
+ type: 'apiKey'
2029
+ }],
2030
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/pause',
2031
+ ...options,
2032
+ ...params
2033
+ });
2034
+ }
2035
+ /**
2036
+ * Resume Email Send
2037
+ *
2038
+ * Undo a pause and carry on from where it stopped.
2039
+ */
2040
+ resume(parameters, options) {
2041
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { in: 'path', key: 'send_id' }] }]);
2042
+ return (options?.client ?? this.client).post({
2043
+ responseStyle: 'data',
2044
+ security: [{ scheme: 'bearer', type: 'http' }, {
2045
+ in: 'cookie',
2046
+ name: 'talqing_session',
2047
+ type: 'apiKey'
2048
+ }],
2049
+ url: '/v1/email/batches/{batch_id}/sends/{send_id}/resume',
2050
+ ...options,
2051
+ ...params
2052
+ });
2053
+ }
1911
2054
  }
1912
- exports.Recipients2 = Recipients2;
2055
+ exports.Sends = Sends;
1913
2056
  class Batches2 extends HeyApiClient {
1914
2057
  /**
1915
2058
  * List Email Batches
@@ -1950,13 +2093,16 @@ class Batches2 extends HeyApiClient {
1950
2093
  * scraped contacts — and this runs on your account under your agreement.
1951
2094
  *
1952
2095
  * **Nothing is sent that a person has not selected.** Creating a batch only
1953
- * starts drafting; sending is a separate call over at most 50 named rows.
2096
+ * starts drafting; sending is a separate call that creates a send you can
2097
+ * schedule, pace, pause and cancel.
1954
2098
  *
1955
- * **Every row runs your task as it stands right now** — a task has no
1956
- * versions, so editing it mid-batch changes every row drafted after that.
2099
+ * **Every row runs the task's CURRENT published version**, re-read every pass,
2100
+ * so publishing a better prompt mid-batch changes every row drafted after it.
1957
2101
  *
1958
2102
  * `field_map` points `to`, `subject` and `body` at a column of your list or at
1959
- * a field the task produces. An invalid batch is a 400 listing every problem.
2103
+ * a field the task produces. `window` is when email may LEAVE, inherited by
2104
+ * every send; drafting is not restricted by hours. An invalid batch is a 400
2105
+ * listing every problem.
1960
2106
  *
1961
2107
  * There is no spend cap: every row runs the task and is billed, so a 5 000-row
1962
2108
  * batch doing research costs 5 000 task runs whether or not anything is sent.
@@ -1983,9 +2129,10 @@ class Batches2 extends HeyApiClient {
1983
2129
  /**
1984
2130
  * Get Email Batch
1985
2131
  *
1986
- * One batch: its policy, its per-status counts, what drafting has cost so
1987
- * far, and — while it is waiting on a start time or a closed window —
1988
- * `next_draft_at`.
2132
+ * One batch: its policy, its per-status counts and what drafting has cost.
2133
+ *
2134
+ * `drafted_versions` says which published version of the task wrote how many
2135
+ * rows, and `sent_today` how much of `send_daily_cap` is left today.
1989
2136
  */
1990
2137
  get(parameters, options) {
1991
2138
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
@@ -2006,10 +2153,12 @@ class Batches2 extends HeyApiClient {
2006
2153
  *
2007
2154
  * Edit a batch's policy. The next drafting pass reads the new row.
2008
2155
  *
2009
- * Pacing and the calling window are editable at any time. The sender, the body
2010
- * format and the field map freeze once the batch has sent anything changing
2011
- * them then would make the rows already delivered no longer describe what they
2012
- * were sent as. `start_at` moves only while the batch is still scheduled.
2156
+ * Pacing, the window and the daily cap are editable at any time; the sending
2157
+ * half is the DEFAULT for the next send, and a send already created carries its
2158
+ * own copy. The sender, the body format and the field map freeze once the batch
2159
+ * has sent anything changing them then would make the rows already delivered
2160
+ * no longer describe what they were sent as. `start_at` moves only while the
2161
+ * batch is still scheduled.
2013
2162
  */
2014
2163
  update(parameters, options) {
2015
2164
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchEmailBatchRequest', map: 'body' }] }]);
@@ -2033,12 +2182,12 @@ class Batches2 extends HeyApiClient {
2033
2182
  /**
2034
2183
  * Cancel Email Batch
2035
2184
  *
2036
- * Stop drafting for good. This is the only terminal action a batch cannot
2037
- * be deleted, because it is the record of what was sent to whom.
2185
+ * Stop drafting for good. A batch cannot be deleted, because it is the
2186
+ * record of what was sent to whom.
2038
2187
  *
2039
- * Rows already drafted are **not** touched: cancelling stops drafting, and
2040
- * drafts already produced are still worth reviewing and sending. Rows never
2041
- * reached report as `canceled`.
2188
+ * Rows already drafted are **not** touched and neither is any send: cancelling
2189
+ * stops drafting, and drafts already produced are still worth reviewing and
2190
+ * sending. Rows never reached report as `canceled`.
2042
2191
  */
2043
2192
  cancel(parameters, options) {
2044
2193
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
@@ -2098,6 +2247,9 @@ class Batches2 extends HeyApiClient {
2098
2247
  get recipients() {
2099
2248
  return this._recipients ?? (this._recipients = new Recipients2({ client: this.client }));
2100
2249
  }
2250
+ get sends() {
2251
+ return this._sends ?? (this._sends = new Sends({ client: this.client }));
2252
+ }
2101
2253
  }
2102
2254
  exports.Batches2 = Batches2;
2103
2255
  class Senders extends HeyApiClient {
@@ -2245,8 +2397,10 @@ class Triggers extends HeyApiClient {
2245
2397
  * Patch Integration Trigger
2246
2398
  *
2247
2399
  * Update a trigger: reassign the agent, change reply mode, enable or
2248
- * disable it. Omitted fields are left unchanged. The same checks as creation
2249
- * run when enabling.
2400
+ * disable it.
2401
+ *
2402
+ * Omitted fields are left unchanged, and enabling one runs the same checks
2403
+ * creating it did.
2250
2404
  */
2251
2405
  update(parameters, options) {
2252
2406
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
@@ -2789,6 +2943,33 @@ class Observability extends HeyApiClient {
2789
2943
  }
2790
2944
  }
2791
2945
  exports.Observability = Observability;
2946
+ class Functions extends HeyApiClient {
2947
+ /**
2948
+ * Describe Function
2949
+ *
2950
+ * The full argument schema of one function, by name.
2951
+ *
2952
+ * Every function's arguments are fetched here rather than shown up front, so
2953
+ * call this before the first time you use one. Two exceptions, which carry
2954
+ * their own shape because they would otherwise be uncallable: this function
2955
+ * and `describe_schema`.
2956
+ */
2957
+ get(parameters, options) {
2958
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'name' }] }]);
2959
+ return (options?.client ?? this.client).get({
2960
+ responseStyle: 'data',
2961
+ security: [{ scheme: 'bearer', type: 'http' }, {
2962
+ in: 'cookie',
2963
+ name: 'talqing_session',
2964
+ type: 'apiKey'
2965
+ }],
2966
+ url: '/v1/schemas/functions/{name}',
2967
+ ...options,
2968
+ ...params
2969
+ });
2970
+ }
2971
+ }
2972
+ exports.Functions = Functions;
2792
2973
  class Schemas extends HeyApiClient {
2793
2974
  /**
2794
2975
  * Describe Schema
@@ -2820,6 +3001,9 @@ class Schemas extends HeyApiClient {
2820
3001
  ...params
2821
3002
  });
2822
3003
  }
3004
+ get functions() {
3005
+ return this._functions ?? (this._functions = new Functions({ client: this.client }));
3006
+ }
2823
3007
  }
2824
3008
  exports.Schemas = Schemas;
2825
3009
  class Secrets extends HeyApiClient {
@@ -2900,8 +3084,8 @@ class Runs extends HeyApiClient {
2900
3084
  *
2901
3085
  * This task's runs, newest first, each with its output, trace and cost.
2902
3086
  *
2903
- * A run records the task's *name* and nothing else about the definition it ran
2904
- * under, so two runs either side of an edit are indistinguishable here.
3087
+ * `task_version` says which published definition each one ran, and is null for
3088
+ * a run of the draft.
2905
3089
  */
2906
3090
  list(parameters, options) {
2907
3091
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
@@ -2930,10 +3114,12 @@ class Runs extends HeyApiClient {
2930
3114
  * the MCP servers spend your credits, and the model spends your tokens. A task
2931
3115
  * that books a slot, charges a card or sends a message will do so.
2932
3116
  *
2933
- * `vars` must match what the task declares an unknown name is refused rather
2934
- * than dropped. The response is the whole run: the structured `output`, a
2935
- * `trace` of every tool call, the steps used and what the tokens cost. On
2936
- * failure `error.type` says whose problem it is. Secrets are redacted.
3117
+ * Runs the published version unless `version` names another one, or `"draft"`
3118
+ * to run the unpublished config. `vars` must match what that version declares
3119
+ * an unknown name is refused rather than dropped. The response is the whole
3120
+ * run: the structured `output`, a `trace` of every tool call, the steps used
3121
+ * and what the tokens cost. On failure `error.type` says whose problem it is.
3122
+ * Secrets are redacted.
2937
3123
  */
2938
3124
  create(parameters, options) {
2939
3125
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
@@ -2980,6 +3166,56 @@ class Runs extends HeyApiClient {
2980
3166
  }
2981
3167
  }
2982
3168
  exports.Runs = Runs;
3169
+ class Versions2 extends HeyApiClient {
3170
+ /**
3171
+ * Get Task Version
3172
+ *
3173
+ * Fetch what one published version of a task actually contains.
3174
+ *
3175
+ * `get_task` lists the versions and when each was published; this returns the
3176
+ * frozen definition itself — prompt, model, output fields and the tool
3177
+ * versions it pinned, exactly as they were at that publish.
3178
+ */
3179
+ get(parameters, options) {
3180
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'version' }] }]);
3181
+ return (options?.client ?? this.client).get({
3182
+ responseStyle: 'data',
3183
+ security: [{ scheme: 'bearer', type: 'http' }, {
3184
+ in: 'cookie',
3185
+ name: 'talqing_session',
3186
+ type: 'apiKey'
3187
+ }],
3188
+ url: '/v1/tasks/{task_id}/versions/{version}',
3189
+ ...options,
3190
+ ...params
3191
+ });
3192
+ }
3193
+ /**
3194
+ * Rollback Task Version
3195
+ *
3196
+ * Put an earlier published version of a task back into production.
3197
+ *
3198
+ * That version becomes live **immediately** and **replaces the current draft**,
3199
+ * so any unpublished edits are lost. No new version is created. The restored
3200
+ * draft tracks each tool's latest published version, not the ones this version
3201
+ * pinned.
3202
+ */
3203
+ rollback(parameters, options) {
3204
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { in: 'path', key: 'version' }] }]);
3205
+ return (options?.client ?? this.client).post({
3206
+ responseStyle: 'data',
3207
+ security: [{ scheme: 'bearer', type: 'http' }, {
3208
+ in: 'cookie',
3209
+ name: 'talqing_session',
3210
+ type: 'apiKey'
3211
+ }],
3212
+ url: '/v1/tasks/{task_id}/versions/{version}/rollback',
3213
+ ...options,
3214
+ ...params
3215
+ });
3216
+ }
3217
+ }
3218
+ exports.Versions2 = Versions2;
2983
3219
  class Tasks2 extends HeyApiClient {
2984
3220
  /**
2985
3221
  * List Tasks
@@ -2988,9 +3224,8 @@ class Tasks2 extends HeyApiClient {
2988
3224
  *
2989
3225
  * A task is an agent nobody talks to: a prompt, one LLM, tools and MCP
2990
3226
  * servers, the variables it takes as input, and the typed result it must
2991
- * produce. `last_run` says how the most recent run of each one went, so a
2992
- * task whose prompt stopped calling `submit_result` is visible here rather
2993
- * than only in its own history.
3227
+ * produce. Each item carries the full draft config, the published version
3228
+ * number (null while it has never been published), and `last_run`.
2994
3229
  */
2995
3230
  list(parameters, options) {
2996
3231
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
@@ -3009,18 +3244,13 @@ class Tasks2 extends HeyApiClient {
3009
3244
  /**
3010
3245
  * Create Task
3011
3246
  *
3012
- * Create an agent task.
3013
- *
3014
- * A task has no draft and no publish step: it is valid the moment it saves and
3015
- * callable immediately. An invalid config is a 400 listing every problem and
3016
- * nothing is stored.
3247
+ * Create an agent task: an agent nobody talks to, which takes named inputs
3248
+ * and returns a typed result.
3017
3249
  *
3018
3250
  * `output` is what makes this a task rather than a chat agent — declare the
3019
3251
  * fields the model must produce and it is given a `submit_result` tool built
3020
- * from them. `vars` are its inputs, read as `{{vars.name}}`.
3021
- *
3022
- * `warnings` reports the non-fatal problems. There is no publish screen to
3023
- * show them on, so read them here.
3252
+ * from them. `vars` are its inputs, read as `{{vars.name}}`. The task starts
3253
+ * unpublished; publish it before running it.
3024
3254
  */
3025
3255
  create(parameters, options) {
3026
3256
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
@@ -3044,7 +3274,8 @@ class Tasks2 extends HeyApiClient {
3044
3274
  /**
3045
3275
  * Delete Task
3046
3276
  *
3047
- * Delete a task. Its run history survives, still named after it.
3277
+ * Delete a task and its published versions. Its runs survive, still named
3278
+ * after it.
3048
3279
  */
3049
3280
  delete(parameters, options) {
3050
3281
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
@@ -3063,7 +3294,7 @@ class Tasks2 extends HeyApiClient {
3063
3294
  /**
3064
3295
  * Get Task
3065
3296
  *
3066
- * Fetch one task's config and how its last run went.
3297
+ * Fetch one task's draft config, published version, history and last run.
3067
3298
  */
3068
3299
  get(parameters, options) {
3069
3300
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
@@ -3082,12 +3313,11 @@ class Tasks2 extends HeyApiClient {
3082
3313
  /**
3083
3314
  * Update Task
3084
3315
  *
3085
- * Replace a task's config.
3316
+ * Replace the task's draft config with the one supplied.
3086
3317
  *
3087
- * The whole config is sent, so include every field you mean to keep, and it is
3088
- * validated exactly as `create_task` is. The edit takes effect on the next run
3089
- * a task has no versions, so there is no old wording to go back to and no
3090
- * record of which definition produced an earlier run.
3318
+ * The whole config is sent, so include every field you mean to keep. Writes
3319
+ * land on the draft only runs and email batches keep using the published
3320
+ * version until you publish again.
3091
3321
  */
3092
3322
  update(parameters, options) {
3093
3323
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'patchTaskRequest', map: 'body' }] }]);
@@ -3108,9 +3338,59 @@ class Tasks2 extends HeyApiClient {
3108
3338
  }
3109
3339
  });
3110
3340
  }
3341
+ /**
3342
+ * Publish Task
3343
+ *
3344
+ * Freeze the current draft as a new immutable version and make it live.
3345
+ *
3346
+ * Validation must pass. Publishing pins every attached tool to the tool
3347
+ * version live right now, so republishing a tool does not change this task
3348
+ * until the task is published again.
3349
+ */
3350
+ publish(parameters, options) {
3351
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3352
+ return (options?.client ?? this.client).post({
3353
+ responseStyle: 'data',
3354
+ security: [{ scheme: 'bearer', type: 'http' }, {
3355
+ in: 'cookie',
3356
+ name: 'talqing_session',
3357
+ type: 'apiKey'
3358
+ }],
3359
+ url: '/v1/tasks/{task_id}/publish',
3360
+ ...options,
3361
+ ...params
3362
+ });
3363
+ }
3364
+ /**
3365
+ * Validate Task
3366
+ *
3367
+ * Run publish-grade validation on the draft without publishing it.
3368
+ *
3369
+ * Covers everything a draft write checks plus what publishing adds: a
3370
+ * workspace API key for the model, at least one output field, the operation
3371
+ * trees of the attached tools, and the email batches already drafting with
3372
+ * this task. Returns errors (blocking) and warnings (advisory).
3373
+ */
3374
+ validate(parameters, options) {
3375
+ const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
3376
+ return (options?.client ?? this.client).post({
3377
+ responseStyle: 'data',
3378
+ security: [{ scheme: 'bearer', type: 'http' }, {
3379
+ in: 'cookie',
3380
+ name: 'talqing_session',
3381
+ type: 'apiKey'
3382
+ }],
3383
+ url: '/v1/tasks/{task_id}/validate',
3384
+ ...options,
3385
+ ...params
3386
+ });
3387
+ }
3111
3388
  get runs() {
3112
3389
  return this._runs ?? (this._runs = new Runs({ client: this.client }));
3113
3390
  }
3391
+ get versions() {
3392
+ return this._versions ?? (this._versions = new Versions2({ client: this.client }));
3393
+ }
3114
3394
  }
3115
3395
  exports.Tasks2 = Tasks2;
3116
3396
  class Accounts extends HeyApiClient {
@@ -3517,7 +3797,7 @@ class Telephony extends HeyApiClient {
3517
3797
  }
3518
3798
  }
3519
3799
  exports.Telephony = Telephony;
3520
- class Versions2 extends HeyApiClient {
3800
+ class Versions3 extends HeyApiClient {
3521
3801
  /**
3522
3802
  * Get Tool Version
3523
3803
  *
@@ -3568,7 +3848,7 @@ class Versions2 extends HeyApiClient {
3568
3848
  });
3569
3849
  }
3570
3850
  }
3571
- exports.Versions2 = Versions2;
3851
+ exports.Versions3 = Versions3;
3572
3852
  class Tools2 extends HeyApiClient {
3573
3853
  /**
3574
3854
  * List Tools
@@ -3774,7 +4054,7 @@ class Tools2 extends HeyApiClient {
3774
4054
  });
3775
4055
  }
3776
4056
  get versions() {
3777
- return this._versions ?? (this._versions = new Versions2({ client: this.client }));
4057
+ return this._versions ?? (this._versions = new Versions3({ client: this.client }));
3778
4058
  }
3779
4059
  }
3780
4060
  exports.Tools2 = Tools2;