@vm0/cli 9.159.0 → 9.160.1
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/{chunk-BMHPLXI2.js → chunk-IGFASJAN.js} +473 -266
- package/{chunk-BMHPLXI2.js.map → chunk-IGFASJAN.js.map} +1 -1
- package/index.js +9 -9
- package/package.json +1 -1
- package/zero.js +320 -10
- package/zero.js.map +1 -1
package/index.js
CHANGED
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
source_default,
|
|
69
69
|
volumeConfigSchema,
|
|
70
70
|
withErrorHandler
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-IGFASJAN.js";
|
|
72
72
|
import {
|
|
73
73
|
__toESM,
|
|
74
74
|
init_esm_shims
|
|
@@ -387,7 +387,7 @@ function getConfigPath() {
|
|
|
387
387
|
return join(os.homedir(), ".vm0", "config.json");
|
|
388
388
|
}
|
|
389
389
|
var infoCommand = new Command().name("info").description("Display environment and debug information").action(async () => {
|
|
390
|
-
console.log(source_default.bold(`VM0 CLI v${"9.
|
|
390
|
+
console.log(source_default.bold(`VM0 CLI v${"9.160.1"}`));
|
|
391
391
|
console.log();
|
|
392
392
|
const config = await loadConfig();
|
|
393
393
|
const hasEnvToken = !!process.env.VM0_TOKEN;
|
|
@@ -4280,7 +4280,7 @@ var composeCommand = new Command().name("compose").description("Create or update
|
|
|
4280
4280
|
options.autoUpdate = false;
|
|
4281
4281
|
}
|
|
4282
4282
|
if (options.autoUpdate !== false) {
|
|
4283
|
-
await startSilentUpgrade("9.
|
|
4283
|
+
await startSilentUpgrade("9.160.1");
|
|
4284
4284
|
}
|
|
4285
4285
|
try {
|
|
4286
4286
|
let result;
|
|
@@ -4372,7 +4372,7 @@ var mainRunCommand = new Command().name("run").description("Run an agent").argum
|
|
|
4372
4372
|
withErrorHandler(
|
|
4373
4373
|
async (identifier, prompt, options) => {
|
|
4374
4374
|
if (options.autoUpdate !== false) {
|
|
4375
|
-
await startSilentUpgrade("9.
|
|
4375
|
+
await startSilentUpgrade("9.160.1");
|
|
4376
4376
|
}
|
|
4377
4377
|
const { name, version } = parseIdentifier(identifier);
|
|
4378
4378
|
let composeId;
|
|
@@ -6165,13 +6165,13 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6165
6165
|
if (latestVersion === null) {
|
|
6166
6166
|
throw new Error("Could not check for updates. Please try again later.");
|
|
6167
6167
|
}
|
|
6168
|
-
if (latestVersion === "9.
|
|
6169
|
-
console.log(source_default.green(`\u2713 Already up to date (${"9.
|
|
6168
|
+
if (latestVersion === "9.160.1") {
|
|
6169
|
+
console.log(source_default.green(`\u2713 Already up to date (${"9.160.1"})`));
|
|
6170
6170
|
return;
|
|
6171
6171
|
}
|
|
6172
6172
|
console.log(
|
|
6173
6173
|
source_default.yellow(
|
|
6174
|
-
`Current version: ${"9.
|
|
6174
|
+
`Current version: ${"9.160.1"} -> Latest version: ${latestVersion}`
|
|
6175
6175
|
)
|
|
6176
6176
|
);
|
|
6177
6177
|
console.log();
|
|
@@ -6198,7 +6198,7 @@ var upgradeCommand = new Command().name("upgrade").description("Upgrade vm0 CLI
|
|
|
6198
6198
|
const success = await performUpgrade(packageManager);
|
|
6199
6199
|
if (success) {
|
|
6200
6200
|
console.log(
|
|
6201
|
-
source_default.green(`\u2713 Upgraded from ${"9.
|
|
6201
|
+
source_default.green(`\u2713 Upgraded from ${"9.160.1"} to ${latestVersion}`)
|
|
6202
6202
|
);
|
|
6203
6203
|
return;
|
|
6204
6204
|
}
|
|
@@ -6265,7 +6265,7 @@ var whoamiCommand = new Command().name("whoami").description("Show current ident
|
|
|
6265
6265
|
|
|
6266
6266
|
// src/index.ts
|
|
6267
6267
|
var program = new Command();
|
|
6268
|
-
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.
|
|
6268
|
+
program.name("vm0").description("VM0 CLI - Build and run agents with natural language").version("9.160.1");
|
|
6269
6269
|
program.addCommand(authCommand);
|
|
6270
6270
|
program.addCommand(infoCommand);
|
|
6271
6271
|
program.addCommand(composeCommand);
|
package/package.json
CHANGED
package/zero.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
InvalidArgumentError,
|
|
11
11
|
MODEL_PROVIDER_TYPES,
|
|
12
12
|
Option,
|
|
13
|
+
callZeroMaps,
|
|
13
14
|
completeHostedSite,
|
|
14
15
|
completePhoneFileUpload,
|
|
15
16
|
completeSlackFileUpload,
|
|
@@ -145,7 +146,7 @@ import {
|
|
|
145
146
|
zeroAgentCustomSkillNameSchema,
|
|
146
147
|
zeroLocalAgentCommand,
|
|
147
148
|
zeroTokenAllowsFeatureSwitch
|
|
148
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-IGFASJAN.js";
|
|
149
150
|
import {
|
|
150
151
|
__commonJS,
|
|
151
152
|
__require,
|
|
@@ -35020,8 +35021,41 @@ function Stats(props) {
|
|
|
35020
35021
|
})
|
|
35021
35022
|
);
|
|
35022
35023
|
}
|
|
35024
|
+
function VisualFigure(props) {
|
|
35025
|
+
return h(
|
|
35026
|
+
"figure",
|
|
35027
|
+
{ className: `website-visual-frame ${props.className}` },
|
|
35028
|
+
h("img", { src: props.visual.url, alt: props.visual.alt })
|
|
35029
|
+
);
|
|
35030
|
+
}
|
|
35031
|
+
function heroVisual(visuals) {
|
|
35032
|
+
return visuals.find((visual) => {
|
|
35033
|
+
return visual.placement === "hero";
|
|
35034
|
+
}) ?? visuals[0];
|
|
35035
|
+
}
|
|
35036
|
+
function SupportVisuals(props) {
|
|
35037
|
+
const hero = heroVisual(props.visuals);
|
|
35038
|
+
const support = props.visuals.filter((visual) => {
|
|
35039
|
+
return visual !== hero;
|
|
35040
|
+
});
|
|
35041
|
+
if (support.length === 0) {
|
|
35042
|
+
return null;
|
|
35043
|
+
}
|
|
35044
|
+
return h(
|
|
35045
|
+
"section",
|
|
35046
|
+
{ className: "visual-strip", "aria-label": "Generated visuals" },
|
|
35047
|
+
...support.map((visual) => {
|
|
35048
|
+
return h(VisualFigure, {
|
|
35049
|
+
key: visual.imageId,
|
|
35050
|
+
visual,
|
|
35051
|
+
className: `visual-${visual.placement}`
|
|
35052
|
+
});
|
|
35053
|
+
})
|
|
35054
|
+
);
|
|
35055
|
+
}
|
|
35023
35056
|
function LaunchTemplate(props) {
|
|
35024
35057
|
const data = props.data;
|
|
35058
|
+
const visual = heroVisual(props.generatedVisuals);
|
|
35025
35059
|
return h(
|
|
35026
35060
|
import_react.default.Fragment,
|
|
35027
35061
|
null,
|
|
@@ -35049,7 +35083,10 @@ function LaunchTemplate(props) {
|
|
|
35049
35083
|
})
|
|
35050
35084
|
)
|
|
35051
35085
|
),
|
|
35052
|
-
h(
|
|
35086
|
+
visual ? h(VisualFigure, {
|
|
35087
|
+
visual,
|
|
35088
|
+
className: "hero-visual"
|
|
35089
|
+
}) : h(
|
|
35053
35090
|
"div",
|
|
35054
35091
|
{ className: "hero-panel", "aria-hidden": "true" },
|
|
35055
35092
|
h("span", { className: "panel-label" }, data.siteName),
|
|
@@ -35068,19 +35105,24 @@ function LaunchTemplate(props) {
|
|
|
35068
35105
|
)
|
|
35069
35106
|
),
|
|
35070
35107
|
h(Highlights, { data }),
|
|
35108
|
+
h(SupportVisuals, { visuals: props.generatedVisuals }),
|
|
35071
35109
|
h(Stats, { data }),
|
|
35072
35110
|
h(SectionList, { data })
|
|
35073
35111
|
);
|
|
35074
35112
|
}
|
|
35075
35113
|
function ProfileTemplate(props) {
|
|
35076
35114
|
const data = props.data;
|
|
35115
|
+
const visual = heroVisual(props.generatedVisuals);
|
|
35077
35116
|
return h(
|
|
35078
35117
|
import_react.default.Fragment,
|
|
35079
35118
|
null,
|
|
35080
35119
|
h(
|
|
35081
35120
|
"section",
|
|
35082
35121
|
{ className: "hero hero-profile", id: "top" },
|
|
35083
|
-
h(
|
|
35122
|
+
visual ? h(VisualFigure, {
|
|
35123
|
+
visual,
|
|
35124
|
+
className: "hero-visual profile-visual"
|
|
35125
|
+
}) : h(
|
|
35084
35126
|
"div",
|
|
35085
35127
|
{ className: "profile-mark", "aria-hidden": "true" },
|
|
35086
35128
|
data.siteName.slice(0, 2).toUpperCase()
|
|
@@ -35109,12 +35151,13 @@ function ProfileTemplate(props) {
|
|
|
35109
35151
|
),
|
|
35110
35152
|
h(Stats, { data }),
|
|
35111
35153
|
h(Highlights, { data }),
|
|
35154
|
+
h(SupportVisuals, { visuals: props.generatedVisuals }),
|
|
35112
35155
|
h(SectionList, { data })
|
|
35113
35156
|
);
|
|
35114
35157
|
}
|
|
35115
35158
|
function WebsiteDocument(props) {
|
|
35116
35159
|
const { data, templateId } = props;
|
|
35117
|
-
const template = templateId === "profile" ? h(ProfileTemplate, { data }) : h(LaunchTemplate, { data });
|
|
35160
|
+
const template = templateId === "profile" ? h(ProfileTemplate, { data, generatedVisuals: props.generatedVisuals }) : h(LaunchTemplate, { data, generatedVisuals: props.generatedVisuals });
|
|
35118
35161
|
return h(
|
|
35119
35162
|
"html",
|
|
35120
35163
|
{ lang: "en" },
|
|
@@ -35374,6 +35417,45 @@ h1 {
|
|
|
35374
35417
|
justify-content: space-between;
|
|
35375
35418
|
}
|
|
35376
35419
|
|
|
35420
|
+
.website-visual-frame {
|
|
35421
|
+
margin: 0;
|
|
35422
|
+
border: 1px solid var(--line);
|
|
35423
|
+
border-radius: 8px;
|
|
35424
|
+
overflow: hidden;
|
|
35425
|
+
background: var(--surface);
|
|
35426
|
+
}
|
|
35427
|
+
|
|
35428
|
+
.website-visual-frame img {
|
|
35429
|
+
display: block;
|
|
35430
|
+
width: 100%;
|
|
35431
|
+
height: 100%;
|
|
35432
|
+
object-fit: cover;
|
|
35433
|
+
}
|
|
35434
|
+
|
|
35435
|
+
.hero-visual {
|
|
35436
|
+
align-self: stretch;
|
|
35437
|
+
min-height: 420px;
|
|
35438
|
+
aspect-ratio: 4 / 5;
|
|
35439
|
+
}
|
|
35440
|
+
|
|
35441
|
+
.profile-visual {
|
|
35442
|
+
width: min(32vw, 360px);
|
|
35443
|
+
min-height: 320px;
|
|
35444
|
+
aspect-ratio: 4 / 5;
|
|
35445
|
+
}
|
|
35446
|
+
|
|
35447
|
+
.visual-strip {
|
|
35448
|
+
display: grid;
|
|
35449
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
35450
|
+
gap: 14px;
|
|
35451
|
+
padding: 0 clamp(20px, 5vw, 72px) clamp(36px, 6vw, 72px);
|
|
35452
|
+
}
|
|
35453
|
+
|
|
35454
|
+
.visual-strip .website-visual-frame {
|
|
35455
|
+
min-height: 260px;
|
|
35456
|
+
aspect-ratio: 16 / 9;
|
|
35457
|
+
}
|
|
35458
|
+
|
|
35377
35459
|
.panel-label {
|
|
35378
35460
|
color: var(--muted);
|
|
35379
35461
|
font-size: 0.86rem;
|
|
@@ -35570,8 +35652,16 @@ h1 {
|
|
|
35570
35652
|
min-height: 300px;
|
|
35571
35653
|
}
|
|
35572
35654
|
|
|
35655
|
+
.hero-visual,
|
|
35656
|
+
.profile-visual {
|
|
35657
|
+
width: 100%;
|
|
35658
|
+
min-height: 280px;
|
|
35659
|
+
aspect-ratio: 16 / 10;
|
|
35660
|
+
}
|
|
35661
|
+
|
|
35573
35662
|
.highlights,
|
|
35574
|
-
.stats
|
|
35663
|
+
.stats,
|
|
35664
|
+
.visual-strip {
|
|
35575
35665
|
grid-template-columns: 1fr;
|
|
35576
35666
|
}
|
|
35577
35667
|
|
|
@@ -35596,7 +35686,8 @@ async function buildGeneratedWebsite(options) {
|
|
|
35596
35686
|
const markup = (0, import_server.renderToStaticMarkup)(
|
|
35597
35687
|
import_react.default.createElement(WebsiteDocument, {
|
|
35598
35688
|
data: options.siteData,
|
|
35599
|
-
templateId: options.templateId
|
|
35689
|
+
templateId: options.templateId,
|
|
35690
|
+
generatedVisuals: options.generatedVisuals ?? []
|
|
35600
35691
|
})
|
|
35601
35692
|
);
|
|
35602
35693
|
await writeFile(
|
|
@@ -35608,6 +35699,7 @@ async function buildGeneratedWebsite(options) {
|
|
|
35608
35699
|
|
|
35609
35700
|
// src/commands/zero/built-in/generate/website.ts
|
|
35610
35701
|
var WEBSITE_TEMPLATES = ["auto", "launch", "profile"];
|
|
35702
|
+
var WEBSITE_MAX_IMAGES = 3;
|
|
35611
35703
|
function parseTemplate(value) {
|
|
35612
35704
|
if (WEBSITE_TEMPLATES.some((template) => {
|
|
35613
35705
|
return template === value;
|
|
@@ -35616,6 +35708,18 @@ function parseTemplate(value) {
|
|
|
35616
35708
|
}
|
|
35617
35709
|
throw new InvalidArgumentError("template must be auto, launch, or profile");
|
|
35618
35710
|
}
|
|
35711
|
+
function parseImageCount2(value) {
|
|
35712
|
+
const imageCount = Number(value);
|
|
35713
|
+
if (!Number.isInteger(imageCount)) {
|
|
35714
|
+
throw new InvalidArgumentError("images must be an integer");
|
|
35715
|
+
}
|
|
35716
|
+
if (!Number.isSafeInteger(imageCount) || imageCount < 0 || imageCount > WEBSITE_MAX_IMAGES) {
|
|
35717
|
+
throw new InvalidArgumentError(
|
|
35718
|
+
`images must be between 0 and ${WEBSITE_MAX_IMAGES}`
|
|
35719
|
+
);
|
|
35720
|
+
}
|
|
35721
|
+
return imageCount;
|
|
35722
|
+
}
|
|
35619
35723
|
function readPrompt4(options) {
|
|
35620
35724
|
if (options.prompt?.trim()) {
|
|
35621
35725
|
return options.prompt.trim();
|
|
@@ -35642,12 +35746,20 @@ var websiteCommand = new Command().name("website").description("Generate, build,
|
|
|
35642
35746
|
"Template: auto, launch, or profile",
|
|
35643
35747
|
parseTemplate,
|
|
35644
35748
|
"auto"
|
|
35749
|
+
).option(
|
|
35750
|
+
"--images <count>",
|
|
35751
|
+
`Generated website image count: 0-${WEBSITE_MAX_IMAGES}`,
|
|
35752
|
+
parseImageCount2,
|
|
35753
|
+
1
|
|
35754
|
+
).option(
|
|
35755
|
+
"--image-model <model>",
|
|
35756
|
+
"Image model for generated visuals (default: gpt-image-1): gpt-image-2, gpt-image-1.5, gpt-image-1, gpt-image-1-mini, flux-pro-1.1, flux-pro-1.1-ultra, qwen-image, or seedream4"
|
|
35645
35757
|
).option("--site <slug>", "Hosted site slug; defaults to the generated name").option("--title <text>", "Requested site title or name").option("--audience <text>", "Audience context").option("--keep-build-dir", "Keep the temporary static build directory").option("--json", "Print metadata as JSON").addHelpText(
|
|
35646
35758
|
"after",
|
|
35647
35759
|
`
|
|
35648
35760
|
Examples:
|
|
35649
35761
|
Generate site: zero built-in generate website --prompt "A launch site for a developer observability tool"
|
|
35650
|
-
Pick template: zero built-in generate website --template profile --prompt "Portfolio for a robotics photographer"
|
|
35762
|
+
Pick template: zero built-in generate website --template profile --images 2 --image-model gpt-image-1.5 --prompt "Portfolio for a robotics photographer"
|
|
35651
35763
|
Stable hosted slug: zero built-in generate website --site api-migration-demo --prompt "An internal migration microsite"
|
|
35652
35764
|
Pipe prompt: cat brief.txt | zero built-in generate website
|
|
35653
35765
|
|
|
@@ -35657,7 +35769,7 @@ Output:
|
|
|
35657
35769
|
Notes:
|
|
35658
35770
|
- Authenticates via ZERO_TOKEN (requires host:write capability)
|
|
35659
35771
|
- Charges org credits for model-generated website content
|
|
35660
|
-
- Uses OpenAI gpt-5.5
|
|
35772
|
+
- Uses OpenAI gpt-5.5 for website content and fal.ai for generated visuals`
|
|
35661
35773
|
).action(
|
|
35662
35774
|
withErrorHandler(async (options) => {
|
|
35663
35775
|
const prompt = readPrompt4(options);
|
|
@@ -35667,6 +35779,8 @@ Notes:
|
|
|
35667
35779
|
const generation = await generateWebWebsite({
|
|
35668
35780
|
prompt,
|
|
35669
35781
|
template: options.template,
|
|
35782
|
+
imageCount: options.images,
|
|
35783
|
+
imageModel: options.imageModel,
|
|
35670
35784
|
title: options.title,
|
|
35671
35785
|
audience: options.audience
|
|
35672
35786
|
});
|
|
@@ -35679,7 +35793,8 @@ Notes:
|
|
|
35679
35793
|
await buildGeneratedWebsite({
|
|
35680
35794
|
outDir,
|
|
35681
35795
|
templateId: generation.templateId,
|
|
35682
|
-
siteData: generation.siteData
|
|
35796
|
+
siteData: generation.siteData,
|
|
35797
|
+
generatedVisuals: generation.generatedVisuals
|
|
35683
35798
|
});
|
|
35684
35799
|
const site = options.site ?? generation.slugSuggestion;
|
|
35685
35800
|
const hosted = await publishStaticSite({
|
|
@@ -35706,7 +35821,12 @@ Notes:
|
|
|
35706
35821
|
fileCount: hosted.fileCount,
|
|
35707
35822
|
size: hosted.size,
|
|
35708
35823
|
creditsCharged: generation.creditsCharged,
|
|
35824
|
+
textCreditsCharged: generation.textCreditsCharged,
|
|
35825
|
+
imageCreditsCharged: generation.imageCreditsCharged,
|
|
35709
35826
|
model: generation.model,
|
|
35827
|
+
imageCount: generation.imageCount,
|
|
35828
|
+
imageModel: generation.imageModel,
|
|
35829
|
+
imageUrls: generation.imageUrls,
|
|
35710
35830
|
responseId: generation.responseId,
|
|
35711
35831
|
generationId: generation.generationId,
|
|
35712
35832
|
usage: generation.usage,
|
|
@@ -35722,9 +35842,17 @@ Notes:
|
|
|
35722
35842
|
console.log(source_default.dim(` Template: ${generation.templateLabel}`));
|
|
35723
35843
|
console.log(source_default.dim(` Files: ${hosted.fileCount.toLocaleString()}`));
|
|
35724
35844
|
console.log(source_default.dim(` Size: ${formatBytes(hosted.size)}`));
|
|
35845
|
+
console.log(source_default.dim(` Images: ${generation.imageCount}`));
|
|
35846
|
+
console.log(source_default.dim(` Image model: ${generation.imageModel}`));
|
|
35725
35847
|
console.log(
|
|
35726
35848
|
source_default.dim(` Credits charged: ${generation.creditsCharged}`)
|
|
35727
35849
|
);
|
|
35850
|
+
console.log(
|
|
35851
|
+
source_default.dim(` Text credits: ${generation.textCreditsCharged}`)
|
|
35852
|
+
);
|
|
35853
|
+
console.log(
|
|
35854
|
+
source_default.dim(` Image credits: ${generation.imageCreditsCharged}`)
|
|
35855
|
+
);
|
|
35728
35856
|
console.log(source_default.dim(` Model: ${generation.model}`));
|
|
35729
35857
|
if (options.keepBuildDir) {
|
|
35730
35858
|
console.log(source_default.dim(` Build dir: ${outDir}`));
|
|
@@ -36293,6 +36421,183 @@ Notes:
|
|
|
36293
36421
|
})
|
|
36294
36422
|
);
|
|
36295
36423
|
|
|
36424
|
+
// src/commands/zero/maps/index.ts
|
|
36425
|
+
init_esm_shims();
|
|
36426
|
+
var TRAVEL_MODES = ["driving", "walking", "bicycling", "transit"];
|
|
36427
|
+
var PLACE_DETAIL_FIELDSETS = ["essentials", "pro"];
|
|
36428
|
+
function parseLatitude(value) {
|
|
36429
|
+
const latitude = Number(value);
|
|
36430
|
+
if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90) {
|
|
36431
|
+
throw new InvalidArgumentError("latitude must be a number from -90 to 90");
|
|
36432
|
+
}
|
|
36433
|
+
return latitude;
|
|
36434
|
+
}
|
|
36435
|
+
function parseLongitude(value) {
|
|
36436
|
+
const longitude = Number(value);
|
|
36437
|
+
if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180) {
|
|
36438
|
+
throw new InvalidArgumentError(
|
|
36439
|
+
"longitude must be a number from -180 to 180"
|
|
36440
|
+
);
|
|
36441
|
+
}
|
|
36442
|
+
return longitude;
|
|
36443
|
+
}
|
|
36444
|
+
function parsePositiveInteger4(value) {
|
|
36445
|
+
const parsed = Number(value);
|
|
36446
|
+
if (!Number.isInteger(parsed) || parsed < 1) {
|
|
36447
|
+
throw new InvalidArgumentError("value must be a positive integer");
|
|
36448
|
+
}
|
|
36449
|
+
return parsed;
|
|
36450
|
+
}
|
|
36451
|
+
function parseLimit6(value) {
|
|
36452
|
+
const limit = parsePositiveInteger4(value);
|
|
36453
|
+
if (limit > 20) {
|
|
36454
|
+
throw new InvalidArgumentError("limit must be between 1 and 20");
|
|
36455
|
+
}
|
|
36456
|
+
return limit;
|
|
36457
|
+
}
|
|
36458
|
+
function parseTravelMode(value) {
|
|
36459
|
+
if (TRAVEL_MODES.includes(value)) {
|
|
36460
|
+
return value;
|
|
36461
|
+
}
|
|
36462
|
+
throw new InvalidArgumentError(
|
|
36463
|
+
`mode must be one of: ${TRAVEL_MODES.join(", ")}`
|
|
36464
|
+
);
|
|
36465
|
+
}
|
|
36466
|
+
function parsePlaceDetailFields(value) {
|
|
36467
|
+
if (PLACE_DETAIL_FIELDSETS.includes(value)) {
|
|
36468
|
+
return value;
|
|
36469
|
+
}
|
|
36470
|
+
throw new InvalidArgumentError(
|
|
36471
|
+
`fields must be one of: ${PLACE_DETAIL_FIELDSETS.join(", ")}`
|
|
36472
|
+
);
|
|
36473
|
+
}
|
|
36474
|
+
function renderMapsResponse(label, response) {
|
|
36475
|
+
console.log(source_default.green(`\u2713 ${label}`));
|
|
36476
|
+
if (response.provider) {
|
|
36477
|
+
console.log(source_default.dim(` Provider: ${response.provider}`));
|
|
36478
|
+
}
|
|
36479
|
+
if (response.billingCategory) {
|
|
36480
|
+
console.log(source_default.dim(` Billing category: ${response.billingCategory}`));
|
|
36481
|
+
}
|
|
36482
|
+
if (response.billingQuantity !== void 0) {
|
|
36483
|
+
console.log(source_default.dim(` Billing quantity: ${response.billingQuantity}`));
|
|
36484
|
+
}
|
|
36485
|
+
if (response.creditsCharged !== void 0) {
|
|
36486
|
+
console.log(source_default.dim(` Credits charged: ${response.creditsCharged}`));
|
|
36487
|
+
}
|
|
36488
|
+
const result = response.result ?? response;
|
|
36489
|
+
console.log(JSON.stringify(result, null, 2));
|
|
36490
|
+
}
|
|
36491
|
+
async function runMapsRequest(label, endpoint, payload, options) {
|
|
36492
|
+
const response = await callZeroMaps(endpoint, payload);
|
|
36493
|
+
if (options.json) {
|
|
36494
|
+
console.log(JSON.stringify(response));
|
|
36495
|
+
return;
|
|
36496
|
+
}
|
|
36497
|
+
renderMapsResponse(label, response);
|
|
36498
|
+
}
|
|
36499
|
+
var geocodeCommand = new Command().name("geocode").description("Convert an address into coordinates").requiredOption("--address <address>", "Address to geocode").option("--region <code>", "Optional region bias, such as US or CN").option("--json", "Print the raw maps response as JSON").action(
|
|
36500
|
+
withErrorHandler(async (options) => {
|
|
36501
|
+
await runMapsRequest(
|
|
36502
|
+
"Geocode completed",
|
|
36503
|
+
"geocode",
|
|
36504
|
+
{ address: options.address, region: options.region },
|
|
36505
|
+
options
|
|
36506
|
+
);
|
|
36507
|
+
})
|
|
36508
|
+
);
|
|
36509
|
+
var reverseGeocodeCommand = new Command().name("reverse-geocode").description("Convert coordinates into an address").requiredOption("--lat <number>", "Latitude", parseLatitude).requiredOption("--lng <number>", "Longitude", parseLongitude).option("--json", "Print the raw maps response as JSON").action(
|
|
36510
|
+
withErrorHandler(async (options) => {
|
|
36511
|
+
await runMapsRequest(
|
|
36512
|
+
"Reverse geocode completed",
|
|
36513
|
+
"reverse-geocode",
|
|
36514
|
+
{ lat: options.lat, lng: options.lng },
|
|
36515
|
+
options
|
|
36516
|
+
);
|
|
36517
|
+
})
|
|
36518
|
+
);
|
|
36519
|
+
var directionsCommand = new Command().name("directions").description("Get a route between two places").requiredOption(
|
|
36520
|
+
"--origin <place>",
|
|
36521
|
+
"Origin address, coordinates, or place ID"
|
|
36522
|
+
).requiredOption(
|
|
36523
|
+
"--destination <place>",
|
|
36524
|
+
"Destination address, coordinates, or place ID"
|
|
36525
|
+
).option(
|
|
36526
|
+
"--mode <mode>",
|
|
36527
|
+
"Travel mode: driving, walking, bicycling, or transit",
|
|
36528
|
+
parseTravelMode,
|
|
36529
|
+
"driving"
|
|
36530
|
+
).option("--departure-time <time>", "ISO departure time or provider keyword").option("--json", "Print the raw maps response as JSON").action(
|
|
36531
|
+
withErrorHandler(async (options) => {
|
|
36532
|
+
await runMapsRequest(
|
|
36533
|
+
"Directions completed",
|
|
36534
|
+
"directions",
|
|
36535
|
+
{
|
|
36536
|
+
origin: options.origin,
|
|
36537
|
+
destination: options.destination,
|
|
36538
|
+
mode: options.mode,
|
|
36539
|
+
departureTime: options.departureTime
|
|
36540
|
+
},
|
|
36541
|
+
options
|
|
36542
|
+
);
|
|
36543
|
+
})
|
|
36544
|
+
);
|
|
36545
|
+
var placesSearchCommand = new Command().name("search").description("Search for places").requiredOption("--query <query>", "Place search query").option("--location <lat,lng>", "Optional location bias").option(
|
|
36546
|
+
"--radius <meters>",
|
|
36547
|
+
"Optional search radius in meters",
|
|
36548
|
+
parsePositiveInteger4
|
|
36549
|
+
).option(
|
|
36550
|
+
"--limit <n>",
|
|
36551
|
+
"Maximum places to return, from 1 to 20",
|
|
36552
|
+
parseLimit6,
|
|
36553
|
+
5
|
|
36554
|
+
).option("--region <code>", "Optional region bias, such as US or CN").option("--json", "Print the raw maps response as JSON").action(
|
|
36555
|
+
withErrorHandler(async (options) => {
|
|
36556
|
+
await runMapsRequest(
|
|
36557
|
+
"Places search completed",
|
|
36558
|
+
"places/search",
|
|
36559
|
+
{
|
|
36560
|
+
query: options.query,
|
|
36561
|
+
location: options.location,
|
|
36562
|
+
radius: options.radius,
|
|
36563
|
+
limit: options.limit,
|
|
36564
|
+
region: options.region
|
|
36565
|
+
},
|
|
36566
|
+
options
|
|
36567
|
+
);
|
|
36568
|
+
})
|
|
36569
|
+
);
|
|
36570
|
+
var placesDetailsCommand = new Command().name("details").description("Get details for a place").requiredOption("--place-id <id>", "Provider place ID").option(
|
|
36571
|
+
"--fields <fields>",
|
|
36572
|
+
"Field set: essentials or pro",
|
|
36573
|
+
parsePlaceDetailFields,
|
|
36574
|
+
"essentials"
|
|
36575
|
+
).option("--json", "Print the raw maps response as JSON").action(
|
|
36576
|
+
withErrorHandler(async (options) => {
|
|
36577
|
+
await runMapsRequest(
|
|
36578
|
+
"Place details completed",
|
|
36579
|
+
"places/details",
|
|
36580
|
+
{ placeId: options.placeId, fields: options.fields },
|
|
36581
|
+
options
|
|
36582
|
+
);
|
|
36583
|
+
})
|
|
36584
|
+
);
|
|
36585
|
+
var placesCommand = new Command().name("places").description("Search places and fetch place details").addCommand(placesSearchCommand).addCommand(placesDetailsCommand);
|
|
36586
|
+
var zeroMapsCommand = new Command().name("maps").description("Use managed zero maps services").addCommand(geocodeCommand).addCommand(reverseGeocodeCommand).addCommand(directionsCommand).addCommand(placesCommand).addHelpText(
|
|
36587
|
+
"after",
|
|
36588
|
+
`
|
|
36589
|
+
Examples:
|
|
36590
|
+
Geocode address: zero maps geocode --address "1 Infinite Loop, Cupertino" --json
|
|
36591
|
+
Get route: zero maps directions --origin "SFO" --destination "Mountain View" --mode driving --json
|
|
36592
|
+
Search places: zero maps places search --query "coffee near Union Square SF" --limit 5 --json
|
|
36593
|
+
Place details: zero maps places details --place-id <id> --fields essentials --json
|
|
36594
|
+
|
|
36595
|
+
Notes:
|
|
36596
|
+
- Authenticates via ZERO_TOKEN (requires maps:read capability) or a CLI token
|
|
36597
|
+
- Google Maps calls and credit billing happen on the vm0 API server
|
|
36598
|
+
- Use --fields essentials for place details unless pro fields are required`
|
|
36599
|
+
);
|
|
36600
|
+
|
|
36296
36601
|
// src/commands/zero/model/index.ts
|
|
36297
36602
|
init_esm_shims();
|
|
36298
36603
|
|
|
@@ -36450,6 +36755,7 @@ var COMMAND_CAPABILITY_MAP = {
|
|
|
36450
36755
|
"built-in": "file:write",
|
|
36451
36756
|
web: null,
|
|
36452
36757
|
host: "host:write",
|
|
36758
|
+
maps: "maps:read",
|
|
36453
36759
|
"local-agent": ["local-agent:read", "local-agent:write"],
|
|
36454
36760
|
"local-browser": ["local-browser:read", "local-browser:write"]
|
|
36455
36761
|
};
|
|
@@ -36478,6 +36784,7 @@ var DEFAULT_COMMANDS = [
|
|
|
36478
36784
|
zeroBuiltInCommand,
|
|
36479
36785
|
zeroWebCommand,
|
|
36480
36786
|
zeroHostCommand,
|
|
36787
|
+
zeroMapsCommand,
|
|
36481
36788
|
zeroLocalAgentCommand,
|
|
36482
36789
|
zeroLocalBrowserCommand
|
|
36483
36790
|
];
|
|
@@ -36517,6 +36824,9 @@ function buildZeroHelpText(payload = decodeZeroTokenPayload()) {
|
|
|
36517
36824
|
" Generate voice? zero built-in generate voice --help",
|
|
36518
36825
|
...shouldHideCommand("local-browser", payload) ? [] : [" Read browser context? zero local-browser --help"],
|
|
36519
36826
|
...shouldHideCommand("host", payload) ? [] : [" Host a static site? zero host ./dist --site my-site --spa"],
|
|
36827
|
+
...shouldHideCommand("maps", payload) ? [] : [
|
|
36828
|
+
' Get directions? zero maps directions --origin "SFO" --destination "Mountain View" --json'
|
|
36829
|
+
],
|
|
36520
36830
|
" Check your identity? zero whoami"
|
|
36521
36831
|
];
|
|
36522
36832
|
return `
|
|
@@ -36534,7 +36844,7 @@ function registerZeroCommands(prog, commands) {
|
|
|
36534
36844
|
var program = new Command();
|
|
36535
36845
|
program.name("zero").description(
|
|
36536
36846
|
"Zero CLI \u2014 interact with the zero platform from inside the sandbox"
|
|
36537
|
-
).version("9.
|
|
36847
|
+
).version("9.160.1").addHelpText("after", () => {
|
|
36538
36848
|
return buildZeroHelpText();
|
|
36539
36849
|
});
|
|
36540
36850
|
if (process.argv[1]?.endsWith("zero.js") || process.argv[1]?.endsWith("zero.ts") || process.argv[1]?.endsWith("zero")) {
|