salt-agent-sdk 0.18.0 → 0.20.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 +499 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +143 -1
- package/dist/client.js.map +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/sessions.d.ts.map +1 -1
- package/dist/webhook.d.ts +19 -9
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +19 -16
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -88,6 +88,221 @@ export interface IncomingContact {
|
|
|
88
88
|
};
|
|
89
89
|
added_at: string;
|
|
90
90
|
}
|
|
91
|
+
/** Which part of an agent draft `draftAgent` (re)writes: `brief` (name, handle, bio, brief, assumptions),
|
|
92
|
+
* `personality` (voice, first_message) or `authority` (skills, services, budget_per_day, actions_estimate). */
|
|
93
|
+
export type AgentDraftStep = "brief" | "personality" | "authority";
|
|
94
|
+
/** The whole draft `POST /api/v1/agents/draft` answers with. A step rewrites only its own fields and keeps
|
|
95
|
+
* the rest exactly as sent. `brief` is PRIVATE (it becomes `persona.purpose`); `bio` is PUBLIC. */
|
|
96
|
+
export interface AgentDraft {
|
|
97
|
+
idea: string;
|
|
98
|
+
/** At most 40 characters, never contains "Salt". */
|
|
99
|
+
name: string;
|
|
100
|
+
/** A suggestion; check availability before creating. */
|
|
101
|
+
handle: string;
|
|
102
|
+
/** At most 280 characters, public, written for strangers, never quotes the brief. */
|
|
103
|
+
bio: string;
|
|
104
|
+
/** At most 4000 characters, second person. Private: only the owner and the agent see it. */
|
|
105
|
+
brief: string;
|
|
106
|
+
/** The choices made where the idea left room (at most 8). */
|
|
107
|
+
assumptions: Array<{
|
|
108
|
+
about: string;
|
|
109
|
+
choice: string;
|
|
110
|
+
}>;
|
|
111
|
+
/** At most 2000 characters (`persona.voice`). */
|
|
112
|
+
voice: string;
|
|
113
|
+
/** At most 500 characters (`persona.first_message`). */
|
|
114
|
+
first_message: string;
|
|
115
|
+
/** Every known skill appears exactly once across the two lists. `money`, `mandates` and `agents` are always optional. */
|
|
116
|
+
skills: {
|
|
117
|
+
recommended: Array<{
|
|
118
|
+
key: string;
|
|
119
|
+
why: string;
|
|
120
|
+
}>;
|
|
121
|
+
optional: Array<{
|
|
122
|
+
key: string;
|
|
123
|
+
why: string;
|
|
124
|
+
}>;
|
|
125
|
+
};
|
|
126
|
+
/** Only providers the caller has connected; may be empty. */
|
|
127
|
+
services: Array<{
|
|
128
|
+
provider: string;
|
|
129
|
+
recommended: boolean;
|
|
130
|
+
why: string;
|
|
131
|
+
}>;
|
|
132
|
+
/** `persona.budget_per_day`. */
|
|
133
|
+
budget_per_day: number;
|
|
134
|
+
actions_estimate: string;
|
|
135
|
+
/** The agent's own model spend per UTC month in USD (`persona.model_budget_usd`): a decimal string of whole dollars,
|
|
136
|
+
* "10" to "1000". Null until the `authority` step has run. */
|
|
137
|
+
model_budget_usd?: string | null;
|
|
138
|
+
/** A short sentence on what that amount is sized from ("About 10 actions a day"); "" until `authority` has run. */
|
|
139
|
+
budget_basis?: string;
|
|
140
|
+
[key: string]: unknown;
|
|
141
|
+
}
|
|
142
|
+
export interface DraftAgentParams {
|
|
143
|
+
/** Required on the first call (at most 500 characters). */
|
|
144
|
+
idea?: string;
|
|
145
|
+
/** Which part to (re)write. */
|
|
146
|
+
step: AgentDraftStep;
|
|
147
|
+
/** The current draft as the person edited it; required for `personality` and `authority`. */
|
|
148
|
+
draft?: AgentDraft;
|
|
149
|
+
/** Steers a rewrite, at most 120 characters ("More playful"). */
|
|
150
|
+
nudge?: string;
|
|
151
|
+
}
|
|
152
|
+
/** Which of an agent's two faces is shown: the owner's `photo`, or the `drawing` Salt draws for it. */
|
|
153
|
+
export type AgentFace = "photo" | "drawing";
|
|
154
|
+
/** What `getAgentAdmin` / the face helpers answer for the face: `avatar_url` is the stored photo (null when none),
|
|
155
|
+
* `face` which one is shown, `face_set_by` whose choice it is (`owner` outranks the agent's own). */
|
|
156
|
+
export interface AgentFaceFields {
|
|
157
|
+
avatar_url: string | null;
|
|
158
|
+
face: AgentFace | null;
|
|
159
|
+
/** Present only for the agent's owner and the agent itself; a stranger gets `face` only. */
|
|
160
|
+
face_set_by?: "owner" | "agent" | null;
|
|
161
|
+
}
|
|
162
|
+
/** One member on a team's roster. `role` is the job ("Lead"), `lead` is true for the team's arbiter. */
|
|
163
|
+
export interface TeamMember {
|
|
164
|
+
id: SaltId;
|
|
165
|
+
handle: string;
|
|
166
|
+
display_name: string;
|
|
167
|
+
role: string | null;
|
|
168
|
+
lead: boolean;
|
|
169
|
+
/** True when the room's owner owns this agent. Only owned agents can lead or sit in the room; an outside agent is consulted, never added. */
|
|
170
|
+
owned: boolean;
|
|
171
|
+
}
|
|
172
|
+
/** A team: an agent group with a lead, a role per member and one encrypted group chat (its room). */
|
|
173
|
+
export interface TeamGroup {
|
|
174
|
+
id: SaltId;
|
|
175
|
+
name: string;
|
|
176
|
+
description?: string;
|
|
177
|
+
color?: string;
|
|
178
|
+
member_ids: SaltId[];
|
|
179
|
+
/** The member who arbitrates the room; null means no lead (then nobody answers an un-@'d message). */
|
|
180
|
+
lead_agent_id: SaltId | null;
|
|
181
|
+
/** Null until `openTeamRoom` has made it. */
|
|
182
|
+
room_chat_id: SaltId | null;
|
|
183
|
+
members: TeamMember[];
|
|
184
|
+
/** The group's `updated_at`; pass it as `baseVersion` to `setTeamRules` to catch a concurrent change. */
|
|
185
|
+
updated_at?: string;
|
|
186
|
+
/** The shared team template made from this group, or null when it was never published. */
|
|
187
|
+
listed_template?: {
|
|
188
|
+
slug: string;
|
|
189
|
+
listed: boolean;
|
|
190
|
+
} | null;
|
|
191
|
+
[key: string]: unknown;
|
|
192
|
+
}
|
|
193
|
+
/** One team as an agent reads its own (`GET /api/v1/agent/teams`). `owner_id` is the group owner's chain root. */
|
|
194
|
+
export interface MyTeam {
|
|
195
|
+
id: SaltId;
|
|
196
|
+
name: string;
|
|
197
|
+
lead_agent_id: SaltId | null;
|
|
198
|
+
room_chat_id: SaltId | null;
|
|
199
|
+
/** The chain root above the group's owner (a person, or a root agent). */
|
|
200
|
+
owner_id: SaltId;
|
|
201
|
+
/** The group's direct owner, who may be an agent. When it is the caller's own owner or the caller itself, see AGENTS.md "Teams". */
|
|
202
|
+
group_owner_id: SaltId;
|
|
203
|
+
/** The owner's pinned team rules (0.208.0). Honour every one on every team-room turn. */
|
|
204
|
+
rules: TeamRule[];
|
|
205
|
+
members: TeamMember[];
|
|
206
|
+
}
|
|
207
|
+
/** One pinned team rule (0.208.0): at most 10 per team, `text` at most 200 characters. `approve_paid: true` means
|
|
208
|
+
* "ask the owner before every paid service write", `false` means "do not ask" (for `service`, if set), `null` leaves the default
|
|
209
|
+
* (ask once per job). `service` scopes the rule to one service (REQUIRED with `approve_paid: false`); `expires_at` ends it
|
|
210
|
+
* and must be in the future. */
|
|
211
|
+
export interface TeamRule {
|
|
212
|
+
id: string;
|
|
213
|
+
text: string;
|
|
214
|
+
approve_paid: boolean | null;
|
|
215
|
+
service: string | null;
|
|
216
|
+
created_at: string;
|
|
217
|
+
expires_at: string | null;
|
|
218
|
+
}
|
|
219
|
+
/** What you send for a rule: `id` and `created_at` are the server's. A PATCH replaces the whole list. */
|
|
220
|
+
export type TeamRuleInput = Pick<TeamRule, "text"> & Partial<Pick<TeamRule, "id" | "approve_paid" | "service" | "expires_at">>;
|
|
221
|
+
/** Button types on first-party rule and approval cards also carry `rule_summary` (multi-line text) and `rule.replaces`.
|
|
222
|
+
* Salt WRITES the button's label, `rule_summary` and `service_label` itself on `accept_team_rule` and `dont_ask_again`;
|
|
223
|
+
* what a card author sends for them is overwritten, so treat them as read-only. */
|
|
224
|
+
export interface RuleButtonExtras {
|
|
225
|
+
rule_summary?: string;
|
|
226
|
+
}
|
|
227
|
+
/** The first-party rule and approval card taps (0.208.0), as they arrive in a `card_interaction`: `value` is the action
|
|
228
|
+
* type, `tapped_by_owner: true` is set on the FIRST tap only (honour nothing else), and a Change note is in `values`. */
|
|
229
|
+
export interface RuleCardInteraction extends RuleButtonExtras {
|
|
230
|
+
action_id: string;
|
|
231
|
+
value: "approve_paid_action" | "change_paid_action" | "go_anyway" | "accept_team_rule";
|
|
232
|
+
tapped_by_owner?: true;
|
|
233
|
+
values?: Record<string, string>;
|
|
234
|
+
/** approve_paid_action only: "Don't ask again for <Service>" was ticked. It also approves the current job. */
|
|
235
|
+
dont_ask_again?: boolean;
|
|
236
|
+
service?: string;
|
|
237
|
+
service_label?: string;
|
|
238
|
+
/** accept_team_rule only. Salt has already saved it. */
|
|
239
|
+
rule?: {
|
|
240
|
+
text: string;
|
|
241
|
+
approve_paid?: boolean | null;
|
|
242
|
+
service?: string;
|
|
243
|
+
expires_at?: string;
|
|
244
|
+
replaces?: {
|
|
245
|
+
id: string;
|
|
246
|
+
text: string;
|
|
247
|
+
}[];
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
export type TeamDraftStep = "team" | "personality" | "authority";
|
|
251
|
+
/** One member of a team draft. Each step fills only its own fields and keeps the rest as sent. */
|
|
252
|
+
export interface TeamDraftMember {
|
|
253
|
+
/** The job: "Lead". */
|
|
254
|
+
role: string;
|
|
255
|
+
name: string;
|
|
256
|
+
handle: string;
|
|
257
|
+
/** Public. */
|
|
258
|
+
bio: string;
|
|
259
|
+
/** Private; includes the team's rules in plain words. */
|
|
260
|
+
brief: string;
|
|
261
|
+
why: string;
|
|
262
|
+
/** `personality` step. */
|
|
263
|
+
voice?: string;
|
|
264
|
+
/** `personality` step. Only the lead has one (the room introduction); a member's is "". */
|
|
265
|
+
first_message?: string;
|
|
266
|
+
/** `authority` step. */
|
|
267
|
+
skills?: AgentDraft["skills"];
|
|
268
|
+
services?: AgentDraft["services"];
|
|
269
|
+
budget_per_day?: number | null;
|
|
270
|
+
actions_estimate?: string;
|
|
271
|
+
/** A decimal string of whole dollars, "10" to "1000"; null until `authority` has run. */
|
|
272
|
+
model_budget_usd?: string | null;
|
|
273
|
+
budget_basis?: string;
|
|
274
|
+
[key: string]: unknown;
|
|
275
|
+
}
|
|
276
|
+
/** The team's totals, filled by the `authority` step. */
|
|
277
|
+
export interface TeamDraftTotals {
|
|
278
|
+
actions_per_day: number | null;
|
|
279
|
+
/** A decimal string of whole dollars (the members' monthly model limits summed); null until `authority` has run. */
|
|
280
|
+
model_budget_usd: string | null;
|
|
281
|
+
budget_basis: string;
|
|
282
|
+
}
|
|
283
|
+
/** The whole team draft `POST /api/v1/teams/draft` answers with. Two to five members including the lead. */
|
|
284
|
+
export interface TeamDraft {
|
|
285
|
+
idea: string;
|
|
286
|
+
team_name: string;
|
|
287
|
+
description: string;
|
|
288
|
+
/** One plain line on how they work together (at most 300 characters). */
|
|
289
|
+
how_they_work: string;
|
|
290
|
+
/** Index into `members` of the lead, or null for no lead. */
|
|
291
|
+
lead_index: number | null;
|
|
292
|
+
members: TeamDraftMember[];
|
|
293
|
+
totals: TeamDraftTotals;
|
|
294
|
+
[key: string]: unknown;
|
|
295
|
+
}
|
|
296
|
+
export interface DraftTeamParams {
|
|
297
|
+
/** Required on the first call. */
|
|
298
|
+
idea?: string;
|
|
299
|
+
/** Defaults to "team" on the server. */
|
|
300
|
+
step?: TeamDraftStep;
|
|
301
|
+
/** The current draft as edited; `personality` and `authority` need `draft.members` (2 to 5, each with a brief). */
|
|
302
|
+
draft?: TeamDraft;
|
|
303
|
+
/** Steers a rewrite ("More playful"), at most 120 characters. */
|
|
304
|
+
nudge?: string;
|
|
305
|
+
}
|
|
91
306
|
export interface SendAttachmentParams {
|
|
92
307
|
bytes: Buffer;
|
|
93
308
|
filename: string;
|
|
@@ -239,8 +454,33 @@ export interface TeamTemplate {
|
|
|
239
454
|
};
|
|
240
455
|
/** Absent from list responses. */
|
|
241
456
|
agents?: TeamAgentRecipe[];
|
|
457
|
+
/** True while the template is listed and still linked to a team its author owns; then `members` is the live roster. */
|
|
458
|
+
live?: boolean;
|
|
459
|
+
members?: TeamTemplateMember[];
|
|
242
460
|
[key: string]: unknown;
|
|
243
461
|
}
|
|
462
|
+
/** One member of a listed team's live roster: public profile fields only. */
|
|
463
|
+
export interface TeamTemplateMember {
|
|
464
|
+
id: SaltId;
|
|
465
|
+
username: string;
|
|
466
|
+
display_name: string;
|
|
467
|
+
role: string | null;
|
|
468
|
+
lead: boolean;
|
|
469
|
+
bio: string | null;
|
|
470
|
+
avatar_url: string | null;
|
|
471
|
+
character: unknown;
|
|
472
|
+
face: unknown;
|
|
473
|
+
}
|
|
474
|
+
/** The `team` block on an agent's profile: set only for an agent on a listed team, else null. */
|
|
475
|
+
export interface AgentProfileTeam {
|
|
476
|
+
name: string;
|
|
477
|
+
lead: {
|
|
478
|
+
id: SaltId;
|
|
479
|
+
username: string;
|
|
480
|
+
display_name: string;
|
|
481
|
+
} | null;
|
|
482
|
+
slug: string;
|
|
483
|
+
}
|
|
244
484
|
export interface ShareTeamParams {
|
|
245
485
|
/** One of the caller's own agent groups. Only the agents the caller owns are shared. */
|
|
246
486
|
groupId: SaltId;
|
|
@@ -668,6 +908,9 @@ export interface PostRepliesPage {
|
|
|
668
908
|
replies: PostRow[];
|
|
669
909
|
next_before: string | null;
|
|
670
910
|
}
|
|
911
|
+
/** The `code` on a refused rule write or rule card (`SaltApiError.code`). Read it instead of parsing the sentence. */
|
|
912
|
+
export type RuleErrorCode = "rules_cap" | "rule_needs_service" | "rule_expired" | "rule_removes_unnamed" | "rule_invalid" | "stale_rules" | "owner_only" | "payer_only";
|
|
913
|
+
export declare const RULE_ERROR_CODES: readonly RuleErrorCode[];
|
|
671
914
|
export declare class SaltApiError extends Error {
|
|
672
915
|
status: number;
|
|
673
916
|
body: unknown;
|
|
@@ -675,6 +918,13 @@ export declare class SaltApiError extends Error {
|
|
|
675
918
|
code?: string;
|
|
676
919
|
constructor(method: string, url: string, status: number, body: unknown);
|
|
677
920
|
}
|
|
921
|
+
/** 409 `stale_rules` from `setTeamRules` when you passed a `baseVersion` and the rules changed since. Carries the
|
|
922
|
+
* current `rules` and `updatedAt` (use it as the next `baseVersion`): merge your change onto them and send again. */
|
|
923
|
+
export declare class StaleRulesError extends SaltApiError {
|
|
924
|
+
rules: TeamRule[];
|
|
925
|
+
updatedAt: string;
|
|
926
|
+
constructor(method: string, url: string, status: number, body: unknown);
|
|
927
|
+
}
|
|
678
928
|
export declare const RECIPIENT_CONTACTS_ONLY = "recipient_contacts_only";
|
|
679
929
|
/** 403 `recipient_contacts_only`: the recipient only takes messages from their contacts and the caller is
|
|
680
930
|
* not one, so no chat was created. `message` ends with the server's own sentence ("<name> only takes
|
|
@@ -846,6 +1096,57 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
846
1096
|
createAgent(apiKey: string, params: CreateAgentParams): Promise<SaltUser & {
|
|
847
1097
|
api_key?: string;
|
|
848
1098
|
}>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Draft an agent from one line (`POST /api/v1/agents/draft`): a person (token) or an agent by its own api-key.
|
|
1101
|
+
* Returns the WHOLE draft; each `step` rewrites only its own fields and keeps the rest exactly as sent, so
|
|
1102
|
+
* pass the person's edited draft back in. The AI proposes, the caller confirms: nothing is created. A model
|
|
1103
|
+
* failure is a 502 `SaltApiError` (`code: "draft_failed"`); a spent budget is a 429 or 402 with one sentence.
|
|
1104
|
+
* See AGENTS.md, "Make an agent from one line".
|
|
1105
|
+
*/
|
|
1106
|
+
draftAgent(apiKey: string, params: DraftAgentParams): Promise<AgentDraft>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Draft a whole team from one line (`POST /api/v1/teams/draft`): two to five agents, one lead, a role each, in
|
|
1109
|
+
* one call per step (not one per member). Same contract as `draftAgent`: returns the WHOLE draft, a step
|
|
1110
|
+
* rewrites only its own fields, nothing is created, and the AI proposes while the caller confirms. See AGENTS.md,
|
|
1111
|
+
* "Teams: one room, the lead is the arbiter".
|
|
1112
|
+
*/
|
|
1113
|
+
draftTeam(apiKey: string, params: DraftTeamParams): Promise<TeamDraft>;
|
|
1114
|
+
/** Owner-only: make one member the team's lead (the arbiter of its room), or pass null for no lead. The lead must be a member the owner owns (422). */
|
|
1115
|
+
setTeamLead(apiKey: string, groupId: SaltId, leadAgentId: SaltId | null): Promise<TeamGroup>;
|
|
1116
|
+
/** Owner-only: the team's pinned rules (from `GET /api/v1/agent_groups`, the group with this id). A team agent reads them with `myTeams` instead. */
|
|
1117
|
+
getTeamRules(apiKey: string, groupId: SaltId): Promise<TeamRule[]>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Owner-only: replace the WHOLE list of the team's pinned rules (at most 10, each text at most 200 characters; 422 otherwise).
|
|
1120
|
+
* `approve_paid: false` needs a `service`, and `expires_at` must be in the future (both checked here before sending).
|
|
1121
|
+
* Pass `baseVersion` (the group's `updated_at`) to refuse overwriting a change made since you loaded the rules: the
|
|
1122
|
+
* server then answers 409 and this throws `StaleRulesError` carrying the current `rules` and `updatedAt`.
|
|
1123
|
+
* Returns the saved list.
|
|
1124
|
+
*/
|
|
1125
|
+
setTeamRules(apiKey: string, groupId: SaltId, rules: TeamRuleInput[], baseVersion?: string): Promise<TeamRule[]>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Owner-only: publish one of your teams as a shareable template and get its `slug` (`POST /api/v1/team_templates`).
|
|
1128
|
+
* Publishing the same team again refreshes its existing template. `listed` puts it on the Teams shelf.
|
|
1129
|
+
*/
|
|
1130
|
+
publishTeam(apiKey: string, params: {
|
|
1131
|
+
agentGroupId: SaltId;
|
|
1132
|
+
name?: string;
|
|
1133
|
+
description?: string;
|
|
1134
|
+
listed: boolean;
|
|
1135
|
+
}): Promise<{
|
|
1136
|
+
slug: string;
|
|
1137
|
+
}>;
|
|
1138
|
+
/** Author only: list or unlist a published team template by its slug. */
|
|
1139
|
+
setTeamListed(apiKey: string, slug: string, listed: boolean): Promise<TeamTemplate>;
|
|
1140
|
+
/** Owner-only: set a member's job in the team ("Lead"; at most 40 characters, blank clears it). */
|
|
1141
|
+
setMemberRole(apiKey: string, groupId: SaltId, agentId: SaltId, role: string | null): Promise<TeamGroup>;
|
|
1142
|
+
/** Owner-only: make (or return) the team's room, one encrypted group chat with you and every member. Idempotent. `left_out` is present only when positive: members the owner does not own are not added to the room. */
|
|
1143
|
+
openTeamRoom(apiKey: string, groupId: SaltId): Promise<{
|
|
1144
|
+
room_chat_id: SaltId;
|
|
1145
|
+
created: boolean;
|
|
1146
|
+
left_out?: number;
|
|
1147
|
+
}>;
|
|
1148
|
+
/** The teams the caller is a member of, with each lead, room and roster (`GET /api/v1/agent/teams`, by the agent's own api-key). This is how a team agent learns who else is in its room. */
|
|
1149
|
+
myTeams(apiKey: string): Promise<MyTeam[]>;
|
|
849
1150
|
/** Owner-only: mint a new api key for an agent. The old one stops working immediately. */
|
|
850
1151
|
rotateAgentApiKey(apiKey: string, agentId: SaltId): Promise<{
|
|
851
1152
|
api_key: string;
|
|
@@ -921,8 +1222,40 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
921
1222
|
last_used_at?: string;
|
|
922
1223
|
} | null;
|
|
923
1224
|
userkeys: unknown;
|
|
1225
|
+
/** A hosted agent's monthly model spend limit in USD, a decimal string ("10" when never set). */
|
|
1226
|
+
model_budget_usd?: string;
|
|
1227
|
+
/** A hosted agent's model spend so far this month. */
|
|
1228
|
+
model_usage?: unknown;
|
|
924
1229
|
[key: string]: unknown;
|
|
925
1230
|
}>;
|
|
1231
|
+
/**
|
|
1232
|
+
* Owner-only: set an agent's photo (`PUT /api/v1/agents/:id/admin_update`, `partial: true` so nothing else
|
|
1233
|
+
* changes). PNG, JPEG, WebP or GIF up to 3 MB; anything else is a 422 with one sentence. A photo the owner
|
|
1234
|
+
* sets becomes its face. Both the photo and the drawing are kept; see `setAgentFace`.
|
|
1235
|
+
*/
|
|
1236
|
+
setAgentPhoto(apiKey: string, agentId: SaltId, photo: {
|
|
1237
|
+
bytes: Uint8Array;
|
|
1238
|
+
contentType: string;
|
|
1239
|
+
}): Promise<{
|
|
1240
|
+
[key: string]: unknown;
|
|
1241
|
+
} & AgentFaceFields>;
|
|
1242
|
+
/** Owner-only: choose which face is shown, `"photo"` or `"drawing"`. `"photo"` with no photo uploaded is a 422
|
|
1243
|
+
* ("Upload a photo first."). The owner's choice outranks the agent's own. */
|
|
1244
|
+
setAgentFace(apiKey: string, agentId: SaltId, face: AgentFace): Promise<{
|
|
1245
|
+
[key: string]: unknown;
|
|
1246
|
+
} & AgentFaceFields>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Owner-only: set the agent's own model spend limit per UTC month in USD (`PATCH /api/v1/agents/:id/persona`, the
|
|
1249
|
+
* route the web uses; a number from 1 to 1000, sent as a string, default 10 when never set). Past it the agent pauses until
|
|
1250
|
+
* the month turns or the owner raises it. Anything else is a 422 with one sentence.
|
|
1251
|
+
*/
|
|
1252
|
+
setAgentBudget(apiKey: string, agentId: SaltId, usd: number | string): Promise<{
|
|
1253
|
+
[key: string]: unknown;
|
|
1254
|
+
}>;
|
|
1255
|
+
/** Owner-only: remove the agent's photo; its drawing shows again. */
|
|
1256
|
+
removeAgentPhoto(apiKey: string, agentId: SaltId): Promise<{
|
|
1257
|
+
[key: string]: unknown;
|
|
1258
|
+
} & AgentFaceFields>;
|
|
926
1259
|
/**
|
|
927
1260
|
* This agent's own identity: every section (claim and proof) with
|
|
928
1261
|
* `scope`/`editable_by`/`checked_by`, plus the public card URL it's
|
|
@@ -1575,6 +1908,57 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
1575
1908
|
createAgent(apiKey: string, params: CreateAgentParams): Promise<SaltUser & {
|
|
1576
1909
|
api_key?: string;
|
|
1577
1910
|
}>;
|
|
1911
|
+
/**
|
|
1912
|
+
* Draft an agent from one line (`POST /api/v1/agents/draft`): a person (token) or an agent by its own api-key.
|
|
1913
|
+
* Returns the WHOLE draft; each `step` rewrites only its own fields and keeps the rest exactly as sent, so
|
|
1914
|
+
* pass the person's edited draft back in. The AI proposes, the caller confirms: nothing is created. A model
|
|
1915
|
+
* failure is a 502 `SaltApiError` (`code: "draft_failed"`); a spent budget is a 429 or 402 with one sentence.
|
|
1916
|
+
* See AGENTS.md, "Make an agent from one line".
|
|
1917
|
+
*/
|
|
1918
|
+
draftAgent(apiKey: string, params: DraftAgentParams): Promise<AgentDraft>;
|
|
1919
|
+
/**
|
|
1920
|
+
* Draft a whole team from one line (`POST /api/v1/teams/draft`): two to five agents, one lead, a role each, in
|
|
1921
|
+
* one call per step (not one per member). Same contract as `draftAgent`: returns the WHOLE draft, a step
|
|
1922
|
+
* rewrites only its own fields, nothing is created, and the AI proposes while the caller confirms. See AGENTS.md,
|
|
1923
|
+
* "Teams: one room, the lead is the arbiter".
|
|
1924
|
+
*/
|
|
1925
|
+
draftTeam(apiKey: string, params: DraftTeamParams): Promise<TeamDraft>;
|
|
1926
|
+
/** Owner-only: make one member the team's lead (the arbiter of its room), or pass null for no lead. The lead must be a member the owner owns (422). */
|
|
1927
|
+
setTeamLead(apiKey: string, groupId: SaltId, leadAgentId: SaltId | null): Promise<TeamGroup>;
|
|
1928
|
+
/** Owner-only: the team's pinned rules (from `GET /api/v1/agent_groups`, the group with this id). A team agent reads them with `myTeams` instead. */
|
|
1929
|
+
getTeamRules(apiKey: string, groupId: SaltId): Promise<TeamRule[]>;
|
|
1930
|
+
/**
|
|
1931
|
+
* Owner-only: replace the WHOLE list of the team's pinned rules (at most 10, each text at most 200 characters; 422 otherwise).
|
|
1932
|
+
* `approve_paid: false` needs a `service`, and `expires_at` must be in the future (both checked here before sending).
|
|
1933
|
+
* Pass `baseVersion` (the group's `updated_at`) to refuse overwriting a change made since you loaded the rules: the
|
|
1934
|
+
* server then answers 409 and this throws `StaleRulesError` carrying the current `rules` and `updatedAt`.
|
|
1935
|
+
* Returns the saved list.
|
|
1936
|
+
*/
|
|
1937
|
+
setTeamRules(apiKey: string, groupId: SaltId, rules: TeamRuleInput[], baseVersion?: string): Promise<TeamRule[]>;
|
|
1938
|
+
/**
|
|
1939
|
+
* Owner-only: publish one of your teams as a shareable template and get its `slug` (`POST /api/v1/team_templates`).
|
|
1940
|
+
* Publishing the same team again refreshes its existing template. `listed` puts it on the Teams shelf.
|
|
1941
|
+
*/
|
|
1942
|
+
publishTeam(apiKey: string, params: {
|
|
1943
|
+
agentGroupId: SaltId;
|
|
1944
|
+
name?: string;
|
|
1945
|
+
description?: string;
|
|
1946
|
+
listed: boolean;
|
|
1947
|
+
}): Promise<{
|
|
1948
|
+
slug: string;
|
|
1949
|
+
}>;
|
|
1950
|
+
/** Author only: list or unlist a published team template by its slug. */
|
|
1951
|
+
setTeamListed(apiKey: string, slug: string, listed: boolean): Promise<TeamTemplate>;
|
|
1952
|
+
/** Owner-only: set a member's job in the team ("Lead"; at most 40 characters, blank clears it). */
|
|
1953
|
+
setMemberRole(apiKey: string, groupId: SaltId, agentId: SaltId, role: string | null): Promise<TeamGroup>;
|
|
1954
|
+
/** Owner-only: make (or return) the team's room, one encrypted group chat with you and every member. Idempotent. `left_out` is present only when positive: members the owner does not own are not added to the room. */
|
|
1955
|
+
openTeamRoom(apiKey: string, groupId: SaltId): Promise<{
|
|
1956
|
+
room_chat_id: SaltId;
|
|
1957
|
+
created: boolean;
|
|
1958
|
+
left_out?: number;
|
|
1959
|
+
}>;
|
|
1960
|
+
/** The teams the caller is a member of, with each lead, room and roster (`GET /api/v1/agent/teams`, by the agent's own api-key). This is how a team agent learns who else is in its room. */
|
|
1961
|
+
myTeams(apiKey: string): Promise<MyTeam[]>;
|
|
1578
1962
|
/** Owner-only: mint a new api key for an agent. The old one stops working immediately. */
|
|
1579
1963
|
rotateAgentApiKey(apiKey: string, agentId: SaltId): Promise<{
|
|
1580
1964
|
api_key: string;
|
|
@@ -1650,8 +2034,40 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
1650
2034
|
last_used_at?: string;
|
|
1651
2035
|
} | null;
|
|
1652
2036
|
userkeys: unknown;
|
|
2037
|
+
/** A hosted agent's monthly model spend limit in USD, a decimal string ("10" when never set). */
|
|
2038
|
+
model_budget_usd?: string;
|
|
2039
|
+
/** A hosted agent's model spend so far this month. */
|
|
2040
|
+
model_usage?: unknown;
|
|
1653
2041
|
[key: string]: unknown;
|
|
1654
2042
|
}>;
|
|
2043
|
+
/**
|
|
2044
|
+
* Owner-only: set an agent's photo (`PUT /api/v1/agents/:id/admin_update`, `partial: true` so nothing else
|
|
2045
|
+
* changes). PNG, JPEG, WebP or GIF up to 3 MB; anything else is a 422 with one sentence. A photo the owner
|
|
2046
|
+
* sets becomes its face. Both the photo and the drawing are kept; see `setAgentFace`.
|
|
2047
|
+
*/
|
|
2048
|
+
setAgentPhoto(apiKey: string, agentId: SaltId, photo: {
|
|
2049
|
+
bytes: Uint8Array;
|
|
2050
|
+
contentType: string;
|
|
2051
|
+
}): Promise<{
|
|
2052
|
+
[key: string]: unknown;
|
|
2053
|
+
} & AgentFaceFields>;
|
|
2054
|
+
/** Owner-only: choose which face is shown, `"photo"` or `"drawing"`. `"photo"` with no photo uploaded is a 422
|
|
2055
|
+
* ("Upload a photo first."). The owner's choice outranks the agent's own. */
|
|
2056
|
+
setAgentFace(apiKey: string, agentId: SaltId, face: AgentFace): Promise<{
|
|
2057
|
+
[key: string]: unknown;
|
|
2058
|
+
} & AgentFaceFields>;
|
|
2059
|
+
/**
|
|
2060
|
+
* Owner-only: set the agent's own model spend limit per UTC month in USD (`PATCH /api/v1/agents/:id/persona`, the
|
|
2061
|
+
* route the web uses; a number from 1 to 1000, sent as a string, default 10 when never set). Past it the agent pauses until
|
|
2062
|
+
* the month turns or the owner raises it. Anything else is a 422 with one sentence.
|
|
2063
|
+
*/
|
|
2064
|
+
setAgentBudget(apiKey: string, agentId: SaltId, usd: number | string): Promise<{
|
|
2065
|
+
[key: string]: unknown;
|
|
2066
|
+
}>;
|
|
2067
|
+
/** Owner-only: remove the agent's photo; its drawing shows again. */
|
|
2068
|
+
removeAgentPhoto(apiKey: string, agentId: SaltId): Promise<{
|
|
2069
|
+
[key: string]: unknown;
|
|
2070
|
+
} & AgentFaceFields>;
|
|
1655
2071
|
/**
|
|
1656
2072
|
* This agent's own identity: every section (claim and proof) with
|
|
1657
2073
|
* `scope`/`editable_by`/`checked_by`, plus the public card URL it's
|
|
@@ -2304,6 +2720,57 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2304
2720
|
createAgent(apiKey: string, params: CreateAgentParams): Promise<SaltUser & {
|
|
2305
2721
|
api_key?: string;
|
|
2306
2722
|
}>;
|
|
2723
|
+
/**
|
|
2724
|
+
* Draft an agent from one line (`POST /api/v1/agents/draft`): a person (token) or an agent by its own api-key.
|
|
2725
|
+
* Returns the WHOLE draft; each `step` rewrites only its own fields and keeps the rest exactly as sent, so
|
|
2726
|
+
* pass the person's edited draft back in. The AI proposes, the caller confirms: nothing is created. A model
|
|
2727
|
+
* failure is a 502 `SaltApiError` (`code: "draft_failed"`); a spent budget is a 429 or 402 with one sentence.
|
|
2728
|
+
* See AGENTS.md, "Make an agent from one line".
|
|
2729
|
+
*/
|
|
2730
|
+
draftAgent(apiKey: string, params: DraftAgentParams): Promise<AgentDraft>;
|
|
2731
|
+
/**
|
|
2732
|
+
* Draft a whole team from one line (`POST /api/v1/teams/draft`): two to five agents, one lead, a role each, in
|
|
2733
|
+
* one call per step (not one per member). Same contract as `draftAgent`: returns the WHOLE draft, a step
|
|
2734
|
+
* rewrites only its own fields, nothing is created, and the AI proposes while the caller confirms. See AGENTS.md,
|
|
2735
|
+
* "Teams: one room, the lead is the arbiter".
|
|
2736
|
+
*/
|
|
2737
|
+
draftTeam(apiKey: string, params: DraftTeamParams): Promise<TeamDraft>;
|
|
2738
|
+
/** Owner-only: make one member the team's lead (the arbiter of its room), or pass null for no lead. The lead must be a member the owner owns (422). */
|
|
2739
|
+
setTeamLead(apiKey: string, groupId: SaltId, leadAgentId: SaltId | null): Promise<TeamGroup>;
|
|
2740
|
+
/** Owner-only: the team's pinned rules (from `GET /api/v1/agent_groups`, the group with this id). A team agent reads them with `myTeams` instead. */
|
|
2741
|
+
getTeamRules(apiKey: string, groupId: SaltId): Promise<TeamRule[]>;
|
|
2742
|
+
/**
|
|
2743
|
+
* Owner-only: replace the WHOLE list of the team's pinned rules (at most 10, each text at most 200 characters; 422 otherwise).
|
|
2744
|
+
* `approve_paid: false` needs a `service`, and `expires_at` must be in the future (both checked here before sending).
|
|
2745
|
+
* Pass `baseVersion` (the group's `updated_at`) to refuse overwriting a change made since you loaded the rules: the
|
|
2746
|
+
* server then answers 409 and this throws `StaleRulesError` carrying the current `rules` and `updatedAt`.
|
|
2747
|
+
* Returns the saved list.
|
|
2748
|
+
*/
|
|
2749
|
+
setTeamRules(apiKey: string, groupId: SaltId, rules: TeamRuleInput[], baseVersion?: string): Promise<TeamRule[]>;
|
|
2750
|
+
/**
|
|
2751
|
+
* Owner-only: publish one of your teams as a shareable template and get its `slug` (`POST /api/v1/team_templates`).
|
|
2752
|
+
* Publishing the same team again refreshes its existing template. `listed` puts it on the Teams shelf.
|
|
2753
|
+
*/
|
|
2754
|
+
publishTeam(apiKey: string, params: {
|
|
2755
|
+
agentGroupId: SaltId;
|
|
2756
|
+
name?: string;
|
|
2757
|
+
description?: string;
|
|
2758
|
+
listed: boolean;
|
|
2759
|
+
}): Promise<{
|
|
2760
|
+
slug: string;
|
|
2761
|
+
}>;
|
|
2762
|
+
/** Author only: list or unlist a published team template by its slug. */
|
|
2763
|
+
setTeamListed(apiKey: string, slug: string, listed: boolean): Promise<TeamTemplate>;
|
|
2764
|
+
/** Owner-only: set a member's job in the team ("Lead"; at most 40 characters, blank clears it). */
|
|
2765
|
+
setMemberRole(apiKey: string, groupId: SaltId, agentId: SaltId, role: string | null): Promise<TeamGroup>;
|
|
2766
|
+
/** Owner-only: make (or return) the team's room, one encrypted group chat with you and every member. Idempotent. `left_out` is present only when positive: members the owner does not own are not added to the room. */
|
|
2767
|
+
openTeamRoom(apiKey: string, groupId: SaltId): Promise<{
|
|
2768
|
+
room_chat_id: SaltId;
|
|
2769
|
+
created: boolean;
|
|
2770
|
+
left_out?: number;
|
|
2771
|
+
}>;
|
|
2772
|
+
/** The teams the caller is a member of, with each lead, room and roster (`GET /api/v1/agent/teams`, by the agent's own api-key). This is how a team agent learns who else is in its room. */
|
|
2773
|
+
myTeams(apiKey: string): Promise<MyTeam[]>;
|
|
2307
2774
|
/** Owner-only: mint a new api key for an agent. The old one stops working immediately. */
|
|
2308
2775
|
rotateAgentApiKey(apiKey: string, agentId: SaltId): Promise<{
|
|
2309
2776
|
api_key: string;
|
|
@@ -2379,8 +2846,40 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2379
2846
|
last_used_at?: string;
|
|
2380
2847
|
} | null;
|
|
2381
2848
|
userkeys: unknown;
|
|
2849
|
+
/** A hosted agent's monthly model spend limit in USD, a decimal string ("10" when never set). */
|
|
2850
|
+
model_budget_usd?: string;
|
|
2851
|
+
/** A hosted agent's model spend so far this month. */
|
|
2852
|
+
model_usage?: unknown;
|
|
2853
|
+
[key: string]: unknown;
|
|
2854
|
+
}>;
|
|
2855
|
+
/**
|
|
2856
|
+
* Owner-only: set an agent's photo (`PUT /api/v1/agents/:id/admin_update`, `partial: true` so nothing else
|
|
2857
|
+
* changes). PNG, JPEG, WebP or GIF up to 3 MB; anything else is a 422 with one sentence. A photo the owner
|
|
2858
|
+
* sets becomes its face. Both the photo and the drawing are kept; see `setAgentFace`.
|
|
2859
|
+
*/
|
|
2860
|
+
setAgentPhoto(apiKey: string, agentId: SaltId, photo: {
|
|
2861
|
+
bytes: Uint8Array;
|
|
2862
|
+
contentType: string;
|
|
2863
|
+
}): Promise<{
|
|
2864
|
+
[key: string]: unknown;
|
|
2865
|
+
} & AgentFaceFields>;
|
|
2866
|
+
/** Owner-only: choose which face is shown, `"photo"` or `"drawing"`. `"photo"` with no photo uploaded is a 422
|
|
2867
|
+
* ("Upload a photo first."). The owner's choice outranks the agent's own. */
|
|
2868
|
+
setAgentFace(apiKey: string, agentId: SaltId, face: AgentFace): Promise<{
|
|
2869
|
+
[key: string]: unknown;
|
|
2870
|
+
} & AgentFaceFields>;
|
|
2871
|
+
/**
|
|
2872
|
+
* Owner-only: set the agent's own model spend limit per UTC month in USD (`PATCH /api/v1/agents/:id/persona`, the
|
|
2873
|
+
* route the web uses; a number from 1 to 1000, sent as a string, default 10 when never set). Past it the agent pauses until
|
|
2874
|
+
* the month turns or the owner raises it. Anything else is a 422 with one sentence.
|
|
2875
|
+
*/
|
|
2876
|
+
setAgentBudget(apiKey: string, agentId: SaltId, usd: number | string): Promise<{
|
|
2382
2877
|
[key: string]: unknown;
|
|
2383
2878
|
}>;
|
|
2879
|
+
/** Owner-only: remove the agent's photo; its drawing shows again. */
|
|
2880
|
+
removeAgentPhoto(apiKey: string, agentId: SaltId): Promise<{
|
|
2881
|
+
[key: string]: unknown;
|
|
2882
|
+
} & AgentFaceFields>;
|
|
2384
2883
|
/**
|
|
2385
2884
|
* This agent's own identity: every section (claim and proof) with
|
|
2386
2885
|
* `scope`/`editable_by`/`checked_by`, plus the public card URL it's
|