deepline 0.3.396 → 0.3.397

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 (117) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +2 -2
  3. package/dist/cli/{auth-3LTD62VL.mjs → auth-AZJFXGKP.mjs} +5 -4
  4. package/dist/cli/auth-CZJQU7B5.js +40 -0
  5. package/dist/cli/{billing-PA5OXEM5.js → billing-MQV5AGDJ.js} +76 -75
  6. package/dist/cli/{billing-DP7ZAJBO.mjs → billing-MZAAUHGH.mjs} +5 -4
  7. package/dist/cli/{chunk-VE3U3SQC.mjs → chunk-2LDADJNO.mjs} +7 -107
  8. package/dist/cli/{chunk-772W2SAU.js → chunk-3VP34TAU.js} +8 -8
  9. package/dist/cli/{chunk-QHGPA362.mjs → chunk-4D745XZO.mjs} +6 -108
  10. package/dist/cli/chunk-7DRPTGCK.js +930 -0
  11. package/dist/cli/{chunk-NSOTASOP.js → chunk-BQR6UN3C.js} +1 -83
  12. package/dist/cli/{chunk-RTO5QZWT.js → chunk-DQ65ZVHN.js} +6 -6
  13. package/dist/cli/{chunk-3T4MCB5R.mjs → chunk-F3BUFYKE.mjs} +89 -969
  14. package/dist/cli/chunk-FIVKWNMT.mjs +210 -0
  15. package/dist/cli/{describe-6O2ENKTP.mjs → chunk-HFYQBC2D.mjs} +22 -160
  16. package/dist/cli/chunk-HGFFYVXN.js +210 -0
  17. package/dist/cli/{chunk-5WNJF2T3.mjs → chunk-IHG7UAHD.mjs} +1 -83
  18. package/dist/cli/{chunk-GNN4MY5X.js → chunk-IZ74ABSX.js} +1 -1
  19. package/dist/cli/{chunk-MR6XCBQJ.mjs → chunk-J7ABTQQ7.mjs} +4 -2
  20. package/dist/cli/{chunk-2VOLOWYZ.js → chunk-K33MXVXQ.js} +293 -1173
  21. package/dist/cli/chunk-LJ5747UC.mjs +107 -0
  22. package/dist/cli/{chunk-NHB5YUCS.mjs → chunk-MRXMMERY.mjs} +1 -1
  23. package/dist/cli/{chunk-TLQ3FZOC.mjs → chunk-MV7QRALK.mjs} +3 -3
  24. package/dist/cli/{chunk-AUYXWELC.mjs → chunk-MYPH2LUU.mjs} +2 -2
  25. package/dist/cli/{chunk-LWERJUKN.js → chunk-NA4T3B62.js} +7 -215
  26. package/dist/cli/{chunk-23GAA3YO.mjs → chunk-NOX2TCBP.mjs} +1 -1
  27. package/dist/cli/chunk-OSDXE27V.mjs +88 -0
  28. package/dist/cli/{chunk-KAEZNPUM.js → chunk-PSGEDGLT.js} +13 -115
  29. package/dist/cli/chunk-Q2E4E4FJ.js +112 -0
  30. package/dist/cli/{describe-EFWNECHI.js → chunk-RFG3MRAC.js} +37 -175
  31. package/dist/cli/{chunk-XKZXO7D3.mjs → chunk-RNSWDKBM.mjs} +1 -1
  32. package/dist/cli/{chunk-V7UP2F4U.js → chunk-RYW4HPSM.js} +21 -121
  33. package/dist/cli/{chunk-7Z66NHUC.js → chunk-SO7RUVTY.js} +26 -26
  34. package/dist/cli/{chunk-H5KLUGY7.mjs → chunk-TXZVVBQZ.mjs} +1 -209
  35. package/dist/cli/{chunk-WQJJNIMQ.js → chunk-UVXBVUZQ.js} +11 -9
  36. package/dist/cli/{chunk-AVHLATII.js → chunk-VTF4RRWJ.js} +50 -50
  37. package/dist/cli/{chunk-LOGGNW4H.mjs → chunk-W3HMGKMI.mjs} +2 -2
  38. package/dist/cli/{chunk-JCN4DHF7.mjs → chunk-WM2QEHZL.mjs} +2 -2
  39. package/dist/cli/chunk-YHPYUZZX.mjs +112 -0
  40. package/dist/cli/chunk-YHZUZO3U.mjs +930 -0
  41. package/dist/cli/{chunk-ME6XRFLY.js → chunk-YLRME7MK.js} +15 -15
  42. package/dist/cli/{chunk-DC6LTULT.js → chunk-YSVORIEW.js} +2 -2
  43. package/dist/cli/{chunk-I4T4XAA2.mjs → chunk-YUDKBQUD.mjs} +4 -4
  44. package/dist/cli/chunk-ZAAKSJAS.js +88 -0
  45. package/dist/cli/{chunk-RMTASUAK.js → chunk-ZHUMDMOS.js} +65 -65
  46. package/dist/cli/chunk-ZM2YPJQJ.js +107 -0
  47. package/dist/cli/{csv-TF576S77.js → csv-AQBQ5O3I.js} +13 -12
  48. package/dist/cli/{csv-RLRR74RQ.mjs → csv-MB7PJMYQ.mjs} +4 -3
  49. package/dist/cli/{db-FDBJUTFO.js → db-JPUYC5RB.js} +30 -29
  50. package/dist/cli/{db-XORGNBIC.mjs → db-L5IEI2AU.mjs} +5 -4
  51. package/dist/cli/describe-6WT74AOR.js +164 -0
  52. package/dist/cli/describe-S6BFANVI.mjs +164 -0
  53. package/dist/cli/describe-core.d.mts +100 -0
  54. package/dist/cli/describe-core.d.ts +100 -0
  55. package/dist/cli/describe-core.js +18 -0
  56. package/dist/cli/describe-core.mjs +18 -0
  57. package/dist/cli/{executions-SFYAXPF4.js → executions-6TMQTFP4.js} +7 -6
  58. package/dist/cli/{executions-YPP7WR77.mjs → executions-L7I2ZW4Z.mjs} +5 -4
  59. package/dist/cli/{feedback-RBGA5ARU.mjs → feedback-DSJ63HK6.mjs} +4 -3
  60. package/dist/cli/{feedback-5UZFYMGB.js → feedback-XF7CQGMD.js} +8 -7
  61. package/dist/cli/{git-IRSAJEK2.mjs → git-C3ENM67D.mjs} +5 -4
  62. package/dist/cli/git-HYDZK2QR.js +24 -0
  63. package/dist/cli/index.js +93 -91
  64. package/dist/cli/index.mjs +35 -33
  65. package/dist/cli/{legacy-noops-CVAOQY2F.js → legacy-noops-B2NHWIVD.js} +8 -7
  66. package/dist/cli/{legacy-noops-NA7N6ZOU.mjs → legacy-noops-VFG2K6HK.mjs} +5 -4
  67. package/dist/cli/{monitors-4OMRXCXP.js → monitors-ORFWOVZB.js} +86 -85
  68. package/dist/cli/{monitors-ILZ2XHYG.mjs → monitors-TCEDBDGY.mjs} +5 -4
  69. package/dist/cli/{org-QDDXAE3J.mjs → org-45KREIKZ.mjs} +5 -4
  70. package/dist/cli/{org-YGNJDD2X.js → org-T74CJESN.js} +65 -64
  71. package/dist/cli/{play-VT6OHB2D.mjs → play-MU7MYBIM.mjs} +19 -15
  72. package/dist/cli/{play-L535H26U.js → play-XHK2LPON.js} +251 -247
  73. package/dist/cli/{providers-GPZ6PQAL.js → providers-4MGQKYFD.js} +8 -7
  74. package/dist/cli/{providers-KG4W5MPK.mjs → providers-VYCXIJT5.mjs} +5 -4
  75. package/dist/cli/{quickstart-UI27S5LO.js → quickstart-47G3VEOT.js} +6 -5
  76. package/dist/cli/{quickstart-2JDGTXIG.mjs → quickstart-H724EFM2.mjs} +4 -3
  77. package/dist/cli/search-3356ENLD.js +30 -0
  78. package/dist/cli/{search-PW3RAUX7.mjs → search-VQHXEFQ4.mjs} +7 -5
  79. package/dist/cli/{secrets-WFAXOUZE.js → secrets-ALLKCU35.js} +14 -13
  80. package/dist/cli/{secrets-HNOMK5A2.mjs → secrets-CPBNGA44.mjs} +5 -4
  81. package/dist/cli/{sessions-XLX3E5UO.mjs → sessions-7RSQB7IX.mjs} +5 -4
  82. package/dist/cli/sessions-FKGAY7WQ.js +16 -0
  83. package/dist/cli/{settings-YNZ4YKCH.mjs → settings-UYSGV4IC.mjs} +8 -7
  84. package/dist/cli/{settings-GADAG2UK.js → settings-Y5BI42P7.js} +75 -74
  85. package/dist/cli/{setup-PSEHIUXO.mjs → setup-L3ZBBTS4.mjs} +7 -6
  86. package/dist/cli/{setup-R5YO7GT6.js → setup-VXQPEU3E.js} +42 -41
  87. package/dist/cli/skills-DUZQTDTE.js +29 -0
  88. package/dist/cli/{skills-LTQBP6CZ.mjs → skills-QHVDLSFE.mjs} +5 -4
  89. package/dist/cli/{tools-UAXDWU63.mjs → tools-LSCEK4K2.mjs} +13 -8
  90. package/dist/cli/tools-YWU5QOQ5.js +39 -0
  91. package/dist/cli/update-5LYQAI55.js +29 -0
  92. package/dist/cli/{update-SMNIBIMS.mjs → update-CU22OTBM.mjs} +7 -6
  93. package/dist/cli/{workflow-AOQVZHMD.js → workflow-ERFLTRNX.js} +16 -15
  94. package/dist/cli/{workflow-IKGMBGF6.mjs → workflow-KQARK5BZ.mjs} +6 -5
  95. package/dist/{client-DiGl8ska.d.mts → client-D0j-_aaa.d.mts} +1 -1
  96. package/dist/{client-Bgis7F6-.d.ts → client-DflfVyj6.d.ts} +1 -1
  97. package/dist/index.d.mts +2 -2
  98. package/dist/index.d.ts +2 -2
  99. package/dist/index.js +14 -10
  100. package/dist/index.mjs +19 -15
  101. package/dist/install-integrity.json +92 -76
  102. package/dist/plays/play-description.d.mts +1 -1
  103. package/dist/plays/play-description.d.ts +1 -1
  104. package/dist/plays/run-request.d.mts +1 -1
  105. package/dist/plays/run-request.d.ts +1 -1
  106. package/dist/release.d.mts +1 -1
  107. package/dist/release.d.ts +1 -1
  108. package/dist/release.js +2 -2
  109. package/dist/release.mjs +1 -1
  110. package/package.json +6 -1
  111. package/dist/cli/auth-562JPKOM.js +0 -39
  112. package/dist/cli/git-5LDY5ZID.js +0 -23
  113. package/dist/cli/search-MGWROZ33.js +0 -28
  114. package/dist/cli/sessions-366KROUA.js +0 -15
  115. package/dist/cli/skills-JF2LPEGM.js +0 -28
  116. package/dist/cli/tools-CP2PEFRN.js +0 -34
  117. package/dist/cli/update-HZHZOU6C.js +0 -28
