@tai42/api-client 36.0.1 → 38.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/auth-client.d.ts +5 -5
- package/dist/client/auth-client.d.ts.map +1 -1
- package/dist/client/auth-client.js.map +1 -1
- package/dist/client/conversations-client.d.ts +12 -8
- package/dist/client/conversations-client.d.ts.map +1 -1
- package/dist/client/conversations-client.js.map +1 -1
- package/dist/client/hooks-client.d.ts +2 -2
- package/dist/client/hooks-client.d.ts.map +1 -1
- package/dist/client/hooks-client.js.map +1 -1
- package/dist/client/index.d.ts +8 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/interactions-client.d.ts +2 -2
- package/dist/client/interactions-client.d.ts.map +1 -1
- package/dist/client/interactions-client.js.map +1 -1
- package/dist/client/login-client.d.ts +2 -2
- package/dist/client/login-client.d.ts.map +1 -1
- package/dist/client/login-client.js.map +1 -1
- package/dist/client/presets-client.d.ts +13 -14
- package/dist/client/presets-client.d.ts.map +1 -1
- package/dist/client/presets-client.js.map +1 -1
- package/dist/client/profiles-client.d.ts +2 -2
- package/dist/client/profiles-client.d.ts.map +1 -1
- package/dist/client/profiles-client.js.map +1 -1
- package/dist/client/schedules-client.d.ts +2 -2
- package/dist/client/schedules-client.d.ts.map +1 -1
- package/dist/client/schedules-client.js.map +1 -1
- package/dist/client/states-client.d.ts +3 -3
- package/dist/client/states-client.d.ts.map +1 -1
- package/dist/client/states-client.js.map +1 -1
- package/dist/client/templates-client.d.ts +2 -2
- package/dist/client/templates-client.d.ts.map +1 -1
- package/dist/client/templates-client.js.map +1 -1
- package/dist/client/tool-extensions-client.d.ts +2 -2
- package/dist/client/tool-extensions-client.d.ts.map +1 -1
- package/dist/client/tool-extensions-client.js.map +1 -1
- package/dist/generated/openapi-schemas.d.ts +24 -0
- package/dist/generated/openapi-schemas.d.ts.map +1 -1
- package/dist/generated/openapi-schemas.js +2 -1
- package/dist/generated/openapi-schemas.js.map +1 -1
- package/dist/generated/served-schemas.d.ts +35 -2
- package/dist/generated/served-schemas.d.ts.map +1 -1
- package/dist/generated/served-schemas.js +33 -3
- package/dist/generated/served-schemas.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas/channels.d.ts +5 -1
- package/dist/schemas/channels.d.ts.map +1 -1
- package/dist/schemas/channels.js +2 -0
- package/dist/schemas/channels.js.map +1 -1
- package/dist/schemas/conversations.d.ts +6 -0
- package/dist/schemas/conversations.d.ts.map +1 -1
- package/dist/schemas/interactions.d.ts +2 -2
- package/dist/schemas/interactions.js +2 -2
- package/dist/schemas/manifest-mcp.d.ts +13 -1
- package/dist/schemas/manifest-mcp.d.ts.map +1 -1
- package/dist/schemas/manifest-mcp.js +1 -0
- package/dist/schemas/manifest-mcp.js.map +1 -1
- package/dist/schemas/served.d.ts +32 -2
- package/dist/schemas/served.d.ts.map +1 -1
- package/dist/worker-refusal.d.ts +8 -0
- package/dist/worker-refusal.d.ts.map +1 -0
- package/dist/worker-refusal.js +15 -0
- package/dist/worker-refusal.js.map +1 -0
- package/package.json +1 -1
- package/src/client/auth-client.ts +5 -4
- package/src/client/conversations-client.ts +15 -7
- package/src/client/hooks-client.ts +2 -1
- package/src/client/index.ts +5 -1
- package/src/client/interactions-client.ts +2 -1
- package/src/client/login-client.ts +2 -1
- package/src/client/presets-client.ts +18 -13
- package/src/client/profiles-client.ts +2 -1
- package/src/client/schedules-client.ts +2 -1
- package/src/client/states-client.ts +3 -2
- package/src/client/templates-client.ts +2 -1
- package/src/client/tool-extensions-client.ts +2 -1
- package/src/generated/openapi-schemas.ts +4 -1
- package/src/generated/served-schemas.ts +33 -3
- package/src/index.ts +9 -1
- package/src/schemas/channels.ts +2 -1
- package/src/schemas/interactions.ts +2 -2
- package/src/schemas/manifest-mcp.ts +2 -1
- package/src/worker-refusal.ts +18 -0
package/src/client/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { failedReplyRoll } from '../failed-reply-roll';
|
|
|
4
4
|
import type { ApiConfig } from '../http';
|
|
5
5
|
import { isMcpNotLoadedError, isMcpStartingError } from '../mcp-failure';
|
|
6
6
|
import { servedConstants } from '../schemas';
|
|
7
|
+
import { isReloadingError, isWorkerLeavingError } from '../worker-refusal';
|
|
7
8
|
import { agentsClient } from './agents-client';
|
|
8
9
|
import { authClient } from './auth-client';
|
|
9
10
|
import { backendClient } from './backend-client';
|
|
@@ -42,6 +43,7 @@ export type {
|
|
|
42
43
|
AddUrlToScopeBody,
|
|
43
44
|
ApiKeyBody,
|
|
44
45
|
ClaimLinkBody,
|
|
46
|
+
InvokeMemberActionBody,
|
|
45
47
|
PinRoutePublicBody,
|
|
46
48
|
RoleCreateBody,
|
|
47
49
|
RoleUpdateBody,
|
|
@@ -60,7 +62,7 @@ export type {
|
|
|
60
62
|
} from './conversations-client';
|
|
61
63
|
export type { TopicVerifierBody } from './hooks-client';
|
|
62
64
|
export { isSafeApiPath } from './login-client';
|
|
63
|
-
export type { ApiToolsListsBody, McpToolFilter } from './manifest-client';
|
|
65
|
+
export type { ApiToolsListsBody, McpToolFilter, SetMcpSecretEnvBody } from './manifest-client';
|
|
64
66
|
export type {
|
|
65
67
|
MarketplaceInstallBody,
|
|
66
68
|
MarketplaceInstallPreviewBody,
|
|
@@ -102,6 +104,8 @@ export function createApiClient(config: ApiConfig) {
|
|
|
102
104
|
storedPresetFaultFromError,
|
|
103
105
|
isMcpStartingError,
|
|
104
106
|
isMcpNotLoadedError,
|
|
107
|
+
isReloadingError,
|
|
108
|
+
isWorkerLeavingError,
|
|
105
109
|
failedReplyRoll,
|
|
106
110
|
...toolsClient(t),
|
|
107
111
|
...presetsClient(t),
|
|
@@ -3,6 +3,7 @@ import { ApiError, ApiUnauthorizedError } from '../errors';
|
|
|
3
3
|
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
4
4
|
import { API_KEY_HEADER } from '../headers';
|
|
5
5
|
import { extractError } from '../http';
|
|
6
|
+
import type { ReactionEvent } from '../schemas';
|
|
6
7
|
import * as s from '../schemas';
|
|
7
8
|
import { readSseFrames, sseOpenToken } from '../sse';
|
|
8
9
|
import type { Transport } from './transport';
|
|
@@ -38,7 +39,7 @@ export function interactionsClient(t: Transport) {
|
|
|
38
39
|
// on the server — it records no answer and resolves no interaction — so it never
|
|
39
40
|
// substitutes for the answer door. A handler error/timeout surfaces as the shared
|
|
40
41
|
// `apiRequest` status handling (loud), never a stale value.
|
|
41
|
-
reactInteraction: (interactionId: string, event:
|
|
42
|
+
reactInteraction: (interactionId: string, event: ReactionEvent, values: unknown) =>
|
|
42
43
|
req(
|
|
43
44
|
buildPath(apiRoutes.post_api_interactions_interaction_id_react.path, {
|
|
44
45
|
interaction_id: interactionId,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ApiUnauthorizedError,
|
|
7
7
|
} from '../errors';
|
|
8
8
|
import { apiRoutes } from '../generated/api-routes';
|
|
9
|
+
import type { SetupBody } from '../schemas';
|
|
9
10
|
import * as s from '../schemas';
|
|
10
11
|
import type { Transport } from './transport';
|
|
11
12
|
|
|
@@ -131,7 +132,7 @@ export function loginClient(t: Transport) {
|
|
|
131
132
|
// already-initialized deployment, an unsupported setup door, or an invalid
|
|
132
133
|
// body becomes an inline `ApiSetupFailedError`; any other failure rethrows
|
|
133
134
|
// loudly.
|
|
134
|
-
submitSetup: async (body:
|
|
135
|
+
submitSetup: async (body: SetupBody) => {
|
|
135
136
|
try {
|
|
136
137
|
return await req(apiRoutes.post_api_setup.path, s.setupResult, { method: 'POST', body });
|
|
137
138
|
} catch (error) {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** Preset CRUD, versioning and validation sub-client. */
|
|
2
2
|
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
PresetExtensionElement,
|
|
5
|
+
PresetHolderAction,
|
|
6
|
+
StateBinding,
|
|
7
|
+
TemplatedText,
|
|
8
|
+
} from '../schemas';
|
|
4
9
|
import * as s from '../schemas';
|
|
5
10
|
import type { Transport } from './transport';
|
|
6
11
|
|
|
@@ -25,13 +30,13 @@ export interface CreatePresetBody {
|
|
|
25
30
|
readonly base_tool: string;
|
|
26
31
|
readonly description: string;
|
|
27
32
|
readonly fixed_kwargs?: Record<string, unknown>;
|
|
28
|
-
readonly extensions?: readonly
|
|
33
|
+
readonly extensions?: readonly PresetExtensionElement[][];
|
|
29
34
|
readonly output_schema?: Record<string, unknown> | null;
|
|
30
35
|
readonly input_schema?: Record<string, unknown> | null;
|
|
31
|
-
readonly input_map?:
|
|
32
|
-
readonly output_map?:
|
|
36
|
+
readonly input_map?: TemplatedText | string | null;
|
|
37
|
+
readonly output_map?: TemplatedText | string | null;
|
|
33
38
|
// The optional door-layer state binding applied around every run of this preset.
|
|
34
|
-
readonly state_binding?:
|
|
39
|
+
readonly state_binding?: StateBinding | null;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
/**
|
|
@@ -51,12 +56,12 @@ export interface CreatePresetBody {
|
|
|
51
56
|
export interface SavePresetVersionBody {
|
|
52
57
|
readonly fixed_kwargs?: Record<string, unknown>;
|
|
53
58
|
readonly description?: string;
|
|
54
|
-
readonly extensions?: readonly
|
|
59
|
+
readonly extensions?: readonly PresetExtensionElement[][];
|
|
55
60
|
readonly output_schema?: Record<string, unknown> | null;
|
|
56
61
|
readonly input_schema?: Record<string, unknown> | null;
|
|
57
|
-
readonly input_map?:
|
|
58
|
-
readonly output_map?:
|
|
59
|
-
readonly state_binding?:
|
|
62
|
+
readonly input_map?: TemplatedText | string | null;
|
|
63
|
+
readonly output_map?: TemplatedText | string | null;
|
|
64
|
+
readonly state_binding?: StateBinding | null;
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
/**
|
|
@@ -71,15 +76,15 @@ export interface ValidatePresetBody {
|
|
|
71
76
|
readonly base_tool?: string;
|
|
72
77
|
readonly description?: string;
|
|
73
78
|
readonly fixed_kwargs?: Record<string, unknown>;
|
|
74
|
-
readonly extensions?: readonly
|
|
79
|
+
readonly extensions?: readonly PresetExtensionElement[][];
|
|
75
80
|
readonly output_schema?: Record<string, unknown> | null;
|
|
76
81
|
readonly input_schema?: Record<string, unknown> | null;
|
|
77
|
-
readonly input_map?:
|
|
78
|
-
readonly output_map?:
|
|
82
|
+
readonly input_map?: TemplatedText | string | null;
|
|
83
|
+
readonly output_map?: TemplatedText | string | null;
|
|
79
84
|
// The optional door-layer state binding to dry-run — validated (never mounted) by the
|
|
80
85
|
// same checks the write would run. In VERSION mode it follows the save-version sentinel:
|
|
81
86
|
// omitted carries the active binding forward, an explicit `null` clears it.
|
|
82
|
-
readonly state_binding?:
|
|
87
|
+
readonly state_binding?: StateBinding | null;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
export function presetsClient(t: Transport) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Settings-profile CRUD, versioning and apply sub-client. */
|
|
2
2
|
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
|
+
import type { SettingsProfileBody } from '../schemas';
|
|
3
4
|
import * as s from '../schemas';
|
|
4
5
|
import type { Transport } from './transport';
|
|
5
6
|
|
|
@@ -14,7 +15,7 @@ export function profilesClient(t: Transport) {
|
|
|
14
15
|
req(buildPath(apiRoutes.get_api_config_profiles_name.path, { name }), s.settingsProfileBody, {
|
|
15
16
|
signal,
|
|
16
17
|
}),
|
|
17
|
-
putSettingsProfile: (name: string, body:
|
|
18
|
+
putSettingsProfile: (name: string, body: SettingsProfileBody) =>
|
|
18
19
|
req(
|
|
19
20
|
buildPath(apiRoutes.put_api_config_profiles_name.path, { name }),
|
|
20
21
|
s.settingsProfileSaved,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Schedule listing and mutation sub-client. */
|
|
2
2
|
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
|
+
import type { ScheduleCreate } from '../schemas';
|
|
3
4
|
import * as s from '../schemas';
|
|
4
5
|
import type { Transport } from './transport';
|
|
5
6
|
|
|
@@ -13,7 +14,7 @@ export function schedulesClient(t: Transport) {
|
|
|
13
14
|
// The body is the served `ScheduleCreate` document: the base tool, its kwargs, an optional
|
|
14
15
|
// typed cadence (none runs the tool once now) and schedule name, the top-level subject,
|
|
15
16
|
// the state binding, the execution key and the four door-contract jqs.
|
|
16
|
-
addSchedule: (body:
|
|
17
|
+
addSchedule: (body: ScheduleCreate) =>
|
|
17
18
|
req(apiRoutes.post_api_schedules.path, s.jsonValue, { method: 'POST', body }),
|
|
18
19
|
deleteSchedule: (name: string) =>
|
|
19
20
|
req(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** State declaration, record, template and consumer sub-client. */
|
|
2
2
|
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
|
+
import type { TemplatedText } from '../schemas';
|
|
3
4
|
import * as s from '../schemas';
|
|
4
5
|
import type { Transport } from './transport';
|
|
5
6
|
|
|
@@ -14,7 +15,7 @@ import type { Transport } from './transport';
|
|
|
14
15
|
export interface StateDeclarationBody {
|
|
15
16
|
readonly name: string;
|
|
16
17
|
readonly description?: string;
|
|
17
|
-
readonly schema:
|
|
18
|
+
readonly schema: TemplatedText | Record<string, unknown>;
|
|
18
19
|
readonly subject_kinds: readonly string[];
|
|
19
20
|
readonly default_subject_kind: string;
|
|
20
21
|
readonly retention_days?: number | null;
|
|
@@ -29,7 +30,7 @@ export interface StateTemplateBody {
|
|
|
29
30
|
readonly name: string;
|
|
30
31
|
readonly description?: string;
|
|
31
32
|
readonly parameters?: Record<string, unknown>;
|
|
32
|
-
readonly schema:
|
|
33
|
+
readonly schema: TemplatedText | Record<string, unknown>;
|
|
33
34
|
readonly regimes?: Record<string, unknown>[];
|
|
34
35
|
readonly declarations?: Record<string, unknown> | null;
|
|
35
36
|
readonly trace?: Record<string, unknown>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Prompt-template listing, render and mutation sub-client. */
|
|
2
2
|
import { apiRoutes } from '../generated/api-routes';
|
|
3
|
+
import type { TemplatedText } from '../schemas';
|
|
3
4
|
import * as s from '../schemas';
|
|
4
5
|
import type { Transport } from './transport';
|
|
5
6
|
|
|
@@ -34,7 +35,7 @@ export function templatesClient(t: Transport) {
|
|
|
34
35
|
// Render one authored text — inline `content` OR a stored template `id`, plus its
|
|
35
36
|
// render `kwargs` — and parse the rendered output. The value is the shared
|
|
36
37
|
// `TemplatedText` (exactly one source); the route wraps it under `text`.
|
|
37
|
-
renderTemplate: (text:
|
|
38
|
+
renderTemplate: (text: TemplatedText) =>
|
|
38
39
|
req(apiRoutes.post_api_render_template.path, s.templateRendered, {
|
|
39
40
|
method: 'POST',
|
|
40
41
|
body: { text },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** Tool extension listing and authoring sub-client. */
|
|
2
2
|
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
|
+
import type { PresetExtensionElement } from '../schemas';
|
|
3
4
|
import * as s from '../schemas';
|
|
4
5
|
import type { Transport } from './transport';
|
|
5
6
|
|
|
@@ -18,7 +19,7 @@ export function toolExtensionsClient(t: Transport) {
|
|
|
18
19
|
// clears). Returns the apply result: the local reload (`status` + `env_keys`) plus
|
|
19
20
|
// the mode-wrapped fleet `fanout` of the reload it broadcast, from which the shared
|
|
20
21
|
// fleet-report handler surfaces any failed propagation.
|
|
21
|
-
setToolExtensions: (name: string, combos: readonly
|
|
22
|
+
setToolExtensions: (name: string, combos: readonly PresetExtensionElement[][]) =>
|
|
22
23
|
req(
|
|
23
24
|
buildPath(apiRoutes.post_api_tools_name_extensions.path, { name }),
|
|
24
25
|
s.toolExtensionsApplyResult,
|
|
@@ -148,7 +148,7 @@ export type AnswerPart = z.infer<typeof answerPart>;
|
|
|
148
148
|
export const overlapPolicy = z.object({ "deliver": z.enum(["one","all"]).default("one"), "running": z.enum(["continue","cancel"]).default("continue"), "settle_seconds": z.number().int().gte(0).lte(30).default(0) });
|
|
149
149
|
export type OverlapPolicy = z.infer<typeof overlapPolicy>;
|
|
150
150
|
|
|
151
|
-
export const replyTexts = z.object({ "error": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code_invalid": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_link_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_not_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlink_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlinked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_could_not_receive": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_too_large": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unreadable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unsupported_type": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "slow_down": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null) }).strict();
|
|
151
|
+
export const replyTexts = z.object({ "error": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code_invalid": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_link_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_not_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlink_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlinked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_choice_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_could_not_receive": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_too_large": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unreadable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unsupported_type": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "slow_down": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null) }).strict();
|
|
152
152
|
export type ReplyTexts = z.infer<typeof replyTexts>;
|
|
153
153
|
|
|
154
154
|
export const apiConversationRouteCreate = z.object({ "callback_url": z.string().regex(new RegExp("^[hH][tT][tT][pP][sS]://[^/?#@]+(?:[/?#]|$)")).nullable().default(null), "cancel_expr": templatedText.nullable().default(null), "channel": z.null().default(null), "door": z.literal("api"), "execution_key": z.string().min(1), "extras_expr": templatedText.nullable().default(null), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.string().nullable().default(null), "our_identity": z.null().default(null), "overlap": overlapPolicy.default({"deliver":"one","running":"continue","settle_seconds":0}), "reply_expr": templatedText.nullable().default(null), "reply_texts": replyTexts.nullable().default(null), "resume_expr": templatedText.nullable().default(null), "route_name": z.string().regex(new RegExp("^[a-z0-9-]+$")), "start_expr": templatedText.nullable().default(null), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.number().int().gt(0).nullable().default(null) });
|
|
@@ -562,6 +562,9 @@ export type KindStatus = z.infer<typeof kindStatus>;
|
|
|
562
562
|
export const lastOp = z.object({ "at": z.string(), "op": z.string(), "outcome": z.string() });
|
|
563
563
|
export type LastOp = z.infer<typeof lastOp>;
|
|
564
564
|
|
|
565
|
+
export const leavingError = z.object({ "error": z.string(), "leaving": z.string() });
|
|
566
|
+
export type LeavingError = z.infer<typeof leavingError>;
|
|
567
|
+
|
|
565
568
|
export const setupLogin = z.object({ "kinds": z.array(z.enum(["password","invite"])) });
|
|
566
569
|
export type SetupLogin = z.infer<typeof setupLogin>;
|
|
567
570
|
|
|
@@ -15,7 +15,7 @@ export type AccessPolicy = z.infer<typeof accessPolicy>;
|
|
|
15
15
|
export const overlapPolicy = z.object({ "deliver": z.enum(["one","all"]).default("one"), "running": z.enum(["continue","cancel"]).default("continue"), "settle_seconds": z.number().int().gte(0).lte(30).default(0) });
|
|
16
16
|
export type OverlapPolicy = z.infer<typeof overlapPolicy>;
|
|
17
17
|
|
|
18
|
-
export const replyTexts = z.object({ "error": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code_invalid": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_link_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_not_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlink_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlinked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_could_not_receive": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_too_large": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unreadable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unsupported_type": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "slow_down": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null) }).strict();
|
|
18
|
+
export const replyTexts = z.object({ "error": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_code_invalid": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_link_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_not_linked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlink_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "pairing_unlinked": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_choice_unavailable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_could_not_receive": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_too_large": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unreadable": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "rejected_unsupported_type": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null), "slow_down": z.string().regex(new RegExp("\\S")).min(1).max(2000).nullable().default(null) }).strict();
|
|
19
19
|
export type ReplyTexts = z.infer<typeof replyTexts>;
|
|
20
20
|
|
|
21
21
|
export const apiConversationRoute = z.object({ "callback_secret": z.string().nullable().default(null), "callback_url": z.string().regex(new RegExp("^[hH][tT][tT][pP][sS]://[^/?#@]+(?:[/?#]|$)")).nullable().default(null), "cancel_expr": templatedText.nullable().default(null), "channel": z.null().default(null), "door": z.literal("api"), "execution_key": z.string().min(1), "execution_key_fingerprint": z.string().min(1), "extras_expr": templatedText.nullable().default(null), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.string().nullable().default(null), "our_identity": z.null().default(null), "overlap": overlapPolicy.default({"deliver":"one","running":"continue","settle_seconds":0}), "reply_expr": templatedText.nullable().default(null), "reply_texts": replyTexts.nullable().default(null), "resume_expr": templatedText.nullable().default(null), "route_name": z.string().regex(new RegExp("^[a-z0-9-]+$")), "start_expr": templatedText.nullable().default(null), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.number().int().gt(0).nullable().default(null) });
|
|
@@ -1366,7 +1366,7 @@ export const servedDocumentsJson = {
|
|
|
1366
1366
|
},
|
|
1367
1367
|
"ReplyTexts": {
|
|
1368
1368
|
"additionalProperties": false,
|
|
1369
|
-
"description": "The caller's words for the platform's fixed participant replies on one route. Frozen, strict keys.\n\n``error`` is sent when a turn fails and the target gave no reply
|
|
1369
|
+
"description": "The caller's words for the platform's fixed participant replies on one route. Frozen, strict keys.\n\n``error`` is sent when a turn the participant sent fails and the target gave no reply;\n``slow_down`` when an address is over the turn cap; ``pairing_linked`` when a pair code was\nredeemed and the two persons merged; ``pairing_unlinked`` when ``/unlink`` detached the\naddress; ``pairing_not_linked`` when ``/unlink`` came from an address linked to nothing;\n``pairing_code_invalid`` when a redeem was refused; ``pairing_code`` is the ``/link`` reply\ncarrying the fresh code, a template that MUST reference ``{pairing_code}`` and may reference\n``{expires_at}`` (the code's ISO-8601 expiry), with no conversion or format spec;\n``pairing_link_unavailable`` when a redeem met a person being erased (its code is consumed,\nso the reply asks for a new one); ``pairing_unlink_unavailable`` when ``/unlink`` met the\nsender's person being erased; ``rejected_unsupported_type`` / ``rejected_too_large`` /\n``rejected_could_not_receive`` / ``rejected_unreadable`` / ``rejected_choice_unavailable``\nare the notices for an inbound message the channel cannot bridge, a file over the cap, a\nfile the channel could not fetch, an inbound message whose body the channel could not read,\nand a tap on a choice the channel can no longer read. Every member but\n``pairing_code`` is literal text: a ``{`` in it is drawn as written. Each is a\n:data:`~tai42_contract.interactions.ReplyText` in the line's language; absent, the built-in\nEnglish reply is sent. An empty catalogue names nothing and is refused; an unknown key is\nrefused.",
|
|
1370
1370
|
"properties": {
|
|
1371
1371
|
"error": {
|
|
1372
1372
|
"anyOf": [
|
|
@@ -1488,6 +1488,21 @@ export const servedDocumentsJson = {
|
|
|
1488
1488
|
"default": null,
|
|
1489
1489
|
"title": "Pairing Unlinked"
|
|
1490
1490
|
},
|
|
1491
|
+
"rejected_choice_unavailable": {
|
|
1492
|
+
"anyOf": [
|
|
1493
|
+
{
|
|
1494
|
+
"maxLength": 2000,
|
|
1495
|
+
"minLength": 1,
|
|
1496
|
+
"pattern": "\\S",
|
|
1497
|
+
"type": "string"
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
"type": "null"
|
|
1501
|
+
}
|
|
1502
|
+
],
|
|
1503
|
+
"default": null,
|
|
1504
|
+
"title": "Rejected Choice Unavailable"
|
|
1505
|
+
},
|
|
1491
1506
|
"rejected_could_not_receive": {
|
|
1492
1507
|
"anyOf": [
|
|
1493
1508
|
{
|
|
@@ -2471,7 +2486,7 @@ export const servedDocumentsJson = {
|
|
|
2471
2486
|
},
|
|
2472
2487
|
"ReplyTexts": {
|
|
2473
2488
|
"additionalProperties": false,
|
|
2474
|
-
"description": "The caller's words for the platform's fixed participant replies on one route. Frozen, strict keys.\n\n``error`` is sent when a turn fails and the target gave no reply
|
|
2489
|
+
"description": "The caller's words for the platform's fixed participant replies on one route. Frozen, strict keys.\n\n``error`` is sent when a turn the participant sent fails and the target gave no reply;\n``slow_down`` when an address is over the turn cap; ``pairing_linked`` when a pair code was\nredeemed and the two persons merged; ``pairing_unlinked`` when ``/unlink`` detached the\naddress; ``pairing_not_linked`` when ``/unlink`` came from an address linked to nothing;\n``pairing_code_invalid`` when a redeem was refused; ``pairing_code`` is the ``/link`` reply\ncarrying the fresh code, a template that MUST reference ``{pairing_code}`` and may reference\n``{expires_at}`` (the code's ISO-8601 expiry), with no conversion or format spec;\n``pairing_link_unavailable`` when a redeem met a person being erased (its code is consumed,\nso the reply asks for a new one); ``pairing_unlink_unavailable`` when ``/unlink`` met the\nsender's person being erased; ``rejected_unsupported_type`` / ``rejected_too_large`` /\n``rejected_could_not_receive`` / ``rejected_unreadable`` / ``rejected_choice_unavailable``\nare the notices for an inbound message the channel cannot bridge, a file over the cap, a\nfile the channel could not fetch, an inbound message whose body the channel could not read,\nand a tap on a choice the channel can no longer read. Every member but\n``pairing_code`` is literal text: a ``{`` in it is drawn as written. Each is a\n:data:`~tai42_contract.interactions.ReplyText` in the line's language; absent, the built-in\nEnglish reply is sent. An empty catalogue names nothing and is refused; an unknown key is\nrefused.",
|
|
2475
2490
|
"properties": {
|
|
2476
2491
|
"error": {
|
|
2477
2492
|
"anyOf": [
|
|
@@ -2593,6 +2608,21 @@ export const servedDocumentsJson = {
|
|
|
2593
2608
|
"default": null,
|
|
2594
2609
|
"title": "Pairing Unlinked"
|
|
2595
2610
|
},
|
|
2611
|
+
"rejected_choice_unavailable": {
|
|
2612
|
+
"anyOf": [
|
|
2613
|
+
{
|
|
2614
|
+
"maxLength": 2000,
|
|
2615
|
+
"minLength": 1,
|
|
2616
|
+
"pattern": "\\S",
|
|
2617
|
+
"type": "string"
|
|
2618
|
+
},
|
|
2619
|
+
{
|
|
2620
|
+
"type": "null"
|
|
2621
|
+
}
|
|
2622
|
+
],
|
|
2623
|
+
"default": null,
|
|
2624
|
+
"title": "Rejected Choice Unavailable"
|
|
2625
|
+
},
|
|
2596
2626
|
"rejected_could_not_receive": {
|
|
2597
2627
|
"anyOf": [
|
|
2598
2628
|
{
|
package/src/index.ts
CHANGED
|
@@ -12,7 +12,13 @@ export type {
|
|
|
12
12
|
ParsedAgentEvent,
|
|
13
13
|
UnknownAgentEvent,
|
|
14
14
|
} from './agents';
|
|
15
|
-
export {
|
|
15
|
+
export {
|
|
16
|
+
agentEventSchema,
|
|
17
|
+
agentList,
|
|
18
|
+
agentSummary,
|
|
19
|
+
parseAgentFrame,
|
|
20
|
+
parseAgentTranscript,
|
|
21
|
+
} from './agents';
|
|
16
22
|
export type {
|
|
17
23
|
AddServerArgs,
|
|
18
24
|
AddUrlToScopeBody,
|
|
@@ -26,6 +32,7 @@ export type {
|
|
|
26
32
|
ConversationTranscriptQuery,
|
|
27
33
|
CreatePresetBody,
|
|
28
34
|
DiscoverServerTarget,
|
|
35
|
+
InvokeMemberActionBody,
|
|
29
36
|
MarketplaceInstallBody,
|
|
30
37
|
MarketplaceInstallPreviewBody,
|
|
31
38
|
MarketplaceSearchQuery,
|
|
@@ -38,6 +45,7 @@ export type {
|
|
|
38
45
|
RunsQuery,
|
|
39
46
|
RunToolArgs,
|
|
40
47
|
SavePresetVersionBody,
|
|
48
|
+
SetMcpSecretEnvBody,
|
|
41
49
|
SetProviderClientArgs,
|
|
42
50
|
StartConnectArgs,
|
|
43
51
|
StateAttachmentBody,
|
package/src/schemas/channels.ts
CHANGED
|
@@ -10,4 +10,5 @@ import * as openapi from '../generated/openapi-schemas';
|
|
|
10
10
|
export const channels = openapi.channelListing;
|
|
11
11
|
export type Channels = z.infer<typeof channels>;
|
|
12
12
|
/** One installed channel plugin: its name and its declared identity hint, if any. */
|
|
13
|
-
export
|
|
13
|
+
export const channelEntry = openapi.channelEntry;
|
|
14
|
+
export type ChannelEntry = z.infer<typeof channelEntry>;
|
|
@@ -329,8 +329,8 @@ export type FormReactions = z.infer<typeof formReactions>;
|
|
|
329
329
|
/**
|
|
330
330
|
* The form update a reaction door returns (`POST /api/interactions/{id}/react`, its
|
|
331
331
|
* `update`): the same kind of data a form is sent with, applied to the open form. `values`
|
|
332
|
-
* sets field values; `options` replaces the per-send
|
|
333
|
-
* `errors` shows per-field messages (keyed by field name); `display` fills display slots
|
|
332
|
+
* sets field values, and a `null` value clears its field; `options` replaces the per-send
|
|
333
|
+
* choice list of option-bearing fields; `errors` shows per-field messages (keyed by field name); `display` fills display slots
|
|
334
334
|
* (keyed by slot name) — a computed total among them. A slot value is a text, a number,
|
|
335
335
|
* true/false or `null` (the slot unfilled); an object or a list makes the whole update
|
|
336
336
|
* malformed. Every member defaults to empty, so a reaction that touches only one of them
|
|
@@ -87,4 +87,5 @@ export type ReloadConfigResult = z.infer<typeof reloadConfigResult>;
|
|
|
87
87
|
*/
|
|
88
88
|
export const mcpAdvertisedTools = openapi.mcpAdvertisedTools;
|
|
89
89
|
export type McpAdvertisedTools = z.infer<typeof mcpAdvertisedTools>;
|
|
90
|
-
export
|
|
90
|
+
export const mcpAdvertisedTool = openapi.mcpAdvertisedTool;
|
|
91
|
+
export type McpAdvertisedTool = z.infer<typeof mcpAdvertisedTool>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusals a worker answers at its door before a change begins, each a retriable `503`
|
|
3
|
+
* carrying its own envelope: the reload gate held (`{ error, reloading: true }`), or the worker
|
|
4
|
+
* leaving (`{ error, leaving }`). A `503` without either envelope did not come from that door.
|
|
5
|
+
*/
|
|
6
|
+
import { ApiError } from './errors';
|
|
7
|
+
import { leavingError, reloadingError } from './generated/openapi-schemas';
|
|
8
|
+
|
|
9
|
+
/** Whether `error` is the reload gate's refusal: a `503` whose body is the reloading envelope. */
|
|
10
|
+
export const isReloadingError = (error: unknown): boolean =>
|
|
11
|
+
error instanceof ApiError && error.status === 503 && reloadingError.safeParse(error.body).success;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Whether `error` is a leaving worker's refusal: a `503` whose body is the leaving envelope. The
|
|
15
|
+
* worker begins no change; another worker takes the same request.
|
|
16
|
+
*/
|
|
17
|
+
export const isWorkerLeavingError = (error: unknown): boolean =>
|
|
18
|
+
error instanceof ApiError && error.status === 503 && leavingError.safeParse(error.body).success;
|