@bendyline/gezel-cli 1.2.9 → 1.2.10
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/bin/gezel-main.js +67 -27
- package/package.json +9 -9
package/dist/bin/gezel-main.js
CHANGED
|
@@ -967,7 +967,8 @@ async function waitForTask(client, ref, options) {
|
|
|
967
967
|
() => client.listQuestions(
|
|
968
968
|
{
|
|
969
969
|
projectId: task2.projectId,
|
|
970
|
-
pending: true
|
|
970
|
+
pending: true,
|
|
971
|
+
taskRefs: [...refs]
|
|
971
972
|
},
|
|
972
973
|
signal
|
|
973
974
|
)
|
|
@@ -1341,7 +1342,8 @@ function errorMessage(error) {
|
|
|
1341
1342
|
// src/settings-command.ts
|
|
1342
1343
|
import {
|
|
1343
1344
|
classifySecurityLevel,
|
|
1344
|
-
resolveSecurityPolicy
|
|
1345
|
+
resolveSecurityPolicy,
|
|
1346
|
+
securityCapabilitiesOf
|
|
1345
1347
|
} from "@bendyline/gezel";
|
|
1346
1348
|
var SECURITY_LEVEL_LABELS = {
|
|
1347
1349
|
"super-lockdown": "Super Lockdown",
|
|
@@ -1349,17 +1351,33 @@ var SECURITY_LEVEL_LABELS = {
|
|
|
1349
1351
|
free: "Unrestricted",
|
|
1350
1352
|
custom: "Custom"
|
|
1351
1353
|
};
|
|
1352
|
-
function
|
|
1353
|
-
const
|
|
1354
|
-
const caps = {
|
|
1355
|
-
allowFileEdits: current.allowFileEdits,
|
|
1356
|
-
allowExternalChat: current.allowExternalChat,
|
|
1357
|
-
allowExternalServices: enabled,
|
|
1358
|
-
allowScriptExecution: current.allowScriptExecution,
|
|
1359
|
-
allowAppNetwork: current.allowAppNetwork
|
|
1360
|
-
};
|
|
1354
|
+
function policyWithCapability(config, key, enabled) {
|
|
1355
|
+
const caps = { ...securityCapabilitiesOf(resolveSecurityPolicy(config)), [key]: enabled };
|
|
1361
1356
|
return { level: classifySecurityLevel(caps), ...caps };
|
|
1362
1357
|
}
|
|
1358
|
+
function policyWithExternalServices(config, enabled) {
|
|
1359
|
+
return policyWithCapability(config, "allowExternalServices", enabled);
|
|
1360
|
+
}
|
|
1361
|
+
var SECURITY_SWITCHES = [
|
|
1362
|
+
{
|
|
1363
|
+
command: "external-services",
|
|
1364
|
+
key: "allowExternalServices",
|
|
1365
|
+
label: "External services",
|
|
1366
|
+
description: "Show or set on/off for model-initiated external services, including web search"
|
|
1367
|
+
},
|
|
1368
|
+
{
|
|
1369
|
+
command: "run-package-scripts",
|
|
1370
|
+
key: "allowPackageScriptExecution",
|
|
1371
|
+
label: "Run package scripts",
|
|
1372
|
+
description: "Show or set on/off for gezels running package scripts and installed package binaries (outside the sandbox, with network access)"
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
command: "edit-package-scripts",
|
|
1376
|
+
key: "allowPackageScriptEdits",
|
|
1377
|
+
label: "Edit package scripts",
|
|
1378
|
+
description: "Show or set on/off for gezels adding or changing the scripts in package.json"
|
|
1379
|
+
}
|
|
1380
|
+
];
|
|
1363
1381
|
function enabledValue(state) {
|
|
1364
1382
|
if (state === void 0) return void 0;
|
|
1365
1383
|
if (state === "on") return true;
|
|
@@ -1367,19 +1385,24 @@ function enabledValue(state) {
|
|
|
1367
1385
|
throw new CliError("Use on or off.");
|
|
1368
1386
|
}
|
|
1369
1387
|
function registerSecurityCommands(program2, connect) {
|
|
1370
|
-
program2.command("security").description("Inspect or explicitly change security settings")
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1388
|
+
const security = program2.command("security").description("Inspect or explicitly change security settings");
|
|
1389
|
+
for (const setting of SECURITY_SWITCHES) {
|
|
1390
|
+
security.command(`${setting.command} [state]`).description(setting.description).option("--json", "Output the setting as JSON").action(async (state, options) => {
|
|
1391
|
+
const enabled = enabledValue(state);
|
|
1392
|
+
const client = await connect();
|
|
1393
|
+
const config = await client.getConfig();
|
|
1394
|
+
const policy = resolveSecurityPolicy(config);
|
|
1395
|
+
if (enabled !== void 0) {
|
|
1396
|
+
await client.updateConfig({
|
|
1397
|
+
securityPolicy: policyWithCapability(config, setting.key, enabled)
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
const value = enabled ?? policy[setting.key];
|
|
1401
|
+
console.log(
|
|
1402
|
+
options.json ? JSON.stringify({ [setting.key]: value }) : `${setting.label}: ${value ? "on" : "off"}`
|
|
1403
|
+
);
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1383
1406
|
}
|
|
1384
1407
|
function registerProjectSettingsCommands(env2, connect, projectFor) {
|
|
1385
1408
|
env2.command("indexing [state]").description("Show or set on/off for background workspace indexing in the current project").option("--json", "Output the project setting as JSON").action(async (state, options) => {
|
|
@@ -1404,7 +1427,8 @@ var ENGINE_BINARY = {
|
|
|
1404
1427
|
};
|
|
1405
1428
|
async function ensureCraftbookSetup(client, options) {
|
|
1406
1429
|
const services = options.needs.services ?? [];
|
|
1407
|
-
|
|
1430
|
+
const commands = options.needs.commands ?? [];
|
|
1431
|
+
if (!options.needs.models?.length && services.length === 0 && commands.length === 0) return;
|
|
1408
1432
|
const config = await client.getConfig();
|
|
1409
1433
|
const models = resolveCraftbookModelNeeds(options.needs.models, {
|
|
1410
1434
|
...options.params ? { params: options.params } : {},
|
|
@@ -1412,7 +1436,7 @@ async function ensureCraftbookSetup(client, options) {
|
|
|
1412
1436
|
defaultProvider: defaultModelEngine(config, options.platform, options.arch)
|
|
1413
1437
|
});
|
|
1414
1438
|
const gaps = craftbookSetupGaps(
|
|
1415
|
-
{ services, models },
|
|
1439
|
+
{ services, models, commands },
|
|
1416
1440
|
await readSetupState(client, config, models)
|
|
1417
1441
|
);
|
|
1418
1442
|
if (gaps.length === 0) return;
|
|
@@ -1455,6 +1479,18 @@ ${lines.join("\n")}
|
|
|
1455
1479
|
if (!yes) stop(gap);
|
|
1456
1480
|
await client.updateConfig({ securityPolicy: next });
|
|
1457
1481
|
options.write("External services: on\n");
|
|
1482
|
+
} else if (gap.kind === "package-scripts") {
|
|
1483
|
+
const current = await client.getConfig();
|
|
1484
|
+
const next = policyWithCapability(current, "allowPackageScriptExecution", true);
|
|
1485
|
+
const from = SECURITY_LEVEL_LABELS[resolveSecurityPolicy2(current).level];
|
|
1486
|
+
const to = SECURITY_LEVEL_LABELS[next.level];
|
|
1487
|
+
const change = from === to ? "" : ` This changes your security level from ${from} to ${to}.`;
|
|
1488
|
+
const yes = await prompter.confirm(
|
|
1489
|
+
`Let gezels run package scripts such as ${gap.commands[0]}? They run outside the sandbox, as your account, with network access, and Gezel asks before each new command.${change} [y/N] `
|
|
1490
|
+
);
|
|
1491
|
+
if (!yes) stop(gap);
|
|
1492
|
+
await client.updateConfig({ securityPolicy: next });
|
|
1493
|
+
options.write("Run package scripts: on\n");
|
|
1458
1494
|
} else if (gap.kind === "web-search") {
|
|
1459
1495
|
if (gap.keyMissing) {
|
|
1460
1496
|
options.write(
|
|
@@ -1504,7 +1540,7 @@ ${lines.join("\n")}
|
|
|
1504
1540
|
for (const gap of downloads) await pullChatModel(client, gap.provider, gap.id, options.write);
|
|
1505
1541
|
}
|
|
1506
1542
|
const after = craftbookSetupGaps(
|
|
1507
|
-
{ services, models },
|
|
1543
|
+
{ services, models, commands },
|
|
1508
1544
|
await readSetupState(client, await client.getConfig(), models)
|
|
1509
1545
|
);
|
|
1510
1546
|
if (after.length > 0) {
|
|
@@ -1607,6 +1643,7 @@ async function readSetupState(client, config, models) {
|
|
|
1607
1643
|
);
|
|
1608
1644
|
return {
|
|
1609
1645
|
allowExternalServices: resolveSecurityPolicy2(config).allowExternalServices,
|
|
1646
|
+
allowPackageScriptExecution: resolveSecurityPolicy2(config).allowPackageScriptExecution,
|
|
1610
1647
|
...config.webSearch?.provider ? { webSearchProvider: config.webSearch.provider } : {},
|
|
1611
1648
|
hasBraveSearchApiKey: config.hasBraveSearchApiKey === true,
|
|
1612
1649
|
installedModels: Object.fromEntries(installed)
|
|
@@ -1642,6 +1679,8 @@ function describeGap(gap, sizes) {
|
|
|
1642
1679
|
switch (gap.kind) {
|
|
1643
1680
|
case "external-services":
|
|
1644
1681
|
return `External services are off, so gezels cannot reach the web${why}.`;
|
|
1682
|
+
case "package-scripts":
|
|
1683
|
+
return `Run package scripts is off, so gezels cannot run ${gap.commands.join(", ")}${why}.`;
|
|
1645
1684
|
case "web-search":
|
|
1646
1685
|
return gap.keyMissing ? `Web search needs a Brave Search API key, and none is set${why}.` : `Web search is not set to Brave Search${why}.`;
|
|
1647
1686
|
case "model": {
|
|
@@ -1654,6 +1693,7 @@ function instructions(gaps) {
|
|
|
1654
1693
|
const out = [];
|
|
1655
1694
|
for (const gap of gaps) {
|
|
1656
1695
|
if (gap.kind === "external-services") out.push("gezel security external-services on");
|
|
1696
|
+
else if (gap.kind === "package-scripts") out.push("gezel security run-package-scripts on");
|
|
1657
1697
|
else if (gap.kind === "web-search")
|
|
1658
1698
|
out.push(
|
|
1659
1699
|
`gezel secret set braveSearchApiKey --env BRAVE_SEARCH_API_KEY --use-for-search (get a key at ${BRAVE_KEY_URL})`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/gezel-cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.10",
|
|
4
4
|
"description": "The gezel command-line tool: chat with your gezels, run craftbooks, and manage local models from the terminal.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"!dist/**/*.map"
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@bendyline/gezel": "1.2.
|
|
48
|
-
"@bendyline/gezel-app-sdk": "1.1.
|
|
49
|
-
"@bendyline/gezel-catalog": "1.2.
|
|
50
|
-
"@bendyline/gezel-client": "1.2.
|
|
47
|
+
"@bendyline/gezel": "1.2.10",
|
|
48
|
+
"@bendyline/gezel-app-sdk": "1.1.10",
|
|
49
|
+
"@bendyline/gezel-catalog": "1.2.10",
|
|
50
|
+
"@bendyline/gezel-client": "1.2.10",
|
|
51
51
|
"@bendyline/gezel-knowledge": "1.2.9",
|
|
52
|
-
"@bendyline/gezel-service": "1.2.
|
|
53
|
-
"@bendyline/squisq": "2.13.
|
|
54
|
-
"@bendyline/squisq-formats": "2.8.
|
|
55
|
-
"@bendyline/squisq-react": "2.12.
|
|
52
|
+
"@bendyline/gezel-service": "1.2.10",
|
|
53
|
+
"@bendyline/squisq": "2.13.5",
|
|
54
|
+
"@bendyline/squisq-formats": "2.8.6",
|
|
55
|
+
"@bendyline/squisq-react": "2.12.15",
|
|
56
56
|
"commander": "^15.0.0",
|
|
57
57
|
"ink": "^7.1.1",
|
|
58
58
|
"ink-text-input": "^6.0.0",
|