deepline 0.3.324 → 0.3.326

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 (133) 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/sdk/src/types.ts +6 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +2 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +7 -1
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +1 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +5 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +84 -10
  18. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +9 -0
  19. package/dist/cli/auth-6STWK6UK.js +31 -0
  20. package/dist/cli/{auth-6KWNR6AI.mjs → auth-VON5FFUK.mjs} +4 -4
  21. package/dist/cli/{billing-VQ2NUJLB.mjs → billing-X6JUEFRE.mjs} +4 -4
  22. package/dist/cli/{billing-CLLWHIAT.js → billing-YI4RZI2O.js} +70 -70
  23. package/dist/cli/{chunk-NC2ZXG2Y.js → chunk-3NGWGFVL.js} +26 -26
  24. package/dist/cli/{chunk-5CQ554BM.mjs → chunk-4AB4Y6FF.mjs} +1 -1
  25. package/dist/cli/{chunk-EXKRHZRG.js → chunk-4LNBSQM4.js} +5928 -5730
  26. package/dist/cli/{chunk-G4F2AIQ5.js → chunk-5NXHSRRE.js} +6 -6
  27. package/dist/cli/{chunk-XNL3SEMC.js → chunk-AFNEQ43J.js} +8 -3
  28. package/dist/cli/{chunk-XSEMQ4II.js → chunk-AGH6YP2T.js} +2 -1
  29. package/dist/cli/chunk-AID3OYVJ.js +8 -0
  30. package/dist/cli/{chunk-HHZDWBSQ.mjs → chunk-BQJVMKWL.mjs} +1 -1
  31. package/dist/cli/{chunk-TJGJTB5T.mjs → chunk-BR7GGTAE.mjs} +24 -1
  32. package/dist/cli/{chunk-IXYR65PW.js → chunk-BUYZEUY4.js} +1 -1
  33. package/dist/cli/{chunk-GROXVGGW.js → chunk-CUUHQ3AO.js} +6 -6
  34. package/dist/cli/{chunk-NIOFMRYW.mjs → chunk-DFDXKOLR.mjs} +98 -113
  35. package/dist/cli/{chunk-GMO3NBE2.js → chunk-EMZ7Y5SW.js} +70 -67
  36. package/dist/cli/chunk-GVESPYSY.mjs +234 -0
  37. package/dist/cli/{chunk-N5E66DP3.js → chunk-GVYKY6T6.js} +344 -254
  38. package/dist/cli/{chunk-EHSI2DMO.mjs → chunk-IQCCGOQH.mjs} +4 -20
  39. package/dist/cli/{chunk-76VKBPOC.mjs → chunk-JOA6IKDE.mjs} +7 -2
  40. package/dist/cli/{chunk-3ZKAKQYC.mjs → chunk-KLWBAQ5A.mjs} +104 -14
  41. package/dist/cli/{chunk-PAA4FYCF.js → chunk-KZ4PCK4O.js} +29 -45
  42. package/dist/cli/chunk-LVEDPCLJ.js +234 -0
  43. package/dist/cli/{chunk-I7RLL7LN.mjs → chunk-M7CPVMDB.mjs} +1 -1
  44. package/dist/cli/{chunk-2UQUOUAW.js → chunk-MDQZQ3NY.js} +2 -2
  45. package/dist/cli/{chunk-V5PA6TCT.js → chunk-MKHSZA2X.js} +48 -48
  46. package/dist/cli/{chunk-LHJKYMTS.mjs → chunk-MOBZS4F3.mjs} +1 -1
  47. package/dist/cli/chunk-OVDNJAJN.mjs +8 -0
  48. package/dist/cli/{chunk-QM2Z4FQF.js → chunk-T33W6JUJ.js} +6 -6
  49. package/dist/cli/{chunk-DO2VA5UP.mjs → chunk-TDSNAC3C.mjs} +2 -2
  50. package/dist/cli/{chunk-D5YJHGST.js → chunk-TXVOB5J2.js} +29 -6
  51. package/dist/cli/{chunk-TZZNI2A4.js → chunk-TZQMFWLF.js} +147 -162
  52. package/dist/cli/{chunk-NQJQ3CLX.mjs → chunk-VGKVLADU.mjs} +3 -3
  53. package/dist/cli/{chunk-U2RPP53P.mjs → chunk-VKXGOQG5.mjs} +5674 -5476
  54. package/dist/cli/{chunk-AKM5JVPG.mjs → chunk-W74E5ETE.mjs} +12 -9
  55. package/dist/cli/{chunk-7PZFGB7L.mjs → chunk-YIY74KUF.mjs} +2 -1
  56. package/dist/cli/{chunk-5QZFWY7C.mjs → chunk-ZRN6YOF2.mjs} +2 -2
  57. package/dist/cli/client-TEBW2P24.js +20 -0
  58. package/dist/cli/{client-VHUKTDAZ.mjs → client-ZMOKUNL2.mjs} +3 -3
  59. package/dist/cli/{csv-5MZY7HU5.js → csv-HZRKEI7J.js} +12 -12
  60. package/dist/cli/{csv-7DA4APB6.mjs → csv-IICJHJZ4.mjs} +3 -3
  61. package/dist/cli/{db-ICG3FUVE.js → db-TM5NZF73.js} +226 -149
  62. package/dist/cli/{db-7UPW3N5U.mjs → db-X4B7YFNY.mjs} +214 -137
  63. package/dist/cli/{describe-VDRY2JCE.js → describe-BDBARWZJ.js} +28 -27
  64. package/dist/cli/{describe-ZAPGM5ND.mjs → describe-GMVS3LFC.mjs} +12 -11
  65. package/dist/cli/{executions-TK3C2FAQ.mjs → executions-447ZJMN4.mjs} +4 -4
  66. package/dist/cli/{executions-D5GYCY3A.js → executions-QX25UOQM.js} +6 -6
  67. package/dist/cli/{feedback-PZAZZUXF.js → feedback-4IXUTBX7.js} +6 -6
  68. package/dist/cli/{feedback-T4EIP5QR.mjs → feedback-JB7HHIC6.mjs} +3 -3
  69. package/dist/cli/git-C7C7DTEH.js +23 -0
  70. package/dist/cli/{git-WBFWIVO5.mjs → git-VID6KGAA.mjs} +4 -4
  71. package/dist/cli/index.js +105 -87
  72. package/dist/cli/index.mjs +65 -47
  73. package/dist/cli/{legacy-noops-LRBJWXRK.js → legacy-noops-3FYTCOZO.js} +7 -7
  74. package/dist/cli/{legacy-noops-DUCK7OKN.mjs → legacy-noops-SGR3G5WS.mjs} +4 -4
  75. package/dist/cli/{monitors-WYH5AQIO.mjs → monitors-SH4FOMBM.mjs} +4 -4
  76. package/dist/cli/{monitors-7S2SL62G.js → monitors-SP52UHS4.js} +85 -85
  77. package/dist/cli/{org-XCSMLTUW.mjs → org-B32MMIQT.mjs} +4 -4
  78. package/dist/cli/{org-EQNGGHPV.js → org-UQMX7JOR.js} +60 -60
  79. package/dist/cli/play-UCIWBN7U.js +153 -0
  80. package/dist/cli/{play-A5ISFBJM.mjs → play-XTE4LUP7.mjs} +11 -10
  81. package/dist/cli/{providers-DR2CLD3N.js → providers-JNMJJ2OH.js} +7 -7
  82. package/dist/cli/{providers-KHTZFQ5I.mjs → providers-RWLN6FUR.mjs} +4 -4
  83. package/dist/cli/{quickstart-NIRWI6YU.js → quickstart-HK6WZ342.js} +5 -5
  84. package/dist/cli/{quickstart-KT4LKORA.mjs → quickstart-IDB3Y375.mjs} +3 -3
  85. package/dist/cli/{search-WCEXPBAT.mjs → search-6D3IFNPT.mjs} +5 -5
  86. package/dist/cli/search-LUZ2S7DH.js +26 -0
  87. package/dist/cli/{secrets-QSFEZGVE.js → secrets-JOQB57IE.js} +13 -13
  88. package/dist/cli/{secrets-TN7DW3QR.mjs → secrets-TZ53CQ3D.mjs} +4 -4
  89. package/dist/cli/{sessions-WSE5FN4H.mjs → sessions-4MBDC4EK.mjs} +4 -4
  90. package/dist/cli/{sessions-LJS6W67T.js → sessions-QSAICDXX.js} +5 -5
  91. package/dist/cli/{settings-FGS3VYJN.js → settings-OTOCW7L7.js} +74 -74
  92. package/dist/cli/{settings-Z3V53A6J.mjs → settings-RKQFMLDU.mjs} +7 -7
  93. package/dist/cli/{setup-GMH4VJS3.mjs → setup-2S5TNTUB.mjs} +6 -6
  94. package/dist/cli/{setup-ZA234HEY.js → setup-AKZUDVYY.js} +41 -41
  95. package/dist/cli/skills-26LASHZF.js +28 -0
  96. package/dist/cli/{skills-7G2RZMYH.mjs → skills-AGZXDLSA.mjs} +4 -4
  97. package/dist/cli/{tools-7EE4BGXO.mjs → tools-7Y6RD6FY.mjs} +8 -7
  98. package/dist/cli/tools-L5VIJQWX.js +39 -0
  99. package/dist/cli/{update-O5QEWS7K.mjs → update-M7YGF67I.mjs} +6 -6
  100. package/dist/cli/update-MNHF6M2F.js +28 -0
  101. package/dist/cli/{workflow-KE54RUTR.mjs → workflow-CTVE7S7W.mjs} +5 -5
  102. package/dist/cli/{workflow-M5PAAW3O.js → workflow-NGMY425T.js} +15 -15
  103. package/dist/{client-BV68GMPo.d.ts → client-DHq8dJ56.d.ts} +45 -11
  104. package/dist/{client-D9ACjiRC.d.mts → client-wiWPZhnI.d.mts} +45 -11
  105. package/dist/{compiler-manifest-BXcZ4P4W.d.mts → compiler-manifest-9TkZ_ykI.d.mts} +717 -711
  106. package/dist/{compiler-manifest-BXcZ4P4W.d.ts → compiler-manifest-9TkZ_ykI.d.ts} +717 -711
  107. package/dist/index-B-5_Xhud.d.mts +75 -0
  108. package/dist/index-ykksoEyR.d.ts +75 -0
  109. package/dist/index.d.mts +52 -13
  110. package/dist/index.d.ts +52 -13
  111. package/dist/index.js +92 -28
  112. package/dist/index.mjs +91 -27
  113. package/dist/install-integrity.json +91 -84
  114. package/dist/plays/bundle-play-file.d.mts +7 -75
  115. package/dist/plays/bundle-play-file.d.ts +7 -75
  116. package/dist/plays/bundle-play-file.mjs +1 -1
  117. package/dist/plays/run-request.d.mts +2 -2
  118. package/dist/plays/run-request.d.ts +2 -2
  119. package/dist/release.d.mts +1 -1
  120. package/dist/release.d.ts +1 -1
  121. package/dist/release.js +2 -2
  122. package/dist/release.mjs +1 -1
  123. package/package.json +1 -1
  124. package/dist/cli/auth-LKSTC3YV.js +0 -31
  125. package/dist/cli/chunk-OWJZUE3Y.mjs +0 -103
  126. package/dist/cli/chunk-SDK3ZA2C.js +0 -103
  127. package/dist/cli/client-WMSTRUGP.js +0 -20
  128. package/dist/cli/git-73N6EUZ3.js +0 -23
  129. package/dist/cli/play-CLC2Z5SO.js +0 -152
  130. package/dist/cli/search-DM7IQS5F.js +0 -26
  131. package/dist/cli/skills-6APAQV6W.js +0 -28
  132. package/dist/cli/tools-EPYUFWPB.js +0 -38
  133. package/dist/cli/update-FPVX3XJC.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.324',
