@elaraai/e3-types 1.0.28 → 1.0.29

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.
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Execution environment types for e3.
7
+ *
8
+ * An environment spec describes everything a worker needs to materialize the
9
+ * runtime environment a task or function executes in — beyond the stock
10
+ * runtime image. It is stored as a content-addressed object; tasks and
11
+ * functions reference it by hash (`environment` field), so identical
12
+ * environments dedupe and the environment hash transitively folds the user's
13
+ * implementation code (via lockfile + sdist/tarball hashes) into execution
14
+ * cache identity.
15
+ *
16
+ * All fields hold object-store hashes, never inline file contents: the blobs
17
+ * ride the existing content-addressed object store and transfer machinery.
18
+ */
19
+ import { ArrayType, StringType, StructType, ValueTypeOf, VariantType } from '@elaraai/east';
20
+ /**
21
+ * A Python (uv) project environment.
22
+ *
23
+ * Materialized by creating a venv from the locked dependency set
24
+ * (`uv sync --frozen`) and installing the project's own sdists into it.
25
+ *
26
+ * @remarks
27
+ * - `pyproject`: object hash of the project's `pyproject.toml` blob.
28
+ * - `lock`: object hash of the `uv.lock` blob — pins the full closure.
29
+ * - `sdists`: the project's own source distributions (`uv build --sdist`) —
30
+ * the user's platform-function implementation code — installed in order
31
+ * after the sync. Each entry carries the original filename because
32
+ * Python installers derive the package name from `name-version.tar.gz`
33
+ * and reject a renamed file.
34
+ */
35
+ export declare const PythonEnvironmentType: StructType<{
36
+ /** Object hash of the pyproject.toml blob */
37
+ readonly pyproject: StringType;
38
+ /** Object hash of the uv.lock blob */
39
+ readonly lock: StringType;
40
+ /** Project sdist blobs (original filename + object hash), in install order */
41
+ readonly sdists: ArrayType<StructType<{
42
+ readonly filename: StringType;
43
+ readonly hash: StringType;
44
+ }>>;
45
+ }>;
46
+ export type PythonEnvironmentType = typeof PythonEnvironmentType;
47
+ export type PythonEnvironment = ValueTypeOf<typeof PythonEnvironmentType>;
48
+ /**
49
+ * A Node (npm/pnpm) project environment.
50
+ *
51
+ * Materialized by installing the locked dependency set and then the
52
+ * project's own packed tarballs (`npm pack`).
53
+ *
54
+ * @remarks
55
+ * - `packageJson`: object hash of the project's `package.json` blob.
56
+ * - `lock`: object hash of the lockfile blob (`package-lock.json` or
57
+ * `pnpm-lock.yaml`).
58
+ * - `tarballs`: object hashes of `npm pack` tarballs of the project's own
59
+ * package(s), installed in order.
60
+ */
61
+ export declare const NodeEnvironmentType: StructType<{
62
+ /** Object hash of the package.json blob */
63
+ readonly packageJson: StringType;
64
+ /** Object hash of the lockfile blob */
65
+ readonly lock: StringType;
66
+ /** Object hashes of npm-pack tarball blobs, in install order */
67
+ readonly tarballs: ArrayType<StringType>;
68
+ }>;
69
+ export type NodeEnvironmentType = typeof NodeEnvironmentType;
70
+ export type NodeEnvironment = ValueTypeOf<typeof NodeEnvironmentType>;
71
+ /**
72
+ * A user-controlled container image environment.
73
+ *
74
+ * The catch-all tier for CUDA bases, system libraries, or custom native
75
+ * runtimes. Executed by running the task's argv inside the referenced image.
76
+ *
77
+ * @remarks
78
+ * `digest` must be a full immutable digest reference
79
+ * (`repo@sha256:<64 hex>`); mutable tags are rejected at definition time so
80
+ * the environment hash cannot silently drift.
81
+ */
82
+ export declare const ImageEnvironmentType: StructType<{
83
+ /** Full image digest reference: `repo@sha256:<64 hex chars>` */
84
+ readonly digest: StringType;
85
+ }>;
86
+ export type ImageEnvironmentType = typeof ImageEnvironmentType;
87
+ export type ImageEnvironment = ValueTypeOf<typeof ImageEnvironmentType>;
88
+ /**
89
+ * An execution environment specification.
90
+ *
91
+ * Stored beast2-encoded in the object store; the **environment hash** is the
92
+ * object hash of the encoded spec. A task/function with no environment
93
+ * (`none`) runs on the stock runtime image as today.
94
+ */
95
+ export declare const EnvironmentSpecType: VariantType<{
96
+ /** Python (uv) project environment */
97
+ readonly python: StructType<{
98
+ /** Object hash of the pyproject.toml blob */
99
+ readonly pyproject: StringType;
100
+ /** Object hash of the uv.lock blob */
101
+ readonly lock: StringType;
102
+ /** Project sdist blobs (original filename + object hash), in install order */
103
+ readonly sdists: ArrayType<StructType<{
104
+ readonly filename: StringType;
105
+ readonly hash: StringType;
106
+ }>>;
107
+ }>;
108
+ /** Node project environment */
109
+ readonly node: StructType<{
110
+ /** Object hash of the package.json blob */
111
+ readonly packageJson: StringType;
112
+ /** Object hash of the lockfile blob */
113
+ readonly lock: StringType;
114
+ /** Object hashes of npm-pack tarball blobs, in install order */
115
+ readonly tarballs: ArrayType<StringType>;
116
+ }>;
117
+ /** Custom container image environment */
118
+ readonly image: StructType<{
119
+ /** Full image digest reference: `repo@sha256:<64 hex chars>` */
120
+ readonly digest: StringType;
121
+ }>;
122
+ }>;
123
+ export type EnvironmentSpecType = typeof EnvironmentSpecType;
124
+ export type EnvironmentSpec = ValueTypeOf<typeof EnvironmentSpecType>;
125
+ /**
126
+ * Lists the object-store hashes an environment spec references.
127
+ *
128
+ * Every reachability walker (package export closure, GC) must include these
129
+ * so environment blobs transfer with the package and survive collection.
130
+ *
131
+ * @param spec - The environment spec to walk
132
+ * @returns The referenced blob hashes (empty for `image` environments)
133
+ */
134
+ export declare function environmentSpecObjectHashes(spec: EnvironmentSpec): string[];
135
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5F;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB;IAChC,6CAA6C;;IAE7C,sCAAsC;;IAEtC,8EAA8E;;;;;EAE9E,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC;AACjE,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,mBAAmB;IAC9B,2CAA2C;;IAE3C,uCAAuC;;IAEvC,gEAAgE;;EAEhE,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB;IAC/B,gEAAgE;;EAEhE,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC;AAC/D,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;IAC9B,sCAAsC;;QA5DtC,6CAA6C;;QAE7C,sCAAsC;;QAEtC,8EAA8E;;;;;;IA0D9E,+BAA+B;;QAtC/B,2CAA2C;;QAE3C,uCAAuC;;QAEvC,gEAAgE;;;IAoChE,yCAAyC;;QAlBzC,gEAAgE;;;EAoBhE,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC;AAC7D,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,EAAE,CAS3E"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Execution environment types for e3.
7
+ *
8
+ * An environment spec describes everything a worker needs to materialize the
9
+ * runtime environment a task or function executes in — beyond the stock
10
+ * runtime image. It is stored as a content-addressed object; tasks and
11
+ * functions reference it by hash (`environment` field), so identical
12
+ * environments dedupe and the environment hash transitively folds the user's
13
+ * implementation code (via lockfile + sdist/tarball hashes) into execution
14
+ * cache identity.
15
+ *
16
+ * All fields hold object-store hashes, never inline file contents: the blobs
17
+ * ride the existing content-addressed object store and transfer machinery.
18
+ */
19
+ import { ArrayType, StringType, StructType, VariantType } from '@elaraai/east';
20
+ /**
21
+ * A Python (uv) project environment.
22
+ *
23
+ * Materialized by creating a venv from the locked dependency set
24
+ * (`uv sync --frozen`) and installing the project's own sdists into it.
25
+ *
26
+ * @remarks
27
+ * - `pyproject`: object hash of the project's `pyproject.toml` blob.
28
+ * - `lock`: object hash of the `uv.lock` blob — pins the full closure.
29
+ * - `sdists`: the project's own source distributions (`uv build --sdist`) —
30
+ * the user's platform-function implementation code — installed in order
31
+ * after the sync. Each entry carries the original filename because
32
+ * Python installers derive the package name from `name-version.tar.gz`
33
+ * and reject a renamed file.
34
+ */
35
+ export const PythonEnvironmentType = StructType({
36
+ /** Object hash of the pyproject.toml blob */
37
+ pyproject: StringType,
38
+ /** Object hash of the uv.lock blob */
39
+ lock: StringType,
40
+ /** Project sdist blobs (original filename + object hash), in install order */
41
+ sdists: ArrayType(StructType({ filename: StringType, hash: StringType })),
42
+ });
43
+ /**
44
+ * A Node (npm/pnpm) project environment.
45
+ *
46
+ * Materialized by installing the locked dependency set and then the
47
+ * project's own packed tarballs (`npm pack`).
48
+ *
49
+ * @remarks
50
+ * - `packageJson`: object hash of the project's `package.json` blob.
51
+ * - `lock`: object hash of the lockfile blob (`package-lock.json` or
52
+ * `pnpm-lock.yaml`).
53
+ * - `tarballs`: object hashes of `npm pack` tarballs of the project's own
54
+ * package(s), installed in order.
55
+ */
56
+ export const NodeEnvironmentType = StructType({
57
+ /** Object hash of the package.json blob */
58
+ packageJson: StringType,
59
+ /** Object hash of the lockfile blob */
60
+ lock: StringType,
61
+ /** Object hashes of npm-pack tarball blobs, in install order */
62
+ tarballs: ArrayType(StringType),
63
+ });
64
+ /**
65
+ * A user-controlled container image environment.
66
+ *
67
+ * The catch-all tier for CUDA bases, system libraries, or custom native
68
+ * runtimes. Executed by running the task's argv inside the referenced image.
69
+ *
70
+ * @remarks
71
+ * `digest` must be a full immutable digest reference
72
+ * (`repo@sha256:<64 hex>`); mutable tags are rejected at definition time so
73
+ * the environment hash cannot silently drift.
74
+ */
75
+ export const ImageEnvironmentType = StructType({
76
+ /** Full image digest reference: `repo@sha256:<64 hex chars>` */
77
+ digest: StringType,
78
+ });
79
+ /**
80
+ * An execution environment specification.
81
+ *
82
+ * Stored beast2-encoded in the object store; the **environment hash** is the
83
+ * object hash of the encoded spec. A task/function with no environment
84
+ * (`none`) runs on the stock runtime image as today.
85
+ */
86
+ export const EnvironmentSpecType = VariantType({
87
+ /** Python (uv) project environment */
88
+ python: PythonEnvironmentType,
89
+ /** Node project environment */
90
+ node: NodeEnvironmentType,
91
+ /** Custom container image environment */
92
+ image: ImageEnvironmentType,
93
+ });
94
+ /**
95
+ * Lists the object-store hashes an environment spec references.
96
+ *
97
+ * Every reachability walker (package export closure, GC) must include these
98
+ * so environment blobs transfer with the package and survive collection.
99
+ *
100
+ * @param spec - The environment spec to walk
101
+ * @returns The referenced blob hashes (empty for `image` environments)
102
+ */
103
+ export function environmentSpecObjectHashes(spec) {
104
+ switch (spec.type) {
105
+ case 'python':
106
+ return [spec.value.pyproject, spec.value.lock, ...spec.value.sdists.map((s) => s.hash)];
107
+ case 'node':
108
+ return [spec.value.packageJson, spec.value.lock, ...spec.value.tarballs];
109
+ case 'image':
110
+ return [];
111
+ }
112
+ }
113
+ //# sourceMappingURL=environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/environment.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAe,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5F;;;;;;;;;;;;;;GAcG;AACH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C,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC3E,KAAK,OAAO;YACV,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -15,7 +15,7 @@
15
15
  * loading the IR bundle, and so dynamic callers (CLI literal parsing,
16
16
  * non-TS clients) have the types they need to encode arguments.
