@solongate/proxy 0.83.58 → 0.83.60
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/api-client/client.d.ts +15 -1
- package/dist/api-client/fleet.d.ts +163 -0
- package/dist/api-client/index.d.ts +2 -0
- package/dist/commands/index.js +100 -3
- package/dist/index.js +1390 -599
- package/dist/tui/index.js +1357 -594
- package/dist/tui/panels/Fleet.d.ts +4 -0
- package/dist/tui/panels/FleetLive.d.ts +4 -0
- package/hooks/conversation.mjs +21 -15
- package/package.json +7 -7
|
@@ -58,11 +58,25 @@ export declare function isAuthenticated(): boolean;
|
|
|
58
58
|
*/
|
|
59
59
|
export declare function resolveCredentials(apiUrlOverride?: string): Credentials;
|
|
60
60
|
export interface RequestOptions {
|
|
61
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Query parameters. An ARRAY is sent as the same key repeated, not as a
|
|
63
|
+
* comma-joined value — the fleet filters (`group`, `who`) are repeated
|
|
64
|
+
* parameters on the API side, and a joined one reads as a single group whose
|
|
65
|
+
* name contains a comma.
|
|
66
|
+
*/
|
|
67
|
+
query?: Record<string, string | number | boolean | string[] | undefined>;
|
|
62
68
|
body?: unknown;
|
|
63
69
|
timeoutMs?: number;
|
|
64
70
|
/** Override api URL for this request (rarely needed). */
|
|
65
71
|
apiUrl?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Return the response body as TEXT rather than parsing it as JSON.
|
|
74
|
+
*
|
|
75
|
+
* For the routes that answer with a document — the report download is
|
|
76
|
+
* markdown or CSV. Without this the body parses to undefined and the caller
|
|
77
|
+
* gets an empty file with no error to explain it.
|
|
78
|
+
*/
|
|
79
|
+
raw?: boolean;
|
|
66
80
|
}
|
|
67
81
|
/**
|
|
68
82
|
* Typed request against the v1 API. Returns the parsed JSON body (as T) for 2xx
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export interface FleetMember {
|
|
2
|
+
id: string;
|
|
3
|
+
guest_user_id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
status: string;
|
|
6
|
+
group: string;
|
|
7
|
+
policy_id: string;
|
|
8
|
+
top_agent: string;
|
|
9
|
+
variant_id: string;
|
|
10
|
+
created_at: string;
|
|
11
|
+
accepted_at: string;
|
|
12
|
+
}
|
|
13
|
+
export interface FleetOverview {
|
|
14
|
+
host: boolean;
|
|
15
|
+
seats: number;
|
|
16
|
+
used: number;
|
|
17
|
+
host_group: string;
|
|
18
|
+
host_top_agent: string;
|
|
19
|
+
invitations: FleetMember[];
|
|
20
|
+
}
|
|
21
|
+
export interface FleetGroup {
|
|
22
|
+
name: string;
|
|
23
|
+
members: number;
|
|
24
|
+
color: string;
|
|
25
|
+
policy_id: string;
|
|
26
|
+
}
|
|
27
|
+
export interface FleetPerson {
|
|
28
|
+
guest_user_id: string;
|
|
29
|
+
email: string;
|
|
30
|
+
role: string;
|
|
31
|
+
group: string;
|
|
32
|
+
calls: number;
|
|
33
|
+
denied: number;
|
|
34
|
+
sessions: number;
|
|
35
|
+
last_at: string;
|
|
36
|
+
}
|
|
37
|
+
export interface FleetCount {
|
|
38
|
+
name: string;
|
|
39
|
+
calls: number;
|
|
40
|
+
denied: number;
|
|
41
|
+
}
|
|
42
|
+
export interface FleetSummary {
|
|
43
|
+
developers: number;
|
|
44
|
+
totals: {
|
|
45
|
+
calls: number;
|
|
46
|
+
allowed: number;
|
|
47
|
+
denied: number;
|
|
48
|
+
sessions: number;
|
|
49
|
+
};
|
|
50
|
+
agents: FleetCount[];
|
|
51
|
+
tools: FleetCount[];
|
|
52
|
+
by_hour: number[];
|
|
53
|
+
people: FleetPerson[];
|
|
54
|
+
groups: FleetGroup[];
|
|
55
|
+
range: string;
|
|
56
|
+
}
|
|
57
|
+
export interface FleetReport {
|
|
58
|
+
span: string;
|
|
59
|
+
title: string;
|
|
60
|
+
headline: string;
|
|
61
|
+
from: number;
|
|
62
|
+
to: number;
|
|
63
|
+
totals: {
|
|
64
|
+
calls: number;
|
|
65
|
+
allowed: number;
|
|
66
|
+
denied: number;
|
|
67
|
+
sessions: number;
|
|
68
|
+
agents: number;
|
|
69
|
+
tools: number;
|
|
70
|
+
prev_calls: number;
|
|
71
|
+
prev_denied: number;
|
|
72
|
+
};
|
|
73
|
+
top_denies: FleetCount[];
|
|
74
|
+
top_tools: FleetCount[];
|
|
75
|
+
top_agents: FleetCount[];
|
|
76
|
+
people: Array<{
|
|
77
|
+
user_id: string;
|
|
78
|
+
label: string;
|
|
79
|
+
calls: number;
|
|
80
|
+
denied: number;
|
|
81
|
+
sessions: number;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
export interface ReportSchedule {
|
|
85
|
+
endMinute: number;
|
|
86
|
+
day: boolean;
|
|
87
|
+
week: boolean;
|
|
88
|
+
month: boolean;
|
|
89
|
+
weekday: number;
|
|
90
|
+
emails: string[];
|
|
91
|
+
telegram: string[];
|
|
92
|
+
}
|
|
93
|
+
/** Who is on the fleet, and every invitation's state. */
|
|
94
|
+
export declare function overview(): Promise<FleetOverview>;
|
|
95
|
+
/** Everybody's numbers at once. `range` is the same vocabulary the card uses. */
|
|
96
|
+
export declare function summary(opts?: {
|
|
97
|
+
range?: string;
|
|
98
|
+
group?: string[];
|
|
99
|
+
who?: string[];
|
|
100
|
+
agent?: string;
|
|
101
|
+
}): Promise<FleetSummary>;
|
|
102
|
+
/** The groups themselves, including the empty ones. */
|
|
103
|
+
export declare function groups(): Promise<{
|
|
104
|
+
groups: FleetGroup[];
|
|
105
|
+
}>;
|
|
106
|
+
export declare function createGroup(name: string, color?: string): Promise<unknown>;
|
|
107
|
+
export declare function renameGroup(name: string, newName: string): Promise<unknown>;
|
|
108
|
+
export declare function setGroupColor(name: string, color: string): Promise<unknown>;
|
|
109
|
+
export declare function deleteGroup(name: string): Promise<unknown>;
|
|
110
|
+
/**
|
|
111
|
+
* Which policy a whole group runs.
|
|
112
|
+
*
|
|
113
|
+
* This is what a fleet is for; everything else about a group is filing. An
|
|
114
|
+
* empty id means the group names none and its members fall back to the
|
|
115
|
+
* project's own choice.
|
|
116
|
+
*/
|
|
117
|
+
export declare function setGroupPolicy(name: string, policyId: string): Promise<unknown>;
|
|
118
|
+
/** The per-person exception to a group's policy. Empty clears it. */
|
|
119
|
+
export declare function setUserPolicy(ids: string[], policyId: string): Promise<unknown>;
|
|
120
|
+
/** File people under a label. An empty group unfiles them. */
|
|
121
|
+
export declare function assignGroup(ids: string[], group: string): Promise<unknown>;
|
|
122
|
+
export declare function invite(email: string): Promise<unknown>;
|
|
123
|
+
export declare function revoke(id: string): Promise<unknown>;
|
|
124
|
+
/** One person, in full. `guest` is an account id, or "self" for the host. */
|
|
125
|
+
export declare function analytics(guest: string): Promise<Record<string, unknown>>;
|
|
126
|
+
/** One person's recent calls. */
|
|
127
|
+
export declare function activity(guest: string, limit?: number): Promise<Record<string, unknown>>;
|
|
128
|
+
/** A span of the fleet's history, summarised. */
|
|
129
|
+
export declare function report(span?: 'day' | 'week' | 'month'): Promise<FleetReport>;
|
|
130
|
+
/** The same report, as the file the dashboard offers. */
|
|
131
|
+
export declare function reportDownload(span: 'day' | 'week' | 'month', format?: 'md' | 'csv'): Promise<string>;
|
|
132
|
+
export declare function sendReport(span?: 'day' | 'week' | 'month'): Promise<{
|
|
133
|
+
emails: number;
|
|
134
|
+
telegram: number;
|
|
135
|
+
}>;
|
|
136
|
+
export declare function reportSchedule(): Promise<{
|
|
137
|
+
schedule: ReportSchedule;
|
|
138
|
+
next: number;
|
|
139
|
+
}>;
|
|
140
|
+
export declare function setReportSchedule(schedule: Partial<ReportSchedule>): Promise<{
|
|
141
|
+
schedule: ReportSchedule;
|
|
142
|
+
next: number;
|
|
143
|
+
}>;
|
|
144
|
+
export interface FleetStreamRow {
|
|
145
|
+
id: string;
|
|
146
|
+
user_id: string;
|
|
147
|
+
who: string;
|
|
148
|
+
session_id: string;
|
|
149
|
+
tool: string;
|
|
150
|
+
agent: string;
|
|
151
|
+
decision: string;
|
|
152
|
+
reason: string;
|
|
153
|
+
created_at: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The fleet's calls as they land, with the person on each one.
|
|
157
|
+
*
|
|
158
|
+
* Separate from activity() because that one is about a person and this is about
|
|
159
|
+
* a moment. Same table, opposite question.
|
|
160
|
+
*/
|
|
161
|
+
export declare function stream(limit?: number): Promise<{
|
|
162
|
+
calls: FleetStreamRow[];
|
|
163
|
+
}>;
|
|
@@ -13,6 +13,7 @@ import * as audit from './audit.js';
|
|
|
13
13
|
import * as agents from './agents.js';
|
|
14
14
|
import * as keys from './keys.js';
|
|
15
15
|
import * as mcp from './mcp.js';
|
|
16
|
+
import * as fleet from './fleet.js';
|
|
16
17
|
export declare const api: {
|
|
17
18
|
auth: typeof auth;
|
|
18
19
|
policies: typeof policies;
|
|
@@ -22,4 +23,5 @@ export declare const api: {
|
|
|
22
23
|
agents: typeof agents;
|
|
23
24
|
keys: typeof keys;
|
|
24
25
|
mcp: typeof mcp;
|
|
26
|
+
fleet: typeof fleet;
|
|
25
27
|
};
|
package/dist/commands/index.js
CHANGED
|
@@ -152,8 +152,8 @@ function readCodexHooksFile(path) {
|
|
|
152
152
|
continue;
|
|
153
153
|
}
|
|
154
154
|
if (k === "hooks" && v && typeof v === "object") {
|
|
155
|
-
for (const [ev,
|
|
156
|
-
if (Array.isArray(
|
|
155
|
+
for (const [ev, groups2] of Object.entries(v)) {
|
|
156
|
+
if (Array.isArray(groups2)) out2.hooks[ev] = groups2;
|
|
157
157
|
}
|
|
158
158
|
continue;
|
|
159
159
|
}
|
|
@@ -299,6 +299,10 @@ function buildUrl(base, path, query) {
|
|
|
299
299
|
if (query) {
|
|
300
300
|
for (const [k, v] of Object.entries(query)) {
|
|
301
301
|
if (v === void 0) continue;
|
|
302
|
+
if (Array.isArray(v)) {
|
|
303
|
+
for (const one of v) url.searchParams.append(k, one);
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
302
306
|
url.searchParams.set(k, String(v));
|
|
303
307
|
}
|
|
304
308
|
}
|
|
@@ -358,6 +362,7 @@ async function request(method, path, opts = {}) {
|
|
|
358
362
|
if (res.status >= 500) throw new ApiError(res.status, "SERVER_ERROR", text || "SolonGate API had a problem (server error). Please try again in a moment.");
|
|
359
363
|
throw new ApiError(res.status, "ERROR", text || res.statusText || `HTTP ${res.status}`);
|
|
360
364
|
}
|
|
365
|
+
if (opts.raw) return text;
|
|
361
366
|
return json;
|
|
362
367
|
}
|
|
363
368
|
|
|
@@ -598,8 +603,100 @@ function list4() {
|
|
|
598
603
|
return request("GET", "/mcp-servers");
|
|
599
604
|
}
|
|
600
605
|
|
|
606
|
+
// src/api-client/fleet.ts
|
|
607
|
+
var fleet_exports = {};
|
|
608
|
+
__export(fleet_exports, {
|
|
609
|
+
activity: () => activity,
|
|
610
|
+
analytics: () => analytics,
|
|
611
|
+
assignGroup: () => assignGroup,
|
|
612
|
+
createGroup: () => createGroup,
|
|
613
|
+
deleteGroup: () => deleteGroup,
|
|
614
|
+
groups: () => groups,
|
|
615
|
+
invite: () => invite,
|
|
616
|
+
overview: () => overview,
|
|
617
|
+
renameGroup: () => renameGroup,
|
|
618
|
+
report: () => report,
|
|
619
|
+
reportDownload: () => reportDownload,
|
|
620
|
+
reportSchedule: () => reportSchedule,
|
|
621
|
+
revoke: () => revoke2,
|
|
622
|
+
sendReport: () => sendReport,
|
|
623
|
+
setGroupColor: () => setGroupColor,
|
|
624
|
+
setGroupPolicy: () => setGroupPolicy,
|
|
625
|
+
setReportSchedule: () => setReportSchedule,
|
|
626
|
+
setUserPolicy: () => setUserPolicy,
|
|
627
|
+
stream: () => stream,
|
|
628
|
+
summary: () => summary
|
|
629
|
+
});
|
|
630
|
+
function overview() {
|
|
631
|
+
return request("GET", "/fleet");
|
|
632
|
+
}
|
|
633
|
+
function summary(opts = {}) {
|
|
634
|
+
const query = {};
|
|
635
|
+
if (opts.range) query.range = opts.range;
|
|
636
|
+
if (opts.group?.length) query.group = opts.group;
|
|
637
|
+
if (opts.who?.length) query.who = opts.who;
|
|
638
|
+
if (opts.agent) query.agent = opts.agent;
|
|
639
|
+
return request("GET", "/fleet/summary", { query });
|
|
640
|
+
}
|
|
641
|
+
function groups() {
|
|
642
|
+
return request("GET", "/fleet/groups");
|
|
643
|
+
}
|
|
644
|
+
function createGroup(name, color) {
|
|
645
|
+
return request("POST", "/fleet/groups", { body: { name, color } });
|
|
646
|
+
}
|
|
647
|
+
function renameGroup(name, newName) {
|
|
648
|
+
return request("POST", "/fleet/groups/rename", { body: { name, new_name: newName } });
|
|
649
|
+
}
|
|
650
|
+
function setGroupColor(name, color) {
|
|
651
|
+
return request("POST", "/fleet/groups/color", { body: { name, color } });
|
|
652
|
+
}
|
|
653
|
+
function deleteGroup(name) {
|
|
654
|
+
return request("POST", "/fleet/groups/delete", { body: { name } });
|
|
655
|
+
}
|
|
656
|
+
function setGroupPolicy(name, policyId) {
|
|
657
|
+
return request("POST", "/fleet/groups/policy", { body: { name, policy_id: policyId } });
|
|
658
|
+
}
|
|
659
|
+
function setUserPolicy(ids, policyId) {
|
|
660
|
+
return request("POST", "/fleet/policy", { body: { ids, policy_id: policyId } });
|
|
661
|
+
}
|
|
662
|
+
function assignGroup(ids, group) {
|
|
663
|
+
return request("POST", "/fleet/group", { body: { ids, group } });
|
|
664
|
+
}
|
|
665
|
+
function invite(email) {
|
|
666
|
+
return request("POST", "/fleet/invitations", { body: { email } });
|
|
667
|
+
}
|
|
668
|
+
function revoke2(id) {
|
|
669
|
+
return request("DELETE", `/fleet/invitations/${encodeURIComponent(id)}`);
|
|
670
|
+
}
|
|
671
|
+
function analytics(guest) {
|
|
672
|
+
return request("GET", "/fleet/analytics", { query: { guest } });
|
|
673
|
+
}
|
|
674
|
+
function activity(guest, limit) {
|
|
675
|
+
const query = { guest };
|
|
676
|
+
if (limit) query.limit = limit;
|
|
677
|
+
return request("GET", "/fleet/activity", { query });
|
|
678
|
+
}
|
|
679
|
+
function report(span = "day") {
|
|
680
|
+
return request("GET", "/fleet/report", { query: { span } });
|
|
681
|
+
}
|
|
682
|
+
function reportDownload(span, format = "md") {
|
|
683
|
+
return request("GET", "/fleet/report/download", { query: { span, format }, raw: true });
|
|
684
|
+
}
|
|
685
|
+
function sendReport(span = "day") {
|
|
686
|
+
return request("POST", "/fleet/report/send", { query: { span }, body: {} });
|
|
687
|
+
}
|
|
688
|
+
function reportSchedule() {
|
|
689
|
+
return request("GET", "/settings/reports");
|
|
690
|
+
}
|
|
691
|
+
function setReportSchedule(schedule) {
|
|
692
|
+
return request("PUT", "/settings/reports", { body: schedule });
|
|
693
|
+
}
|
|
694
|
+
function stream(limit = 60) {
|
|
695
|
+
return request("GET", "/fleet/stream", { query: { limit } });
|
|
696
|
+
}
|
|
697
|
+
|
|
601
698
|
// src/api-client/index.ts
|
|
602
|
-
var api = { auth: auth_exports, policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports };
|
|
699
|
+
var api = { auth: auth_exports, policies: policies_exports, settings: settings_exports, stats: stats_exports, audit: audit_exports, agents: agents_exports, keys: keys_exports, mcp: mcp_exports, fleet: fleet_exports };
|
|
603
700
|
|
|
604
701
|
// src/cli-utils.ts
|
|
605
702
|
var c = {
|