@nosana/node 1.1.24-rc → 1.1.25-rc

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.24-rc",
3
+ "version": "1.1.25-rc",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -73,7 +73,7 @@
73
73
  "@coral-xyz/anchor": "^0.28.1-beta.1",
74
74
  "@inquirer/prompts": "^4.3.0",
75
75
  "@nosana/ipfs": "^2.2.6",
76
- "@nosana/sdk": "^0.4.82",
76
+ "@nosana/sdk": "^0.4.84",
77
77
  "@solana/web3.js": "^1.78.0",
78
78
  "bn.js": "^5.2.1",
79
79
  "chalk": "^5.3.0",
@@ -111,7 +111,7 @@ export class JobHandler {
111
111
  return false;
112
112
  }
113
113
  if (jobDefinition.ops.some(op => op.type === "container/run" && op.args.trusted_execution_env)) {
114
- if (!await this.provider.hasTrustedExecutionEnvCapability("SEV-SNP")) {
114
+ if (!await this.provider.hasTrustedExecutionEnvCapability()) {
115
115
  this.repository.updateflowStateError(this.jobId(), {
116
116
  status: 'validation-error',
117
117
  error: 'Node does not support Trusted Execution Environments',
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { Flow, Operation, OperationArgsMap, OperationType, TrustedExecutionEnv } from '@nosana/sdk';
2
+ import { Flow, Operation, OperationArgsMap, OperationType } from '@nosana/sdk';
3
3
  import EventEmitter from 'events';
4
4
  import { NodeRepository } from '../repository/NodeRepository.js';
5
5
  import { ResourceManager } from '../node/resource/resourceManager.js';
@@ -11,7 +11,7 @@ export declare class Provider {
11
11
  private readonly frpcImage;
12
12
  private proxyStartupAbortController;
13
13
  constructor(containerOrchestration: ContainerOrchestrationInterface, repository: NodeRepository, resourceManager: ResourceManager);
14
- hasTrustedExecutionEnvCapability(required_environment: TrustedExecutionEnv): Promise<boolean>;
14
+ hasTrustedExecutionEnvCapability(): Promise<boolean>;
15
15
  stopReverseProxyApi(address: string): Promise<boolean>;
16
16
  setUpReverseProxyApi(address: string, port: string): Promise<boolean>;
17
17
  taskManagerContainerRunOperation(flow: Flow, op: Operation<'container/run'>, controller: AbortController, emitter: EventEmitter): Promise<void>;
@@ -17,8 +17,8 @@ export class Provider {
17
17
  this.proxyStartupAbortController = undefined;
18
18
  applyLoggingProxyToClass(this);
19
19
  }
20
- async hasTrustedExecutionEnvCapability(required_environment) {
21
- return this.containerOrchestration.teeRuntime === required_environment;
20
+ async hasTrustedExecutionEnvCapability() {
21
+ return this.containerOrchestration.teeRuntime !== undefined;
22
22
  }
23
23
  async stopReverseProxyApi(address) {
24
24
  const frpc_name = `frpc-api-${address}`;
@@ -216,6 +216,11 @@ export class Provider {
216
216
  const resourceVolumes = await this.resourceManager.getResourceVolumes(op.args.resources ?? [], controller);
217
217
  volumes.push(...resourceVolumes);
218
218
  }
219
+ // The op only declares that it wants a TEE; the node's configured
220
+ // runtime decides how that is fulfilled.
221
+ const teeRuntime = op.args.trusted_execution_env
222
+ ? this.containerOrchestration.teeRuntime
223
+ : undefined;
219
224
  const createContainerOptions = {
220
225
  name,
221
226
  cmd,
@@ -228,9 +233,9 @@ export class Provider {
228
233
  volumes,
229
234
  aliases,
230
235
  restart_policy: op.args.restart_policy,
231
- runtime: op.args.trusted_execution_env
236
+ runtime: teeRuntime,
232
237
  };
233
- if (op.args.trusted_execution_env) {
238
+ if (teeRuntime === 'SEV-SNP') {
234
239
  await this.containerOrchestration.pullImage("busybox");
235
240
  await this.resourceManager.images.setImage("busybox");
236
241
  const bridgeContainer = await this.containerOrchestration.runFlowContainer("busybox", {
@@ -252,7 +257,7 @@ export class Provider {
252
257
  emitter.emit('container:started');
253
258
  const info = await container.inspect();
254
259
  emitter.emit('updateOpState', { providerId: container.id });
255
- if (!op.args.trusted_execution_env && info.NetworkSettings?.Networks["NOSANA_GATEWAY"].IPAddress) {
260
+ if (teeRuntime !== 'SEV-SNP' && info.NetworkSettings?.Networks["NOSANA_GATEWAY"].IPAddress) {
256
261
  emitter.emit('setContainerInternalIp', info.NetworkSettings.Networks["NOSANA_GATEWAY"].IPAddress);
257
262
  }
258
263
  stateManager = new ContainerStateManager(container, controller, emitter, op.args.restart_policy);
@@ -59,7 +59,7 @@ export function createDockerRunOptions(image, { name, cmd, gpu, volumes, env, wo
59
59
  })),
60
60
  NetworkMode: bind_network_to_container ? bind_network_to_container : 'bridge',
61
61
  DeviceRequests: devices,
62
- ...(runtime === 'SEV-SNP' ? {
62
+ ...(runtime === 'SEV-SNP' || runtime === 'SEV-GUEST' ? {
63
63
  Devices: [
64
64
  {
65
65
  PathOnHost: '/dev/sev-guest',
@@ -69,7 +69,7 @@ export function createDockerRunOptions(image, { name, cmd, gpu, volumes, env, wo
69
69
  ]
70
70
  } : {}),
71
71
  RestartPolicy: parseRestartPolicy(restart_policy),
72
- ...(runtime ? { Runtime: runtime } : {}),
72
+ ...(runtime === 'SEV-SNP' ? { Runtime: runtime } : {}),
73
73
  },
74
74
  };
75
75
  }
@@ -5,7 +5,7 @@ import { RequestInit, Response } from 'undici';
5
5
  export declare class PodmanContainerOrchestration extends DockerContainerOrchestration {
6
6
  private api;
7
7
  name: string;
8
- constructor(server: string, gpu: string, _teeRuntime?: string);
8
+ constructor(server: string, gpu: string, teeRuntime?: string);
9
9
  libPodAPICall(path: string, options: RequestInit): Promise<Response>;
10
10
  createNetwork(_name: string, controller?: AbortController): Promise<void>;
11
11
  runFlowContainer(image: string, args: RunContainerArgs): Promise<Container>;
@@ -3,8 +3,8 @@ import { createPodmanRunOptions } from './utils/createPodmanRunOptions.js';
3
3
  import { fetch, Agent } from 'undici';
4
4
  import { liveAbortSignal } from '../../../utils/liveAbortSignal.js';
5
5
  export class PodmanContainerOrchestration extends DockerContainerOrchestration {
6
- constructor(server, gpu, _teeRuntime) {
7
- super(server, gpu);
6
+ constructor(server, gpu, teeRuntime) {
7
+ super(server, gpu, teeRuntime);
8
8
  this.name = 'podman';
9
9
  if (this.protocol === 'socket') {
10
10
  this.api = `http://localhost/v4.5.0/libpod`;
@@ -24,7 +24,7 @@ function parseRestartPolicy(restart_policy) {
24
24
  * @returns
25
25
  */
26
26
  export function createPodmanRunOptions(image, args, gpuOption) {
27
- const { name, cmd, gpu, volumes, env, aliases, work_dir, entrypoint, restart_policy, } = args;
27
+ const { name, cmd, gpu, volumes, env, aliases, work_dir, entrypoint, restart_policy, runtime, } = args;
28
28
  const devices = gpu
29
29
  ? gpuOption === 'all'
30
30
  ? [
@@ -34,6 +34,9 @@ export function createPodmanRunOptions(image, args, gpuOption) {
34
34
  ]
35
35
  : gpuOption.split(',').map((id) => ({ path: `nvidia.com/gpu=${id}` }))
36
36
  : [];
37
+ if (runtime === 'SEV-GUEST') {
38
+ devices.push({ path: '/dev/sev-guest' });
39
+ }
37
40
  return {
38
41
  image,
39
42
  name,
@@ -1,12 +1,12 @@
1
1
  import { DockerContainerOrchestration } from './docker/index.js';
2
2
  import { PodmanContainerOrchestration } from './podman/index.js';
3
3
  export function selectContainerOrchestrationProvider(provider, url, gpu, teeRuntime) {
4
- if (provider !== 'docker' && teeRuntime) {
4
+ if (provider !== 'docker' && teeRuntime === 'SEV-SNP') {
5
5
  throw new Error('Custom runtimes are only supported with the Docker provider.');
6
6
  }
7
7
  switch (provider) {
8
8
  case 'podman':
9
- return new PodmanContainerOrchestration(url, gpu, undefined);
9
+ return new PodmanContainerOrchestration(url, gpu, teeRuntime);
10
10
  case 'docker':
11
11
  default:
12
12
  return new DockerContainerOrchestration(url, gpu, teeRuntime);
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.24-rc",
3
+ "version": "1.1.25-rc",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@nosana/node",
9
- "version": "1.1.24-rc",
9
+ "version": "1.1.25-rc",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@coral-xyz/anchor": "^0.28.1-beta.1",
13
13
  "@inquirer/prompts": "^4.3.0",
14
14
  "@nosana/ipfs": "^2.2.6",
15
- "@nosana/sdk": "^0.4.82",
15
+ "@nosana/sdk": "^0.4.84",
16
16
  "@solana/web3.js": "^1.78.0",
17
17
  "bn.js": "^5.2.1",
18
18
  "chalk": "^5.3.0",
@@ -1609,9 +1609,9 @@
1609
1609
  }
1610
1610
  },
1611
1611
  "node_modules/@nosana/sdk": {
1612
- "version": "0.4.82",
1613
- "resolved": "https://registry.npmjs.org/@nosana/sdk/-/sdk-0.4.82.tgz",
1614
- "integrity": "sha512-s964bc25mLM/Jb5ctSttZ58lbB3SR3KcxECF/BKlOWiN8VUqUEY/GLG6NAzkQ97r23IhenXSewOhNWMbY405Ig==",
1612
+ "version": "0.4.84",
1613
+ "resolved": "https://registry.npmjs.org/@nosana/sdk/-/sdk-0.4.84.tgz",
1614
+ "integrity": "sha512-N5qq1d1WYS0h+uXxxYb9CN39J/jb9x6rh1HG1yNDuUpv8ZpHjF+QerTm0BbaOD8VrX+/t+4WCVtlSADEcyVFqg==",
1615
1615
  "license": "ISC",
1616
1616
  "dependencies": {
1617
1617
  "@coral-xyz/anchor": "^0.28.1-beta.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nosana/node",
3
- "version": "1.1.24-rc",
3
+ "version": "1.1.25-rc",
4
4
  "description": "",
5
5
  "bin": {
6
6
  "nosana-node": "./dist/src/index.js"
@@ -73,7 +73,7 @@
73
73
  "@coral-xyz/anchor": "^0.28.1-beta.1",
74
74
  "@inquirer/prompts": "^4.3.0",
75
75
  "@nosana/ipfs": "^2.2.6",
76
- "@nosana/sdk": "^0.4.82",
76
+ "@nosana/sdk": "^0.4.84",
77
77
  "@solana/web3.js": "^1.78.0",
78
78
  "bn.js": "^5.2.1",
79
79
  "chalk": "^5.3.0",
@@ -105,4 +105,4 @@
105
105
  "util": "^0.12.5",
106
106
  "yaml": "^2.8.0"
107
107
  }
108
- }
108
+ }