@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,653 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { logError, logSuccess } from '@aopslabs/xf-cli-ui';
|
|
4
|
+
import { applyCommonOptions, compactPayload, normalizeNonEmpty } from '../utils/command.js';
|
|
5
|
+
import { invokeHostedToolWithApiState, requireApiState, unwrapHostedToolResult, } from '../utils/agent-gateway.js';
|
|
6
|
+
import { buildHostedSugarEnvelope, ensureGuardedWrite, ensureDestructiveWrite, } from '../utils/hosted-sugar.js';
|
|
7
|
+
import { preferProjectNameBinding, resolveOwnerScopeIdFromBinding, resolveOwnerScopeIdFromProjectRecord, resolveProjectBindingContext, } from '../utils/project-context.js';
|
|
8
|
+
const AGENT_PROFILE_CREATE_TOOL_ID = 'agentspace.agent-profile.create';
|
|
9
|
+
const AGENT_PROFILE_LIST_TOOL_ID = 'agentspace.agent-profile.list';
|
|
10
|
+
const AGENT_PROFILE_GET_TOOL_ID = 'agentspace.agent-profile.get-by-id';
|
|
11
|
+
const AGENT_PROFILE_UPDATE_TOOL_ID = 'agentspace.agent-profile.update';
|
|
12
|
+
const AGENT_PROFILE_DELETE_TOOL_ID = 'agentspace.agent-profile.delete';
|
|
13
|
+
function collectRepeatedOption(value, previous = []) {
|
|
14
|
+
const normalized = normalizeNonEmpty(value);
|
|
15
|
+
return normalized ? [...previous, normalized] : previous;
|
|
16
|
+
}
|
|
17
|
+
function parseInteger(value) {
|
|
18
|
+
return Number.parseInt(value, 10);
|
|
19
|
+
}
|
|
20
|
+
function toStringArray(values) {
|
|
21
|
+
return Array.isArray(values)
|
|
22
|
+
? values.map((entry) => normalizeNonEmpty(entry)).filter((entry) => Boolean(entry))
|
|
23
|
+
: [];
|
|
24
|
+
}
|
|
25
|
+
function uniqueStrings(values) {
|
|
26
|
+
const seen = new Set();
|
|
27
|
+
const result = [];
|
|
28
|
+
for (const value of values) {
|
|
29
|
+
const normalized = normalizeNonEmpty(value);
|
|
30
|
+
if (!normalized)
|
|
31
|
+
continue;
|
|
32
|
+
const key = normalized.toLowerCase();
|
|
33
|
+
if (seen.has(key))
|
|
34
|
+
continue;
|
|
35
|
+
seen.add(key);
|
|
36
|
+
result.push(normalized);
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
function isRecord(value) {
|
|
41
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
42
|
+
}
|
|
43
|
+
function toNonNegativeInteger(value) {
|
|
44
|
+
if (value === undefined || value === null || value === '')
|
|
45
|
+
return undefined;
|
|
46
|
+
const parsed = typeof value === 'number' ? value : Number.parseInt(String(value), 10);
|
|
47
|
+
if (!Number.isInteger(parsed) || parsed < 0)
|
|
48
|
+
return undefined;
|
|
49
|
+
return parsed;
|
|
50
|
+
}
|
|
51
|
+
function numberOrUndefined(value) {
|
|
52
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
53
|
+
}
|
|
54
|
+
function expandAtFileContent(value) {
|
|
55
|
+
if (typeof value === 'string' && value.startsWith('@')) {
|
|
56
|
+
return readFileSync(value.slice(1).trim(), 'utf8');
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
function readInlineBody(text) {
|
|
61
|
+
return normalizeNonEmpty(expandAtFileContent(typeof text === 'string' ? text : undefined));
|
|
62
|
+
}
|
|
63
|
+
function buildResolvedContextRecord(context) {
|
|
64
|
+
return compactPayload({
|
|
65
|
+
repoRoot: context.repoRoot,
|
|
66
|
+
configPath: context.configPath,
|
|
67
|
+
configFound: context.configFound,
|
|
68
|
+
scopeId: context.scopeId,
|
|
69
|
+
projectId: context.projectId,
|
|
70
|
+
projectName: context.projectName,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async function resolveAgentProfileContext(options, params = {}) {
|
|
74
|
+
const resolved = await resolveProjectBindingContext(options, {
|
|
75
|
+
requireProject: params.requireScope === true,
|
|
76
|
+
});
|
|
77
|
+
const scopeId = normalizeNonEmpty(options.scopeId) ?? resolveOwnerScopeIdFromBinding(resolved);
|
|
78
|
+
if (params.requireScope === true && !scopeId && !normalizeNonEmpty(resolved.projectId)) {
|
|
79
|
+
throw new Error('Agent profile context could not be resolved. Provide --project-id/--project-name. `--scope-id` remains a legacy/internal alias.');
|
|
80
|
+
}
|
|
81
|
+
return { ...resolved, scopeId };
|
|
82
|
+
}
|
|
83
|
+
function buildGatewayOptions(options, resolvedContext) {
|
|
84
|
+
return {
|
|
85
|
+
...options,
|
|
86
|
+
...preferProjectNameBinding(resolvedContext),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function unwrapResultData(result) {
|
|
90
|
+
if (isRecord(result) && Object.prototype.hasOwnProperty.call(result, 'data')) {
|
|
91
|
+
return result.data;
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
function extractHostedRows(result) {
|
|
96
|
+
const data = unwrapResultData(result);
|
|
97
|
+
if (Array.isArray(data))
|
|
98
|
+
return data.filter(isRecord);
|
|
99
|
+
if (Array.isArray(result))
|
|
100
|
+
return result.filter(isRecord);
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
async function hydrateProjectScopeContext(apiState, options, resolvedContext) {
|
|
104
|
+
const projectId = normalizeNonEmpty(resolvedContext.projectId);
|
|
105
|
+
if (!projectId) {
|
|
106
|
+
return resolvedContext;
|
|
107
|
+
}
|
|
108
|
+
if (normalizeNonEmpty(resolvedContext.scopeId) === projectId && normalizeNonEmpty(resolvedContext.projectName)) {
|
|
109
|
+
return resolvedContext;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const payload = await invokeHostedToolWithApiState(apiState, {
|
|
113
|
+
...buildGatewayOptions(options, resolvedContext),
|
|
114
|
+
toolId: 'agentspace.project.get-by-id',
|
|
115
|
+
input: { id: projectId },
|
|
116
|
+
});
|
|
117
|
+
const result = unwrapHostedToolResult(payload);
|
|
118
|
+
const project = unwrapResultData(result);
|
|
119
|
+
if (!isRecord(project)) {
|
|
120
|
+
return resolvedContext;
|
|
121
|
+
}
|
|
122
|
+
const scopeId = resolveOwnerScopeIdFromProjectRecord(project, resolvedContext.scopeId ?? projectId);
|
|
123
|
+
const projectName = normalizeNonEmpty(project.name) ?? resolvedContext.projectName;
|
|
124
|
+
return {
|
|
125
|
+
...resolvedContext,
|
|
126
|
+
scopeId: scopeId ?? resolvedContext.scopeId,
|
|
127
|
+
projectName,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return resolvedContext;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function normalizeHostedAgentProfileRecord(row) {
|
|
135
|
+
const id = normalizeNonEmpty(row.id) ?? normalizeNonEmpty(row.localId);
|
|
136
|
+
return compactPayload({
|
|
137
|
+
id,
|
|
138
|
+
localId: id,
|
|
139
|
+
remoteId: normalizeNonEmpty(row.id) ?? normalizeNonEmpty(row.remoteId),
|
|
140
|
+
name: normalizeNonEmpty(row.name),
|
|
141
|
+
slug: normalizeNonEmpty(row.slug),
|
|
142
|
+
version: numberOrUndefined(row.version),
|
|
143
|
+
kind: normalizeNonEmpty(row.kind),
|
|
144
|
+
role: normalizeNonEmpty(row.role),
|
|
145
|
+
defaultAgentIds: toStringArray(row.defaultAgents),
|
|
146
|
+
capabilities: toStringArray(row.capabilities),
|
|
147
|
+
allowedSurfaces: toStringArray(row.allowedSurfaces),
|
|
148
|
+
requiresApprovalFor: toStringArray(row.requiresApprovalFor),
|
|
149
|
+
promptRef: normalizeNonEmpty(row.promptRef),
|
|
150
|
+
skillRefs: toStringArray(row.skillRefs),
|
|
151
|
+
resourceRefs: toStringArray(row.resourceRefs),
|
|
152
|
+
overlayRefs: toStringArray(row.overlayRefs),
|
|
153
|
+
additionalContextRefs: toStringArray(row.additionalContextRefs),
|
|
154
|
+
tags: toStringArray(row.tags),
|
|
155
|
+
projectId: normalizeNonEmpty(row.projectId),
|
|
156
|
+
scopeId: normalizeNonEmpty(row.scopeId),
|
|
157
|
+
createdAt: normalizeNonEmpty(row.createdAt),
|
|
158
|
+
updatedAt: normalizeNonEmpty(row.updatedAt),
|
|
159
|
+
storage: 'hosted',
|
|
160
|
+
content: normalizeNonEmpty(row.body),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function buildAgentProfileListFilter(resolvedContext, options) {
|
|
164
|
+
return compactPayload({
|
|
165
|
+
scopeId: resolvedContext.scopeId,
|
|
166
|
+
scopeResolution: 'cascade',
|
|
167
|
+
defaultAgent: normalizeNonEmpty(options.agent),
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function filterHostedAgentProfileRecords(records, options) {
|
|
171
|
+
const role = normalizeNonEmpty(options.role)?.toLowerCase();
|
|
172
|
+
const agent = normalizeNonEmpty(options.agent)?.toLowerCase();
|
|
173
|
+
const limit = toNonNegativeInteger(options.limit);
|
|
174
|
+
const filtered = records.filter((record) => {
|
|
175
|
+
if (role && normalizeNonEmpty(record.role)?.toLowerCase() !== role)
|
|
176
|
+
return false;
|
|
177
|
+
if (agent && !toStringArray(record.defaultAgentIds).some((entry) => entry.toLowerCase() === agent))
|
|
178
|
+
return false;
|
|
179
|
+
return true;
|
|
180
|
+
});
|
|
181
|
+
return typeof limit === 'number' && limit > 0 ? filtered.slice(0, limit) : filtered;
|
|
182
|
+
}
|
|
183
|
+
function emitAgentProfileCommandError(params) {
|
|
184
|
+
const message = params.error instanceof Error ? params.error.message : String(params.error);
|
|
185
|
+
if (params.options.json) {
|
|
186
|
+
console.log(JSON.stringify(buildHostedSugarEnvelope({
|
|
187
|
+
command: params.command,
|
|
188
|
+
toolId: params.toolId,
|
|
189
|
+
resolvedContext: params.resolvedContext ? buildResolvedContextRecord(params.resolvedContext) : {},
|
|
190
|
+
input: params.input ?? {},
|
|
191
|
+
result: { error: { message } },
|
|
192
|
+
}), null, 2));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
logError(message);
|
|
196
|
+
}
|
|
197
|
+
process.exitCode = 1;
|
|
198
|
+
}
|
|
199
|
+
function buildCreateDataInput(options, context) {
|
|
200
|
+
const name = normalizeNonEmpty(options.name);
|
|
201
|
+
if (!name)
|
|
202
|
+
throw new Error('Provide --name.');
|
|
203
|
+
const role = normalizeNonEmpty(options.role);
|
|
204
|
+
if (!role)
|
|
205
|
+
throw new Error('Provide --role.');
|
|
206
|
+
return compactPayload({
|
|
207
|
+
scopeId: context.scopeId,
|
|
208
|
+
projectId: context.projectId,
|
|
209
|
+
slug: normalizeNonEmpty(options.slug),
|
|
210
|
+
name,
|
|
211
|
+
role,
|
|
212
|
+
version: numberOrUndefined(options.version) ?? 1,
|
|
213
|
+
kind: normalizeNonEmpty(options.kind) ?? 'role-profile',
|
|
214
|
+
defaultAgents: uniqueStrings(toStringArray(options.defaultAgent)),
|
|
215
|
+
capabilities: uniqueStrings(toStringArray(options.capability)),
|
|
216
|
+
allowedSurfaces: uniqueStrings(toStringArray(options.allowedSurface)),
|
|
217
|
+
requiresApprovalFor: uniqueStrings(toStringArray(options.requiresApprovalFor)),
|
|
218
|
+
promptRef: normalizeNonEmpty(options.promptRef),
|
|
219
|
+
skillRefs: uniqueStrings(toStringArray(options.skillRef)),
|
|
220
|
+
resourceRefs: uniqueStrings(toStringArray(options.resourceRef)),
|
|
221
|
+
overlayRefs: uniqueStrings(toStringArray(options.overlayRef)),
|
|
222
|
+
additionalContextRefs: uniqueStrings(toStringArray(options.additionalContextRef)),
|
|
223
|
+
tags: uniqueStrings(toStringArray(options.tag)),
|
|
224
|
+
body: readInlineBody(options.text),
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
export async function runAgentProfileCreate(options = {}) {
|
|
228
|
+
let resolvedContext;
|
|
229
|
+
let apiState;
|
|
230
|
+
try {
|
|
231
|
+
ensureGuardedWrite(options, 'This command writes an Agentspace agent profile.');
|
|
232
|
+
apiState = await requireApiState(options);
|
|
233
|
+
if (!apiState)
|
|
234
|
+
return;
|
|
235
|
+
resolvedContext = await resolveAgentProfileContext(options, { requireScope: true });
|
|
236
|
+
resolvedContext = await hydrateProjectScopeContext(apiState, options, resolvedContext);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
logError(error instanceof Error ? error.message : String(error));
|
|
240
|
+
process.exitCode = 1;
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
const data = buildCreateDataInput(options, resolvedContext);
|
|
245
|
+
const input = { data };
|
|
246
|
+
const payload = await invokeHostedToolWithApiState(apiState, {
|
|
247
|
+
...buildGatewayOptions(options, resolvedContext),
|
|
248
|
+
tenantId: options.tenantId,
|
|
249
|
+
locale: options.locale,
|
|
250
|
+
fallbackLocale: options.fallbackLocale,
|
|
251
|
+
timeoutMs: options.timeoutMs,
|
|
252
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
253
|
+
accessToken: options.accessToken,
|
|
254
|
+
refreshToken: options.refreshToken,
|
|
255
|
+
toolId: AGENT_PROFILE_CREATE_TOOL_ID,
|
|
256
|
+
input,
|
|
257
|
+
preview: options.preview,
|
|
258
|
+
apply: options.apply,
|
|
259
|
+
idempotencyKey: options.idempotencyKey,
|
|
260
|
+
});
|
|
261
|
+
const result = unwrapHostedToolResult(payload);
|
|
262
|
+
const row = unwrapResultData(result);
|
|
263
|
+
const data2 = { profile: isRecord(row) ? normalizeHostedAgentProfileRecord(row) : result };
|
|
264
|
+
if (options.json) {
|
|
265
|
+
console.log(JSON.stringify(buildHostedSugarEnvelope({
|
|
266
|
+
command: 'agent-profile.create',
|
|
267
|
+
toolId: AGENT_PROFILE_CREATE_TOOL_ID,
|
|
268
|
+
resolvedContext: buildResolvedContextRecord(resolvedContext),
|
|
269
|
+
input,
|
|
270
|
+
result: data2,
|
|
271
|
+
}), null, 2));
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
logSuccess('Agent profile created.');
|
|
275
|
+
console.log(JSON.stringify(data2, null, 2));
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
emitAgentProfileCommandError({
|
|
279
|
+
options,
|
|
280
|
+
command: 'agent-profile.create',
|
|
281
|
+
toolId: AGENT_PROFILE_CREATE_TOOL_ID,
|
|
282
|
+
resolvedContext,
|
|
283
|
+
error,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
export async function runAgentProfileList(options = {}) {
|
|
288
|
+
let resolvedContext;
|
|
289
|
+
let apiState;
|
|
290
|
+
try {
|
|
291
|
+
apiState = await requireApiState(options);
|
|
292
|
+
if (!apiState)
|
|
293
|
+
return;
|
|
294
|
+
resolvedContext = await resolveAgentProfileContext(options, { requireScope: true });
|
|
295
|
+
resolvedContext = await hydrateProjectScopeContext(apiState, options, resolvedContext);
|
|
296
|
+
}
|
|
297
|
+
catch (error) {
|
|
298
|
+
logError(error instanceof Error ? error.message : String(error));
|
|
299
|
+
process.exitCode = 1;
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
const input = compactPayload({
|
|
304
|
+
filter: buildAgentProfileListFilter(resolvedContext, options),
|
|
305
|
+
options: compactPayload({ limit: toNonNegativeInteger(options.limit) }),
|
|
306
|
+
});
|
|
307
|
+
const payload = await invokeHostedToolWithApiState(apiState, {
|
|
308
|
+
...buildGatewayOptions(options, resolvedContext),
|
|
309
|
+
tenantId: options.tenantId,
|
|
310
|
+
locale: options.locale,
|
|
311
|
+
fallbackLocale: options.fallbackLocale,
|
|
312
|
+
timeoutMs: options.timeoutMs,
|
|
313
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
314
|
+
accessToken: options.accessToken,
|
|
315
|
+
refreshToken: options.refreshToken,
|
|
316
|
+
toolId: AGENT_PROFILE_LIST_TOOL_ID,
|
|
317
|
+
input,
|
|
318
|
+
});
|
|
319
|
+
const result = unwrapHostedToolResult(payload);
|
|
320
|
+
const records = extractHostedRows(result).map(normalizeHostedAgentProfileRecord);
|
|
321
|
+
const filtered = filterHostedAgentProfileRecords(records, options);
|
|
322
|
+
const data = { data: filtered };
|
|
323
|
+
if (options.json) {
|
|
324
|
+
console.log(JSON.stringify(buildHostedSugarEnvelope({
|
|
325
|
+
command: 'agent-profile.list',
|
|
326
|
+
toolId: AGENT_PROFILE_LIST_TOOL_ID,
|
|
327
|
+
resolvedContext: buildResolvedContextRecord(resolvedContext),
|
|
328
|
+
input,
|
|
329
|
+
result: data,
|
|
330
|
+
}), null, 2));
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
logSuccess('Agent profiles loaded.');
|
|
334
|
+
console.log(JSON.stringify(data, null, 2));
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
emitAgentProfileCommandError({
|
|
338
|
+
options,
|
|
339
|
+
command: 'agent-profile.list',
|
|
340
|
+
toolId: AGENT_PROFILE_LIST_TOOL_ID,
|
|
341
|
+
resolvedContext,
|
|
342
|
+
error,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
export async function runAgentProfileGet(options = {}) {
|
|
347
|
+
let resolvedContext;
|
|
348
|
+
let apiState;
|
|
349
|
+
try {
|
|
350
|
+
const id = normalizeNonEmpty(options.id);
|
|
351
|
+
if (!id)
|
|
352
|
+
throw new Error('Provide --id.');
|
|
353
|
+
apiState = await requireApiState(options);
|
|
354
|
+
if (!apiState)
|
|
355
|
+
return;
|
|
356
|
+
resolvedContext = await resolveAgentProfileContext(options, { requireScope: false });
|
|
357
|
+
resolvedContext = await hydrateProjectScopeContext(apiState, options, resolvedContext);
|
|
358
|
+
const input = { id };
|
|
359
|
+
const payload = await invokeHostedToolWithApiState(apiState, {
|
|
360
|
+
...buildGatewayOptions(options, resolvedContext),
|
|
361
|
+
tenantId: options.tenantId,
|
|
362
|
+
locale: options.locale,
|
|
363
|
+
fallbackLocale: options.fallbackLocale,
|
|
364
|
+
timeoutMs: options.timeoutMs,
|
|
365
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
366
|
+
accessToken: options.accessToken,
|
|
367
|
+
refreshToken: options.refreshToken,
|
|
368
|
+
toolId: AGENT_PROFILE_GET_TOOL_ID,
|
|
369
|
+
input,
|
|
370
|
+
});
|
|
371
|
+
const result = unwrapHostedToolResult(payload);
|
|
372
|
+
const row = unwrapResultData(result);
|
|
373
|
+
if (!isRecord(row))
|
|
374
|
+
throw new Error('Agent profile was not found.');
|
|
375
|
+
const data = { profile: normalizeHostedAgentProfileRecord(row) };
|
|
376
|
+
if (options.json) {
|
|
377
|
+
console.log(JSON.stringify(buildHostedSugarEnvelope({
|
|
378
|
+
command: 'agent-profile.get',
|
|
379
|
+
toolId: AGENT_PROFILE_GET_TOOL_ID,
|
|
380
|
+
resolvedContext: buildResolvedContextRecord(resolvedContext),
|
|
381
|
+
input,
|
|
382
|
+
result: data,
|
|
383
|
+
}), null, 2));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
logSuccess('Agent profile loaded.');
|
|
387
|
+
console.log(JSON.stringify(data, null, 2));
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
emitAgentProfileCommandError({
|
|
391
|
+
options,
|
|
392
|
+
command: 'agent-profile.get',
|
|
393
|
+
toolId: AGENT_PROFILE_GET_TOOL_ID,
|
|
394
|
+
resolvedContext,
|
|
395
|
+
input: compactPayload({ id: normalizeNonEmpty(options.id) }),
|
|
396
|
+
error,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function buildUpdatePatch(options) {
|
|
401
|
+
const defaultAgents = uniqueStrings(toStringArray(options.defaultAgent));
|
|
402
|
+
const capabilities = uniqueStrings(toStringArray(options.capability));
|
|
403
|
+
const allowedSurfaces = uniqueStrings(toStringArray(options.allowedSurface));
|
|
404
|
+
const requiresApprovalFor = uniqueStrings(toStringArray(options.requiresApprovalFor));
|
|
405
|
+
const skillRefs = uniqueStrings(toStringArray(options.skillRef));
|
|
406
|
+
const resourceRefs = uniqueStrings(toStringArray(options.resourceRef));
|
|
407
|
+
const overlayRefs = uniqueStrings(toStringArray(options.overlayRef));
|
|
408
|
+
const additionalContextRefs = uniqueStrings(toStringArray(options.additionalContextRef));
|
|
409
|
+
const tags = uniqueStrings(toStringArray(options.tag));
|
|
410
|
+
return compactPayload({
|
|
411
|
+
name: normalizeNonEmpty(options.name),
|
|
412
|
+
slug: normalizeNonEmpty(options.slug),
|
|
413
|
+
role: normalizeNonEmpty(options.role),
|
|
414
|
+
version: numberOrUndefined(options.version),
|
|
415
|
+
kind: normalizeNonEmpty(options.kind),
|
|
416
|
+
defaultAgents: defaultAgents.length > 0 ? defaultAgents : undefined,
|
|
417
|
+
capabilities: capabilities.length > 0 ? capabilities : undefined,
|
|
418
|
+
allowedSurfaces: allowedSurfaces.length > 0 ? allowedSurfaces : undefined,
|
|
419
|
+
requiresApprovalFor: requiresApprovalFor.length > 0 ? requiresApprovalFor : undefined,
|
|
420
|
+
promptRef: normalizeNonEmpty(options.promptRef),
|
|
421
|
+
skillRefs: skillRefs.length > 0 ? skillRefs : undefined,
|
|
422
|
+
resourceRefs: resourceRefs.length > 0 ? resourceRefs : undefined,
|
|
423
|
+
overlayRefs: overlayRefs.length > 0 ? overlayRefs : undefined,
|
|
424
|
+
additionalContextRefs: additionalContextRefs.length > 0 ? additionalContextRefs : undefined,
|
|
425
|
+
tags: tags.length > 0 ? tags : undefined,
|
|
426
|
+
body: readInlineBody(options.text),
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
export async function runAgentProfileUpdate(options = {}) {
|
|
430
|
+
let resolvedContext;
|
|
431
|
+
let apiState;
|
|
432
|
+
try {
|
|
433
|
+
const id = normalizeNonEmpty(options.id);
|
|
434
|
+
if (!id)
|
|
435
|
+
throw new Error('Provide --id.');
|
|
436
|
+
ensureGuardedWrite(options, 'This command updates an Agentspace agent profile.');
|
|
437
|
+
apiState = await requireApiState(options);
|
|
438
|
+
if (!apiState)
|
|
439
|
+
return;
|
|
440
|
+
resolvedContext = await resolveAgentProfileContext(options, { requireScope: false });
|
|
441
|
+
resolvedContext = await hydrateProjectScopeContext(apiState, options, resolvedContext);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
logError(error instanceof Error ? error.message : String(error));
|
|
445
|
+
process.exitCode = 1;
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
try {
|
|
449
|
+
const id = normalizeNonEmpty(options.id);
|
|
450
|
+
const patch = buildUpdatePatch(options);
|
|
451
|
+
if (Object.keys(patch).length === 0) {
|
|
452
|
+
throw new Error('Provide at least one patch field such as --name, --role, --capability, --allowed-surface, --prompt-ref, --skill-ref, --tag, or --text.');
|
|
453
|
+
}
|
|
454
|
+
const input = { id, patch };
|
|
455
|
+
const payload = await invokeHostedToolWithApiState(apiState, {
|
|
456
|
+
...buildGatewayOptions(options, resolvedContext),
|
|
457
|
+
tenantId: options.tenantId,
|
|
458
|
+
locale: options.locale,
|
|
459
|
+
fallbackLocale: options.fallbackLocale,
|
|
460
|
+
timeoutMs: options.timeoutMs,
|
|
461
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
462
|
+
accessToken: options.accessToken,
|
|
463
|
+
refreshToken: options.refreshToken,
|
|
464
|
+
toolId: AGENT_PROFILE_UPDATE_TOOL_ID,
|
|
465
|
+
input,
|
|
466
|
+
preview: options.preview,
|
|
467
|
+
apply: options.apply,
|
|
468
|
+
idempotencyKey: options.idempotencyKey,
|
|
469
|
+
});
|
|
470
|
+
const result = unwrapHostedToolResult(payload);
|
|
471
|
+
const row = unwrapResultData(result);
|
|
472
|
+
const data = { profile: isRecord(row) ? normalizeHostedAgentProfileRecord(row) : result };
|
|
473
|
+
if (options.json) {
|
|
474
|
+
console.log(JSON.stringify(buildHostedSugarEnvelope({
|
|
475
|
+
command: 'agent-profile.update',
|
|
476
|
+
toolId: AGENT_PROFILE_UPDATE_TOOL_ID,
|
|
477
|
+
resolvedContext: buildResolvedContextRecord(resolvedContext),
|
|
478
|
+
input,
|
|
479
|
+
result: data,
|
|
480
|
+
}), null, 2));
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
logSuccess('Agent profile updated.');
|
|
484
|
+
console.log(JSON.stringify(data, null, 2));
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
emitAgentProfileCommandError({
|
|
488
|
+
options,
|
|
489
|
+
command: 'agent-profile.update',
|
|
490
|
+
toolId: AGENT_PROFILE_UPDATE_TOOL_ID,
|
|
491
|
+
resolvedContext,
|
|
492
|
+
input: compactPayload({ id: normalizeNonEmpty(options.id) }),
|
|
493
|
+
error,
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
export async function runAgentProfileDelete(options = {}) {
|
|
498
|
+
let resolvedContext;
|
|
499
|
+
let apiState;
|
|
500
|
+
try {
|
|
501
|
+
const id = normalizeNonEmpty(options.id);
|
|
502
|
+
if (!id)
|
|
503
|
+
throw new Error('Provide --id.');
|
|
504
|
+
ensureDestructiveWrite(options, 'This command deletes an Agentspace agent profile.');
|
|
505
|
+
apiState = await requireApiState(options);
|
|
506
|
+
if (!apiState)
|
|
507
|
+
return;
|
|
508
|
+
resolvedContext = await resolveAgentProfileContext(options, { requireScope: false });
|
|
509
|
+
resolvedContext = await hydrateProjectScopeContext(apiState, options, resolvedContext);
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
logError(error instanceof Error ? error.message : String(error));
|
|
513
|
+
process.exitCode = 1;
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
try {
|
|
517
|
+
const id = normalizeNonEmpty(options.id);
|
|
518
|
+
const input = { id };
|
|
519
|
+
const payload = await invokeHostedToolWithApiState(apiState, {
|
|
520
|
+
...buildGatewayOptions(options, resolvedContext),
|
|
521
|
+
tenantId: options.tenantId,
|
|
522
|
+
locale: options.locale,
|
|
523
|
+
fallbackLocale: options.fallbackLocale,
|
|
524
|
+
timeoutMs: options.timeoutMs,
|
|
525
|
+
apiBaseUrl: options.apiBaseUrl,
|
|
526
|
+
accessToken: options.accessToken,
|
|
527
|
+
refreshToken: options.refreshToken,
|
|
528
|
+
toolId: AGENT_PROFILE_DELETE_TOOL_ID,
|
|
529
|
+
input,
|
|
530
|
+
preview: options.preview,
|
|
531
|
+
apply: options.apply,
|
|
532
|
+
confirm: options.confirm,
|
|
533
|
+
idempotencyKey: options.idempotencyKey,
|
|
534
|
+
});
|
|
535
|
+
const result = unwrapHostedToolResult(payload);
|
|
536
|
+
const row = unwrapResultData(result);
|
|
537
|
+
const data = isRecord(row) ? { deleted: true, id, ...row } : { deleted: true, id };
|
|
538
|
+
if (options.json) {
|
|
539
|
+
console.log(JSON.stringify(buildHostedSugarEnvelope({
|
|
540
|
+
command: 'agent-profile.delete',
|
|
541
|
+
toolId: AGENT_PROFILE_DELETE_TOOL_ID,
|
|
542
|
+
resolvedContext: buildResolvedContextRecord(resolvedContext),
|
|
543
|
+
input,
|
|
544
|
+
result: data,
|
|
545
|
+
}), null, 2));
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
logSuccess('Agent profile deleted.');
|
|
549
|
+
console.log(JSON.stringify(data, null, 2));
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
emitAgentProfileCommandError({
|
|
553
|
+
options,
|
|
554
|
+
command: 'agent-profile.delete',
|
|
555
|
+
toolId: AGENT_PROFILE_DELETE_TOOL_ID,
|
|
556
|
+
resolvedContext,
|
|
557
|
+
input: compactPayload({ id: normalizeNonEmpty(options.id) }),
|
|
558
|
+
error,
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
export function makeAgentProfileCommand() {
|
|
563
|
+
const cmd = new Command('agent-profile')
|
|
564
|
+
.description('Author and read hosted Agentspace agent profiles (server-first)');
|
|
565
|
+
applyCommonOptions(cmd, { withAuth: false, withProject: true, withYes: true, withJson: true });
|
|
566
|
+
cmd.addHelpText('after', `
|
|
567
|
+
Agent profiles are server-first: every subcommand reads and writes the hosted
|
|
568
|
+
\`agentspace.agent-profile.*\` ops through the agent gateway. The hosted store is
|
|
569
|
+
the single source of truth.
|
|
570
|
+
|
|
571
|
+
V1 semantics:
|
|
572
|
+
- agent profiles compose promptRef/skillRefs/resourceRefs
|
|
573
|
+
- overlayRefs/additionalContextRefs are metadata for runtime prompt assembly
|
|
574
|
+
- profiles do not copy prompt bodies
|
|
575
|
+
- requiresApprovalFor is declarative-only in V1
|
|
576
|
+
|
|
577
|
+
Author and read hosted agent profiles:
|
|
578
|
+
aops-cli agent-profile create --name "Reviewer" --role reviewer --default-agent claude --apply --json
|
|
579
|
+
aops-cli agent-profile list --role reviewer --json
|
|
580
|
+
aops-cli agent-profile get --id <id> --json
|
|
581
|
+
aops-cli agent-profile update --id <id> --capability code-review --apply --json
|
|
582
|
+
aops-cli agent-profile delete --id <id> --apply --confirm --json
|
|
583
|
+
`);
|
|
584
|
+
const create = cmd.command('create')
|
|
585
|
+
.description('Create a hosted Agentspace agent profile')
|
|
586
|
+
.requiredOption('--name <name>', 'Profile name')
|
|
587
|
+
.requiredOption('--role <role>', 'Role name, for example implementer|reviewer|tester')
|
|
588
|
+
.option('--slug <slug>', 'Optional stable profile slug (server derives from name otherwise)')
|
|
589
|
+
.option('--version <n>', 'Profile version number', parseInteger)
|
|
590
|
+
.option('--kind <kind>', 'Profile kind (default: role-profile)')
|
|
591
|
+
.option('--default-agent <id>', 'Default agent id; repeatable', collectRepeatedOption, [])
|
|
592
|
+
.option('--capability <value>', 'Capability label; repeatable', collectRepeatedOption, [])
|
|
593
|
+
.option('--allowed-surface <value>', 'Allowed surface label; repeatable', collectRepeatedOption, [])
|
|
594
|
+
.option('--requires-approval-for <value>', 'Declarative approval hint; repeatable', collectRepeatedOption, [])
|
|
595
|
+
.option('--prompt-ref <ref>', 'Prompt reference')
|
|
596
|
+
.option('--skill-ref <ref>', 'Skill reference; repeatable', collectRepeatedOption, [])
|
|
597
|
+
.option('--resource-ref <ref>', 'Resource reference; repeatable', collectRepeatedOption, [])
|
|
598
|
+
.option('--overlay-ref <ref>', 'Profile overlay reference; repeatable', collectRepeatedOption, [])
|
|
599
|
+
.option('--additional-context-ref <ref>', 'Additional context reference; repeatable', collectRepeatedOption, [])
|
|
600
|
+
.option('--tag <tag>', 'Tag; repeatable', collectRepeatedOption, [])
|
|
601
|
+
.option('--text <text>', 'Inline profile body (supports @file)')
|
|
602
|
+
.option('--preview', 'Preview the hosted write without applying')
|
|
603
|
+
.option('--apply', 'Write the profile')
|
|
604
|
+
.option('--idempotency-key <key>', 'Idempotency key for the hosted write')
|
|
605
|
+
.action((commandOptions) => runAgentProfileCreate({ ...cmd.opts(), ...commandOptions }));
|
|
606
|
+
applyCommonOptions(create, { withAuth: false, withProject: true, withYes: true, withJson: true });
|
|
607
|
+
const list = cmd.command('list')
|
|
608
|
+
.description('List hosted agent profiles within the current owner scope')
|
|
609
|
+
.option('--role <role>', 'Filter by role')
|
|
610
|
+
.option('--agent <id>', 'Filter by default agent id')
|
|
611
|
+
.option('--limit <n>', 'Result limit', parseInteger)
|
|
612
|
+
.action((commandOptions) => runAgentProfileList({ ...cmd.opts(), ...commandOptions }));
|
|
613
|
+
applyCommonOptions(list, { withAuth: false, withProject: true, withYes: true, withJson: true });
|
|
614
|
+
const get = cmd.command('get')
|
|
615
|
+
.description('Get one hosted agent profile by id')
|
|
616
|
+
.requiredOption('--id <id>', 'Agent profile id')
|
|
617
|
+
.action((commandOptions) => runAgentProfileGet({ ...cmd.opts(), ...commandOptions }));
|
|
618
|
+
applyCommonOptions(get, { withAuth: false, withProject: true, withYes: true, withJson: true });
|
|
619
|
+
const update = cmd.command('update')
|
|
620
|
+
.description('Patch one hosted agent profile')
|
|
621
|
+
.requiredOption('--id <id>', 'Agent profile id')
|
|
622
|
+
.option('--name <name>', 'New profile name')
|
|
623
|
+
.option('--slug <slug>', 'New profile slug')
|
|
624
|
+
.option('--role <role>', 'New role name')
|
|
625
|
+
.option('--version <n>', 'Profile version number', parseInteger)
|
|
626
|
+
.option('--kind <kind>', 'Profile kind')
|
|
627
|
+
.option('--default-agent <id>', 'Replace default agent ids; repeatable', collectRepeatedOption, [])
|
|
628
|
+
.option('--capability <value>', 'Replace capability labels; repeatable', collectRepeatedOption, [])
|
|
629
|
+
.option('--allowed-surface <value>', 'Replace allowed surface labels; repeatable', collectRepeatedOption, [])
|
|
630
|
+
.option('--requires-approval-for <value>', 'Replace declarative approval hints; repeatable', collectRepeatedOption, [])
|
|
631
|
+
.option('--prompt-ref <ref>', 'Replace prompt reference')
|
|
632
|
+
.option('--skill-ref <ref>', 'Replace skill references; repeatable', collectRepeatedOption, [])
|
|
633
|
+
.option('--resource-ref <ref>', 'Replace resource references; repeatable', collectRepeatedOption, [])
|
|
634
|
+
.option('--overlay-ref <ref>', 'Replace profile overlay references; repeatable', collectRepeatedOption, [])
|
|
635
|
+
.option('--additional-context-ref <ref>', 'Replace additional context references; repeatable', collectRepeatedOption, [])
|
|
636
|
+
.option('--tag <tag>', 'Replace tags; repeatable', collectRepeatedOption, [])
|
|
637
|
+
.option('--text <text>', 'Replace profile body (supports @file)')
|
|
638
|
+
.option('--preview', 'Preview the hosted update without applying')
|
|
639
|
+
.option('--apply', 'Write the profile')
|
|
640
|
+
.option('--idempotency-key <key>', 'Idempotency key for the hosted write')
|
|
641
|
+
.action((commandOptions) => runAgentProfileUpdate({ ...cmd.opts(), ...commandOptions }));
|
|
642
|
+
applyCommonOptions(update, { withAuth: false, withProject: true, withYes: true, withJson: true });
|
|
643
|
+
const del = cmd.command('delete')
|
|
644
|
+
.description('Delete one hosted agent profile')
|
|
645
|
+
.requiredOption('--id <id>', 'Agent profile id')
|
|
646
|
+
.option('--preview', 'Preview the hosted delete without applying')
|
|
647
|
+
.option('--apply', 'Delete the profile')
|
|
648
|
+
.option('--confirm', 'Confirm destructive delete')
|
|
649
|
+
.option('--idempotency-key <key>', 'Idempotency key for the hosted delete')
|
|
650
|
+
.action((commandOptions) => runAgentProfileDelete({ ...cmd.opts(), ...commandOptions }));
|
|
651
|
+
applyCommonOptions(del, { withAuth: false, withProject: true, withYes: true, withJson: true });
|
|
652
|
+
return cmd;
|
|
653
|
+
}
|