@tai42/api-client 19.3.0 → 20.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.
Files changed (36) hide show
  1. package/dist/client/auth-client.d.ts +51 -0
  2. package/dist/client/auth-client.d.ts.map +1 -1
  3. package/dist/client/auth-client.js +16 -0
  4. package/dist/client/auth-client.js.map +1 -1
  5. package/dist/client/conversations-client.d.ts +4 -4
  6. package/dist/client/index.d.ts +42 -12
  7. package/dist/client/index.d.ts.map +1 -1
  8. package/dist/client/notifications-client.d.ts +1 -8
  9. package/dist/client/notifications-client.d.ts.map +1 -1
  10. package/dist/generated/served-schemas.d.ts +1 -45
  11. package/dist/generated/served-schemas.d.ts.map +1 -1
  12. package/dist/generated/served-schemas.js +1 -27
  13. package/dist/generated/served-schemas.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/schemas/conversations.d.ts +7 -7
  18. package/dist/schemas/index.d.ts +1 -0
  19. package/dist/schemas/index.d.ts.map +1 -1
  20. package/dist/schemas/index.js +1 -0
  21. package/dist/schemas/index.js.map +1 -1
  22. package/dist/schemas/interactions.d.ts +4 -4
  23. package/dist/schemas/members.d.ts +154 -0
  24. package/dist/schemas/members.d.ts.map +1 -0
  25. package/dist/schemas/members.js +105 -0
  26. package/dist/schemas/members.js.map +1 -0
  27. package/dist/schemas/notifications.d.ts +2 -28
  28. package/dist/schemas/notifications.d.ts.map +1 -1
  29. package/dist/schemas/served.d.ts +1 -14
  30. package/dist/schemas/served.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/client/auth-client.ts +35 -0
  33. package/src/generated/served-schemas.ts +1 -45
  34. package/src/index.ts +8 -0
  35. package/src/schemas/index.ts +1 -0
  36. package/src/schemas/members.ts +121 -0
@@ -12,12 +12,6 @@ import { templatedText } from '../templated-text';
12
12
  export const hookSubject = z.object({ "key_expr": templatedText, "kind": z.string(), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1) }).strict();
13
13
  export type HookSubject = z.infer<typeof hookSubject>;
14
14
 
15
- export const mediaKind = z.enum(["image","link","document","video","audio"]);
16
- export type MediaKind = z.infer<typeof mediaKind>;
17
-
18
- export const mediaItem = z.object({ "caption": z.union([z.string(), z.null()]).default(null), "filename": z.union([z.string(), z.null()]).default(null), "kind": mediaKind, "url": z.string() });
19
- export type MediaItem = z.infer<typeof mediaItem>;
20
-
21
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) });
22
16
  export type OverlapPolicy = z.infer<typeof overlapPolicy>;
23
17
 
@@ -27,9 +21,6 @@ export type PresetSeedToolMeta = z.infer<typeof presetSeedToolMeta>;
27
21
  export const presetSpec = z.object({ "base_tool": z.string(), "description": z.string().default(""), "fixed_kwargs": z.record(z.string(), z.unknown()).default({}), "name": z.string() });
28
22
  export type PresetSpec = z.infer<typeof presetSpec>;
29
23
 
30
- export const quickReplyButtonParam = z.object({ "kind": z.literal("quick_reply").default("quick_reply"), "payload": z.string() });
31
- export type QuickReplyButtonParam = z.infer<typeof quickReplyButtonParam>;
32
-
33
24
  export const stateInjection = z.object({ "into": z.string().min(1), "jq": z.union([templatedText, z.null()]).default(null), "template_jq": z.union([z.string(), z.null()]).default(null) }).strict();
34
25
  export type StateInjection = z.infer<typeof stateInjection>;
35
26
 
@@ -54,48 +45,13 @@ export type StateTemplateReconcile = z.infer<typeof stateTemplateReconcile>;
54
45
  export const subAgentSpec: z.ZodType = z.lazy(() => z.object({ "description": z.string().default(""), "inline_skills": z.array(z.record(z.string(), z.unknown())).default([]), "name": z.string(), "presets": z.array(presetSpec).default([]), "response_format": z.union([z.unknown(), templatedText, z.record(z.string(), z.unknown()), z.null()]).default(null), "skills": z.array(z.string()).default([]), "strategy": z.union([z.string(), z.null()]).default(null), "subagents": z.array(subAgentSpec).default([]), "system_prompt": z.union([templatedText, z.null()]).default(null), "tool_names": z.array(z.string()).default([]), "tools": z.array(z.unknown()).default([]) }));
55
46
  export type SubAgentSpec = z.infer<typeof subAgentSpec>;
56
47
 
57
- export const urlButtonParam = z.object({ "kind": z.literal("url").default("url"), "url_parameter": z.string() });
58
- export type UrlButtonParam = z.infer<typeof urlButtonParam>;
59
-
60
48
  export const accessPolicy = z.object({ "condition": z.union([templatedText, z.null()]).default(null), "policy_data": z.record(z.string(), z.unknown()).default({}), "scopes": z.array(z.string()).default([]) });
