deepline 0.3.325 → 0.3.327

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 (128) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +23 -25
  2. package/dist/bundling-sources/sdk/src/compat.ts +11 -6
  3. package/dist/bundling-sources/sdk/src/db/query.ts +172 -0
  4. package/dist/bundling-sources/sdk/src/errors.ts +35 -0
  5. package/dist/bundling-sources/sdk/src/index.ts +13 -0
  6. package/dist/bundling-sources/sdk/src/play.ts +34 -31
  7. package/dist/bundling-sources/sdk/src/plays/authoring-graph-path.ts +13 -0
  8. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +2 -1
  9. package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +189 -0
  10. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/projection.ts +11 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +98 -11
  14. package/dist/cli/auth-67YOPQ6M.js +31 -0
  15. package/dist/cli/{auth-PIZESRPC.mjs → auth-EBBDOKNV.mjs} +4 -4
  16. package/dist/cli/{billing-DQKFCQV5.js → billing-6AAB7WPJ.js} +70 -70
  17. package/dist/cli/{billing-HSL6VTCM.mjs → billing-IM2QUFX4.mjs} +4 -4
  18. package/dist/cli/{chunk-WW4XZIVM.mjs → chunk-3ITDKXNC.mjs} +12 -9
  19. package/dist/cli/{chunk-K7FC5IUU.js → chunk-3MXRNPBN.js} +1 -1
  20. package/dist/cli/{chunk-DLW7X2UK.js → chunk-4TO56P22.js} +5928 -5730
  21. package/dist/cli/{chunk-MNKDSR2J.js → chunk-4ZARCCPT.js} +344 -254
  22. package/dist/cli/{chunk-PBNZXZCW.js → chunk-77RAV5XX.js} +48 -48
  23. package/dist/cli/{chunk-HUKWYHBG.js → chunk-7RCJDAJX.js} +2 -2
  24. package/dist/cli/{chunk-5TYU3UIS.mjs → chunk-A5SKM3GL.mjs} +1 -1
  25. package/dist/cli/{chunk-XNL3SEMC.js → chunk-AFNEQ43J.js} +8 -3
  26. package/dist/cli/{chunk-XSEMQ4II.js → chunk-AGH6YP2T.js} +2 -1
  27. package/dist/cli/chunk-AID3OYVJ.js +8 -0
  28. package/dist/cli/{chunk-YE3O2UHM.mjs → chunk-CCRQ2VGJ.mjs} +24 -1
  29. package/dist/cli/{chunk-HPTQEWCF.js → chunk-CISKBOXD.js} +70 -67
  30. package/dist/cli/{chunk-OPERWJR6.mjs → chunk-D6GD5AVN.mjs} +3 -3
  31. package/dist/cli/{chunk-6RMKHN7S.mjs → chunk-DCAU6PND.mjs} +4 -20
  32. package/dist/cli/{chunk-PVDQ55PS.js → chunk-DM3SHV6U.js} +29 -6
  33. package/dist/cli/{chunk-CV5GDCKN.js → chunk-DSDX6EUW.js} +29 -45
  34. package/dist/cli/{chunk-5FHU7TV4.mjs → chunk-DVV4FPS7.mjs} +2 -2
  35. package/dist/cli/{chunk-AQUNQJ5Y.mjs → chunk-F45425TB.mjs} +1 -1
  36. package/dist/cli/{chunk-NWBARG3F.mjs → chunk-G5774EFF.mjs} +1 -1
  37. package/dist/cli/chunk-GVESPYSY.mjs +234 -0
  38. package/dist/cli/{chunk-H5TJBRSC.mjs → chunk-HOWQKN6J.mjs} +98 -113
  39. package/dist/cli/{chunk-UYFWTIKF.js → chunk-HZZJR2GV.js} +26 -26
  40. package/dist/cli/{chunk-76VKBPOC.mjs → chunk-JOA6IKDE.mjs} +7 -2
  41. package/dist/cli/chunk-LVEDPCLJ.js +234 -0
  42. package/dist/cli/{chunk-KZNFYOHX.js → chunk-MOP6D7Z5.js} +6 -6
  43. package/dist/cli/{chunk-YXRPWMGN.js → chunk-NWIJLTRL.js} +147 -162
  44. package/dist/cli/chunk-OVDNJAJN.mjs +8 -0
  45. package/dist/cli/{chunk-XIVUB36F.mjs → chunk-QZAP5VOS.mjs} +104 -14
  46. package/dist/cli/{chunk-6VZDSBK6.mjs → chunk-REP2MYBI.mjs} +2 -2
  47. package/dist/cli/{chunk-PWV2M4LW.mjs → chunk-RSEVBSFE.mjs} +1 -1
  48. package/dist/cli/{chunk-OOPSX57I.js → chunk-TAGHNT5P.js} +6 -6
  49. package/dist/cli/{chunk-QQ2FG5W3.js → chunk-UROXKPND.js} +6 -6
  50. package/dist/cli/{chunk-7PZFGB7L.mjs → chunk-YIY74KUF.mjs} +2 -1
  51. package/dist/cli/{chunk-7MD453WV.mjs → chunk-ZOFARJWH.mjs} +5674 -5476
  52. package/dist/cli/client-7LZCG4VD.js +20 -0
  53. package/dist/cli/{client-57SR4KVM.mjs → client-JCMSACT4.mjs} +3 -3
  54. package/dist/cli/{csv-G2FRMOXL.mjs → csv-NPMWVM5D.mjs} +3 -3
  55. package/dist/cli/{csv-5DJSC6BD.js → csv-OILKDKUX.js} +12 -12
  56. package/dist/cli/{db-WWZEXM3N.mjs → db-AZUAOWPQ.mjs} +214 -137
  57. package/dist/cli/{db-NVO7P4VO.js → db-MNDRYYEX.js} +226 -149
  58. package/dist/cli/{describe-26OMF3A4.mjs → describe-KJWOHMKC.mjs} +12 -11
  59. package/dist/cli/{describe-M26LHDBQ.js → describe-QENLDLM2.js} +28 -27
  60. package/dist/cli/{executions-KI47LPKE.js → executions-P36UHBPG.js} +6 -6
  61. package/dist/cli/{executions-2LLHY3IL.mjs → executions-QZNQWF6F.mjs} +4 -4
  62. package/dist/cli/{feedback-2Y26C2BZ.js → feedback-K4UGTLFD.js} +6 -6
  63. package/dist/cli/{feedback-O26VL2OF.mjs → feedback-RQ6HSZSG.mjs} +3 -3
  64. package/dist/cli/{git-UVPGZN3K.mjs → git-PBRMCBMI.mjs} +4 -4
  65. package/dist/cli/git-RPFH3NJ2.js +23 -0
  66. package/dist/cli/index.js +105 -87
  67. package/dist/cli/index.mjs +65 -47
  68. package/dist/cli/{legacy-noops-IK5CH72U.mjs → legacy-noops-G7GWJ5UC.mjs} +4 -4
  69. package/dist/cli/{legacy-noops-H6Y3SEVB.js → legacy-noops-X74FM35Q.js} +7 -7
  70. package/dist/cli/{monitors-SFVVMAJT.mjs → monitors-KL2MCR57.mjs} +4 -4
  71. package/dist/cli/{monitors-JL6TTQCI.js → monitors-VKURX3YM.js} +85 -85
  72. package/dist/cli/{org-SSDONL57.mjs → org-DT53KTNW.mjs} +4 -4
  73. package/dist/cli/{org-OVMAZCQS.js → org-ZYXJDC44.js} +60 -60
  74. package/dist/cli/play-BUQV47E2.js +153 -0
  75. package/dist/cli/{play-X6NPACUO.mjs → play-WIJGQYTB.mjs} +11 -10
  76. package/dist/cli/{providers-E24JDWSR.js → providers-GRTW4TXX.js} +7 -7
  77. package/dist/cli/{providers-ONUBYYY4.mjs → providers-GYGKGS2J.mjs} +4 -4
  78. package/dist/cli/{quickstart-TB7C3DLG.js → quickstart-WB26543C.js} +5 -5
  79. package/dist/cli/{quickstart-B7NIXACV.mjs → quickstart-XF3M2M2S.mjs} +3 -3
  80. package/dist/cli/{search-N3QUIATW.mjs → search-ANJLTOF2.mjs} +5 -5
  81. package/dist/cli/search-CR2GZLCM.js +26 -0
  82. package/dist/cli/{secrets-CPCVFDYB.js → secrets-5KBUGMTK.js} +13 -13
  83. package/dist/cli/{secrets-V7Z4M67T.mjs → secrets-D6UR5CTW.mjs} +4 -4
  84. package/dist/cli/{sessions-E4FIZLQP.js → sessions-46PXFULL.js} +5 -5
  85. package/dist/cli/{sessions-PDOBKAKO.mjs → sessions-S7N4JEWK.mjs} +4 -4
  86. package/dist/cli/{settings-UVM2WDE4.js → settings-KMNBITSU.js} +74 -74
  87. package/dist/cli/{settings-QYHYHZDI.mjs → settings-V6U3SRTH.mjs} +7 -7
  88. package/dist/cli/{setup-3JFAXQLJ.js → setup-4K5FY6AU.js} +41 -41
  89. package/dist/cli/{setup-4RLAETDW.mjs → setup-OGITSLTN.mjs} +6 -6
  90. package/dist/cli/skills-4FP2MZKL.js +28 -0
  91. package/dist/cli/{skills-ZX2JSWOZ.mjs → skills-AXWAYPBY.mjs} +4 -4
  92. package/dist/cli/tools-7YZPH6WC.js +39 -0
  93. package/dist/cli/{tools-EGXCVIPJ.mjs → tools-LJCY6B23.mjs} +8 -7
  94. package/dist/cli/update-3VUOW6AP.js +28 -0
  95. package/dist/cli/{update-7FEKRQFE.mjs → update-DDR5XIUB.mjs} +6 -6
  96. package/dist/cli/{workflow-54VCKIG2.js → workflow-7CTCDWL3.js} +15 -15
  97. package/dist/cli/{workflow-7V7TTTKK.mjs → workflow-PRNCVANQ.mjs} +5 -5
  98. package/dist/{client-Bb4Jjzmj.d.ts → client-DHq8dJ56.d.ts} +39 -11
  99. package/dist/{client-COa-3GHK.d.mts → client-wiWPZhnI.d.mts} +39 -11
  100. package/dist/{compiler-manifest-CsnWj-AK.d.mts → compiler-manifest-9TkZ_ykI.d.mts} +711 -711
  101. package/dist/{compiler-manifest-CsnWj-AK.d.ts → compiler-manifest-9TkZ_ykI.d.ts} +711 -711
  102. package/dist/index-B-5_Xhud.d.mts +75 -0
  103. package/dist/index-ykksoEyR.d.ts +75 -0
  104. package/dist/index.d.mts +52 -13
  105. package/dist/index.d.ts +52 -13
  106. package/dist/index.js +142 -68
  107. package/dist/index.mjs +102 -28
  108. package/dist/install-integrity.json +91 -84
  109. package/dist/plays/bundle-play-file.d.mts +7 -75
  110. package/dist/plays/bundle-play-file.d.ts +7 -75
  111. package/dist/plays/bundle-play-file.mjs +1 -1
  112. package/dist/plays/run-request.d.mts +2 -2
  113. package/dist/plays/run-request.d.ts +2 -2
  114. package/dist/release.d.mts +1 -1
  115. package/dist/release.d.ts +1 -1
  116. package/dist/release.js +2 -2
  117. package/dist/release.mjs +1 -1
  118. package/package.json +1 -1
  119. package/dist/cli/auth-RXCD4GOV.js +0 -31
  120. package/dist/cli/chunk-OWJZUE3Y.mjs +0 -103
  121. package/dist/cli/chunk-SDK3ZA2C.js +0 -103
  122. package/dist/cli/client-562MULXK.js +0 -20
  123. package/dist/cli/git-KGPX5YPD.js +0 -23
  124. package/dist/cli/play-3DB4MSHN.js +0 -152
  125. package/dist/cli/search-NJ637YGQ.js +0 -26
  126. package/dist/cli/skills-BYRYG64R.js +0 -28
  127. package/dist/cli/tools-TAWOAY5X.js +0 -38
  128. package/dist/cli/update-H24GEBXM.js +0 -28
