@agentled/cli 0.1.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/README.md +79 -0
- package/dist/client.d.ts +35 -0
- package/dist/client.js +107 -0
- package/dist/client.js.map +1 -0
- package/dist/commands/ai.d.ts +2 -0
- package/dist/commands/ai.js +34 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/apps.d.ts +2 -0
- package/dist/commands/apps.js +53 -0
- package/dist/commands/apps.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +247 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/chat.d.ts +12 -0
- package/dist/commands/chat.js +34 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/do.d.ts +13 -0
- package/dist/commands/do.js +80 -0
- package/dist/commands/do.js.map +1 -0
- package/dist/commands/executions.d.ts +2 -0
- package/dist/commands/executions.js +143 -0
- package/dist/commands/executions.js.map +1 -0
- package/dist/commands/knowledge.d.ts +2 -0
- package/dist/commands/knowledge.js +97 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/onboarding.d.ts +12 -0
- package/dist/commands/onboarding.js +86 -0
- package/dist/commands/onboarding.js.map +1 -0
- package/dist/commands/workflows.d.ts +2 -0
- package/dist/commands/workflows.js +429 -0
- package/dist/commands/workflows.js.map +1 -0
- package/dist/commands/workspace.d.ts +2 -0
- package/dist/commands/workspace.js +156 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/browser-auth.d.ts +24 -0
- package/dist/utils/browser-auth.js +172 -0
- package/dist/utils/browser-auth.js.map +1 -0
- package/dist/utils/output.d.ts +11 -0
- package/dist/utils/output.js +56 -0
- package/dist/utils/output.js.map +1 -0
- package/llms-full.txt +494 -0
- package/llms.txt +20 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @agentled/cli
|
|
2
|
+
|
|
3
|
+
Command-line access to Agentled workflows, apps, knowledge, and workspace operations.
|
|
4
|
+
|
|
5
|
+
This is the canonical customer-facing CLI package for Agentled. It uses the same external API surface as the MCP server, but without MCP tool-definition overhead in the agent context window.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @agentled/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
agentled auth login
|
|
17
|
+
agentled auth current
|
|
18
|
+
agentled workflows list
|
|
19
|
+
agentled workspace info
|
|
20
|
+
agentled workspace company-profile
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Authentication and workspace profiles
|
|
24
|
+
|
|
25
|
+
The CLI stores multiple saved workspace profiles in `~/.agentled/config.json`.
|
|
26
|
+
Normal commands use the active saved workspace by default.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Add or refresh a workspace profile
|
|
30
|
+
agentled auth login
|
|
31
|
+
|
|
32
|
+
# Inspect the active workspace profile
|
|
33
|
+
agentled auth current
|
|
34
|
+
|
|
35
|
+
# List all saved workspaces
|
|
36
|
+
agentled auth list
|
|
37
|
+
|
|
38
|
+
# Switch the active workspace
|
|
39
|
+
agentled auth use bestseo4u
|
|
40
|
+
|
|
41
|
+
# Target a different saved workspace for one command only
|
|
42
|
+
agentled --workspace inovexus workflows list
|
|
43
|
+
# or
|
|
44
|
+
AGENTLED_WORKSPACE=inovexus agentled workflows list
|
|
45
|
+
|
|
46
|
+
# Remove one saved workspace profile
|
|
47
|
+
agentled auth remove bestseo4u
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Company profile commands
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Get company profile + offerings
|
|
54
|
+
agentled workspace company-profile
|
|
55
|
+
|
|
56
|
+
# Update top-level company fields
|
|
57
|
+
agentled workspace update-company-profile --input '{"name":"Acme","urls":["https://acme.com"]}'
|
|
58
|
+
|
|
59
|
+
# Upsert offerings from a JSON file
|
|
60
|
+
agentled workspace upsert-company-offerings --file ./offerings.json
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Local development
|
|
64
|
+
|
|
65
|
+
Use the built `dist/` entrypoint when testing unpublished CLI changes locally.
|
|
66
|
+
Do not use `npx -y @agentled/cli` for this, because `npx` resolves the latest
|
|
67
|
+
published npm package.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
cd packages/cli
|
|
71
|
+
npm run build
|
|
72
|
+
|
|
73
|
+
node dist/index.js --help
|
|
74
|
+
AGENTLED_URL=http://localhost:8080 node dist/index.js workflows list
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Base URL
|
|
78
|
+
|
|
79
|
+
The CLI defaults to `https://www.agentled.app`. Override it with `AGENTLED_URL` only when testing against another environment.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentledClient — CLI-facing wrapper around the shared Agentled external API client.
|
|
3
|
+
*
|
|
4
|
+
* Reads credentials from:
|
|
5
|
+
* 1. AGENTLED_API_KEY env var
|
|
6
|
+
* 2. ~/.agentled/config.json (active workspace profile)
|
|
7
|
+
*
|
|
8
|
+
* Base URL from AGENTLED_URL env var or config file (default: https://www.agentled.app)
|
|
9
|
+
*/
|
|
10
|
+
import { AgentledApiClient, DEFAULT_AGENTLED_URL, type AgentledConfig, type AgentledUserProfile, type AgentledWorkspaceProfile, type UpsertAgentledWorkspaceProfileInput } from '@agentled/core';
|
|
11
|
+
export type { AgentledConfig, AgentledUserProfile, AgentledWorkspaceProfile, UpsertAgentledWorkspaceProfileInput, };
|
|
12
|
+
export { DEFAULT_AGENTLED_URL };
|
|
13
|
+
export interface AgentledAuthContext {
|
|
14
|
+
authenticated: boolean;
|
|
15
|
+
source: 'environment' | 'config' | 'none';
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
baseUrl: string;
|
|
18
|
+
workspace?: AgentledWorkspaceProfile;
|
|
19
|
+
config: AgentledConfig;
|
|
20
|
+
}
|
|
21
|
+
export declare function loadConfig(): AgentledConfig;
|
|
22
|
+
export declare function getWorkspaceSelector(): string | undefined;
|
|
23
|
+
export declare function listWorkspaces(config?: AgentledConfig): AgentledWorkspaceProfile[];
|
|
24
|
+
export declare function getSelectedWorkspace(config?: AgentledConfig, workspaceRef?: string | undefined): AgentledWorkspaceProfile | undefined;
|
|
25
|
+
export declare function getBaseUrl(): string;
|
|
26
|
+
export declare function saveConfig(config: AgentledConfig): void;
|
|
27
|
+
export declare function deleteConfig(): boolean;
|
|
28
|
+
export declare function getConfigPath(): string;
|
|
29
|
+
export declare function saveWorkspaceProfile(input: UpsertAgentledWorkspaceProfileInput): AgentledConfig;
|
|
30
|
+
export declare function setActiveWorkspace(workspaceRef: string): AgentledConfig;
|
|
31
|
+
export declare function removeWorkspace(workspaceRef: string): AgentledConfig;
|
|
32
|
+
export declare function resolveAuthContext(): AgentledAuthContext;
|
|
33
|
+
export declare class AgentledClient extends AgentledApiClient {
|
|
34
|
+
constructor();
|
|
35
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentledClient — CLI-facing wrapper around the shared Agentled external API client.
|
|
3
|
+
*
|
|
4
|
+
* Reads credentials from:
|
|
5
|
+
* 1. AGENTLED_API_KEY env var
|
|
6
|
+
* 2. ~/.agentled/config.json (active workspace profile)
|
|
7
|
+
*
|
|
8
|
+
* Base URL from AGENTLED_URL env var or config file (default: https://www.agentled.app)
|
|
9
|
+
*/
|
|
10
|
+
import { AgentledApiClient, DEFAULT_AGENTLED_URL, deleteAgentledConfig, getAgentledBaseUrl, getAgentledConfigPath, listAgentledWorkspaceProfiles, loadAgentledConfig, removeAgentledWorkspaceProfile, resolveAgentledWorkspaceProfile, saveAgentledConfig, setActiveAgentledWorkspaceProfile, upsertAgentledWorkspaceProfile, } from '@agentled/core';
|
|
11
|
+
export { DEFAULT_AGENTLED_URL };
|
|
12
|
+
export function loadConfig() {
|
|
13
|
+
return loadAgentledConfig();
|
|
14
|
+
}
|
|
15
|
+
export function getWorkspaceSelector() {
|
|
16
|
+
const workspace = process.env.AGENTLED_WORKSPACE?.trim();
|
|
17
|
+
return workspace || undefined;
|
|
18
|
+
}
|
|
19
|
+
export function listWorkspaces(config = loadAgentledConfig()) {
|
|
20
|
+
return listAgentledWorkspaceProfiles(config);
|
|
21
|
+
}
|
|
22
|
+
export function getSelectedWorkspace(config = loadAgentledConfig(), workspaceRef = getWorkspaceSelector()) {
|
|
23
|
+
return resolveAgentledWorkspaceProfile(config, workspaceRef);
|
|
24
|
+
}
|
|
25
|
+
export function getBaseUrl() {
|
|
26
|
+
const config = loadAgentledConfig();
|
|
27
|
+
return getAgentledBaseUrl({
|
|
28
|
+
baseUrl: process.env.AGENTLED_URL,
|
|
29
|
+
config,
|
|
30
|
+
workspace: getWorkspaceSelector(),
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function saveConfig(config) {
|
|
34
|
+
saveAgentledConfig(config);
|
|
35
|
+
}
|
|
36
|
+
export function deleteConfig() {
|
|
37
|
+
return deleteAgentledConfig();
|
|
38
|
+
}
|
|
39
|
+
export function getConfigPath() {
|
|
40
|
+
return getAgentledConfigPath();
|
|
41
|
+
}
|
|
42
|
+
export function saveWorkspaceProfile(input) {
|
|
43
|
+
const nextConfig = upsertAgentledWorkspaceProfile(loadAgentledConfig(), input);
|
|
44
|
+
saveAgentledConfig(nextConfig);
|
|
45
|
+
return nextConfig;
|
|
46
|
+
}
|
|
47
|
+
export function setActiveWorkspace(workspaceRef) {
|
|
48
|
+
const nextConfig = setActiveAgentledWorkspaceProfile(loadAgentledConfig(), workspaceRef);
|
|
49
|
+
saveAgentledConfig(nextConfig);
|
|
50
|
+
return nextConfig;
|
|
51
|
+
}
|
|
52
|
+
export function removeWorkspace(workspaceRef) {
|
|
53
|
+
const nextConfig = removeAgentledWorkspaceProfile(loadAgentledConfig(), workspaceRef);
|
|
54
|
+
if (listAgentledWorkspaceProfiles(nextConfig).length === 0) {
|
|
55
|
+
deleteAgentledConfig();
|
|
56
|
+
return nextConfig;
|
|
57
|
+
}
|
|
58
|
+
saveAgentledConfig(nextConfig);
|
|
59
|
+
return nextConfig;
|
|
60
|
+
}
|
|
61
|
+
export function resolveAuthContext() {
|
|
62
|
+
const config = loadAgentledConfig();
|
|
63
|
+
const workspace = getSelectedWorkspace(config);
|
|
64
|
+
const baseUrl = getAgentledBaseUrl({
|
|
65
|
+
baseUrl: process.env.AGENTLED_URL,
|
|
66
|
+
config,
|
|
67
|
+
workspace: getWorkspaceSelector(),
|
|
68
|
+
});
|
|
69
|
+
if (process.env.AGENTLED_API_KEY) {
|
|
70
|
+
return {
|
|
71
|
+
authenticated: true,
|
|
72
|
+
source: 'environment',
|
|
73
|
+
apiKey: process.env.AGENTLED_API_KEY,
|
|
74
|
+
baseUrl,
|
|
75
|
+
workspace,
|
|
76
|
+
config,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (workspace?.apiKey) {
|
|
80
|
+
return {
|
|
81
|
+
authenticated: true,
|
|
82
|
+
source: 'config',
|
|
83
|
+
apiKey: workspace.apiKey,
|
|
84
|
+
baseUrl,
|
|
85
|
+
workspace,
|
|
86
|
+
config,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
authenticated: false,
|
|
91
|
+
source: 'none',
|
|
92
|
+
baseUrl,
|
|
93
|
+
workspace,
|
|
94
|
+
config,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export class AgentledClient extends AgentledApiClient {
|
|
98
|
+
constructor() {
|
|
99
|
+
const authContext = resolveAuthContext();
|
|
100
|
+
super({
|
|
101
|
+
apiKey: authContext.apiKey || '',
|
|
102
|
+
baseUrl: authContext.baseUrl || DEFAULT_AGENTLED_URL,
|
|
103
|
+
missingAuthMessage: 'Not authenticated. Run "agentled auth login" or set AGENTLED_API_KEY.',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACH,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,kBAAkB,EAClB,8BAA8B,EAC9B,+BAA+B,EAC/B,kBAAkB,EAClB,iCAAiC,EACjC,8BAA8B,GAKjC,MAAM,gBAAgB,CAAC;AAQxB,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAWhC,MAAM,UAAU,UAAU;IACtB,OAAO,kBAAkB,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,oBAAoB;IAChC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,IAAI,EAAE,CAAC;IACzD,OAAO,SAAS,IAAI,SAAS,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAyB,kBAAkB,EAAE;IACxE,OAAO,6BAA6B,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAChC,SAAyB,kBAAkB,EAAE,EAC7C,eAAmC,oBAAoB,EAAE;IAEzD,OAAO,+BAA+B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,UAAU;IACtB,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,OAAO,kBAAkB,CAAC;QACtB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QACjC,MAAM;QACN,SAAS,EAAE,oBAAoB,EAAE;KACpC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAA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C,gBAAgB,EAAE,CAAC;QAC/B,OAAO;YACH,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,gBAAgB;YACpC,OAAO;YACP,SAAS;YACT,MAAM;SACT,CAAC;IACN,CAAC;IAED,IAAI,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,OAAO;YACH,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,OAAO;YACP,SAAS;YACT,MAAM;SACT,CAAC;IACN,CAAC;IAED,OAAO;QACH,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,MAAM;QACd,OAAO;QACP,SAAS;QACT,MAAM;KACT,CAAC;AACN,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,iBAAiB;IACjD;QACI,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;QAEzC,KAAK,CAAC;YACF,MAAM,EAAE,WAAW,CAAC,MAAM,IAAI,EAAE;YAChC,OAAO,EAAE,WAAW,CAAC,OAAO,IAAI,oBAAoB;YACpD,kBAAkB,EAAE,uEAAuE;SAC9F,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AgentledClient } from '../client.js';
|
|
2
|
+
import { printOutput, printError } from '../utils/output.js';
|
|
3
|
+
export function registerAiCommands(program) {
|
|
4
|
+
const ai = program
|
|
5
|
+
.command('ai')
|
|
6
|
+
.description('Test AI actions');
|
|
7
|
+
ai
|
|
8
|
+
.command('test')
|
|
9
|
+
.description('Test an AI prompt with variables and response structure')
|
|
10
|
+
.requiredOption('--template <template>', 'Prompt template with {{variables}}')
|
|
11
|
+
.option('--vars <json>', 'Variables as JSON')
|
|
12
|
+
.option('--response-structure <json>', 'Expected output shape as JSON')
|
|
13
|
+
.option('--response-type <type>', 'Response type')
|
|
14
|
+
.option('--system-prompt <prompt>', 'System prompt')
|
|
15
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
16
|
+
.action(async (opts) => {
|
|
17
|
+
try {
|
|
18
|
+
const variables = opts.vars ? JSON.parse(opts.vars) : undefined;
|
|
19
|
+
const responseStructure = opts.responseStructure
|
|
20
|
+
? JSON.parse(opts.responseStructure)
|
|
21
|
+
: undefined;
|
|
22
|
+
const client = new AgentledClient();
|
|
23
|
+
const result = await client.testAiAction(opts.template, variables, responseStructure, {
|
|
24
|
+
responseType: opts.responseType,
|
|
25
|
+
systemPrompt: opts.systemPrompt,
|
|
26
|
+
});
|
|
27
|
+
printOutput(result, opts.format);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
printError(e.message);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../../src/commands/ai.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAE3E,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IAC/C,MAAM,EAAE,GAAG,OAAO;SACb,OAAO,CAAC,IAAI,CAAC;SACb,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAEpC,EAAE;SACG,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,yDAAyD,CAAC;SACtE,cAAc,CAAC,uBAAuB,EAAE,oCAAoC,CAAC;SAC7E,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC;SAC5C,MAAM,CAAC,6BAA6B,EAAE,+BAA+B,CAAC;SACtE,MAAM,CAAC,wBAAwB,EAAE,eAAe,CAAC;SACjD,MAAM,CAAC,0BAA0B,EAAE,eAAe,CAAC;SACnD,MAAM,CAAC,gBAAgB,EAAE,eAAe,EAAE,MAAM,CAAC;SACjD,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACnB,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAChE,MAAM,iBAAiB,GAAG,IAAI,CAAC,iBAAiB;gBAC5C,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC;gBACpC,CAAC,CAAC,SAAS,CAAC;YAChB,MAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,YAAY,CACpC,IAAI,CAAC,QAAQ,EACb,SAAS,EACT,iBAAiB,EACjB;gBACI,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;aAClC,CACJ,CAAC;YACF,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAsB,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AgentledClient } from '../client.js';
|
|
2
|
+
import { printOutput, printError } from '../utils/output.js';
|
|
3
|
+
export function registerAppCommands(program) {
|
|
4
|
+
const apps = program
|
|
5
|
+
.command('apps')
|
|
6
|
+
.description('Discover apps and test actions');
|
|
7
|
+
apps
|
|
8
|
+
.command('list')
|
|
9
|
+
.description('List available apps and integrations')
|
|
10
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
11
|
+
.action(async (opts) => {
|
|
12
|
+
try {
|
|
13
|
+
const client = new AgentledClient();
|
|
14
|
+
const result = await client.listApps();
|
|
15
|
+
printOutput(result, opts.format);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
printError(e.message);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
apps
|
|
22
|
+
.command('actions <appId>')
|
|
23
|
+
.description('Get action schemas for an app')
|
|
24
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
25
|
+
.action(async (appId, opts) => {
|
|
26
|
+
try {
|
|
27
|
+
const client = new AgentledClient();
|
|
28
|
+
const result = await client.getAppActions(appId);
|
|
29
|
+
printOutput(result, opts.format);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
printError(e.message);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
apps
|
|
36
|
+
.command('test <appId> <actionId>')
|
|
37
|
+
.description('Test an app action with sample input')
|
|
38
|
+
.option('--input <json>', 'Input data as JSON')
|
|
39
|
+
.option('--bypass-cache', 'Bypass cached results')
|
|
40
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
41
|
+
.action(async (appId, actionId, opts) => {
|
|
42
|
+
try {
|
|
43
|
+
const input = opts.input ? JSON.parse(opts.input) : undefined;
|
|
44
|
+
const client = new AgentledClient();
|
|
45
|
+
const result = await client.testAppAction(appId, actionId, input, opts.bypassCache);
|
|
46
|
+
printOutput(result, opts.format);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
printError(e.message);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAE3E,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAChD,MAAM,IAAI,GAAG,OAAO;SACf,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,gCAA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Ae,EAAE,MAAM,CAAC;SACjD,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;QACpC,IAAI,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9D,MAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;YACpF,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAsB,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import * as readline from 'node:readline';
|
|
3
|
+
import { AgentledApiClient } from '@agentled/core';
|
|
4
|
+
import { getBaseUrl, getConfigPath, getSelectedWorkspace, listWorkspaces, loadConfig, removeWorkspace, resolveAuthContext, saveWorkspaceProfile, setActiveWorkspace, deleteConfig, } from '../client.js';
|
|
5
|
+
import { browserLogin } from '../utils/browser-auth.js';
|
|
6
|
+
import { printError, printOutput } from '../utils/output.js';
|
|
7
|
+
import { runOnboarding } from './onboarding.js';
|
|
8
|
+
function prompt(question) {
|
|
9
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
10
|
+
return new Promise(resolve => {
|
|
11
|
+
rl.question(question, answer => {
|
|
12
|
+
rl.close();
|
|
13
|
+
resolve(answer.trim());
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function pluralize(count, singular, plural) {
|
|
18
|
+
return count === 1 ? singular : plural;
|
|
19
|
+
}
|
|
20
|
+
function describeWorkspace(workspace) {
|
|
21
|
+
if (!workspace)
|
|
22
|
+
return 'unknown workspace';
|
|
23
|
+
return workspace.alias ? `${workspace.name} (${workspace.alias})` : workspace.name;
|
|
24
|
+
}
|
|
25
|
+
function listWorkspaceHints(workspaces) {
|
|
26
|
+
if (!workspaces.length)
|
|
27
|
+
return 'No saved workspaces.';
|
|
28
|
+
return workspaces
|
|
29
|
+
.map(workspace => workspace.alias || workspace.name || workspace.id)
|
|
30
|
+
.join(', ');
|
|
31
|
+
}
|
|
32
|
+
async function resolveWorkspaceFromApiKey(apiKey, baseUrl) {
|
|
33
|
+
const client = new AgentledApiClient({
|
|
34
|
+
apiKey,
|
|
35
|
+
baseUrl,
|
|
36
|
+
missingAuthMessage: 'API key is required.',
|
|
37
|
+
});
|
|
38
|
+
const result = await client.getWorkspace();
|
|
39
|
+
const workspaceId = result?.workspace?.id;
|
|
40
|
+
const workspaceName = result?.workspace?.name || result?.company?.name || 'Workspace';
|
|
41
|
+
if (!workspaceId) {
|
|
42
|
+
throw new Error('Authenticated, but the workspace response did not include workspace.id.');
|
|
43
|
+
}
|
|
44
|
+
return { workspaceId, workspaceName };
|
|
45
|
+
}
|
|
46
|
+
function printSavedWorkspaceSummary() {
|
|
47
|
+
const savedWorkspaces = listWorkspaces();
|
|
48
|
+
const count = savedWorkspaces.length;
|
|
49
|
+
console.log(`Saved ${count} ${pluralize(count, 'workspace', 'workspaces')}. Use "agentled auth list" to inspect them.`);
|
|
50
|
+
}
|
|
51
|
+
export function registerAuthCommands(program) {
|
|
52
|
+
const auth = program.command('auth').description('Manage authentication');
|
|
53
|
+
auth
|
|
54
|
+
.command('login')
|
|
55
|
+
.description('Authenticate with Agentled (opens browser by default)')
|
|
56
|
+
.option('--key <apiKey>', 'API key (wsk_...) — skip browser flow')
|
|
57
|
+
.option('--alias <alias>', 'Optional local alias for this workspace profile')
|
|
58
|
+
.option('--url <baseUrl>', 'Base URL (default: https://www.agentled.app)')
|
|
59
|
+
.option('--no-browser', 'Skip browser flow, prompt for API key instead')
|
|
60
|
+
.action(async (opts) => {
|
|
61
|
+
const baseUrl = opts.url || getBaseUrl();
|
|
62
|
+
if (opts.key) {
|
|
63
|
+
if (!opts.key.startsWith('wsk_')) {
|
|
64
|
+
console.error('Error: API key should start with "wsk_". Generate one in Workspace Settings > Developer.');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
const workspace = await resolveWorkspaceFromApiKey(opts.key, baseUrl);
|
|
69
|
+
saveWorkspaceProfile({
|
|
70
|
+
id: workspace.workspaceId,
|
|
71
|
+
name: workspace.workspaceName,
|
|
72
|
+
apiKey: opts.key,
|
|
73
|
+
baseUrl,
|
|
74
|
+
alias: opts.alias,
|
|
75
|
+
});
|
|
76
|
+
console.log(`Authenticated to workspace "${workspace.workspaceName}" ✓`);
|
|
77
|
+
printSavedWorkspaceSummary();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
printError(error.message);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (opts.browser === false) {
|
|
85
|
+
const apiKey = await prompt('Enter your API key (wsk_...): ');
|
|
86
|
+
if (!apiKey.startsWith('wsk_')) {
|
|
87
|
+
console.error('Error: API key should start with "wsk_". Generate one in Workspace Settings > Developer.');
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
const workspace = await resolveWorkspaceFromApiKey(apiKey, baseUrl);
|
|
92
|
+
saveWorkspaceProfile({
|
|
93
|
+
id: workspace.workspaceId,
|
|
94
|
+
name: workspace.workspaceName,
|
|
95
|
+
apiKey,
|
|
96
|
+
baseUrl,
|
|
97
|
+
alias: opts.alias,
|
|
98
|
+
});
|
|
99
|
+
console.log(`Authenticated to workspace "${workspace.workspaceName}" ✓`);
|
|
100
|
+
printSavedWorkspaceSummary();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
printError(error.message);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const result = await browserLogin(baseUrl);
|
|
109
|
+
saveWorkspaceProfile({
|
|
110
|
+
id: result.workspaceId,
|
|
111
|
+
name: result.workspaceName,
|
|
112
|
+
apiKey: result.apiKey,
|
|
113
|
+
baseUrl: result.baseUrl || baseUrl,
|
|
114
|
+
userId: result.userId,
|
|
115
|
+
userEmail: result.userEmail,
|
|
116
|
+
userName: result.userName,
|
|
117
|
+
alias: opts.alias,
|
|
118
|
+
});
|
|
119
|
+
console.log(`Authenticated to workspace "${result.workspaceName}" ✓`);
|
|
120
|
+
printSavedWorkspaceSummary();
|
|
121
|
+
if (result.isNewUser) {
|
|
122
|
+
await runOnboarding();
|
|
123
|
+
}
|
|
124
|
+
console.log('Run `agentled --help` to get started.');
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
console.error(`\nLogin failed: ${err.message}`);
|
|
128
|
+
console.error('\nAlternatives:');
|
|
129
|
+
console.error(' agentled auth login --no-browser (prompt for API key)');
|
|
130
|
+
console.error(' agentled auth login --key wsk_... (direct API key)');
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
auth
|
|
135
|
+
.command('status')
|
|
136
|
+
.description('Check authentication status')
|
|
137
|
+
.action(() => {
|
|
138
|
+
const authContext = resolveAuthContext();
|
|
139
|
+
if (!authContext.authenticated) {
|
|
140
|
+
console.log('Not authenticated. Run "agentled auth login" or set AGENTLED_API_KEY.');
|
|
141
|
+
process.exit(1);
|
|
142
|
+
}
|
|
143
|
+
const savedCount = listWorkspaces(authContext.config).length;
|
|
144
|
+
const viaEnv = authContext.source === 'environment';
|
|
145
|
+
const workspaceLabel = describeWorkspace(authContext.workspace);
|
|
146
|
+
if (viaEnv) {
|
|
147
|
+
console.log(`Authenticated via AGENTLED_API_KEY (${workspaceLabel}).`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
console.log(`Authenticated to workspace "${workspaceLabel}" (${savedCount} saved ${pluralize(savedCount, 'workspace', 'workspaces')}).`);
|
|
151
|
+
});
|
|
152
|
+
auth
|
|
153
|
+
.command('current')
|
|
154
|
+
.description('Show the current authenticated workspace profile')
|
|
155
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
156
|
+
.action((opts) => {
|
|
157
|
+
const authContext = resolveAuthContext();
|
|
158
|
+
const savedCount = listWorkspaces(authContext.config).length;
|
|
159
|
+
printOutput({
|
|
160
|
+
authenticated: authContext.authenticated,
|
|
161
|
+
source: authContext.source,
|
|
162
|
+
baseUrl: authContext.baseUrl,
|
|
163
|
+
configPath: getConfigPath(),
|
|
164
|
+
activeWorkspace: authContext.workspace
|
|
165
|
+
? {
|
|
166
|
+
id: authContext.workspace.id,
|
|
167
|
+
name: authContext.workspace.name,
|
|
168
|
+
alias: authContext.workspace.alias,
|
|
169
|
+
userId: authContext.workspace.userId,
|
|
170
|
+
userEmail: authContext.workspace.userEmail,
|
|
171
|
+
userName: authContext.workspace.userName,
|
|
172
|
+
}
|
|
173
|
+
: null,
|
|
174
|
+
savedWorkspaceCount: savedCount,
|
|
175
|
+
}, opts.format);
|
|
176
|
+
});
|
|
177
|
+
auth
|
|
178
|
+
.command('list')
|
|
179
|
+
.description('List saved workspace profiles')
|
|
180
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
181
|
+
.action((opts) => {
|
|
182
|
+
const config = loadConfig();
|
|
183
|
+
const workspaces = listWorkspaces(config).map(workspace => ({
|
|
184
|
+
active: workspace.id === config.activeWorkspaceId,
|
|
185
|
+
id: workspace.id,
|
|
186
|
+
name: workspace.name,
|
|
187
|
+
alias: workspace.alias,
|
|
188
|
+
userEmail: workspace.userEmail,
|
|
189
|
+
baseUrl: workspace.baseUrl,
|
|
190
|
+
lastUsedAt: workspace.lastUsedAt,
|
|
191
|
+
}));
|
|
192
|
+
printOutput(workspaces, opts.format);
|
|
193
|
+
});
|
|
194
|
+
auth
|
|
195
|
+
.command('use <workspace>')
|
|
196
|
+
.description('Make a saved workspace profile active')
|
|
197
|
+
.action((workspaceRef) => {
|
|
198
|
+
const config = loadConfig();
|
|
199
|
+
const workspace = getSelectedWorkspace(config, workspaceRef);
|
|
200
|
+
if (!workspace) {
|
|
201
|
+
printError(`Unknown workspace "${workspaceRef}". Saved workspaces: ${listWorkspaceHints(listWorkspaces(config))}`);
|
|
202
|
+
}
|
|
203
|
+
setActiveWorkspace(workspaceRef);
|
|
204
|
+
console.log(`Active workspace set to "${describeWorkspace(workspace)}".`);
|
|
205
|
+
});
|
|
206
|
+
auth
|
|
207
|
+
.command('remove <workspace>')
|
|
208
|
+
.description('Remove a saved workspace profile')
|
|
209
|
+
.action((workspaceRef) => {
|
|
210
|
+
const config = loadConfig();
|
|
211
|
+
const workspace = getSelectedWorkspace(config, workspaceRef);
|
|
212
|
+
if (!workspace) {
|
|
213
|
+
printError(`Unknown workspace "${workspaceRef}". Saved workspaces: ${listWorkspaceHints(listWorkspaces(config))}`);
|
|
214
|
+
}
|
|
215
|
+
const nextConfig = removeWorkspace(workspaceRef);
|
|
216
|
+
const remaining = listWorkspaces(nextConfig).length;
|
|
217
|
+
console.log(`Removed workspace "${describeWorkspace(workspace)}". ${remaining} ${pluralize(remaining, 'workspace remains', 'workspaces remain')}.`);
|
|
218
|
+
});
|
|
219
|
+
auth
|
|
220
|
+
.command('logout')
|
|
221
|
+
.description('Remove all stored credentials')
|
|
222
|
+
.action(() => {
|
|
223
|
+
if (deleteConfig()) {
|
|
224
|
+
console.log('Logged out. All saved workspaces removed.');
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
console.log('No stored credentials found.');
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
auth
|
|
231
|
+
.command('whoami')
|
|
232
|
+
.description('Alias for auth current')
|
|
233
|
+
.option('--format <fmt>', 'Output format', 'json')
|
|
234
|
+
.action((opts) => {
|
|
235
|
+
const authContext = resolveAuthContext();
|
|
236
|
+
const savedCount = listWorkspaces(authContext.config).length;
|
|
237
|
+
printOutput({
|
|
238
|
+
authenticated: authContext.authenticated,
|
|
239
|
+
source: authContext.source,
|
|
240
|
+
baseUrl: authContext.baseUrl,
|
|
241
|
+
configPath: getConfigPath(),
|
|
242
|
+
activeWorkspace: authContext.workspace ?? null,
|
|
243
|
+
savedWorkspaceCount: savedCount,
|
|
244
|
+
}, opts.format);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EACH,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,YAAY,GAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAqB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,SAAS,MAAM,CAAC,QAAgB;IAC5B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QACzB,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE;YAC3B,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,O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AAI;SACC,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,wBAAwB,CAAC;SACrC,MAAM,CAAC,gBAAgB,EAAE,eAAe,EAAE,MAAM,CAAC;SACjD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACb,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAC;QACzC,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QAE7D,WAAW,CAAC;YACR,aAAa,EAAE,WAAW,CAAC,aAAa;YACxC,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,UAAU,EAAE,aAAa,EAAE;YAC3B,eAAe,EAAE,WAAW,CAAC,SAAS,IAAI,IAAI;YAC9C,mBAAmB,EAAE,UAAU;SAClC,EAAE,IAAI,CAAC,MAAsB,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agentled chat` — Conversational interface to Agentled.
|
|
3
|
+
*
|
|
4
|
+
* Send a message and get a response from the Agentled AI assistant.
|
|
5
|
+
* Optionally continue a conversation with --session-id.
|
|
6
|
+
*
|
|
7
|
+
* Examples:
|
|
8
|
+
* agentled chat "List my workflows"
|
|
9
|
+
* agentled chat "Create a workflow that enriches companies" --session-id abc123
|
|
10
|
+
*/
|
|
11
|
+
import { Command } from 'commander';
|
|
12
|
+
export declare function registerChatCommands(program: Command): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agentled chat` — Conversational interface to Agentled.
|
|
3
|
+
*
|
|
4
|
+
* Send a message and get a response from the Agentled AI assistant.
|
|
5
|
+
* Optionally continue a conversation with --session-id.
|
|
6
|
+
*
|
|
7
|
+
* Examples:
|
|
8
|
+
* agentled chat "List my workflows"
|
|
9
|
+
* agentled chat "Create a workflow that enriches companies" --session-id abc123
|
|
10
|
+
*/
|
|
11
|
+
import { AgentledClient } from '../client.js';
|
|
12
|
+
import { printOutput, printError } from '../utils/output.js';
|
|
13
|
+
export function registerChatCommands(program) {
|
|
14
|
+
program
|
|
15
|
+
.command('chat <message>')
|
|
16
|
+
.description('Send a message to the Agentled AI assistant')
|
|
17
|
+
.option('--session-id <id>', 'Continue an existing chat session')
|
|
18
|
+
.option('--format <fmt>', 'Output format: json, table, minimal', 'json')
|
|
19
|
+
.action(async (message, opts) => {
|
|
20
|
+
try {
|
|
21
|
+
const client = new AgentledClient();
|
|
22
|
+
if (!client.isAuthenticated) {
|
|
23
|
+
printError('Not authenticated. Run "agentled auth login" or set AGENTLED_API_KEY.');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const result = await client.chat(message, opts.sessionId);
|
|
27
|
+
printOutput(result, opts.format);
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
printError(e.message);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/commands/chat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,oBAAoB,CAAC;AAE3E,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACjD,OAAO;SACF,OAAO,CAAC,gBAAgB,CAAC;SACzB,WAAW,CAAC,6CAA6C,CAAC;SAC1D,MAAM,CAAC,mBAAmB,EAAE,mCAAmC,CAAC;SAChE,MAAM,CAAC,gBAAgB,EAAE,qCAAqC,EAAE,MAAM,CAAC;SACvE,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,IAAI,EAAE,EAAE;QACpC,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;YAEpC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;gBAC1B,UAAU,CACN,uEAAuE,CAC1E,CAAC;gBACF,OAAO;YACX,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1D,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,MAAsB,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|