@agiflowai/agent-cli 0.0.10 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ import { ai as s, ah as t, a9 as o, ae as c, ad as S, a0 as m, a4 as n, ag as r, a8 as h, a6 as g, al as l, a7 as p, ac as M, aj as P, af as T, a5 as u, a1 as i, aa as C, ab as v, a3 as I, a2 as d, ak as x, am as A, an as R, ap as f, ao as q, aq as V } from "./index-DavC_yrW.mjs";
2
+ export {
3
+ s as AgentMessageCreateSchema,
4
+ t as AgentMessageTypeSchema,
5
+ o as ComponentSchema,
6
+ c as ErrorMessagePartSchema,
7
+ S as FileMessagePartSchema,
8
+ m as JSONValueSchema,
9
+ n as LanguageModelV1SourceSchema,
10
+ r as MessagePartSchema,
11
+ h as PlaceholderComponentSchema,
12
+ g as ReasoningMessagePartSchema,
13
+ l as RequestApprovalSchema,
14
+ p as SelectComponentSchema,
15
+ M as SourceMessagePartSchema,
16
+ P as StartMessageSchema,
17
+ T as StepStartMessagePartSchema,
18
+ u as TextMessagePartSchema,
19
+ i as ToolCallSchema,
20
+ C as ToolInvocationInputSchema,
21
+ v as ToolInvocationMessagePartSchema,
22
+ I as ToolInvocationSchema,
23
+ d as ToolResultSchema,
24
+ x as UpdateMessageSchema,
25
+ A as contentToParts,
26
+ R as convertToCreateData,
27
+ f as createSelectComponent,
28
+ q as createTextPart,
29
+ V as createToolInvocationInput
30
+ };
31
+ //# sourceMappingURL=index-qSVjC0ej.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-qSVjC0ej.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,58 @@
1
+ import { A as a, a as t, b as n, c as S, d as m, e as o, f as E, g as c, h as A, i as g, j as h, k as v, l as u, m as i, n as r, o as R, p, q as D, r as T, s as M, t as q, u as O, v as d, w as k, x as N, y as _, z as P, B as I, C as l, D as U, E as C, F as G, G as L, H as Y, I as f, J as B, K as V, L as x, M as y, N as z, O as b, P as j, Q as w, R as F, S as H, T as J, U as K, V as Q, W, X, Y as Z, Z as $, _ as ee, $ as se } from "./index-DavC_yrW.mjs";
2
+ export {
3
+ a as AGENT_EVENT_TYPES,
4
+ t as AGENT_STATUS,
5
+ n as AGENT_TYPES,
6
+ S as AgentConfigSchema,
7
+ m as AgentSessionDirectControlRequestEventSchema,
8
+ o as AgentSessionErrorAckEventSchema,
9
+ E as AgentSessionErrorRequestEventSchema,
10
+ c as AgentSessionErrorResponseEventSchema,
11
+ A as AgentSessionIdlePromptRequestEventSchema,
12
+ g as AgentSessionMessageDeletedAckEventSchema,
13
+ h as AgentSessionMessageDeletedEventSchema,
14
+ v as AgentSessionMessageInputAckEventSchema,
15
+ u as AgentSessionMessageInputRequestEventSchema,
16
+ i as AgentSessionMessageInputResponseEventSchema,
17
+ r as AgentSessionMessageOutputAckEventSchema,
18
+ R as AgentSessionMessageOutputEndedEventSchema,
19
+ p as AgentSessionMessageOutputPermissionRequestedEventSchema,
20
+ D as AgentSessionMessageOutputRequestEventSchema,
21
+ T as AgentSessionMessageOutputResponseEventSchema,
22
+ M as AgentSessionMessageOutputStartedEventSchema,
23
+ q as AgentSessionMessageStdinRequestEventSchema,
24
+ O as AgentSessionMessageStdoutResponseEventSchema,
25
+ d as AgentSessionResizeRequestEventSchema,
26
+ k as AgentSessionStatusAckEventSchema,
27
+ N as AgentSessionStatusRequestEventSchema,
28
+ _ as AgentSessionStatusResponseEventSchema,
29
+ P as AgentStatusSchema,
30
+ I as AgentTypeSchema,
31
+ l as BaseAgentSessionEventSchema,
32
+ U as BaseDaemonEventSchema,
33
+ C as COMMANDS,
34
+ G as DAEMON_EVENT_TYPES,
35
+ L as DAEMON_STATUS,
36
+ Y as DaemonErrorRequestEventSchema,
37
+ f as DaemonErrorResponseEventSchema,
38
+ B as DaemonListAgentSessionsAckEventSchema,
39
+ V as DaemonListAgentSessionsRequestEventSchema,
40
+ x as DaemonListAgentSessionsResponseEventSchema,
41
+ y as DaemonStartAgentAckEventSchema,
42
+ z as DaemonStartAgentRequestEventSchema,
43
+ b as DaemonStartAgentResponseEventSchema,
44
+ j as DaemonStatusRequestEventSchema,
45
+ w as DaemonStatusResponseEventSchema,
46
+ F as DaemonStatusSchema,
47
+ H as DaemonStopAgentAckEventSchema,
48
+ J as DaemonStopAgentRequestEventSchema,
49
+ K as DaemonStopAgentResponseEventSchema,
50
+ Q as DaemonTerminateAckEventSchema,
51
+ W as DaemonTerminateRequestEventSchema,
52
+ X as DaemonTerminateResponseEventSchema,
53
+ Z as EventTargetSchema,
54
+ $ as OUTPUT_STREAMS,
55
+ ee as OutputStreamSchema,
56
+ se as TraceIdSchema
57
+ };
58
+ //# sourceMappingURL=index-sv9a95e9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-sv9a95e9.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/dist/index.js CHANGED
@@ -1,2 +1,320 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./cli-Cr-ovvgN.js"),c=require("./AgentHttpService-Cz0DO3Zx.js"),i=require("@inquirer/prompts");class m{static async confirm(a,e=!0){return await i.confirm({message:a,default:e})}static async input(a,e){return await i.input({message:a,default:e?.default,validate:e?.validate})}static async password(a,e){return await i.password({message:a,validate:e?.validate})}static async select(a,e,n){return await i.select({message:a,choices:e.map(r=>({name:r,value:r})),default:n})}static async multiSelect(a,e,n){return await i.checkbox({message:a,choices:e.map(r=>({name:r,value:r,checked:n?.includes(r)||!1}))})}static async number(a,e){const n=await i.number({message:a,default:e?.default,validate:r=>r==null?"Value is required":e?.min!==void 0&&r<e.min?`Value must be at least ${e.min}`:e?.max!==void 0&&r>e.max?`Value must be at most ${e.max}`:!0});if(n===void 0)throw new Error("Number input was cancelled or invalid");return n}}exports.BaseCommand=t.BaseCommand;exports.ClaudeCommand=t.ClaudeCommand;exports.ConfigSchema=t.ConfigSchema;exports.ConnectCommand=t.ConnectCommand;exports.DaemonHttpService=t.DaemonHttpService;exports.DaemonWsService=t.DaemonWsService;exports.DeviceCodeAuthService=t.DeviceCodeAuthService;exports.LogoutCommand=t.LogoutCommand;exports.RouterCommand=t.RouterCommand;exports.config=t.config;exports.createHeartbeat=t.createHeartbeat;exports.generateDeviceId=t.generateDeviceId;exports.getServerUrl=t.getServerUrl;exports.getSystemInfo=t.getSystemInfo;exports.getWebSocketUrl=t.getWebSocketUrl;exports.httpToWebSocket=t.httpToWebSocket;exports.webSocketToHttp=t.webSocketToHttp;exports.FileSystemUtils=c.FileSystemUtils;exports.Logger=c.Logger;exports.SessionSettingsManager=c.SessionSettingsManager;exports.PromptUtils=m;
1
+ import { ar as o, as as l } from "./index-DavC_yrW.mjs";
2
+ import { aK as E, aI as I, aJ as k, aL as A, aM as T, ax as L, b4 as N, ay as R, az as P, aN as U, aO as B, b0 as J, aQ as $, at as z, aP as V, aR as W, aS as H, aT as O, aU as _, aV as Y, aC as G, b6 as K, aW as j, au as q, b1 as Q, aY as X, aB as Z, aZ as ee, a_ as te, a$ as ae, aX as se, b2 as re, aA as ie, bc as ne, aG as oe, b3 as le, aH as ue, aE as me, aF as ce, av as fe, b5 as he, bb as de, b7 as ge, aD as be, b8 as Se, aw as we, b9 as pe, ba as ve } from "./index-DavC_yrW.mjs";
3
+ import * as n from "node:fs";
4
+ import * as c from "node:path";
5
+ import { confirm as f, input as h, password as d, select as g, checkbox as b, number as S } from "@inquirer/prompts";
6
+ import "./cli.js";
7
+ class y {
8
+ /**
9
+ * Ask for confirmation with a yes/no prompt
10
+ */
11
+ static async confirm(t, e = !0) {
12
+ return await f({
13
+ message: t,
14
+ default: e
15
+ });
16
+ }
17
+ /**
18
+ * Ask for text input
19
+ */
20
+ static async input(t, e) {
21
+ return await h({
22
+ message: t,
23
+ default: e?.default,
24
+ validate: e?.validate
25
+ });
26
+ }
27
+ /**
28
+ * Ask for password input (hidden)
29
+ */
30
+ static async password(t, e) {
31
+ return await d({
32
+ message: t,
33
+ validate: e?.validate
34
+ });
35
+ }
36
+ /**
37
+ * Ask user to select from a list of choices
38
+ */
39
+ static async select(t, e, a) {
40
+ return await g({
41
+ message: t,
42
+ choices: e.map((s) => ({ name: s, value: s })),
43
+ default: a
44
+ });
45
+ }
46
+ /**
47
+ * Ask user to select multiple items from a list
48
+ */
49
+ static async multiSelect(t, e, a) {
50
+ return await b({
51
+ message: t,
52
+ choices: e.map((s) => ({
53
+ name: s,
54
+ value: s,
55
+ checked: a?.includes(s) || !1
56
+ }))
57
+ });
58
+ }
59
+ /**
60
+ * Ask for a number input
61
+ */
62
+ static async number(t, e) {
63
+ const a = await S({
64
+ message: t,
65
+ default: e?.default,
66
+ validate: (s) => s == null ? "Value is required" : e?.min !== void 0 && s < e.min ? `Value must be at least ${e.min}` : e?.max !== void 0 && s > e.max ? `Value must be at most ${e.max}` : !0
67
+ });
68
+ if (a === void 0)
69
+ throw new Error("Number input was cancelled or invalid");
70
+ return a;
71
+ }
72
+ }
73
+ class x extends o {
74
+ resourceType = "BUFFER";
75
+ priority = l.NORMAL;
76
+ buffer = [];
77
+ onFlush;
78
+ maxSize;
79
+ /**
80
+ * Create a new disposable buffer.
81
+ * @param onFlush - Optional callback to receive buffer contents on disposal
82
+ * @param maxSize - Maximum number of items to keep (default: unlimited)
83
+ * @param resourceId - Optional custom resource ID
84
+ */
85
+ constructor(t, e = 1 / 0, a) {
86
+ super(a), this.onFlush = t, this.maxSize = e;
87
+ }
88
+ /**
89
+ * Add data to the buffer.
90
+ * If maxSize is set, oldest items are removed when limit is exceeded.
91
+ */
92
+ push(t) {
93
+ this.isDisposed || (this.buffer.push(t), this.buffer.length > this.maxSize && (this.buffer = this.buffer.slice(-this.maxSize)));
94
+ }
95
+ /**
96
+ * Get current buffer contents without clearing.
97
+ */
98
+ peek() {
99
+ return this.buffer;
100
+ }
101
+ /**
102
+ * Get current buffer size.
103
+ */
104
+ get size() {
105
+ return this.buffer.length;
106
+ }
107
+ /**
108
+ * Clear the buffer without flushing.
109
+ */
110
+ clear() {
111
+ this.buffer = [];
112
+ }
113
+ async doDispose() {
114
+ this.onFlush && this.buffer.length > 0 && await this.onFlush(this.buffer), this.buffer = [], this.onFlush = void 0;
115
+ }
116
+ }
117
+ class D extends o {
118
+ resourceType = "TIMEOUT";
119
+ priority = l.LOW;
120
+ timeoutId = null;
121
+ /**
122
+ * Create a new disposable timeout.
123
+ * @param callback - Function to call when timeout fires
124
+ * @param ms - Delay in milliseconds
125
+ * @param resourceId - Optional custom resource ID
126
+ */
127
+ constructor(t, e, a) {
128
+ super(a), this.timeoutId = setTimeout(() => {
129
+ t(), this.timeoutId = null;
130
+ }, e);
131
+ }
132
+ async doDispose() {
133
+ this.timeoutId !== null && (clearTimeout(this.timeoutId), this.timeoutId = null);
134
+ }
135
+ }
136
+ class M {
137
+ stream;
138
+ useJsonFormat;
139
+ constructor(t) {
140
+ const e = c.dirname(t.logFilePath);
141
+ n.existsSync(e) || n.mkdirSync(e, { recursive: !0 }), this.stream = n.createWriteStream(t.logFilePath, {
142
+ flags: "a",
143
+ // Append mode
144
+ encoding: "utf8"
145
+ }), this.useJsonFormat = t.useJsonFormat ?? !0, this.stream.on("error", (a) => {
146
+ console.error("[FileLogger] Stream error:", a);
147
+ });
148
+ }
149
+ /**
150
+ * Write a log entry to the file
151
+ */
152
+ write(t, e, a, ...s) {
153
+ const i = {
154
+ level: t,
155
+ time: Date.now(),
156
+ msg: a,
157
+ ...s.length > 0 && { args: s }
158
+ };
159
+ if (this.useJsonFormat)
160
+ this.stream.write(JSON.stringify(i) + `
161
+ `);
162
+ else {
163
+ const u = (/* @__PURE__ */ new Date()).toISOString(), m = s.length > 0 ? " " + JSON.stringify(s) : "";
164
+ this.stream.write(`[${u}] ${e.toUpperCase()}: ${a}${m}
165
+ `);
166
+ }
167
+ }
168
+ /**
169
+ * Log an informational message
170
+ */
171
+ info(t, ...e) {
172
+ this.write(30, "info", t, ...e);
173
+ }
174
+ /**
175
+ * Log a success message
176
+ */
177
+ success(t, ...e) {
178
+ this.write(30, "success", t, ...e);
179
+ }
180
+ /**
181
+ * Log a warning message
182
+ */
183
+ warn(t, ...e) {
184
+ this.write(40, "warn", t, ...e);
185
+ }
186
+ /**
187
+ * Log an error message
188
+ */
189
+ error(t, e) {
190
+ let a;
191
+ e instanceof Error && (a = e), a ? this.write(50, "error", t, {
192
+ error: {
193
+ message: a.message,
194
+ stack: a.stack,
195
+ name: a.name
196
+ }
197
+ }) : this.write(50, "error", t, e);
198
+ }
199
+ /**
200
+ * Log a debug message
201
+ */
202
+ debug(t, ...e) {
203
+ this.write(20, "debug", t, ...e);
204
+ }
205
+ /**
206
+ * Log a trace message
207
+ */
208
+ trace(t, ...e) {
209
+ this.write(10, "trace", t, ...e);
210
+ }
211
+ /**
212
+ * Log a title/header message
213
+ */
214
+ title(t, ...e) {
215
+ this.write(30, "title", t, ...e);
216
+ }
217
+ /**
218
+ * Log code or formatted content
219
+ */
220
+ code(t, ...e) {
221
+ this.write(30, "code", t, ...e);
222
+ }
223
+ /**
224
+ * Log a new line (no-op for file logger)
225
+ */
226
+ newLine() {
227
+ }
228
+ /**
229
+ * Log a terminal command or output
230
+ */
231
+ terminal(t, ...e) {
232
+ this.write(30, "terminal", t, ...e);
233
+ }
234
+ /**
235
+ * Generic log method with level
236
+ */
237
+ log(t, e, ...a) {
238
+ const i = {
239
+ trace: 10,
240
+ debug: 20,
241
+ info: 30,
242
+ warn: 40,
243
+ error: 50,
244
+ fatal: 60
245
+ }[t.toLowerCase()] || 30;
246
+ this.write(i, t, e, ...a);
247
+ }
248
+ /**
249
+ * Close the file stream
250
+ */
251
+ close() {
252
+ return new Promise((t, e) => {
253
+ this.stream.end((a) => {
254
+ a ? e(a) : t();
255
+ });
256
+ });
257
+ }
258
+ /**
259
+ * Flush pending writes to disk
260
+ */
261
+ flush() {
262
+ this.stream.write("");
263
+ }
264
+ }
265
+ export {
266
+ E as AgentAlreadyExistsError,
267
+ I as AgentDetectionService,
268
+ k as AgentManager,
269
+ A as AgentManagerError,
270
+ T as AgentNotFoundError,
271
+ L as AppConfigSchema,
272
+ o as BaseDisposable,
273
+ N as CommandBuilder,
274
+ R as ConfigManager,
275
+ P as ConfigSchema,
276
+ U as ContextService,
277
+ B as CredentialsService,
278
+ J as DEFAULT_RETRY_CONFIG,
279
+ $ as DaemonAlreadyRunningError,
280
+ z as DaemonCommand,
281
+ V as DaemonManager,
282
+ W as DaemonManagerError,
283
+ H as DaemonNotRunningError,
284
+ O as DeviceCodeAuthService,
285
+ x as DisposableBuffer,
286
+ _ as DisposableInterval,
287
+ Y as DisposableRegistry,
288
+ D as DisposableTimeout,
289
+ G as ENV_KEYS,
290
+ M as FileLogger,
291
+ K as FileSystemUtils,
292
+ j as HookManagementService,
293
+ q as LogoutCommand,
294
+ Q as MessageMultiplexClient,
295
+ X as MiddlewarePipeline,
296
+ Z as MultiplexClientConfig,
297
+ ee as MultiplexDirectClient,
298
+ te as MultiplexRemoteClient,
299
+ ae as MultiplexStandaloneClient,
300
+ se as PinoLogger,
301
+ re as ProjectListing,
302
+ y as PromptUtils,
303
+ ie as RuntimeConfigSchema,
304
+ ne as SessionSettingsManager,
305
+ oe as StandaloneMultiplexBroker,
306
+ le as StateManagerService,
307
+ ue as StatefulMultiplexBroker,
308
+ me as SubEnvManager,
309
+ ce as SubEnvSchema,
310
+ fe as config,
311
+ he as createCommandBuilder,
312
+ de as createHeartbeat,
313
+ ge as generateDeviceId,
314
+ be as getServerUrl,
315
+ Se as getSystemInfo,
316
+ we as getWebSocketUrl,
317
+ pe as httpToWebSocket,
318
+ ve as webSocketToHttp
319
+ };
2
320
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils/prompts.ts"],"sourcesContent":["import { checkbox, confirm, input, number, password, select } from '@inquirer/prompts';\n\nexport class PromptUtils {\n /**\n * Ask for confirmation with a yes/no prompt\n */\n static async confirm(message: string, defaultValue = true): Promise<boolean> {\n return await confirm({\n message,\n default: defaultValue,\n });\n }\n\n /**\n * Ask for text input\n */\n static async input(\n message: string,\n options?: {\n default?: string;\n validate?: (input: string) => boolean | string;\n },\n ): Promise<string> {\n return await input({\n message,\n default: options?.default,\n validate: options?.validate,\n });\n }\n\n /**\n * Ask for password input (hidden)\n */\n static async password(\n message: string,\n options?: {\n validate?: (input: string) => boolean | string;\n },\n ): Promise<string> {\n return await password({\n message,\n validate: options?.validate,\n });\n }\n\n /**\n * Ask user to select from a list of choices\n */\n static async select(message: string, choices: string[], defaultChoice?: string): Promise<string> {\n return await select({\n message,\n choices: choices.map((choice) => ({ name: choice, value: choice })),\n default: defaultChoice,\n });\n }\n\n /**\n * Ask user to select multiple items from a list\n */\n static async multiSelect(message: string, choices: string[], defaultChoices?: string[]): Promise<string[]> {\n return await checkbox({\n message,\n choices: choices.map((choice) => ({\n name: choice,\n value: choice,\n checked: defaultChoices?.includes(choice) || false,\n })),\n });\n }\n\n /**\n * Ask for a number input\n */\n static async number(\n message: string,\n options?: {\n default?: number;\n min?: number;\n max?: number;\n },\n ): Promise<number> {\n const result = await number({\n message,\n default: options?.default,\n validate: (input?: number) => {\n if (input === undefined || input === null) return 'Value is required';\n if (options?.min !== undefined && input < options.min) {\n return `Value must be at least ${options.min}`;\n }\n if (options?.max !== undefined && input > options.max) {\n return `Value must be at most ${options.max}`;\n }\n return true;\n },\n });\n\n if (result === undefined) {\n throw new Error('Number input was cancelled or invalid');\n }\n\n return result;\n }\n}\n"],"names":["PromptUtils","message","defaultValue","confirm","options","input","password","choices","defaultChoice","select","choice","defaultChoices","checkbox","result","number"],"mappings":"gMAEO,MAAMA,CAAY,CAIvB,aAAa,QAAQC,EAAiBC,EAAe,GAAwB,CAC3E,OAAO,MAAMC,EAAAA,QAAQ,CACnB,QAAAF,EACA,QAASC,CAAA,CACV,CACH,CAKA,aAAa,MACXD,EACAG,EAIiB,CACjB,OAAO,MAAMC,EAAAA,MAAM,CACjB,QAAAJ,EACA,QAASG,GAAS,QAClB,SAAUA,GAAS,QAAA,CACpB,CACH,CAKA,aAAa,SACXH,EACAG,EAGiB,CACjB,OAAO,MAAME,EAAAA,SAAS,CACpB,QAAAL,EACA,SAAUG,GAAS,QAAA,CACpB,CACH,CAKA,aAAa,OAAOH,EAAiBM,EAAmBC,EAAyC,CAC/F,OAAO,MAAMC,EAAAA,OAAO,CAClB,QAAAR,EACA,QAASM,EAAQ,IAAKG,IAAY,CAAE,KAAMA,EAAQ,MAAOA,CAAA,EAAS,EAClE,QAASF,CAAA,CACV,CACH,CAKA,aAAa,YAAYP,EAAiBM,EAAmBI,EAA8C,CACzG,OAAO,MAAMC,EAAAA,SAAS,CACpB,QAAAX,EACA,QAASM,EAAQ,IAAKG,IAAY,CAChC,KAAMA,EACN,MAAOA,EACP,QAASC,GAAgB,SAASD,CAAM,GAAK,EAAA,EAC7C,CAAA,CACH,CACH,CAKA,aAAa,OACXT,EACAG,EAKiB,CACjB,MAAMS,EAAS,MAAMC,SAAO,CAC1B,QAAAb,EACA,QAASG,GAAS,QAClB,SAAWC,GACkBA,GAAU,KAAa,oBAC9CD,GAAS,MAAQ,QAAaC,EAAQD,EAAQ,IACzC,0BAA0BA,EAAQ,GAAG,GAE1CA,GAAS,MAAQ,QAAaC,EAAQD,EAAQ,IACzC,yBAAyBA,EAAQ,GAAG,GAEtC,EACT,CACD,EAED,GAAIS,IAAW,OACb,MAAM,IAAI,MAAM,uCAAuC,EAGzD,OAAOA,CACT,CACF"}
1
+ {"version":3,"file":"index.js","sources":["../src/utils/prompts.ts","../src/services/Disposable/DisposableBuffer.ts","../src/services/Disposable/DisposableTimeout.ts","../src/services/Logger/FileLogger.ts"],"sourcesContent":["import { checkbox, confirm, input, number, password, select } from '@inquirer/prompts';\n\nexport class PromptUtils {\n /**\n * Ask for confirmation with a yes/no prompt\n */\n static async confirm(message: string, defaultValue = true): Promise<boolean> {\n return await confirm({\n message,\n default: defaultValue,\n });\n }\n\n /**\n * Ask for text input\n */\n static async input(\n message: string,\n options?: {\n default?: string;\n validate?: (input: string) => boolean | string;\n },\n ): Promise<string> {\n return await input({\n message,\n default: options?.default,\n validate: options?.validate,\n });\n }\n\n /**\n * Ask for password input (hidden)\n */\n static async password(\n message: string,\n options?: {\n validate?: (input: string) => boolean | string;\n },\n ): Promise<string> {\n return await password({\n message,\n validate: options?.validate,\n });\n }\n\n /**\n * Ask user to select from a list of choices\n */\n static async select(message: string, choices: string[], defaultChoice?: string): Promise<string> {\n return await select({\n message,\n choices: choices.map((choice) => ({ name: choice, value: choice })),\n default: defaultChoice,\n });\n }\n\n /**\n * Ask user to select multiple items from a list\n */\n static async multiSelect(message: string, choices: string[], defaultChoices?: string[]): Promise<string[]> {\n return await checkbox({\n message,\n choices: choices.map((choice) => ({\n name: choice,\n value: choice,\n checked: defaultChoices?.includes(choice) || false,\n })),\n });\n }\n\n /**\n * Ask for a number input\n */\n static async number(\n message: string,\n options?: {\n default?: number;\n min?: number;\n max?: number;\n },\n ): Promise<number> {\n const result = await number({\n message,\n default: options?.default,\n validate: (input?: number) => {\n if (input === undefined || input === null) return 'Value is required';\n if (options?.min !== undefined && input < options.min) {\n return `Value must be at least ${options.min}`;\n }\n if (options?.max !== undefined && input > options.max) {\n return `Value must be at most ${options.max}`;\n }\n return true;\n },\n });\n\n if (result === undefined) {\n throw new Error('Number input was cancelled or invalid');\n }\n\n return result;\n }\n}\n","/**\n * DisposableBuffer - Manages a string buffer with automatic flush on disposal\n *\n * Use this for output buffering that needs to be flushed when\n * the agent session terminates.\n */\n\nimport { DisposalPriority } from '@/interfaces/disposable';\nimport { BaseDisposable } from './BaseDisposable';\n\n/**\n * A disposable buffer that flushes remaining content on disposal.\n * Useful for buffering output data that needs to be sent before cleanup.\n */\nexport class DisposableBuffer extends BaseDisposable {\n readonly resourceType = 'BUFFER';\n readonly priority = DisposalPriority.NORMAL;\n\n private buffer: string[] = [];\n private onFlush?: (data: string[]) => void | Promise<void>;\n private maxSize: number;\n\n /**\n * Create a new disposable buffer.\n * @param onFlush - Optional callback to receive buffer contents on disposal\n * @param maxSize - Maximum number of items to keep (default: unlimited)\n * @param resourceId - Optional custom resource ID\n */\n constructor(onFlush?: (data: string[]) => void | Promise<void>, maxSize: number = Infinity, resourceId?: string) {\n super(resourceId);\n this.onFlush = onFlush;\n this.maxSize = maxSize;\n }\n\n /**\n * Add data to the buffer.\n * If maxSize is set, oldest items are removed when limit is exceeded.\n */\n push(data: string): void {\n if (this.isDisposed) return;\n\n this.buffer.push(data);\n\n // Trim if over maxSize\n if (this.buffer.length > this.maxSize) {\n this.buffer = this.buffer.slice(-this.maxSize);\n }\n }\n\n /**\n * Get current buffer contents without clearing.\n */\n peek(): ReadonlyArray<string> {\n return this.buffer;\n }\n\n /**\n * Get current buffer size.\n */\n get size(): number {\n return this.buffer.length;\n }\n\n /**\n * Clear the buffer without flushing.\n */\n clear(): void {\n this.buffer = [];\n }\n\n protected async doDispose(): Promise<void> {\n // Flush remaining content\n if (this.onFlush && this.buffer.length > 0) {\n await this.onFlush(this.buffer);\n }\n this.buffer = [];\n this.onFlush = undefined;\n }\n}\n","/**\n * DisposableTimeout - Wraps setTimeout with automatic cleanup\n *\n * Use this instead of raw setTimeout to ensure timeouts are\n * properly cleaned up when the agent session terminates.\n */\n\nimport { DisposalPriority } from '@/interfaces/disposable';\nimport { BaseDisposable } from './BaseDisposable';\n\n/**\n * A disposable wrapper around setTimeout.\n * Automatically clears the timeout on disposal.\n */\nexport class DisposableTimeout extends BaseDisposable {\n readonly resourceType = 'TIMEOUT';\n readonly priority = DisposalPriority.LOW;\n\n private timeoutId: NodeJS.Timeout | null = null;\n\n /**\n * Create a new disposable timeout.\n * @param callback - Function to call when timeout fires\n * @param ms - Delay in milliseconds\n * @param resourceId - Optional custom resource ID\n */\n constructor(callback: () => void, ms: number, resourceId?: string) {\n super(resourceId);\n this.timeoutId = setTimeout(() => {\n callback();\n this.timeoutId = null; // Mark as fired\n }, ms);\n }\n\n protected async doDispose(): Promise<void> {\n if (this.timeoutId !== null) {\n clearTimeout(this.timeoutId);\n this.timeoutId = null;\n }\n }\n}\n","/**\n * File Logger Implementation\n *\n * Simple file stream logger without stdout pollution.\n * Features:\n * - Direct fs.WriteStream writing\n * - Structured JSON logging\n * - No stdout interference\n * - Pino-compatible log levels\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport type { ILogger } from './types';\n\nexport interface FileLoggerOptions {\n logFilePath: string;\n useJsonFormat?: boolean;\n}\n\nexport class FileLogger implements ILogger {\n private stream: fs.WriteStream;\n private useJsonFormat: boolean;\n\n constructor(options: FileLoggerOptions) {\n // Ensure log directory exists\n const logDir = path.dirname(options.logFilePath);\n if (!fs.existsSync(logDir)) {\n fs.mkdirSync(logDir, { recursive: true });\n }\n\n this.stream = fs.createWriteStream(options.logFilePath, {\n flags: 'a', // Append mode\n encoding: 'utf8',\n });\n\n this.useJsonFormat = options.useJsonFormat ?? true;\n\n // Handle stream errors\n this.stream.on('error', (error) => {\n console.error('[FileLogger] Stream error:', error);\n });\n }\n\n /**\n * Write a log entry to the file\n */\n private write(level: number, levelName: string, message: string, ...args: any[]): void {\n const logEntry = {\n level,\n time: Date.now(),\n msg: message,\n ...(args.length > 0 && { args }),\n };\n\n if (this.useJsonFormat) {\n this.stream.write(JSON.stringify(logEntry) + '\\n');\n } else {\n const timestamp = new Date().toISOString();\n const argsStr = args.length > 0 ? ' ' + JSON.stringify(args) : '';\n this.stream.write(`[${timestamp}] ${levelName.toUpperCase()}: ${message}${argsStr}\\n`);\n }\n }\n\n /**\n * Log an informational message\n */\n info(message: string, ...args: any[]): void {\n this.write(30, 'info', message, ...args);\n }\n\n /**\n * Log a success message\n */\n success(message: string, ...args: any[]): void {\n this.write(30, 'success', message, ...args);\n }\n\n /**\n * Log a warning message\n */\n warn(message: string, ...args: any[]): void {\n this.write(40, 'warn', message, ...args);\n }\n\n /**\n * Log an error message\n */\n error(message: string, errorOrOptions?: Error | any): void {\n let error: Error | undefined;\n\n if (errorOrOptions instanceof Error) {\n error = errorOrOptions;\n }\n\n if (error) {\n this.write(50, 'error', message, {\n error: {\n message: error.message,\n stack: error.stack,\n name: error.name,\n },\n });\n } else {\n this.write(50, 'error', message, errorOrOptions);\n }\n }\n\n /**\n * Log a debug message\n */\n debug(message: string, ...args: any[]): void {\n this.write(20, 'debug', message, ...args);\n }\n\n /**\n * Log a trace message\n */\n trace(message: string, ...args: any[]): void {\n this.write(10, 'trace', message, ...args);\n }\n\n /**\n * Log a title/header message\n */\n title(message: string, ...args: any[]): void {\n this.write(30, 'title', message, ...args);\n }\n\n /**\n * Log code or formatted content\n */\n code(message: string, ...args: any[]): void {\n this.write(30, 'code', message, ...args);\n }\n\n /**\n * Log a new line (no-op for file logger)\n */\n newLine(): void {\n // No-op for file logger\n }\n\n /**\n * Log a terminal command or output\n */\n terminal(message: string, ...args: any[]): void {\n this.write(30, 'terminal', message, ...args);\n }\n\n /**\n * Generic log method with level\n */\n log(level: string, message: string, ...args: any[]): void {\n const levelMap: Record<string, number> = {\n trace: 10,\n debug: 20,\n info: 30,\n warn: 40,\n error: 50,\n fatal: 60,\n };\n\n const levelNum = levelMap[level.toLowerCase()] || 30;\n this.write(levelNum, level, message, ...args);\n }\n\n /**\n * Close the file stream\n */\n close(): Promise<void> {\n return new Promise((resolve, reject) => {\n this.stream.end((error) => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n }\n\n /**\n * Flush pending writes to disk\n */\n flush(): void {\n // Node.js WriteStream doesn't have a flush method\n // But we can drain the buffer by writing an empty string\n this.stream.write('');\n }\n}\n"],"names":["PromptUtils","message","defaultValue","confirm","options","input","password","choices","defaultChoice","select","choice","defaultChoices","checkbox","result","number","DisposableBuffer","BaseDisposable","DisposalPriority","onFlush","maxSize","resourceId","data","DisposableTimeout","callback","ms","FileLogger","logDir","path","fs","error","level","levelName","args","logEntry","timestamp","argsStr","errorOrOptions","levelNum","resolve","reject"],"mappings":";;;;;;AAEO,MAAMA,E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AAgB;AAAA,EAEhB;AAAA;AAAA;AAAA;AAAA,EAKA,SAAS/B,MAAoB+B,GAAmB;AAC9C,SAAK,MAAM,IAAI,YAAY/B,GAAS,GAAG+B,CAAI;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA,EAKA,IAAIF,GAAe7B,MAAoB+B,GAAmB;AAUxD,UAAMK,IATmC;AAAA,MACvC,OAAO;AAAA,MACP,OAAO;AAAA,MACP,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,IAAA,EAGiBP,EAAM,YAAA,CAAa,KAAK;AAClD,SAAK,MAAMO,GAAUP,GAAO7B,GAAS,GAAG+B,CAAI;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA,EAKA,QAAuB;AACrB,WAAO,IAAI,QAAQ,CAACM,GAASC,MAAW;AACtC,WAAK,OAAO,IAAI,CAACV,MAAU;AACzB,QAAIA,IACFU,EAAOV,CAAK,IAEZS,EAAA;AAAA,MAEJ,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,QAAc;AAGZ,SAAK,OAAO,MAAM,EAAE;AAAA,EACtB;AACF;"}
package/dist/package.json CHANGED
@@ -1,25 +1,42 @@
1
1
  {
2
2
  "name": "@agiflowai/agent-cli",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "description": "@agiflowai/agent-cli - Command-line interface for Agiflow development tools",
5
+ "type": "module",
5
6
  "bin": {
6
7
  "agent-cli": "./dist/bin/cli.js"
7
8
  },
8
9
  "dependencies": {
9
- "@agimonai/universal-agent-events": "workspace:*",
10
+ "@inkjs/ui": "^2.0.0",
11
+ "@inquirer/prompts": "^7.8.0",
12
+ "@reduxjs/toolkit": "2.8.2",
13
+ "@tanstack/react-query": "5.90.6",
14
+ "@types/node-forge": "^1.3.14",
15
+ "async": "^3.2.6",
10
16
  "best-effort-json-parser": "1.2.1",
11
17
  "chalk": "5.4.1",
12
18
  "commander": "12.1.0",
13
19
  "dotenv": "17.2.3",
14
20
  "execa": "^9.6.0",
15
21
  "fs-extra": "11.2.0",
16
- "@inquirer/prompts": "^7.8.0",
22
+ "http-mitm-proxy": "^1.1.0",
23
+ "ink": "^6.5.0",
24
+ "ink-link": "^5.0.0",
25
+ "inversify": "7.10.4",
26
+ "mkdirp": "^3.0.1",
27
+ "node-forge": "^1.3.1",
17
28
  "node-pty": "^1.0.0",
18
29
  "ora": "8.1.1",
19
30
  "pino": "10.1.0",
20
31
  "pino-pretty": "13.1.2",
21
32
  "pino-roll": "^3.1.0",
33
+ "react": "19.2.0",
34
+ "react-redux": "^9.2.0",
35
+ "redux": "5.0.1",
36
+ "reflect-metadata": "0.2.2",
37
+ "semaphore": "^1.1.0",
22
38
  "strip-ansi": "^7.1.0",
39
+ "supports-color": "^10.2.2",
23
40
  "ulidx": "2.4.1",
24
41
  "ws": "^8.18.3",
25
42
  "zod": "4.1.12"