deepline 0.2.13 → 0.2.15

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 (36) hide show
  1. package/dist/bundling-sources/sdk/src/index.ts +3 -0
  2. package/dist/bundling-sources/sdk/src/play.ts +150 -691
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +7 -1
  5. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +249 -51
  6. package/dist/bundling-sources/shared_libs/play-runtime/csv-rename.ts +10 -6
  7. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +32 -51
  8. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +11 -22
  9. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-policy.ts +34 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +2 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +95 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +11 -6
  13. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +38 -9
  14. package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +23 -15
  15. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +3 -0
  16. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +2222 -0
  17. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +3 -2
  18. package/dist/bundling-sources/shared_libs/plays/compiler-manifest.ts +2 -0
  19. package/dist/bundling-sources/shared_libs/plays/contracts.ts +16 -0
  20. package/dist/bundling-sources/shared_libs/plays/input-contract-definition.ts +28 -0
  21. package/dist/bundling-sources/shared_libs/plays/input-contract.ts +3 -3
  22. package/dist/cli/index.js +5074 -829
  23. package/dist/cli/index.mjs +5019 -759
  24. package/dist/compiler-manifest-xFkbJX2B.d.mts +2517 -0
  25. package/dist/compiler-manifest-xFkbJX2B.d.ts +2517 -0
  26. package/dist/index.d.mts +36 -1011
  27. package/dist/index.d.ts +36 -1011
  28. package/dist/index.js +25 -7
  29. package/dist/index.mjs +25 -7
  30. package/dist/plays/bundle-play-file.d.mts +5 -8
  31. package/dist/plays/bundle-play-file.d.ts +5 -8
  32. package/dist/plays/bundle-play-file.mjs +3844 -3
  33. package/package.json +1 -1
  34. package/dist/bundling-sources/shared_libs/plays/source-metadata.ts +0 -240
  35. package/dist/tool-execution-error-4-rhemLQ.d.mts +0 -446
  36. package/dist/tool-execution-error-4-rhemLQ.d.ts +0 -446
@@ -32,10 +32,11 @@ import type { ToolExecutionErrorSchemaVersion } from '../../tool-execution-error
32
32
  import type { PlaySandboxRuntimeDeclaration } from '../../play-runtime/sandbox-runtime-limits';
33
33
  import { validatePlaySourceFilesHaveNoInlineSecrets } from '../secret-guardrails';
34
34
  import { MAX_PLAY_BUNDLE_BYTES } from './limits';
35
+ import { PLAY_AUTHORING_CONTRACT_EDITION } from '../authoring-contract';
35
36
 
36
37
  // The authored tool-error schema is part of the artifact bytes. Do not reuse a
37
38
  // local bundle cached before compatibility selection entered graph analysis.
