Comparing version 0.13.22-dev-7d0bd9d.0 to 0.13.22-dev-883ec48.0
{ | ||
"name": "agoric", | ||
"version": "0.13.22-dev-7d0bd9d.0+7d0bd9d", | ||
"version": "0.13.22-dev-883ec48.0+883ec48", | ||
"description": "Manage the Agoric Javascript smart contract platform", | ||
@@ -25,3 +25,3 @@ "type": "module", | ||
"devDependencies": { | ||
"@agoric/swingset-vat": "0.24.2-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/swingset-vat": "0.24.2-dev-883ec48.0+883ec48", | ||
"ava": "^3.12.1", | ||
@@ -32,9 +32,9 @@ "c8": "^7.7.2", | ||
"dependencies": { | ||
"@agoric/access-token": "0.4.17-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/assert": "0.3.16-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/bundle-source": "2.0.2-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/captp": "1.10.9-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/install-ses": "0.5.30-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/access-token": "0.4.17-dev-883ec48.0+883ec48", | ||
"@agoric/assert": "0.3.16-dev-883ec48.0+883ec48", | ||
"@agoric/bundle-source": "2.0.2-dev-883ec48.0+883ec48", | ||
"@agoric/captp": "1.10.9-dev-883ec48.0+883ec48", | ||
"@agoric/install-ses": "0.5.30-dev-883ec48.0+883ec48", | ||
"@agoric/nat": "^4.1.0", | ||
"@agoric/promise-kit": "0.2.30-dev-7d0bd9d.0+7d0bd9d", | ||
"@agoric/promise-kit": "0.2.30-dev-883ec48.0+883ec48", | ||
"@endo/compartment-mapper": "^0.6.1", | ||
@@ -77,3 +77,3 @@ "@iarna/toml": "^2.2.3", | ||
}, | ||
"gitHead": "7d0bd9dafe0566091836f48f2d628a3d33889056" | ||
"gitHead": "883ec48439ca628e1d7b228d1bf8ba8f9e3abe94" | ||
} |
import chalk from 'chalk'; | ||
import path from 'path'; | ||
import { makePspawn, getSDKBinaries } from './helpers.js'; | ||
const filename = new URL(import.meta.url).pathname; | ||
export default async function cosmosMain(progname, rawArgs, powers, opts) { | ||
const IMAGE = `agoric/agoric-sdk`; | ||
const { anylogger, spawn, process } = powers; | ||
const { anylogger, fs, spawn, process } = powers; | ||
const log = anylogger('agoric:cosmos'); | ||
@@ -23,5 +26,43 @@ | ||
function helper(args, hopts = undefined) { | ||
if (opts.sdk) { | ||
const { cosmosHelper } = getSDKBinaries(); | ||
return pspawn(cosmosHelper, args, hopts); | ||
if (!opts.dockerTag) { | ||
const sdkPrefixes = {}; | ||
if (!opts.sdk) { | ||
const agoricPrefix = path.resolve(`node_modules/@agoric`); | ||
sdkPrefixes.goPfx = agoricPrefix; | ||
sdkPrefixes.jsPfx = agoricPrefix; | ||
} | ||
// Use the locally-built binaries. | ||
const { cosmosHelper, cosmosClientBuild } = getSDKBinaries(sdkPrefixes); | ||
return fs | ||
.stat(cosmosHelper) | ||
.then( | ||
() => 0, | ||
e => { | ||
if (e.code === 'ENOENT') { | ||
// Build the client helper. | ||
log.warn('Building the Cosmos client helper...'); | ||
const ps = pspawn( | ||
cosmosClientBuild[0], | ||
cosmosClientBuild.slice(1), | ||
{ | ||
cwd: path.dirname(filename), | ||
stdio: ['ignore', 'pipe', 'inherit'], | ||
}, | ||
); | ||
// Ensure the build doesn't mess up stdout. | ||
ps.childProcess.stdout.pipe(process.stderr); | ||
return ps; | ||
} | ||
throw e; | ||
}, | ||
) | ||
.then(code => { | ||
if (code !== 0) { | ||
throw new Error( | ||
`Cosmos client helper build failed with code ${code}`, | ||
); | ||
} | ||
return pspawn(cosmosHelper, args, hopts); | ||
}); | ||
} | ||
@@ -40,3 +81,3 @@ | ||
'--entrypoint=agd', | ||
IMAGE, | ||
`${IMAGE}:${opts.dockerTag}`, | ||
...args, | ||
@@ -43,0 +84,0 @@ ], |
@@ -271,2 +271,3 @@ /* global process setTimeout setInterval clearInterval */ | ||
port, | ||
args: opts.scriptArgs, | ||
}); | ||
@@ -273,0 +274,0 @@ } |
@@ -64,3 +64,3 @@ /* global process */ | ||
log.log(color('blueBright', cmd, ...cargs)); | ||
log.warn(color('blueBright', cmd, ...cargs)); | ||
const cp = spawn(cmd, cargs, { stdio, env, ...rest }); | ||
@@ -67,0 +67,0 @@ const pr = new Promise((resolve, _reject) => { |
@@ -163,35 +163,59 @@ /* global process */ | ||
const addRunOptions = cmd => | ||
cmd | ||
.option( | ||
'--allow-unsafe-plugins', | ||
`CAREFUL: installed Agoric VM plugins will also have all your user's privileges`, | ||
false, | ||
) | ||
.option( | ||
'--hostport <host:port>', | ||
'host and port to connect to VM', | ||
'127.0.0.1:8000', | ||
) | ||
.option( | ||
'--need <subsystems>', | ||
'comma-separated names of subsystems to wait for', | ||
'local,agoric,wallet', | ||
) | ||
.option( | ||
'--provide <subsystems>', | ||
'comma-separated names of subsystems this script initializes', | ||
'', | ||
); | ||
addRunOptions( | ||
program | ||
.command('run <script> [script-args...]') | ||
.description( | ||
'run a script with all your user privileges against the local Agoric VM', | ||
), | ||
).action(async (script, scriptArgs, cmd) => { | ||
const opts = { ...program.opts(), ...cmd.opts(), scriptArgs }; | ||
return subMain(deployMain, ['run', script], opts); | ||
}); | ||
addRunOptions( | ||
program | ||
.command('deploy [script...]') | ||
.description( | ||
'run multiple scripts with all your user privileges against the local Agoric VM', | ||
), | ||
).action(async (scripts, cmd) => { | ||
const opts = { ...program.opts(), ...cmd.opts() }; | ||
return subMain(deployMain, ['deploy', ...scripts], opts); | ||
}); | ||
program | ||
.command('deploy [script...]') | ||
.command('start [profile] [args...]') | ||
.description( | ||
'run a deployment script with all your user privileges against the local Agoric VM', | ||
`\ | ||
start an Agoric VM | ||
agoric start - runs the default profile (dev) | ||
agoric start dev -- [initArgs] - simulated chain and solo VM | ||
agoric start local-chain [portNum] -- [initArgs] - local chain | ||
agoric start local-solo [portNum] [provisionPowers] - local solo VM | ||
`, | ||
) | ||
.option( | ||
'--allow-unsafe-plugins', | ||
`CAREFUL: installed Agoric VM plugins will also have all your user's privileges`, | ||
false, | ||
) | ||
.option( | ||
'--hostport <host:port>', | ||
'host and port to connect to VM', | ||
'127.0.0.1:8000', | ||
) | ||
.option( | ||
'--need <subsystems>', | ||
'comma-separated names of subsystems to wait for', | ||
'local,agoric,wallet', | ||
) | ||
.option( | ||
'--provide <subsystems>', | ||
'comma-separated names of subsystems this script initializes', | ||
'', | ||
) | ||
.action(async (scripts, cmd) => { | ||
const opts = { ...program.opts(), ...cmd.opts() }; | ||
return subMain(deployMain, ['deploy', ...scripts], opts); | ||
}); | ||
program | ||
.command('start [profile] [args...]') | ||
.description('run an Agoric VM') | ||
.option('-d, --debug', 'run in JS debugger mode') | ||
@@ -198,0 +222,0 @@ .option('--reset', 'clear all VM state before starting') |
@@ -37,2 +37,3 @@ // DO NOT EDIT - automatically generated by get-sdk-package-names.js | ||
"@agoric/swingset-vat", | ||
"@agoric/telemetry", | ||
"@agoric/ui-components", | ||
@@ -39,0 +40,0 @@ "@agoric/vats", |
@@ -64,12 +64,12 @@ /* global process setTimeout */ | ||
const agServersPrefix = opts.sdk | ||
? undefined | ||
: path.resolve(`node_modules/@agoric`); | ||
const getBinaries = opts.sdk | ||
? getSDKBinaries | ||
: () => getSDKBinaries({ goPfx: agServersPrefix, jsPfx: agServersPrefix }); | ||
const sdkPrefixes = {}; | ||
if (!opts.sdk) { | ||
const agoricPrefix = path.resolve(`node_modules/@agoric`); | ||
sdkPrefixes.goPfx = agoricPrefix; | ||
sdkPrefixes.jsPfx = agoricPrefix; | ||
} | ||
let keysSpawn; | ||
if (!opts.dockerTag) { | ||
const { cosmosHelper } = getBinaries(); | ||
const { cosmosHelper } = getSDKBinaries(sdkPrefixes); | ||
keysSpawn = (args, ...rest) => | ||
@@ -145,3 +145,3 @@ pspawn(cosmosHelper, [`--home=_agstate/keys`, ...args], ...rest); | ||
} else { | ||
({ agSolo, agSoloBuild } = getBinaries()); | ||
({ agSolo, agSoloBuild } = getSDKBinaries(sdkPrefixes)); | ||
} | ||
@@ -220,3 +220,3 @@ | ||
const { cosmosChain, cosmosChainBuild } = getBinaries(); | ||
const { cosmosChain, cosmosChainBuild } = getSDKBinaries(sdkPrefixes); | ||
if (popts.pull || popts.rebuild) { | ||
@@ -413,3 +413,3 @@ if (popts.dockerTag) { | ||
const { cosmosClientBuild } = getBinaries(); | ||
const { cosmosClientBuild } = getSDKBinaries(sdkPrefixes); | ||
if (popts.pull || popts.rebuild) { | ||
@@ -469,2 +469,21 @@ if (popts.dockerTag) { | ||
// Initialise the solo directory and key. | ||
if (!(await exists(agServer))) { | ||
const initArgs = [`--webport=${portNum}`]; | ||
if (opts.dockerTag) { | ||
initArgs.push(`--webhost=0.0.0.0`); | ||
} | ||
const exitStatus = await soloSpawn( | ||
['init', agServer, ...initArgs], | ||
undefined, | ||
[`--workdir=/usr/src/dapp`], | ||
); | ||
if (exitStatus) { | ||
return exitStatus; | ||
} | ||
} | ||
if (!opts.restart) { | ||
return 0; | ||
} | ||
const gciFile = `_agstate/agoric-servers/local-chain-${CHAIN_PORT}/config/genesis.json.sha256`; | ||
@@ -495,18 +514,2 @@ process.stdout.write(`Waiting for local-chain-${CHAIN_PORT} to start...`); | ||
// Initialise the solo directory and key. | ||
if (!(await exists(agServer))) { | ||
const initArgs = [`--webport=${portNum}`]; | ||
if (opts.dockerTag) { | ||
initArgs.push(`--webhost=0.0.0.0`); | ||
} | ||
const exitStatus = await soloSpawn( | ||
['init', agServer, ...initArgs], | ||
undefined, | ||
[`--workdir=/usr/src/dapp`], | ||
); | ||
if (exitStatus) { | ||
return exitStatus; | ||
} | ||
} | ||
const spawnOpts = {}; | ||
@@ -513,0 +516,0 @@ if (!popts.dockerTag) { |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
118212
2143