@klex/agent-admin-api 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/index.d.ts +249 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,4 +66,40 @@ The Admin API contract includes the dedicated God Messages session:
|
|
|
66
66
|
- `GET /v1/god-messages/messages` returns cursor-paginated session history.
|
|
67
67
|
- `POST /v1/god-messages/reset` replaces a resettable session.
|
|
68
68
|
|
|
69
|
+
## Session history
|
|
70
|
+
|
|
71
|
+
The agent persists the transcript of every chat session instance (default,
|
|
72
|
+
god, and child) to local storage. These routes expose it read-only:
|
|
73
|
+
|
|
74
|
+
- `GET /v1/sessions` lists instances, newest first. Filter with `kind`
|
|
75
|
+
(`default`, `god`, `child`), `live`, and `parentInstanceId`; page with
|
|
76
|
+
`limit` and the opaque `cursor` returned as `nextCursor`. To find the
|
|
77
|
+
current main session, call `GET /v1/sessions?kind=default&live=true&limit=1`.
|
|
78
|
+
A session is persisted only after its first message, so this list can be
|
|
79
|
+
empty right after a restart.
|
|
80
|
+
- `GET /v1/sessions/{instanceId}` returns one instance's metadata, including
|
|
81
|
+
`live`, `endReason`, `messageCount`, and `trimmedMessageCount`.
|
|
82
|
+
- `GET /v1/sessions/{instanceId}/messages` returns messages in chronological
|
|
83
|
+
order. Without a cursor it returns the newest `limit` messages. Pass the
|
|
84
|
+
numeric `nextCursor` as `cursor` to load the previous, older page.
|
|
85
|
+
|
|
86
|
+
Messages use the stored AI SDK `UIMessage` shape: `tool-${name}` parts carry
|
|
87
|
+
full `input`, `output`, and `errorText`, and `data-${name}` parts carry their
|
|
88
|
+
`data`. Unlike God Messages history, nothing is truncated. Provider metadata
|
|
89
|
+
(`providerMetadata`, `callProviderMetadata`, `resultProviderMetadata`, such
|
|
90
|
+
as encrypted reasoning) is omitted unless `includeProviderMetadata=true`.
|
|
91
|
+
|
|
92
|
+
Each `ChatSession` gets its own `instanceId`. The default session reuses
|
|
93
|
+
`sessionId = "default"` across replacements, so query by `instanceId`. The
|
|
94
|
+
local store has a size cap. When the cap is reached, the oldest ended sessions
|
|
95
|
+
are deleted first. After that, the oldest messages of live sessions are
|
|
96
|
+
trimmed, and `trimmedMessageCount` reports how many were removed. Inline
|
|
97
|
+
data is redacted everywhere, including inside tool outputs: the payload of
|
|
98
|
+
every `data:` URL in any encoding, also inside longer strings, the `data`
|
|
99
|
+
field of image, audio, and media blocks, and embedded resource `blob`s.
|
|
100
|
+
Objects nested deeper than 64 levels are replaced by a placeholder.
|
|
101
|
+
|
|
102
|
+
Unknown instances return `404` with code `session_not_found`. Malformed list
|
|
103
|
+
cursors return `400` with code `invalid_cursor`.
|
|
104
|
+
|
|
69
105
|
Install `hono` and `@hono/zod-openapi` as peer dependencies.
|
package/dist/index.d.ts
CHANGED
|
@@ -512,15 +512,6 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
512
512
|
} & {
|
|
513
513
|
"/v1/introspect": {
|
|
514
514
|
$get: {
|
|
515
|
-
output: {
|
|
516
|
-
error: string;
|
|
517
|
-
code: string;
|
|
518
|
-
remediation?: string | undefined;
|
|
519
|
-
};
|
|
520
|
-
outputFormat: "json";
|
|
521
|
-
status: 500;
|
|
522
|
-
input: {};
|
|
523
|
-
} | {
|
|
524
515
|
output: {
|
|
525
516
|
path: string[];
|
|
526
517
|
state: {
|
|
@@ -535,6 +526,15 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
535
526
|
outputFormat: "json";
|
|
536
527
|
status: 200;
|
|
537
528
|
input: {};
|
|
529
|
+
} | {
|
|
530
|
+
output: {
|
|
531
|
+
error: string;
|
|
532
|
+
code: string;
|
|
533
|
+
remediation?: string | undefined;
|
|
534
|
+
};
|
|
535
|
+
outputFormat: "json";
|
|
536
|
+
status: 500;
|
|
537
|
+
input: {};
|
|
538
538
|
};
|
|
539
539
|
};
|
|
540
540
|
} & {
|
|
@@ -1167,10 +1167,12 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
1167
1167
|
"/v1/god-messages": {
|
|
1168
1168
|
$post: {
|
|
1169
1169
|
output: {
|
|
1170
|
-
|
|
1170
|
+
error: string;
|
|
1171
|
+
code: string;
|
|
1172
|
+
remediation?: string | undefined;
|
|
1171
1173
|
};
|
|
1172
1174
|
outputFormat: "json";
|
|
1173
|
-
status:
|
|
1175
|
+
status: 400;
|
|
1174
1176
|
input: {
|
|
1175
1177
|
json: {
|
|
1176
1178
|
content: ({
|
|
@@ -1210,7 +1212,7 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
1210
1212
|
remediation?: string | undefined;
|
|
1211
1213
|
};
|
|
1212
1214
|
outputFormat: "json";
|
|
1213
|
-
status:
|
|
1215
|
+
status: 409;
|
|
1214
1216
|
input: {
|
|
1215
1217
|
json: {
|
|
1216
1218
|
content: ({
|
|
@@ -1250,7 +1252,7 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
1250
1252
|
remediation?: string | undefined;
|
|
1251
1253
|
};
|
|
1252
1254
|
outputFormat: "json";
|
|
1253
|
-
status:
|
|
1255
|
+
status: 500;
|
|
1254
1256
|
input: {
|
|
1255
1257
|
json: {
|
|
1256
1258
|
content: ({
|
|
@@ -1290,7 +1292,7 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
1290
1292
|
remediation?: string | undefined;
|
|
1291
1293
|
};
|
|
1292
1294
|
outputFormat: "json";
|
|
1293
|
-
status:
|
|
1295
|
+
status: 503;
|
|
1294
1296
|
input: {
|
|
1295
1297
|
json: {
|
|
1296
1298
|
content: ({
|
|
@@ -1325,12 +1327,10 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
1325
1327
|
};
|
|
1326
1328
|
} | {
|
|
1327
1329
|
output: {
|
|
1328
|
-
|
|
1329
|
-
code: string;
|
|
1330
|
-
remediation?: string | undefined;
|
|
1330
|
+
sessionId: string;
|
|
1331
1331
|
};
|
|
1332
1332
|
outputFormat: "json";
|
|
1333
|
-
status:
|
|
1333
|
+
status: 202;
|
|
1334
1334
|
input: {
|
|
1335
1335
|
json: {
|
|
1336
1336
|
content: ({
|
|
@@ -1523,6 +1523,221 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
1523
1523
|
input: {};
|
|
1524
1524
|
};
|
|
1525
1525
|
};
|
|
1526
|
+
} & {
|
|
1527
|
+
"/v1/sessions": {
|
|
1528
|
+
$get: {
|
|
1529
|
+
output: {
|
|
1530
|
+
error: string;
|
|
1531
|
+
code: string;
|
|
1532
|
+
remediation?: string | undefined;
|
|
1533
|
+
};
|
|
1534
|
+
outputFormat: "json";
|
|
1535
|
+
status: 400;
|
|
1536
|
+
input: {
|
|
1537
|
+
query: {
|
|
1538
|
+
kind?: "child" | "default" | "god" | undefined;
|
|
1539
|
+
parentInstanceId?: string | undefined;
|
|
1540
|
+
live?: "false" | "true" | undefined;
|
|
1541
|
+
limit?: unknown;
|
|
1542
|
+
cursor?: string | undefined;
|
|
1543
|
+
};
|
|
1544
|
+
};
|
|
1545
|
+
} | {
|
|
1546
|
+
output: {
|
|
1547
|
+
error: string;
|
|
1548
|
+
code: string;
|
|
1549
|
+
remediation?: string | undefined;
|
|
1550
|
+
};
|
|
1551
|
+
outputFormat: "json";
|
|
1552
|
+
status: 500;
|
|
1553
|
+
input: {
|
|
1554
|
+
query: {
|
|
1555
|
+
kind?: "child" | "default" | "god" | undefined;
|
|
1556
|
+
parentInstanceId?: string | undefined;
|
|
1557
|
+
live?: "false" | "true" | undefined;
|
|
1558
|
+
limit?: unknown;
|
|
1559
|
+
cursor?: string | undefined;
|
|
1560
|
+
};
|
|
1561
|
+
};
|
|
1562
|
+
} | {
|
|
1563
|
+
output: {
|
|
1564
|
+
sessions: {
|
|
1565
|
+
instanceId: string;
|
|
1566
|
+
sessionId: string;
|
|
1567
|
+
kind: "child" | "default" | "god";
|
|
1568
|
+
name: string;
|
|
1569
|
+
parentInstanceId: string | null;
|
|
1570
|
+
extensionIdentifier: string | null;
|
|
1571
|
+
createdAt: string;
|
|
1572
|
+
updatedAt: string;
|
|
1573
|
+
endedAt: string | null;
|
|
1574
|
+
endReason: string | null;
|
|
1575
|
+
live: boolean;
|
|
1576
|
+
messageCount: number;
|
|
1577
|
+
trimmedMessageCount: number;
|
|
1578
|
+
byteSize: number;
|
|
1579
|
+
}[];
|
|
1580
|
+
nextCursor: string | null;
|
|
1581
|
+
hasMore: boolean;
|
|
1582
|
+
};
|
|
1583
|
+
outputFormat: "json";
|
|
1584
|
+
status: 200;
|
|
1585
|
+
input: {
|
|
1586
|
+
query: {
|
|
1587
|
+
kind?: "child" | "default" | "god" | undefined;
|
|
1588
|
+
parentInstanceId?: string | undefined;
|
|
1589
|
+
live?: "false" | "true" | undefined;
|
|
1590
|
+
limit?: unknown;
|
|
1591
|
+
cursor?: string | undefined;
|
|
1592
|
+
};
|
|
1593
|
+
};
|
|
1594
|
+
};
|
|
1595
|
+
};
|
|
1596
|
+
} & {
|
|
1597
|
+
"/v1/sessions/:instanceId": {
|
|
1598
|
+
$get: {
|
|
1599
|
+
output: {
|
|
1600
|
+
error: string;
|
|
1601
|
+
code: string;
|
|
1602
|
+
remediation?: string | undefined;
|
|
1603
|
+
};
|
|
1604
|
+
outputFormat: "json";
|
|
1605
|
+
status: 404;
|
|
1606
|
+
input: {
|
|
1607
|
+
param: {
|
|
1608
|
+
instanceId: string;
|
|
1609
|
+
};
|
|
1610
|
+
};
|
|
1611
|
+
} | {
|
|
1612
|
+
output: {
|
|
1613
|
+
error: string;
|
|
1614
|
+
code: string;
|
|
1615
|
+
remediation?: string | undefined;
|
|
1616
|
+
};
|
|
1617
|
+
outputFormat: "json";
|
|
1618
|
+
status: 500;
|
|
1619
|
+
input: {
|
|
1620
|
+
param: {
|
|
1621
|
+
instanceId: string;
|
|
1622
|
+
};
|
|
1623
|
+
};
|
|
1624
|
+
} | {
|
|
1625
|
+
output: {
|
|
1626
|
+
instanceId: string;
|
|
1627
|
+
sessionId: string;
|
|
1628
|
+
kind: "child" | "default" | "god";
|
|
1629
|
+
name: string;
|
|
1630
|
+
parentInstanceId: string | null;
|
|
1631
|
+
extensionIdentifier: string | null;
|
|
1632
|
+
createdAt: string;
|
|
1633
|
+
updatedAt: string;
|
|
1634
|
+
endedAt: string | null;
|
|
1635
|
+
endReason: string | null;
|
|
1636
|
+
live: boolean;
|
|
1637
|
+
messageCount: number;
|
|
1638
|
+
trimmedMessageCount: number;
|
|
1639
|
+
byteSize: number;
|
|
1640
|
+
};
|
|
1641
|
+
outputFormat: "json";
|
|
1642
|
+
status: 200;
|
|
1643
|
+
input: {
|
|
1644
|
+
param: {
|
|
1645
|
+
instanceId: string;
|
|
1646
|
+
};
|
|
1647
|
+
};
|
|
1648
|
+
};
|
|
1649
|
+
};
|
|
1650
|
+
} & {
|
|
1651
|
+
"/v1/sessions/:instanceId/messages": {
|
|
1652
|
+
$get: {
|
|
1653
|
+
output: {
|
|
1654
|
+
error: string;
|
|
1655
|
+
code: string;
|
|
1656
|
+
remediation?: string | undefined;
|
|
1657
|
+
};
|
|
1658
|
+
outputFormat: "json";
|
|
1659
|
+
status: 400;
|
|
1660
|
+
input: {
|
|
1661
|
+
param: {
|
|
1662
|
+
instanceId: string;
|
|
1663
|
+
};
|
|
1664
|
+
} & {
|
|
1665
|
+
query: {
|
|
1666
|
+
limit?: unknown;
|
|
1667
|
+
cursor?: unknown;
|
|
1668
|
+
includeProviderMetadata?: "false" | "true" | undefined;
|
|
1669
|
+
};
|
|
1670
|
+
};
|
|
1671
|
+
} | {
|
|
1672
|
+
output: {
|
|
1673
|
+
error: string;
|
|
1674
|
+
code: string;
|
|
1675
|
+
remediation?: string | undefined;
|
|
1676
|
+
};
|
|
1677
|
+
outputFormat: "json";
|
|
1678
|
+
status: 404;
|
|
1679
|
+
input: {
|
|
1680
|
+
param: {
|
|
1681
|
+
instanceId: string;
|
|
1682
|
+
};
|
|
1683
|
+
} & {
|
|
1684
|
+
query: {
|
|
1685
|
+
limit?: unknown;
|
|
1686
|
+
cursor?: unknown;
|
|
1687
|
+
includeProviderMetadata?: "false" | "true" | undefined;
|
|
1688
|
+
};
|
|
1689
|
+
};
|
|
1690
|
+
} | {
|
|
1691
|
+
output: {
|
|
1692
|
+
error: string;
|
|
1693
|
+
code: string;
|
|
1694
|
+
remediation?: string | undefined;
|
|
1695
|
+
};
|
|
1696
|
+
outputFormat: "json";
|
|
1697
|
+
status: 500;
|
|
1698
|
+
input: {
|
|
1699
|
+
param: {
|
|
1700
|
+
instanceId: string;
|
|
1701
|
+
};
|
|
1702
|
+
} & {
|
|
1703
|
+
query: {
|
|
1704
|
+
limit?: unknown;
|
|
1705
|
+
cursor?: unknown;
|
|
1706
|
+
includeProviderMetadata?: "false" | "true" | undefined;
|
|
1707
|
+
};
|
|
1708
|
+
};
|
|
1709
|
+
} | {
|
|
1710
|
+
output: {
|
|
1711
|
+
messages: {
|
|
1712
|
+
id: string;
|
|
1713
|
+
role: "assistant" | "system" | "user";
|
|
1714
|
+
metadata?: import("hono/utils/types").JSONValue | undefined;
|
|
1715
|
+
parts: {
|
|
1716
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
1717
|
+
type: string;
|
|
1718
|
+
}[];
|
|
1719
|
+
seq: number;
|
|
1720
|
+
persistedAt: string;
|
|
1721
|
+
}[];
|
|
1722
|
+
nextCursor: number | null;
|
|
1723
|
+
hasMore: boolean;
|
|
1724
|
+
trimmedMessageCount: number;
|
|
1725
|
+
};
|
|
1726
|
+
outputFormat: "json";
|
|
1727
|
+
status: 200;
|
|
1728
|
+
input: {
|
|
1729
|
+
param: {
|
|
1730
|
+
instanceId: string;
|
|
1731
|
+
};
|
|
1732
|
+
} & {
|
|
1733
|
+
query: {
|
|
1734
|
+
limit?: unknown;
|
|
1735
|
+
cursor?: unknown;
|
|
1736
|
+
includeProviderMetadata?: "false" | "true" | undefined;
|
|
1737
|
+
};
|
|
1738
|
+
};
|
|
1739
|
+
};
|
|
1740
|
+
};
|
|
1526
1741
|
} & {
|
|
1527
1742
|
"/v1/usage": {
|
|
1528
1743
|
$get: {
|
|
@@ -2786,12 +3001,18 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
2786
3001
|
"/v1/introspect/:path": {
|
|
2787
3002
|
$get: {
|
|
2788
3003
|
output: {
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
3004
|
+
path: string[];
|
|
3005
|
+
state: {
|
|
3006
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
3007
|
+
} | null;
|
|
3008
|
+
children: {
|
|
3009
|
+
id: string;
|
|
3010
|
+
hasState: boolean;
|
|
3011
|
+
hasChildren: boolean;
|
|
3012
|
+
}[];
|
|
2792
3013
|
};
|
|
2793
3014
|
outputFormat: "json";
|
|
2794
|
-
status:
|
|
3015
|
+
status: 200;
|
|
2795
3016
|
input: {
|
|
2796
3017
|
param: {
|
|
2797
3018
|
path: string;
|
|
@@ -2804,7 +3025,7 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
2804
3025
|
remediation?: string | undefined;
|
|
2805
3026
|
};
|
|
2806
3027
|
outputFormat: "json";
|
|
2807
|
-
status:
|
|
3028
|
+
status: 400;
|
|
2808
3029
|
input: {
|
|
2809
3030
|
param: {
|
|
2810
3031
|
path: string;
|
|
@@ -2817,7 +3038,7 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
2817
3038
|
remediation?: string | undefined;
|
|
2818
3039
|
};
|
|
2819
3040
|
outputFormat: "json";
|
|
2820
|
-
status:
|
|
3041
|
+
status: 404;
|
|
2821
3042
|
input: {
|
|
2822
3043
|
param: {
|
|
2823
3044
|
path: string;
|
|
@@ -2825,18 +3046,12 @@ export type AdminApi = import("hono/hono-base").HonoBase<any, {
|
|
|
2825
3046
|
};
|
|
2826
3047
|
} | {
|
|
2827
3048
|
output: {
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
} | null;
|
|
2832
|
-
children: {
|
|
2833
|
-
id: string;
|
|
2834
|
-
hasState: boolean;
|
|
2835
|
-
hasChildren: boolean;
|
|
2836
|
-
}[];
|
|
3049
|
+
error: string;
|
|
3050
|
+
code: string;
|
|
3051
|
+
remediation?: string | undefined;
|
|
2837
3052
|
};
|
|
2838
3053
|
outputFormat: "json";
|
|
2839
|
-
status:
|
|
3054
|
+
status: 500;
|
|
2840
3055
|
input: {
|
|
2841
3056
|
param: {
|
|
2842
3057
|
path: string;
|