@@ -1,11 +1,14 @@
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; } var _class;
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
 
3
4
 
4
- var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
5
5
 
6
+ var _chunkQ2E4E4FJjs = require('./chunk-Q2E4E4FJ.js');
6
7
 
7
8
 
8
9
 
10
+ var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
11
+
9
12
 
10
13
 
11
14
 
@@ -14,105 +17,7 @@ var _chunkXNYIZMNQjs = require('./chunk-XNYIZMNQ.js');
14
17
  var _chunk7P5AA3SNjs = require('./chunk-7P5AA3SN.js');
15
18
 
16
19
 
17
- var _chunkGNN4MY5Xjs = require('./chunk-GNN4MY5X.js');
18
-
19
- // src/errors.ts
20
- var CustomerDbQueryOutcomeUnknownError = (_class = class extends _chunk7P5AA3SNjs.DeeplineError {
21
- __init() {this.outcome = "unknown"}
22
-
23
-
24
- constructor(cause, operationKey, options = {}) {
25
- const recoveryAvailable = operationKey !== void 0 && options.recoveryAvailable !== false;
26
- super(
27
- operationKey === void 0 ? "SQL outcome is unknown. The unkeyed request was attempted once; inspect the database before issuing another write. An operation key added afterwards cannot recover this request." : recoveryAvailable ? "SQL outcome is unknown. Recover by submitting the same SQL and options with the original operation key; do not use a new key." : "SQL outcome is unknown. The server did not confirm atomic recovery support. Do not resubmit this write; inspect the database and confirm reader support before recovering with the original operation key.",
28
- cause.statusCode,
29
- "CUSTOMER_DB_QUERY_OUTCOME_UNKNOWN",
30
- {
31
- outcome: "unknown",
32
- recovery: recoveryAvailable ? "original_operation_key" : "unavailable",
33
- causeCode: cause.code
34
- }
35
- );_class.prototype.__init.call(this);;
36
- this.name = "CustomerDbQueryOutcomeUnknownError";
37
- this.operationKey = operationKey;
38
- this.retryable = recoveryAvailable;
39
- Object.defineProperty(this, "cause", { value: cause, configurable: true });
40
- }
41
- }, _class);
42
- var AuthError = class extends _chunk7P5AA3SNjs.DeeplineError {
43
- /** Constructed by the SDK when Deepline rejects the caller's credentials. */
44
- constructor(message = "Authentication failed. Check your DEEPLINE_API_KEY.") {
45
- super(message, 401, "AUTH_ERROR");
46
- this.name = "AuthError";
47
- }
48
- };
49
- var RateLimitError = class extends _chunk7P5AA3SNjs.DeeplineError {
50
- /** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
51
-
52
- /** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
53
- constructor(retryAfterMs = 5e3, message) {
54
- super(
55
- _nullishCoalesce(message, () => ( `Rate limited. Retry after ${retryAfterMs}ms.`)),
56
- 429,
57
- "RATE_LIMIT"
58
- );
59
- this.name = "RateLimitError";
60
- this.retryAfterMs = retryAfterMs;
61
- }
62
- };
63
- var ToolRateLimitError = class extends RateLimitError {
64
- /** Public tool id passed to `tools.execute`. */
65
-
66
- /** Provider responsible for the operation, or `null`. */
67
-
68
- /** Provider operation name, or `null`. */
69
-
70
- /** Stable machine-readable failure code when one exists. */
71
-
72
- /** Boundary responsible for the failure. */
73
-
74
- /** Stable reason family for policy and diagnostics. */
75
-
76
- /** Whether repeating the same semantic call is delivery-safe. */
77
-
78
- /** Provider or Deepline request id, or `null`. */
79
-
80
- /** Network failure kind, or `null` for non-network failures. */
81
-
82
- /** Network boundary that failed, or `null` for non-network failures. */
83
-
84
- /** Explicitly allowlisted diagnostics safe for SDK callers. */
85
-
86
- /** Constructed by the SDK after a structured tool HTTP 429. */
87
- constructor(message, options) {
88
- super(_nullishCoalesce(options.retryAfterMs, () => ( 5e3)), message);
89
- this.name = "ToolRateLimitError";
90
- this.statusCode = _nullishCoalesce(options.statusCode, () => ( 429));
91
- this.code = _nullishCoalesce(options.code, () => ( void 0));
92
- this.toolId = options.toolId;
93
- this.provider = options.provider;
94
- this.operation = options.operation;
95
- this.origin = options.origin;
96
- this.category = options.category;
97
- this.retryable = options.retryable;
98
- this.requestId = options.requestId;
99
- this.networkKind = options.networkKind;
100
- this.networkScope = options.networkScope;
101
- this.publicDetails = _nullishCoalesce(options.publicDetails, () => ( null));
102
- this.details = options.details;
103
- _chunk7P5AA3SNjs.brandAsToolExecutionError.call(void 0, this);
104
- if (_chunk7P5AA3SNjs.isProviderTransientFailure.call(void 0, this)) {
105
- _chunk7P5AA3SNjs.brandAsProviderTransientError.call(void 0, this);
106
- }
107
- }
108
- };
109
- var ConfigError = class extends _chunk7P5AA3SNjs.DeeplineError {
110
- /** Construct a local SDK configuration failure. */
111
- constructor(message) {
112
- super(message, void 0, "CONFIG_ERROR");
113
- this.name = "ConfigError";
114
- }
115
- };
20
+ var _chunkIZ74ABSXjs = require('./chunk-IZ74ABSX.js');
116
21
 
