@orchagent/cli 0.3.75 → 0.3.77
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/commands/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerCommands = registerCommands;
|
|
4
4
|
const login_1 = require("./login");
|
|
5
|
+
const logout_1 = require("./logout");
|
|
5
6
|
const call_1 = require("./call");
|
|
6
7
|
const agents_1 = require("./agents");
|
|
7
8
|
const init_1 = require("./init");
|
|
@@ -37,6 +38,7 @@ const logs_1 = require("./logs");
|
|
|
37
38
|
const secrets_1 = require("./secrets");
|
|
38
39
|
function registerCommands(program) {
|
|
39
40
|
(0, login_1.registerLoginCommand)(program);
|
|
41
|
+
(0, logout_1.registerLogoutCommand)(program);
|
|
40
42
|
(0, whoami_1.registerWhoamiCommand)(program);
|
|
41
43
|
(0, init_1.registerInitCommand)(program);
|
|
42
44
|
(0, publish_1.registerPublishCommand)(program);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerLogoutCommand = registerLogoutCommand;
|
|
4
|
+
const config_1 = require("../lib/config");
|
|
5
|
+
const api_1 = require("../lib/api");
|
|
6
|
+
const analytics_1 = require("../lib/analytics");
|
|
7
|
+
function registerLogoutCommand(program) {
|
|
8
|
+
program
|
|
9
|
+
.command('logout')
|
|
10
|
+
.description('Log out of orchagent (revokes API key and clears local credentials)')
|
|
11
|
+
.action(async () => {
|
|
12
|
+
const config = await (0, config_1.loadConfig)();
|
|
13
|
+
// Check if already logged out
|
|
14
|
+
if (!config.api_key && !process.env.ORCHAGENT_API_KEY) {
|
|
15
|
+
process.stdout.write('Not logged in.\n');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const resolved = await (0, config_1.getResolvedConfig)();
|
|
19
|
+
// Best-effort server-side key revocation (Vercel/Fly pattern)
|
|
20
|
+
if (resolved.apiKey) {
|
|
21
|
+
try {
|
|
22
|
+
await (0, api_1.safeFetch)(`${resolved.apiUrl}/auth/cli-logout`, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${resolved.apiKey}`,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// Network errors, server down, etc. — proceed with local cleanup
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Clear auth fields but preserve user preferences
|
|
34
|
+
delete config.api_key;
|
|
35
|
+
delete config.default_org;
|
|
36
|
+
delete config.workspace;
|
|
37
|
+
await (0, config_1.saveConfig)(config);
|
|
38
|
+
await (0, analytics_1.track)('cli_logout', {});
|
|
39
|
+
process.stdout.write('Logged out.\n');
|
|
40
|
+
// Warn if env var is still set (GitHub CLI / Fly.io pattern)
|
|
41
|
+
if (process.env.ORCHAGENT_API_KEY) {
|
|
42
|
+
process.stderr.write('\nWarning: ORCHAGENT_API_KEY is set in your environment.\n' +
|
|
43
|
+
'The env var will still authenticate requests. Unset it with:\n' +
|
|
44
|
+
' unset ORCHAGENT_API_KEY\n');
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/commands/publish.js
CHANGED
|
@@ -360,6 +360,7 @@ function registerPublishCommand(program) {
|
|
|
360
360
|
.option('--skills-locked', 'Lock default skills (callers cannot override via headers)')
|
|
361
361
|
.option('--docker', 'Include Dockerfile for custom environment (builds E2B template)')
|
|
362
362
|
.option('--local-download', 'Allow users to download and run locally (default: server-only)')
|
|
363
|
+
.option('--no-required-secrets', 'Skip required_secrets check for tool/agent types')
|
|
363
364
|
.action(async (options) => {
|
|
364
365
|
const skillsFromFlag = options.skills
|
|
365
366
|
? options.skills.split(',').map(s => s.trim()).filter(Boolean)
|
|
@@ -820,6 +821,19 @@ function registerPublishCommand(program) {
|
|
|
820
821
|
` (Platform-injected vars like LLM API keys are already excluded.)\n\n`);
|
|
821
822
|
}
|
|
822
823
|
}
|
|
824
|
+
// C-1: Block publish if tool/agent type has no required_secrets declared.
|
|
825
|
+
// Prompt and skill types are exempt (prompt agents get LLM keys from platform,
|
|
826
|
+
// skills don't run standalone).
|
|
827
|
+
if ((canonicalType === 'tool' || canonicalType === 'agent') &&
|
|
828
|
+
(!manifest.required_secrets || manifest.required_secrets.length === 0) &&
|
|
829
|
+
options.requiredSecrets !== false) {
|
|
830
|
+
process.stderr.write(chalk_1.default.red(`\nError: ${canonicalType} agents must declare required_secrets in orchagent.json.\n\n`) +
|
|
831
|
+
` Add the env vars your code needs at runtime:\n` +
|
|
832
|
+
` ${chalk_1.default.cyan('"required_secrets": ["ANTHROPIC_API_KEY", "MY_TOKEN"]')}\n\n` +
|
|
833
|
+
` These are matched by name against your workspace secrets vault.\n` +
|
|
834
|
+
` Use ${chalk_1.default.cyan('--no-required-secrets')} to skip this check.\n`);
|
|
835
|
+
throw new errors_1.CliError('Missing required_secrets declaration', errors_1.ExitCodes.INVALID_INPUT);
|
|
836
|
+
}
|
|
823
837
|
// Create the agent (server auto-assigns version)
|
|
824
838
|
let result;
|
|
825
839
|
try {
|
package/dist/commands/service.js
CHANGED
|
@@ -147,6 +147,13 @@ function registerServiceCommand(program) {
|
|
|
147
147
|
spinner.fail('Failed to resolve agent');
|
|
148
148
|
throw e;
|
|
149
149
|
}
|
|
150
|
+
// C-2: Show deprecation notice when --secret is used
|
|
151
|
+
if (options.secret.length > 0) {
|
|
152
|
+
process.stderr.write(chalk_1.default.yellow(`\nTip: `) +
|
|
153
|
+
`Declare secrets in orchagent.json ${chalk_1.default.cyan('required_secrets')} instead.\n` +
|
|
154
|
+
`They'll be auto-injected from your workspace vault at deploy time.\n` +
|
|
155
|
+
`The ${chalk_1.default.cyan('--secret')} flag is for extras not declared on the agent.\n\n`);
|
|
156
|
+
}
|
|
150
157
|
const deploySpinner = (0, spinner_1.createSpinner)('Deploying service...');
|
|
151
158
|
deploySpinner.start();
|
|
152
159
|
try {
|
package/package.json
CHANGED