17
17
  */
18
- import { StructType, StringType, ArrayType, ValueTypeOf } from '@elaraai/east';
18
+ import { StructType, StringType, ArrayType, OptionType, ValueTypeOf } from '@elaraai/east';
19
19
  /**
20
20
  * Function object stored in the object store, referenced by name from
21
21
  * `PackageObject.functions`.
@@ -126,7 +126,24 @@ export declare const FunctionObjectType: StructType<{
126
126
  readonly command: ArrayType<StringType>;
127
127
  }>;
128
128
  }>;
129
+ /**
130
+ * Hash of an `EnvironmentSpecType` object the function executes in;
131
+ * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
132
+ * fields positionally) with a legacy dual decoder — see
133
+ * {@link decodeFunctionObject}.
134
+ */
135
+ readonly environment: OptionType<StringType>;
129
136
  }>;
130
137
  export type FunctionObjectType = typeof FunctionObjectType;
131
138
  export type FunctionObject = ValueTypeOf<typeof FunctionObjectType>;
139
+ /**
140
+ * Decode a `FunctionObject` from BEAST2 bytes, tolerating the
141
+ * pre-`environment` wire format (dual-decode migration, like
142
+ * `decodePackageObject`).
143
+ *
144
+ * Every function-read path — local AND cloud — must use this instead of
145
+ * `decodeBeast2For(FunctionObjectType)` directly. Older bytes decode with
146
+ * `environment` defaulted to `none`.
147
+ */
148
+ export declare function decodeFunctionObject(data: Uint8Array): FunctionObject;
132
149
  //# sourceMappingURL=function.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAG7F;;;GAGG;AACH,eAAO,MAAM,kBAAkB;IAC7B,wFAAwF;;IAExF;mEAC+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE/D,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAExE;oEACgE;;;;;;;;;;;;;;;EAEhE,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAgB,UAAU,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAGhI;;;GAGG;AACH,eAAO,MAAM,kBAAkB;IAC7B,wFAAwF;;IAExF;mEAC+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE/D,wEAAwE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAExE;oEACgE;;;;;;;;;;;;;;;IAEhE;;;;;OAKG;;EAEH,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAiBpE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,CAWrE"}
