@tai42/api-client 10.0.0 → 11.0.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/dist/client.d.ts +370 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +121 -3
- package/dist/client.js.map +1 -1
- package/dist/fleet-report.d.ts +14 -0
- package/dist/fleet-report.d.ts.map +1 -1
- package/dist/fleet-report.js +29 -0
- package/dist/fleet-report.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas.d.ts +267 -2
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +146 -3
- package/dist/schemas.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +187 -3
- package/src/fleet-report.ts +33 -0
- package/src/index.ts +20 -1
- package/src/schemas.ts +168 -3
package/src/schemas.ts
CHANGED
|
@@ -282,6 +282,7 @@ export const templateNames = z.array(z.string());
|
|
|
282
282
|
export const templateDetail = z.object({ template: z.string(), schema: jsonSchema });
|
|
283
283
|
export const templateUploaded = z.object({ path: z.string(), uploaded: z.literal(true) });
|
|
284
284
|
export const templateDeleted = z.object({ path: z.string(), deleted: z.literal(true) });
|
|
285
|
+
export const templateDirDeleted = z.object({ path: z.string(), deleted: z.literal(true) });
|
|
285
286
|
export const templateRendered = z.object({ rendered: z.string() });
|
|
286
287
|
export const templateCacheCleared = z.object({ cleared: z.literal(true) });
|
|
287
288
|
|
|
@@ -1027,6 +1028,15 @@ export type ConversationDoor = z.infer<typeof conversationDoor>;
|
|
|
1027
1028
|
export const conversationTargetKind = z.enum(['agent', 'tool']);
|
|
1028
1029
|
export type ConversationTargetKind = z.infer<typeof conversationTargetKind>;
|
|
1029
1030
|
|
|
1031
|
+
/**
|
|
1032
|
+
* A route's default control mode (`initial_mode`) when a thread carries no
|
|
1033
|
+
* per-thread override: `agent` runs the target turn, `manual` suppresses it for an
|
|
1034
|
+
* operator to answer. The same value vocabulary as a per-thread mode override, but
|
|
1035
|
+
* a distinct concept (the route default vs. one thread's override).
|
|
1036
|
+
*/
|
|
1037
|
+
export const conversationMode = z.enum(['agent', 'manual']);
|
|
1038
|
+
export type ConversationMode = z.infer<typeof conversationMode>;
|
|
1039
|
+
|
|
1030
1040
|
/**
|
|
1031
1041
|
* Where a record sits between intake and a terminal outcome. `failed` is the one
|
|
1032
1042
|
* the monitor surfaces loudly; `shed` and `silent` are terminal by design and
|
|
@@ -1055,7 +1065,14 @@ export type ConversationAnswerStatus = z.infer<typeof conversationAnswerStatus>;
|
|
|
1055
1065
|
export const conversationRecordOrigin = z.enum(['client', 'operator']);
|
|
1056
1066
|
export type ConversationRecordOrigin = z.infer<typeof conversationRecordOrigin>;
|
|
1057
1067
|
|
|
1058
|
-
/**
|
|
1068
|
+
/**
|
|
1069
|
+
* A stored routing row as a read door returns it, its `callback_secret` withheld.
|
|
1070
|
+
*
|
|
1071
|
+
* `initial_mode`, `turns_per_hour_override`, and `error_reply_text` carry defaults
|
|
1072
|
+
* because a stored row always returns them, while a hand-built stub/fixture may
|
|
1073
|
+
* omit them — the default keeps such a payload valid without inventing a field the
|
|
1074
|
+
* server never sends.
|
|
1075
|
+
*/
|
|
1059
1076
|
export const conversationRoute = z.object({
|
|
1060
1077
|
route_name: z.string(),
|
|
1061
1078
|
door: conversationDoor,
|
|
@@ -1063,10 +1080,13 @@ export const conversationRoute = z.object({
|
|
|
1063
1080
|
target_name: z.string(),
|
|
1064
1081
|
payload_expr: z.string().nullable(),
|
|
1065
1082
|
reply_expr: z.string().nullable(),
|
|
1083
|
+
initial_mode: conversationMode.default('agent'),
|
|
1066
1084
|
execution_key: z.string(),
|
|
1067
1085
|
channel: z.string().nullable(),
|
|
1068
1086
|
our_identity: z.string().nullable(),
|
|
1069
1087
|
callback_url: z.string().nullable(),
|
|
1088
|
+
turns_per_hour_override: z.number().int().nullable().default(null),
|
|
1089
|
+
error_reply_text: z.string().nullable().default(null),
|
|
1070
1090
|
execution_key_fingerprint: z.string(),
|
|
1071
1091
|
});
|
|
1072
1092
|
export type ConversationRoute = z.infer<typeof conversationRoute>;
|
|
@@ -1077,6 +1097,62 @@ export const conversationRoutes = z.object({
|
|
|
1077
1097
|
});
|
|
1078
1098
|
export type ConversationRoutes = z.infer<typeof conversationRoutes>;
|
|
1079
1099
|
|
|
1100
|
+
/**
|
|
1101
|
+
* The client-facing create/edit body for a conversation route — the wire model of
|
|
1102
|
+
* `tai42_contract.conversations.ConversationRouteCreate`. `POST
|
|
1103
|
+
* /api/conversations/{route_name}` is an UPSERT, so this one shape is both the
|
|
1104
|
+
* create AND the edit body. `route_name` rides the URL path; it is carried here too
|
|
1105
|
+
* (the door rejects a body whose `route_name` disagrees with the path).
|
|
1106
|
+
*
|
|
1107
|
+
* The contract's cross-field validators are mirrored where the form authors this
|
|
1108
|
+
* body: `payload_expr`/`reply_expr` are tool-only; an `api` door carries a
|
|
1109
|
+
* `callback_url` (and no channel identity); a `channel` door carries `channel` +
|
|
1110
|
+
* `our_identity` (and no callback). Sent explicitly (including `null`) so an edit
|
|
1111
|
+
* clears a field the operator emptied rather than leaving the stored value.
|
|
1112
|
+
*/
|
|
1113
|
+
export const conversationRouteCreate = z.object({
|
|
1114
|
+
route_name: z.string(),
|
|
1115
|
+
door: conversationDoor,
|
|
1116
|
+
target_kind: conversationTargetKind,
|
|
1117
|
+
target_name: z.string().min(1),
|
|
1118
|
+
payload_expr: z.string().nullable().default(null),
|
|
1119
|
+
reply_expr: z.string().nullable().default(null),
|
|
1120
|
+
initial_mode: conversationMode.default('agent'),
|
|
1121
|
+
execution_key: z.string().min(1),
|
|
1122
|
+
channel: z.string().nullable().default(null),
|
|
1123
|
+
our_identity: z.string().nullable().default(null),
|
|
1124
|
+
callback_url: z.string().nullable().default(null),
|
|
1125
|
+
turns_per_hour_override: z.number().int().positive().nullable().default(null),
|
|
1126
|
+
error_reply_text: z.string().min(1).max(2000).nullable().default(null),
|
|
1127
|
+
});
|
|
1128
|
+
export type ConversationRouteCreate = z.infer<typeof conversationRouteCreate>;
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* The create/replace reply: whether THIS call created the row (vs. replaced an
|
|
1132
|
+
* existing one), the row itself (its `callback_secret` withheld), and the
|
|
1133
|
+
* `callback_secret` returned ONCE for an `api`-door row (`null` for a `channel`
|
|
1134
|
+
* row). The secret signs delivery callbacks and is never re-read from any door, so
|
|
1135
|
+
* a caller that needs it must capture it from this reply.
|
|
1136
|
+
*/
|
|
1137
|
+
export const conversationRouteWritten = z.object({
|
|
1138
|
+
created: z.boolean(),
|
|
1139
|
+
route_name: z.string(),
|
|
1140
|
+
route: conversationRoute,
|
|
1141
|
+
callback_secret: z.string().nullable(),
|
|
1142
|
+
});
|
|
1143
|
+
export type ConversationRouteWritten = z.infer<typeof conversationRouteWritten>;
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* The delete reply: `removed` says whether THIS call removed the routing row (a
|
|
1147
|
+
* retryable reclamation of orphaned thread indexes answers `false` rather than a
|
|
1148
|
+
* 404).
|
|
1149
|
+
*/
|
|
1150
|
+
export const conversationRouteDeleted = z.object({
|
|
1151
|
+
removed: z.boolean(),
|
|
1152
|
+
route_name: z.string(),
|
|
1153
|
+
});
|
|
1154
|
+
export type ConversationRouteDeleted = z.infer<typeof conversationRouteDeleted>;
|
|
1155
|
+
|
|
1080
1156
|
/**
|
|
1081
1157
|
* One thread of a route, summarized from its newest record. A `thread_id` holds
|
|
1082
1158
|
* an api-door address (`{principal}/{end user}`, percent-encoded), so it never
|
|
@@ -1179,6 +1255,94 @@ export const conversationThreadMessageSent = z.object({
|
|
|
1179
1255
|
});
|
|
1180
1256
|
export type ConversationThreadMessageSent = z.infer<typeof conversationThreadMessageSent>;
|
|
1181
1257
|
|
|
1258
|
+
/**
|
|
1259
|
+
* Per-target presentation config for the conversation bridge, keyed by
|
|
1260
|
+
* `(target_kind, target_name)` — the wire model of
|
|
1261
|
+
* `tai42_contract.conversations.TargetConversationConfig`. The row carries no
|
|
1262
|
+
* server-derived fields, so this ONE shape is the stored row AND the upsert body
|
|
1263
|
+
* (`PUT /api/conversation-configs/{target_kind}/{target_name}` is the create AND
|
|
1264
|
+
* the edit path).
|
|
1265
|
+
*
|
|
1266
|
+
* `multichannel` opts the target into person linking; `greeting_template` is the
|
|
1267
|
+
* first-contact greeting. `greeting_template` is a `str.format` template (NOT a jq
|
|
1268
|
+
* expression) that may reference at most the `{pairing_code}` placeholder — it
|
|
1269
|
+
* carries no `x-tai42-expression`. `null` is the explicit spelling for "no
|
|
1270
|
+
* greeting"; a blank string is refused server-side.
|
|
1271
|
+
*/
|
|
1272
|
+
export const targetConversationConfig = z.object({
|
|
1273
|
+
target_kind: conversationTargetKind,
|
|
1274
|
+
target_name: z.string().min(1),
|
|
1275
|
+
multichannel: z.boolean().default(false),
|
|
1276
|
+
greeting_template: z.string().nullable().default(null),
|
|
1277
|
+
});
|
|
1278
|
+
export type TargetConversationConfig = z.infer<typeof targetConversationConfig>;
|
|
1279
|
+
|
|
1280
|
+
/** Every stored per-target config (`GET /api/conversation-configs`). */
|
|
1281
|
+
export const conversationConfigs = z.object({
|
|
1282
|
+
items: z.array(targetConversationConfig),
|
|
1283
|
+
total: z.number(),
|
|
1284
|
+
});
|
|
1285
|
+
export type ConversationConfigs = z.infer<typeof conversationConfigs>;
|
|
1286
|
+
|
|
1287
|
+
/**
|
|
1288
|
+
* The upsert reply: whether THIS call created the config (vs. replaced an existing
|
|
1289
|
+
* one), its key, and the stored row.
|
|
1290
|
+
*/
|
|
1291
|
+
export const conversationConfigWritten = z.object({
|
|
1292
|
+
created: z.boolean(),
|
|
1293
|
+
target_kind: conversationTargetKind,
|
|
1294
|
+
target_name: z.string(),
|
|
1295
|
+
config: targetConversationConfig,
|
|
1296
|
+
});
|
|
1297
|
+
export type ConversationConfigWritten = z.infer<typeof conversationConfigWritten>;
|
|
1298
|
+
|
|
1299
|
+
/** The config-delete reply: `removed` is always `true` on success (an unknown key is a 404). */
|
|
1300
|
+
export const conversationConfigDeleted = z.object({
|
|
1301
|
+
removed: z.boolean(),
|
|
1302
|
+
target_kind: conversationTargetKind,
|
|
1303
|
+
target_name: z.string(),
|
|
1304
|
+
});
|
|
1305
|
+
export type ConversationConfigDeleted = z.infer<typeof conversationConfigDeleted>;
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* The admin-only failed-delivery listing (`GET /api/conversations/messages/failed`):
|
|
1309
|
+
* every answer record whose delivery ended `failed`, across every route and caller.
|
|
1310
|
+
* The records are the ADMIN projection (delivery bookkeeping and `error` included),
|
|
1311
|
+
* so the row shape is {@link conversationMessage} exactly. It is NOT a paged window —
|
|
1312
|
+
* the door returns `{items, total}` and nothing more.
|
|
1313
|
+
*/
|
|
1314
|
+
export const conversationFailedMessages = z.object({
|
|
1315
|
+
items: z.array(conversationMessage),
|
|
1316
|
+
total: z.number(),
|
|
1317
|
+
});
|
|
1318
|
+
export type ConversationFailedMessages = z.infer<typeof conversationFailedMessages>;
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* The thread-delete reply (`DELETE /api/conversations/{route_name}/thread?thread_id=`).
|
|
1322
|
+
* `removed` is a COUNT of the answer records this call deleted — `0` when a prior
|
|
1323
|
+
* run already cleared them, when they had aged out under retention, or when the id
|
|
1324
|
+
* was never stored (forgetting is absolute, never a 404 on a valid id).
|
|
1325
|
+
*/
|
|
1326
|
+
export const conversationThreadDeleted = z.object({
|
|
1327
|
+
removed: z.number(),
|
|
1328
|
+
route_name: z.string(),
|
|
1329
|
+
thread_id: z.string(),
|
|
1330
|
+
});
|
|
1331
|
+
export type ConversationThreadDeleted = z.infer<typeof conversationThreadDeleted>;
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* The person-erase reply (`DELETE /api/conversations/persons/{person_id}`).
|
|
1335
|
+
* `removed` counts the answer records deleted across the person's routes; `erased`
|
|
1336
|
+
* says whether THIS call removed the person row (`false` on a retry or an
|
|
1337
|
+
* already-gone person — never a 404).
|
|
1338
|
+
*/
|
|
1339
|
+
export const conversationPersonDeleted = z.object({
|
|
1340
|
+
person_id: z.string(),
|
|
1341
|
+
removed: z.number(),
|
|
1342
|
+
erased: z.boolean(),
|
|
1343
|
+
});
|
|
1344
|
+
export type ConversationPersonDeleted = z.infer<typeof conversationPersonDeleted>;
|
|
1345
|
+
|
|
1182
1346
|
// -- channel-web entry gate --------------------------------------------------
|
|
1183
1347
|
// The web channel's entry gate: a web route can be gated so its chat page is
|
|
1184
1348
|
// served only to a navigation carrying a live entry code. These four doors are
|
|
@@ -2195,8 +2359,9 @@ export const marketplaceInstalledPlugin = z
|
|
|
2195
2359
|
missing_upstream: z.boolean(),
|
|
2196
2360
|
compat: marketplaceInstalledCompat,
|
|
2197
2361
|
// The `{kind, name}` of every item this plugin's stored spec provides
|
|
2198
|
-
// (local truth). The
|
|
2199
|
-
// manifest's mcp-entry titles to render an
|
|
2362
|
+
// (local truth). The connectors page's McpServersSection joins the mcp-server
|
|
2363
|
+
// item names against the manifest's mcp-entry titles to render an
|
|
2364
|
+
// installer-written entry read-only.
|
|
2200
2365
|
items: z.array(marketplaceItem.pick({ kind: true, name: true })),
|
|
2201
2366
|
// The persisted `{item_name: base}` mount this plugin is installed at (local
|
|
2202
2367
|
// truth; `{}` means every item at its declared base). Studio seeds the update
|