117
22
  // src/config.ts
118
23
 
@@ -473,7 +378,7 @@ function resolveBaseUrlOnly(options) {
473
378
  _optionalChain([options, 'optionalAccess', _32 => _32.baseUrl, 'optionalAccess', _33 => _33.trim, 'call', _34 => _34()]) || autoDetectBaseUrl()
474
379
  );
475
380
  if (!baseUrl) {
476
- throw new ConfigError(
381
+ throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
477
382
  `Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
478
383
  );
479
384
  }
@@ -484,13 +389,13 @@ function resolveConfig(options) {
484
389
  _optionalChain([options, 'optionalAccess', _35 => _35.baseUrl, 'optionalAccess', _36 => _36.trim, 'call', _37 => _37()]) || autoDetectBaseUrl()
485
390
  );
486
391
  if (!baseUrl) {
487
- throw new ConfigError(
392
+ throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
488
393
  `Invalid ${HOST_URL_ENV}. Expected an http(s) URL such as https://code.deepline.com.`
489
394
  );
490
395
  }
491
396
  const apiKey = resolveApiKeyForBaseUrl(baseUrl, _optionalChain([options, 'optionalAccess', _38 => _38.apiKey]));
492
397
  if (!apiKey) {
493
- throw new ConfigError(
398
+ throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
494
399
  `No API key found. Set ${API_KEY_ENV}, add it to .env.deepline, or run: deepline auth register`
495
400
  );
496
401
  }