@@ -15,7 +15,7 @@
15
15
  * loading the IR bundle, and so dynamic callers (CLI literal parsing,
16
16
  * non-TS clients) have the types they need to encode arguments.
17
17
  */
18
- import { StructType, StringType, ArrayType, EastTypeType } from '@elaraai/east';
18
+ import { StructType, StringType, ArrayType, EastTypeType, OptionType, decodeBeast2For, none } from '@elaraai/east';
19
19
  import { RunnerType } from './runner.js';
20
20
  /**
21
21
  * Function object stored in the object store, referenced by name from
@@ -32,5 +32,48 @@ export const FunctionObjectType = StructType({
32
32
  /** Author-chosen runtime; resolved to argv by runnerToArgv. One of the known
33
33
  * runtime tags — there is no raw-argv runner for functions. */
34
34
  runner: RunnerType,
35
+ /**
36
+ * Hash of an `EnvironmentSpecType` object the function executes in;
37
+ * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
38
+ * fields positionally) with a legacy dual decoder — see
39
+ * {@link decodeFunctionObject}.
40
+ */
41
+ environment: OptionType(StringType),
35
42
  });
43
+ /**
44
+ * The pre-`environment` function object wire shape, kept only so
45
+ * {@link decodeFunctionObject} can read functions exported before execution
46
+ * environments existed.
47
+ */
48
+ const PreEnvironmentFunctionObjectType = StructType({
49
+ bodyIr: StringType,
50
+ inputTypes: ArrayType(EastTypeType),
51
+ outputType: EastTypeType,
52
+ runner: RunnerType,
53
+ });
54
+ const decodeCurrentFunction = decodeBeast2For(FunctionObjectType);
55
+ const decodePreEnvironmentFunction = decodeBeast2For(PreEnvironmentFunctionObjectType);
56
+ /**
57
+ * Decode a `FunctionObject` from BEAST2 bytes, tolerating the
58
+ * pre-`environment` wire format (dual-decode migration, like
59
+ * `decodePackageObject`).
60
+ *
61
+ * Every function-read path — local AND cloud — must use this instead of
62
+ * `decodeBeast2For(FunctionObjectType)` directly. Older bytes decode with
63
+ * `environment` defaulted to `none`.
64
+ */
65
+ export function decodeFunctionObject(data) {
66
+ try {
67
+ return decodeCurrentFunction(data);
68
+ }
69
+ catch (err) {
70
+ try {
71
+ const legacy = decodePreEnvironmentFunction(data);
72
+ return { ...legacy, environment: none };
73
+ }
74
+ catch {
75
+ throw err; // no known shape — surface the current-format error
76
+ }
77
+ }
78
+ }
36
79
  //# sourceMappingURL=function.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/function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,qBAAqB,GAAG,eAAe,CAAC,kBAAkB,CAAC,CAAC;AAClE,MAAM,4BAA4B,GAAG,eAAe,CAAC,gCAAgC,CAAC,CAAC;AAEvF;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAgB;IACnD,IAAI,CAAC;QACH,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,4BAA4B,CAAC,IAAI,CAAC,CAAC;YAClD,OAAO,EAAE,GAAG,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAC1C,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,CAAC,CAAC,oDAAoD;QACjE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -22,10 +22,11 @@