@@ -0,0 +1,189 @@
1
+ import type { DeeplineClient } from '../client.js';
2
+ import type { BundledPlayFileSuccess } from './bundle-play-file.js';
3
+
4
+ export type LocalPlayGraph = {
5
+ root: BundledPlayFileSuccess;
6
+ nodes: Map<string, BundledPlayFileSuccess>;
7
+ };
8
+
9
+ function importedNodes(graph: LocalPlayGraph): BundledPlayFileSuccess[] {
10
+ const visited = new Set<string>();
11
+ const visiting = new Set<string>();
12
+ const ordered: BundledPlayFileSuccess[] = [];
13
+ const names = new Map<string, string>();
14
+ const visit = (node: BundledPlayFileSuccess) => {
15
+ if (visiting.has(node.filePath))
16
+ throw new Error(`Recursive imported Play graph at ${node.filePath}.`);
17
+ if (visited.has(node.filePath)) return;
18
+ visiting.add(node.filePath);
19
+ for (const dependency of node.importedPlayDependencies) {
20
+ const child = graph.nodes.get(dependency.filePath);
21
+ if (!child)
22
+ throw new Error(
23
+ `Missing bundled Play dependency ${dependency.filePath}.`,
24
+ );
25
+ visit(child);
26
+ }
27
+ visiting.delete(node.filePath);
28
+ visited.add(node.filePath);
29
+ if (node === graph.root) return;
30
+ if (!node.playName)
31
+ throw new Error(
32
+ `Imported Play ${node.filePath} must export definePlay(...).`,
33
+ );
34
+ const existing = names.get(node.playName);
35
+ if (existing !== undefined && existing !== node.filePath)
36
+ throw new Error(
37
+ `Imported Play name ${node.playName} belongs to more than one source file.`,
38
+ );
39
+ names.set(node.playName, node.filePath);
40
+ ordered.push(node);
41
+ };
42
+ visit(graph.root);
43
+ return ordered;
44
+ }
45
+
46
+ /** Describe local execution without storing artifacts or starting cloud work. */
47
+ export function planLocalPlayExecution(
48
+ graph: LocalPlayGraph,
49
+ input: { runIdFile?: string | null } = {},
50
+ ) {
51
+ const imports = importedNodes(graph).map((node) => ({
52
+ name: node.playName!,
53
+ artifactHash: node.artifact.artifactHash,
54
+ graphHash: node.artifact.graphHash,
55
+ }));
56
+ return {
57
+ command: 'plays run',
58
+ root: {
59
+ name: graph.root.playName,
60
+ artifactHash: graph.root.artifact.artifactHash,
61
+ publication: 'unpublished' as const,
62
+ },
63
+ importedPlays: imports.map((node) => ({
64
+ ...node,
65
+ publication: 'pinned' as const,
66
+ })),
67
+ effects: {
68
+ cloudMutations: imports.length
69
+ ? [
70
+ 'store_imported_execution_artifacts',
71
+ 'stage_files_if_present',
72
+ 'register_unpublished_root_revision',
73
+ 'start_run',
74
+ ]
75
+ : [
76
+ 'stage_files_if_present',
77
+ 'register_unpublished_root_revision',
78
+ 'start_run',
79
+ ],
80
+ localWrites: input.runIdFile
81
+ ? ['bundle_cache', 'run_identity_file']
82
+ : ['bundle_cache'],
83
+ creditSpending: 'tool_calls_may_spend' as const,
84
+ recovery: 'inspect_or_resume_original_run_id' as const,
85
+ },
86
+ };
87
+ }
88
+
89
+ /** Store immutable imported execution content without changing draft or live revisions. */
90
+ export async function pinLocalPlayImports(
91
+ client: Pick<DeeplineClient, 'registerPlayArtifact'>,
92
+ graph: LocalPlayGraph,
93
+ ): Promise<LocalPlayGraph> {
94
+ const imports = importedNodes(graph);
95
+ if (imports.length === 0) return graph;
96
+ // Validate the entire graph before the first storage request.
97
+ for (const node of [...imports, graph.root]) {
98
+ if (!node.compilerManifest)
99
+ throw new Error(`Missing compiler manifest for ${node.filePath}.`);
100
+ }
101
+ const nodes = new Map(graph.nodes);
102
+ const stored = new Map<
103
+ string,
104
+ NonNullable<
105
+ BundledPlayFileSuccess['artifact']['importedPlayArtifacts']
106
+ >[string]
107
+ >();
108
+ const withPins = (node: BundledPlayFileSuccess): BundledPlayFileSuccess => {
109
+ const closure = new Map<
110
+ string,
111
+ NonNullable<
112
+ BundledPlayFileSuccess['artifact']['importedPlayArtifacts']
113
+ >[string]
114
+ >();
115
+ for (const dependency of node.importedPlayDependencies) {
116
+ const child = nodes.get(dependency.filePath)!;
117
+ const pointer = stored.get(dependency.filePath);
118
+ if (!pointer)
119
+ throw new Error(`Imported Play ${dependency.filePath} was not stored.`);
120
+ for (const [name, pin] of Object.entries(
121
+ child.artifact.importedPlayArtifacts ?? {},
122
+ ))
123
+ closure.set(name, pin);
124
+ closure.set(child.playName!, pointer);
125
+ }
126
+ return {
127
+ ...node,
128
+ artifact: {
129
+ ...node.artifact,
130
+ ...(closure.size
131
+ ? { importedPlayArtifacts: Object.fromEntries(closure) }
132
+ : {}),
133
+ },
134
+ };
135
+ };
136
+ // Children are stored before parents so every pointer refers to immutable content.
137
+ for (const original of imports) {
138
+ const node = withPins(original);
139
+ const result = await client.registerPlayArtifact({
140
+ name: node.playName!,
141
+ sourceCode: node.sourceCode,
142
+ sourceFiles: node.sourceFiles,
143
+ description: node.playDescription ?? undefined,
144
+ artifact: node.artifact,
145
+ compilerManifest: node.compilerManifest!,
146
+ publish: false,
147
+ artifactOnly: true,
148
+ });
149
+ if (
150
+ typeof result.artifactStorageKey !== 'string' ||
151
+ !result.artifactStorageKey.trim()
152
+ )
153
+ throw new Error(
154
+ `No immutable artifact identity was returned for ${node.playName}.`,
155
+ );
156
+ stored.set(node.filePath, {
157
+ artifactStorageKey: result.artifactStorageKey,
158
+ artifactHash: node.artifact.artifactHash,
159
+ graphHash: node.artifact.graphHash,
160
+ });
161
+ nodes.set(node.filePath, node);
162
+ }
163
+ const root = withPins(graph.root);
164
+ nodes.set(root.filePath, root);
165
+ return { root, nodes };
166
+ }
167
+
168
+ /** Publish exactly the reviewed import graph; the root is submitted as an unpublished run. */
169
+ export async function publishLocalPlayImports(
170
+ client: Pick<DeeplineClient, 'registerPlayArtifact'>,
171
+ graph: LocalPlayGraph,
172
+ ): Promise<void> {
173
+ const nodes = importedNodes(graph);
174
+ for (const node of nodes) {
175
+ if (!node.compilerManifest)
176
+ throw new Error(`Missing compiler manifest for ${node.filePath}.`);
177
+ }
178
+ for (const node of nodes) {
179
+ await client.registerPlayArtifact({
180
+ name: node.playName!,
181
+ sourceCode: node.sourceCode,
182
+ sourceFiles: node.sourceFiles,
183
+ description: node.playDescription ?? undefined,
184
+ artifact: node.artifact,
185
+ compilerManifest: node.compilerManifest!,
186
+ publish: true,
187
+ });
188
+ }
189
+ }
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.325',
203
+ version: '0.3.327',
204
204
  updateSummary:
