@agnt-sdk/studio 0.0.46 → 0.0.47
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 +33 -1
- package/dist/cli/commands/configure.d.ts +13 -0
- package/dist/cli/commands/configure.d.ts.map +1 -0
- package/dist/cli/commands/configure.js +26 -0
- package/dist/cli/commands/configure.js.map +1 -0
- package/dist/cli/commands/run.d.ts +30 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +179 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/index.js +46 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/api.d.ts +59 -0
- package/dist/cli/utils/api.d.ts.map +1 -1
- package/dist/cli/utils/api.js +72 -0
- package/dist/cli/utils/api.js.map +1 -1
- package/dist/cli/utils/credentials.d.ts +37 -0
- package/dist/cli/utils/credentials.d.ts.map +1 -0
- package/dist/cli/utils/credentials.js +106 -0
- package/dist/cli/utils/credentials.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @agnt-sdk/studio
|
|
2
2
|
|
|
3
|
-
V2 manifest-native LLM executor for [Agnt](https://agnt.ai) prompts, with a CLI for pulling
|
|
3
|
+
V2 manifest-native LLM executor for [Agnt](https://agnt.ai) prompts, with a CLI for pulling/running agent manifests locally and for pulling task/chat run detail from the platform for debugging.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -55,6 +55,38 @@ Scaffold an `agnt.config.js` in the current directory:
|
|
|
55
55
|
agnt init
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
### `agnt configure` / `agnt run` — pull task/chat run detail from the DB
|
|
59
|
+
|
|
60
|
+
For debugging what an agent actually did on a task or chat — every tool call and result, not just the message transcript — without tunneling into the database or scraping logs. Uses the standard `/tasks` and `/chats` API, so it needs a real API key, not the project-level `agnt.config.js`.
|
|
61
|
+
|
|
62
|
+
**Setup — mint an API key, then save it as a named profile** (AWS-CLI style; profiles live in `~/.agnt/credentials`, independent of any project):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
agnt configure --profile production --api-url https://api.agnt.ai --api-key ak_live_...
|
|
66
|
+
agnt configure --profile staging --api-url https://staging-api.agnt.ai --api-key ak_live_...
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Select a profile per command with `--profile`, or set `AGNT_PROFILE` in your shell. Defaults to a profile named `default`.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# List recent tasks/chats
|
|
73
|
+
agnt run list --since 24h --profile production
|
|
74
|
+
agnt run list --status active --profile production
|
|
75
|
+
|
|
76
|
+
# Full activity timeline for one task/chat (tool calls + results, paginates
|
|
77
|
+
# through everything automatically — capped at 1000 activities by default)
|
|
78
|
+
agnt run task <taskId> --profile production
|
|
79
|
+
agnt run chat <chatId> --profile production
|
|
80
|
+
|
|
81
|
+
# No cap — fetch every activity, however many pages that takes
|
|
82
|
+
agnt run task <taskId> --all --profile production
|
|
83
|
+
|
|
84
|
+
# Raw JSON for piping into other tools (e.g. `jq`, or Claude Code via Bash)
|
|
85
|
+
agnt run task <taskId> --json --profile production
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
An account-level API key (one created without a specific `userId`) sees everything in its account. A user-scoped key only sees that one user's own tasks/chats.
|
|
89
|
+
|
|
58
90
|
## Programmatic use
|
|
59
91
|
|
|
60
92
|
### `AgntExecutor`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agnt configure — write a named profile to ~/.agnt/credentials
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* agnt configure --profile staging --api-url https://staging-api.agnt.ai --api-key ak_live_...
|
|
6
|
+
*/
|
|
7
|
+
export interface ConfigureOptions {
|
|
8
|
+
profile: string;
|
|
9
|
+
apiUrl: string;
|
|
10
|
+
apiKey: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function runConfigure(opts: ConfigureOptions): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=configure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/configure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBxE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agnt configure — write a named profile to ~/.agnt/credentials
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* agnt configure --profile staging --api-url https://staging-api.agnt.ai --api-key ak_live_...
|
|
6
|
+
*/
|
|
7
|
+
import { saveProfile } from '../utils/credentials.js';
|
|
8
|
+
export async function runConfigure(opts) {
|
|
9
|
+
if (!opts.apiUrl?.trim()) {
|
|
10
|
+
console.error('Usage: agnt configure --profile <name> --api-url <url> --api-key <key>');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
if (!opts.apiKey?.trim()) {
|
|
14
|
+
console.error('Usage: agnt configure --profile <name> --api-url <url> --api-key <key>');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
await saveProfile(opts.profile, { apiUrl: opts.apiUrl.trim(), apiKey: opts.apiKey.trim() });
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
console.error(`Failed to save profile: ${err.message}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
console.log(`Saved profile "${opts.profile}" to ~/.agnt/credentials`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=configure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../../src/cli/commands/configure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAQtD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAsB;IACvD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;QACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;QACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC9F,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,2BAA2B,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,CAAC,OAAO,0BAA0B,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agnt run — pull task/chat run detail from the DB via API (no bastion, no log scraping)
|
|
3
|
+
*
|
|
4
|
+
* Uses the standard /tasks and /chats API — an account-level API key (one
|
|
5
|
+
* created without a specific userId) gets account-wide visibility, the same
|
|
6
|
+
* as your own dashboard already shows for your account. There is no
|
|
7
|
+
* separate admin surface: this is just another client of the existing API.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* agnt run list [--since 24h] [--status active] [--limit 50] [--profile <name>] [--json]
|
|
11
|
+
* agnt run task <taskId> [--profile <name>] [--json]
|
|
12
|
+
* agnt run chat <chatId> [--profile <name>] [--json]
|
|
13
|
+
*/
|
|
14
|
+
export interface RunListOptions {
|
|
15
|
+
since?: string;
|
|
16
|
+
status?: string;
|
|
17
|
+
limit?: string;
|
|
18
|
+
profile?: string;
|
|
19
|
+
json?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function runList(opts: RunListOptions): Promise<void>;
|
|
22
|
+
export interface RunGetOptions {
|
|
23
|
+
profile?: string;
|
|
24
|
+
json?: boolean;
|
|
25
|
+
max?: string;
|
|
26
|
+
all?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function runGetTask(taskId: string, opts: RunGetOptions): Promise<void>;
|
|
29
|
+
export declare function runGetChat(chatId: string, opts: RunGetOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA+FH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjE;AAUD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAQD,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BnF;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBnF"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agnt run — pull task/chat run detail from the DB via API (no bastion, no log scraping)
|
|
3
|
+
*
|
|
4
|
+
* Uses the standard /tasks and /chats API — an account-level API key (one
|
|
5
|
+
* created without a specific userId) gets account-wide visibility, the same
|
|
6
|
+
* as your own dashboard already shows for your account. There is no
|
|
7
|
+
* separate admin surface: this is just another client of the existing API.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* agnt run list [--since 24h] [--status active] [--limit 50] [--profile <name>] [--json]
|
|
11
|
+
* agnt run task <taskId> [--profile <name>] [--json]
|
|
12
|
+
* agnt run chat <chatId> [--profile <name>] [--json]
|
|
13
|
+
*/
|
|
14
|
+
import { resolveProfile } from '../utils/credentials.js';
|
|
15
|
+
import { AgntApiClient } from '../utils/api.js';
|
|
16
|
+
const TRUNCATE_LEN = 400;
|
|
17
|
+
const DEFAULT_MAX_ACTIVITIES = 1000;
|
|
18
|
+
const PAGE_SIZE = 100;
|
|
19
|
+
// Both /tasks/:id/activities and /chats/:id/activities page backward
|
|
20
|
+
// (newest-first, `before` cursor). Agentic tool loops can run into the
|
|
21
|
+
// thousands of activities, so this loops until hasMore is false or `max`
|
|
22
|
+
// is hit — never silently caps at one page. Concatenating pages in fetch
|
|
23
|
+
// order (each page itself newest-first) keeps the whole thing newest-first;
|
|
24
|
+
// reversed once at the end for chronological display.
|
|
25
|
+
async function fetchAllActivities(fetchPage, { max, all }) {
|
|
26
|
+
const pages = [];
|
|
27
|
+
let cursor;
|
|
28
|
+
let total = 0;
|
|
29
|
+
let truncated = false;
|
|
30
|
+
while (true) {
|
|
31
|
+
const { activities, hasMore, cursor: nextCursor } = await fetchPage(cursor);
|
|
32
|
+
pages.push(activities);
|
|
33
|
+
total += activities.length;
|
|
34
|
+
if (!hasMore)
|
|
35
|
+
break;
|
|
36
|
+
if (!all && total >= max) {
|
|
37
|
+
truncated = true;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
if (!nextCursor)
|
|
41
|
+
break; // defensive: hasMore true but no cursor shouldn't happen
|
|
42
|
+
cursor = nextCursor;
|
|
43
|
+
}
|
|
44
|
+
return { activities: pages.flat().reverse(), truncated };
|
|
45
|
+
}
|
|
46
|
+
function truncate(value) {
|
|
47
|
+
const str = typeof value === 'string' ? value : JSON.stringify(value);
|
|
48
|
+
if (!str)
|
|
49
|
+
return '';
|
|
50
|
+
return str.length > TRUNCATE_LEN ? `${str.slice(0, TRUNCATE_LEN)}… (${str.length} chars)` : str;
|
|
51
|
+
}
|
|
52
|
+
// "24h" / "45m" / "2d" / an ISO timestamp -> a Date to filter client-side by.
|
|
53
|
+
// The API has no server-side time-window filter, so `--since` is applied
|
|
54
|
+
// after fetching the newest page — this just bounds what gets printed.
|
|
55
|
+
function parseSince(raw) {
|
|
56
|
+
const match = /^(\d+)(h|m|d)?$/.exec(raw.trim());
|
|
57
|
+
if (match) {
|
|
58
|
+
const amount = Number(match[1]);
|
|
59
|
+
const unit = match[2] || 'h';
|
|
60
|
+
const ms = unit === 'm' ? amount * 60_000 : unit === 'd' ? amount * 86_400_000 : amount * 3_600_000;
|
|
61
|
+
return new Date(Date.now() - ms);
|
|
62
|
+
}
|
|
63
|
+
const parsed = new Date(raw);
|
|
64
|
+
if (Number.isNaN(parsed.getTime()))
|
|
65
|
+
throw new Error(`Invalid --since value: "${raw}"`);
|
|
66
|
+
return parsed;
|
|
67
|
+
}
|
|
68
|
+
function renderActivity(activity) {
|
|
69
|
+
const time = activity.createdAt ? new Date(activity.createdAt).toISOString() : '?';
|
|
70
|
+
if (activity.type === 'tool_turn' && activity.toolTurn) {
|
|
71
|
+
const { textContent, toolCalls = [], toolResults = [] } = activity.toolTurn;
|
|
72
|
+
if (textContent)
|
|
73
|
+
console.log(`[${time}] assistant: ${truncate(textContent)}`);
|
|
74
|
+
for (const call of toolCalls) {
|
|
75
|
+
console.log(`[${time}] → ${call.name}(${truncate(call.input)})`);
|
|
76
|
+
const result = toolResults.find((r) => r.toolCallId === call.id);
|
|
77
|
+
if (result) {
|
|
78
|
+
const marker = result.isError ? 'ERROR' : 'ok';
|
|
79
|
+
console.log(`[${time}] ← [${marker}] ${truncate(result.content)}`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (activity.type === 'message' && activity.message) {
|
|
85
|
+
console.log(`[${time}] message from=${activity.message.from ?? '?'}: ${truncate(activity.message.content)}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
console.log(`[${time}] ${activity.type}`);
|
|
89
|
+
}
|
|
90
|
+
async function clientFor(profile) {
|
|
91
|
+
const { apiUrl, apiKey } = await resolveProfile(profile);
|
|
92
|
+
return new AgntApiClient({ apiUrl, serviceKey: apiKey });
|
|
93
|
+
}
|
|
94
|
+
export async function runList(opts) {
|
|
95
|
+
try {
|
|
96
|
+
const client = await clientFor(opts.profile);
|
|
97
|
+
const perPage = opts.limit ? Number(opts.limit) : 50;
|
|
98
|
+
const since = opts.since ? parseSince(opts.since) : null;
|
|
99
|
+
const [{ tasks }, { chats }] = await Promise.all([
|
|
100
|
+
client.listTasks({ status: opts.status, perPage }),
|
|
101
|
+
client.listChats({ status: opts.status, perPage }),
|
|
102
|
+
]);
|
|
103
|
+
const recentTasks = since ? tasks.filter(t => new Date(t.updatedAt ?? t.createdAt) >= since) : tasks;
|
|
104
|
+
const recentChats = since ? chats.filter(c => new Date(c.lastMessageAt ?? c.updatedAt ?? c.createdAt) >= since) : chats;
|
|
105
|
+
if (opts.json) {
|
|
106
|
+
console.log(JSON.stringify({ tasks: recentTasks, chats: recentChats }, null, 2));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
console.log(`Tasks (${recentTasks.length}${since ? ` since ${since.toISOString()}` : ''}):`);
|
|
110
|
+
renderSummaryList(recentTasks, (t) => `${t.id} [${t.status}] ${t.title ?? ''}`.trimEnd());
|
|
111
|
+
console.log(`\nChats (${recentChats.length}${since ? ` since ${since.toISOString()}` : ''}):`);
|
|
112
|
+
renderSummaryList(recentChats, (c) => `${c.id} [${c.status}] ${c.title ?? ''}`.trimEnd());
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
console.error(err.message);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function renderSummaryList(items, line) {
|
|
120
|
+
if (!items.length) {
|
|
121
|
+
console.log(' (none)');
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
for (const item of items)
|
|
125
|
+
console.log(` ${line(item)}`);
|
|
126
|
+
}
|
|
127
|
+
function warnIfTruncated(truncated, fetchedCount) {
|
|
128
|
+
if (truncated) {
|
|
129
|
+
console.error(`(showing the most recent ${fetchedCount} activities — pass --all to fetch everything, or --max <n> to raise the cap)`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
export async function runGetTask(taskId, opts) {
|
|
133
|
+
try {
|
|
134
|
+
const client = await clientFor(opts.profile);
|
|
135
|
+
const max = opts.max ? Number(opts.max) : DEFAULT_MAX_ACTIVITIES;
|
|
136
|
+
const [task, { activities, truncated }] = await Promise.all([
|
|
137
|
+
client.getTask(taskId),
|
|
138
|
+
fetchAllActivities(before => client.getTaskActivities(taskId, { limit: PAGE_SIZE, before }), { max, all: !!opts.all }),
|
|
139
|
+
]);
|
|
140
|
+
if (opts.json) {
|
|
141
|
+
console.log(JSON.stringify({ task, activities, truncated }, null, 2));
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
console.log(`Task ${task.id} [${task.status}] ${task.title ?? ''}`.trimEnd());
|
|
145
|
+
console.log(`Owner: ${task.ownerEmail ?? '?'}`);
|
|
146
|
+
warnIfTruncated(truncated, activities.length);
|
|
147
|
+
console.log('');
|
|
148
|
+
for (const activity of activities)
|
|
149
|
+
renderActivity(activity);
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
console.error(err.message);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export async function runGetChat(chatId, opts) {
|
|
157
|
+
try {
|
|
158
|
+
const client = await clientFor(opts.profile);
|
|
159
|
+
const max = opts.max ? Number(opts.max) : DEFAULT_MAX_ACTIVITIES;
|
|
160
|
+
const [chat, { activities, truncated }] = await Promise.all([
|
|
161
|
+
client.getChat(chatId),
|
|
162
|
+
fetchAllActivities(before => client.getChatActivities(chatId, { limit: PAGE_SIZE, before }), { max, all: !!opts.all }),
|
|
163
|
+
]);
|
|
164
|
+
if (opts.json) {
|
|
165
|
+
console.log(JSON.stringify({ chat, activities, truncated }, null, 2));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
console.log(`Chat ${chat.id} [${chat.status}] ${chat.title ?? ''}`.trimEnd());
|
|
169
|
+
warnIfTruncated(truncated, activities.length);
|
|
170
|
+
console.log('');
|
|
171
|
+
for (const activity of activities)
|
|
172
|
+
renderActivity(activity);
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
console.error(err.message);
|
|
176
|
+
process.exit(1);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/cli/commands/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAqD,M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,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACzB;SACF,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YACtE,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAChF,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,KAAK,MAAM,QAAQ,IAAI,UAAU;YAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
import { Command } from 'commander';
|
|
6
6
|
import { runInit } from './commands/init.js';
|
|
7
7
|
import { runPull } from './commands/pull.js';
|
|
8
|
+
import { runConfigure } from './commands/configure.js';
|
|
9
|
+
import { runList, runGetTask, runGetChat } from './commands/run.js';
|
|
8
10
|
const program = new Command();
|
|
9
11
|
program
|
|
10
12
|
.name('agnt')
|
|
11
13
|
.description('Agnt SDK CLI — manage and run v2 prompt manifests')
|
|
12
|
-
.version('0.0.
|
|
14
|
+
.version('0.0.47');
|
|
13
15
|
program
|
|
14
16
|
.command('init')
|
|
15
17
|
.description('Create agnt.config.js in the current directory')
|
|
@@ -24,5 +26,48 @@ program
|
|
|
24
26
|
.action(async (address) => {
|
|
25
27
|
await runPull(address);
|
|
26
28
|
});
|
|
29
|
+
program
|
|
30
|
+
.command('configure')
|
|
31
|
+
.description('Save an API profile to ~/.agnt/credentials (like `aws configure --profile`)')
|
|
32
|
+
.requiredOption('--profile <name>', 'Profile name')
|
|
33
|
+
.requiredOption('--api-url <url>', 'Agnt API base URL')
|
|
34
|
+
.requiredOption('--api-key <key>', 'API key (ak_live_...)')
|
|
35
|
+
.action(async (opts) => {
|
|
36
|
+
await runConfigure(opts);
|
|
37
|
+
});
|
|
38
|
+
const runCmd = program
|
|
39
|
+
.command('run')
|
|
40
|
+
.description('Inspect agent run detail (tasks/chats) via the Agnt API — no bastion, no log scraping');
|
|
41
|
+
runCmd
|
|
42
|
+
.command('list')
|
|
43
|
+
.description('List recent tasks/chats (client-side filtered by --since; the API has no server-side time filter)')
|
|
44
|
+
.option('--since <window>', 'Time window, e.g. 24h, 45m, 2d, or an ISO timestamp')
|
|
45
|
+
.option('--status <status>', 'Filter by status (task/chat status value)')
|
|
46
|
+
.option('--limit <n>', 'Max results per collection', '50')
|
|
47
|
+
.option('--profile <name>', 'Credentials profile to use')
|
|
48
|
+
.option('--json', 'Print raw JSON instead of a human-readable summary')
|
|
49
|
+
.action(async (opts) => {
|
|
50
|
+
await runList(opts);
|
|
51
|
+
});
|
|
52
|
+
runCmd
|
|
53
|
+
.command('task <taskId>')
|
|
54
|
+
.description('Fetch the full activity timeline for one task (paginates automatically)')
|
|
55
|
+
.option('--profile <name>', 'Credentials profile to use')
|
|
56
|
+
.option('--json', 'Print raw JSON instead of a human-readable transcript')
|
|
57
|
+
.option('--max <n>', 'Max activities to fetch before stopping', '1000')
|
|
58
|
+
.option('--all', 'No cap — fetch every activity, however many pages that takes')
|
|
59
|
+
.action(async (taskId, opts) => {
|
|
60
|
+
await runGetTask(taskId, opts);
|
|
61
|
+
});
|
|
62
|
+
runCmd
|
|
63
|
+
.command('chat <chatId>')
|
|
64
|
+
.description('Fetch the full activity timeline for one chat (paginates automatically)')
|
|
65
|
+
.option('--profile <name>', 'Credentials profile to use')
|
|
66
|
+
.option('--json', 'Print raw JSON instead of a human-readable transcript')
|
|
67
|
+
.option('--max <n>', 'Max activities to fetch before stopping', '1000')
|
|
68
|
+
.option('--all', 'No cap — fetch every activity, however many pages that takes')
|
|
69
|
+
.action(async (chatId, opts) => {
|
|
70
|
+
await runGetChat(chatId, opts);
|
|
71
|
+
});
|
|
27
72
|
program.parse(process.argv);
|
|
28
73
|
//# sourceMappingURL=index.js.map
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,WAAW,CAAC,mDAAmD,CAAC;KAChE,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,gDA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,WAAW,CAAC,yEAAyE,CAAC;KACtF,MAAM,CAAC,kBAAkB,EAAE,4BAA4B,CAAC;KACxD,MAAM,CAAC,QAAQ,EAAE,uDAAuD,CAAC;KACzE,MAAM,CAAC,WAAW,EAAE,yCAAyC,EAAE,MAAM,CAAC;KACtE,MAAM,CAAC,OAAO,EAAE,8DAA8D,CAAC;KAC/E,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAuE,EAAE,EAAE;IACxG,MAAM,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEL,MAAM;KACH,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,yEAAyE,CAAC;KACtF,MAAM,CAAC,kBAAkB,EAAE,4BAA4B,CAAC;KACxD,MAAM,CAAC,QAAQ,EAAE,uDAAuD,CAAC;KACzE,MAAM,CAAC,WAAW,EAAE,yCAAyC,EAAE,MAAM,CAAC;KACtE,MAAM,CAAC,OAAO,EAAE,8DAA8D,CAAC;KAC/E,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAuE,EAAE,EAAE;IACxG,MAAM,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/dist/cli/utils/api.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export interface PublicPromptListItem {
|
|
|
20
20
|
description?: string;
|
|
21
21
|
visibility: string;
|
|
22
22
|
}
|
|
23
|
+
export type TaskSummary = Record<string, any>;
|
|
24
|
+
export type ChatSummary = Record<string, any>;
|
|
25
|
+
export type Activity = Record<string, any>;
|
|
23
26
|
export declare class AgntApiClient {
|
|
24
27
|
private apiUrl;
|
|
25
28
|
private serviceKey;
|
|
@@ -40,5 +43,61 @@ export declare class AgntApiClient {
|
|
|
40
43
|
* List public prompts for an account.
|
|
41
44
|
*/
|
|
42
45
|
listPublicPrompts(accountSlug: string): Promise<PublicPromptListItem[]>;
|
|
46
|
+
/**
|
|
47
|
+
* GET /tasks — account-scoped (an account-level API key sees every task in
|
|
48
|
+
* the account; a user-scoped key sees only its own). Sorted newest-created first.
|
|
49
|
+
*/
|
|
50
|
+
listTasks(params?: {
|
|
51
|
+
status?: string;
|
|
52
|
+
perPage?: number;
|
|
53
|
+
page?: number;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
tasks: TaskSummary[];
|
|
56
|
+
total: number;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* GET /chats — same account-wide/user-scoped split as listTasks. Sorted by
|
|
60
|
+
* lastMessageAt, newest first.
|
|
61
|
+
*/
|
|
62
|
+
listChats(params?: {
|
|
63
|
+
status?: string;
|
|
64
|
+
perPage?: number;
|
|
65
|
+
page?: number;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
chats: ChatSummary[];
|
|
68
|
+
total: number;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* GET /tasks/:taskId — task metadata (title, status, owner, account, etc.)
|
|
72
|
+
*/
|
|
73
|
+
getTask(taskId: string): Promise<TaskSummary>;
|
|
74
|
+
/**
|
|
75
|
+
* GET /chats/:chatId — chat metadata.
|
|
76
|
+
*/
|
|
77
|
+
getChat(chatId: string): Promise<ChatSummary>;
|
|
78
|
+
/**
|
|
79
|
+
* GET /tasks/:taskId/activities — the full tool-call/tool-result timeline
|
|
80
|
+
* (and every other activity type), paginated newest-first, cursor via `before`.
|
|
81
|
+
*/
|
|
82
|
+
getTaskActivities(taskId: string, params?: {
|
|
83
|
+
limit?: number;
|
|
84
|
+
before?: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
activities: Activity[];
|
|
87
|
+
hasMore: boolean;
|
|
88
|
+
cursor: string | null;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* GET /chats/:chatId/activities — same cursor-pagination contract as
|
|
92
|
+
* getTaskActivities (newest-first, un-reversed).
|
|
93
|
+
*/
|
|
94
|
+
getChatActivities(chatId: string, params?: {
|
|
95
|
+
limit?: number;
|
|
96
|
+
before?: string;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
activities: Activity[];
|
|
99
|
+
hasMore: boolean;
|
|
100
|
+
cursor: string | null;
|
|
101
|
+
}>;
|
|
43
102
|
}
|
|
44
103
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC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AAG,OAAO,CAAC,WAAW,CAAC;IAKnD;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAKnD;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC;QACjG,UAAU,EAAE,QAAQ,EAAE,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;IAYF;;;OAGG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC;QACjG,UAAU,EAAE,QAAQ,EAAE,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;CAWH"}
|
package/dist/cli/utils/api.js
CHANGED
|
@@ -50,5 +50,77 @@ export class AgntApiClient {
|
|
|
50
50
|
const data = await this.request(`/manifests/${accountSlug}`);
|
|
51
51
|
return data.prompts;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* GET /tasks — account-scoped (an account-level API key sees every task in
|
|
55
|
+
* the account; a user-scoped key sees only its own). Sorted newest-created first.
|
|
56
|
+
*/
|
|
57
|
+
async listTasks(params = {}) {
|
|
58
|
+
const query = new URLSearchParams();
|
|
59
|
+
if (params.status)
|
|
60
|
+
query.set('status', params.status);
|
|
61
|
+
if (params.perPage)
|
|
62
|
+
query.set('perPage', String(params.perPage));
|
|
63
|
+
if (params.page)
|
|
64
|
+
query.set('page', String(params.page));
|
|
65
|
+
const qs = query.toString();
|
|
66
|
+
const data = await this.request(`/tasks${qs ? `?${qs}` : ''}`, {}, true);
|
|
67
|
+
return { tasks: data.tasks, total: data.total };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* GET /chats — same account-wide/user-scoped split as listTasks. Sorted by
|
|
71
|
+
* lastMessageAt, newest first.
|
|
72
|
+
*/
|
|
73
|
+
async listChats(params = {}) {
|
|
74
|
+
const query = new URLSearchParams();
|
|
75
|
+
if (params.status)
|
|
76
|
+
query.set('status', params.status);
|
|
77
|
+
if (params.perPage)
|
|
78
|
+
query.set('perPage', String(params.perPage));
|
|
79
|
+
if (params.page)
|
|
80
|
+
query.set('page', String(params.page));
|
|
81
|
+
const qs = query.toString();
|
|
82
|
+
const data = await this.request(`/chats${qs ? `?${qs}` : ''}`, {}, true);
|
|
83
|
+
return { chats: data.chats, total: data.total };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* GET /tasks/:taskId — task metadata (title, status, owner, account, etc.)
|
|
87
|
+
*/
|
|
88
|
+
async getTask(taskId) {
|
|
89
|
+
const data = await this.request(`/tasks/${taskId}`, {}, true);
|
|
90
|
+
return data.task;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* GET /chats/:chatId — chat metadata.
|
|
94
|
+
*/
|
|
95
|
+
async getChat(chatId) {
|
|
96
|
+
const data = await this.request(`/chats/${chatId}`, {}, true);
|
|
97
|
+
return data.chat;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* GET /tasks/:taskId/activities — the full tool-call/tool-result timeline
|
|
101
|
+
* (and every other activity type), paginated newest-first, cursor via `before`.
|
|
102
|
+
*/
|
|
103
|
+
async getTaskActivities(taskId, params = {}) {
|
|
104
|
+
const query = new URLSearchParams();
|
|
105
|
+
if (params.limit)
|
|
106
|
+
query.set('limit', String(params.limit));
|
|
107
|
+
if (params.before)
|
|
108
|
+
query.set('before', params.before);
|
|
109
|
+
const qs = query.toString();
|
|
110
|
+
return this.request(`/tasks/${taskId}/activities${qs ? `?${qs}` : ''}`, {}, true);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* GET /chats/:chatId/activities — same cursor-pagination contract as
|
|
114
|
+
* getTaskActivities (newest-first, un-reversed).
|
|
115
|
+
*/
|
|
116
|
+
async getChatActivities(chatId, params = {}) {
|
|
117
|
+
const query = new URLSearchParams();
|
|
118
|
+
if (params.limit)
|
|
119
|
+
query.set('limit', String(params.limit));
|
|
120
|
+
if (params.before)
|
|
121
|
+
query.set('before', params.before);
|
|
122
|
+
const qs = query.toString();
|
|
123
|
+
return this.request(`/chats/${chatId}/activities${qs ? `?${qs}` : ''}`, {}, true);
|
|
124
|
+
}
|
|
53
125
|
}
|
|
54
126
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/cli/utils/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/cli/utils/api.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA4BH,MAAM,OAAO,aAAa;IAChB,MAAM,CAAS;IACf,UAAU,CAAS;IAE3B,YAAY,OAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;IAC7C,CAAC;IAEO,KAAK,CAAC,OAAO,CAAI,IAAY,EAAE,UAAuB,EAAE,EAAE,WAAW,GAAG,KAAK;QACnF,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QACpC,MAAM,OAAO,GAA2B,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC;QAC/E,IAAI,IAAI,CAAC,UAAU,IAAI,WAAW,EAAE,CAAC;YACnC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,IAAI,CAAC,UAAU,E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I,eAAe,EAAE,CAAC;QACpC,IAAI,MAAM,CAAC,KAAK;YAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3D,IAAI,MAAM,CAAC,MAAM;YAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,OAAO,CACjB,UAAU,MAAM,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAClD,EAAE,EACF,IAAI,CACL,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile-based credentials — ~/.agnt/credentials
|
|
3
|
+
*
|
|
4
|
+
* AWS-CLI-style named profiles, independent of any project's agnt.config.js
|
|
5
|
+
* (that file is a per-project SDK config found by walking up from cwd; these
|
|
6
|
+
* are personal, per-machine debugging credentials used by `agnt run`/`agnt configure`).
|
|
7
|
+
*
|
|
8
|
+
* [default]
|
|
9
|
+
* apiUrl = https://api.agnt.ai
|
|
10
|
+
* apiKey = ak_live_...
|
|
11
|
+
*
|
|
12
|
+
* [staging]
|
|
13
|
+
* apiUrl = https://staging-api.agnt.ai
|
|
14
|
+
* apiKey = ak_live_...
|
|
15
|
+
*/
|
|
16
|
+
export interface Profile {
|
|
17
|
+
apiUrl: string;
|
|
18
|
+
apiKey: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolve which profile to use: explicit name > AGNT_PROFILE env var > 'default'.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveProfileName(explicit?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Load one profile's credentials. Throws a plain Error with a message
|
|
26
|
+
* pointing at `agnt configure` when the file or the named profile is missing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveProfile(explicitName?: string): Promise<Profile>;
|
|
29
|
+
/**
|
|
30
|
+
* Write (or overwrite) one named profile, creating ~/.agnt/credentials if absent.
|
|
31
|
+
* Written with mode 0o600 from the moment the file is created — this file
|
|
32
|
+
* holds a live bearer token, so there's no window where a default-umask
|
|
33
|
+
* write leaves it group/world-readable before a follow-up chmod lands.
|
|
34
|
+
*/
|
|
35
|
+
export declare function saveProfile(name: string, profile: Profile): Promise<void>;
|
|
36
|
+
export declare function listProfileNames(): Promise<string[]>;
|
|
37
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAuDD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAY5E;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/E;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAG1D"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile-based credentials — ~/.agnt/credentials
|
|
3
|
+
*
|
|
4
|
+
* AWS-CLI-style named profiles, independent of any project's agnt.config.js
|
|
5
|
+
* (that file is a per-project SDK config found by walking up from cwd; these
|
|
6
|
+
* are personal, per-machine debugging credentials used by `agnt run`/`agnt configure`).
|
|
7
|
+
*
|
|
8
|
+
* [default]
|
|
9
|
+
* apiUrl = https://api.agnt.ai
|
|
10
|
+
* apiKey = ak_live_...
|
|
11
|
+
*
|
|
12
|
+
* [staging]
|
|
13
|
+
* apiUrl = https://staging-api.agnt.ai
|
|
14
|
+
* apiKey = ak_live_...
|
|
15
|
+
*/
|
|
16
|
+
function credentialsPath(homedir, join) {
|
|
17
|
+
return join(homedir, '.agnt', 'credentials');
|
|
18
|
+
}
|
|
19
|
+
function parseCredentials(raw) {
|
|
20
|
+
const profiles = {};
|
|
21
|
+
let current = null;
|
|
22
|
+
for (const rawLine of raw.split('\n')) {
|
|
23
|
+
const line = rawLine.trim();
|
|
24
|
+
if (!line || line.startsWith('#') || line.startsWith(';'))
|
|
25
|
+
continue;
|
|
26
|
+
const section = /^\[(.+)\]$/.exec(line);
|
|
27
|
+
if (section) {
|
|
28
|
+
current = section[1].trim();
|
|
29
|
+
profiles[current] = profiles[current] ?? { apiUrl: '', apiKey: '' };
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const kv = /^([^=]+)=(.*)$/.exec(line);
|
|
33
|
+
if (kv && current) {
|
|
34
|
+
const key = kv[1].trim();
|
|
35
|
+
const value = kv[2].trim();
|
|
36
|
+
if (key === 'apiUrl' || key === 'apiKey') {
|
|
37
|
+
profiles[current][key] = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return profiles;
|
|
42
|
+
}
|
|
43
|
+
function serializeCredentials(profiles) {
|
|
44
|
+
return Object.entries(profiles)
|
|
45
|
+
.map(([name, profile]) => `[${name}]\napiUrl = ${profile.apiUrl}\napiKey = ${profile.apiKey}\n`)
|
|
46
|
+
.join('\n');
|
|
47
|
+
}
|
|
48
|
+
async function readAllProfiles() {
|
|
49
|
+
const { homedir } = await import('os');
|
|
50
|
+
const { join } = await import('path');
|
|
51
|
+
const { readFile } = await import('fs/promises');
|
|
52
|
+
const path = credentialsPath(homedir(), join);
|
|
53
|
+
try {
|
|
54
|
+
const raw = await readFile(path, 'utf-8');
|
|
55
|
+
return parseCredentials(raw);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
if (err.code === 'ENOENT')
|
|
59
|
+
return {};
|
|
60
|
+
throw err;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resolve which profile to use: explicit name > AGNT_PROFILE env var > 'default'.
|
|
65
|
+
*/
|
|
66
|
+
export function resolveProfileName(explicit) {
|
|
67
|
+
return explicit || process.env.AGNT_PROFILE || 'default';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Load one profile's credentials. Throws a plain Error with a message
|
|
71
|
+
* pointing at `agnt configure` when the file or the named profile is missing.
|
|
72
|
+
*/
|
|
73
|
+
export async function resolveProfile(explicitName) {
|
|
74
|
+
const name = resolveProfileName(explicitName);
|
|
75
|
+
const profiles = await readAllProfiles();
|
|
76
|
+
const profile = profiles[name];
|
|
77
|
+
if (!profile || !profile.apiKey) {
|
|
78
|
+
throw new Error(`No profile "${name}" found in ~/.agnt/credentials. Run: agnt configure --profile ${name} --api-url <url> --api-key <key>`);
|
|
79
|
+
}
|
|
80
|
+
return profile;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Write (or overwrite) one named profile, creating ~/.agnt/credentials if absent.
|
|
84
|
+
* Written with mode 0o600 from the moment the file is created — this file
|
|
85
|
+
* holds a live bearer token, so there's no window where a default-umask
|
|
86
|
+
* write leaves it group/world-readable before a follow-up chmod lands.
|
|
87
|
+
*/
|
|
88
|
+
export async function saveProfile(name, profile) {
|
|
89
|
+
const { homedir } = await import('os');
|
|
90
|
+
const { join, dirname } = await import('path');
|
|
91
|
+
const { mkdir, writeFile, chmod } = await import('fs/promises');
|
|
92
|
+
const path = credentialsPath(homedir(), join);
|
|
93
|
+
await mkdir(dirname(path), { recursive: true });
|
|
94
|
+
const profiles = await readAllProfiles();
|
|
95
|
+
profiles[name] = profile;
|
|
96
|
+
await writeFile(path, serializeCredentials(profiles), { encoding: 'utf-8', mode: 0o600 });
|
|
97
|
+
// Existing files aren't re-created (no O_CREAT mode applied), so an
|
|
98
|
+
// overwrite of a profile added before this fix still needs an explicit
|
|
99
|
+
// chmod to actually narrow its permissions.
|
|
100
|
+
await chmod(path, 0o600);
|
|
101
|
+
}
|
|
102
|
+
export async function listProfileNames() {
|
|
103
|
+
const profiles = await readAllProfiles();
|
|
104
|
+
return Object.keys(profiles);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../../src/cli/utils/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,SAAS,eAAe,CAAC,OAAe,EAAE,IAAoC;IAC5E,OAAO,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW;IACnC,MAAM,QAAQ,GAA4B,EAAE,CAAC;IAC7C,IAAI,OAAO,GAAkB,IAAI,CAAC;IAElC,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QAEpE,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5B,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAA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