22
22
  */
23
23
  export { DataRefType, type DataRef, unassignedRef, nullRef, DataTreeType, } from './dataset.js';
24
24
  export { VersionVectorType, type VersionVector, DatasetRefType, type DatasetRef, } from './dataset-ref.js';
25
- export { TaskObjectType, type TaskObject, } from './task.js';
25
+ export { TaskObjectType, type TaskObject, decodeTaskObject, } from './task.js';
26
+ export { EnvironmentSpecType, type EnvironmentSpec, PythonEnvironmentType, type PythonEnvironment, NodeEnvironmentType, type NodeEnvironment, ImageEnvironmentType, type ImageEnvironment, environmentSpecObjectHashes, } from './environment.js';
26
27
  export { StructureType, type Structure, PathSegmentType, type PathSegment, TreePathType, type TreePath, type ParsePathResult, type ParseDatasetPathResult, type ParsePackageRefResult, treePath, pathToString, parsePath, parseDatasetPath, parsePackageRef, urlPathToTreePath, DatasetSchemaType, type DatasetSchema, } from './structure.js';
27
28
  export { RunnerType, type RunnerValue, runnerToArgv, } from './runner.js';
28
- export { FunctionObjectType, type FunctionObject, } from './function.js';
29
+ export { FunctionObjectType, type FunctionObject, decodeFunctionObject, } from './function.js';
29
30
  export { RecordCommitType, type RecordCommit, MutationObjectType, type MutationObject, RecordObjectType, type RecordObject, } from './record.js';
30
31
  export { PackageDataType, type PackageData, PackageObjectType, type PackageObject, decodePackageObject, PackageDatasetsType, type PackageDatasets, PackageTransferInitRequestType, type PackageTransferInitRequest, PackageTransferInitResponseType, type PackageTransferInitResponse, PackageJobResponseType, type PackageJobResponse, PackageImportResultType, type PackageImportResult, PackageExportResultType, type PackageExportResult, PackageImportProgressType, type PackageImportProgress, PackageImportStatusType, type PackageImportStatus, PackageExportProgressType, type PackageExportProgress, PackageExportStatusType, type PackageExportStatus, } from './package.js';
31
32
  export { WorkspaceStateType, type WorkspaceState, } from './workspace.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,iBAAiB,EACjB,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,aAAa,EACb,KAAK,SAAS,EACd,eAAe,EACf,KAAK,WAAW,EAChB,YAAY,EACZ,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAEjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,KAAK,WAAW,EAChB,YAAY,GACb,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,kBAAkB,EAClB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,gBAAgB,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,EACpB,KAAK,QAAQ,EACb,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,UAAU,EACf,aAAa,EACb,KAAK,SAAS,EACd,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,KAAK,aAAa,EAClB,kBAAkB,EAClB,KAAK,cAAc,EACnB,0BAA0B,EAC1B,KAAK,sBAAsB,EAE3B,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,eAAe,EACf,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EACL,WAAW,EACX,KAAK,OAAO,EACZ,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,iBAAiB,EACjB,KAAK,aAAa,EAClB,cAAc,EACd,KAAK,UAAU,GAChB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,KAAK,UAAU,EACf,gBAAgB,GACjB,MAAM,WAAW,CAAC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,EACrB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,KAAK,aAAa,EAClB,kBAAkB,EAClB,KAAK,cAAc,EACnB,0BAA0B,EAC1B,KAAK,sBAAsB,EAE3B,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,eAAe,EACf,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC"}
