@guildai/cli 0.9.0 → 0.10.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/dist/commands/agent/chat.d.ts +1 -0
- package/dist/commands/agent/chat.js +24 -1
- package/dist/commands/agent/fork.js +1 -0
- package/dist/commands/agent/init.js +2 -1
- package/dist/commands/agent/list.js +3 -2
- package/dist/commands/agent/pull.js +1 -1
- package/dist/commands/agent/save.js +4 -4
- package/dist/commands/agent/search.js +3 -2
- package/dist/commands/agent/test.d.ts +1 -0
- package/dist/commands/agent/test.js +92 -34
- package/dist/commands/agent/versions.js +3 -2
- package/dist/commands/agent/workspaces.js +3 -2
- package/dist/commands/chat.d.ts +10 -0
- package/dist/commands/chat.js +215 -50
- package/dist/commands/credentials/endpoint-list.js +3 -2
- package/dist/commands/credentials/list.js +3 -2
- package/dist/commands/credentials/policy-list.js +3 -2
- package/dist/commands/integration/connect.js +1 -1
- package/dist/commands/integration/create.js +36 -36
- package/dist/commands/integration/list.js +3 -2
- package/dist/commands/integration/operation/create.js +2 -1
- package/dist/commands/integration/operation/list.js +26 -17
- package/dist/commands/integration/version/list.js +3 -2
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/session/create.js +1 -1
- package/dist/commands/session/events.js +19 -9
- package/dist/commands/session/list.js +3 -2
- package/dist/commands/session/send.js +1 -1
- package/dist/commands/session/tasks.js +3 -2
- package/dist/commands/trigger/list.js +3 -2
- package/dist/commands/trigger/sessions.js +3 -2
- package/dist/commands/workspace/agent/add.js +16 -3
- package/dist/commands/workspace/agent/list.js +17 -3
- package/dist/commands/workspace/agent/remove.js +14 -1
- package/dist/commands/workspace/clear.d.ts +3 -0
- package/dist/commands/workspace/clear.js +45 -0
- package/dist/commands/workspace/context/list.js +3 -2
- package/dist/commands/workspace/list.js +3 -2
- package/dist/commands/workspace/select.js +3 -1
- package/dist/index.js +53 -6
- package/dist/lib/api-types.d.ts +5 -0
- package/dist/lib/api-types.js +4 -0
- package/dist/lib/generated-types.d.ts +1 -1
- package/dist/lib/generated-types.js +1 -0
- package/dist/lib/guild-config.d.ts +13 -0
- package/dist/lib/guild-config.js +19 -0
- package/dist/lib/npmrc.js +6 -2
- package/dist/lib/output.js +4 -4
- package/dist/lib/owner-helpers.d.ts +3 -0
- package/dist/lib/owner-helpers.js +17 -10
- package/dist/lib/session-events.d.ts +32 -16
- package/dist/lib/session-events.js +22 -0
- package/dist/lib/session-polling.d.ts +4 -3
- package/dist/lib/session-polling.js +75 -17
- package/dist/lib/session-resume.js +4 -1
- package/dist/lib/stdin.d.ts +4 -0
- package/dist/lib/stdin.js +23 -0
- package/dist/lib/validate-input-schema.d.ts +19 -0
- package/dist/lib/validate-input-schema.js +208 -0
- package/dist/lib/workspace-helpers.d.ts +20 -0
- package/dist/lib/workspace-helpers.js +49 -0
- package/dist/mcp/tools.js +8 -52
- package/docs/skills/agent-dev.md +191 -128
- package/package.json +2 -1
|
@@ -19,6 +19,7 @@ import * as readline from 'readline';
|
|
|
19
19
|
import { pollForResponse } from '../../lib/session-polling.js';
|
|
20
20
|
import { readStdinAsJSON, ensureInteractiveStdin } from '../../lib/stdin.js';
|
|
21
21
|
import { fetchSession, fetchSessionEvents } from '../../lib/session-resume.js';
|
|
22
|
+
import { getWorkspaceId, getWorkspaceSourceLabel } from '../../lib/guild-config.js';
|
|
22
23
|
// ESM equivalent of __dirname
|
|
23
24
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
24
25
|
// Read version from package.json
|
|
@@ -103,9 +104,26 @@ export function createAgentChatCommand() {
|
|
|
103
104
|
const sessionPrompt = options.mode === 'json' && inputData
|
|
104
105
|
? JSON.stringify(inputData)
|
|
105
106
|
: initialPrompt;
|
|
106
|
-
|
|
107
|
+
// Pre-resolve workspace so we can show the source label in output.
|
|
108
|
+
// When --workspace is given explicitly, no source label is shown.
|
|
109
|
+
let resolvedWorkspaceId = options.workspace;
|
|
110
|
+
let workspaceSourceLabel;
|
|
111
|
+
if (!resolvedWorkspaceId) {
|
|
112
|
+
const wsResolved = await getWorkspaceId(resolvedPath);
|
|
113
|
+
resolvedWorkspaceId = wsResolved?.workspaceId;
|
|
114
|
+
workspaceSourceLabel = wsResolved
|
|
115
|
+
? getWorkspaceSourceLabel(wsResolved.source)
|
|
116
|
+
: undefined;
|
|
117
|
+
}
|
|
118
|
+
const session = await createSession(client, resolvedWorkspaceId, sessionPrompt, version.id);
|
|
107
119
|
if (!quiet) {
|
|
108
120
|
console.log(`✓ Agent: ${config?.name || agentId}`);
|
|
121
|
+
if (session.workspace_id) {
|
|
122
|
+
const workspaceDisplay = workspaceSourceLabel
|
|
123
|
+
? `${session.workspace_id} (from ${workspaceSourceLabel})`
|
|
124
|
+
: session.workspace_id;
|
|
125
|
+
console.log(`✓ Workspace: ${workspaceDisplay}`);
|
|
126
|
+
}
|
|
109
127
|
const sessionLink = session.session_url
|
|
110
128
|
? hyperlink(session.id, session.session_url)
|
|
111
129
|
: session.id;
|
|
@@ -252,4 +270,9 @@ export function createAgentChatCommand() {
|
|
|
252
270
|
});
|
|
253
271
|
return cmd;
|
|
254
272
|
}
|
|
273
|
+
// Thin wrapper for lazy-loading from index.ts (avoids importing React at startup)
|
|
274
|
+
export async function handleAgentChatAction(_promptArgs, _options) {
|
|
275
|
+
const cmd = createAgentChatCommand();
|
|
276
|
+
await cmd.parseAsync(process.argv.slice(3), { from: 'user' });
|
|
277
|
+
}
|
|
255
278
|
//# sourceMappingURL=chat.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2026 Guild.ai
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
4
|
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
6
5
|
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
7
6
|
import { createSteps, createSpinner, format } from '../../lib/progress.js';
|
|
@@ -61,6 +60,7 @@ async function promptForName(defaultName) {
|
|
|
61
60
|
return ask();
|
|
62
61
|
}
|
|
63
62
|
async function promptForTemplate() {
|
|
63
|
+
const { default: inquirer } = await import('inquirer');
|
|
64
64
|
const { template } = await inquirer.prompt([
|
|
65
65
|
{
|
|
66
66
|
type: 'list',
|
|
@@ -192,6 +192,7 @@ export function createAgentInitCommand() {
|
|
|
192
192
|
ownerFlag: options.owner,
|
|
193
193
|
client,
|
|
194
194
|
interactive: isInteractive(),
|
|
195
|
+
requireExplicitOwner: true,
|
|
195
196
|
});
|
|
196
197
|
const agent = await client.post('/agents', {
|
|
197
198
|
name: agentName,
|
|
@@ -6,6 +6,7 @@ import { getAuthToken } from '../../lib/auth.js';
|
|
|
6
6
|
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
7
7
|
import { getOutputMode } from '../../lib/output-mode.js';
|
|
8
8
|
import { createOutputWriter, formatAgentTable } from '../../lib/output.js';
|
|
9
|
+
import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
|
|
9
10
|
const SORT_MAP = {
|
|
10
11
|
updated: 'updated_at',
|
|
11
12
|
newest: 'created_at',
|
|
@@ -23,8 +24,8 @@ export function createAgentListCommand() {
|
|
|
23
24
|
.option('--all', 'Show all agents including archived')
|
|
24
25
|
.option('--owner <name>', 'Filter by owner (user or org name). Without this flag, lists your own agents')
|
|
25
26
|
.option('--workspace <id>', 'Filter agents by workspace ID or name')
|
|
26
|
-
.option('--limit <number>',
|
|
27
|
-
.option('--offset <number>', 'Offset for pagination', '0')
|
|
27
|
+
.option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
|
|
28
|
+
.option('--offset <number>', 'Offset for pagination (default: 0)', '0')
|
|
28
29
|
.action(async (options) => {
|
|
29
30
|
const output = createOutputWriter();
|
|
30
31
|
if (options.archived && options.all) {
|
|
@@ -13,7 +13,7 @@ export function createAgentPullCommand() {
|
|
|
13
13
|
const cmd = new Command('pull');
|
|
14
14
|
cmd
|
|
15
15
|
.description('Pull remote changes into local agent directory')
|
|
16
|
-
.option('--json', 'Output JSON only
|
|
16
|
+
.option('--json', 'Output JSON only, no progress messages (default: off)', false)
|
|
17
17
|
.action(async (_options) => {
|
|
18
18
|
const cwd = process.cwd();
|
|
19
19
|
const output = createOutputWriter();
|
|
@@ -16,11 +16,11 @@ export function createAgentSaveCommand() {
|
|
|
16
16
|
.description('Commit, push, and create a new agent version')
|
|
17
17
|
.option('-A, --all', 'Stage all changes and commit before pushing', false)
|
|
18
18
|
.option('-m, --message <text>', 'Commit message (required with --all)')
|
|
19
|
-
.option('--wait', 'Wait for validation to complete before returning', false)
|
|
20
|
-
.option('--publish', 'Publish after validation passes (implies --wait)', false)
|
|
21
|
-
.option('--bump [level]', 'Bump package.json version before saving (patch, or minor/major)', 'patch')
|
|
19
|
+
.option('--wait', 'Wait for validation to complete before returning (default: returns immediately)', false)
|
|
20
|
+
.option('--publish', 'Publish after validation passes (implies --wait) (default: does not publish)', false)
|
|
21
|
+
.option('--bump [level]', 'Bump package.json version before saving (patch, or minor/major) (default: patch)', 'patch')
|
|
22
22
|
.option('--no-bump', 'Skip automatic version bump')
|
|
23
|
-
.option('--json', 'Output JSON only
|
|
23
|
+
.option('--json', 'Output JSON only, no progress messages (default: off)', false)
|
|
24
24
|
.action(async (options) => {
|
|
25
25
|
const cwd = process.cwd();
|
|
26
26
|
let guildConfig = null;
|
|
@@ -6,6 +6,7 @@ import { getAuthToken } from '../../lib/auth.js';
|
|
|
6
6
|
import { handleAxiosError } from '../../lib/errors.js';
|
|
7
7
|
import { getOutputMode } from '../../lib/output-mode.js';
|
|
8
8
|
import { createOutputWriter, formatAgentTable } from '../../lib/output.js';
|
|
9
|
+
import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
|
|
9
10
|
const SORT_MAP = {
|
|
10
11
|
updated: 'updated_at',
|
|
11
12
|
newest: 'created_at',
|
|
@@ -19,8 +20,8 @@ export function createAgentSearchCommand() {
|
|
|
19
20
|
.argument('<query>', 'Search query')
|
|
20
21
|
.option('--sort <field>', 'Sort by: updated, newest, name, popular (default: updated)', 'updated')
|
|
21
22
|
.option('--published', 'Only show published agents')
|
|
22
|
-
.option('--limit <number>',
|
|
23
|
-
.option('--offset <number>', 'Offset for pagination', '0')
|
|
23
|
+
.option('--limit <number>', `Number of results to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
|
|
24
|
+
.option('--offset <number>', 'Offset for pagination (default: 0)', '0')
|
|
24
25
|
.action(async (query, options) => {
|
|
25
26
|
const output = createOutputWriter();
|
|
26
27
|
try {
|
|
@@ -12,14 +12,14 @@ import { hyperlink } from '../../lib/colors.js';
|
|
|
12
12
|
import { GuildAPIClient } from '../../lib/api-client.js';
|
|
13
13
|
import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
14
14
|
import { format } from '../../lib/progress.js';
|
|
15
|
-
import * as readline from 'readline';
|
|
16
15
|
import { parseEventFilter } from '../../lib/event-filter.js';
|
|
17
16
|
import { isQuietMode, getOutputMode } from '../../lib/output-mode.js';
|
|
18
|
-
import { pollForResponseWithEvents } from '../../lib/session-polling.js';
|
|
19
|
-
import { readStdinAsJSON, ensureInteractiveStdin } from '../../lib/stdin.js';
|
|
20
|
-
import { loadLocalConfig, getWorkspaceId } from '../../lib/guild-config.js';
|
|
17
|
+
import { pollForResponse, pollForResponseWithEvents, } from '../../lib/session-polling.js';
|
|
18
|
+
import { readStdinAsJSON, readStdinAsText, ensureInteractiveStdin, } from '../../lib/stdin.js';
|
|
19
|
+
import { loadLocalConfig, getWorkspaceId, getWorkspaceSourceLabel, } from '../../lib/guild-config.js';
|
|
21
20
|
import { GitError, formatGitError } from '../../lib/git.js';
|
|
22
21
|
import { readAgentFiles, buildEphemeralVersion, buildBundledVersion, BundleNotFoundError, BuildTimeoutError, BuildFailedError, } from '../../lib/agent-helpers.js';
|
|
22
|
+
import { validateInputSchema } from '../../lib/validate-input-schema.js';
|
|
23
23
|
import { fetchSession, fetchSessionEvents } from '../../lib/session-resume.js';
|
|
24
24
|
import { ChatApp, ensureAuthenticated } from '../chat.js';
|
|
25
25
|
import { suppressScrollbackClear } from '../../lib/alternate-screen.js';
|
|
@@ -36,13 +36,15 @@ export function createAgentTestCommand() {
|
|
|
36
36
|
.option('--agent-version <id>', 'Test a specific version (UUID or version number)')
|
|
37
37
|
.option('--resume <session-id>', 'Resume an existing test session')
|
|
38
38
|
.option('--open', 'Open session in web dashboard')
|
|
39
|
-
.option('--events <types>', 'Event types to stream (default:
|
|
39
|
+
.option('--events <types>', 'Event types to stream (default: user). Shorthands: none, user, system, all, or comma-separated type names')
|
|
40
40
|
.option('--bundle <file>', 'Path to a pre-built gzip+base64 bundle file')
|
|
41
41
|
.option('--no-cache', 'Skip ephemeral build cache (force a fresh build)')
|
|
42
42
|
.action(async (options) => {
|
|
43
43
|
const cwd = process.cwd();
|
|
44
|
-
// Parse --events filter once, before any branching
|
|
45
|
-
const eventFilter =
|
|
44
|
+
// Parse --events filter once, before any branching
|
|
45
|
+
const eventFilter = options.events
|
|
46
|
+
? parseEventFilter(options.events)
|
|
47
|
+
: undefined;
|
|
46
48
|
try {
|
|
47
49
|
// Handle --resume: skip build, fetch existing session, hand off to ChatApp
|
|
48
50
|
if (options.resume) {
|
|
@@ -81,9 +83,10 @@ export function createAgentTestCommand() {
|
|
|
81
83
|
console.error(' guild agent clone <agent-id>');
|
|
82
84
|
process.exit(1);
|
|
83
85
|
}
|
|
84
|
-
// If using JSON input, read and validate it early (before auth/session creation)
|
|
85
|
-
// This provides better UX - fail fast on bad
|
|
86
|
+
// If using JSON/JSONL input, read and validate it early (before auth/session creation)
|
|
87
|
+
// This provides better UX - fail fast on bad input without needing auth
|
|
86
88
|
let inputData;
|
|
89
|
+
let jsonlInputs;
|
|
87
90
|
if (options.mode === 'json') {
|
|
88
91
|
try {
|
|
89
92
|
inputData = await readStdinAsJSON();
|
|
@@ -98,6 +101,57 @@ export function createAgentTestCommand() {
|
|
|
98
101
|
process.exit(1);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
104
|
+
else if (options.mode === 'jsonl') {
|
|
105
|
+
try {
|
|
106
|
+
const stdinContent = await readStdinAsText();
|
|
107
|
+
jsonlInputs = [];
|
|
108
|
+
const lines = stdinContent.split('\n');
|
|
109
|
+
for (let i = 0; i < lines.length; i++) {
|
|
110
|
+
const line = lines[i].trim();
|
|
111
|
+
if (!line)
|
|
112
|
+
continue;
|
|
113
|
+
try {
|
|
114
|
+
jsonlInputs.push(JSON.parse(line));
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
console.error(`Error: Invalid JSON on line ${i + 1}`);
|
|
118
|
+
console.error('');
|
|
119
|
+
console.error('Each line must be valid JSON.');
|
|
120
|
+
console.error(' cat inputs.jsonl | guild agent test --mode jsonl');
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (jsonlInputs.length === 0) {
|
|
125
|
+
console.error('Error: No JSON input provided');
|
|
126
|
+
console.error('');
|
|
127
|
+
console.error('Example usage:');
|
|
128
|
+
console.error(' cat inputs.jsonl | guild agent test --mode jsonl');
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
const err = error;
|
|
134
|
+
console.error(`Error: ${err.message}`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Validate input against agent's schema locally (before build)
|
|
139
|
+
// Skip when --agent-version is set since local source may differ from that version
|
|
140
|
+
const inputsToValidate = inputData !== undefined ? [inputData] : (jsonlInputs ?? []);
|
|
141
|
+
if (inputsToValidate.length > 0 && !options.agentVersion) {
|
|
142
|
+
const validationResult = await validateInputSchema(cwd, inputsToValidate);
|
|
143
|
+
if (!validationResult.valid) {
|
|
144
|
+
console.error('Input validation failed:');
|
|
145
|
+
for (const err of validationResult.errors) {
|
|
146
|
+
const pathStr = err.path?.length ? ` (at ${err.path.join('.')})` : '';
|
|
147
|
+
console.error(` - ${err.message}${pathStr}`);
|
|
148
|
+
}
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
if ('skipped' in validationResult && validationResult.skipped) {
|
|
152
|
+
format.warn(`Skipping local validation: ${validationResult.reason}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
101
155
|
// If using bundle, verify the file exists early (before auth/session creation)
|
|
102
156
|
// so we fail fast without needing auth if the path is wrong.
|
|
103
157
|
if (options.bundle) {
|
|
@@ -115,9 +169,13 @@ export function createAgentTestCommand() {
|
|
|
115
169
|
}
|
|
116
170
|
// Determine workspace (priority: flag > local config > global config)
|
|
117
171
|
let workspaceId = options.workspace;
|
|
172
|
+
let workspaceSourceLabel;
|
|
118
173
|
if (!workspaceId) {
|
|
119
174
|
const resolved = await getWorkspaceId(cwd);
|
|
120
175
|
workspaceId = resolved?.workspaceId;
|
|
176
|
+
workspaceSourceLabel = resolved
|
|
177
|
+
? getWorkspaceSourceLabel(resolved.source)
|
|
178
|
+
: undefined;
|
|
121
179
|
if (!workspaceId) {
|
|
122
180
|
console.error('Error: No default workspace configured');
|
|
123
181
|
console.error('');
|
|
@@ -249,7 +307,10 @@ export function createAgentTestCommand() {
|
|
|
249
307
|
? 'ephemeral (cached, no changes)'
|
|
250
308
|
: 'ephemeral (working directory)';
|
|
251
309
|
console.log(`✓ Version: ${versionDisplay}`);
|
|
252
|
-
|
|
310
|
+
const workspaceDisplay = workspaceSourceLabel
|
|
311
|
+
? `${workspaceId} (from ${workspaceSourceLabel})`
|
|
312
|
+
: workspaceId;
|
|
313
|
+
console.log(`✓ Workspace: ${workspaceDisplay}`);
|
|
253
314
|
const sessionLink = session.session_url
|
|
254
315
|
? hyperlink(session.id, session.session_url)
|
|
255
316
|
: session.id;
|
|
@@ -270,7 +331,9 @@ export function createAgentTestCommand() {
|
|
|
270
331
|
});
|
|
271
332
|
// Poll for response (starting from beginning)
|
|
272
333
|
// 3 minutes - allow time for agents that use LLM calls for input parsing
|
|
273
|
-
const { response } =
|
|
334
|
+
const { response } = eventFilter
|
|
335
|
+
? await pollForResponseWithEvents(client, session.id, eventFilter, undefined, 180000)
|
|
336
|
+
: await pollForResponse(client, session.id, undefined, 180000);
|
|
274
337
|
if (!response) {
|
|
275
338
|
console.error('Error: No response received from agent within timeout');
|
|
276
339
|
console.error('');
|
|
@@ -321,41 +384,33 @@ export function createAgentTestCommand() {
|
|
|
321
384
|
process.exit(1);
|
|
322
385
|
}
|
|
323
386
|
}
|
|
324
|
-
else if (options.mode === 'jsonl') {
|
|
325
|
-
// JSONL input mode: line-by-line processing
|
|
326
|
-
const rl = readline.createInterface({
|
|
327
|
-
input: process.stdin,
|
|
328
|
-
output: process.stdout,
|
|
329
|
-
terminal: false,
|
|
330
|
-
});
|
|
331
|
-
let lineNumber = 0;
|
|
387
|
+
else if (options.mode === 'jsonl' && jsonlInputs) {
|
|
388
|
+
// JSONL input mode: line-by-line processing (inputs already parsed and validated)
|
|
332
389
|
let processedCount = 0;
|
|
333
390
|
let lastEventId;
|
|
334
|
-
for
|
|
335
|
-
|
|
336
|
-
if (!
|
|
337
|
-
|
|
391
|
+
for (let inputIndex = 0; inputIndex < jsonlInputs.length; inputIndex++) {
|
|
392
|
+
const jsonInput = jsonlInputs[inputIndex];
|
|
393
|
+
if (!quiet) {
|
|
394
|
+
console.error(`Processing input ${inputIndex + 1}/${jsonlInputs.length}...`);
|
|
395
|
+
}
|
|
338
396
|
try {
|
|
339
|
-
const jsonInput = JSON.parse(line);
|
|
340
|
-
if (!quiet) {
|
|
341
|
-
console.error(`Processing line ${lineNumber}...`);
|
|
342
|
-
}
|
|
343
397
|
// Send message
|
|
344
398
|
await client.post(`/sessions/${session.id}/events`, {
|
|
345
399
|
mode: 'json',
|
|
346
400
|
content: jsonInput,
|
|
347
401
|
});
|
|
348
402
|
// Wait for response (looking for events after last seen)
|
|
349
|
-
const result =
|
|
403
|
+
const result = eventFilter
|
|
404
|
+
? await pollForResponseWithEvents(client, session.id, eventFilter, lastEventId, 180000)
|
|
405
|
+
: await pollForResponse(client, session.id, lastEventId, 180000);
|
|
350
406
|
lastEventId = result.lastEventId;
|
|
351
407
|
if (!result.response) {
|
|
352
|
-
console.error(`Timeout: No response for
|
|
408
|
+
console.error(`Timeout: No response for input ${inputIndex + 1}`);
|
|
353
409
|
continue;
|
|
354
410
|
}
|
|
355
411
|
const response = result.response;
|
|
356
412
|
// Output response
|
|
357
413
|
if (quiet) {
|
|
358
|
-
// In quiet mode, output just the message content (or as JSON if --json is used)
|
|
359
414
|
console.log(response);
|
|
360
415
|
}
|
|
361
416
|
else {
|
|
@@ -365,10 +420,8 @@ export function createAgentTestCommand() {
|
|
|
365
420
|
processedCount++;
|
|
366
421
|
}
|
|
367
422
|
catch (error) {
|
|
368
|
-
const
|
|
369
|
-
console.error(`Error
|
|
370
|
-
console.error(`Failed to parse JSON: ${err.message}`);
|
|
371
|
-
console.error('Skipping line and continuing...');
|
|
423
|
+
const formattedErr = handleAxiosError(error);
|
|
424
|
+
console.error(`Error processing input ${inputIndex + 1}: ${formattedErr.details}`);
|
|
372
425
|
}
|
|
373
426
|
}
|
|
374
427
|
if (!quiet) {
|
|
@@ -425,4 +478,9 @@ export function createAgentTestCommand() {
|
|
|
425
478
|
});
|
|
426
479
|
return cmd;
|
|
427
480
|
}
|
|
481
|
+
// Thin wrapper for lazy-loading from index.ts (avoids importing React at startup)
|
|
482
|
+
export async function handleAgentTestAction(_options) {
|
|
483
|
+
const cmd = createAgentTestCommand();
|
|
484
|
+
await cmd.parseAsync(process.argv.slice(3), { from: 'user' });
|
|
485
|
+
}
|
|
428
486
|
//# sourceMappingURL=test.js.map
|
|
@@ -7,13 +7,14 @@ import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
|
7
7
|
import { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
|
|
8
8
|
import { getOutputMode } from '../../lib/output-mode.js';
|
|
9
9
|
import { createOutputWriter, formatVersionTable } from '../../lib/output.js';
|
|
10
|
+
import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
|
|
10
11
|
export function createAgentVersionsCommand() {
|
|
11
12
|
const cmd = new Command('versions');
|
|
12
13
|
cmd
|
|
13
14
|
.description('List all versions of an agent')
|
|
14
15
|
.argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
|
|
15
|
-
.option('--limit <number>',
|
|
16
|
-
.option('--offset <number>', 'Number of versions to skip', '0')
|
|
16
|
+
.option('--limit <number>', `Maximum number of versions to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
|
|
17
|
+
.option('--offset <number>', 'Number of versions to skip (default: 0)', '0')
|
|
17
18
|
.action(async (agentIdArg, options) => {
|
|
18
19
|
const output = createOutputWriter();
|
|
19
20
|
// Get agent ID from argument or guild.json
|
|
@@ -7,13 +7,14 @@ import { handleAxiosError, ErrorCodes } from '../../lib/errors.js';
|
|
|
7
7
|
import { getAgentId, resolveAgentRef } from '../../lib/agent-helpers.js';
|
|
8
8
|
import { createOutputWriter, formatWorkspaceTable } from '../../lib/output.js';
|
|
9
9
|
import { getOutputMode } from '../../lib/output-mode.js';
|
|
10
|
+
import { DEFAULT_PAGE_LIMIT } from '../../lib/api-types.js';
|
|
10
11
|
export function createAgentWorkspacesCommand() {
|
|
11
12
|
const cmd = new Command('workspaces');
|
|
12
13
|
cmd
|
|
13
14
|
.description('List workspaces that use an agent')
|
|
14
15
|
.argument('[identifier]', 'Agent ID or full name (e.g., owner~agent-name)')
|
|
15
|
-
.option('--limit <number>',
|
|
16
|
-
.option('--offset <number>', 'Number of workspaces to skip', '0')
|
|
16
|
+
.option('--limit <number>', `Maximum number of workspaces to return (default: ${DEFAULT_PAGE_LIMIT})`, String(DEFAULT_PAGE_LIMIT))
|
|
17
|
+
.option('--offset <number>', 'Number of workspaces to skip (default: 0)', '0')
|
|
17
18
|
.action(async (agentIdArg, options) => {
|
|
18
19
|
const output = createOutputWriter();
|
|
19
20
|
const { agentId } = await getAgentId(agentIdArg);
|
package/dist/commands/chat.d.ts
CHANGED
|
@@ -2,6 +2,15 @@ import React from 'react';
|
|
|
2
2
|
import { Command } from 'commander';
|
|
3
3
|
import { GuildAPIClient } from '../lib/api-client.js';
|
|
4
4
|
import { SessionEvent, Session } from '../lib/session-events.js';
|
|
5
|
+
/** Thrown when no workspace is configured (no --workspace flag, no config). */
|
|
6
|
+
export declare class WorkspaceNotConfiguredError extends Error {
|
|
7
|
+
constructor();
|
|
8
|
+
}
|
|
9
|
+
/** Thrown when the specified workspace ID is not found in the backend. */
|
|
10
|
+
export declare class WorkspaceNotFoundError extends Error {
|
|
11
|
+
readonly workspaceId: string;
|
|
12
|
+
constructor(workspaceId: string);
|
|
13
|
+
}
|
|
5
14
|
/**
|
|
6
15
|
* ChatApp wrapper component that shows splash animation during connection
|
|
7
16
|
* and then transitions to ChatUIWithConnection once connected.
|
|
@@ -23,4 +32,5 @@ export declare function ChatApp({ initialPrompt, version, workspaceId, versionId
|
|
|
23
32
|
export declare function ensureAuthenticated(): Promise<string>;
|
|
24
33
|
export declare function createSession(client: GuildAPIClient, workspaceId: string | undefined, initialPrompt: string, versionId?: string, onProgress?: (status: string) => void): Promise<Session>;
|
|
25
34
|
export declare function createChatCommand(): Command;
|
|
35
|
+
export declare function handleChatAction(_promptArgs: string[], _options: Record<string, unknown>): Promise<void>;
|
|
26
36
|
//# sourceMappingURL=chat.d.ts.map
|