@talqing/sdk 0.4.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.Functions = 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.
@@ -1985,8 +2131,8 @@ class Batches2 extends HeyApiClient {
1985
2131
  *
1986
2132
  * One batch: its policy, its per-status counts and what drafting has cost.
1987
2133
  *
1988
- * While the batch is waiting on a start time or a closed window, the response
1989
- * also carries `next_draft_at`.
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.
1990
2136
  */
1991
2137
  get(parameters, options) {
1992
2138
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
@@ -2007,10 +2153,12 @@ class Batches2 extends HeyApiClient {
2007
2153
  *
2008
2154
  * Edit a batch's policy. The next drafting pass reads the new row.
2009
2155
  *
2010
- * Pacing and the calling window are editable at any time. The sender, the body
2011
- * format and the field map freeze once the batch has sent anything changing
2012
- * them then would make the rows already delivered no longer describe what they
2013
- * 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.
2014
2162
  */
2015
2163
  update(parameters, options) {
2016
2164
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }, { key: 'patchEmailBatchRequest', map: 'body' }] }]);
@@ -2034,12 +2182,12 @@ class Batches2 extends HeyApiClient {
2034
2182
  /**
2035
2183
  * Cancel Email Batch
2036
2184
  *
2037
- * Stop drafting for good. This is the only terminal action a batch cannot
2038
- * 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.
2039
2187
  *
2040
- * Rows already drafted are **not** touched: cancelling stops drafting, and
2041
- * drafts already produced are still worth reviewing and sending. Rows never
2042
- * 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`.
2043
2191
  */
2044
2192
  cancel(parameters, options) {
2045
2193
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'batch_id' }] }]);
@@ -2099,6 +2247,9 @@ class Batches2 extends HeyApiClient {
2099
2247
  get recipients() {
2100
2248
  return this._recipients ?? (this._recipients = new Recipients2({ client: this.client }));
2101
2249
  }
2250
+ get sends() {
2251
+ return this._sends ?? (this._sends = new Sends({ client: this.client }));
2252
+ }
2102
2253
  }
2103
2254
  exports.Batches2 = Batches2;
2104
2255
  class Senders extends HeyApiClient {
@@ -2933,8 +3084,8 @@ class Runs extends HeyApiClient {
2933
3084
  *
2934
3085
  * This task's runs, newest first, each with its output, trace and cost.
2935
3086
  *
2936
- * A run records the task's *name* and nothing else about the definition it ran
2937
- * 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.
2938
3089
  */
2939
3090
  list(parameters, options) {
2940
3091
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [
@@ -2963,10 +3114,12 @@ class Runs extends HeyApiClient {
2963
3114
  * the MCP servers spend your credits, and the model spends your tokens. A task
2964
3115
  * that books a slot, charges a card or sends a message will do so.
2965
3116
  *
2966
- * `vars` must match what the task declares an unknown name is refused rather
2967
- * than dropped. The response is the whole run: the structured `output`, a
2968
- * `trace` of every tool call, the steps used and what the tokens cost. On
2969
- * 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.
2970
3123
  */
2971
3124
  create(parameters, options) {
2972
3125
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'runTaskRequest', map: 'body' }] }]);
@@ -3013,6 +3166,56 @@ class Runs extends HeyApiClient {
3013
3166
  }
3014
3167
  }