package/dist/src/index.js CHANGED
@@ -25,7 +25,9 @@ export { DataRefType, unassignedRef, nullRef, DataTreeType, } from './dataset.js
25
25
  // Per-dataset refs and version vectors (reactive dataflow)
26
26
  export { VersionVectorType, DatasetRefType, } from './dataset-ref.js';
27
27
  // Task definitions
28
- export { TaskObjectType, } from './task.js';
28
+ export { TaskObjectType, decodeTaskObject, } from './task.js';
29
+ // Execution environments
30
+ export { EnvironmentSpecType, PythonEnvironmentType, NodeEnvironmentType, ImageEnvironmentType, environmentSpecObjectHashes, } from './environment.js';
29
31
  // Data structure and paths
30
32
  export { StructureType, PathSegmentType, TreePathType, treePath, pathToString, parsePath, parseDatasetPath, parsePackageRef, urlPathToTreePath,
31
33
  // Backwards compatibility
@@ -33,7 +35,7 @@ DatasetSchemaType, } from './structure.js';
33
35
  // Runner wire types (functions)
34
36
  export { RunnerType, runnerToArgv, } from './runner.js';
35
37
  // Function objects
36
- export { FunctionObjectType, } from './function.js';
38
+ export { FunctionObjectType, decodeFunctionObject, } from './function.js';
37
39
  // Record objects
38
40
  export { RecordCommitType, MutationObjectType, RecordObjectType, } from './record.js';
39
41
  // Package objects
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,4BAA4B;AAC5B,OAAO,EACL,WAAW,EAEX,aAAa,EACb,OAAO,EACP,YAAY,GACb,MAAM,cAAc,CAAC;AAEtB,2DAA2D;AAC3D,OA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,YAAY;AACZ,mBAAmB,EACnB,YAAY,EACZ,uBAAuB,EACvB,kBAAkB;AAClB,uBAAuB;AACvB,iBAAiB,EACjB,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B;AAC7B,yBAAyB;AACzB,0BAA0B,EAC1B,qBAAqB;AACrB,eAAe;AACf,YAAY,EACZ,aAAa;AACb,wBAAwB;AACxB,uBAAuB;AACvB,gCAAgC;AAChC,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,GA+CxB,MAAM,UAAU,CAAC;AAElB,2BAA2B;AAC3B,OAAO,EAGL,aAAa,EAEb,qBAAqB,EAErB,iBAAiB,EAEjB,kBAAkB,EAElB,0BAA0B;AAE1B,uBAAuB;AACvB,qBAAqB,EAErB,uBAAuB,EAEvB,sBAAsB,EAEtB,eAAe,GAEhB,MAAM,eAAe,CAAC"}
@@ -86,7 +86,23 @@ export declare const TaskObjectType: StructType<{
86
86
  readonly command: ArrayType<StringType>;
87
87
  }>;
88
88
  }>;
89
+ /**
90
+ * Hash of an {@link EnvironmentSpecType} object the task executes in;
91
+ * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
92
+ * fields positionally) with a legacy dual decoder — see
93
+ * {@link decodeTaskObject}.
94
+ */
95
+ readonly environment: OptionType<StringType>;
89
96
  }>;
90
97
  export type TaskObjectType = typeof TaskObjectType;
91
98
  export type TaskObject = ValueTypeOf<typeof TaskObjectType>;
99
+ /**
100
+ * Decode a `TaskObject` from BEAST2 bytes, tolerating the pre-`environment`
101
+ * wire format (dual-decode migration, like {@link decodePackageObject}).
102
+ *
103
+ * Every task-read path — local AND cloud — must use this instead of
104
+ * `decodeBeast2For(TaskObjectType)` directly. Older bytes decode with
105
+ * `environment` defaulted to `none`.
106
+ */
107
+ export declare function decodeTaskObject(data: Uint8Array): TaskObject;
92
108
  //# sourceMappingURL=task.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIrG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,cAAc;IACzB,kFAAkF;;IAElF,uEAAuE;;;;IAEvE,sEAAsE;;;;IAEtE,sFAAsF;;IAEtF,6FAA6F;;IAE7F;;;;;;;OAOG;;;;;;;;;;;;;;;EAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"task.d.ts","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAI5H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,cAAc;IACzB,kFAAkF;;IAElF,uEAAuE;;;;IAEvE,sEAAsE;;;;IAEtE,sFAAsF;;IAEtF,6FAA6F;;IAE7F;;;;;;;OAOG;;;;;;;;;;;;;;;IAEH;;;;;OAKG;;EAEH,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AAEnD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,cAAc,CAAC,CAAC;AAmB5D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAW7D"}
package/dist/src/task.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * Input and output types are inferred from the package's structure at the
15
15
  * specified paths - the task just references locations, not types.
16
16
  */
17
- import { StructType, StringType, ArrayType, BlobType, OptionType } from '@elaraai/east';
17
+ import { StructType, StringType, ArrayType, BlobType, OptionType, decodeBeast2For, none } from '@elaraai/east';
18
18
  import { TreePathType } from './structure.js';
