aui-agent-builder 0.3.112 → 0.3.113

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.
@@ -0,0 +1,410 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as path from "path";
3
+ import { render, Box, Text } from "ink";
4
+ import { getConfig, loadSession, loadProjectConfig, findProjectRoot, } from "../config/index.js";
5
+ import { AUIClient } from "../api-client/index.js";
6
+ import { ApolloClient, } from "../api-client/apollo-client.js";
7
+ import { resolveBundledAgent } from "./util/bundled-agent.js";
8
+ import { validate } from "./validate.js";
9
+ import { findAuiFiles, parseAuiFile, assembleBundleFromFiles } from "../utils/index.js";
10
+ import { getTracer, SpanStatusCode, setUserContext, setProjectContext, setAgentContext, } from "../telemetry.js";
11
+ import { AuthenticationError, ConfigError, ValidationError, } from "../errors/index.js";
12
+ import { isJsonMode, outputJson, stderrLog, } from "../utils/json-output.js";
13
+ import { Header, Section, KeyValue, StatusLine, Spinner, Hint, } from "../ui/components/index.js";
14
+ import { colors } from "../ui/theme.js";
15
+ // ─── Ink helpers ───
16
+ function log(node) {
17
+ const { unmount } = render(node);
18
+ unmount();
19
+ }
20
+ function startSpinner(label) {
21
+ if (isJsonMode()) {
22
+ stderrLog(label);
23
+ return { stop: () => { } };
24
+ }
25
+ const inst = render(_jsx(Spinner, { label: label }));
26
+ return { stop: () => inst.unmount() };
27
+ }
28
+ /**
29
+ * Resolve the CLI session + project config into the two clients the
30
+ * commands need: an `AUIClient` (for the bundle-mode guard read) and an
31
+ * `ApolloClient` (for the actual runtime call). Throws clear auth /
32
+ * config errors when the session is incomplete.
33
+ */
34
+ function buildContext(optionPath) {
35
+ const projectRoot = optionPath
36
+ ? path.resolve(optionPath)
37
+ : findProjectRoot() || undefined;
38
+ const projectConfig = loadProjectConfig(projectRoot);
39
+ const config = getConfig(projectRoot);
40
+ const session = loadSession();
41
+ if (!config.authToken) {
42
+ throw new AuthenticationError("Not logged in.");
43
+ }
44
+ const organizationId = projectConfig?.organization_id || config.organizationId;
45
+ if (!organizationId) {
46
+ throw new ConfigError("No organization could be resolved.", {
47
+ suggestion: "Run `aui login` (and select an organization), or run inside an imported agent project so .auirc carries organization_id.",
48
+ });
49
+ }
50
+ const accountId = projectConfig?.account_id || config.accountId || "";
51
+ const userId = session?.user_id;
52
+ const aui = new AUIClient({
53
+ baseUrl: config.apiUrl,
54
+ authToken: config.authToken,
55
+ accountId,
56
+ organizationId,
57
+ environment: config.environment,
58
+ });
59
+ const apollo = new ApolloClient({
60
+ authToken: config.authToken,
61
+ organizationId,
62
+ accountId,
63
+ userId,
64
+ environment: config.environment,
65
+ });
66
+ return { apollo, aui, projectRoot, projectConfig };
67
+ }
68
+ /** Attach the standard user / project / agent telemetry onto a span. */
69
+ async function attachContextTelemetry(span, ctx, agentManagementId) {
70
+ await setUserContext(span);
71
+ await setProjectContext(span, ctx.projectRoot);
72
+ await setAgentContext(span, {
73
+ agentManagementId: agentManagementId ?? ctx.projectConfig?.agent_management_id ?? undefined,
74
+ agentId: ctx.projectConfig?.agent_id ?? undefined,
75
+ agentCode: ctx.projectConfig?.agent_code ?? undefined,
76
+ versionId: ctx.projectConfig?.version_id ?? undefined,
77
+ versionLabel: ctx.projectConfig?.version_label ?? undefined,
78
+ accountId: ctx.projectConfig?.account_id ?? undefined,
79
+ organizationId: ctx.projectConfig?.organization_id ?? undefined,
80
+ networkCategoryId: ctx.projectConfig?.network_category_id ?? undefined,
81
+ });
82
+ }
83
+ /**
84
+ * Assemble the local `.aui.json` files into the bundle shape the runtime
85
+ * expects (same as the blob `/push` endpoint) AFTER validating them
86
+ * against the remote validator. Throws `ValidationError` when validation
87
+ * fails so the caller never ships a broken bundle.
88
+ */
89
+ async function buildValidatedBundle(projectRoot) {
90
+ if (!projectRoot) {
91
+ throw new ConfigError("No agent project found to read files from.", {
92
+ suggestion: "Run this command inside an imported agent project (with .aui.json files), or pass --path <dir>. Use `aui import-agent` to create one.",
93
+ });
94
+ }
95
+ // Validate first (silent — this command owns its own stdout). A failed
96
+ // validation aborts the send rather than shipping an unusable bundle.
97
+ if (isJsonMode()) {
98
+ stderrLog("Validating local agent files before sending...");
99
+ }
100
+ const ok = await validate(projectRoot, { silent: true });
101
+ if (!ok) {
102
+ throw new ValidationError("Local agent files failed validation — not sending the bundle.", {
103
+ suggestion: "Run `aui validate` to see the specific errors, fix them, then retry.",
104
+ });
105
+ }
106
+ const files = await findAuiFiles(projectRoot);
107
+ const fileData = files.map((abs) => ({
108
+ file: path.relative(projectRoot, abs),
109
+ type: "",
110
+ data: parseAuiFile(abs),
111
+ }));
112
+ return assembleBundleFromFiles(fileData);
113
+ }
114
+ // ═══════════════════════════════════════════════════════════════
115
+ // create-task
116
+ // ═══════════════════════════════════════════════════════════════
117
+ export async function apolloCreateTask(options = {}) {
118
+ const tracer = getTracer();
119
+ await tracer.startActiveSpan("aui.apollo.create_task", async (span) => {
120
+ try {
121
+ const ctx = buildContext();
122
+ const session = loadSession();
123
+ const userId = options.userId?.trim() || session?.user_id;
124
+ if (!userId) {
125
+ throw new ValidationError("Missing required value: user_id.", {
126
+ suggestion: "Pass --user-id <id>, or log in so the session provides one.",
127
+ });
128
+ }
129
+ const taskOriginType = options.taskOriginType?.trim() || "web-widget";
130
+ await attachContextTelemetry(span, ctx, options.agentId);
131
+ const spinner = startSpinner("Resolving agent...");
132
+ const resolved = await resolveBundledAgent({
133
+ client: ctx.aui,
134
+ agentIdOption: options.agentId,
135
+ projectConfig: ctx.projectConfig,
136
+ });
137
+ span.setAttribute("apollo.agent_id", resolved.agentManagementId);
138
+ span.setAttribute("apollo.task_origin_type", taskOriginType);
139
+ spinner.stop();
140
+ const sp2 = startSpinner("Creating task...");
141
+ const result = await ctx.apollo.createTask({
142
+ agent_id: resolved.agentManagementId,
143
+ user_id: userId,
144
+ task_origin_type: taskOriginType,
145
+ });
146
+ sp2.stop();
147
+ span.setAttribute("apollo.task_id", result.id);
148
+ span.setStatus({ code: SpanStatusCode.OK });
149
+ if (isJsonMode()) {
150
+ outputJson(result);
151
+ return;
152
+ }
153
+ renderCreateTask(result);
154
+ }
155
+ catch (error) {
156
+ recordSpanError(span, error);
157
+ throw error;
158
+ }
159
+ finally {
160
+ span.end();
161
+ }
162
+ });
163
+ }
164
+ function renderCreateTask(result) {
165
+ log(_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Header, { title: "Task Created", subtitle: result.id }), _jsxs(Section, { title: "Task", children: [_jsx(KeyValue, { label: "Task ID", value: result.id }), _jsx(KeyValue, { label: "User ID", value: result.user_id }), _jsx(KeyValue, { label: "Title", value: result.title || "(untitled)" }), result.welcome_message ? (_jsx(KeyValue, { label: "Welcome", value: result.welcome_message })) : null] }), result.followup_suggestions && result.followup_suggestions.length > 0 ? (_jsx(Section, { title: "Follow-up suggestions", children: result.followup_suggestions.map((s, i) => (_jsxs(Text, { color: colors.muted, children: [" • ", s] }, i))) })) : null, _jsx(Box, { marginTop: 1, children: _jsx(Hint, { message: `Send a message: aui apollo send-message --task-id ${result.id} --text "..."` }) })] }));
166
+ }
167
+ // ═══════════════════════════════════════════════════════════════
168
+ // send-message
169
+ // ═══════════════════════════════════════════════════════════════
170
+ export async function apolloSendMessage(options = {}) {
171
+ const tracer = getTracer();
172
+ await tracer.startActiveSpan("aui.apollo.send_message", async (span) => {
173
+ try {
174
+ const taskId = options.taskId?.trim();
175
+ const text = options.text;
176
+ if (!taskId) {
177
+ throw new ValidationError("Missing required option: --task-id.", {
178
+ suggestion: "Pass --task-id <id> (create one with `aui apollo create-task`).",
179
+ });
180
+ }
181
+ if (text === undefined || text === null) {
182
+ throw new ValidationError("Missing required option: --text.", {
183
+ suggestion: 'Pass --text "your message".',
184
+ });
185
+ }
186
+ const ctx = buildContext(options.path);
187
+ await attachContextTelemetry(span, ctx, options.agentId);
188
+ const spinner = startSpinner("Resolving agent...");
189
+ const resolved = await resolveBundledAgent({
190
+ client: ctx.aui,
191
+ agentIdOption: options.agentId,
192
+ projectConfig: ctx.projectConfig,
193
+ });
194
+ span.setAttribute("apollo.agent_id", resolved.agentManagementId);
195
+ span.setAttribute("apollo.task_id", taskId);
196
+ span.setAttribute("apollo.include_trace", !!options.includeTrace);
197
+ spinner.stop();
198
+ // Assemble + validate the local bundle unless explicitly skipped
199
+ // via `--no-bundle` (commander sets `options.bundle === false`).
200
+ let bundle;
201
+ if (options.bundle !== false) {
202
+ bundle = await buildValidatedBundle(ctx.projectRoot);
203
+ span.setAttribute("apollo.bundle_attached", true);
204
+ }
205
+ else {
206
+ span.setAttribute("apollo.bundle_attached", false);
207
+ }
208
+ const sp2 = startSpinner("Sending message...");
209
+ const result = await ctx.apollo.sendMessage({
210
+ task_id: taskId,
211
+ text,
212
+ agent_settings_bundle: bundle ?? null,
213
+ }, { includeTrace: !!options.includeTrace });
214
+ sp2.stop();
215
+ span.setAttribute("apollo.message_id", result.id ?? "");
216
+ span.setStatus({ code: SpanStatusCode.OK });
217
+ if (isJsonMode()) {
218
+ outputJson(result);
219
+ return;
220
+ }
221
+ renderMessage(result, !!options.includeTrace);
222
+ }
223
+ catch (error) {
224
+ recordSpanError(span, error);
225
+ throw error;
226
+ }
227
+ finally {
228
+ span.end();
229
+ }
230
+ });
231
+ }
232
+ function renderMessage(result, includeTrace) {
233
+ log(_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Header, { title: "Agent Reply", subtitle: result.id }), _jsx(Section, { title: "Message", children: _jsx(Text, { color: colors.muted, children: result.text || "(no text)" }) }), result.followup_suggestions && result.followup_suggestions.length > 0 ? (_jsx(Section, { title: "Follow-up suggestions", children: result.followup_suggestions.map((s, i) => (_jsxs(Text, { color: colors.muted, children: [" • ", s] }, i))) })) : null, includeTrace ? (_jsx(Section, { title: "Trace", children: _jsx(Text, { color: colors.muted, children: result.trace_info
234
+ ? "Trace info attached (use --json to see the full object)."
235
+ : "No trace info returned." }) })) : null] }));
236
+ }
237
+ // ═══════════════════════════════════════════════════════════════
238
+ // rerun
239
+ // ═══════════════════════════════════════════════════════════════
240
+ export async function apolloRerun(options = {}) {
241
+ const tracer = getTracer();
242
+ await tracer.startActiveSpan("aui.apollo.rerun", async (span) => {
243
+ try {
244
+ const taskId = options.taskId?.trim();
245
+ const interactionId = options.interactionId?.trim();
246
+ const text = options.text;
247
+ if (!taskId) {
248
+ throw new ValidationError("Missing required option: --task-id.", {
249
+ suggestion: "Pass --task-id <id>.",
250
+ });
251
+ }
252
+ if (!interactionId) {
253
+ throw new ValidationError("Missing required option: --interaction-id.", {
254
+ suggestion: "Pass --interaction-id <id> of the interaction to rerun.",
255
+ });
256
+ }
257
+ if (!text || text.trim().length < 1) {
258
+ throw new ValidationError("Missing required option: --text.", {
259
+ suggestion: 'Pass --text "..." (the edited or original message to replay; min length 1).',
260
+ });
261
+ }
262
+ const ctx = buildContext(options.path);
263
+ await attachContextTelemetry(span, ctx, options.agentId);
264
+ const spinner = startSpinner("Resolving agent...");
265
+ const resolved = await resolveBundledAgent({
266
+ client: ctx.aui,
267
+ agentIdOption: options.agentId,
268
+ projectConfig: ctx.projectConfig,
269
+ });
270
+ span.setAttribute("apollo.agent_id", resolved.agentManagementId);
271
+ span.setAttribute("apollo.task_id", taskId);
272
+ span.setAttribute("apollo.interaction_id", interactionId);
273
+ spinner.stop();
274
+ // Optional config: attach a validated local bundle.
275
+ let bundle;
276
+ if (options.withConfig) {
277
+ bundle = await buildValidatedBundle(ctx.projectRoot);
278
+ span.setAttribute("apollo.bundle_attached", true);
279
+ }
280
+ else {
281
+ span.setAttribute("apollo.bundle_attached", false);
282
+ }
283
+ const versionId = options.versionId?.trim() || ctx.projectConfig?.version_id;
284
+ span.setAttribute("apollo.include_trace", !!options.includeTrace);
285
+ const sp2 = startSpinner("Rerunning interaction...");
286
+ const result = await ctx.apollo.rerunMessage({
287
+ task_id: taskId,
288
+ interaction_id: interactionId,
289
+ text,
290
+ agent: {
291
+ agent_id: resolved.agentManagementId,
292
+ version_id: versionId ?? null,
293
+ },
294
+ agent_settings_bundle: bundle ?? null,
295
+ }, { includeTrace: !!options.includeTrace });
296
+ sp2.stop();
297
+ span.setAttribute("apollo.regenerated_task_id", result.regenerated_task_id);
298
+ span.setStatus({ code: SpanStatusCode.OK });
299
+ if (isJsonMode()) {
300
+ outputJson(result);
301
+ return;
302
+ }
303
+ renderRerun(result, !!options.includeTrace);
304
+ }
305
+ catch (error) {
306
+ recordSpanError(span, error);
307
+ throw error;
308
+ }
309
+ finally {
310
+ span.end();
311
+ }
312
+ });
313
+ }
314
+ function renderRerun(result, includeTrace) {
315
+ log(_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Header, { title: "Interaction Rerun", subtitle: result.regenerated_task_id }), _jsxs(Section, { title: "Result", children: [_jsx(KeyValue, { label: "Regenerated Task", value: result.regenerated_task_id }), result.message?.id ? (_jsx(KeyValue, { label: "Message ID", value: result.message.id })) : null] }), _jsx(Section, { title: "Reply", children: _jsx(Text, { color: colors.muted, children: result.message?.text || "(no text)" }) }), includeTrace ? (_jsx(Section, { title: "Trace", children: _jsx(Text, { color: colors.muted, children: result.message?.trace_info
316
+ ? "Trace info attached (use --json to see the full object)."
317
+ : "No trace info returned." }) })) : null] }));
318
+ }
319
+ // ═══════════════════════════════════════════════════════════════
320
+ // trace
321
+ // ═══════════════════════════════════════════════════════════════
322
+ export async function apolloTrace(options = {}) {
323
+ const tracer = getTracer();
324
+ await tracer.startActiveSpan("aui.apollo.trace", async (span) => {
325
+ try {
326
+ const taskId = options.taskId?.trim();
327
+ if (!taskId) {
328
+ throw new ValidationError("Missing required option: --task-id.", {
329
+ suggestion: "Pass --task-id <id> to fetch its interaction traces.",
330
+ });
331
+ }
332
+ const interactionId = options.interactionId?.trim();
333
+ const ctx = buildContext();
334
+ await attachContextTelemetry(span, ctx, options.agentId);
335
+ const spinner = startSpinner("Resolving agent...");
336
+ const resolved = await resolveBundledAgent({
337
+ client: ctx.aui,
338
+ agentIdOption: options.agentId,
339
+ projectConfig: ctx.projectConfig,
340
+ });
341
+ span.setAttribute("apollo.agent_id", resolved.agentManagementId);
342
+ span.setAttribute("apollo.task_id", taskId);
343
+ spinner.stop();
344
+ // Interaction-level trace (single object) when --interaction-id is
345
+ // given; otherwise the task-level list of all interaction traces.
346
+ if (interactionId) {
347
+ span.setAttribute("apollo.interaction_id", interactionId);
348
+ const sp2 = startSpinner("Fetching interaction trace info...");
349
+ const trace = await ctx.apollo.getInteractionTraceInfo(taskId, interactionId);
350
+ sp2.stop();
351
+ span.setStatus({ code: SpanStatusCode.OK });
352
+ if (isJsonMode()) {
353
+ outputJson({ task_id: taskId, interaction_id: interactionId, trace });
354
+ return;
355
+ }
356
+ renderInteractionTrace(taskId, interactionId, trace);
357
+ return;
358
+ }
359
+ const sp2 = startSpinner("Fetching trace info...");
360
+ const traces = await ctx.apollo.getTaskTraceInfo(taskId);
361
+ sp2.stop();
362
+ span.setAttribute("apollo.trace_count", Array.isArray(traces) ? traces.length : 0);
363
+ span.setStatus({ code: SpanStatusCode.OK });
364
+ if (isJsonMode()) {
365
+ outputJson({ task_id: taskId, count: Array.isArray(traces) ? traces.length : 0, traces });
366
+ return;
367
+ }
368
+ renderTrace(taskId, traces);
369
+ }
370
+ catch (error) {
371
+ recordSpanError(span, error);
372
+ throw error;
373
+ }
374
+ finally {
375
+ span.end();
376
+ }
377
+ });
378
+ }
379
+ function renderTrace(taskId, traces) {
380
+ const count = Array.isArray(traces) ? traces.length : 0;
381
+ log(_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Header, { title: "Task Trace Info", subtitle: taskId }), count === 0 ? (_jsx(StatusLine, { kind: "warning", label: "No interaction traces returned." })) : (_jsx(Section, { title: `Interaction traces (${count})`, children: _jsx(Text, { color: colors.muted, children: `Returned ${count} trace object(s). Use --json to see the full trace payload.` }) }))] }));
382
+ }
383
+ function renderInteractionTrace(taskId, interactionId, trace) {
384
+ const hasTrace = trace && Object.keys(trace).length > 0;
385
+ log(_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Header, { title: "Interaction Trace Info", subtitle: `${taskId} · ${interactionId}` }), !hasTrace ? (_jsx(StatusLine, { kind: "warning", label: "No trace info returned for this interaction." })) : (_jsx(Section, { title: "Trace", children: _jsx(Text, { color: colors.muted, children: "Trace returned. Use --json to see the full trace object." }) }))] }));
386
+ }
387
+ // ═══════════════════════════════════════════════════════════════
388
+ // menu (parent — non-interactive overview)
389
+ // ═══════════════════════════════════════════════════════════════
390
+ export async function apolloMenu() {
391
+ if (isJsonMode()) {
392
+ outputJson({
393
+ commands: [
394
+ { name: "create-task", description: "Create a runtime task for a bundle-mode agent" },
395
+ { name: "send-message", description: "Send a message (forwards the validated local bundle)" },
396
+ { name: "rerun", description: "Regenerate a task from an interaction and replay a message" },
397
+ { name: "trace", description: "Fetch all interaction traces for a task" },
398
+ ],
399
+ });
400
+ return;
401
+ }
402
+ log(_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Header, { title: "Apollo Messaging", subtitle: "Runtime task / message commands (bundle-mode agents only)" }), _jsxs(Section, { title: "Commands", children: [_jsx(KeyValue, { label: "create-task", value: "Create a runtime task for a bundle-mode agent" }), _jsx(KeyValue, { label: "send-message", value: "Send a message (forwards the validated local bundle)" }), _jsx(KeyValue, { label: "rerun", value: "Regenerate a task from an interaction and replay a message" }), _jsx(KeyValue, { label: "trace", value: "Fetch all interaction traces for a task" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Hint, { message: "Run `aui apollo <command> --help` for the flags of each command." }) })] }));
403
+ }
404
+ // ─── shared error recording ───
405
+ function recordSpanError(span, error) {
406
+ const msg = error instanceof Error ? error.message : String(error);
407
+ span.setStatus({ code: SpanStatusCode.ERROR, message: msg });
408
+ span.recordException(error instanceof Error ? error : new Error(msg));
409
+ }
410
+ //# sourceMappingURL=apollo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apollo.js","sourceRoot":"","sources":["../../src/commands/apollo.tsx"],"names":[],"mappings":";AAuCA,OAAO,KAA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yCAAyC,GAAG,IAClE,EACV,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,OAAO,EAAC,kEAAkE,GAAG,GAC/E,IACF,CACP,CAAC;AACJ,CAAC;AAED,iCAAiC;AAEjC,SAAS,eAAe,CAAC,IAAU,EAAE,KAAc;IACjD,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC,eAAe,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AACxE,CAAC"}
@@ -22,4 +22,5 @@ export { pullAgent } from "./pull-agent.js";
22
22
  export { upgrade } from "./upgrade.js";
