deepline 0.3.559 → 0.3.561

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +14 -0
  2. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  3. package/dist/bundling-sources/sdk/src/integrations.ts +62 -0
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +4 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +57 -2
  7. package/dist/cli/auth-3NPCF7CL.js +44 -0
  8. package/dist/cli/{auth-D6S6E7BL.mjs → auth-3WPN7C5X.mjs} +5 -5
  9. package/dist/cli/{billing-7YRVKWAU.js → billing-DOHRRK73.js} +102 -102
  10. package/dist/cli/{billing-3BNTAYUY.mjs → billing-NCTL4WRP.mjs} +9 -9
  11. package/dist/cli/{chunk-OJ3FRPEP.js → chunk-2YNYWHBI.js} +10 -10
  12. package/dist/cli/{chunk-G7IGOVPF.js → chunk-3CZLPUBB.js} +20 -20
  13. package/dist/cli/{chunk-K5BZF2VO.js → chunk-3VBYUQ4G.js} +9 -9
  14. package/dist/cli/{chunk-VZKBLSTA.mjs → chunk-42RBMROP.mjs} +2 -2
  15. package/dist/cli/{chunk-PQ52YTDB.js → chunk-4OITRR2V.js} +13 -13
  16. package/dist/cli/{chunk-YI4ADWTN.js → chunk-5CNHEUGJ.js} +12 -2
  17. package/dist/cli/{chunk-XXZDT3U7.mjs → chunk-5FJGP5NZ.mjs} +2 -2
  18. package/dist/cli/{chunk-SSE5P2CX.js → chunk-5TWCVY3S.js} +12 -12
  19. package/dist/cli/{chunk-EEUJNR5K.js → chunk-65L4IL3E.js} +6 -6
  20. package/dist/cli/{chunk-A4KQZ6P5.js → chunk-6EJOADKB.js} +206 -180
  21. package/dist/cli/{chunk-URACGTQE.mjs → chunk-7HGJKBNU.mjs} +1 -1
  22. package/dist/cli/{chunk-LTCV5BI2.mjs → chunk-AEIRQFS3.mjs} +1 -1
  23. package/dist/cli/{chunk-YE7OCVI5.js → chunk-AH5T5LX2.js} +26 -26
  24. package/dist/cli/{chunk-YODGCJPX.mjs → chunk-BIIKWKTD.mjs} +2 -2
  25. package/dist/cli/{chunk-UA2VLWZH.mjs → chunk-CCRGOHC2.mjs} +2 -2
  26. package/dist/cli/{chunk-IUDO463I.js → chunk-CUU5CL3V.js} +20 -20
  27. package/dist/cli/{chunk-QQ6AVBHW.js → chunk-DSOQL4ZF.js} +23 -23
  28. package/dist/cli/{chunk-3MVBZ4XI.mjs → chunk-EAU5JJXS.mjs} +5 -5
  29. package/dist/cli/{chunk-53HQJS6D.mjs → chunk-EN36QYE7.mjs} +1 -1
  30. package/dist/cli/{chunk-2YQGXPQ7.js → chunk-F5XQN6PU.js} +2 -2
  31. package/dist/cli/{chunk-YFUFYV4M.mjs → chunk-GCBXXN4P.mjs} +5 -5
  32. package/dist/cli/{chunk-P2DFD2NG.mjs → chunk-GITMBBDH.mjs} +1 -1
  33. package/dist/cli/{chunk-XPS2UBYV.mjs → chunk-GPGNBG3E.mjs} +3 -3
  34. package/dist/cli/{chunk-FHMGNUOP.mjs → chunk-HLWNMRSF.mjs} +1 -1
  35. package/dist/cli/{chunk-WZUOUQZ3.js → chunk-HSRYGNCA.js} +3 -3
  36. package/dist/cli/{chunk-KGCY3MSS.mjs → chunk-I4FFGMIQ.mjs} +5 -5
  37. package/dist/cli/{chunk-PZUBDHQ7.mjs → chunk-IEVV72X5.mjs} +4 -4
  38. package/dist/cli/{chunk-ZMC5FEJN.mjs → chunk-JKBSEUFN.mjs} +2 -2
  39. package/dist/cli/{chunk-MPEMAGZS.mjs → chunk-JNI4353Z.mjs} +11 -11
  40. package/dist/cli/{chunk-D7DXRFM2.mjs → chunk-JRQDDQLZ.mjs} +1 -1
  41. package/dist/cli/{chunk-TPLISQND.js → chunk-JV3WBT3X.js} +5 -5
  42. package/dist/cli/{chunk-TIMFDVUN.js → chunk-K72PGYSH.js} +48 -48
  43. package/dist/cli/{chunk-KACD2TYW.mjs → chunk-LRQZ2XO5.mjs} +2 -2
  44. package/dist/cli/{chunk-EYL4V32Q.js → chunk-M4ZL2H5B.js} +4 -4
  45. package/dist/cli/{chunk-MJ4JEJLL.mjs → chunk-MTD7OXGL.mjs} +150 -124
  46. package/dist/cli/{chunk-JUTXZW3S.js → chunk-NGIQXZIE.js} +7 -7
  47. package/dist/cli/{chunk-II33OPIO.mjs → chunk-O5TXP65R.mjs} +1 -1
  48. package/dist/cli/{chunk-GETMCDVX.mjs → chunk-OBQOFQX2.mjs} +5 -5
  49. package/dist/cli/{chunk-XNN45XYF.js → chunk-OML66OOS.js} +2 -2
  50. package/dist/cli/{chunk-JME33A35.js → chunk-OTOID2SE.js} +15 -15
  51. package/dist/cli/{chunk-24XWLHKJ.js → chunk-PLQ4OMYO.js} +1 -1
  52. package/dist/cli/{chunk-OFC24U3N.mjs → chunk-PQLQ2YV7.mjs} +2 -2
  53. package/dist/cli/{chunk-6BJHMXMA.js → chunk-PSXPGRZK.js} +2 -2
  54. package/dist/cli/{chunk-22Z2U5MW.mjs → chunk-QO5MVJWJ.mjs} +3 -3
  55. package/dist/cli/{chunk-OSHKFYY4.js → chunk-RSFBTSJZ.js} +41 -41
  56. package/dist/cli/{chunk-UHIOXXAO.mjs → chunk-S4WTJQEJ.mjs} +1 -1
  57. package/dist/cli/{chunk-MWZEGRY2.mjs → chunk-SBUFCQ3W.mjs} +2 -2
  58. package/dist/cli/{chunk-GWS7XJI2.mjs → chunk-T5WVODJY.mjs} +4 -4
  59. package/dist/cli/{chunk-BTKVXI3G.mjs → chunk-VACBPVIR.mjs} +12 -2
  60. package/dist/cli/{chunk-LWOYDMYC.js → chunk-X6IDT5II.js} +3 -3
  61. package/dist/cli/{chunk-QGVOD6Y4.js → chunk-XDTI5HF7.js} +100 -100
  62. package/dist/cli/{chunk-FDVSB4NF.js → chunk-XFEBBBYA.js} +53 -53
  63. package/dist/cli/{chunk-GFHBS7HG.js → chunk-XKYNEKG2.js} +5 -5
  64. package/dist/cli/{chunk-PNFC7VHH.js → chunk-ZFTQYCMB.js} +5 -5
  65. package/dist/cli/command-docs.js +2 -2
  66. package/dist/cli/command-docs.mjs +1 -1
  67. package/dist/cli/concurrent-runs-help-HWDISMIC.js +22 -0
  68. package/dist/cli/{concurrent-runs-help-FCAZLZNA.mjs → concurrent-runs-help-YGCPBET7.mjs} +6 -6
  69. package/dist/cli/{csv-BC26EB4B.mjs → csv-FWL7B2BV.mjs} +4 -4
  70. package/dist/cli/{csv-SCIQKZNH.js → csv-QEDNA7FG.js} +13 -13
  71. package/dist/cli/{db-RVOPGYKY.mjs → db-RJEX3BRW.mjs} +6 -6
  72. package/dist/cli/{db-IJRJVIQ3.js → db-SRNS2IET.js} +27 -27
  73. package/dist/cli/{describe-K7CRL4PA.mjs → describe-N7EFSCTT.mjs} +18 -18
  74. package/dist/cli/describe-OHO4OETQ.js +50 -0
  75. package/dist/cli/describe-core.d.mts +2 -2
  76. package/dist/cli/describe-core.d.ts +2 -2
  77. package/dist/cli/{executions-IEVLTSXV.js → executions-FVZYM5X7.js} +8 -8
  78. package/dist/cli/{executions-PDOO2GFK.mjs → executions-UIB2VWM3.mjs} +6 -6
  79. package/dist/cli/{feedback-7YVUUROQ.mjs → feedback-2UFZ73PJ.mjs} +6 -6
  80. package/dist/cli/{feedback-KHYOWTXA.js → feedback-4DPMGP54.js} +14 -14
  81. package/dist/cli/git-6AKXBYB7.js +26 -0
  82. package/dist/cli/{git-426CAP5S.mjs → git-LBADM335.mjs} +5 -5
  83. package/dist/cli/index.js +147 -147
  84. package/dist/cli/index.mjs +46 -46
  85. package/dist/cli/{integrations-TNJ4IELE.mjs → integrations-2MLNXLEQ.mjs} +40 -7
  86. package/dist/cli/{integrations-BVHTRN3W.js → integrations-YNXYTLOA.js} +48 -15
  87. package/dist/cli/{legacy-noops-F73BMPBV.js → legacy-noops-KZ4TWNLG.js} +9 -9
  88. package/dist/cli/{legacy-noops-2GB35THO.mjs → legacy-noops-MLULOC4E.mjs} +6 -6
  89. package/dist/cli/{mcp-KMTC7OBK.js → mcp-B3KGTSQW.js} +24 -24
  90. package/dist/cli/{mcp-BAGMQXNR.mjs → mcp-LBP6ZNGI.mjs} +4 -4
  91. package/dist/cli/{monitors-O2BUIK7Q.js → monitors-7OB3JGLF.js} +100 -100
  92. package/dist/cli/{monitors-ECONWLHL.mjs → monitors-IUJPNNJJ.mjs} +7 -7
  93. package/dist/cli/{org-AEZZBWA3.mjs → org-4BJVKLJ4.mjs} +6 -6
  94. package/dist/cli/{org-5NQQ4PRU.js → org-ZETP5SLA.js} +121 -121
  95. package/dist/cli/{outcomes-ZWHAJH5I.mjs → outcomes-4IH5QXAA.mjs} +6 -6
  96. package/dist/cli/{outcomes-IKEQKAF7.js → outcomes-XZLWT7OK.js} +14 -14
  97. package/dist/cli/{play-VDWB7FZ5.js → play-KMXUSZ3W.js} +324 -324
  98. package/dist/cli/{play-BVKLMTAS.mjs → play-QGYAHOX6.mjs} +19 -19
  99. package/dist/cli/{providers-RXT3Q5Q7.js → providers-A4FNCWOJ.js} +9 -9
  100. package/dist/cli/{providers-SWRTGKJJ.mjs → providers-LXMG2WMM.mjs} +6 -6
  101. package/dist/cli/{quickstart-GQVXM7XV.mjs → quickstart-3L4ZMV5Y.mjs} +4 -4
  102. package/dist/cli/{quickstart-UJJNXI2S.js → quickstart-BRN25JX5.js} +6 -6
  103. package/dist/cli/{run-WOTVRFGN.js → run-36GX6EWC.js} +44 -44
  104. package/dist/cli/{run-GDIEU622.mjs → run-P3WFKNPE.mjs} +23 -23
  105. package/dist/cli/search-EEJ2VPS3.js +32 -0
  106. package/dist/cli/{search-EWC7V6GT.mjs → search-SEQFDQKQ.mjs} +7 -7
  107. package/dist/cli/{search-output-FCW4R6Z4.mjs → search-output-I5U5EI75.mjs} +4 -4
  108. package/dist/cli/{search-output-FL7STAYJ.js → search-output-Y32YHSQ3.js} +6 -6
  109. package/dist/cli/{secrets-UXDUGONR.js → secrets-DH46W2VF.js} +15 -15
  110. package/dist/cli/{secrets-XG22PDCR.mjs → secrets-OIXJK4E4.mjs} +6 -6
  111. package/dist/cli/{sessions-2OKBG7FD.mjs → sessions-OADAVWXU.mjs} +6 -6
  112. package/dist/cli/sessions-UJVLZK2H.js +23 -0
  113. package/dist/cli/{settings-EDYA2V4W.mjs → settings-2N5IJ7CZ.mjs} +12 -12
  114. package/dist/cli/{settings-RWN7YHK3.js → settings-DNJBXD5N.js} +85 -85
  115. package/dist/cli/{setup-UZW2IHAT.mjs → setup-5LLJ77BQ.mjs} +9 -9
  116. package/dist/cli/{setup-HA3PG3ST.js → setup-KKZXSKN6.js} +49 -49
  117. package/dist/cli/skills-HRGWKTL6.js +37 -0
  118. package/dist/cli/{skills-V4KAUQQA.mjs → skills-U76N7CTT.mjs} +7 -7
  119. package/dist/cli/{tools-HFUGLYHU.mjs → tools-4US4UIIT.mjs} +17 -17
  120. package/dist/cli/tools-RTNCLQEP.js +57 -0
  121. package/dist/cli/{update-S3KEH7P2.mjs → update-AH44HYX7.mjs} +9 -9
  122. package/dist/cli/update-YY5PZGYJ.js +37 -0
  123. package/dist/cli/{views-QH5L37UW.js → views-HOCGYKC5.js} +21 -21
  124. package/dist/cli/{views-Y7Y5Y7V2.mjs → views-YJAFUL2K.mjs} +6 -6
  125. package/dist/cli/{workflow-XNN54KIK.mjs → workflow-UCVXUIRX.mjs} +7 -7
  126. package/dist/cli/{workflow-4W5JT5HP.js → workflow-ZNP5BLMJ.js} +17 -17
  127. package/dist/{client-BoayTB7p.d.ts → client-BSxuaObS.d.ts} +1 -1
  128. package/dist/{client-1ogYQqUw.d.mts → client-CnphYDTe.d.mts} +1 -1
  129. package/dist/{client-core-Ch8CXaX4.d.mts → client-core-DQOTt3yV.d.mts} +37 -2
  130. package/dist/{client-core-DySw9x_E.d.ts → client-core-Yad6-K7-.d.ts} +37 -2
  131. package/dist/index.d.mts +3 -3
  132. package/dist/index.d.ts +3 -3
  133. package/dist/index.js +9 -9
  134. package/dist/index.mjs +6 -6
  135. package/dist/install-integrity.json +118 -118
  136. package/dist/plays/play-description.d.mts +1 -1
  137. package/dist/plays/play-description.d.ts +1 -1
  138. package/dist/plays/run-request.d.mts +1 -1
  139. package/dist/plays/run-request.d.ts +1 -1
  140. package/dist/release.d.mts +1 -1
  141. package/dist/release.d.ts +1 -1
  142. package/dist/release.js +2 -2
  143. package/dist/release.mjs +1 -1
  144. package/dist/server.d.mts +2 -2
  145. package/dist/server.d.ts +2 -2
  146. package/dist/server.js +5 -5
  147. package/dist/server.mjs +3 -3
  148. package/package.json +1 -1
  149. package/dist/cli/auth-3SBMYRAJ.js +0 -44
  150. package/dist/cli/concurrent-runs-help-TVQO4USY.js +0 -22
  151. package/dist/cli/describe-4FBGZZK5.js +0 -50
  152. package/dist/cli/git-O6A2FVJE.js +0 -26
  153. package/dist/cli/search-UIZHXBHR.js +0 -32
  154. package/dist/cli/sessions-DPYJFTCW.js +0 -23
  155. package/dist/cli/skills-RQ6V5TGY.js +0 -37
  156. package/dist/cli/tools-NGQKXMHP.js +0 -57
  157. package/dist/cli/update-SJJK6XXM.js +0 -37