19
19
  import { RunnerType } from './runner.js';
20
20
  /**
@@ -71,5 +71,49 @@ export const TaskObjectType = StructType({
71
71
  * older SDKs must be re-exported.
72
72
  */
73
73
  runner: RunnerType,
74
+ /**
75
+ * Hash of an {@link EnvironmentSpecType} object the task executes in;
76
+ * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
77
+ * fields positionally) with a legacy dual decoder — see
78
+ * {@link decodeTaskObject}.
79
+ */
80
+ environment: OptionType(StringType),
81
+ });
82
+ /**
83
+ * The pre-`environment` task object wire shape, kept only so
84
+ * {@link decodeTaskObject} can read tasks exported before execution
85
+ * environments existed.
86
+ */
87
+ const PreEnvironmentTaskObjectType = StructType({
88
+ commandIr: StringType,
89
+ inputs: ArrayType(TreePathType),
90
+ output: TreePathType,
91
+ kind: OptionType(StringType),
92
+ metadata: OptionType(BlobType),
93
+ runner: RunnerType,
74
94
  });
95
+ const decodeCurrentTask = decodeBeast2For(TaskObjectType);
96
+ const decodePreEnvironmentTask = decodeBeast2For(PreEnvironmentTaskObjectType);
97
+ /**
98
+ * Decode a `TaskObject` from BEAST2 bytes, tolerating the pre-`environment`
99
+ * wire format (dual-decode migration, like {@link decodePackageObject}).
100
+ *
101
+ * Every task-read path — local AND cloud — must use this instead of
102
+ * `decodeBeast2For(TaskObjectType)` directly. Older bytes decode with
103
+ * `environment` defaulted to `none`.
104
+ */
105
+ export function decodeTaskObject(data) {
106
+ try {
107
+ return decodeCurrentTask(data);
108
+ }
109
+ catch (err) {
110
+ try {
111
+ const legacy = decodePreEnvironmentTask(data);
112
+ return { ...legacy, environment: none };
113
+ }
114
+ catch {
115
+ throw err; // no known shape — surface the current-format error
116
+ }
117
+ }
118
+ }
75
119
  //# sourceMappingURL=task.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAe,MAAM,eAAe,CAAC;AACrG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,kFAAkF;IAClF,SAAS,EAAE,UAAU;IACrB,uEAAuE;IACvE,MAAM,EAAE,SAAS,CAAC,YAAY,CAAC;IAC/B,sEAAsE;IACtE,MAAM,EAAE,YAAY;IACpB,sFAAsF;IACtF,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC;IAC5B,6FAA6F;IAC7F,QAAQ,EAAE,UAAU,CAAC,QAAQ,CAAC;IAC9B;;;;;;;OAOG;IACH,MAAM,EAAE,UAAU;CACnB,CAAC,CAAC"}
