@aopslabs/aops 0.3.0 → 0.3.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/dist/commands/host.js +16 -67
- package/dist/main.js +70 -7
- package/native/tui/win32-x64/aops-tui.exe +0 -0
- package/package.json +5 -3
package/dist/commands/host.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
5
|
import { Command } from 'commander';
|
|
6
6
|
import { banner, logError, logInfo, logSuccess } from '@aopslabs/xf-cli-ui';
|
|
7
|
-
import { getHostRegistrationsDir, listInstalledHostRegistrations,
|
|
7
|
+
import { getHostRegistrationsDir, listInstalledHostRegistrations, mergeHostRegistrationsIntoConfig, unregisterHostRegistration, } from '@aopslabs/aops-host-registration';
|
|
8
8
|
import { getAopsServerEnvPath, inferAopsRepoDialect, readAopsServerEnvConfig, redactAopsRepoUrl, writeAopsServerEnvConfig, } from '@aopslabs/aops-runtime-config';
|
|
9
9
|
import { createCliApiClientFromOptions, fetchCliHealth } from '../utils/api.js';
|
|
10
10
|
import { applyCommonOptions, compactPayload } from '../utils/command.js';
|
|
@@ -325,71 +325,20 @@ function printHostRegistrationResult(payload, options) {
|
|
|
325
325
|
}
|
|
326
326
|
console.log(JSON.stringify(payload, null, 2));
|
|
327
327
|
}
|
|
328
|
-
function requireCommunityRegistrationJsonPath(options) {
|
|
329
|
-
const from = options.from?.trim();
|
|
330
|
-
if (!from)
|
|
331
|
-
throw new Error('Missing registration source. Use --from /path/to/host-registration.json.');
|
|
332
|
-
const filePath = path.resolve(process.cwd(), from);
|
|
333
|
-
if (path.extname(filePath).toLowerCase() !== '.json') {
|
|
334
|
-
throw new Error('Community host registration accepts JSON files only.');
|
|
335
|
-
}
|
|
336
|
-
const stats = fs.lstatSync(filePath);
|
|
337
|
-
if (!stats.isFile() || stats.isSymbolicLink()) {
|
|
338
|
-
throw new Error(`Community host registration must be a regular JSON file: ${filePath}`);
|
|
339
|
-
}
|
|
340
|
-
return fs.realpathSync(filePath);
|
|
341
|
-
}
|
|
342
|
-
function loadCommunityHostRegistrationJson(filePath) {
|
|
343
|
-
let parsed;
|
|
344
|
-
try {
|
|
345
|
-
parsed = JSON.parse(fs.readFileSync(filePath, 'utf8'));
|
|
346
|
-
}
|
|
347
|
-
catch (error) {
|
|
348
|
-
throw new Error(`Host registration JSON parse failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
349
|
-
}
|
|
350
|
-
const materialized = materializeHostRegistrationManifest(normalizeHostRegistrationManifest(parsed), path.dirname(filePath));
|
|
351
|
-
return normalizeHostRegistrationManifest({
|
|
352
|
-
...materialized,
|
|
353
|
-
provenance: {
|
|
354
|
-
...materialized.provenance,
|
|
355
|
-
source: filePath,
|
|
356
|
-
sourceType: 'file',
|
|
357
|
-
registeredAt: new Date().toISOString(),
|
|
358
|
-
},
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
328
|
export async function runHostRegister(options = {}) {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
});
|
|
376
|
-
if (!options.json)
|
|
377
|
-
logSuccess(`Registered ${manifest.domain}.`);
|
|
378
|
-
printHostRegistrationResult({
|
|
379
|
-
ok: true,
|
|
380
|
-
domain: manifest.domain,
|
|
381
|
-
displayName: manifest.displayName ?? null,
|
|
382
|
-
packageName: manifest.packageName ?? null,
|
|
383
|
-
filePath,
|
|
384
|
-
registrationsDir,
|
|
385
|
-
manifest,
|
|
386
|
-
}, options);
|
|
387
|
-
}
|
|
388
|
-
catch (error) {
|
|
389
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
390
|
-
logError(`Registration failed: ${message}`);
|
|
391
|
-
process.exitCode = 1;
|
|
392
|
-
}
|
|
329
|
+
const unsupported = {
|
|
330
|
+
ok: false,
|
|
331
|
+
schemaVersion: 1,
|
|
332
|
+
error: 'commercial_profile_required',
|
|
333
|
+
profile: 'trusted-local',
|
|
334
|
+
action: 'host.register',
|
|
335
|
+
message: 'External domain registration is not available in the public trusted-local profile.',
|
|
336
|
+
};
|
|
337
|
+
if (options.json)
|
|
338
|
+
console.log(JSON.stringify(unsupported, null, 2));
|
|
339
|
+
else
|
|
340
|
+
logError(`${unsupported.error}: ${unsupported.message}`);
|
|
341
|
+
process.exitCode = 1;
|
|
393
342
|
}
|
|
394
343
|
export async function runHostRegistrations(options = {}) {
|
|
395
344
|
const interactive = !options.yes && !options.json;
|
|
@@ -995,8 +944,8 @@ export function makeHostCommand() {
|
|
|
995
944
|
}), { withAuth: false, withProject: false });
|
|
996
945
|
applyHostRegistrationOptions(applyCommonOptions(cmd
|
|
997
946
|
.command('register')
|
|
998
|
-
.description('
|
|
999
|
-
.
|
|
947
|
+
.description('Return commercial_profile_required; external domains are disabled in trusted-local')
|
|
948
|
+
.option('--from <path>', 'Ignored registration source; retained only for a stable refusal contract')
|
|
1000
949
|
.action(async (options) => {
|
|
1001
950
|
await runHostRegister(options);
|
|
1002
951
|
}), { withAuth: false, withProject: false }));
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { createCliProgram, runCli } from '@aopslabs/cli-kit';
|
|
3
4
|
import { logError } from '@aopslabs/xf-cli-ui';
|
|
4
5
|
import { resolveCommunityCliIdentity } from './lib/community-client-contract.js';
|
|
5
6
|
import { makeInitCommand } from './commands/init.js';
|
|
@@ -28,7 +29,6 @@ import { makeMissionCommand } from './commands/mission.js';
|
|
|
28
29
|
import { makePlaybookCommand } from './commands/playbook.js';
|
|
29
30
|
import { makeResourceCommand } from './commands/resource.js';
|
|
30
31
|
import { makeArtifactCommand } from './commands/artifact.js';
|
|
31
|
-
import { makeCommercialLicenseCommand } from './commands/commercial-license.js';
|
|
32
32
|
import { makeActivityCommand } from './commands/activity.js';
|
|
33
33
|
import { makeSkillCommand } from './commands/skill.js';
|
|
34
34
|
import { makeDocCommand } from './commands/doc.js';
|
|
@@ -40,6 +40,61 @@ import { makeTargetCommand } from './commands/target.js';
|
|
|
40
40
|
import { makeVersionCommand } from './commands/version.js';
|
|
41
41
|
import { launchBundledTui, shouldLaunchBundledTui } from './lib/tui-launcher.js';
|
|
42
42
|
import { CommunityDiagnosticError, formatCommunityDiagnostic, } from './lib/community-diagnostic.js';
|
|
43
|
+
import { resolveCliApiBaseUrl } from './utils/api.js';
|
|
44
|
+
const KERNEL_COMMANDS_REPLACED_BY_AOPS = new Set(['agent', 'api', 'auth', 'client', 'host']);
|
|
45
|
+
function removeReplacedKernelCommands(program) {
|
|
46
|
+
const mutable = program;
|
|
47
|
+
mutable.commands = mutable.commands.filter((command) => !KERNEL_COMMANDS_REPLACED_BY_AOPS.has(command.name()));
|
|
48
|
+
}
|
|
49
|
+
function renderTrustedLocalLicenseStatus(command) {
|
|
50
|
+
const payload = {
|
|
51
|
+
ok: true,
|
|
52
|
+
schemaVersion: 1,
|
|
53
|
+
contract: 'aops-trusted-local-license-status-v1',
|
|
54
|
+
profile: 'trusted-local',
|
|
55
|
+
commercialAvailable: false,
|
|
56
|
+
southRequired: false,
|
|
57
|
+
builtInDomains: ['agentspace', 'chatv3', 'docman', 'projectman', 'sys'],
|
|
58
|
+
next: 'South-backed licensing and external domains are not available in this public profile.',
|
|
59
|
+
};
|
|
60
|
+
const json = command.optsWithGlobals().json === true;
|
|
61
|
+
process.stdout.write(`${JSON.stringify(payload, null, json ? 0 : 2)}\n`);
|
|
62
|
+
}
|
|
63
|
+
function refuseTrustedLocalCommercialActivation(command) {
|
|
64
|
+
const payload = {
|
|
65
|
+
ok: false,
|
|
66
|
+
schemaVersion: 1,
|
|
67
|
+
error: 'commercial_profile_required',
|
|
68
|
+
profile: 'trusted-local',
|
|
69
|
+
action: 'license.activate',
|
|
70
|
+
message: 'South-backed licensing is not available in the public trusted-local profile.',
|
|
71
|
+
};
|
|
72
|
+
const json = command.optsWithGlobals().json === true;
|
|
73
|
+
const output = `${JSON.stringify(payload, null, json ? 0 : 2)}\n`;
|
|
74
|
+
if (json)
|
|
75
|
+
process.stdout.write(output);
|
|
76
|
+
else
|
|
77
|
+
process.stderr.write(output);
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
}
|
|
80
|
+
function makeTrustedLocalLicenseCommand() {
|
|
81
|
+
const command = new Command('license')
|
|
82
|
+
.description('Inspect the public trusted-local license profile; commercial activation is unavailable');
|
|
83
|
+
command
|
|
84
|
+
.command('status')
|
|
85
|
+
.description('Show the free built-in domain profile')
|
|
86
|
+
.option('--json', 'Emit compact JSON')
|
|
87
|
+
.action((_options, actionCommand) => renderTrustedLocalLicenseStatus(actionCommand));
|
|
88
|
+
command
|
|
89
|
+
.command('activate')
|
|
90
|
+
.description('Return commercial_profile_required without accepting commercial evidence')
|
|
91
|
+
.allowUnknownOption(true)
|
|
92
|
+
.allowExcessArguments(true)
|
|
93
|
+
.argument('[args...]')
|
|
94
|
+
.option('--json', 'Emit compact JSON')
|
|
95
|
+
.action((_args, _options, actionCommand) => refuseTrustedLocalCommercialActivation(actionCommand));
|
|
96
|
+
return command;
|
|
97
|
+
}
|
|
43
98
|
for (const stream of [process.stdout, process.stderr]) {
|
|
44
99
|
stream.on('error', (error) => {
|
|
45
100
|
if (error?.code === 'EPIPE') {
|
|
@@ -49,13 +104,18 @@ for (const stream of [process.stdout, process.stderr]) {
|
|
|
49
104
|
});
|
|
50
105
|
}
|
|
51
106
|
export function buildCommunityProgram() {
|
|
52
|
-
const program = new Command();
|
|
53
107
|
const version = resolveCommunityCliIdentity().version;
|
|
108
|
+
const program = createCliProgram({
|
|
109
|
+
name: 'aops',
|
|
110
|
+
version,
|
|
111
|
+
description: 'AOPS Community operator CLI for local-trusted, self-hosted workflows',
|
|
112
|
+
brand: 'aops',
|
|
113
|
+
defaultApiBaseUrl: resolveCliApiBaseUrl(),
|
|
114
|
+
moduleSearchRoot: process.cwd(),
|
|
115
|
+
});
|
|
116
|
+
removeReplacedKernelCommands(program);
|
|
54
117
|
program
|
|
55
|
-
.name('aops')
|
|
56
|
-
.description('AOPS Community operator CLI for local-trusted, self-hosted workflows')
|
|
57
118
|
.enablePositionalOptions()
|
|
58
|
-
.version(version)
|
|
59
119
|
.version(version, '--cli-version', 'output the CLI version (legacy alias)');
|
|
60
120
|
program.addCommand(makeInitCommand());
|
|
61
121
|
program.addCommand(makeCommunitySetupCommand());
|
|
@@ -83,7 +143,7 @@ export function buildCommunityProgram() {
|
|
|
83
143
|
program.addCommand(makePlaybookCommand());
|
|
84
144
|
program.addCommand(makeResourceCommand());
|
|
85
145
|
program.addCommand(makeArtifactCommand());
|
|
86
|
-
program.addCommand(
|
|
146
|
+
program.addCommand(makeTrustedLocalLicenseCommand());
|
|
87
147
|
program.addCommand(makeActivityCommand());
|
|
88
148
|
program.addCommand(makeSkillCommand());
|
|
89
149
|
program.addCommand(makeDocCommand());
|
|
@@ -124,7 +184,10 @@ async function main() {
|
|
|
124
184
|
: process.argv;
|
|
125
185
|
guardChatv3UnknownSubcommand(argv);
|
|
126
186
|
guardCommunitySecretArgv(argv);
|
|
127
|
-
|
|
187
|
+
const kernelArgv = argv.includes('--no-client-plugin')
|
|
188
|
+
? argv
|
|
189
|
+
: [argv[0], argv[1], '--no-client-plugin', ...argv.slice(2)];
|
|
190
|
+
await runCli(program, kernelArgv);
|
|
128
191
|
}
|
|
129
192
|
catch (error) {
|
|
130
193
|
if (error instanceof CommunityDiagnosticError) {
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aopslabs/aops",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AOPS CLI and terminal setup application.",
|
|
6
|
-
"aopsDockerServerVersion": "0.2.
|
|
6
|
+
"aopsDockerServerVersion": "0.2.3",
|
|
7
7
|
"license": "SEE LICENSE IN LICENSE",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"test:r6-cutover-baseline": "node scripts/verify-r6-cutover-baseline.mjs",
|
|
48
48
|
"test:r6-auth-cutover": "node --test test/r6-auth-cutover.test.mjs",
|
|
49
49
|
"test:container-runtime": "node --test test/container-runtime.test.mjs",
|
|
50
|
+
"test:kernel-alignment": "node --test test/kernel-alignment.test.mjs",
|
|
50
51
|
"test:home": "node --test test/home-menu.test.mjs",
|
|
51
52
|
"test:launchers": "node --test test/terminal-launchers.test.mjs",
|
|
52
53
|
"test:shortcuts": "pnpm run test:home && pnpm run test:cockpit && pnpm run test:launchers && pnpm run test:assets-menu && pnpm run test:agent-assets-content && pnpm run test:setup-install && pnpm run test:container-runtime && pnpm run test:native-lifecycle && pnpm run test:operation-journal && pnpm run test:commercial-canonical-order && pnpm run test:commercial-runtime-closure && pnpm run test:commercial-artifact && pnpm run test:commercial-final-readiness && pnpm run test:commercial-admission && pnpm run test:commercial-license && pnpm run test:commercial-runbook && pnpm run test:package-identity && pnpm run test:skill-discovery && pnpm run test:target-transport && pnpm run test:target-auth && pnpm run test:r6-auth-cutover && pnpm run test:r6-cutover-baseline",
|
|
@@ -54,7 +55,8 @@
|
|
|
54
55
|
"start": "node dist/main.js"
|
|
55
56
|
},
|
|
56
57
|
"dependencies": {
|
|
57
|
-
"@aopslabs/artifact-trust-contracts": "0.
|
|
58
|
+
"@aopslabs/artifact-trust-contracts": "0.3.0",
|
|
59
|
+
"@aopslabs/cli-kit": "0.1.0",
|
|
58
60
|
"@aopslabs/aops-host-registration": "0.2.0",
|
|
59
61
|
"@aopslabs/aops-pg-bootstrap": "0.2.0",
|
|
60
62
|
"@aopslabs/aops-runtime-config": "0.2.0",
|