38
- const PLAY_BUNDLE_CACHE_VERSION = 27;
39
+ const PLAY_BUNDLE_CACHE_VERSION = 28;
39
40
  const PLAY_ARTIFACT_CACHE_DIR = join(
40
41
  tmpdir(),
41
42
  `deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`,
@@ -1833,7 +1834,7 @@ export async function bundlePlayFile(
1833
1834
  exportName,
1834
1835
  );
1835
1836
  analysis.graphHash = sha256(
1836
- `${analysis.graphHash}\nentry-export:${exportName}`,
1837
+ `${analysis.graphHash}\nentry-export:${exportName}\nauthoring-contract-edition:${PLAY_AUTHORING_CONTRACT_EDITION}`,
1837
1838
  );
1838
1839
  try {
1839
1840
  validatePlaySourceFilesHaveNoInlineSecrets(analysis.sourceFiles);
@@ -1,5 +1,6 @@
1
1
  import type { PlayArtifactKind } from '../play-runtime/backend';
2
2
  import type { PlayStaticPipeline } from './static-pipeline';
3
+ import type { AdmittedPlayAuthoringContract } from './authoring-contract';
3
4
 
4
5
  export const PLAY_COMPILER_MANIFEST_VERSION = 1;
5
6
 
@@ -22,6 +23,7 @@ export type PlayCompilerManifest = {
22
23
  artifactKind?: PlayArtifactKind;
23
24
  staticPipeline: PlayStaticPipeline;
24
25
  importedPlayDependencies: PlayCompilerDependencyManifest[];
26
+ authoringContract?: AdmittedPlayAuthoringContract;
25
27
  };
26
28
 
27
29
  export type PlayRuntimeManifest = {
@@ -5,6 +5,12 @@ import {
5
5
  type ToolExecutionErrorSchemaVersion,
6
6
  } from '../tool-execution-error';
7
7
  import { CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION } from './artifact-contract-version';
8
+ import {
9
+ PLAY_AUTHORING_CONTRACT_EDITION,
10
+ normalizePlayAuthoringContractEdition,
11
+ type PlayAuthoringContractEdition,
12
+ type AdmittedPlayAuthoringContract,
13
+ } from './authoring-contract';
8
14
 
9
15
  export type PlayContractSource = 'ad_hoc' | 'draft' | 'published';
10
16
 
@@ -32,11 +38,14 @@ export type PlayContractCompatibilitySnapshot = {
32
38
  runtimeBackend?: string | null;
33
39
  /** Missing preserves the legacy contract used by artifacts stored before this field existed. */
34
40
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
41
+ /** Missing preserves edition 1 for artifacts stored before authoring contracts were pinned. */
42
+ authoringContractEdition?: PlayAuthoringContractEdition;
35
43
  };
36
44
 
37
45
  export type NormalizedPlayContractCompatibilitySnapshot =
38
46
  PlayContractCompatibilitySnapshot & {
39
47
  toolErrorSchemaVersion: ToolExecutionErrorSchemaVersion;
48
+ authoringContractEdition: PlayAuthoringContractEdition;
40
49
  };
41
50
 
42
51
  export class UnsupportedPlayToolErrorSchemaVersionError extends Error {
@@ -86,12 +95,16 @@ export function normalizePlayContractCompatibility(
86
95
  ...compatibility,
87
96
  toolErrorSchemaVersion:
88
97
  toolErrorSchemaVersion as ToolExecutionErrorSchemaVersion,
98
+ authoringContractEdition: normalizePlayAuthoringContractEdition(
99
+ compatibility.authoringContractEdition,
100
+ ),
89
101
  };
90
102
  }
91
103
 
92
104
  export function buildPlayContractCompatibility(input?: {
93
105
  runtimeBackend?: string | null;
94
106
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
107
+ authoringContractEdition?: PlayAuthoringContractEdition;
95
108
  }): PlayContractCompatibilitySnapshot {
96
109
  return {
97
110
  apiVersion: PLAY_PUBLIC_API_VERSION,
@@ -101,6 +114,8 @@ export function buildPlayContractCompatibility(input?: {
101
114
  runtimeBackend: input?.runtimeBackend ?? null,
102
115
  toolErrorSchemaVersion:
103
116
  input?.toolErrorSchemaVersion ?? TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
117
+ authoringContractEdition:
118
+ input?.authoringContractEdition ?? PLAY_AUTHORING_CONTRACT_EDITION,
104
119
  };
105
120
  }
106
121
 
@@ -122,4 +137,5 @@ export type PlayRunContractSnapshot = {
122
137
  codeFormat?: 'function' | 'cjs_module' | 'esm_module' | null;
123
138
  sourceCode?: string | null;
124
139
  compatibility?: PlayContractCompatibilitySnapshot | null;
140
+ authoringContract?: AdmittedPlayAuthoringContract | null;
125
141
  };
@@ -0,0 +1,28 @@
1
+ import type { PlayAuthoringInputContract } from './authoring-contract';
2
+
3
+ function freezeInputSchema(
4
+ schema: Record<string, unknown>,
5
+ ): Record<string, unknown> {
6
+ const visited = new WeakSet<object>();
7
+ const freeze = (value: unknown): void => {
8
+ if (value === null || typeof value !== 'object' || visited.has(value)) {
9
+ return;
10
+ }
11
+ visited.add(value);
12
+ for (const child of Object.values(value)) freeze(child);
13
+ Object.freeze(value);
14
+ };
15
+ freeze(schema);
16
+ return schema;
17
+ }
18
+
19
+ export function createPlayInputContract<TInput>(
20
+ schema: Record<string, unknown>,
21
+ ): PlayAuthoringInputContract<TInput> {
22
+ if (!schema || typeof schema !== 'object' || Array.isArray(schema)) {
23
+ throw new Error(
24
+ 'defineInput<T>(schema) requires a JSON-schema-like object.',
25
+ );
26
+ }
27
+ return Object.freeze({ schema: freezeInputSchema(schema) });
28
+ }
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  export type PlayInputKind = 'csv' | 'typed' | 'none';
10
10
 
11
- export type PlayInputContract = {
11
+ export type PlayEntryInputContract = {
12
12
  callInputFields: string[];
13
13
  csvHeaderFields: string[];
14
14
  rowKeyFields: string[];
@@ -17,7 +17,7 @@ export type PlayInputContract = {
17
17
  summary: string;
18
18
  };
19
19
 
20
- export type PlayEntryContract = PlayInputContract & {
20
+ export type PlayEntryContract = PlayEntryInputContract & {
21
21
  outputFields: string[];
22
22
  outputDatasetFields?: ReadonlySet<string>;
23
23
  };
@@ -26,7 +26,7 @@ export function buildPlayInputContract(input: {
26
26
  pipeline: PlayStaticPipeline;
27
27
  displaySubsteps?: readonly PlayStaticSubstep[];
28
28
  inputFields?: readonly string[];
29
- }): PlayInputContract {
29
+ }): PlayEntryInputContract {
30
30
  const displaySubsteps =
31
31
  input.displaySubsteps ?? getTopLevelPipelineSubsteps(input.pipeline);
32
32
  const datasetInputs = collectDatasetInputDetails(displaySubsteps);