1
+ {"version":3,"file":"task.js","sourceRoot":"","sources":["../../src/task.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAe,eAAe,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,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"name": "@elaraai/e3-types",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Shared type definitions for e3 (East Execution Engine)",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -18,7 +18,7 @@
18
18
  "directory": "libs/e3/packages/e3-types"
19
19
  },
20
20
  "peerDependencies": {
21
- "@elaraai/east": "1.0.28"
21
+ "@elaraai/east": "1.0.29"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@typescript-eslint/eslint-plugin": "^8.47.0",
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+
6
+ /**
7
+ * Execution environment types for e3.
8
+ *
9
+ * An environment spec describes everything a worker needs to materialize the
10
+ * runtime environment a task or function executes in — beyond the stock
11
+ * runtime image. It is stored as a content-addressed object; tasks and
12
+ * functions reference it by hash (`environment` field), so identical
13
+ * environments dedupe and the environment hash transitively folds the user's
14
+ * implementation code (via lockfile + sdist/tarball hashes) into execution
15
+ * cache identity.
16
+ *
17
+ * All fields hold object-store hashes, never inline file contents: the blobs
18
+ * ride the existing content-addressed object store and transfer machinery.
19
+ */
20
+
21
+ import { ArrayType, StringType, StructType, ValueTypeOf, VariantType } from '@elaraai/east';
22
+
23
+ /**
24
+ * A Python (uv) project environment.
25
+ *
26
+ * Materialized by creating a venv from the locked dependency set
27
+ * (`uv sync --frozen`) and installing the project's own sdists into it.
28
+ *
29
+ * @remarks
30
+ * - `pyproject`: object hash of the project's `pyproject.toml` blob.
31
+ * - `lock`: object hash of the `uv.lock` blob — pins the full closure.
32
+ * - `sdists`: the project's own source distributions (`uv build --sdist`) —
33
+ * the user's platform-function implementation code — installed in order
34
+ * after the sync. Each entry carries the original filename because
35
+ * Python installers derive the package name from `name-version.tar.gz`
36
+ * and reject a renamed file.
37
+ */
38
+ export const PythonEnvironmentType = StructType({
39
+ /** Object hash of the pyproject.toml blob */
40
+ pyproject: StringType,
41
+ /** Object hash of the uv.lock blob */
42
+ lock: StringType,
43
+ /** Project sdist blobs (original filename + object hash), in install order */
44
+ sdists: ArrayType(StructType({ filename: StringType, hash: StringType })),
45
+ });
46
+ export type PythonEnvironmentType = typeof PythonEnvironmentType;
47
+ export type PythonEnvironment = ValueTypeOf<typeof PythonEnvironmentType>;
48
+
49
+ /**
50
+ * A Node (npm/pnpm) project environment.
51
+ *
52
+ * Materialized by installing the locked dependency set and then the
53
+ * project's own packed tarballs (`npm pack`).
54
+ *
55
+ * @remarks
56
+ * - `packageJson`: object hash of the project's `package.json` blob.
57
+ * - `lock`: object hash of the lockfile blob (`package-lock.json` or
58
+ * `pnpm-lock.yaml`).
59
+ * - `tarballs`: object hashes of `npm pack` tarballs of the project's own
60
+ * package(s), installed in order.
61
+ */
62
+ export const NodeEnvironmentType = StructType({
63
+ /** Object hash of the package.json blob */
64
+ packageJson: StringType,
65
+ /** Object hash of the lockfile blob */
66
+ lock: StringType,
67
+ /** Object hashes of npm-pack tarball blobs, in install order */
68
+ tarballs: ArrayType(StringType),
69
+ });
70
+ export type NodeEnvironmentType = typeof NodeEnvironmentType;
71
+ export type NodeEnvironment = ValueTypeOf<typeof NodeEnvironmentType>;
72
+
73
+ /**
74
+ * A user-controlled container image environment.
75
+ *
76
+ * The catch-all tier for CUDA bases, system libraries, or custom native
77
+ * runtimes. Executed by running the task's argv inside the referenced image.
78
+ *
79
+ * @remarks
80
+ * `digest` must be a full immutable digest reference
81
+ * (`repo@sha256:<64 hex>`); mutable tags are rejected at definition time so
82
+ * the environment hash cannot silently drift.
83
+ */
84
+ export const ImageEnvironmentType = StructType({
85
+ /** Full image digest reference: `repo@sha256:<64 hex chars>` */
86
+ digest: StringType,
87
+ });
88
+ export type ImageEnvironmentType = typeof ImageEnvironmentType;
89
+ export type ImageEnvironment = ValueTypeOf<typeof ImageEnvironmentType>;
90
+
91
+ /**
92
+ * An execution environment specification.
93
+ *
94
+ * Stored beast2-encoded in the object store; the **environment hash** is the
95
+ * object hash of the encoded spec. A task/function with no environment
96
+ * (`none`) runs on the stock runtime image as today.
97
+ */
98
+ export const EnvironmentSpecType = VariantType({
99
+ /** Python (uv) project environment */
100
+ python: PythonEnvironmentType,
101
+ /** Node project environment */
102
+ node: NodeEnvironmentType,
103
+ /** Custom container image environment */
104
+ image: ImageEnvironmentType,
105
+ });
106
+ export type EnvironmentSpecType = typeof EnvironmentSpecType;
107
+ export type EnvironmentSpec = ValueTypeOf<typeof EnvironmentSpecType>;
108
+
109
+ /**
110
+ * Lists the object-store hashes an environment spec references.
111
+ *
112
+ * Every reachability walker (package export closure, GC) must include these
113
+ * so environment blobs transfer with the package and survive collection.
114
+ *
115
+ * @param spec - The environment spec to walk
116
+ * @returns The referenced blob hashes (empty for `image` environments)
117
+ */
118
+ export function environmentSpecObjectHashes(spec: EnvironmentSpec): string[] {
119
+ switch (spec.type) {
120
+ case 'python':
121
+ return [spec.value.pyproject, spec.value.lock, ...spec.value.sdists.map((s) => s.hash)];
122
+ case 'node':
123
+ return [spec.value.packageJson, spec.value.lock, ...spec.value.tarballs];
124
+ case 'image':
125
+ return [];
126
+ }
127
+ }
package/src/function.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * non-TS clients) have the types they need to encode arguments.
18
18
  */
19
19
 
20
- import { StructType, StringType, ArrayType, EastTypeType, ValueTypeOf } from '@elaraai/east';
20
+ import { StructType, StringType, ArrayType, EastTypeType, OptionType, ValueTypeOf, decodeBeast2For, none } from '@elaraai/east';
21
21
  import { RunnerType } from './runner.js';
22
22
 
23
23
  /**
@@ -35,7 +35,51 @@ export const FunctionObjectType = StructType({
35
35
  /** Author-chosen runtime; resolved to argv by runnerToArgv. One of the known
36
36
  * runtime tags — there is no raw-argv runner for functions. */
37
37
  runner: RunnerType,
38
+ /**
39
+ * Hash of an `EnvironmentSpecType` object the function executes in;
40
+ * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
41
+ * fields positionally) with a legacy dual decoder — see
42
+ * {@link decodeFunctionObject}.
43
+ */
44
+ environment: OptionType(StringType),
38
45
  });
39
46
  export type FunctionObjectType = typeof FunctionObjectType;
40
47
 
41
48
  export type FunctionObject = ValueTypeOf<typeof FunctionObjectType>;