205
205
  '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.',
206
206
  packageCapabilities: {
@@ -26,7 +26,7 @@ const EXECUTE_RESPONSE_INTENT_HEADER = 'x-deepline-execute-response-intent';
26
26
  const RAW_V2_EXECUTE_RESPONSE_CONTRACT = RAW_V2_TOOL_RESPONSE_CONTRACT;
27
27
  const DEFAULT_EXECUTION_RECOVERY_TIMEOUT_MS = 15 * 60 * 1_000;
28
28
 
29
- function validateExecutionIdempotencyKey(key: string): void {
29
+ export function validateExecutionIdempotencyKey(key: string): void {
30
30
  if (
31
31
  typeof key !== 'string' ||
32
32
  key.length < 1 ||
@@ -84,6 +84,15 @@ function normalizePhoneStatus(value: unknown): unknown {
84
84
  return normalized;
85
85
  }
86
86
 
87
+ // Searchbug's FCC RND `reassigned` answer: YES means the number changed
88
+ // hands after the consent date, NO means it did not, NO_DATA is no answer.
89
+ function normalizeSearchbugReassignedStatus(value: unknown): unknown {
90
+ const normalized = normalizeString(value)?.toUpperCase();
91
+ if (normalized === 'NO') return 'valid';
92
+ if (normalized === 'YES') return 'invalid';
93
+ return 'unknown';
94
+ }
95
+
87
96
  function normalizeJobChangeStatus(value: unknown): unknown {
88
97
  if (typeof value === 'boolean') return value ? 'moved' : 'no_change';
89
98
  const normalized = normalizeString(value)
@@ -165,6 +174,8 @@ function applyTransforms(
165
174
  // Contract), never by a string transform — so an `emailStatus` transform is
166
175
  // a no-op and falls through to `return current`.
167
176
  if (transform.endsWith('phoneStatus')) return normalizePhoneStatus(current);
177
+ if (transform === 'searchbug.reassignedStatus')
178
+ return normalizeSearchbugReassignedStatus(current);
168
179
  if (transform === 'jobChange') return normalizeJobChange(current);
169
180
  if (transform === 'jobChangeStatus')
170
181
  return normalizeJobChangeStatus(current);
@@ -614,13 +614,79 @@ function normalizeRelativePath(path: string): string {
614
614
  .replace(/^\./, '');
615
615
  }
616
616
 
617
+ /**
618
+ * Keys that carry the dialable number inside a provider's phone object, in
619
+ * preference order (Apollo `sanitized_number`, Wiza/Lusha/Forager `number`,
620
+ * Enformion `phoneNumber`, Datagma `display_international`, ...).
621
+ */
622
+ const PHONE_OBJECT_VALUE_KEYS = [
623
+ 'sanitized_number',
624
+ 'number',
625
+ 'phone',
626
+ 'phone_number',
627
+ 'phoneNumber',
628
+ 'display_international',
629
+ 'displayInternational',
630
+ 'international',
631
+ 'value',
632
+ 'raw_number',
633
+ 'raw',
634
+ 'sanitized',
635
+ ] as const;
636
+
637
+ /** Shortest real national number; anything shorter is a flag or a mask. */
638
+ const PHONE_TARGET_MIN_DIGITS = 7;
639
+
640
+ /**
641
+ * The `phone` getter is typed as one string. Providers put the number inside
642
+ * objects (`{ number, type }`) and arrays, and put availability flags under
643
+ * the same keys (`mobile_phone: true`, `has_direct_phone: "Yes"`, masked
644
+ * `"120******"`). Resolve to the first dialable string, or null when the
645
+ * value carries no phone number at all.
646
+ */
647
+ function phoneTargetValue(value: unknown): string | null {
648
+ if (typeof value === 'number' && Number.isFinite(value)) {
649
+ return phoneTargetValue(String(value));
650
+ }
651
+ if (typeof value === 'string') {
652
+ const trimmed = value.trim();
653
+ const digits = trimmed.replace(/\D/g, '').length;
654
+ return digits >= PHONE_TARGET_MIN_DIGITS ? trimmed : null;
655
+ }
656
+ if (Array.isArray(value)) {
657
+ for (const entry of value) {
658
+ const phone = phoneTargetValue(entry);
659
+ if (phone) return phone;
660
+ }
661
+ return null;
662
+ }
663
+ if (isRecord(value)) {
664
+ for (const key of PHONE_OBJECT_VALUE_KEYS) {
665
+ const phone = phoneTargetValue(value[key]);
666
+ if (phone) return phone;
667
+ }
668
+ }
669
+ return null;
670
+ }
671
+
672
+ /** The value a target accepts from a candidate, or undefined to keep looking. */
673
+ function acceptedTargetValue(
674
+ target: string | undefined,
675
+ value: unknown,
676
+ ): unknown {
677
+ if (target === 'phone') return phoneTargetValue(value) ?? undefined;
678
+ return isMeaningfulValue(value) ? value : undefined;
679
+ }
680
+
617
681
  function getFirstMeaningfulValueAtPath(
618
682
  root: unknown,
619
683
  path: string,
684
+ target?: string,
620
685
  ): ToolResultTargetMetadata | null {
621
686
  for (const entry of valuesAtSegments(root, parsePath(path))) {
622
- if (isMeaningfulValue(entry.value)) {
623
- return { value: entry.value, path: entry.path };
687
+ const value = acceptedTargetValue(target, entry.value);
688
+ if (value !== undefined) {
689
+ return { value, path: entry.path };
624
690
  }
625
691
  }
626
692
  return null;
@@ -663,10 +729,11 @@ function normalizeRows(value: unknown): Record<string, unknown>[] | null {
663
729
  function findFirstTargetByPath(
664
730
  result: unknown,
665
731
  paths: readonly string[] | undefined,
732
+ target?: string,
666
733
  ): ToolResultTargetMetadata | null {
667
734
  for (const path of paths ?? []) {
668
735
  for (const candidate of candidateResultPaths(path)) {
669
- const match = getFirstMeaningfulValueAtPath(result, candidate);
736
+ const match = getFirstMeaningfulValueAtPath(result, candidate, target);
670
737
  if (match) return match;
671
738
  }
672
739
  }
@@ -756,11 +823,10 @@ function findFirstTargetByKey(
756
823
  };
757
824
  for (const [key, value] of Object.entries(result)) {
758
825
  if (rule.reject?.some((pattern) => pattern.test(key))) continue;
759
- if (
760
- rule.match.some((pattern) => pattern.test(key)) &&
761
- isMeaningfulValue(value)
762
- ) {
763
- return { value, path: pathToString([...path, key]) };
826
+ if (!rule.match.some((pattern) => pattern.test(key))) continue;
827
+ const accepted = acceptedTargetValue(target, value);
828
+ if (accepted !== undefined) {
829
+ return { value: accepted, path: pathToString([...path, key]) };
764
830
  }
765
831
  }
766
832
  for (const [key, value] of Object.entries(result)) {
@@ -807,6 +873,15 @@ function normalizePhoneStatus(value: unknown): unknown {
807
873
  return normalized;
808
874
  }
809
875
 
876
+ // Searchbug's FCC RND `reassigned` answer: YES means the number changed
877
+ // hands after the consent date, NO means it did not, NO_DATA is no answer.
878
+ function normalizeSearchbugReassignedStatus(value: unknown): unknown {
879
+ const normalized = normalizeString(value)?.toUpperCase();
880
+ if (normalized === 'NO') return 'valid';
881
+ if (normalized === 'YES') return 'invalid';
882
+ return 'unknown';
883
+ }
884
+
810
885
  function normalizeJobChangeStatus(value: unknown): unknown {
811
886
  if (typeof value === 'boolean') return value ? 'moved' : 'no_change';
812
887
  const normalized = normalizeString(value)
@@ -886,6 +961,8 @@ function applyExtractorTransforms(
886
961
  return (descriptor.transforms ?? []).reduce((current, transform) => {
887
962
  if (transform.endsWith('emailStatus')) return normalizeEmailStatus(current);
888
963
  if (transform.endsWith('phoneStatus')) return normalizePhoneStatus(current);
964
+ if (transform === 'searchbug.reassignedStatus')
965
+ return normalizeSearchbugReassignedStatus(current);
889
966
  if (transform === 'jobChange') return normalizeJobChange(current);
890
967
  if (transform === 'jobChangeStatus')
891
968
  return normalizeJobChangeStatus(current);
@@ -1029,7 +1106,9 @@ function buildTargets(
1029
1106
  const isSemanticStatus =
1030
1107
  descriptor.emailStatus !== undefined ||
1031
1108
  descriptor.transforms?.some((transform) =>
1032
- /(emailStatus|phoneStatus|jobChange(?:Status)?)$/.test(transform),
1109
+ /(emailStatus|phoneStatus|reassignedStatus|jobChange(?:Status)?)$/.test(
1110
+ transform,
1111
+ ),
1033
1112
  ) === true;
1034
1113
  if (isSemanticStatus) semanticStatusTargets.add(target);
1035
1114
  else declaredTargetPaths.set(target, descriptor.paths);
@@ -1038,7 +1117,11 @@ function buildTargets(
1038
1117
  targets[target] = emailStatusTarget;
1039
1118
  continue;
1040
1119
  }
1041
- const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
1120
+ const fromExtractor = findFirstTargetByPath(
1121
+ result,
1122
+ descriptor.paths,
1123
+ target,
1124
+ );
1042
1125
  if (!fromExtractor) {
1043
1126
  // A declared null is an explicit provider answer, not permission to
1044
1127
  // guess from a similarly named sibling such as `emailDomain`.
@@ -1065,7 +1148,11 @@ function buildTargets(
1065
1148
  target,
1066
1149
  targetGetters?.[target] ?? declaredTargetPaths.get(target) ?? [],
1067
1150
  );
1068
- const fromMetadata = findFirstTargetByPath(result, targetGetters?.[target]);
1151
+ const fromMetadata = findFirstTargetByPath(
1152
+ result,
1153
+ targetGetters?.[target],
1154
+ target,
1155
+ );
1069
1156
  if (fromMetadata) {
1070
1157
  targets[target] = fromMetadata;
1071
1158
  continue;
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunk77RAV5XXjs = require('./chunk-77RAV5XX.js');
13
+ require('./chunk-UROXKPND.js');
14
+ require('./chunk-DM3SHV6U.js');
15
+ require('./chunk-XNYIZMNQ.js');
16
+ require('./chunk-3MXRNPBN.js');
17
+ require('./chunk-7P5AA3SN.js');
18
+ require('./chunk-OG64RBAC.js');
19
+ require('./chunk-COGTRVWW.js');
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ exports.EXIT_WORKSPACE_MISMATCH = _chunk77RAV5XXjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunk77RAV5XXjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk77RAV5XXjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk77RAV5XXjs.handleRegister; exports.handleStatus = _chunk77RAV5XXjs.handleStatus; exports.handleWait = _chunk77RAV5XXjs.handleWait; exports.readPendingAuthClaim = _chunk77RAV5XXjs.readPendingAuthClaim; exports.registerAuthCommands = _chunk77RAV5XXjs.registerAuthCommands; exports.reportSetupCompleted = _chunk77RAV5XXjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk77RAV5XXjs.resolvePendingAuthClaimForResume;
@@ -9,11 +9,11 @@ import {
9
9
  registerAuthCommands,
10
10
  reportSetupCompleted,
11
11
  resolvePendingAuthClaimForResume
12
- } from "./chunk-5FHU7TV4.mjs";
13
- import "./chunk-AQUNQJ5Y.mjs";
14
- import "./chunk-YE3O2UHM.mjs";
12
+ } from "./chunk-DVV4FPS7.mjs";
13
+ import "./chunk-F45425TB.mjs";
14
+ import "./chunk-CCRQ2VGJ.mjs";
15
15
  import "./chunk-DLIRSHV6.mjs";
16
- import "./chunk-NWBARG3F.mjs";
16
+ import "./chunk-G5774EFF.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
18
  import "./chunk-WZYKRD7T.mjs";
19
19
  import "./chunk-KRD6H754.mjs";