23
23
  export { revert } from "./revert.js";
24
24
  export { widgetGenerate } from "./widget.js";
25
+ export { apolloMenu, apolloCreateTask, apolloSendMessage, apolloRerun, apolloTrace, } from "./apollo.js";
25
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MA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ACjC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC"}
@@ -22,4 +22,5 @@ export { pullAgent } from "./pull-agent.js";
22
22
  export { upgrade } from "./upgrade.js";
23
23
  export { revert } from "./revert.js";
24
24
  export { widgetGenerate } from "./widget.js";
25
+ export { apolloMenu, apolloCreateTask, apolloSendMessage, apolloRerun, apolloTrace, } from "./apollo.js";
25
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAA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AAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,aAAa,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Bundled-agent guard for the Apollo runtime messaging commands
3
+ * (`aui apollo create-task | send-message | rerun | trace`).
4
+ *
5
+ * These four commands are intentionally restricted to **bundle-mode
6
+ * agents** (`Agent.bundle_mode === true`). They forward an assembled
7
+ * agent-settings bundle (the same JSON shape `aui push` sends to the
8
+ * blob endpoint) and operate against the new agent-first Apollo
9
+ * contract — neither of which applies to legacy records-mode ("regular")
10
+ * agents. Running them against a records-mode agent would silently send
11
+ * a bundle the runtime can't honour, so we fail fast with a clear
12
+ * message instead.
13
+ *
14
+ * Resolution mirrors the rest of the CLI: an explicit `--agent-id`
15
+ * always wins, otherwise we fall back to the project's
16
+ * `.auirc.agent_management_id` (then the legacy `agent_id`). The
17
+ * bundle-mode decision is delegated to the shared `detectAgentBundleMode`
18
+ * dispatcher so the `AUI_FORCE_AGENT_MODE` escape hatch and the
19
+ * `agent.mode_resolved` telemetry event behave exactly as they do for
20
+ * push/pull/import.
21
+ */
22
+ import type { AUIClient, AgentInfo } from "../../api-client/index.js";
23
+ import type { ProjectConfig } from "../../config/index.js";
24
+ import { type AgentMode } from "./agent-mode.js";
25
+ export interface ResolveBundledAgentInput {
26
+ client: AUIClient;
27
+ /** Value of the command's `--agent-id` flag, if provided. */
28
+ agentIdOption?: string;
29
+ /** Loaded `.auirc` for the project, if any. */
30
+ projectConfig: ProjectConfig | null;
31
+ }
32
+ export interface ResolvedBundledAgent {
33
+ /** The agent-management id used for the Apollo body + bundle-mode check. */
34
+ agentManagementId: string;
35
+ /** The fetched AgentInfo when a network call was made (saves re-fetch). */
36
+ info?: AgentInfo;
37
+ /** Always `"bundle"` on success (we throw otherwise). */
38
+ mode: AgentMode;
39
+ }
40
+ /**
41
+ * Resolve the target agent-management id and assert it is a bundle-mode
42
+ * agent. Throws `ConfigError` when no agent can be resolved and
43
+ * `ValidationError` when the resolved agent is not bundle-mode.
44
+ */
45
+ export declare function resolveBundledAgent(input: ResolveBundledAgentInput): Promise<ResolvedBundledAgent>;
46
+ //# sourceMappingURL=bundled-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-agent.d.ts","sourceRoot":"","sources":["../../../src/commands/util/bundled-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAExE,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,SAAS,CAAC;IAClB,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,yDAAyD;IACzD,IAAI,EAAE,SAAS,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,CAiC/B"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Bundled-agent guard for the Apollo runtime messaging commands
3
+ * (`aui apollo create-task | send-message | rerun | trace`).
4
+ *
5
+ * These four commands are intentionally restricted to **bundle-mode
6
+ * agents** (`Agent.bundle_mode === true`). They forward an assembled
7
+ * agent-settings bundle (the same JSON shape `aui push` sends to the
8
+ * blob endpoint) and operate against the new agent-first Apollo
9
+ * contract — neither of which applies to legacy records-mode ("regular")
10
+ * agents. Running them against a records-mode agent would silently send
11
+ * a bundle the runtime can't honour, so we fail fast with a clear
12
+ * message instead.
13
+ *
14
+ * Resolution mirrors the rest of the CLI: an explicit `--agent-id`
15
+ * always wins, otherwise we fall back to the project's
16
+ * `.auirc.agent_management_id` (then the legacy `agent_id`). The
17
+ * bundle-mode decision is delegated to the shared `detectAgentBundleMode`
18
+ * dispatcher so the `AUI_FORCE_AGENT_MODE` escape hatch and the
19
+ * `agent.mode_resolved` telemetry event behave exactly as they do for
20
+ * push/pull/import.
21
+ */
22
+ import { ConfigError, ValidationError } from "../../errors/index.js";
23
+ import { detectAgentBundleMode } from "./agent-mode.js";
24
+ /**
25
+ * Resolve the target agent-management id and assert it is a bundle-mode
26
+ * agent. Throws `ConfigError` when no agent can be resolved and
27
+ * `ValidationError` when the resolved agent is not bundle-mode.
28
+ */
29
+ export async function resolveBundledAgent(input) {
30
+ const agentManagementId = input.agentIdOption?.trim() ||
31
+ input.projectConfig?.agent_management_id ||
32
+ input.projectConfig?.agent_id;
33
+ if (!agentManagementId) {
34
+ throw new ConfigError("No agent could be resolved for this command.", {
35
+ suggestion: "Pass --agent-id <agent-management-id>, or run from an imported agent project (so .auirc has agent_management_id). Use `aui import-agent` to link one.",
36
+ });
37
+ }
38
+ const resolution = await detectAgentBundleMode(input.client, agentManagementId);
39
+ if (resolution.mode !== "bundle") {
40
+ throw new ValidationError(`Agent ${agentManagementId} is a records-mode (regular) agent — the Apollo messaging commands are only available for bundle-mode agents.`, {
41
+ suggestion: "Use a bundle-mode agent (created with `aui agents --create --bundle-mode`, the default for new agents). These commands do not support legacy records-mode agents.",
42
+ });
43
+ }
44
+ return {
45
+ agentManagementId,
46
+ info: resolution.info,
47
+ mode: resolution.mode,
48
+ };
49
+ }
50
+ //# sourceMappingURL=bundled-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundled-agent.js","sourceRoot":"","sources":["../../../src/commands/util/bundled-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAkB,MAAM,iBAAiB,CAAC;AAmBxE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,KAA+B;IAE/B,MAAM,iBAAiB,GACrB,KAAK,CAAC,aAAa,EAAE,IAAI,EAAE;QAC3B,KAAK,CAAC,aAAa,EAAE,mBAAmB;QACxC,KAAK,CAAC,aAAa,EAAE,QAAQ,CAAC;IAEhC,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,WAAW,CACnB,8CAA8C,EAC9C;YACE,UAAU,EACR,uJAAuJ;SAC1J,CACF,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,qBAAqB,CAAC,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAEhF,IAAI,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,IAAI,eAAe,CACvB,SAAS,iBAAiB,+GAA+G,EACzI;YACE,UAAU,EACR,mKAAmK;SACtK,CACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,iBAAiB;QACjB,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,IAAI,EAAE,UAAU,CAAC,IAAI;KACtB,CAAC;AACJ,CAAC"}
@@ -57,6 +57,16 @@ export interface ValidateOptions {
57
57
  * the caller can never break validation.
58
58
  */
59
59
  onResult?: (summary: ValidateResultSummary) => void;
60
+ /**
61
+ * Suppress ALL user-facing output (Ink render AND the `--json`
62
+ * envelope) and just return the boolean / fire `onResult`. Used by
63
+ * commands that run validation as an internal preflight step and own
64
+ * their own stdout — notably `aui apollo send-message` / `rerun`,
65
+ * which validate the local files before forwarding the assembled
66
+ * bundle and must not emit a second JSON envelope. Telemetry (the
67
+ * `aui.validate` span + remote curl) still fires.
68
+ */
69
+ silent?: boolean;
60
70
  }
61
71
  /**
62
72
  * Rich validation summary surfaced via `ValidateOptions.onResult`. Mirrors
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AA2BH,OAAO,EAAqD,KAAK,qBAAqB,EAA2B,MAAM,wBAAwB,CAAC;AAKhJ,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACrD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,EAAE,EAAE,OAAO,CAAC;IACZ;;;;OAIG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,uDAAuD;IACvD,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,EAAE,CAAC;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