@copado/agentia-cli 0.42.0-alpha.0 → 0.45.0-alpha.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/README.md +471 -106
- package/dist/commands/ai/agent/ask.d.ts +28 -0
- package/dist/commands/ai/agent/ask.js +124 -0
- package/dist/commands/ai/agent/ask.js.map +1 -0
- package/dist/commands/ai/agent/chat.d.ts +29 -0
- package/dist/commands/ai/agent/chat.js +97 -0
- package/dist/commands/ai/agent/chat.js.map +1 -0
- package/dist/commands/auth/get.d.ts +3 -0
- package/dist/commands/auth/get.js +46 -1
- package/dist/commands/auth/get.js.map +1 -1
- package/dist/commands/auth/set.d.ts +5 -0
- package/dist/commands/auth/set.js +39 -0
- package/dist/commands/auth/set.js.map +1 -1
- package/dist/commands/auth/unset.d.ts +1 -0
- package/dist/commands/auth/unset.js +4 -0
- package/dist/commands/auth/unset.js.map +1 -1
- package/dist/commands/cicd/repository/create.d.ts +25 -0
- package/dist/commands/cicd/repository/create.js +45 -0
- package/dist/commands/cicd/repository/create.js.map +1 -0
- package/dist/commands/cicd/repository/delete.d.ts +11 -0
- package/dist/commands/cicd/repository/delete.js +29 -0
- package/dist/commands/cicd/repository/delete.js.map +1 -0
- package/dist/commands/cicd/repository/get.d.ts +10 -0
- package/dist/commands/cicd/repository/get.js +30 -0
- package/dist/commands/cicd/repository/get.js.map +1 -0
- package/dist/commands/cicd/repository/list.d.ts +8 -0
- package/dist/commands/cicd/repository/list.js +26 -0
- package/dist/commands/cicd/repository/list.js.map +1 -0
- package/dist/commands/cicd/repository/reset.d.ts +12 -0
- package/dist/commands/cicd/repository/reset.js +29 -0
- package/dist/commands/cicd/repository/reset.js.map +1 -0
- package/dist/commands/cicd/repository/update.d.ts +34 -0
- package/dist/commands/cicd/repository/update.js +64 -0
- package/dist/commands/cicd/repository/update.js.map +1 -0
- package/dist/commands/cicd/repository/validate.d.ts +10 -0
- package/dist/commands/cicd/repository/validate.js +33 -0
- package/dist/commands/cicd/repository/validate.js.map +1 -0
- package/dist/lib/ai-chat-session.d.ts +17 -0
- package/dist/lib/ai-chat-session.js +144 -0
- package/dist/lib/ai-chat-session.js.map +1 -0
- package/dist/lib/ai-config.d.ts +26 -0
- package/dist/lib/ai-config.js +113 -0
- package/dist/lib/ai-config.js.map +1 -0
- package/dist/lib/ai-gateway.d.ts +48 -0
- package/dist/lib/ai-gateway.js +298 -0
- package/dist/lib/ai-gateway.js.map +1 -0
- package/dist/lib/ai-operations.d.ts +26 -0
- package/dist/lib/ai-operations.js +177 -0
- package/dist/lib/ai-operations.js.map +1 -0
- package/dist/lib/ai-stream-parser.d.ts +12 -0
- package/dist/lib/ai-stream-parser.js +59 -0
- package/dist/lib/ai-stream-parser.js.map +1 -0
- package/dist/lib/ai-types.d.ts +80 -0
- package/dist/lib/ai-types.js +66 -0
- package/dist/lib/ai-types.js.map +1 -0
- package/dist/lib/auth-config.d.ts +21 -0
- package/dist/lib/auth-config.js +158 -6
- package/dist/lib/auth-config.js.map +1 -1
- package/dist/lib/credential-store.d.ts +13 -1
- package/dist/lib/credential-store.js +47 -2
- package/dist/lib/credential-store.js.map +1 -1
- package/dist/lib/mcp/ai-tools.d.ts +22 -0
- package/dist/lib/mcp/ai-tools.js +45 -0
- package/dist/lib/mcp/ai-tools.js.map +1 -0
- package/dist/lib/mcp/tools.d.ts +77 -2
- package/dist/lib/mcp/tools.js +169 -0
- package/dist/lib/mcp/tools.js.map +1 -1
- package/dist/lib/repository-flags.d.ts +117 -0
- package/dist/lib/repository-flags.js +208 -0
- package/dist/lib/repository-flags.js.map +1 -0
- package/dist/lib/repository-types.d.ts +94 -0
- package/dist/lib/repository-types.js +110 -0
- package/dist/lib/repository-types.js.map +1 -0
- package/oclif.manifest.json +891 -1
- package/package.json +10 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
2
|
+
import { normalizeAiDialogueId, normalizeAiWorkspaceId, resolveAiCredentials } from './ai-config.js';
|
|
3
|
+
import { AiGateway, AiGatewayError } from './ai-gateway.js';
|
|
4
|
+
import { assistantIdForAgent, buildDialogueName, enrichAiPrompt, validateAiContext, } from './ai-types.js';
|
|
5
|
+
function trimOptional(value) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
const trimmed = value.trim();
|
|
9
|
+
return trimmed.length === 0 ? undefined : trimmed;
|
|
10
|
+
}
|
|
11
|
+
function validatePrompt(prompt) {
|
|
12
|
+
const trimmed = prompt.trim();
|
|
13
|
+
if (trimmed.length === 0) {
|
|
14
|
+
throw new Error('AI prompt cannot be empty.');
|
|
15
|
+
}
|
|
16
|
+
return prompt;
|
|
17
|
+
}
|
|
18
|
+
function chunkContent(chunk) {
|
|
19
|
+
return typeof chunk.content === 'string' ? chunk.content : undefined;
|
|
20
|
+
}
|
|
21
|
+
function normalizeFollowup(value) {
|
|
22
|
+
if (typeof value === 'string' && value.trim().length > 0)
|
|
23
|
+
return { content: value };
|
|
24
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
25
|
+
return undefined;
|
|
26
|
+
const record = value;
|
|
27
|
+
for (const candidate of [record.content, record.question, record.text]) {
|
|
28
|
+
if (typeof candidate === 'string' && candidate.trim().length > 0)
|
|
29
|
+
return { content: candidate };
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
function normalizeLink(value) {
|
|
34
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
35
|
+
return undefined;
|
|
36
|
+
const record = value;
|
|
37
|
+
const link = {};
|
|
38
|
+
if (typeof record.summary === 'string')
|
|
39
|
+
link.summary = record.summary;
|
|
40
|
+
if (typeof record.title === 'string')
|
|
41
|
+
link.title = record.title;
|
|
42
|
+
if (typeof record.url === 'string')
|
|
43
|
+
link.url = record.url;
|
|
44
|
+
return Object.keys(link).length === 0 ? undefined : link;
|
|
45
|
+
}
|
|
46
|
+
function createStreamSummary() {
|
|
47
|
+
return {
|
|
48
|
+
completed: false,
|
|
49
|
+
content: '',
|
|
50
|
+
followups: [],
|
|
51
|
+
links: [],
|
|
52
|
+
statuses: [],
|
|
53
|
+
warnings: [],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function isCompletionChunk(type) {
|
|
57
|
+
return type === 'done' || type === 'performance' || type === 'stream_complete';
|
|
58
|
+
}
|
|
59
|
+
function applyMetadataChunk(summary, chunk) {
|
|
60
|
+
if (chunk.type === 'followup') {
|
|
61
|
+
const followup = normalizeFollowup(chunk.content);
|
|
62
|
+
if (followup !== undefined)
|
|
63
|
+
summary.followups.push(followup);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
if (chunk.type === 'link') {
|
|
67
|
+
const link = normalizeLink(chunk.content);
|
|
68
|
+
if (link !== undefined)
|
|
69
|
+
summary.links.push(link);
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return chunk.type === 'heartbeat';
|
|
73
|
+
}
|
|
74
|
+
function applyStreamChunk(summary, chunk, callbacks) {
|
|
75
|
+
const content = chunkContent(chunk);
|
|
76
|
+
if (isCompletionChunk(chunk.type)) {
|
|
77
|
+
summary.completed = true;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (applyMetadataChunk(summary, chunk))
|
|
81
|
+
return;
|
|
82
|
+
if (chunk.type === 'error')
|
|
83
|
+
throw new AiGatewayError(content ?? 'AI stream returned an error.');
|
|
84
|
+
if (chunk.type === 'request_id' && content !== undefined) {
|
|
85
|
+
summary.gatewayRequestId = content;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (chunk.type === 'status' && content !== undefined) {
|
|
89
|
+
summary.statuses.push(content);
|
|
90
|
+
callbacks.onStatus?.(content);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (chunk.type === 'thinking' && content !== undefined) {
|
|
94
|
+
callbacks.onStatus?.(content);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (chunk.type === 'token' && content !== undefined) {
|
|
98
|
+
summary.content += content;
|
|
99
|
+
callbacks.onToken?.(content);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (chunk.type === 'warning' && content !== undefined) {
|
|
103
|
+
summary.warnings.push(content);
|
|
104
|
+
callbacks.onWarning?.(content);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function bootstrapAiDialogue(options) {
|
|
108
|
+
const assistantId = assistantIdForAgent(options.agent);
|
|
109
|
+
const dialogueId = trimOptional(options.dialogue);
|
|
110
|
+
if (dialogueId !== undefined) {
|
|
111
|
+
const dialogue = await AiGateway.getDialogue(normalizeAiDialogueId(dialogueId), options);
|
|
112
|
+
return { assistantId, dialogue };
|
|
113
|
+
}
|
|
114
|
+
const credentials = resolveAiCredentials(options);
|
|
115
|
+
let workspace;
|
|
116
|
+
if (options.workspace !== undefined) {
|
|
117
|
+
workspace = { id: normalizeAiWorkspaceId(options.workspace) };
|
|
118
|
+
}
|
|
119
|
+
else if (credentials.workspaceId === undefined) {
|
|
120
|
+
workspace = await AiGateway.createWorkspace(options);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
workspace = { id: credentials.workspaceId };
|
|
124
|
+
}
|
|
125
|
+
const dialogue = await AiGateway.createDialogue({
|
|
126
|
+
assistantId,
|
|
127
|
+
name: buildDialogueName(options.kind, options.agent),
|
|
128
|
+
workspaceId: workspace.id,
|
|
129
|
+
}, options);
|
|
130
|
+
return { assistantId, dialogue, workspace };
|
|
131
|
+
}
|
|
132
|
+
export async function runAiAsk(options, callbacks = {}) {
|
|
133
|
+
validateAiContext({
|
|
134
|
+
component: options.component,
|
|
135
|
+
sfOrg: options.sfOrg,
|
|
136
|
+
userStory: options.userStory,
|
|
137
|
+
workItem: options.workItem,
|
|
138
|
+
});
|
|
139
|
+
const prompt = enrichAiPrompt(validatePrompt(options.prompt), {
|
|
140
|
+
component: trimOptional(options.component),
|
|
141
|
+
sfOrg: trimOptional(options.sfOrg),
|
|
142
|
+
userStory: trimOptional(options.userStory),
|
|
143
|
+
workItem: trimOptional(options.workItem),
|
|
144
|
+
});
|
|
145
|
+
const bootstrap = await bootstrapAiDialogue({
|
|
146
|
+
...options,
|
|
147
|
+
kind: 'ask',
|
|
148
|
+
});
|
|
149
|
+
const requestId = uuidv4();
|
|
150
|
+
const summary = createStreamSummary();
|
|
151
|
+
await AiGateway.sendMessage(bootstrap.dialogue.id, {
|
|
152
|
+
assistantId: bootstrap.assistantId,
|
|
153
|
+
'dev_context': null,
|
|
154
|
+
integrations: null,
|
|
155
|
+
prompt,
|
|
156
|
+
'request_id': requestId,
|
|
157
|
+
'system_prompt': null,
|
|
158
|
+
}, options, (chunk) => applyStreamChunk(summary, chunk, callbacks));
|
|
159
|
+
if (!summary.completed) {
|
|
160
|
+
throw new AiGatewayError('AI stream ended before stream_complete. Response may be incomplete.');
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
agent: options.agent,
|
|
164
|
+
assistantId: bootstrap.assistantId,
|
|
165
|
+
completed: summary.completed,
|
|
166
|
+
content: summary.content,
|
|
167
|
+
dialogueId: bootstrap.dialogue.id,
|
|
168
|
+
followups: summary.followups,
|
|
169
|
+
gatewayRequestId: summary.gatewayRequestId,
|
|
170
|
+
links: summary.links,
|
|
171
|
+
requestId,
|
|
172
|
+
statuses: summary.statuses,
|
|
173
|
+
warnings: summary.warnings,
|
|
174
|
+
workspaceId: bootstrap.workspace?.id ?? bootstrap.dialogue.workspaceId ?? bootstrap.dialogue.workspace_id ?? undefined,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=ai-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-operations.js","sourceRoot":"","sources":["../../src/lib/ai-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAA;AAEjC,OAAO,EAA6B,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|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AiStreamChunk } from './ai-types.js';
|
|
2
|
+
export declare class AiStreamProtocolError extends Error {
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class AiStreamParser {
|
|
6
|
+
private buffer;
|
|
7
|
+
private readonly decoder;
|
|
8
|
+
finish(): AiStreamChunk[];
|
|
9
|
+
push(chunk: Buffer | string): AiStreamChunk[];
|
|
10
|
+
private drainCompleteLines;
|
|
11
|
+
private parseLine;
|
|
12
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { StringDecoder } from 'node:string_decoder';
|
|
2
|
+
export class AiStreamProtocolError extends Error {
|
|
3
|
+
constructor(message) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.name = 'AiStreamProtocolError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export class AiStreamParser {
|
|
9
|
+
buffer = '';
|
|
10
|
+
decoder = new StringDecoder('utf8');
|
|
11
|
+
finish() {
|
|
12
|
+
this.buffer += this.decoder.end();
|
|
13
|
+
const chunks = [];
|
|
14
|
+
const trailing = this.buffer.trim();
|
|
15
|
+
this.buffer = '';
|
|
16
|
+
if (trailing.length > 0) {
|
|
17
|
+
chunks.push(this.parseLine(trailing));
|
|
18
|
+
}
|
|
19
|
+
return chunks;
|
|
20
|
+
}
|
|
21
|
+
push(chunk) {
|
|
22
|
+
this.buffer += typeof chunk === 'string' ? chunk : this.decoder.write(chunk);
|
|
23
|
+
return this.drainCompleteLines();
|
|
24
|
+
}
|
|
25
|
+
drainCompleteLines() {
|
|
26
|
+
const chunks = [];
|
|
27
|
+
while (true) {
|
|
28
|
+
const newlineIndex = this.buffer.search(/\r?\n/u);
|
|
29
|
+
if (newlineIndex === -1)
|
|
30
|
+
break;
|
|
31
|
+
const rawLine = this.buffer.slice(0, newlineIndex);
|
|
32
|
+
const newlineLength = this.buffer[newlineIndex] === '\r' && this.buffer[newlineIndex + 1] === '\n' ? 2 : 1;
|
|
33
|
+
this.buffer = this.buffer.slice(newlineIndex + newlineLength);
|
|
34
|
+
const line = rawLine.trim();
|
|
35
|
+
if (line.length > 0) {
|
|
36
|
+
chunks.push(this.parseLine(line));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return chunks;
|
|
40
|
+
}
|
|
41
|
+
parseLine(line) {
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
parsed = JSON.parse(line);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
throw new AiStreamProtocolError(`AI stream returned malformed NDJSON: ${line}`);
|
|
48
|
+
}
|
|
49
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
50
|
+
throw new AiStreamProtocolError('AI stream returned a non-object NDJSON record.');
|
|
51
|
+
}
|
|
52
|
+
const { type } = parsed;
|
|
53
|
+
if (typeof type !== 'string' || type.trim().length === 0) {
|
|
54
|
+
throw new AiStreamProtocolError('AI stream record did not include a type.');
|
|
55
|
+
}
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ai-stream-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-stream-parser.js","sourceRoot":"","sources":["../../src/lib/ai-stream-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAIjD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAmB,OAAe;QAChC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;IACrC,CAAC;CACF;AAED,MAAM,OAAO,cAAc;IACjB,MAAM,GAAG,EAAE,CAAA;IACF,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;IAE7C,MAAM;QACX,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,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AI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;YACnC,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAEO,SAAS,CAAC,IAAY;QAC5B,IAAI,MAAe,CAAA;QAEnB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,qBAAqB,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAA;QACjF,CAAC;QAED,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3E,MAAM,IAAI,qBAAqB,CAAC,gDAAgD,CAAC,CAAA;QACnF,CAAC;QAED,MAAM,EAAC,IAAI,EAAC,GAAG,MAA0B,CAAA;QACzC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzD,MAAM,IAAI,qBAAqB,CAAC,0CAA0C,CAAC,CAAA;QAC7E,CAAC;QAED,OAAO,MAAuB,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export declare const AI_ASK_AGENTS: readonly ["plan", "build", "test", "release", "operate"];
|
|
2
|
+
export declare const AI_CHAT_AGENTS: readonly ["plan", "build", "test", "release", "operate", "orchestrate"];
|
|
3
|
+
export type AiAskAgent = (typeof AI_ASK_AGENTS)[number];
|
|
4
|
+
export type AiChatAgent = (typeof AI_CHAT_AGENTS)[number];
|
|
5
|
+
export type AiAgent = AiAskAgent | AiChatAgent;
|
|
6
|
+
export type AiAssistantId = 'build' | 'generalist' | 'operate' | 'plan' | 'release' | 'test';
|
|
7
|
+
export type AiContextOptions = {
|
|
8
|
+
component?: string;
|
|
9
|
+
sfOrg?: string;
|
|
10
|
+
userStory?: string;
|
|
11
|
+
workItem?: string;
|
|
12
|
+
};
|
|
13
|
+
export type AiWorkspace = {
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
};
|
|
18
|
+
export type AiDialogue = {
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
assistantId?: AiAssistantId;
|
|
21
|
+
id: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
workspace_id?: null | string;
|
|
24
|
+
workspaceId?: null | string;
|
|
25
|
+
};
|
|
26
|
+
export type AiMessageCreate = {
|
|
27
|
+
assistantId: AiAssistantId;
|
|
28
|
+
dev_context?: null | Record<string, unknown>;
|
|
29
|
+
integrations?: null | Record<string, unknown>;
|
|
30
|
+
prompt: string;
|
|
31
|
+
request_id: string;
|
|
32
|
+
system_prompt?: null | string;
|
|
33
|
+
};
|
|
34
|
+
export type AiFollowup = {
|
|
35
|
+
content: string;
|
|
36
|
+
};
|
|
37
|
+
export type AiLink = {
|
|
38
|
+
summary?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
url?: string;
|
|
41
|
+
};
|
|
42
|
+
export type AiAskResult = {
|
|
43
|
+
agent: AiAgent;
|
|
44
|
+
assistantId: AiAssistantId;
|
|
45
|
+
completed: boolean;
|
|
46
|
+
content: string;
|
|
47
|
+
dialogueId: string;
|
|
48
|
+
followups: AiFollowup[];
|
|
49
|
+
gatewayRequestId?: string;
|
|
50
|
+
links: AiLink[];
|
|
51
|
+
requestId: string;
|
|
52
|
+
statuses: string[];
|
|
53
|
+
warnings: string[];
|
|
54
|
+
workspaceId?: string;
|
|
55
|
+
};
|
|
56
|
+
export type AiStreamChunk = {
|
|
57
|
+
[key: string]: unknown;
|
|
58
|
+
content?: unknown;
|
|
59
|
+
type: string;
|
|
60
|
+
};
|
|
61
|
+
export type AiStreamSummary = {
|
|
62
|
+
completed: boolean;
|
|
63
|
+
content: string;
|
|
64
|
+
followups: AiFollowup[];
|
|
65
|
+
gatewayRequestId?: string;
|
|
66
|
+
links: AiLink[];
|
|
67
|
+
statuses: string[];
|
|
68
|
+
warnings: string[];
|
|
69
|
+
};
|
|
70
|
+
export declare function assistantIdForAgent(agent: AiAgent): AiAssistantId;
|
|
71
|
+
export declare function workspacesEndpoint(): string;
|
|
72
|
+
export declare function workspaceEndpoint(workspaceId: string): string;
|
|
73
|
+
export declare function dialoguesEndpoint(): string;
|
|
74
|
+
export declare function dialogueEndpoint(dialogueId: string): string;
|
|
75
|
+
export declare function dialogueMessagesEndpoint(dialogueId: string): string;
|
|
76
|
+
export declare function buildDialogueName(kind: 'ask' | 'chat', agent: AiAgent): string;
|
|
77
|
+
export declare function enrichAiPrompt(prompt: string, context?: AiContextOptions): string;
|
|
78
|
+
export declare function normalizeAiWorkspace(value: unknown): AiWorkspace;
|
|
79
|
+
export declare function normalizeAiDialogue(value: unknown): AiDialogue;
|
|
80
|
+
export declare function validateAiContext(context: AiContextOptions): void;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { normalizeAiDialogueId, normalizeAiWorkspaceId } from './ai-config.js';
|
|
2
|
+
export const AI_ASK_AGENTS = ['plan', 'build', 'test', 'release', 'operate'];
|
|
3
|
+
export const AI_CHAT_AGENTS = [...AI_ASK_AGENTS, 'orchestrate'];
|
|
4
|
+
export function assistantIdForAgent(agent) {
|
|
5
|
+
return agent === 'orchestrate' ? 'generalist' : agent;
|
|
6
|
+
}
|
|
7
|
+
export function workspacesEndpoint() {
|
|
8
|
+
return '/workspaces';
|
|
9
|
+
}
|
|
10
|
+
export function workspaceEndpoint(workspaceId) {
|
|
11
|
+
return `/workspaces/${normalizeAiWorkspaceId(workspaceId)}`;
|
|
12
|
+
}
|
|
13
|
+
export function dialoguesEndpoint() {
|
|
14
|
+
return '/dialogues';
|
|
15
|
+
}
|
|
16
|
+
export function dialogueEndpoint(dialogueId) {
|
|
17
|
+
return `/dialogues/${normalizeAiDialogueId(dialogueId)}`;
|
|
18
|
+
}
|
|
19
|
+
export function dialogueMessagesEndpoint(dialogueId) {
|
|
20
|
+
return `/dialogues/${normalizeAiDialogueId(dialogueId)}/messages`;
|
|
21
|
+
}
|
|
22
|
+
export function buildDialogueName(kind, agent) {
|
|
23
|
+
return `cli-${kind}-${agent}`;
|
|
24
|
+
}
|
|
25
|
+
export function enrichAiPrompt(prompt, context = {}) {
|
|
26
|
+
const lines = [];
|
|
27
|
+
if (context.userStory !== undefined)
|
|
28
|
+
lines.push(`- User story: ${context.userStory}`);
|
|
29
|
+
if (context.sfOrg !== undefined)
|
|
30
|
+
lines.push(`- Salesforce environment: ${context.sfOrg}`);
|
|
31
|
+
if (context.component !== undefined)
|
|
32
|
+
lines.push(`- Component: ${context.component}`);
|
|
33
|
+
if (context.workItem !== undefined)
|
|
34
|
+
lines.push(`- Work item: ${context.workItem}`);
|
|
35
|
+
if (lines.length === 0)
|
|
36
|
+
return prompt;
|
|
37
|
+
return `${prompt}\n\n---\nContext:\n${lines.join('\n')}`;
|
|
38
|
+
}
|
|
39
|
+
export function normalizeAiWorkspace(value) {
|
|
40
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
41
|
+
throw new Error('AI workspace response was not an object.');
|
|
42
|
+
}
|
|
43
|
+
const workspace = value;
|
|
44
|
+
if (typeof workspace.id !== 'string' || workspace.id.trim().length === 0) {
|
|
45
|
+
throw new Error('AI workspace response did not include an id.');
|
|
46
|
+
}
|
|
47
|
+
return { ...value, id: workspace.id.trim() };
|
|
48
|
+
}
|
|
49
|
+
export function normalizeAiDialogue(value) {
|
|
50
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value)) {
|
|
51
|
+
throw new Error('AI dialogue response was not an object.');
|
|
52
|
+
}
|
|
53
|
+
const dialogue = value;
|
|
54
|
+
if (typeof dialogue.id !== 'string' || dialogue.id.trim().length === 0) {
|
|
55
|
+
throw new Error('AI dialogue response did not include an id.');
|
|
56
|
+
}
|
|
57
|
+
return { ...value, id: dialogue.id.trim() };
|
|
58
|
+
}
|
|
59
|
+
export function validateAiContext(context) {
|
|
60
|
+
for (const [label, value] of Object.entries(context)) {
|
|
61
|
+
if (typeof value === 'string' && value.trim().length === 0) {
|
|
62
|
+
throw new Error(`${label} value cannot be empty.`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=ai-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-types.js","sourceRoot":"","sources":["../../src/lib/ai-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,qBAAqB,EAAE,sBAAsB,EAAC,MAAM,gBAAgB,CAAA;AAE5E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAU,CAAA;AACrF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,aAAa,EAAE,aAAa,CAAU,CAAA;AA+ExE,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAA;AACvD,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,aAAa,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,OAAO,eAAe,sBAAsB,CAAC,WAAW,CAAC,EAAE,CAAA;AAC7D,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAAkB;IACjD,OAAO,cAAc,qBAAqB,CAAC,UAAU,CAAC,EAAE,CAAA;AAC1D,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACzD,OAAO,cAAc,qBAAqB,CAAC,UAAU,CAAC,WAAW,CAAA;AACnE,CAAC;AA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AAK,CAAC,8CAA8C,CAAC,CAAA;IACjE,CAAC;IAED,OAAO,EAAC,GAAI,KAAiC,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,EAAgB,CAAA;AACxF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAA;IAC5D,CAAC;IAED,MAAM,QAAQ,GAAG,KAA4B,CAAA;IAC7C,IAAI,OAAO,QAAQ,CAAC,EAAE,KAAK,QAAQ,IAAI,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAChE,CAAC;IAED,OAAO,EAAC,GAAI,KAAiC,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAe,CAAA;AACtF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAyB;IACzD,KAAK,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,yBAAyB,CAAC,CAAA;QACpD,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type CredentialType } from './credential-store.js';
|
|
2
2
|
export declare const COPADO_ACCOUNT_SUMMARY_LOGIN_URL = "https://login.salesforce.com/?startURL=%2Flightning%2Fn%2Fcopado__Account_Summary";
|
|
3
3
|
export type AuthSetResult = {
|
|
4
|
+
ai?: {
|
|
5
|
+
domain?: string;
|
|
6
|
+
gatewayUrl?: string;
|
|
7
|
+
orgId?: number;
|
|
8
|
+
workspaceId?: string;
|
|
9
|
+
};
|
|
4
10
|
baseUrl?: string;
|
|
5
11
|
crt?: {
|
|
6
12
|
domain?: string;
|
|
@@ -20,6 +26,11 @@ export type AuthUnsetResult = {
|
|
|
20
26
|
removed: AuthUnsetCredentialResult[];
|
|
21
27
|
};
|
|
22
28
|
export type ApplyAuthSetInput = {
|
|
29
|
+
ai?: string;
|
|
30
|
+
aiDomain?: string;
|
|
31
|
+
aiGatewayUrl?: string;
|
|
32
|
+
aiOrg?: number;
|
|
33
|
+
aiWorkspace?: string;
|
|
23
34
|
cicd?: string;
|
|
24
35
|
crt?: string;
|
|
25
36
|
crtDomain?: string;
|
|
@@ -39,6 +50,14 @@ export type CrtAuthStatus = {
|
|
|
39
50
|
orgId?: null | string;
|
|
40
51
|
set: boolean;
|
|
41
52
|
};
|
|
53
|
+
export type AiAuthStatus = {
|
|
54
|
+
domain?: null | string;
|
|
55
|
+
gatewayUrl?: null | string;
|
|
56
|
+
masked?: string;
|
|
57
|
+
orgId?: null | string;
|
|
58
|
+
set: boolean;
|
|
59
|
+
workspaceId?: null | string;
|
|
60
|
+
};
|
|
42
61
|
export declare class AuthSetError extends Error {
|
|
43
62
|
readonly exitCode: number;
|
|
44
63
|
constructor(message: string, exitCode?: number);
|
|
@@ -47,8 +66,10 @@ export declare function formatTerminalHyperlink(label: string, url: string): str
|
|
|
47
66
|
export declare function formatCicdApiKeyHelp(): string;
|
|
48
67
|
export declare function getCicdAuthStatus(): CicdAuthStatus;
|
|
49
68
|
export declare function getCrtAuthStatus(): CrtAuthStatus;
|
|
69
|
+
export declare function getAiAuthStatus(): AiAuthStatus;
|
|
50
70
|
export declare function isCicdConfigured(): boolean;
|
|
51
71
|
export declare function resolveAuthUnsetTypes(options: {
|
|
72
|
+
ai?: boolean;
|
|
52
73
|
cicd?: boolean;
|
|
53
74
|
crt?: boolean;
|
|
54
75
|
}): CredentialType[];
|