@agentuity/cli 1.0.23 → 1.0.24
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/cmd/cloud/db/index.d.ts.map +1 -1
- package/dist/cmd/cloud/db/index.js +2 -0
- package/dist/cmd/cloud/db/index.js.map +1 -1
- package/dist/cmd/cloud/db/stats.d.ts +3 -0
- package/dist/cmd/cloud/db/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/db/stats.js +66 -0
- package/dist/cmd/cloud/db/stats.js.map +1 -0
- package/dist/cmd/cloud/email/create.d.ts.map +1 -1
- package/dist/cmd/cloud/email/create.js +14 -6
- package/dist/cmd/cloud/email/create.js.map +1 -1
- package/dist/cmd/cloud/email/delete.js +1 -1
- package/dist/cmd/cloud/email/delete.js.map +1 -1
- package/dist/cmd/cloud/email/destination/delete.js +1 -1
- package/dist/cmd/cloud/email/destination/delete.js.map +1 -1
- package/dist/cmd/cloud/email/destination/list.js +1 -1
- package/dist/cmd/cloud/email/destination/list.js.map +1 -1
- package/dist/cmd/cloud/email/destination/url.d.ts.map +1 -1
- package/dist/cmd/cloud/email/destination/url.js +5 -4
- package/dist/cmd/cloud/email/destination/url.js.map +1 -1
- package/dist/cmd/cloud/email/get.js +1 -1
- package/dist/cmd/cloud/email/get.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/get.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/get.js +2 -3
- package/dist/cmd/cloud/email/inbound/get.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/list.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/list.js +1 -3
- package/dist/cmd/cloud/email/inbound/list.js.map +1 -1
- package/dist/cmd/cloud/email/inbound/schemas.d.ts +3 -1
- package/dist/cmd/cloud/email/inbound/schemas.d.ts.map +1 -1
- package/dist/cmd/cloud/email/inbound/schemas.js +3 -1
- package/dist/cmd/cloud/email/inbound/schemas.js.map +1 -1
- package/dist/cmd/cloud/email/index.d.ts.map +1 -1
- package/dist/cmd/cloud/email/index.js +2 -0
- package/dist/cmd/cloud/email/index.js.map +1 -1
- package/dist/cmd/cloud/email/list.d.ts.map +1 -1
- package/dist/cmd/cloud/email/list.js +9 -2
- package/dist/cmd/cloud/email/list.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/get.js +4 -4
- package/dist/cmd/cloud/email/outbound/get.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/list.js +3 -3
- package/dist/cmd/cloud/email/outbound/list.js.map +1 -1
- package/dist/cmd/cloud/email/outbound/schemas.d.ts +2 -2
- package/dist/cmd/cloud/email/outbound/schemas.js +2 -2
- package/dist/cmd/cloud/email/outbound/schemas.js.map +1 -1
- package/dist/cmd/cloud/email/send.d.ts.map +1 -1
- package/dist/cmd/cloud/email/send.js +8 -10
- package/dist/cmd/cloud/email/send.js.map +1 -1
- package/dist/cmd/cloud/email/stats.d.ts +3 -0
- package/dist/cmd/cloud/email/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/email/stats.js +65 -0
- package/dist/cmd/cloud/email/stats.js.map +1 -0
- package/dist/cmd/cloud/email/util.d.ts +4 -7
- package/dist/cmd/cloud/email/util.d.ts.map +1 -1
- package/dist/cmd/cloud/email/util.js +8 -23
- package/dist/cmd/cloud/email/util.js.map +1 -1
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +2 -0
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/queue/get.js +4 -4
- package/dist/cmd/cloud/queue/get.js.map +1 -1
- package/dist/cmd/cloud/queue/receive.d.ts.map +1 -1
- package/dist/cmd/cloud/queue/receive.js +11 -7
- package/dist/cmd/cloud/queue/receive.js.map +1 -1
- package/dist/cmd/cloud/queue/stats.js +3 -3
- package/dist/cmd/cloud/queue/stats.js.map +1 -1
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.js +71 -0
- package/dist/cmd/cloud/sandbox/checkpoint/create.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js +78 -0
- package/dist/cmd/cloud/sandbox/checkpoint/delete.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts +2 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.js +33 -0
- package/dist/cmd/cloud/sandbox/checkpoint/index.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.js +72 -0
- package/dist/cmd/cloud/sandbox/checkpoint/list.js.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js +61 -0
- package/dist/cmd/cloud/sandbox/checkpoint/restore.js.map +1 -0
- package/dist/cmd/cloud/sandbox/get.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/get.js +5 -3
- package/dist/cmd/cloud/sandbox/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/index.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/index.js +4 -0
- package/dist/cmd/cloud/sandbox/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/build.js +9 -9
- package/dist/cmd/cloud/sandbox/snapshot/build.js.map +1 -1
- package/dist/cmd/cloud/sandbox/snapshot/get.js +3 -3
- package/dist/cmd/cloud/sandbox/snapshot/get.js.map +1 -1
- package/dist/cmd/cloud/sandbox/stats.d.ts +3 -0
- package/dist/cmd/cloud/sandbox/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/sandbox/stats.js +72 -0
- package/dist/cmd/cloud/sandbox/stats.js.map +1 -0
- package/dist/cmd/cloud/schedule/create.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/create.js +3 -4
- package/dist/cmd/cloud/schedule/create.js.map +1 -1
- package/dist/cmd/cloud/schedule/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delete.js +2 -3
- package/dist/cmd/cloud/schedule/delete.js.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/get.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/get.js +3 -4
- package/dist/cmd/cloud/schedule/delivery/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/delivery/list.js +2 -3
- package/dist/cmd/cloud/schedule/delivery/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/create.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/create.js +7 -4
- package/dist/cmd/cloud/schedule/destination/create.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/delete.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/delete.js +2 -3
- package/dist/cmd/cloud/schedule/destination/delete.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/get.js +15 -13
- package/dist/cmd/cloud/schedule/destination/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/destination/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/destination/list.js +13 -9
- package/dist/cmd/cloud/schedule/destination/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/get.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/get.js +15 -11
- package/dist/cmd/cloud/schedule/get.js.map +1 -1
- package/dist/cmd/cloud/schedule/index.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/index.js +2 -0
- package/dist/cmd/cloud/schedule/index.js.map +1 -1
- package/dist/cmd/cloud/schedule/list.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/list.js +2 -3
- package/dist/cmd/cloud/schedule/list.js.map +1 -1
- package/dist/cmd/cloud/schedule/stats.d.ts +3 -0
- package/dist/cmd/cloud/schedule/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/schedule/stats.js +64 -0
- package/dist/cmd/cloud/schedule/stats.js.map +1 -0
- package/dist/cmd/cloud/schedule/update.js +5 -5
- package/dist/cmd/cloud/schedule/update.js.map +1 -1
- package/dist/cmd/cloud/schedule/util.d.ts +4 -5
- package/dist/cmd/cloud/schedule/util.d.ts.map +1 -1
- package/dist/cmd/cloud/schedule/util.js +6 -6
- package/dist/cmd/cloud/schedule/util.js.map +1 -1
- package/dist/cmd/cloud/services/index.d.ts +3 -0
- package/dist/cmd/cloud/services/index.d.ts.map +1 -0
- package/dist/cmd/cloud/services/index.js +10 -0
- package/dist/cmd/cloud/services/index.js.map +1 -0
- package/dist/cmd/cloud/services/stats.d.ts +3 -0
- package/dist/cmd/cloud/services/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/services/stats.js +153 -0
- package/dist/cmd/cloud/services/stats.js.map +1 -0
- package/dist/cmd/cloud/stream/index.d.ts.map +1 -1
- package/dist/cmd/cloud/stream/index.js +2 -1
- package/dist/cmd/cloud/stream/index.js.map +1 -1
- package/dist/cmd/cloud/stream/stats.d.ts +3 -0
- package/dist/cmd/cloud/stream/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/stream/stats.js +64 -0
- package/dist/cmd/cloud/stream/stats.js.map +1 -0
- package/dist/cmd/cloud/task/create.d.ts.map +1 -1
- package/dist/cmd/cloud/task/create.js +0 -1
- package/dist/cmd/cloud/task/create.js.map +1 -1
- package/dist/cmd/cloud/task/get.d.ts.map +1 -1
- package/dist/cmd/cloud/task/get.js +4 -3
- package/dist/cmd/cloud/task/get.js.map +1 -1
- package/dist/cmd/cloud/task/index.d.ts.map +1 -1
- package/dist/cmd/cloud/task/index.js +2 -1
- package/dist/cmd/cloud/task/index.js.map +1 -1
- package/dist/cmd/cloud/task/list.d.ts.map +1 -1
- package/dist/cmd/cloud/task/list.js +1 -2
- package/dist/cmd/cloud/task/list.js.map +1 -1
- package/dist/cmd/cloud/task/stats.d.ts +3 -0
- package/dist/cmd/cloud/task/stats.d.ts.map +1 -0
- package/dist/cmd/cloud/task/stats.js +66 -0
- package/dist/cmd/cloud/task/stats.js.map +1 -0
- package/dist/cmd/cloud/task/update.d.ts.map +1 -1
- package/dist/cmd/cloud/task/update.js +0 -1
- package/dist/cmd/cloud/task/update.js.map +1 -1
- package/dist/cmd/cloud/task/util.d.ts +4 -7
- package/dist/cmd/cloud/task/util.d.ts.map +1 -1
- package/dist/cmd/cloud/task/util.js +6 -10
- package/dist/cmd/cloud/task/util.js.map +1 -1
- package/dist/cmd/cloud/vector/get.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/get.js +17 -12
- package/dist/cmd/cloud/vector/get.js.map +1 -1
- package/dist/cmd/cloud/vector/stats.d.ts.map +1 -1
- package/dist/cmd/cloud/vector/stats.js +10 -7
- package/dist/cmd/cloud/vector/stats.js.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/deliveries.js +9 -3
- package/dist/cmd/cloud/webhook/deliveries.js.map +1 -1
- package/dist/cmd/cloud/webhook/destinations.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/destinations.js +20 -9
- package/dist/cmd/cloud/webhook/destinations.js.map +1 -1
- package/dist/cmd/cloud/webhook/get.js +2 -2
- package/dist/cmd/cloud/webhook/get.js.map +1 -1
- package/dist/cmd/cloud/webhook/receipts.d.ts.map +1 -1
- package/dist/cmd/cloud/webhook/receipts.js +19 -3
- package/dist/cmd/cloud/webhook/receipts.js.map +1 -1
- package/dist/tui.d.ts +4 -0
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +8 -0
- package/dist/tui.js.map +1 -1
- package/package.json +6 -6
- package/src/cmd/cloud/db/index.ts +2 -0
- package/src/cmd/cloud/db/stats.ts +80 -0
- package/src/cmd/cloud/email/create.ts +16 -6
- package/src/cmd/cloud/email/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/delete.ts +1 -1
- package/src/cmd/cloud/email/destination/list.ts +1 -1
- package/src/cmd/cloud/email/destination/url.ts +5 -4
- package/src/cmd/cloud/email/get.ts +1 -1
- package/src/cmd/cloud/email/inbound/get.ts +2 -3
- package/src/cmd/cloud/email/inbound/list.ts +1 -3
- package/src/cmd/cloud/email/inbound/schemas.ts +3 -1
- package/src/cmd/cloud/email/index.ts +2 -0
- package/src/cmd/cloud/email/list.ts +9 -2
- package/src/cmd/cloud/email/outbound/get.ts +4 -4
- package/src/cmd/cloud/email/outbound/list.ts +3 -3
- package/src/cmd/cloud/email/outbound/schemas.ts +2 -2
- package/src/cmd/cloud/email/send.ts +8 -10
- package/src/cmd/cloud/email/stats.ts +77 -0
- package/src/cmd/cloud/email/util.ts +10 -29
- package/src/cmd/cloud/index.ts +2 -0
- package/src/cmd/cloud/queue/get.ts +4 -4
- package/src/cmd/cloud/queue/receive.ts +15 -7
- package/src/cmd/cloud/queue/stats.ts +3 -3
- package/src/cmd/cloud/sandbox/checkpoint/create.ts +85 -0
- package/src/cmd/cloud/sandbox/checkpoint/delete.ts +93 -0
- package/src/cmd/cloud/sandbox/checkpoint/index.ts +33 -0
- package/src/cmd/cloud/sandbox/checkpoint/list.ts +83 -0
- package/src/cmd/cloud/sandbox/checkpoint/restore.ts +72 -0
- package/src/cmd/cloud/sandbox/get.ts +6 -3
- package/src/cmd/cloud/sandbox/index.ts +4 -0
- package/src/cmd/cloud/sandbox/snapshot/build.ts +9 -9
- package/src/cmd/cloud/sandbox/snapshot/get.ts +3 -3
- package/src/cmd/cloud/sandbox/stats.ts +86 -0
- package/src/cmd/cloud/schedule/create.ts +3 -4
- package/src/cmd/cloud/schedule/delete.ts +2 -3
- package/src/cmd/cloud/schedule/delivery/get.ts +3 -4
- package/src/cmd/cloud/schedule/delivery/list.ts +2 -3
- package/src/cmd/cloud/schedule/destination/create.ts +8 -4
- package/src/cmd/cloud/schedule/destination/delete.ts +2 -3
- package/src/cmd/cloud/schedule/destination/get.ts +17 -17
- package/src/cmd/cloud/schedule/destination/list.ts +15 -10
- package/src/cmd/cloud/schedule/get.ts +17 -12
- package/src/cmd/cloud/schedule/index.ts +2 -0
- package/src/cmd/cloud/schedule/list.ts +2 -3
- package/src/cmd/cloud/schedule/stats.ts +74 -0
- package/src/cmd/cloud/schedule/update.ts +5 -5
- package/src/cmd/cloud/schedule/util.ts +13 -18
- package/src/cmd/cloud/services/index.ts +11 -0
- package/src/cmd/cloud/services/stats.ts +225 -0
- package/src/cmd/cloud/stream/index.ts +2 -1
- package/src/cmd/cloud/stream/stats.ts +74 -0
- package/src/cmd/cloud/task/create.ts +0 -1
- package/src/cmd/cloud/task/get.ts +5 -4
- package/src/cmd/cloud/task/index.ts +2 -1
- package/src/cmd/cloud/task/list.ts +1 -2
- package/src/cmd/cloud/task/stats.ts +74 -0
- package/src/cmd/cloud/task/update.ts +0 -1
- package/src/cmd/cloud/task/util.ts +12 -24
- package/src/cmd/cloud/vector/get.ts +16 -11
- package/src/cmd/cloud/vector/stats.ts +10 -8
- package/src/cmd/cloud/webhook/deliveries.ts +16 -3
- package/src/cmd/cloud/webhook/destinations.ts +22 -9
- package/src/cmd/cloud/webhook/get.ts +2 -2
- package/src/cmd/cloud/webhook/receipts.ts +16 -3
- package/src/tui.ts +9 -0
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import { TaskStorageService, type Logger } from '@agentuity/core';
|
|
2
2
|
import { createServerFetchAdapter } from '@agentuity/server';
|
|
3
|
-
import type { AuthData, Config, GlobalOptions
|
|
3
|
+
import type { AuthData, Config, GlobalOptions } from '../../../types';
|
|
4
4
|
import { getCatalystUrl } from '../../../catalyst';
|
|
5
5
|
import { setResourceInfo } from '../../../cache';
|
|
6
6
|
import { defaultProfileName, getDefaultRegion } from '../../../config';
|
|
7
7
|
import * as tui from '../../../tui';
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
explicitOrgId?: string
|
|
19
|
-
) {
|
|
9
|
+
export interface TaskContext {
|
|
10
|
+
logger: Logger;
|
|
11
|
+
auth: AuthData;
|
|
12
|
+
config: Config | null;
|
|
13
|
+
options: GlobalOptions;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function createStorageAdapter(ctx: TaskContext) {
|
|
20
17
|
const orgId =
|
|
21
|
-
explicitOrgId ??
|
|
22
|
-
ctx.project?.orgId ??
|
|
23
18
|
ctx.options.orgId ??
|
|
24
19
|
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
25
20
|
if (!orgId) {
|
|
26
|
-
tui.fatal(
|
|
27
|
-
'Organization ID is required. Either run from a project directory or use --org-id flag.'
|
|
28
|
-
);
|
|
21
|
+
tui.fatal('Organization ID is required. Use --org-id flag or set AGENTUITY_CLOUD_ORG_ID.');
|
|
29
22
|
}
|
|
30
23
|
|
|
31
24
|
const adapter = createServerFetchAdapter(
|
|
@@ -39,26 +32,21 @@ export async function createStorageAdapter(
|
|
|
39
32
|
);
|
|
40
33
|
|
|
41
34
|
// Task tenant DB is not regional — any Catalyst can serve the request.
|
|
42
|
-
|
|
43
|
-
const region =
|
|
44
|
-
ctx.region ?? (await getDefaultRegion(ctx.config?.name ?? defaultProfileName, ctx.config));
|
|
35
|
+
const region = await getDefaultRegion(ctx.config?.name ?? defaultProfileName, ctx.config);
|
|
45
36
|
const baseUrl = getCatalystUrl(region);
|
|
46
37
|
return new TaskStorageService(baseUrl, adapter);
|
|
47
38
|
}
|
|
48
39
|
|
|
49
40
|
export async function cacheTaskId(
|
|
50
41
|
ctx: {
|
|
51
|
-
region?: string;
|
|
52
|
-
project?: ProjectConfig;
|
|
53
42
|
config: Config | null;
|
|
54
43
|
options: GlobalOptions;
|
|
55
44
|
},
|
|
56
45
|
taskId: string
|
|
57
46
|
) {
|
|
58
47
|
const profileName = ctx.config?.name ?? defaultProfileName;
|
|
59
|
-
const region =
|
|
48
|
+
const region = await getDefaultRegion(profileName, ctx.config);
|
|
60
49
|
const orgId =
|
|
61
|
-
ctx.project?.orgId ??
|
|
62
50
|
ctx.options.orgId ??
|
|
63
51
|
(process.env.AGENTUITY_CLOUD_ORG_ID || ctx.config?.preferences?.orgId);
|
|
64
52
|
await setResourceInfo('task', profileName, taskId, region, orgId);
|
|
@@ -58,31 +58,36 @@ export const getSubcommand = createCommand({
|
|
|
58
58
|
);
|
|
59
59
|
|
|
60
60
|
const data = result.data;
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
const details: Record<string, unknown> = {
|
|
62
|
+
ID: data.id,
|
|
63
|
+
Key: data.key,
|
|
64
|
+
};
|
|
63
65
|
|
|
64
66
|
if (data.similarity !== undefined) {
|
|
65
|
-
|
|
67
|
+
details.Similarity = `${(data.similarity * 100).toFixed(1)}%`;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
if (data.document) {
|
|
69
|
-
|
|
71
|
+
details.Document =
|
|
70
72
|
data.document.length > 200
|
|
71
73
|
? data.document.substring(0, 197) + '...'
|
|
72
74
|
: data.document;
|
|
73
|
-
tui.info(` Document: ${docPreview}`);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (data.metadata && Object.keys(data.metadata).length > 0) {
|
|
77
|
-
tui.info(` Metadata: ${JSON.stringify(data.metadata, null, 2)}`);
|
|
78
75
|
}
|
|
79
76
|
|
|
80
77
|
if (data.embeddings) {
|
|
81
|
-
|
|
78
|
+
details.Embeddings = `[${data.embeddings.length} dimensions]`;
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
if (data.expiresAt) {
|
|
85
|
-
|
|
82
|
+
details.Expires = new Date(data.expiresAt).toLocaleString();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
tui.table([details], undefined, { layout: 'vertical' });
|
|
86
|
+
|
|
87
|
+
if (data.metadata && Object.keys(data.metadata).length > 0) {
|
|
88
|
+
tui.newline();
|
|
89
|
+
tui.header('Metadata');
|
|
90
|
+
tui.json(data.metadata);
|
|
86
91
|
}
|
|
87
92
|
} else {
|
|
88
93
|
tui.warning(`Vector "${tui.bold(args.key)}" not found in ${tui.bold(args.namespace)}`);
|
|
@@ -85,24 +85,26 @@ export const statsSubcommand = createCommand({
|
|
|
85
85
|
if (stats.count === 0 && stats.sum === 0) {
|
|
86
86
|
tui.info(`Namespace ${tui.bold(args.name)} is empty or does not exist`);
|
|
87
87
|
} else {
|
|
88
|
-
tui.
|
|
89
|
-
tui.info(` Vectors: ${stats.count}`);
|
|
88
|
+
tui.header(`Statistics for ${tui.bold(args.name)}`);
|
|
90
89
|
const sizeDisplay =
|
|
91
90
|
stats.sum < 1024 * 1024
|
|
92
91
|
? `${stats.sum.toLocaleString()} bytes`
|
|
93
92
|
: `${(stats.sum / (1024 * 1024)).toFixed(2)} MB`;
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
const statsDetails: Record<string, unknown> = {
|
|
94
|
+
Vectors: stats.count,
|
|
95
|
+
'Total size': sizeDisplay,
|
|
96
|
+
};
|
|
96
97
|
if (stats.createdAt) {
|
|
97
|
-
|
|
98
|
+
statsDetails.Created = new Date(stats.createdAt).toLocaleString();
|
|
98
99
|
}
|
|
99
100
|
if (stats.lastUsed) {
|
|
100
|
-
|
|
101
|
+
statsDetails['Last used'] = new Date(stats.lastUsed).toLocaleString();
|
|
101
102
|
}
|
|
103
|
+
tui.table([statsDetails], undefined, { layout: 'vertical' });
|
|
102
104
|
|
|
103
105
|
if (stats.sampledResults && Object.keys(stats.sampledResults).length > 0) {
|
|
104
|
-
tui.
|
|
105
|
-
tui.
|
|
106
|
+
tui.newline();
|
|
107
|
+
tui.header(`Sample vectors (${Object.keys(stats.sampledResults).length})`);
|
|
106
108
|
|
|
107
109
|
const tableData = Object.entries(stats.sampledResults).map(([key, item]) => {
|
|
108
110
|
const docPreview = item.document
|
|
@@ -18,6 +18,7 @@ const DeliveriesListResponseSchema = z.object({
|
|
|
18
18
|
status: z.string(),
|
|
19
19
|
retries: z.number(),
|
|
20
20
|
webhook_destination_id: z.string(),
|
|
21
|
+
error: z.string().nullable().optional(),
|
|
21
22
|
})
|
|
22
23
|
),
|
|
23
24
|
});
|
|
@@ -73,8 +74,15 @@ const listDeliveriesSubcommand = createSubcommand({
|
|
|
73
74
|
Status: d.status,
|
|
74
75
|
Retries: d.retries,
|
|
75
76
|
'Destination ID': d.webhook_destination_id,
|
|
77
|
+
...(d.error != null ? { Error: d.error } : {}),
|
|
76
78
|
}));
|
|
77
|
-
|
|
79
|
+
const hasErrors = result.deliveries.some((d: WebhookDelivery) => d.error != null);
|
|
80
|
+
tui.table(
|
|
81
|
+
tableData,
|
|
82
|
+
hasErrors
|
|
83
|
+
? ['ID', 'Date', 'Status', 'Retries', 'Destination ID', 'Error']
|
|
84
|
+
: ['ID', 'Date', 'Status', 'Retries', 'Destination ID']
|
|
85
|
+
);
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
|
|
@@ -85,6 +93,7 @@ const listDeliveriesSubcommand = createSubcommand({
|
|
|
85
93
|
status: d.status,
|
|
86
94
|
retries: d.retries,
|
|
87
95
|
webhook_destination_id: d.webhook_destination_id,
|
|
96
|
+
...(d.error != null ? { error: d.error } : {}),
|
|
88
97
|
})),
|
|
89
98
|
};
|
|
90
99
|
},
|
|
@@ -120,8 +129,12 @@ const retryDeliverySubcommand = createSubcommand({
|
|
|
120
129
|
);
|
|
121
130
|
|
|
122
131
|
if (!options.json) {
|
|
123
|
-
tui.success(`Retried delivery: ${delivery.id}`);
|
|
124
|
-
|
|
132
|
+
tui.success(`Retried delivery: ${tui.bold(delivery.id)}`);
|
|
133
|
+
tui.table(
|
|
134
|
+
[{ ID: delivery.id, Status: delivery.status }],
|
|
135
|
+
['ID', 'Status'],
|
|
136
|
+
{ layout: 'vertical', padStart: ' ' }
|
|
137
|
+
);
|
|
125
138
|
}
|
|
126
139
|
|
|
127
140
|
return delivery;
|
|
@@ -57,13 +57,22 @@ const listDestinationsSubcommand = createSubcommand({
|
|
|
57
57
|
if (destinations.length === 0) {
|
|
58
58
|
tui.info('No destinations configured');
|
|
59
59
|
} else {
|
|
60
|
-
const tableData = destinations.map((d: WebhookDestination) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
const tableData = destinations.map((d: WebhookDestination) => {
|
|
61
|
+
const config =
|
|
62
|
+
d.type === 'url' &&
|
|
63
|
+
d.config &&
|
|
64
|
+
typeof d.config === 'object' &&
|
|
65
|
+
'url' in d.config
|
|
66
|
+
? String((d.config as Record<string, unknown>).url)
|
|
67
|
+
: JSON.stringify(d.config);
|
|
68
|
+
return {
|
|
69
|
+
ID: d.id,
|
|
70
|
+
Type: d.type,
|
|
71
|
+
URL: config,
|
|
72
|
+
Created: new Date(d.created_at).toLocaleString(),
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
tui.table(tableData, ['ID', 'Type', 'URL', 'Created']);
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
78
|
|
|
@@ -130,7 +139,7 @@ const createDestinationSubcommand = createCommand({
|
|
|
130
139
|
examples: [
|
|
131
140
|
{
|
|
132
141
|
command: getCommand(
|
|
133
|
-
'cloud webhook destinations create url wh_abc123
|
|
142
|
+
'cloud webhook destinations create url wh_abc123 https://example.com/webhook'
|
|
134
143
|
),
|
|
135
144
|
description: 'Create a URL destination',
|
|
136
145
|
},
|
|
@@ -182,7 +191,11 @@ const updateDestinationSubcommand = createSubcommand({
|
|
|
182
191
|
|
|
183
192
|
if (!options.json) {
|
|
184
193
|
tui.success(`Updated destination: ${destination.id}`);
|
|
185
|
-
|
|
194
|
+
const url =
|
|
195
|
+
destination.config && typeof destination.config === 'object' && 'url' in destination.config
|
|
196
|
+
? (destination.config as Record<string, unknown>).url
|
|
197
|
+
: JSON.stringify(destination.config);
|
|
198
|
+
console.log(` URL: ${url}`);
|
|
186
199
|
}
|
|
187
200
|
|
|
188
201
|
return destination;
|
|
@@ -46,8 +46,8 @@ export const getSubcommand = createCommand({
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
details['Created By'] = webhook.created_by;
|
|
49
|
-
details.Created = new Date(webhook.created_at).
|
|
50
|
-
details.Updated = new Date(webhook.updated_at).
|
|
49
|
+
details.Created = new Date(webhook.created_at).toLocaleString();
|
|
50
|
+
details.Updated = new Date(webhook.updated_at).toLocaleString();
|
|
51
51
|
|
|
52
52
|
tui.table([details], undefined, { layout: 'vertical' });
|
|
53
53
|
}
|
|
@@ -124,12 +124,25 @@ const getReceiptSubcommand = createSubcommand({
|
|
|
124
124
|
tui.table([details], undefined, { layout: 'vertical' });
|
|
125
125
|
|
|
126
126
|
tui.newline();
|
|
127
|
-
tui.
|
|
127
|
+
tui.header('Headers');
|
|
128
128
|
tui.json(receipt.headers);
|
|
129
129
|
|
|
130
130
|
tui.newline();
|
|
131
|
-
tui.
|
|
132
|
-
|
|
131
|
+
tui.header('Payload');
|
|
132
|
+
if (typeof receipt.payload === 'string') {
|
|
133
|
+
try {
|
|
134
|
+
const decoded = Buffer.from(receipt.payload, 'base64').toString('utf-8');
|
|
135
|
+
try {
|
|
136
|
+
tui.json(JSON.parse(decoded));
|
|
137
|
+
} catch {
|
|
138
|
+
console.log(decoded);
|
|
139
|
+
}
|
|
140
|
+
} catch {
|
|
141
|
+
tui.json(receipt.payload);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
tui.json(receipt.payload);
|
|
145
|
+
}
|
|
133
146
|
}
|
|
134
147
|
|
|
135
148
|
return receipt;
|
package/src/tui.ts
CHANGED
|
@@ -474,6 +474,15 @@ export function newline(): void {
|
|
|
474
474
|
process.stderr.write('\n');
|
|
475
475
|
}
|
|
476
476
|
|
|
477
|
+
/**
|
|
478
|
+
* Print a section header without any prefix icon
|
|
479
|
+
*/
|
|
480
|
+
export function header(message: string): void {
|
|
481
|
+
const color = getColor('bold');
|
|
482
|
+
const reset = getColor('reset');
|
|
483
|
+
process.stderr.write(`${color}${message}${reset}\n`);
|
|
484
|
+
}
|
|
485
|
+
|
|
477
486
|
/**
|
|
478
487
|
* Print plain text output without any prefix or icon
|
|
479
488
|
* Use for primary command output that shouldn't have semantic formatting
|