deepline 0.3.35 → 0.3.36

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.
@@ -199,7 +199,7 @@ export const SDK_RELEASE = {
199
199
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
- version: '0.3.35',
202
+ version: '0.3.36',
203
203
  updateSummary:
204
204
  'Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.',
205
205
  packageCapabilities: {
@@ -16,6 +16,12 @@ export type ResolveStaticPipelineInput = {
16
16
  playId: string,
17
17
  ) => Promise<ResolvablePlayStaticShape | null>;
18
18
  maxDepth?: number;
19
+ /**
20
+ * Keep an embedded local-import contract when one is present, while still
21
+ * resolving compact calls nested inside it. Named live calls omit the
22
+ * embedded pipeline and continue through the registry resolver.
23
+ */
24
+ preferEmbeddedPlayCalls?: boolean;
19
25
  };
20
26
 
21
27
  function clonePipeline(pipeline: PlayStaticPipeline): PlayStaticPipeline {
@@ -69,8 +75,17 @@ async function resolvePipelineSubsteps(input: {
69
75
  ) => Promise<ResolvablePlayStaticShape | null>;
70
76
  stack: string[];
71
77
  maxDepth: number;
78
+ preferEmbeddedPlayCalls: boolean;
79
+ resolvedPipelineCache: Map<string, Promise<PlayStaticPipeline | null>>;
72
80
  }): Promise<PlayStaticSubstep[]> {
73
- const { steps, resolveReferencedPlay, stack, maxDepth } = input;
81
+ const {
82
+ steps,
83
+ resolveReferencedPlay,
84
+ stack,
85
+ maxDepth,
86
+ preferEmbeddedPlayCalls,
87
+ resolvedPipelineCache,
88
+ } = input;
74
89
  const callDepth = Math.max(0, stack.length - 1);
75
90
 
76
91
  return await Promise.all(
@@ -81,20 +96,44 @@ async function resolvePipelineSubsteps(input: {
81
96
  });
82
97
 
83
98
  if (
84
- (annotated.type === 'dataset' ||
85
- annotated.type === 'step_suite' ||
86
- annotated.type === 'control_flow') &&
87
- annotated.steps?.length
99
+ annotated.type === 'dataset' ||
100
+ annotated.type === 'step_suite' ||
101
+ annotated.type === 'control_flow'
88
102
  ) {
89
- return {
103
+ const nested = {
90
104
  ...annotated,
91
- steps: await resolvePipelineSubsteps({
92
- steps: annotated.steps,
93
- resolveReferencedPlay,
94
- stack,
95
- maxDepth,
96
- }),
97
- } satisfies PlayStaticSubstep;
105
+ ...(annotated.steps?.length
106
+ ? {
107
+ steps: await resolvePipelineSubsteps({
108
+ steps: annotated.steps,
109
+ resolveReferencedPlay,
110
+ stack,
111
+ maxDepth,
112
+ preferEmbeddedPlayCalls,
113
+ resolvedPipelineCache,
114
+ }),
115
+ }
116
+ : {}),
117
+ };
118
+ if (nested.type === 'control_flow' && nested.branches?.length) {
119
+ return {
120
+ ...nested,
121
+ branches: await Promise.all(
122
+ nested.branches.map(async (branch) => ({
123
+ ...branch,
124
+ steps: await resolvePipelineSubsteps({
125
+ steps: branch.steps,
126
+ resolveReferencedPlay,
127
+ stack,
128
+ maxDepth,
129
+ preferEmbeddedPlayCalls,
130
+ resolvedPipelineCache,
131
+ }),
132
+ })),
133
+ ),
134
+ } satisfies PlayStaticSubstep;
135
+ }
136
+ return nested satisfies PlayStaticSubstep;
98
137
  }
99
138
 
100
139
  if (annotated.type !== 'play_call') {
@@ -118,9 +157,51 @@ async function resolvePipelineSubsteps(input: {
118
157
  } satisfies PlayStaticSubstep;
119
158
  }
120
159
 
121
- const childShape = await resolveReferencedPlay(annotated.playId);
122
- const childPipeline = materializePipeline(childShape);
123
- if (!childPipeline) {
160
+ const cacheKey = JSON.stringify([...stack, annotated.playId]);
161
+ let resolvedChildPipelinePromise = resolvedPipelineCache.get(cacheKey);
162
+ if (!resolvedChildPipelinePromise) {
163
+ resolvedChildPipelinePromise = (async () => {
164
+ const childShape =
165
+ preferEmbeddedPlayCalls && annotated.pipeline
166
+ ? { staticPipeline: annotated.pipeline }
167
+ : await resolveReferencedPlay(annotated.playId);
168
+ const childPipeline = materializePipeline(childShape);
169
+ if (!childPipeline) {
170
+ return null;
171
+ }
172
+
173
+ const resolvedChildPipeline = {
174
+ ...childPipeline,
175
+ stages: await resolvePipelineSubsteps({
176
+ steps: childPipeline.stages ?? [],
177
+ resolveReferencedPlay,
178
+ stack: [...stack, annotated.playId],
179
+ maxDepth,
180
+ preferEmbeddedPlayCalls,
181
+ resolvedPipelineCache,
182
+ }),
183
+ substeps: await resolvePipelineSubsteps({
184
+ steps: childPipeline.substeps,
185
+ resolveReferencedPlay,
186
+ stack: [...stack, annotated.playId],
187
+ maxDepth,
188
+ preferEmbeddedPlayCalls,
189
+ resolvedPipelineCache,
190
+ }),
191
+ };
192
+ const childContract = compileSheetContract(resolvedChildPipeline);
193
+
194
+ return {
195
+ ...resolvedChildPipeline,
196
+ sheetContract: childContract.contract,
197
+ sheetContractErrors: childContract.errors,
198
+ };
199
+ })();
200
+ resolvedPipelineCache.set(cacheKey, resolvedChildPipelinePromise);
201
+ }
202
+
203
+ const resolvedChildPipeline = await resolvedChildPipelinePromise;
204
+ if (!resolvedChildPipeline) {
124
205
  return {
125
206
  ...annotated,
126
207
  resolutionError: `Unable to statically resolve play "${annotated.playId}"`,
@@ -128,30 +209,9 @@ async function resolvePipelineSubsteps(input: {
128
209
  } satisfies PlayStaticSubstep;
129
210
  }
130
211
 
131
- const resolvedChildPipeline = {
132
- ...childPipeline,
133
- stages: await resolvePipelineSubsteps({
134
- steps: childPipeline.stages ?? [],
135
- resolveReferencedPlay,
136
- stack: [...stack, annotated.playId],
137
- maxDepth,
138
- }),
139
- substeps: await resolvePipelineSubsteps({
140
- steps: childPipeline.substeps,
141
- resolveReferencedPlay,
142
- stack: [...stack, annotated.playId],
143
- maxDepth,
144
- }),
145
- };
146
- const childContract = compileSheetContract(resolvedChildPipeline);
147
-
148
212
  return {
149
213
  ...annotated,
150
- pipeline: {
151
- ...resolvedChildPipeline,
152
- sheetContract: childContract.contract,
153
- sheetContractErrors: childContract.errors,
154
- },
214
+ pipeline: resolvedChildPipeline,
155
215
  } satisfies PlayStaticSubstep;
156
216
  }),
157
217
  );
@@ -161,10 +221,15 @@ export async function resolveStaticPipelineTree(
161
221
  input: ResolveStaticPipelineInput,
162
222
  ): Promise<PlayStaticPipeline | null> {
163
223
  const maxDepth = input.maxDepth ?? 6;
224
+ const preferEmbeddedPlayCalls = input.preferEmbeddedPlayCalls ?? false;
164
225
  const rootPipeline = materializePipeline(input.root);
165
226
  if (!rootPipeline) {
166
227
  return null;
167
228
  }
229
+ const resolvedPipelineCache = new Map<
230
+ string,
231
+ Promise<PlayStaticPipeline | null>
232
+ >();
168
233
 
169
234
  const resolvedPipeline = {
170
235
  ...rootPipeline,
@@ -173,12 +238,16 @@ export async function resolveStaticPipelineTree(
173
238
  resolveReferencedPlay: input.resolveReferencedPlay,
174
239
  stack: [input.rootPlayId],
175
240
  maxDepth,
241
+ preferEmbeddedPlayCalls,
242
+ resolvedPipelineCache,
176
243
  }),
177
244
  substeps: await resolvePipelineSubsteps({
178
245
  steps: rootPipeline.substeps,
179
246
  resolveReferencedPlay: input.resolveReferencedPlay,
180
247
  stack: [input.rootPlayId],
181
248
  maxDepth,
249
+ preferEmbeddedPlayCalls,
250
+ resolvedPipelineCache,
182
251
  }),
183
252
  };
184
253
  const contract = compileSheetContract(resolvedPipeline);
@@ -609,6 +609,13 @@ export function truncateStaticPipelineForRuntimeContract(
609
609
  */
610
610
  export function createStaticPipelineReferenceProjection(
611
611
  pipeline: PlayStaticPipeline | null | undefined,
612
+ options?: {
613
+ /**
614
+ * Local imported Plays do not have an independently published registry
615
+ * contract. Keep those embedded while compacting live named Play calls.
616
+ */
617
+ preserveEmbeddedPlayIds?: ReadonlySet<string>;
618
+ },
612
619
  ): PlayStaticPipeline | null | undefined {
613
620
  const stored = truncateStaticPipelineForStorage(pipeline, {
614
621
  maxEmbeddedPlayCallPipelineDepth: Number.POSITIVE_INFINITY,
@@ -629,6 +636,13 @@ export function createStaticPipelineReferenceProjection(
629
636
  }>;
630
637
  };
631
638
  if (projected.type === 'play_call') {
639
+ if (
640
+ projected.pipeline &&
641
+ options?.preserveEmbeddedPlayIds?.has(projected.playId)
642
+ ) {
643
+ projected.pipeline = projectPipeline(projected.pipeline);
644
+ return projected;
645
+ }
632
646
  delete projected.pipeline;
633
647
  if (
634
648
  projected.resolutionError?.startsWith(
@@ -656,11 +670,15 @@ export function createStaticPipelineReferenceProjection(
656
670
  return projected;
657
671
  });
658
672
 
659
- return {
660
- ...stored,
661
- stages: projectSteps(stored.stages),
662
- substeps: projectSteps(stored.substeps),
663
- };
673
+ const projectPipeline = (
674
+ candidate: PlayStaticPipeline,
675
+ ): PlayStaticPipeline => ({
676
+ ...candidate,
677
+ stages: projectSteps(candidate.stages),
678
+ substeps: projectSteps(candidate.substeps),
679
+ });
680
+
681
+ return projectPipeline(stored);
664
682
  }
665
683
 
666
684
  function asStaticRecord(value: unknown): Record<string, unknown> | null {
package/dist/cli/index.js CHANGED
@@ -1043,7 +1043,7 @@ var SDK_RELEASE = {
1043
1043
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
1044
1044
  // getters keep their established compatibility behavior.
1045
1045
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1046
- version: "0.3.35",
1046
+ version: "0.3.36",
1047
1047
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
1048
1048
  packageCapabilities: {
1049
1049
  updatePreferences: 1
@@ -1029,7 +1029,7 @@ var SDK_RELEASE = {
1029
1029
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
1030
1030
  // getters keep their established compatibility behavior.
1031
1031
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
1032
- version: "0.3.35",
1032
+ version: "0.3.36",
1033
1033
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
1034
1034
  packageCapabilities: {
1035
1035
  updatePreferences: 1
package/dist/index.js CHANGED
@@ -779,7 +779,7 @@ var SDK_RELEASE = {
779
779
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
780
780
  // getters keep their established compatibility behavior.
781
781
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
782
- version: "0.3.35",
782
+ version: "0.3.36",
783
783
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
784
784
  packageCapabilities: {
785
785
  updatePreferences: 1
package/dist/index.mjs CHANGED
@@ -702,7 +702,7 @@ var SDK_RELEASE = {
702
702
  // available at toolResponse.rawV2 while toolResponse.raw and all declared
703
703
  // getters keep their established compatibility behavior.
704
704
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
705
- version: "0.3.35",
705
+ version: "0.3.36",
706
706
  updateSummary: "Automatic CLI updates are now enabled by default. To opt out, run `deepline settings autoupdate off`; use `deepline settings autoupdate on` to re-enable updates or `deepline settings autoupdate pin <version>` to hold an exact release. This release also adds raw-v2 tool responses at toolResponse.rawV2 while preserving existing toolResponse.raw and declared getters.",
707
707
  packageCapabilities: {
708
708
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.35",
3
+ "version": "0.3.36",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",