61
49
  export type AccessPolicy = z.infer<typeof accessPolicy>;
62
50
 
63
51
  export const callbackSchema = z.object({ "carried_kwargs": z.record(z.string(), z.unknown()).default({}), "condition": z.union([templatedText, z.null()]).default(null), "expr": z.union([templatedText, z.null()]).default(null), "tool": z.string().default("") });
64
52
  export type CallbackSchema = z.infer<typeof callbackSchema>;
65
53
 
66
- export const channelTemplate = z.object({ "body_parameters": z.array(z.string()).default([]), "buttons": z.array(z.unknown().superRefine((x, ctx) => {
67
- const schemas = [quickReplyButtonParam, urlButtonParam];
68
- const { errors, failed } = schemas.reduce<{
69
- errors: z.core.$ZodIssue[];
70
- failed: number;
71
- }>(
72
- ({ errors, failed }, schema) =>
73
- ((result) =>
74
- result.error
75
- ? {
76
- errors: [...errors, ...result.error.issues],
77
- failed: failed + 1,
78
- }
79
- : { errors, failed })(
80
- schema.safeParse(x),
81
- ),
82
- { errors: [], failed: 0 },
83
- );
84
- const passed = schemas.length - failed;
85
- if (passed !== 1) {
86
- ctx.addIssue(errors.length ? {
87
- path: [],
88
- code: "invalid_union",
89
- errors: [errors],
90
- message: "Invalid input: Should pass single schema. Passed " + passed,
91
- } : {
92
- path: [],
93
- code: "custom",
94
- errors: [errors],
95
- message: "Invalid input: Should pass single schema. Passed " + passed,
96
- });
97
- }
98
- })).default([]), "header_media": z.union([mediaItem, z.null()]).default(null), "language": z.string(), "name": z.string() });
54
+ export const channelTemplate = z.object({ "language": z.string(), "name": z.string(), "parameters": z.union([z.record(z.string(), z.unknown()), z.null()]).default(null) });
99
55
  export type ChannelTemplate = z.infer<typeof channelTemplate>;
100
56
 
101
57
  export const conversationRoute = z.object({ "callback_secret": z.union([z.string(), z.null()]).default(null), "callback_url": z.union([z.string(), z.null()]).default(null), "cancel_expr": z.union([templatedText, z.null()]).default(null), "channel": z.union([z.string(), z.null()]).default(null), "door": z.enum(["api","channel"]), "error_reply_text": z.union([z.string().min(1).max(2000), z.null()]).default(null), "execution_key": z.string().min(1), "execution_key_fingerprint": z.string().min(1), "extras_expr": z.union([templatedText, z.null()]).default(null), "initial_mode": z.enum(["agent","manual"]).default("agent"), "locale": z.union([z.string(), z.null()]).default(null), "our_identity": z.union([z.string(), z.null()]).default(null), "overlap": overlapPolicy.default({"deliver":"one","running":"continue","settle_seconds":0}), "reply_expr": z.union([templatedText, z.null()]).default(null), "resume_expr": z.union([templatedText, z.null()]).default(null), "route_name": z.string(), "start_expr": z.union([templatedText, z.null()]).default(null), "target_kind": z.enum(["agent","tool"]), "target_name": z.string().min(1), "turns_per_hour_override": z.union([z.number().int().gt(0), z.null()]).default(null) });