@@ -37,7 +37,7 @@ import {
37
37
  RETAINED_PIPELINE_RECEIVERS_HEADER,
38
38
  RUNTIME_ENVIRONMENT_TOKEN_HEADER,
39
39
  SDK_API_MAJOR
40
- } from "./chunk-URACGTQE.mjs";
40
+ } from "./chunk-7HGJKBNU.mjs";
41
41
  import {
42
42
  CustomerDbQueryOutcomeUnknownError
43
43
  } from "./chunk-ASB47RXJ.mjs";
@@ -48,6 +48,145 @@ import {
48
48
  ToolExecutionError
49
49
  } from "./chunk-Z3A2S3QM.mjs";
50
50
 
51
+ // src/integrations.ts
52
+ var CALENDAR_PROVIDER = "google_calendar_availability";
53
+ var AD_ACCOUNT_DISCOVERY_PROVIDERS = [
54
+ "google_ads_audiences",
55
+ "linkedin_ads_audiences"
56
+ ];
57
+ function invalid(message) {
58
+ throw new DeeplineError(message, 400, "INVALID_ARGUMENT");
59
+ }
60
+ function planAdAccountDiscovery(provider) {
61
+ if (!AD_ACCOUNT_DISCOVERY_PROVIDERS.includes(provider)) {
62
+ invalid(`Choose ${AD_ACCOUNT_DISCOVERY_PROVIDERS.join(" or ")}.`);
63
+ }
64
+ return {
65
+ provider,
66
+ method: "POST",
67
+ path: `/api/v2/integrations/${provider}/accounts`,
68
+ body: {}
69
+ };
70
+ }
71
+ async function findConnection(client, name, provider) {
72
+ const { connections } = await client.listWorkspaceConnectionInventory(
73
+ provider,
74
+ { authorizationsOnly: true }
75
+ );
76
+ const matches = connections.filter(
77
+ (row) => row.name === name && (!provider || row.provider === provider)
78
+ );
79
+ if (matches.length === 0)
80
+ throw new DeeplineError(
81
+ `No org connection named ${JSON.stringify(name)}. Run deepline integrations list --json.`,
82
+ 404,
83
+ "NOT_FOUND"
84
+ );
85
+ if (matches.length > 1)
86
+ invalid("This name exists for multiple providers. Pass --provider.");
87
+ return matches[0];
88
+ }
89
+ async function changeConnection(client, action, name, options) {
90
+ const row = await findConnection(client, name, options.provider);
91
+ if (options.booking && (action !== "reconnect" || row.type !== "workspace_delegation"))
92
+ invalid("Use --booking with Google Workspace verify or reconnect.");
93
+ if (options.listCalendars && (action !== "reconnect" || row.type !== "workspace_delegation"))
94
+ invalid("Use --list-calendars with Google Workspace verify or reconnect.");
95
+ if (row.type === "workspace_delegation") {
96
+ if (row.provider !== CALENDAR_PROVIDER || !row.domain)
97
+ invalid(
98
+ "The Google Workspace approval is missing its provider or domain."
99
+ );
100
+ if (row.authorizationVersion === void 0)
101
+ invalid("The API did not return a Google Workspace approval revision.");
102
+ if (action === "reconnect") {
103
+ return verifyWorkspace(client, row.domain, options, row);
104
+ }
105
+ if (options.verificationEmail)
106
+ invalid("Use --verification-email with reconnect or verify.");
107
+ if (action === "delete" && row.status !== "disconnected")
108
+ invalid("Disconnect this approval before deleting it.");
109
+ const change2 = action === "delete" ? {
110
+ action: "remove_workspace",
111
+ domain: row.domain,
112
+ connectionId: row.id,
113
+ grantRevision: row.authorizationVersion
114
+ } : {
115
+ action: "disable_workspace",
116
+ domain: row.domain,
117
+ connectionId: row.id,
118
+ grantRevision: row.authorizationVersion
119
+ };
120
+ if (options.dryRun) return change2;
121
+ return client.changeCalendarDelegation(change2);
122
+ }
123
+ if (options.verificationEmail)
124
+ invalid("--verification-email applies to Google Workspace approvals.");
125
+ if (row.type !== "oauth" || row.provider !== "hubspot" && row.provider !== CALENDAR_PROVIDER)
126
+ invalid(
127
+ "Manage this credential type through deepline integrations connect <provider> --link."
128
+ );
129
+ if (row.authorizationVersion === void 0)
130
+ invalid("The API did not return a connection authorization version.");
131
+ const change = {
132
+ action: action === "delete" ? "remove" : action,
133
+ provider: row.provider,
134
+ name,
135
+ connectionId: row.id,
136
+ authorizationVersion: row.authorizationVersion
137
+ };
138
+ if (options.dryRun) return change;
139
+ return client.manageWorkspaceIntegrationConnection(change);
140
+ }
141
+ async function verifyWorkspace(client, domain, options, existing) {
142
+ domain = domain.trim().toLowerCase();
143
+ if (!GOOGLE_WORKSPACE_DOMAIN_PATTERN.test(domain))
144
+ invalid("Enter a Google Workspace domain, such as example.com.");
145
+ const email = options.verificationEmail?.trim().toLowerCase();
146
+ if (!email || email.length > 254 || !/^[^\s@]+@[^\s@]+$/.test(email) || email.split("@")[1] !== domain)
147
+ invalid("Pass --verification-email with a work email in this domain.");
148
+ const settings = existing ? {
149
+ grantRevision: existing.authorizationVersion,
150
+ connectionId: existing.id,
151
+ grantedScopes: existing.scopes
152
+ } : await client.getCalendarDelegation(void 0, void 0, domain);
153
+ if (settings.grantRevision === void 0)
154
+ invalid("The API did not return a Google Workspace approval revision.");
155
+ const requestedScopes = [
156
+ .../* @__PURE__ */ new Set([
157
+ GOOGLE_WORKSPACE_AVAILABILITY_SCOPE,
158
+ ...settings.grantedScopes ?? [],
159
+ ...options.booking ? [GOOGLE_WORKSPACE_BOOKING_SCOPE] : [],
160
+ ...options.listCalendars ? [GOOGLE_WORKSPACE_CALENDAR_LIST_SCOPE] : []
161
+ ])
162
+ ];
163
+ const change = {
164
+ action: "enable_workspace",
165
+ domain,
166
+ grantRevision: settings.grantRevision,
167
+ ...settings.connectionId ? { connectionId: settings.connectionId } : {},
168
+ verificationEmail: email,
169
+ ...requestedScopes.length > 1 ? { requestedScopes } : {}
170
+ };
171
+ if (options.dryRun) return change;
172
+ return client.changeCalendarDelegation(change);
173
+ }
174
+ function createIntegrationsNamespace(client) {
175
+ return {
176
+ list: (options = {}) => client.listWorkspaceConnectionInventory(options.provider, {
177
+ authorizationsOnly: true
178
+ }),
179
+ get: (name, options = {}) => findConnection(client, name, options.provider),
180
+ connect: (provider) => client.getIntegrationConnectLink(provider),
181
+ discoverAdAccounts: (provider) => client.discoverAdAccounts(provider),
182
+ reconnect: (name, options = {}) => changeConnection(client, "reconnect", name, options),
183
+ disconnect: (name, options = {}) => changeConnection(client, "disconnect", name, options),
184
+ delete: (name, options = {}) => changeConnection(client, "delete", name, options),
185
+ verify: (domain, options) => verifyWorkspace(client, domain, options),
186
+ members: (provider, options = {}) => client.listManagedConnectionMembers(provider, options.cursor)
187
+ };
188
+ }
189
+
51
190
  // ../integration-contracts/billing-plan-skus.ts