203
+ version: '0.3.326',
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 ||
@@ -124,6 +124,12 @@ export interface CustomerDbColumn {
124
124
  * query and selected customer tables.
125
125
  */
126
126
  export interface CustomerDbQueryResult {
127
+ /** Present for explicitly keyed SQL; recovery keeps the original completion time. */
128
+ operation?: {
129
+ operation_key: string;
130
+ completed_at_ms: number;
131
+ source: 'executed' | 'operation_recovery';
132
+ };
127
133
  /** This query reads the current mutable customer database, not one run snapshot. */
128
134
  scope?: { kind: 'database'; mutability: 'current' };
129
135
  /** Database command executed by the query endpoint. */
@@ -241,6 +241,7 @@ type RuntimeApiRequest =
241
241
  }
242
242
  | {
243
243
  action: 'launch_play_async';
244
+ resolveImportedArtifact?: boolean;
244
245
  key: string;
245
246
  invocationKey: string;
246
247
  playRef: string;
@@ -2725,6 +2726,7 @@ export async function recordFirstClaimLatencyViaAppRuntime(
2725
2726
  export async function launchPlayAsyncViaAppRuntime(
2726
2727
  context: WorkerRuntimeApiContext,
2727
2728
  input: {
2729
+ resolveImportedArtifact?: boolean;
2728
2730
  key: string;
2729
2731
  invocationKey: string;
2730
2732
  playRef: string;
@@ -2139,6 +2139,11 @@ async function run(
2139
2139
  const runtimeInput = config.input ?? {};
2140
2140
  const runtimeInputObject: Record<string, unknown> =
2141
2141
  playRunInputObjectView(runtimeInput);
2142
+ const importedArtifactOptions = (playRef: string) =>
2143
+ config.artifact.importedPlayArtifacts &&
2144
+ Object.hasOwn(config.artifact.importedPlayArtifacts, playRef)
2145
+ ? { resolveImportedArtifact: true as const }
2146
+ : {};
2142
2147
  const resolveChildPlay =
2143
2148
  createRunScopedChildPlayResolver<ResolvedPlayExecution>({
2144
2149
  resolvePlay: async (playRef) => {
@@ -2157,6 +2162,7 @@ async function run(
2157
2162
  userEmail: config.context.userEmail,
2158
2163
  },
2159
2164
  playRef,
2165
+ importedArtifactOptions(playRef),
2160
2166
  );
2161
2167
  if (resolved?.resolutionDiagnostics) {
2162
2168
  emitWorkerLog(
@@ -2284,7 +2290,7 @@ async function run(
2284
2290
  ...appRuntimeApiContext,
2285
2291
  requestTimeoutMs: RUNNER_RUNTIME_CONTROL_REQUEST_TIMEOUT_MS,
2286
2292
  },
2287
- request,
2293
+ { ...request, ...importedArtifactOptions(request.playRef) },
2288
2294
  ),
2289
2295
  onBatchComplete: (checkpoint) => {
2290
2296
  emitRunnerEvent(
@@ -275,6 +275,7 @@ export type RuntimeReceiptFailure = RuntimeReceiptLease & {
275
275
  export type RuntimePlayResolutionAction = {
276
276
  action: 'resolve_play';
277
277
  playRef: string;
278
+ resolveImportedArtifact?: boolean;
278
279
  };
279
280
 
280
281
  export type RuntimeResultsAction = {
@@ -540,6 +540,7 @@ type RuntimeApiActionRequest =
540
540
  | {
541
541
  action: 'resolve_play';
542
542
  playRef: string;
543
+ resolveImportedArtifact?: boolean;
543
544
  acceptRetainedPipelineGraph?: boolean;
544
545
  }
545
546
  | {
@@ -3675,6 +3676,7 @@ async function writeRuntimeRowsWithProvisioningRetry(
3675
3676
  export async function resolveRuntimeReferencedPlay(
3676
3677
  context: RuntimeApiContext,
3677
3678
  playRef: string,
3679
+ options?: { resolveImportedArtifact?: boolean },
3678
3680
  ): Promise<ResolvedRuntimePlay | null> {
3679
3681
  const wire = await postRuntimeApi<{
3680
3682
  play: ResolvedRuntimePlay | null;
@@ -3682,6 +3684,9 @@ export async function resolveRuntimeReferencedPlay(
3682
3684
  }>(context, {
3683
3685
  action: 'resolve_play',
3684
3686
  playRef,
3687
+ ...(options?.resolveImportedArtifact === true
3688
+ ? { resolveImportedArtifact: true }
3689
+ : {}),
3685
3690
  acceptRetainedPipelineGraph: true,
3686
3691
  });
3687
3692
  const response = {
@@ -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)) {
@@ -1038,7 +1104,11 @@ function buildTargets(
1038
1104
  targets[target] = emailStatusTarget;
1039
1105
  continue;
1040
1106
  }
1041
- const fromExtractor = findFirstTargetByPath(result, descriptor.paths);
1107
+ const fromExtractor = findFirstTargetByPath(
1108
+ result,
1109
+ descriptor.paths,
1110
+ target,
1111
+ );
1042
1112
  if (!fromExtractor) {
1043
1113
  // A declared null is an explicit provider answer, not permission to
1044
1114
  // guess from a similarly named sibling such as `emailDomain`.
@@ -1065,7 +1135,11 @@ function buildTargets(
1065
1135
  target,
1066
1136
  targetGetters?.[target] ?? declaredTargetPaths.get(target) ?? [],
1067
1137
  );
1068
- const fromMetadata = findFirstTargetByPath(result, targetGetters?.[target]);
1138
+ const fromMetadata = findFirstTargetByPath(
1139
+ result,
1140
+ targetGetters?.[target],
1141
+ target,
1142
+ );
1069
1143
  if (fromMetadata) {
1070
1144
  targets[target] = fromMetadata;
1071
1145
  continue;
@@ -62,6 +62,15 @@ export type PlayBundleArtifact = {
62
62
  sourceMap: string;
63
63
  importPolicy: PlayImportPolicy;
64
64
  compatibility: PlayArtifactCompatibility;
65
+ /** Immutable imported execution closure; absent artifacts retain named live resolution. */
66
+ importedPlayArtifacts?: Record<
67
+ string,
68
+ {
69
+ artifactStorageKey: string;
70
+ artifactHash: string;
71
+ graphHash: string;
72
+ }
73
+ >;
65
74
  generatedAt: number;
66
75
  cacheHit: boolean;
67
76
  };
@@ -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 _chunkMKHSZA2Xjs = require('./chunk-MKHSZA2X.js');
13
+ require('./chunk-CUUHQ3AO.js');
14
+ require('./chunk-TXVOB5J2.js');
15
+ require('./chunk-XNYIZMNQ.js');
16
+ require('./chunk-BUYZEUY4.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 = _chunkMKHSZA2Xjs.EXIT_WORKSPACE_MISMATCH; exports.clearPendingClaim = _chunkMKHSZA2Xjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkMKHSZA2Xjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkMKHSZA2Xjs.handleRegister; exports.handleStatus = _chunkMKHSZA2Xjs.handleStatus; exports.handleWait = _chunkMKHSZA2Xjs.handleWait; exports.readPendingAuthClaim = _chunkMKHSZA2Xjs.readPendingAuthClaim; exports.registerAuthCommands = _chunkMKHSZA2Xjs.registerAuthCommands; exports.reportSetupCompleted = _chunkMKHSZA2Xjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkMKHSZA2Xjs.resolvePendingAuthClaimForResume;
@@ -9,11 +9,11 @@ import {
9
9
  registerAuthCommands,
10
10
  reportSetupCompleted,
11
11
  resolvePendingAuthClaimForResume
12
- } from "./chunk-5QZFWY7C.mjs";
13
- import "./chunk-I7RLL7LN.mjs";
14
- import "./chunk-TJGJTB5T.mjs";
12
+ } from "./chunk-ZRN6YOF2.mjs";
13
+ import "./chunk-M7CPVMDB.mjs";
14
+ import "./chunk-BR7GGTAE.mjs";
15
15
  import "./chunk-DLIRSHV6.mjs";
16
- import "./chunk-HHZDWBSQ.mjs";
16
+ import "./chunk-BQJVMKWL.mjs";
17
17
  import "./chunk-NXGCO4JB.mjs";
18
18
  import "./chunk-WZYKRD7T.mjs";
19
19
  import "./chunk-KRD6H754.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DeeplineClient,
3
3
  iterateCursorPages
4
- } from "./chunk-3ZKAKQYC.mjs";
4
+ } from "./chunk-KLWBAQ5A.mjs";
5
5
  import "./chunk-CBVIJSHF.mjs";
6
6
  import {
7
7
  createTimestampedName,
@@ -9,13 +9,13 @@ import {
9
9
  openInBrowser,
10
10
  printCommandEnvelope,
11
11
  shouldEmitJson
12
- } from "./chunk-I7RLL7LN.mjs";
12
+ } from "./chunk-M7CPVMDB.mjs";
13
13
  import {
14
14
  AuthError,
15
15
  ConfigError
16
- } from "./chunk-TJGJTB5T.mjs";
16
+ } from "./chunk-BR7GGTAE.mjs";
17
17
  import "./chunk-DLIRSHV6.mjs";
18
- import "./chunk-HHZDWBSQ.mjs";
18
+ import "./chunk-BQJVMKWL.mjs";
19
19
  import "./chunk-6IKARAYD.mjs";
20
20
  import {
21
21
  DeeplineError