package/src/index.ts CHANGED
@@ -142,6 +142,8 @@ export type {
142
142
  InteractionCancelled,
143
143
  InteractionMediaItem,
144
144
  InteractionsPage,
145
+ InviteRow,
146
+ InvokeMemberActionResult,
145
147
  KindStatus,
146
148
  LoginFormField,
147
149
  LoginMethod,
@@ -180,6 +182,12 @@ export type {
180
182
  McpEnvRefs,
181
183
  McpReloadResult,
182
184
  MediaKind,
185
+ MemberActionCatalog,
186
+ MemberActionDescriptor,
187
+ MemberActionScope,
188
+ MemberDirectory,
189
+ MemberPrincipalState,
190
+ MemberRow,
183
191
  MeProjection,
184
192
  Notification,
185
193
  Notifications,
@@ -15,6 +15,7 @@ export * from './interactions';
15
15
  export * from './login';
16
16
  export * from './manifest-mcp';
17
17
  export * from './marketplace';
18
+ export * from './members';
18
19
  export * from './notifications';
19
20
  export * from './observability';
20
21
  export * from './policy';
@@ -0,0 +1,121 @@
1
+ /** Member, invite, directory and member-action schemas for the generic Members view. */
2
+ import { z } from 'zod';
3
+
4
+ import { jsonSchema } from './shared';
5
+
6
+ /**
7
+ * Where a declared member action renders: a page-level button, a member-row menu
8
+ * item, or an invite-row menu item. A provider classifies each of its own actions
9
+ * into one of these three places; Studio only joins by `scope`, never reads the
10
+ * provider's meaning behind it.
11
+ */
12
+ export const memberActionScope = z.enum(['page', 'member_row', 'invite_row']);
13
+ export type MemberActionScope = z.infer<typeof memberActionScope>;
14
+
15
+ /**
16
+ * One platform principal a member holds (`GET /api/auth/members` →
17
+ * `members[].principals[]`). `user_id` is the platform principal id; `disabled` is
18
+ * taken from that principal's own record (the store the principals listing reads),
19
+ * never from a provider.
20
+ */
21
+ export const memberPrincipalState = z.object({
22
+ user_id: z.string(),
23
+ disabled: z.boolean(),
24
+ });
25
+ export type MemberPrincipalState = z.infer<typeof memberPrincipalState>;
26
+
27
+ /**
28
+ * One person an accounts provider owns, as the directory door returns them
29
+ * (`GET /api/auth/members` → `members[]`). `id` is the provider's stable handle for
30
+ * the person (a list key, not shown). `email` is the sign-in identity; `role` names
31
+ * the platform role the person holds (the NAME only — the role definition is read
32
+ * from the role listing). `principals` carries each principal's platform-joined
33
+ * state; `disabled` is derived True only when EVERY principal is disabled, so a
34
+ * person with any enabled principal still reads active while the per-principal truth
35
+ * stays visible. `handle` routes an invoke back to the producing provider and pins
36
+ * this row; `action_keys` are the opaque catalog keys of the actions applicable to
37
+ * it — Studio joins and echoes both, never parses them. `created_at` is an ISO-8601
38
+ * instant.
39
+ */
40
+ export const memberRow = z.object({
41
+ id: z.string(),
42
+ email: z.string(),
43
+ role: z.string(),
44
+ created_at: z.string(),
45
+ principals: z.array(memberPrincipalState),
46
+ disabled: z.boolean(),
47
+ handle: z.string(),
48
+ action_keys: z.array(z.string()),
49
+ });
50
+ export type MemberRow = z.infer<typeof memberRow>;
51
+
52
+ /**
53
+ * One outstanding invitation an accounts provider holds, as the directory door
54
+ * returns them (`GET /api/auth/members` → `invites[]`). `id` is the provider's
55
+ * stable handle for the invited person; `email` is the invited address; `role` names
56
+ * the platform role they will hold (name only, as on {@link memberRow}). An
57
+ * invitation holds no principal, so it carries no principal state. `handle` and
58
+ * `action_keys` are the opaque routing tokens (see {@link memberRow}). `created_at`
59
+ * and `expires_at` are ISO-8601 instants.
60
+ */
61
+ export const inviteRow = z.object({
62
+ id: z.string(),
63
+ email: z.string(),
64
+ role: z.string(),
65
+ created_at: z.string(),
66
+ expires_at: z.string(),
67
+ handle: z.string(),
68
+ action_keys: z.array(z.string()),
69
+ });
70
+ export type InviteRow = z.infer<typeof inviteRow>;
71
+
72
+ /**
73
+ * The deployment-wide membership (`GET /api/auth/members`): every accounts
74
+ * provider's people and outstanding invitations, aggregated and platform-joined by
75
+ * the backend into one view so a generic Members screen renders without naming any
76
+ * provider.
77
+ */
78
+ export const memberDirectory = z.object({
79
+ members: z.array(memberRow),
80
+ invites: z.array(inviteRow),
81
+ });
82
+ export type MemberDirectory = z.infer<typeof memberDirectory>;
83
+
84
+ /**
85
+ * One declared member action, serialized for the catalog (`GET
86
+ * /api/auth/member-actions` → `actions[]`). `key` is the opaque catalog key a caller
87
+ * joins and echoes, never parses. `label` is the resolved wording. `scope` places
88
+ * the action; `destructive` asks for a confirm before invoking. `input_schema` and
89
+ * `result_schema` are the declared models' JSON Schema — a caller renders an input
90
+ * form and a read-only result view from them generically, with no provider field
91
+ * name known to Studio.
92
+ */
93
+ export const memberActionDescriptor = z.object({
94
+ key: z.string(),
95
+ label: z.string(),
96
+ scope: memberActionScope,
97
+ destructive: z.boolean(),
98
+ input_schema: jsonSchema,
99
+ result_schema: jsonSchema,
100
+ });
101
+ export type MemberActionDescriptor = z.infer<typeof memberActionDescriptor>;
102
+
103
+ /**
104
+ * Every declared member action across the registered accounts providers (`GET
105
+ * /api/auth/member-actions`). ADMIN-ONLY (`secret`) — a non-admin projection never
106
+ * reaches the route, exactly as the members listing.
107
+ */
108
+ export const memberActionCatalog = z.object({
109
+ actions: z.array(memberActionDescriptor),
110
+ });
111
+ export type MemberActionCatalog = z.infer<typeof memberActionCatalog>;
112
+
113
+ /**
114
+ * The invoke-door result (`POST /api/auth/member-actions/invoke`): the provider's
115
+ * result-model dump, carried opaquely. `result` is rendered through the action's
116
+ * `result_schema`; Studio reads no field of it by name.
117
+ */
118
+ export const invokeMemberActionResult = z.object({
119
+ result: jsonSchema,
120
+ });
121
+ export type InvokeMemberActionResult = z.infer<typeof invokeMemberActionResult>;