52
191
  var PLAN_OFFER_SKUS = {
53
192
  solo: "payg-v1",
@@ -2434,129 +2573,6 @@ function isStopAllPlayRunsDryRunResult(result) {
2434
2573
  return "dryRun" in result && result.dryRun === true;
2435
2574
  }
2436
2575
 
2437
- // src/integrations.ts
2438
- var CALENDAR_PROVIDER = "google_calendar_availability";
2439
- function invalid(message) {
2440
- throw new DeeplineError(message, 400, "INVALID_ARGUMENT");
2441
- }
2442
- async function findConnection(client, name, provider) {
2443
- const { connections } = await client.listWorkspaceConnectionInventory(
2444
- provider,
2445
- { authorizationsOnly: true }
2446
- );
2447
- const matches = connections.filter(
2448
- (row) => row.name === name && (!provider || row.provider === provider)
2449
- );
2450
- if (matches.length === 0)
2451
- throw new DeeplineError(
2452
- `No org connection named ${JSON.stringify(name)}. Run deepline integrations list --json.`,
2453
- 404,
2454
- "NOT_FOUND"
2455
- );
2456
- if (matches.length > 1)
2457
- invalid("This name exists for multiple providers. Pass --provider.");
2458
- return matches[0];
2459
- }
2460
- async function changeConnection(client, action, name, options) {
2461
- const row = await findConnection(client, name, options.provider);
2462
- if (options.booking && (action !== "reconnect" || row.type !== "workspace_delegation"))
2463
- invalid("Use --booking with Google Workspace verify or reconnect.");
2464
- if (options.listCalendars && (action !== "reconnect" || row.type !== "workspace_delegation"))
2465
- invalid("Use --list-calendars with Google Workspace verify or reconnect.");
2466
- if (row.type === "workspace_delegation") {
2467
- if (row.provider !== CALENDAR_PROVIDER || !row.domain)
2468
- invalid(
2469
- "The Google Workspace approval is missing its provider or domain."
2470
- );
2471
- if (row.authorizationVersion === void 0)
2472
- invalid("The API did not return a Google Workspace approval revision.");
2473
- if (action === "reconnect") {
2474
- return verifyWorkspace(client, row.domain, options, row);
2475
- }
2476
- if (options.verificationEmail)
2477
- invalid("Use --verification-email with reconnect or verify.");
2478
- if (action === "delete" && row.status !== "disconnected")
2479
- invalid("Disconnect this approval before deleting it.");
2480
- const change2 = action === "delete" ? {
2481
- action: "remove_workspace",
2482
- domain: row.domain,
2483
- connectionId: row.id,
2484
- grantRevision: row.authorizationVersion
2485
- } : {
2486
- action: "disable_workspace",
2487
- domain: row.domain,
2488
- connectionId: row.id,
2489
- grantRevision: row.authorizationVersion
2490
- };
2491
- if (options.dryRun) return change2;
2492
- return client.changeCalendarDelegation(change2);
2493
- }
2494
- if (options.verificationEmail)
2495
- invalid("--verification-email applies to Google Workspace approvals.");
2496
- if (row.type !== "oauth" || row.provider !== "hubspot" && row.provider !== CALENDAR_PROVIDER)
2497
- invalid(
2498
- "Manage this credential type through deepline integrations connect <provider> --link."
2499
- );
2500
- if (row.authorizationVersion === void 0)
2501
- invalid("The API did not return a connection authorization version.");
2502
- const change = {
2503
- action: action === "delete" ? "remove" : action,
2504
- provider: row.provider,
2505
- name,
2506
- connectionId: row.id,
2507
- authorizationVersion: row.authorizationVersion
2508
- };
2509
- if (options.dryRun) return change;
2510
- return client.manageWorkspaceIntegrationConnection(change);
2511
- }
2512
- async function verifyWorkspace(client, domain, options, existing) {
2513
- domain = domain.trim().toLowerCase();
2514
- if (!GOOGLE_WORKSPACE_DOMAIN_PATTERN.test(domain))
2515
- invalid("Enter a Google Workspace domain, such as example.com.");
2516
- const email = options.verificationEmail?.trim().toLowerCase();
2517
- if (!email || email.length > 254 || !/^[^\s@]+@[^\s@]+$/.test(email) || email.split("@")[1] !== domain)
2518
- invalid("Pass --verification-email with a work email in this domain.");
2519
- const settings = existing ? {
2520
- grantRevision: existing.authorizationVersion,
2521
- connectionId: existing.id,
2522
- grantedScopes: existing.scopes
2523
- } : await client.getCalendarDelegation(void 0, void 0, domain);
2524
- if (settings.grantRevision === void 0)
2525
- invalid("The API did not return a Google Workspace approval revision.");
2526
- const requestedScopes = [
2527
- .../* @__PURE__ */ new Set([
2528
- GOOGLE_WORKSPACE_AVAILABILITY_SCOPE,
2529
- ...settings.grantedScopes ?? [],
2530
- ...options.booking ? [GOOGLE_WORKSPACE_BOOKING_SCOPE] : [],
2531
- ...options.listCalendars ? [GOOGLE_WORKSPACE_CALENDAR_LIST_SCOPE] : []
2532
- ])
2533
- ];
2534
- const change = {
2535
- action: "enable_workspace",
2536
- domain,
2537
- grantRevision: settings.grantRevision,
2538
- ...settings.connectionId ? { connectionId: settings.connectionId } : {},
2539
- verificationEmail: email,
2540
- ...requestedScopes.length > 1 ? { requestedScopes } : {}
2541
- };
2542
- if (options.dryRun) return change;
2543
- return client.changeCalendarDelegation(change);
2544
- }
2545
- function createIntegrationsNamespace(client) {
2546
- return {
2547
- list: (options = {}) => client.listWorkspaceConnectionInventory(options.provider, {
2548
- authorizationsOnly: true
2549
- }),
2550
- get: (name, options = {}) => findConnection(client, name, options.provider),
2551
- connect: (provider) => client.getIntegrationConnectLink(provider),
2552
- reconnect: (name, options = {}) => changeConnection(client, "reconnect", name, options),
2553
- disconnect: (name, options = {}) => changeConnection(client, "disconnect", name, options),
2554
- delete: (name, options = {}) => changeConnection(client, "delete", name, options),
2555
- verify: (domain, options) => verifyWorkspace(client, domain, options),
2556
- members: (provider, options = {}) => client.listManagedConnectionMembers(provider, options.cursor)
2557
- };
2558
- }
2559
-
2560
2576
  // ../plays/trigger-config-route.ts
2561
2577
  function playTriggerConfigPath(playName) {
2562
2578
  return `/api/v2/plays/${encodeURIComponent(playName)}/triggers`;
@@ -5768,6 +5784,14 @@ var DeeplineClient = class _DeeplineClient {
5768
5784
  const params = new URLSearchParams({ provider });
5769
5785
  return this.http.get(`/api/v2/integrations/balance?${params}`);
5770
5786
  }
5787
+ /** Discover and save the ad accounts accessible to the workspace connection. */
5788
+ async discoverAdAccounts(provider) {
5789
+ const { path, body } = planAdAccountDiscovery(provider);
5790
+ return this.http.post(path, body, void 0, {
5791
+ maxRetries: 0,
5792
+ exactUrlOnly: true
5793
+ });
5794
+ }
5771
5795
  /** List the internal pilot's workspace connections. */
5772
5796
  async listWorkspaceIntegrationConnections() {
5773
5797
  return this.http.get("/api/v2/integrations/connections");
@@ -7605,6 +7629,8 @@ var DeeplineClient = class _DeeplineClient {
7605
7629
  };
7606
7630
 
7607
7631
  export {
7632
+ AD_ACCOUNT_DISCOVERY_PROVIDERS,
7633
+ planAdAccountDiscovery,
7608
7634
  PUBLIC_PLAN_SKUS,
7609
7635
  iterateCursorPages,
7610
7636
  requireBillingIdempotencyKey,
@@ -9,7 +9,7 @@ var _chunkLHPYCJNLjs = require('./chunk-LHPYCJNL.js');
9
9
 
10
10
 
11
11
 
12
- var _chunkIUDO463Ijs = require('./chunk-IUDO463I.js');
12
+ var _chunkCUU5CL3Vjs = require('./chunk-CUU5CL3V.js');
13
13
 
14
14
  // src/cli/describe-options.ts
15
15
  function addDescribeOptions(command, options = {}) {
@@ -250,7 +250,7 @@ function projectRunDatasetCell(value) {
250
250
  const logicalValue = parseSerializedDatasetValue(value);
251
251
  if (logicalValue === null || logicalValue === void 0) return logicalValue;
252
252
  if (typeof logicalValue === "object") {
253
- return _chunkIUDO463Ijs.csvSafeJsonString.call(void 0, canonicalDatasetJson(logicalValue));
253
+ return _chunkCUU5CL3Vjs.csvSafeJsonString.call(void 0, canonicalDatasetJson(logicalValue));
254
254
  }
255
255
  return logicalValue;
256
256
  }
@@ -642,7 +642,7 @@ function csvText(rows, columns = []) {
642
642
  rows: rows.map((row) => record(row) ? row : { value: row }),
643
643
  columns
644
644
  });
645
- return _chunkIUDO463Ijs.csvStringFromRows.call(void 0, projection.rows, projection.columns);
645
+ return _chunkCUU5CL3Vjs.csvStringFromRows.call(void 0, projection.rows, projection.columns);
646
646
  }
647
647
  function writeExecutionOutput(result, options, { skipReceiptFile = false } = {}) {
648
648
  let temp;
@@ -770,7 +770,7 @@ function writeExecutionOutput(result, options, { skipReceiptFile = false } = {})
770
770
  };
771
771
  if (options.receiptOut && !skipReceiptFile) {
772
772
  persist(options.receiptOut, jsonText(receipt));
773
- _chunkIUDO463Ijs.markJsonOutputHandled.call(void 0, );
773
+ _chunkCUU5CL3Vjs.markJsonOutputHandled.call(void 0, );
774
774
  } else {
775
775
  printReceipt(receipt, options, {
776
776
  data: hasData ? result.data : void 0,
@@ -939,7 +939,7 @@ function receiptText(receipt, options, extra) {
939
939
  problems.push(
940
940
  `Error: ${record(error) && typeof error.message === "string" ? error.message : JSON.stringify(error)}`
941
941
  );
942
- const diagnostic = _chunkIUDO463Ijs.formatCliFailureDiagnostic.call(void 0, error);
942
+ const diagnostic = _chunkCUU5CL3Vjs.formatCliFailureDiagnostic.call(void 0, error);
943
943
  if (diagnostic) problems.push(...diagnostic.split("\n"));
944
944
  if (record(error) && typeof error.recoveryFile === "string") {
945
945
  problems.push(
@@ -1032,8 +1032,8 @@ function printReceipt(receipt, options, extra) {
1032
1032
  const text = options.receiptJson ? `${JSON.stringify(receipt, null, 2)}
1033
1033
  ` : receiptText(receipt, options, extra);
1034
1034
  if (options.receiptOut !== void 0) {
1035
- _chunkIUDO463Ijs.writeRawStderr.call(void 0, text);
1036
- _chunkIUDO463Ijs.markJsonOutputHandled.call(void 0, );
1035
+ _chunkCUU5CL3Vjs.writeRawStderr.call(void 0, text);
1036
+ _chunkCUU5CL3Vjs.markJsonOutputHandled.call(void 0, );
1037
1037
  } else {
1038
1038
  (dataOnStdout(options) ? process.stderr : process.stdout).write(text);
1039
1039
  }
@@ -9,7 +9,7 @@ import {
9
9
  formatCliFailureDiagnostic,
10
10
  markJsonOutputHandled,
11
11
  writeRawStderr
12
- } from "./chunk-ZMC5FEJN.mjs";
12
+ } from "./chunk-JKBSEUFN.mjs";
13
13
 
14
14
  // src/cli/describe-options.ts
15
15
  function addDescribeOptions(command, options = {}) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  seedToolListScript
3
- } from "./chunk-MPEMAGZS.mjs";
3
+ } from "./chunk-JNI4353Z.mjs";
4
4
  import {
5
5
  addDescribeOptions
6
- } from "./chunk-II33OPIO.mjs";
6
+ } from "./chunk-O5TXP65R.mjs";
7
7
  import {
8
8
  describeLookupsFor,
9
9
  describeName,
@@ -14,16 +14,16 @@ import {
14
14
  } from "./chunk-BM4GE67C.mjs";
15
15
  import {
16
16
  DeeplineClient
17
- } from "./chunk-VZKBLSTA.mjs";
17
+ } from "./chunk-42RBMROP.mjs";
18
18
  import {
19
19
  failureReportHeaders,
20
20
  isFailureReportingDisabled,
21
21
  printCommandEnvelope
22
- } from "./chunk-ZMC5FEJN.mjs";
22
+ } from "./chunk-JKBSEUFN.mjs";
23
23
  import {
24
24
  autoDetectBaseUrl,
25
25
  resolveApiKeyForBaseUrl
26
- } from "./chunk-53HQJS6D.mjs";
26
+ } from "./chunk-EN36QYE7.mjs";
27
27
 
28
28
  // src/cli/commands/describe.ts
29
29
  import { writeFileSync } from "fs";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkTIMFDVUNjs = require('./chunk-TIMFDVUN.js');
3
+ var _chunkK72PGYSHjs = require('./chunk-K72PGYSH.js');
4
4
 
5
5
  // src/cli/npm-script-policy.ts
6
6
  var _child_process = require('child_process');
@@ -13,7 +13,7 @@ function npmSupportsAllowScripts(version) {
13
13
  }
14
14
  function readNpmVersion(env) {
15
15
  try {
16
- const plan = _chunkTIMFDVUNjs.resolveShellSpawn.call(void 0, "npm", ["--version"], process.platform, env);
16
+ const plan = _chunkK72PGYSHjs.resolveShellSpawn.call(void 0, "npm", ["--version"], process.platform, env);
17
17
  const result = _child_process.spawnSync.call(void 0, plan.command, plan.args, {
18
18
  windowsHide: true,
19
19
  encoding: "utf8",
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkQGVOD6Y4js = require('./chunk-QGVOD6Y4.js');
3
+ var _chunkXDTI5HF7js = require('./chunk-XDTI5HF7.js');
4
4
 
5
5
 
6
- var _chunkJUTXZW3Sjs = require('./chunk-JUTXZW3S.js');
6
+ var _chunkNGIQXZIEjs = require('./chunk-NGIQXZIE.js');
7
7
 
8
8
 
9
9
 
@@ -14,16 +14,16 @@ var _chunk6ASDTHENjs = require('./chunk-6ASDTHEN.js');
14
14
  var _chunkLHPYCJNLjs = require('./chunk-LHPYCJNL.js');
15
15
 
16
16
 
17
- var _chunkPNFC7VHHjs = require('./chunk-PNFC7VHH.js');
17
+ var _chunkZFTQYCMBjs = require('./chunk-ZFTQYCMB.js');
18
18
 
19
19
 
20
20
 
21
21
 
22
- var _chunkIUDO463Ijs = require('./chunk-IUDO463I.js');
22
+ var _chunkCUU5CL3Vjs = require('./chunk-CUU5CL3V.js');
23
23
 
24
24
 
25
25
 
26
- var _chunkLWOYDMYCjs = require('./chunk-LWOYDMYC.js');
26
+ var _chunkX6IDT5IIjs = require('./chunk-X6IDT5II.js');
27
27
 
28
28
  // src/cli/commands/describe.ts
29
29
  var _fs = require('fs');
@@ -32,14 +32,14 @@ var _path = require('path');
32
32
  // src/cli/doc-read-reporting.ts
33
33
  var REPORT_TIMEOUT_MS = 1e3;
34
34
  async function reportDocRead(docId) {
35
- if (_chunkIUDO463Ijs.isFailureReportingDisabled.call(void 0, )) return;
35
+ if (_chunkCUU5CL3Vjs.isFailureReportingDisabled.call(void 0, )) return;
36
36
  try {
37
- const baseUrl = _chunkLWOYDMYCjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
38
- const apiKey = _chunkLWOYDMYCjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
37
+ const baseUrl = _chunkX6IDT5IIjs.autoDetectBaseUrl.call(void 0, ).replace(/\/$/, "");
38
+ const apiKey = _chunkX6IDT5IIjs.resolveApiKeyForBaseUrl.call(void 0, baseUrl);
39
39
  if (!apiKey) return;
40
40
  await fetch(new URL("/api/v2/telemetry/doc-read", baseUrl), {
41
41
  method: "POST",
42
- headers: _chunkIUDO463Ijs.failureReportHeaders.call(void 0, apiKey),
42
+ headers: _chunkCUU5CL3Vjs.failureReportHeaders.call(void 0, apiKey),
43
43
  body: JSON.stringify({ doc_id: docId }),
44
44
  signal: AbortSignal.timeout(REPORT_TIMEOUT_MS)
45
45
  });
@@ -52,16 +52,16 @@ function nothingNamed(name) {
52
52
  return `Nothing named "${name}". Search for it: deepline search ${JSON.stringify(name.replace(/[-_./]+/g, " "))}`;
53
53
  }
54
54
  function findNamed2(name, options) {
55
- return _chunk6ASDTHENjs.findNamed.call(void 0, name, options, _chunk6ASDTHENjs.describeLookupsFor.call(void 0, new (0, _chunkPNFC7VHHjs.DeeplineClient)()));
55
+ return _chunk6ASDTHENjs.findNamed.call(void 0, name, options, _chunk6ASDTHENjs.describeLookupsFor.call(void 0, new (0, _chunkZFTQYCMBjs.DeeplineClient)()));
56
56
  }
57
57
  async function describeAnything(name, options, onMissing) {
58
- const client = new (0, _chunkPNFC7VHHjs.DeeplineClient)();
58
+ const client = new (0, _chunkZFTQYCMBjs.DeeplineClient)();
59
59
  const lookups = _chunk6ASDTHENjs.describeLookupsFor.call(void 0, client);
60
60
  const outcome = await _chunk6ASDTHENjs.describeName.call(void 0, name, options, {
61
61
  ...lookups,
62
62
  // `tools describe` has already fetched the tool for its compatibility check.
63
63
  tool: async (toolName) => _nullishCoalesce(options.fetchedTool, () => ( lookups.tool(toolName))),
64
- seedStarterScript: _chunkQGVOD6Y4js.seedToolListScript
64
+ seedStarterScript: _chunkXDTI5HF7js.seedToolListScript
65
65
  });
66
66
  if (outcome.status === "missing") {
67
67
  if (onMissing) return onMissing();
@@ -90,18 +90,18 @@ function deliver(envelope, lines, { json, out }) {
90
90
  ` : text;
91
91
  _fs.writeFileSync.call(void 0, path, content);
92
92
  const bytes = Buffer.byteLength(content);
93
- _chunkIUDO463Ijs.printCommandEnvelope.call(void 0,
93
+ _chunkCUU5CL3Vjs.printCommandEnvelope.call(void 0,
94
94
  { path, bytes },
95
95
  { json, text: `Wrote ${path} (${bytes} bytes)
96
96
  ` }
97
97
  );
98
98
  return 0;
99
99
  }
100
- _chunkIUDO463Ijs.printCommandEnvelope.call(void 0, envelope, { json, text });
100
+ _chunkCUU5CL3Vjs.printCommandEnvelope.call(void 0, envelope, { json, text });
101
101
  return 0;
102
102
  }
103
103
  function registerDescribeCommand(program) {
104
- _chunkJUTXZW3Sjs.addDescribeOptions.call(void 0, program.command("describe <name>")).option("--web-url", "Print only a play's play page URL").description(
104
+ _chunkNGIQXZIEjs.addDescribeOptions.call(void 0, program.command("describe <name>")).option("--web-url", "Print only a play's play page URL").description(
105
105
  "Describe anything search returns: a tool, monitor type, or play."
106
106
  ).addHelpText(
107
107
  "after",
@@ -49,7 +49,7 @@ var SDK_RELEASE = {
49
49
  // getters keep their established compatibility behavior.
50
50
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
51
51
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
52
- version: "0.3.559",
52
+ version: "0.3.561",
53
53
  updateSummary: {
54
54
  introducedIn: "0.3.90",
55
55
  summary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release."
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  DeeplineClient
3
- } from "./chunk-VZKBLSTA.mjs";
3
+ } from "./chunk-42RBMROP.mjs";
4
4
  import {
5
5
  printCommandEnvelope
6
- } from "./chunk-ZMC5FEJN.mjs";
6
+ } from "./chunk-JKBSEUFN.mjs";
7
7
 
8
8
  // src/cli/commands/integration-commands.ts
9
9
  import { Option } from "commander";
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkIUDO463Ijs = require('./chunk-IUDO463I.js');
3
+ var _chunkCUU5CL3Vjs = require('./chunk-CUU5CL3V.js');
4
4
 
5
5
  // src/cli/maintenance-policy.ts
6
6
  var _commander = require('commander');
@@ -33,7 +33,7 @@ function recordCliTrace(event) {
33
33
  sinceStartMs: now - cliTraceStartedAt,
34
34
  ...event
35
35
  };
36
- _chunkIUDO463Ijs.writeRawStderr.call(void 0, `[cli-trace] ${JSON.stringify(payload)}
36
+ _chunkCUU5CL3Vjs.writeRawStderr.call(void 0, `[cli-trace] ${JSON.stringify(payload)}
37
37
  `);
38
38
  }
39
39
  async function traceCliSpan(phase, fields, run) {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  rejectRestrictedFeedback
3
- } from "./chunk-FHMGNUOP.mjs";
3
+ } from "./chunk-HLWNMRSF.mjs";
4
4
  import {
5
5
  getAuthedHttpClient,
6
6
  printCommandEnvelope
7
- } from "./chunk-ZMC5FEJN.mjs";
7
+ } from "./chunk-JKBSEUFN.mjs";
8
8
  import {
9
9
  agentSessionIdFromEnvironment,
10
10
  claudeProjectsRoots,
11
11
  coworkTranscriptFromEnvironment
12
- } from "./chunk-URACGTQE.mjs";
12
+ } from "./chunk-7HGJKBNU.mjs";
13
13
 
14
14
  // src/cli/commands/sessions.ts
15
15
  import {