@aopslabs/aops 0.2.0
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/LICENSE +19 -0
- package/NOTICE +7 -0
- package/README.md +203 -0
- package/assets/agent-assets/core/SKILL.md +49 -0
- package/assets/agent-assets/core/references/agentspace/SKILL.md +78 -0
- package/assets/agent-assets/core/references/aops-cli-core/SKILL.md +108 -0
- package/assets/agent-assets/core/references/chatv3/SKILL.md +48 -0
- package/assets/agent-assets/core/references/collaborative-work/SKILL.md +85 -0
- package/assets/agent-assets/core/references/discuss/SKILL.md +66 -0
- package/assets/agent-assets/core/references/docman/SKILL.md +69 -0
- package/assets/agent-assets/core/references/hosted-chat/SKILL.md +64 -0
- package/assets/agent-assets/core/references/mission/SKILL.md +54 -0
- package/assets/agent-assets/core/references/projectman/SKILL.md +86 -0
- package/assets/agent-assets/core/references/sys/SKILL.md +36 -0
- package/assets/agent-assets/core/references/view/SKILL.md +58 -0
- package/assets/agent-assets/core/references/working-disciplines/SKILL.md +69 -0
- package/assets/agent-assets/core/user-guides/agent-assets.md +81 -0
- package/assets/agent-assets/core/user-guides/agentspace.md +1098 -0
- package/assets/agent-assets/core/user-guides/aops-cli.md +1107 -0
- package/assets/agent-assets/core/user-guides/aops-system.md +63 -0
- package/assets/agent-assets/core/user-guides/chatv3.md +113 -0
- package/assets/agent-assets/core/user-guides/docman.md +162 -0
- package/assets/agent-assets/core/user-guides/projectman.md +212 -0
- package/assets/agent-assets/core/user-guides/sys.md +94 -0
- package/assets/agent-assets/core/user-guides/working-disciplines.md +588 -0
- package/assets/agent-assets/gateway/aops/SKILL.md +14 -0
- package/assets/r6-remote-session-baseline.json +19 -0
- package/assets/skills/aops-install/SKILL.md +231 -0
- package/assets/skills/aops-install/agents/openai.yaml +4 -0
- package/dist/commands/activity.js +352 -0
- package/dist/commands/agent-profile.js +653 -0
- package/dist/commands/agent.js +710 -0
- package/dist/commands/agents-md.js +125 -0
- package/dist/commands/api.js +84 -0
- package/dist/commands/archive.js +873 -0
- package/dist/commands/artifact.js +535 -0
- package/dist/commands/assets.js +1414 -0
- package/dist/commands/auth/device-login.js +1 -0
- package/dist/commands/auth/legacy-export.js +177 -0
- package/dist/commands/auth/login.js +426 -0
- package/dist/commands/chat.js +1363 -0
- package/dist/commands/chatv3.js +1684 -0
- package/dist/commands/checkpoint.js +549 -0
- package/dist/commands/commercial-artifact.js +475 -0
- package/dist/commands/commercial-license.js +594 -0
- package/dist/commands/community-auth.js +62 -0
- package/dist/commands/community-cockpit.js +185 -0
- package/dist/commands/community-console.js +109 -0
- package/dist/commands/community-doctor.js +335 -0
- package/dist/commands/community-server.js +2062 -0
- package/dist/commands/community-setup.js +284 -0
- package/dist/commands/discuss.js +1448 -0
- package/dist/commands/doc.js +5219 -0
- package/dist/commands/experience.js +922 -0
- package/dist/commands/host.js +1127 -0
- package/dist/commands/init.js +118 -0
- package/dist/commands/memory.js +3129 -0
- package/dist/commands/mission.js +562 -0
- package/dist/commands/official-catalog.js +134 -0
- package/dist/commands/plan.js +84 -0
- package/dist/commands/playbook.js +415 -0
- package/dist/commands/pm/context.js +6 -0
- package/dist/commands/pm/index.js +701 -0
- package/dist/commands/pm/projectman.js +6266 -0
- package/dist/commands/project.js +1080 -0
- package/dist/commands/prompt.js +1024 -0
- package/dist/commands/repo-sync.js +1907 -0
- package/dist/commands/resource.js +527 -0
- package/dist/commands/skill.js +1211 -0
- package/dist/commands/start-disciplines.js +510 -0
- package/dist/commands/start.js +1343 -0
- package/dist/commands/target.js +309 -0
- package/dist/commands/version.js +42 -0
- package/dist/commands/view.js +1852 -0
- package/dist/launchers/cockpit.js +28 -0
- package/dist/launchers/options.js +74 -0
- package/dist/launchers/server.js +41 -0
- package/dist/lib/agent-assets/envelope.js +83 -0
- package/dist/lib/agent-assets/gateway.js +15 -0
- package/dist/lib/agent-assets/guards.js +23 -0
- package/dist/lib/agent-assets/hosted-discovery.js +148 -0
- package/dist/lib/agent-assets/hosted-package-input.js +154 -0
- package/dist/lib/agent-assets/legacy-pointer-migration.js +677 -0
- package/dist/lib/agent-assets/native-fs.js +589 -0
- package/dist/lib/agent-assets/package-manifest.js +324 -0
- package/dist/lib/agent-assets/portable-path.js +67 -0
- package/dist/lib/agent-assets/release-input.js +177 -0
- package/dist/lib/agent-assets/roots.js +45 -0
- package/dist/lib/agent-assets/runtime-binding-reader.js +545 -0
- package/dist/lib/agent-assets/runtime-targets.js +50 -0
- package/dist/lib/agent-assets/store-reader.js +1212 -0
- package/dist/lib/agent-assets/store-types.js +1 -0
- package/dist/lib/agent-assets/store-writer.js +1484 -0
- package/dist/lib/agent-assets/types.js +1 -0
- package/dist/lib/agent-assets/unicode-case-folding-v15-1.generated.js +1548 -0
- package/dist/lib/commercial-final-readiness.js +504 -0
- package/dist/lib/commercial-lifecycle-smoke-isolation.js +236 -0
- package/dist/lib/commercial-managed-postgres-docker-adapter.js +274 -0
- package/dist/lib/commercial-setup-readiness-adapter.js +179 -0
- package/dist/lib/community-client-contract.js +164 -0
- package/dist/lib/community-cockpit-lifecycle.js +601 -0
- package/dist/lib/community-command-abort.js +59 -0
- package/dist/lib/community-diagnostic.js +237 -0
- package/dist/lib/community-docker-adapter.js +498 -0
- package/dist/lib/community-home.js +31 -0
- package/dist/lib/community-instance-contract.js +148 -0
- package/dist/lib/community-instance-layout.js +97 -0
- package/dist/lib/community-lifecycle.js +1631 -0
- package/dist/lib/community-migration-snapshot.js +770 -0
- package/dist/lib/community-native-application-recovery.js +425 -0
- package/dist/lib/community-native-child.js +240 -0
- package/dist/lib/community-native-database-recovery.js +456 -0
- package/dist/lib/community-native-lifecycle.js +2458 -0
- package/dist/lib/community-native-migration.js +339 -0
- package/dist/lib/community-native-postgres.js +596 -0
- package/dist/lib/community-operation-journal.js +773 -0
- package/dist/lib/community-operation-lock.js +596 -0
- package/dist/lib/community-release-resolver.js +291 -0
- package/dist/lib/community-release-verifier.js +475 -0
- package/dist/lib/community-repo-discovery.js +252 -0
- package/dist/lib/community-setup-server-env.js +203 -0
- package/dist/lib/external-url.js +110 -0
- package/dist/lib/official-catalog-gateway.js +108 -0
- package/dist/lib/official-catalog.js +364 -0
- package/dist/lib/server-bootstrap.js +240 -0
- package/dist/lib/setup-agent-assets-bridge.js +176 -0
- package/dist/lib/setup-agent-assets-release.js +52 -0
- package/dist/lib/setup-external-postgres.js +108 -0
- package/dist/lib/setup-init-orchestrator.js +990 -0
- package/dist/lib/setup-install-guide.js +52 -0
- package/dist/lib/setup-installer-release.js +47 -0
- package/dist/lib/setup-local-postgres.js +329 -0
- package/dist/lib/setup-official-catalog-bridge.js +148 -0
- package/dist/lib/setup-readiness.js +888 -0
- package/dist/lib/tui-launcher.js +59 -0
- package/dist/main.js +150 -0
- package/dist/seeds/agents-md.js +54 -0
- package/dist/utils/agent-gateway.js +275 -0
- package/dist/utils/agents-md.js +281 -0
- package/dist/utils/api.js +255 -0
- package/dist/utils/chatv3-session-store.js +185 -0
- package/dist/utils/command.js +67 -0
- package/dist/utils/community-host-runtime.js +376 -0
- package/dist/utils/config.js +1015 -0
- package/dist/utils/discussion-workspace.js +552 -0
- package/dist/utils/experience-workspace.js +326 -0
- package/dist/utils/guide-paths.js +67 -0
- package/dist/utils/hosted-sugar.js +56 -0
- package/dist/utils/hosted-workspace.js +229 -0
- package/dist/utils/memory-workspace.js +537 -0
- package/dist/utils/operator-runtime.js +199 -0
- package/dist/utils/password-crypto.js +39 -0
- package/dist/utils/playbook-workspace.js +479 -0
- package/dist/utils/project-context.js +255 -0
- package/dist/utils/prompts.js +70 -0
- package/dist/utils/refresh-race.js +28 -0
- package/dist/utils/repo-config.js +109 -0
- package/dist/utils/repo-first-projectman.js +194 -0
- package/dist/utils/repo-first-storage.js +13 -0
- package/dist/utils/repo-first-view.js +305 -0
- package/dist/utils/session-guidance.js +278 -0
- package/dist/utils/session-state.js +137 -0
- package/dist/utils/table.js +39 -0
- package/dist/utils/transient-fs.js +49 -0
- package/dist/utils/workspace-root.js +1 -0
- package/launchers/aops-cockpit.ps1 +15 -0
- package/launchers/aops-cockpit.sh +16 -0
- package/launchers/aops-server.ps1 +15 -0
- package/launchers/aops-server.sh +16 -0
- package/native/tui/win32-x64/aops-tui.exe +0 -0
- package/package.json +81 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
function normalizeNonEmpty(value) {
|
|
4
|
+
if (typeof value !== 'string')
|
|
5
|
+
return undefined;
|
|
6
|
+
const trimmed = value.trim();
|
|
7
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
8
|
+
}
|
|
9
|
+
function compactProjectBinding(project) {
|
|
10
|
+
const binding = {
|
|
11
|
+
name: project.name,
|
|
12
|
+
projectId: project.projectId,
|
|
13
|
+
};
|
|
14
|
+
if (project.slug)
|
|
15
|
+
binding.slug = project.slug;
|
|
16
|
+
return binding;
|
|
17
|
+
}
|
|
18
|
+
function normalizeProjectRecord(raw) {
|
|
19
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
20
|
+
return null;
|
|
21
|
+
const record = raw;
|
|
22
|
+
const name = normalizeNonEmpty(record.name);
|
|
23
|
+
const projectId = normalizeNonEmpty(record.projectId);
|
|
24
|
+
const scopeId = normalizeNonEmpty(record.scopeId);
|
|
25
|
+
const slug = normalizeNonEmpty(record.slug);
|
|
26
|
+
if (!name || !projectId)
|
|
27
|
+
return null;
|
|
28
|
+
return compactProjectBinding({
|
|
29
|
+
name,
|
|
30
|
+
projectId,
|
|
31
|
+
scopeId: scopeId ?? projectId,
|
|
32
|
+
slug,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function normalizeProjectName(value) {
|
|
36
|
+
return normalizeNonEmpty(value)?.toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
function normalizeOperatorDefaults(raw) {
|
|
39
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
40
|
+
return undefined;
|
|
41
|
+
const record = raw;
|
|
42
|
+
const defaults = {
|
|
43
|
+
apiBaseUrl: normalizeNonEmpty(record.apiBaseUrl),
|
|
44
|
+
tenantId: normalizeNonEmpty(record.tenantId),
|
|
45
|
+
scopeId: normalizeNonEmpty(record.scopeId),
|
|
46
|
+
locale: normalizeNonEmpty(record.locale),
|
|
47
|
+
fallbackLocale: normalizeNonEmpty(record.fallbackLocale),
|
|
48
|
+
};
|
|
49
|
+
return Object.values(defaults).some(Boolean) ? defaults : undefined;
|
|
50
|
+
}
|
|
51
|
+
function resolveActiveProjectName(projects, activeProjectName) {
|
|
52
|
+
const normalizedActiveProjectName = normalizeProjectName(activeProjectName);
|
|
53
|
+
if (normalizedActiveProjectName) {
|
|
54
|
+
const activeProject = projects.find((project) => normalizeProjectName(project.name) === normalizedActiveProjectName);
|
|
55
|
+
if (activeProject)
|
|
56
|
+
return activeProject.name;
|
|
57
|
+
}
|
|
58
|
+
return projects[0]?.name;
|
|
59
|
+
}
|
|
60
|
+
export function findWorkspaceRoot(startDir = process.cwd()) {
|
|
61
|
+
const resolvedStart = path.resolve(startDir);
|
|
62
|
+
let current = resolvedStart;
|
|
63
|
+
while (true) {
|
|
64
|
+
const packageJson = path.join(current, 'package.json');
|
|
65
|
+
if (existsSync(packageJson))
|
|
66
|
+
return current;
|
|
67
|
+
const parent = path.dirname(current);
|
|
68
|
+
if (parent === current)
|
|
69
|
+
return resolvedStart;
|
|
70
|
+
current = parent;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export function resolveRepoConfigPath(rootDir) {
|
|
74
|
+
return path.join(rootDir, '.aops', 'aops.config.json');
|
|
75
|
+
}
|
|
76
|
+
export function parseJsonInput(input, label) {
|
|
77
|
+
if (input === undefined || input === null)
|
|
78
|
+
return undefined;
|
|
79
|
+
if (typeof input !== 'string')
|
|
80
|
+
return input;
|
|
81
|
+
const trimmed = input.trim();
|
|
82
|
+
if (!trimmed)
|
|
83
|
+
return undefined;
|
|
84
|
+
if (trimmed.startsWith('@')) {
|
|
85
|
+
const filePath = trimmed.slice(1).trim();
|
|
86
|
+
if (!filePath)
|
|
87
|
+
throw new Error(`Invalid JSON for ${label}.`);
|
|
88
|
+
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
89
|
+
}
|
|
90
|
+
return JSON.parse(trimmed);
|
|
91
|
+
}
|
|
92
|
+
export function buildDomainApiPath(domain, routePath) {
|
|
93
|
+
const normalizedDomain = domain.trim().toLowerCase().replace(/^\/+|\/+$/g, '');
|
|
94
|
+
const normalizedPath = (routePath ?? '').trim().replace(/^\/+|\/+$/g, '');
|
|
95
|
+
return normalizedPath.length > 0 ? `/api/${normalizedDomain}/${normalizedPath}` : `/api/${normalizedDomain}`;
|
|
96
|
+
}
|
|
97
|
+
export function appendQueryToPath(pathname, query) {
|
|
98
|
+
if (!query || typeof query !== 'object' || Array.isArray(query))
|
|
99
|
+
return pathname;
|
|
100
|
+
const params = new URLSearchParams();
|
|
101
|
+
for (const [keyRaw, value] of Object.entries(query)) {
|
|
102
|
+
const key = keyRaw.trim();
|
|
103
|
+
if (!key || value === undefined || value === null)
|
|
104
|
+
continue;
|
|
105
|
+
if (Array.isArray(value)) {
|
|
106
|
+
for (const item of value)
|
|
107
|
+
params.append(key, String(item));
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (typeof value === 'object') {
|
|
111
|
+
params.append(key, JSON.stringify(value));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
params.append(key, String(value));
|
|
115
|
+
}
|
|
116
|
+
const queryString = params.toString();
|
|
117
|
+
return queryString ? `${pathname}?${queryString}` : pathname;
|
|
118
|
+
}
|
|
119
|
+
export function buildOperatorHeaders(context = {}) {
|
|
120
|
+
const headers = {};
|
|
121
|
+
const tenantId = normalizeNonEmpty(context.tenantId);
|
|
122
|
+
const scopeId = normalizeNonEmpty(context.scopeId);
|
|
123
|
+
const locale = normalizeNonEmpty(context.locale);
|
|
124
|
+
const fallbackLocale = normalizeNonEmpty(context.fallbackLocale);
|
|
125
|
+
const projectId = normalizeNonEmpty(context.projectId);
|
|
126
|
+
const projectName = normalizeNonEmpty(context.projectName);
|
|
127
|
+
if (tenantId)
|
|
128
|
+
headers['x-tenant-id'] = tenantId;
|
|
129
|
+
if (scopeId)
|
|
130
|
+
headers['x-scope-id'] = scopeId;
|
|
131
|
+
if (locale)
|
|
132
|
+
headers['x-locale'] = locale;
|
|
133
|
+
if (fallbackLocale)
|
|
134
|
+
headers['x-fallback-locale'] = fallbackLocale;
|
|
135
|
+
if (projectId)
|
|
136
|
+
headers['x-project-id'] = projectId;
|
|
137
|
+
else if (projectName)
|
|
138
|
+
headers['x-project-name'] = projectName;
|
|
139
|
+
if (context.scopeResolution)
|
|
140
|
+
headers['x-scope-resolution'] = context.scopeResolution;
|
|
141
|
+
return headers;
|
|
142
|
+
}
|
|
143
|
+
export function buildHostedToolInvokeRequestBody(options) {
|
|
144
|
+
const requestBody = {};
|
|
145
|
+
const sourceId = normalizeNonEmpty(options.sourceId)?.toLowerCase();
|
|
146
|
+
const idempotencyKey = normalizeNonEmpty(options.idempotencyKey);
|
|
147
|
+
if (sourceId)
|
|
148
|
+
requestBody.sourceId = sourceId;
|
|
149
|
+
if (options.input !== undefined)
|
|
150
|
+
requestBody.input = options.input;
|
|
151
|
+
if (options.preview === true)
|
|
152
|
+
requestBody.preview = true;
|
|
153
|
+
if (options.apply === true)
|
|
154
|
+
requestBody.apply = true;
|
|
155
|
+
if (options.confirm === true)
|
|
156
|
+
requestBody.confirm = true;
|
|
157
|
+
if (idempotencyKey)
|
|
158
|
+
requestBody.idempotencyKey = idempotencyKey;
|
|
159
|
+
return requestBody;
|
|
160
|
+
}
|
|
161
|
+
export function buildOperatorRepoConfig(params) {
|
|
162
|
+
return {
|
|
163
|
+
schemaVersion: 2,
|
|
164
|
+
repo: { name: params.repoName },
|
|
165
|
+
activeProjectName: params.projectName,
|
|
166
|
+
projects: [
|
|
167
|
+
compactProjectBinding({
|
|
168
|
+
name: params.projectName,
|
|
169
|
+
projectId: params.projectId,
|
|
170
|
+
scopeId: params.scopeId ?? params.projectId,
|
|
171
|
+
slug: params.projectSlug,
|
|
172
|
+
}),
|
|
173
|
+
],
|
|
174
|
+
...(params.operatorDefaults && Object.values(params.operatorDefaults).some(Boolean)
|
|
175
|
+
? { operatorDefaults: params.operatorDefaults }
|
|
176
|
+
: {}),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
export function normalizeOperatorRepoConfig(raw) {
|
|
180
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
181
|
+
return null;
|
|
182
|
+
const typed = raw;
|
|
183
|
+
const repoName = normalizeNonEmpty(typed.repo?.name);
|
|
184
|
+
const rawProjects = Array.isArray(typed.projects) ? typed.projects : [];
|
|
185
|
+
const projects = rawProjects
|
|
186
|
+
.map((project) => normalizeProjectRecord(project))
|
|
187
|
+
.filter((project) => Boolean(project));
|
|
188
|
+
const activeProjectName = resolveActiveProjectName(projects, typed.activeProjectName);
|
|
189
|
+
const operatorDefaults = normalizeOperatorDefaults(typed.operatorDefaults);
|
|
190
|
+
if (!repoName || !activeProjectName || projects.length === 0)
|
|
191
|
+
return null;
|
|
192
|
+
return {
|
|
193
|
+
schemaVersion: 2,
|
|
194
|
+
repo: { name: repoName },
|
|
195
|
+
activeProjectName,
|
|
196
|
+
projects,
|
|
197
|
+
...(operatorDefaults ? { operatorDefaults } : {}),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
async function deriveKey(password, salt) {
|
|
3
|
+
return await new Promise((resolve, reject) => {
|
|
4
|
+
crypto.scrypt(password, salt, 32, (error, key) => {
|
|
5
|
+
if (error)
|
|
6
|
+
reject(error);
|
|
7
|
+
else
|
|
8
|
+
resolve(key);
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export async function encryptWithPassword(value, password, salt = crypto.randomBytes(16)) {
|
|
13
|
+
const key = await deriveKey(password, salt);
|
|
14
|
+
const iv = crypto.randomBytes(12);
|
|
15
|
+
const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);
|
|
16
|
+
const data = Buffer.concat([cipher.update(value, 'utf8'), cipher.final()]);
|
|
17
|
+
return {
|
|
18
|
+
key,
|
|
19
|
+
payload: {
|
|
20
|
+
v: 1,
|
|
21
|
+
kdf: 'scrypt',
|
|
22
|
+
salt: salt.toString('base64'),
|
|
23
|
+
iv: iv.toString('base64'),
|
|
24
|
+
tag: cipher.getAuthTag().toString('base64'),
|
|
25
|
+
data: data.toString('base64'),
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export async function decryptWithPassword(payload, password) {
|
|
30
|
+
if (payload.v !== 1 || payload.kdf !== 'scrypt')
|
|
31
|
+
throw new Error('aops_encrypted_payload_invalid');
|
|
32
|
+
const key = await deriveKey(password, Buffer.from(payload.salt, 'base64'));
|
|
33
|
+
const decipher = crypto.createDecipheriv('aes-256-gcm', key, Buffer.from(payload.iv, 'base64'));
|
|
34
|
+
decipher.setAuthTag(Buffer.from(payload.tag, 'base64'));
|
|
35
|
+
return Buffer.concat([
|
|
36
|
+
decipher.update(Buffer.from(payload.data, 'base64')),
|
|
37
|
+
decipher.final(),
|
|
38
|
+
]).toString('utf8');
|
|
39
|
+
}
|