49
+
50
+ /**
51
+ * The pre-`environment` function object wire shape, kept only so
52
+ * {@link decodeFunctionObject} can read functions exported before execution
53
+ * environments existed.
54
+ */
55
+ const PreEnvironmentFunctionObjectType = StructType({
56
+ bodyIr: StringType,
57
+ inputTypes: ArrayType(EastTypeType),
58
+ outputType: EastTypeType,
59
+ runner: RunnerType,
60
+ });
61
+
62
+ const decodeCurrentFunction = decodeBeast2For(FunctionObjectType);
63
+ const decodePreEnvironmentFunction = decodeBeast2For(PreEnvironmentFunctionObjectType);
64
+
65
+ /**
66
+ * Decode a `FunctionObject` from BEAST2 bytes, tolerating the
67
+ * pre-`environment` wire format (dual-decode migration, like
68
+ * `decodePackageObject`).
69
+ *
70
+ * Every function-read path — local AND cloud — must use this instead of
71
+ * `decodeBeast2For(FunctionObjectType)` directly. Older bytes decode with
72
+ * `environment` defaulted to `none`.
73
+ */
74
+ export function decodeFunctionObject(data: Uint8Array): FunctionObject {
75
+ try {
76
+ return decodeCurrentFunction(data);
77
+ } catch (err) {
78
+ try {
79
+ const legacy = decodePreEnvironmentFunction(data);
80
+ return { ...legacy, environment: none };
81
+ } catch {
82
+ throw err; // no known shape — surface the current-format error
83
+ }
84
+ }
85
+ }
package/src/index.ts CHANGED
@@ -43,8 +43,22 @@ export {
43
43
  export {
44
44
  TaskObjectType,
45
45
  type TaskObject,
46
+ decodeTaskObject,
46
47
  } from './task.js';
47
48
 
49
+ // Execution environments
50
+ export {
51
+ EnvironmentSpecType,
52
+ type EnvironmentSpec,
53
+ PythonEnvironmentType,
54
+ type PythonEnvironment,
55
+ NodeEnvironmentType,
56
+ type NodeEnvironment,
57
+ ImageEnvironmentType,
58
+ type ImageEnvironment,
59
+ environmentSpecObjectHashes,
60
+ } from './environment.js';
61
+
48
62
  // Data structure and paths
49
63
  export {
50
64
  StructureType,
@@ -78,6 +92,7 @@ export {
78
92
  export {
79
93
  FunctionObjectType,
80
94
  type FunctionObject,
95
+ decodeFunctionObject,
81
96
  } from './function.js';
82
97
 
83
98
  // Record objects
package/src/task.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * specified paths - the task just references locations, not types.
17
17
  */
18
18
 
19
- import { StructType, StringType, ArrayType, BlobType, OptionType, ValueTypeOf } from '@elaraai/east';
19
+ import { StructType, StringType, ArrayType, BlobType, OptionType, ValueTypeOf, decodeBeast2For, none } from '@elaraai/east';
20
20
  import { TreePathType } from './structure.js';
21
21
  import { RunnerType } from './runner.js';
22
22
 
@@ -74,7 +74,52 @@ export const TaskObjectType = StructType({
74
74
  * older SDKs must be re-exported.
75
75
  */
76
76
  runner: RunnerType,
77
+ /**
78
+ * Hash of an {@link EnvironmentSpecType} object the task executes in;
79
+ * `none` ⇒ the stock runtime image. Appended LAST (BEAST2 encodes struct
80
+ * fields positionally) with a legacy dual decoder — see
81
+ * {@link decodeTaskObject}.
82
+ */
83
+ environment: OptionType(StringType),
77
84
  });
78
85
  export type TaskObjectType = typeof TaskObjectType;
79
86
 
80
87
  export type TaskObject = ValueTypeOf<typeof TaskObjectType>;
88
+
89
+ /**
90
+ * The pre-`environment` task object wire shape, kept only so
91
+ * {@link decodeTaskObject} can read tasks exported before execution
92
+ * environments existed.
93
+ */
94
+ const PreEnvironmentTaskObjectType = StructType({
95
+ commandIr: StringType,
96
+ inputs: ArrayType(TreePathType),
97
+ output: TreePathType,
98
+ kind: OptionType(StringType),
99
+ metadata: OptionType(BlobType),
100
+ runner: RunnerType,
101
+ });
102
+
103
+ const decodeCurrentTask = decodeBeast2For(TaskObjectType);
104
+ const decodePreEnvironmentTask = decodeBeast2For(PreEnvironmentTaskObjectType);
105
+
106
+ /**
107
+ * Decode a `TaskObject` from BEAST2 bytes, tolerating the pre-`environment`
108
+ * wire format (dual-decode migration, like {@link decodePackageObject}).
109
+ *
110
+ * Every task-read path — local AND cloud — must use this instead of
111
+ * `decodeBeast2For(TaskObjectType)` directly. Older bytes decode with
112
+ * `environment` defaulted to `none`.
113
+ */
114
+ export function decodeTaskObject(data: Uint8Array): TaskObject {
115
+ try {
116
+ return decodeCurrentTask(data);
117
+ } catch (err) {
118
+ try {
119
+ const legacy = decodePreEnvironmentTask(data);
120
+ return { ...legacy, environment: none };
121
+ } catch {
122
+ throw err; // no known shape — surface the current-format error
123
+ }
124
+ }
125
+ }