3015
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;
3016
3219
  class Tasks2 extends HeyApiClient {
3017
3220
  /**
3018
3221
  * List Tasks
@@ -3021,9 +3224,8 @@ class Tasks2 extends HeyApiClient {
3021
3224
  *
3022
3225
  * A task is an agent nobody talks to: a prompt, one LLM, tools and MCP
3023
3226
  * servers, the variables it takes as input, and the typed result it must
3024
- * produce. `last_run` says how the most recent run of each one went, so a
3025
- * task whose prompt stopped calling `submit_result` is visible here rather
3026
- * 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`.
3027
3229
  */
3028
3230
  list(parameters, options) {
3029
3231
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'query', key: 'limit' }, { in: 'query', key: 'offset' }] }]);
@@ -3045,16 +3247,10 @@ class Tasks2 extends HeyApiClient {
3045
3247
  * Create an agent task: an agent nobody talks to, which takes named inputs
3046
3248
  * and returns a typed result.
3047
3249
  *
3048
- * A task has no draft and no publish step: it is valid the moment it saves and
3049
- * callable immediately. An invalid config is a 400 listing every problem and
3050
- * nothing is stored.
3051
- *
3052
3250
  * `output` is what makes this a task rather than a chat agent — declare the
3053
3251
  * fields the model must produce and it is given a `submit_result` tool built
3054
- * from them. `vars` are its inputs, read as `{{vars.name}}`.
3055
- *
3056
- * `warnings` reports the non-fatal problems. There is no publish screen to
3057
- * 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.
3058
3254
  */
3059
3255
  create(parameters, options) {
3060
3256
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ key: 'createTaskRequest', map: 'body' }] }]);
@@ -3078,7 +3274,8 @@ class Tasks2 extends HeyApiClient {
3078
3274
  /**
3079
3275
  * Delete Task
3080
3276
  *
3081
- * 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.
3082
3279
  */
3083
3280
  delete(parameters, options) {
3084
3281
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
@@ -3097,7 +3294,7 @@ class Tasks2 extends HeyApiClient {
3097
3294
  /**
3098
3295
  * Get Task
3099
3296
  *
3100
- * Fetch one task's config and how its last run went.
3297
+ * Fetch one task's draft config, published version, history and last run.
3101
3298
  */
3102
3299
  get(parameters, options) {
3103
3300
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }] }]);
@@ -3116,12 +3313,11 @@ class Tasks2 extends HeyApiClient {
3116
3313
  /**
3117
3314
  * Update Task
3118
3315
  *
3119
- * Replace a task's config.
3316
+ * Replace the task's draft config with the one supplied.
3120
3317
  *
3121
- * The whole config is sent, so include every field you mean to keep, and it is
3122
- * validated exactly as `create_task` is. The edit takes effect on the next run
3123
- * a task has no versions, so there is no old wording to go back to and no
3124
- * 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.
3125
3321
  */
3126
3322
  update(parameters, options) {
3127
3323
  const params = (0, index_js_1.buildClientParams)([parameters], [{ args: [{ in: 'path', key: 'task_id' }, { key: 'patchTaskRequest', map: 'body' }] }]);
@@ -3142,9 +3338,59 @@ class Tasks2 extends HeyApiClient {
3142
3338
  }
3143
3339
  });
3144
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
+ }
3145
3388
  get runs() {
3146
3389
  return this._runs ?? (this._runs = new Runs({ client: this.client }));
3147
3390
  }
3391
+ get versions() {
3392
+ return this._versions ?? (this._versions = new Versions2({ client: this.client }));
3393
+ }
3148
3394
  }
3149
3395
  exports.Tasks2 = Tasks2;
3150
3396
  class Accounts extends HeyApiClient {
@@ -3551,7 +3797,7 @@ class Telephony extends HeyApiClient {
3551
3797
  }
3552
3798
  }
3553
3799
  exports.Telephony = Telephony;
3554
- class Versions2 extends HeyApiClient {
3800
+ class Versions3 extends HeyApiClient {
3555
3801
  /**
3556
3802
  * Get Tool Version
3557
3803
  *
@@ -3602,7 +3848,7 @@ class Versions2 extends HeyApiClient {
3602
3848
  });
3603
3849
  }
3604
3850
  }
3605
- exports.Versions2 = Versions2;
3851
+ exports.Versions3 = Versions3;
3606
3852
  class Tools2 extends HeyApiClient {
3607
3853
  /**
3608
3854
  * List Tools
@@ -3808,7 +4054,7 @@ class Tools2 extends HeyApiClient {
3808
4054
  });
3809
4055
  }
3810
4056
  get versions() {
3811
- return this._versions ?? (this._versions = new Versions2({ client: this.client }));
4057
+ return this._versions ?? (this._versions = new Versions3({ client: this.client }));
3812
4058
  }
3813
4059
  }
3814
4060
  exports.Tools2 = Tools2;