@@ -593,7 +498,7 @@ function findNearestGitCommonDir(startDir) {
593
498
  function saveProjectDeeplineEnvValues(values, startDir = process.cwd()) {
594
499
  const target = resolveProjectPinTarget(startDir);
595
500
  if (!target.ok) {
596
- throw new ConfigError(
501
+ throw new (0, _chunkQ2E4E4FJjs.ConfigError)(
597
502
  `Cowork project folder is ambiguous. Candidate folders: ${target.candidates.join(
598
503
  ", "
599
504
  )}. Set CLAUDE_PROJECT_DIR or cd into the intended project folder before running this command.`
@@ -744,9 +649,9 @@ function resolveCliCommandContext(inputConfig, requestedScope) {
744
649
  }
745
650
 
746
651
  // src/version.ts
747
- var SDK_VERSION = _chunkGNN4MY5Xjs.SDK_RELEASE.version;
748
- var SDK_API_MAJOR = _chunkGNN4MY5Xjs.SDK_RELEASE.contracts.api.currentMajor;
749
- var SDK_API_CONTRACT = _nullishCoalesce(_chunkGNN4MY5Xjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
652
+ var SDK_VERSION = _chunkIZ74ABSXjs.SDK_RELEASE.version;
653
+ var SDK_API_MAJOR = _chunkIZ74ABSXjs.SDK_RELEASE.contracts.api.currentMajor;
654
+ var SDK_API_CONTRACT = _nullishCoalesce(_chunkIZ74ABSXjs.SDK_RELEASE.contracts.api.legacyWireIds[0], () => ( `api-v${SDK_API_MAJOR}`));
750
655
 
751
656
  // src/agent-runtime.ts
752
657
 
@@ -1549,7 +1454,7 @@ var HttpClient = class {
1549
1454
  if (response.status === 429) {
1550
1455
  const retryAfter = parseRetryAfter(response);
1551
1456
  const failure = _chunk7P5AA3SNjs.serializeToolExecutionFailure.call(void 0, structuredToolError);
1552
- lastError = failure === null ? structuredToolError : new ToolRateLimitError(structuredToolError.message, {
1457
+ lastError = failure === null ? structuredToolError : new (0, _chunkQ2E4E4FJjs.ToolRateLimitError)(structuredToolError.message, {
1553
1458
  ...failure,
1554
1459
  retryAfterMs: _nullishCoalesce(failure.retryAfterMs, () => ( Math.max(0, retryAfter)))
1555
1460
  });
@@ -1571,7 +1476,7 @@ var HttpClient = class {
1571
1476
  );
1572
1477
  }
1573
1478
  const retryAfter = parseRetryAfter(response);
1574
- lastError = new RateLimitError(retryAfter);
1479
+ lastError = new (0, _chunkQ2E4E4FJjs.RateLimitError)(retryAfter);
1575
1480
  if (attempt < maxRetries) {
1576
1481
  retryAfterDelayMs = retryAfter;
1577
1482
  break;
@@ -1579,7 +1484,7 @@ var HttpClient = class {
1579
1484
  throw lastError;
1580
1485
  }
1581
1486
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
1582
- throw new AuthError(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1487
+ throw new (0, _chunkQ2E4E4FJjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1583
1488
  }
1584
1489
  if (!response.ok) {
1585
1490
  const retryableApiError = _optionalChain([options, 'optionalAccess', _199 => _199.retryApiErrors]) === true && isRetryableApiErrorResponse(response.status);
@@ -1638,10 +1543,10 @@ var HttpClient = class {
1638
1543
  lastError = requestCancelledError(options.signal);
1639
1544
  break requestAttempts;
1640
1545
  }
1641
- if (error instanceof AuthError || error instanceof _chunk7P5AA3SNjs.DeeplineError) {
1546
+ if (error instanceof _chunkQ2E4E4FJjs.AuthError || error instanceof _chunk7P5AA3SNjs.DeeplineError) {
1642
1547
  throw error;
1643
1548
  }
1644
- if (error instanceof RateLimitError) {
1549
+ if (error instanceof _chunkQ2E4E4FJjs.RateLimitError) {
1645
1550
  lastError = error;
1646
1551
  break;
1647
1552
  }
@@ -1752,7 +1657,7 @@ var HttpClient = class {
1752
1657
  const body = await response.text();
1753
1658
  const parsed = parseResponseBody(body);
1754
1659
  if (response.status === 401 && !isProviderOriginatedHttpError(parsed)) {
1755
- throw new AuthError(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1660
+ throw new (0, _chunkQ2E4E4FJjs.AuthError)(_chunkXNYIZMNQjs.apiErrorMessage.call(void 0, parsed, response.status));
1756
1661
  }
1757
1662
  const htmlError = detectHtmlErrorBody(
1758
1663
  body,
@@ -1783,7 +1688,7 @@ var HttpClient = class {
1783
1688
  yield* decodeSseStream(response.body);
1784
1689
  return;
1785
1690
  } catch (error) {
1786
- if (error instanceof AuthError || error instanceof _chunk7P5AA3SNjs.DeeplineError) {
1691
+ if (error instanceof _chunkQ2E4E4FJjs.AuthError || error instanceof _chunk7P5AA3SNjs.DeeplineError) {
1787
1692
  throw error;
1788
1693
  }
1789
1694
  const normalized = error instanceof Error ? error : new Error(String(error));
@@ -2048,9 +1953,4 @@ ${COWORK_NETWORK_HINT}`;
2048
1953
 
2049
1954
 
2050
1955
 
2051
-
2052
-
2053
-
2054
-
2055
-
2056
- exports.CustomerDbQueryOutcomeUnknownError = CustomerDbQueryOutcomeUnknownError; exports.AuthError = AuthError; exports.RateLimitError = RateLimitError; exports.ToolRateLimitError = ToolRateLimitError; exports.ConfigError = ConfigError; exports.HOST_URL_ENV = HOST_URL_ENV; exports.API_KEY_ENV = API_KEY_ENV; exports.ACTIVE_ORG_ID_ENV = ACTIVE_ORG_ID_ENV; exports.ACTIVE_ORG_NAME_ENV = ACTIVE_ORG_NAME_ENV; exports.FEATURES_ENV = FEATURES_ENV; exports.PROD_URL = PROD_URL; exports.featureEnvValues = featureEnvValues; exports.storedHostApiKey = storedHostApiKey; exports.storedHostFeatures = storedHostFeatures; exports.baseUrlSlug = baseUrlSlug; exports.sdkCliStateDirPath = sdkCliStateDirPath; exports.hostConfigDirPath = hostConfigDirPath; exports.hostEnvFilePath = hostEnvFilePath; exports.saveHostEnvValues = saveHostEnvValues; exports.autoDetectBaseUrl = autoDetectBaseUrl; exports.resolveApiKeyForBaseUrl = resolveApiKeyForBaseUrl; exports.resolveProjectApiKeyForBaseUrl = resolveProjectApiKeyForBaseUrl; exports.resolveGlobalApiKeyForBaseUrl = resolveGlobalApiKeyForBaseUrl; exports.getResolvedProjectAuthSource = getResolvedProjectAuthSource; exports.resolveBaseUrlOnly = resolveBaseUrlOnly; exports.resolveConfig = resolveConfig; exports.ensureProjectPrivatePathsIgnored = ensureProjectPrivatePathsIgnored; exports.saveProjectDeeplineEnvValues = saveProjectDeeplineEnvValues; exports.resolveProjectPinTarget = resolveProjectPinTarget; exports.getActiveProjectAuthSource = getActiveProjectAuthSource; exports.resolveCliAuthProvenance = resolveCliAuthProvenance; exports.resolveCliCommandContext = resolveCliCommandContext; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.hasActivePluginSkills = hasActivePluginSkills; exports.KNOWN_SKILL_AGENTS = KNOWN_SKILL_AGENTS; exports.DEFAULT_SKILL_AGENTS = DEFAULT_SKILL_AGENTS; exports.skillsAgentPathSegment = skillsAgentPathSegment; exports.resolveAutoSyncSkillAgents = resolveAutoSyncSkillAgents; exports.readSdkSkillsLocalVersion = readSdkSkillsLocalVersion; exports.writeSdkSkillsLocalVersion = writeSdkSkillsLocalVersion; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.HttpClient = HttpClient;
1956
+ exports.HOST_URL_ENV = HOST_URL_ENV; exports.API_KEY_ENV = API_KEY_ENV; exports.ACTIVE_ORG_ID_ENV = ACTIVE_ORG_ID_ENV; exports.ACTIVE_ORG_NAME_ENV = ACTIVE_ORG_NAME_ENV; exports.FEATURES_ENV = FEATURES_ENV; exports.PROD_URL = PROD_URL; exports.featureEnvValues = featureEnvValues; exports.storedHostApiKey = storedHostApiKey; exports.storedHostFeatures = storedHostFeatures; exports.baseUrlSlug = baseUrlSlug; exports.sdkCliStateDirPath = sdkCliStateDirPath; exports.hostConfigDirPath = hostConfigDirPath; exports.hostEnvFilePath = hostEnvFilePath; exports.saveHostEnvValues = saveHostEnvValues; exports.autoDetectBaseUrl = autoDetectBaseUrl; exports.resolveApiKeyForBaseUrl = resolveApiKeyForBaseUrl; exports.resolveProjectApiKeyForBaseUrl = resolveProjectApiKeyForBaseUrl; exports.resolveGlobalApiKeyForBaseUrl = resolveGlobalApiKeyForBaseUrl; exports.getResolvedProjectAuthSource = getResolvedProjectAuthSource; exports.resolveBaseUrlOnly = resolveBaseUrlOnly; exports.resolveConfig = resolveConfig; exports.ensureProjectPrivatePathsIgnored = ensureProjectPrivatePathsIgnored; exports.saveProjectDeeplineEnvValues = saveProjectDeeplineEnvValues; exports.resolveProjectPinTarget = resolveProjectPinTarget; exports.getActiveProjectAuthSource = getActiveProjectAuthSource; exports.resolveCliAuthProvenance = resolveCliAuthProvenance; exports.resolveCliCommandContext = resolveCliCommandContext; exports.SDK_VERSION = SDK_VERSION; exports.SDK_API_MAJOR = SDK_API_MAJOR; exports.SDK_API_CONTRACT = SDK_API_CONTRACT; exports.agentSessionIdFromEnvironment = agentSessionIdFromEnvironment; exports.detectAgentRuntime = detectAgentRuntime; exports.hasActivePluginSkills = hasActivePluginSkills; exports.KNOWN_SKILL_AGENTS = KNOWN_SKILL_AGENTS; exports.DEFAULT_SKILL_AGENTS = DEFAULT_SKILL_AGENTS; exports.skillsAgentPathSegment = skillsAgentPathSegment; exports.resolveAutoSyncSkillAgents = resolveAutoSyncSkillAgents; exports.readSdkSkillsLocalVersion = readSdkSkillsLocalVersion; exports.writeSdkSkillsLocalVersion = writeSdkSkillsLocalVersion; exports.deploymentProtectionHeaders = deploymentProtectionHeaders; exports.fetchWithDeploymentProtection = fetchWithDeploymentProtection; exports.COORDINATOR_INTERNAL_TOKEN_HEADER = COORDINATOR_INTERNAL_TOKEN_HEADER; exports.RUNTIME_ENVIRONMENT_TOKEN_HEADER = RUNTIME_ENVIRONMENT_TOKEN_HEADER; exports.RETAINED_PIPELINE_RECEIVERS_HEADER = RETAINED_PIPELINE_RECEIVERS_HEADER; exports.HttpClient = HttpClient;
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkRTO5QZWTjs = require('./chunk-RTO5QZWT.js');
5
+ var _chunkDQ65ZVHNjs = require('./chunk-DQ65ZVHN.js');
6
6
 
7
7
 
8
- var _chunkV7UP2F4Ujs = require('./chunk-V7UP2F4U.js');
8
+ var _chunkRYW4HPSMjs = require('./chunk-RYW4HPSM.js');
9
9
 
10
10
  // src/cli/commands/git.ts
11
11
  function shellQuote(value) {
@@ -32,11 +32,11 @@ function renderDeployment(deployment) {
32
32
  return `${deployment.id} ${source} (${kind}) - ${deployment.status}${suffix}`;
33
33
  }
34
34
  async function handleList(options) {
35
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
35
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
36
36
  const payload = await http.get(
37
37
  `/api/v2/play-projects${options.all ? "?includeDisabled=1" : ""}`
38
38
  );
39
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
39
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
40
40
  {
41
41
  projects: payload.projects,
42
42
  count: payload.projects.length,
@@ -73,7 +73,7 @@ function describeInstallationStatus(installation) {
73
73
  }
74
74
  }
75
75
  async function handleStatus(options) {
76
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
76
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
77
77
  const payload = await http.get("/api/v2/github/installation");
78
78
  const installation = payload.installation;
79
79
  const others = (_nullishCoalesce(payload.installations, () => ( []))).filter(
@@ -136,7 +136,7 @@ async function handleStatus(options) {
136
136
  )
137
137
  );
138
138
  }
139
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
139
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
140
140
  {
141
141
  installation,
142
142
  installations: _nullishCoalesce(payload.installations, () => ( [])),
@@ -147,10 +147,10 @@ async function handleStatus(options) {
147
147
  );
148
148
  }
149
149
  async function handleRepos(options) {
150
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
150
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
151
151
  const query = options.installation ? `?installationId=${encodeURIComponent(options.installation)}` : "";
152
152
  const payload = await http.get(`/api/v2/github/repos${query}`);
153
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
153
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
154
154
  {
155
155
  installation: payload.installation,
156
156
  repositories: payload.repositories,
@@ -171,7 +171,7 @@ async function handleRepos(options) {
171
171
  }
172
172
  async function resolveRepoId(repo, installation) {
173
173
  if (/^\d+$/.test(repo)) return Number(repo);
174
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
174
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
175
175
  const query = installation ? `?installationId=${encodeURIComponent(installation)}` : "";
176
176
  const payload = await http.get(
177
177
  `/api/v2/github/repos${query}`
@@ -188,7 +188,7 @@ async function resolveRepoId(repo, installation) {
188
188
  }
189
189
  async function handleLink(repo, options) {
190
190
  const repoId = await resolveRepoId(repo, options.installation);
191
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
191
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
192
192
  const payload = await http.post("/api/v2/play-projects", {
193
193
  repoId,
194
194
  ...options.installation !== void 0 ? { installationId: options.installation } : {},
@@ -197,7 +197,7 @@ async function handleLink(repo, options) {
197
197
  ...options.branch !== void 0 ? { productionBranch: options.branch } : {},
198
198
  ...options.prChecks !== void 0 ? { checkOnPullRequest: options.prChecks } : {}
199
199
  });
200
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
200
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
201
201
  {
202
202
  project: payload.project,
203
203
  render: {
@@ -220,11 +220,11 @@ async function handleLink(repo, options) {
220
220
  );
221
221
  }
222
222
  async function handleGet(id, options) {
223
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
223
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
224
224
  const payload = await http.get(
225
225
  `/api/v2/play-projects/${encodeURIComponent(id)}`
226
226
  );
227
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
227
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
228
228
  {
229
229
  project: payload.project,
230
230
  render: {
@@ -240,7 +240,7 @@ async function handleGet(id, options) {
240
240
  );
241
241
  }
242
242
  async function handleSet(id, options) {
243
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
243
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
244
244
  const payload = await http.patch(
245
245
  `/api/v2/play-projects/${encodeURIComponent(id)}`,
246
246
  {
@@ -251,7 +251,7 @@ async function handleSet(id, options) {
251
251
  ...options.disabled !== void 0 ? { disabled: options.disabled } : {}
252
252
  }
253
253
  );
254
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
254
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
255
255
  {
256
256
  project: payload.project,
257
257
  render: {
@@ -264,9 +264,9 @@ async function handleSet(id, options) {
264
264
  );
265
265
  }
266
266
  async function handleUnlink(id, options) {
267
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
267
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
268
268
  await http.delete(`/api/v2/play-projects/${encodeURIComponent(id)}`);
269
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
269
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
270
270
  {
271
271
  ok: true,
272
272
  id,
@@ -286,10 +286,10 @@ async function handleUnlink(id, options) {
286
286
  );
287
287
  }
288
288
  async function handleConnect(options) {
289
- const baseUrl = _chunkV7UP2F4Ujs.resolveBaseUrlOnly.call(void 0, );
289
+ const baseUrl = _chunkRYW4HPSMjs.resolveBaseUrlOnly.call(void 0, );
290
290
  const connectUrl = `${baseUrl.replace(/\/$/, "")}/api/v2/github/connect`;
291
- const opened = _chunkRTO5QZWTjs.openInBrowser.call(void 0, connectUrl);
292
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
291
+ const opened = _chunkDQ65ZVHNjs.openInBrowser.call(void 0, connectUrl);
292
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
293
293
  {
294
294
  connectUrl,
295
295
  browser: opened,
@@ -311,7 +311,7 @@ async function handleConnect(options) {
311
311
  );
312
312
  }
313
313
  async function handleDeploymentsList(options) {
314
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
314
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
315
315
  const query = new URLSearchParams();
316
316
  if (options.repo) query.set("projectId", options.repo);
317
317
  if (options.limit) query.set("limit", options.limit);
@@ -319,7 +319,7 @@ async function handleDeploymentsList(options) {
319
319
  const payload = await http.get(
320
320
  `/api/v2/deployments${suffix}`
321
321
  );
322
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
322
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
323
323
  {
324
324
  deployments: payload.deployments,
325
325
  count: payload.deployments.length,
@@ -363,12 +363,12 @@ function renderDeploymentMonitorLines(results) {
363
363
  ]);
364
364
  }
365
365
  async function handleDeploymentGet(id, options) {
366
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
366
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
367
367
  const payload = await http.get(`/api/v2/deployments/${encodeURIComponent(id)}`);
368
368
  const playLines = renderDeploymentPlayLines(payload.deployment.results);
369
369
  const monitorLines = renderDeploymentMonitorLines(payload.deployment.results);
370
370
  const repository = _nullishCoalesce(_optionalChain([payload, 'access', _10 => _10.project, 'optionalAccess', _11 => _11.repoFullName]), () => ( payload.deployment.repoFullName));
371
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
371
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
372
372
  {
373
373
  deployment: payload.deployment,
374
374
  project: payload.project,
@@ -387,9 +387,9 @@ async function handleDeploymentGet(id, options) {
387
387
  );
388
388
  }
389
389
  async function handleDeploymentCancel(id, options) {
390
- const { http } = _chunkRTO5QZWTjs.getAuthedHttpClient.call(void 0, );
390
+ const { http } = _chunkDQ65ZVHNjs.getAuthedHttpClient.call(void 0, );
391
391
  const payload = await http.post(`/api/v2/deployments/${encodeURIComponent(id)}/cancel`, {});
392
- _chunkRTO5QZWTjs.printCommandEnvelope.call(void 0,
392
+ _chunkDQ65ZVHNjs.printCommandEnvelope.call(void 0,
393
393
  {
394
394
  cancelled: payload.cancelled,
395
395
  deployment: payload.deployment,
@@ -60,209 +60,6 @@ function isDeeplineExtractorTarget(value) {
60
60
  return value in DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
61
61
  }
62
62
 
63
- // src/tool-output.ts
64
- import {
65
- closeSync,
66
- mkdirSync,
67
- openSync,
68
- writeFileSync,
69
- writeSync
70
- } from "fs";
71
- import { homedir } from "os";
72
- import { dirname, join } from "path";
73
- function isPlainObject(value) {
74
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
75
- }
76
- function getByDottedPath(root, dottedPath) {
77
- let current = root;
78
- for (const segment of String(dottedPath || "").split(".").filter(Boolean)) {
79
- if (!isPlainObject(current) || !(segment in current)) {
80
- return null;
81
- }
82
- current = current[segment];
83
- }
84
- return current;
85
- }
86
- function normalizeRows(value) {
87
- if (!Array.isArray(value)) return null;
88
- return value.map((entry) => {
89
- if (isPlainObject(entry)) return entry;
90
- return { value: entry };
91
- });
92
- }
93
- function columnsForRows(rows) {
94
- const seen = /* @__PURE__ */ new Set();
95
- const columns = [];
96
- for (const row of rows) {
97
- for (const key of Object.keys(row)) {
98
- if (!seen.has(key)) {
99
- seen.add(key);
100
- columns.push(key);
101
- }
102
- }
103
- }
104
- return columns;
105
- }
106
- function candidateRoots(payload) {
107
- const roots = [
108
- { path: null, value: payload }
109
- ];
110
- if (isPlainObject(payload) && isPlainObject(payload.toolResponse)) {
111
- roots.push({ path: "toolResponse", value: payload.toolResponse });
112
- if (Object.prototype.hasOwnProperty.call(payload.toolResponse, "raw")) {
113
- roots.push({
114
- path: "toolResponse.raw",
115
- value: payload.toolResponse.raw
116
- });
117
- }
118
- }
119
- if (isPlainObject(payload) && isPlainObject(payload.output)) {
120
- roots.push({ path: "output", value: payload.output });
121
- if (Object.prototype.hasOwnProperty.call(payload.output, "body")) {
122
- roots.push({ path: "output.body", value: payload.output.body });
123
- }
124
- }
125
- if (isPlainObject(payload) && isPlainObject(payload.result)) {
126
- roots.push({ path: "result", value: payload.result });
127
- if (isPlainObject(payload.result.data)) {
128
- roots.push({ path: "result.data", value: payload.result.data });
129
- }
130
- }
131
- return roots;
132
- }
133
- function findBestArrayCandidate(value, pathPrefix = "", depth = 0) {
134
- if (depth > 5) return null;
135
- const directRows = normalizeRows(value);
136
- const hasObjectRow = directRows?.some(
137
- (row) => Object.keys(row).some((key) => key !== "value")
138
- ) ?? false;
139
- let best = directRows && directRows.length > 0 && hasObjectRow ? { path: pathPrefix, rows: directRows } : null;
140
- if (!isPlainObject(value)) {
141
- return best;
142
- }
143
- for (const [key, child] of Object.entries(value)) {
144
- const childPath = pathPrefix ? `${pathPrefix}.${key}` : key;
145
- const candidate = findBestArrayCandidate(child, childPath, depth + 1);
146
- if (!candidate) continue;
147
- if (!best || candidate.rows.length > best.rows.length) {
148
- best = candidate;
149
- }
150
- }
151
- return best;
152
- }
153
- function tryConvertToList(payload, options) {
154
- const listExtractorPaths = Array.isArray(options?.listExtractorPaths) ? options?.listExtractorPaths.filter(
155
- (entry) => typeof entry === "string" && entry.trim().length > 0
156
- ) : [];
157
- if (listExtractorPaths.length > 0) {
158
- let emptyMatch = null;
159
- for (const root of candidateRoots(payload)) {
160
- for (const extractorPath of listExtractorPaths) {
161
- const resolved = getByDottedPath(root.value, extractorPath);
162
- const rows = normalizeRows(resolved);
163
- if (!rows) {
164
- continue;
165
- }
166
- const sourcePath = root.path ? `${root.path}.${extractorPath}` : extractorPath;
167
- if (rows.length > 0) {
168
- return { rows, strategy: "configured_paths", sourcePath };
169
- }
170
- emptyMatch ??= { rows, strategy: "configured_paths", sourcePath };
171
- }
172
- }
173
- if (emptyMatch) {
174
- return emptyMatch;
175
- }
176
- }
177
- const roots = candidateRoots(payload);
178
- const v2Raw = roots.find((root) => root.path === "toolResponse.raw");
179
- for (const root of v2Raw ? [v2Raw] : roots) {
180
- const candidate = findBestArrayCandidate(root.value, root.path ?? "");
181
- if (!candidate || candidate.rows.length === 0) continue;
182
- return {
183
- rows: candidate.rows,
184
- strategy: "auto_detected",
185
- sourcePath: candidate.path || root.path
186
- };
187
- }
188
- return null;
189
- }
190
- function projectRowOutput(conversion) {
191
- return {
192
- rows: conversion.rows,
193
- rowCount: conversion.rows.length,
194
- columns: columnsForRows(conversion.rows),
195
- previewRows: conversion.rows.slice(0, 5),
196
- strategy: conversion.strategy,
197
- sourcePath: conversion.sourcePath
198
- };
199
- }
200
- function ensureOutputDir() {
201
- const outputDir = join(homedir(), ".local", "share", "deepline", "data");
202
- mkdirSync(outputDir, { recursive: true });
203
- return outputDir;
204
- }
205
- function writeJsonOutputFile(payload, stem) {
206
- const outputDir = ensureOutputDir();
207
- const outputPath = join(outputDir, `${stem}_${Date.now()}.json`);
208
- writeFileSync(outputPath, JSON.stringify(payload, null, 2), "utf-8");
209
- return outputPath;
210
- }
211
- function writeCsvOutputFile(rows, stem, options) {
212
- const outputPath = options?.outPath ? options.outPath : join(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
213
- mkdirSync(dirname(outputPath), { recursive: true });
214
- const columns = columnsForRows(rows);
215
- const escapeCell = (value) => {
216
- const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
217
- if (/[",\n]/.test(normalized)) {
218
- return `"${normalized.replace(/"/g, '""')}"`;
219
- }
220
- return normalized;
221
- };
222
- const fd = openSync(outputPath, "w");
223
- try {
224
- writeSync(fd, `${columns.map(escapeCell).join(",")}
225
- `);
226
- for (const row of rows) {
227
- writeSync(
228
- fd,
229
- `${columns.map((column) => escapeCell(row[column])).join(",")}
230
- `
231
- );
232
- }
233
- } finally {
234
- closeSync(fd);
235
- }
236
- const previewRows = rows.slice(0, 5);
237
- const previewColumns = columns.slice(0, 5);
238
- const preview = [
239
- previewColumns.join(","),
240
- ...previewRows.map(
241
- (row) => previewColumns.map((column) => escapeCell(row[column])).join(",")
242
- )
243
- ].join("\n");
244
- return {
245
- path: outputPath,
246
- rowCount: rows.length,
247
- columns,
248
- preview
249
- };
250
- }
251
- function extractSummaryFields(payload) {
252
- const candidates = candidateRoots(payload);
253
- for (const candidate of candidates) {
254
- if (!isPlainObject(candidate.value)) continue;
255
- const summaryEntries = Object.entries(candidate.value).filter(
256
- ([, value]) => {
257
- return value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
258
- }
259
- );
260
- if (summaryEntries.length === 0) continue;
261
- return Object.fromEntries(summaryEntries);
262
- }
263
- return {};
264
- }
265
-
266
63
  // ../plays/email-status.ts
267
64
  var nullable = (type) => ({ type: [type, "null"] });
268
65
  var oneOf = (values) => ({ type: "string", enum: values });
@@ -485,10 +282,5 @@ export {
485
282
  PHONE_STATUS_VALUES,
486
283
  DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS,
487
284
  DEEPLINE_EXTRACTOR_TARGETS,
488
- isDeeplineExtractorTarget,
489
- tryConvertToList,
490
- projectRowOutput,
491
- writeJsonOutputFile,
492
- writeCsvOutputFile,
493
- extractSummaryFields
285
+ isDeeplineExtractorTarget
494
286
  };