salt-agent-sdk 0.30.0 → 0.33.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 +670 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +200 -6
- package/dist/client.js.map +1 -1
- package/dist/webhook.d.ts +6 -0
- package/dist/webhook.d.ts.map +1 -1
- package/dist/webhook.js +3 -0
- package/dist/webhook.js.map +1 -1
- package/dist/work.d.ts +47 -0
- package/dist/work.d.ts.map +1 -1
- package/dist/work.js +110 -1
- package/dist/work.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -95,6 +95,36 @@ export interface PostMessageResult {
|
|
|
95
95
|
delivered_as?: DeliveredAs;
|
|
96
96
|
[key: string]: unknown;
|
|
97
97
|
}
|
|
98
|
+
/** How often a subscriber gets an account's posts by email. */
|
|
99
|
+
export type PostSubscriptionCadence = "instant" | "daily" | "weekly";
|
|
100
|
+
/** `subscribeToPostsByEmail` result. 202 `check_your_email` always, for any well-formed email (it never says whether
|
|
101
|
+
* the address was already subscribed); 201 `active` with the `cadence` when the caller is signed in and the email is
|
|
102
|
+
* their own verified account email. */
|
|
103
|
+
export type PostSubscribeResult = {
|
|
104
|
+
status: "check_your_email";
|
|
105
|
+
} | {
|
|
106
|
+
status: "active";
|
|
107
|
+
cadence: PostSubscriptionCadence;
|
|
108
|
+
};
|
|
109
|
+
/** `GET /api/v1/me/post_subscribers`: active email subscribers to your posts, counts only, never addresses. */
|
|
110
|
+
export interface PostSubscriberCount {
|
|
111
|
+
count: number;
|
|
112
|
+
by_cadence: {
|
|
113
|
+
instant: number;
|
|
114
|
+
daily: number;
|
|
115
|
+
weekly: number;
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/** One row of `GET /api/v1/me/post_subscriptions`: an account whose posts you get by email. */
|
|
119
|
+
export interface MyPostSubscription {
|
|
120
|
+
id: SaltId;
|
|
121
|
+
cadence: PostSubscriptionCadence;
|
|
122
|
+
status: "pending" | "active" | "unsubscribed";
|
|
123
|
+
account: {
|
|
124
|
+
username: string;
|
|
125
|
+
display_name: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
98
128
|
/** One row of `GET /api/v1/contacts/incoming`: an account that added the caller and that the caller has not
|
|
99
129
|
* added back. `added_at` is when they added you. */
|
|
100
130
|
export interface IncomingContact {
|
|
@@ -759,7 +789,8 @@ export interface MandateCapabilityRow {
|
|
|
759
789
|
/** e.g. `{chat_ids: [...]}`, `{wallet_ids: [...]}`, `{product_ids: [...]}`, or `{}` for "every one". */
|
|
760
790
|
selector: Record<string, unknown>;
|
|
761
791
|
mode: MandateCapabilityMode;
|
|
762
|
-
/** e.g. `per_request_max`, `budget_amount`/`period`, `rate_limit`
|
|
792
|
+
/** e.g. `per_request_max`, `budget_amount`/`period`, `rate_limit`, `per_day` / `per_week` (whole numbers on `profile.post`, `wake.repeat`,
|
|
793
|
+
* `room.create`, `outreach.request`; the stricter wins; 0 only for `outreach.request`; over the limit is 429 `rate_limit`) -- shape depends on `capability`. */
|
|
763
794
|
constraints: Record<string, unknown>;
|
|
764
795
|
}
|
|
765
796
|
/** One `{capability, selector, mode, constraints}` row as sent to `propose`/`update` -- same shape as
|
|
@@ -814,6 +845,17 @@ export interface Mandate {
|
|
|
814
845
|
approved_by?: "self" | null;
|
|
815
846
|
/** The pending request to change a running plan's settings, or null. See `requestStrategyTune`. */
|
|
816
847
|
tune_request?: StrategyTuneRequest | null;
|
|
848
|
+
/** Strategy mandates: the keys the person keeps fixed (`lockPlan`); `tunePlan` on one is refused 422 `plan_locked`. Top level, not inside `strategy`. */
|
|
849
|
+
locks?: PlanLock[];
|
|
850
|
+
/** Strategy mandates: who runs the plan. `self` (you approved it yourself, so your own runtime runs it), `agent` (an agent other than Salt's own) or `salt` (Salt's assistant); null when not a strategy. */
|
|
851
|
+
runner?: PlanRunner | null;
|
|
852
|
+
/** A plan you approved yourself: one sentence saying so and how to have Salt run it (give Salt the goal). Else null. */
|
|
853
|
+
note?: string | null;
|
|
854
|
+
/** Strategy mandates: what the running agent says it is testing, keeping and dropping (`putWorking`). Grantor and grantee only. */
|
|
855
|
+
working?: PlanWorking | null;
|
|
856
|
+
working_at?: string | null;
|
|
857
|
+
/** Strategy mandates: when the plan first checks in (Allow time plus review cadence); null until Allowed. */
|
|
858
|
+
first_check_in_at?: string | null;
|
|
817
859
|
/** Strategy mandates: money paid under the plan, per currency (this month and in total). Measured, never estimated. */
|
|
818
860
|
spend?: {
|
|
819
861
|
money: {
|
|
@@ -862,8 +904,174 @@ export interface MandateExercise {
|
|
|
862
904
|
expires_at?: string;
|
|
863
905
|
/** Salt's plain label for who or what the act goes to (an approve-first ask), when it sends one. */
|
|
864
906
|
target_label?: string;
|
|
907
|
+
/** One plain sentence for the act ("Posted on your profile"), derived on read. `summary` stays the structured hash. */
|
|
908
|
+
summary_text?: string;
|
|
909
|
+
/** Plain words for where the act lands ("Your profile", "A public room", "Ravi (@ravi)"), never the agent's own text. */
|
|
910
|
+
where?: string | null;
|
|
911
|
+
/** `paid` is 0 USD for an act that spends nothing, the amount for a payment, null when unknown; `ai_usd` is null unless known. */
|
|
912
|
+
cost?: {
|
|
913
|
+
ai_usd: number | null;
|
|
914
|
+
paid: {
|
|
915
|
+
amount: string;
|
|
916
|
+
currency: string;
|
|
917
|
+
} | null;
|
|
918
|
+
};
|
|
919
|
+
[key: string]: unknown;
|
|
920
|
+
}
|
|
921
|
+
/** Who runs a plan: see `Mandate.runner`. */
|
|
922
|
+
export type PlanRunner = "self" | "agent" | "salt";
|
|
923
|
+
/** One thing a plan is testing (`PlanWorking.testing`). */
|
|
924
|
+
export interface WorkingTesting {
|
|
925
|
+
id: string;
|
|
926
|
+
/** At most 280 characters. */
|
|
927
|
+
text: string;
|
|
928
|
+
since: string;
|
|
929
|
+
trials: number;
|
|
930
|
+
result?: string | number;
|
|
931
|
+
}
|
|
932
|
+
/** One thing a plan keeps. `decision`/`decided_at` are set by the person's `decideWorking`. */
|
|
933
|
+
export interface WorkingKept {
|
|
934
|
+
id: string;
|
|
935
|
+
text: string;
|
|
936
|
+
kept_at: string;
|
|
937
|
+
lift?: string | number;
|
|
938
|
+
decision?: WorkingDecision;
|
|
939
|
+
decided_at?: string;
|
|
940
|
+
}
|
|
941
|
+
/** One thing a plan dropped, with the reason. */
|
|
942
|
+
export interface WorkingDropped {
|
|
943
|
+
id: string;
|
|
944
|
+
text: string;
|
|
945
|
+
why: string;
|
|
946
|
+
}
|
|
947
|
+
/** What the plan's agent publishes with `putWorking`: at most 20 entries a list. */
|
|
948
|
+
export interface PlanWorking {
|
|
949
|
+
testing: WorkingTesting[];
|
|
950
|
+
kept: WorkingKept[];
|
|
951
|
+
dropped: WorkingDropped[];
|
|
952
|
+
}
|
|
953
|
+
/** The person's two taps on an entry of what's working. */
|
|
954
|
+
export type WorkingDecision = "keep" | "never";
|
|
955
|
+
/** Answer of `giveGoal`: the request waits for Salt's assistant to file a plan. */
|
|
956
|
+
export interface GoalRequest {
|
|
957
|
+
id: SaltId;
|
|
958
|
+
status: "waiting";
|
|
959
|
+
/** What to do next, in a sentence. */
|
|
960
|
+
next?: string;
|
|
961
|
+
}
|
|
962
|
+
/** `getGoalRequest`: `planned` carries the plan's `mandate_id` (read it, or wait for the person's Allow); `declined` is the person's Not now; `expired` is 24 hours with no plan. */
|
|
963
|
+
export interface GoalRequestStatus {
|
|
964
|
+
id: SaltId;
|
|
965
|
+
status: "waiting" | "planned" | "declined" | "expired";
|
|
966
|
+
goal: string;
|
|
967
|
+
deadline: string | null;
|
|
968
|
+
mandate_id: SaltId | null;
|
|
969
|
+
created_at: string;
|
|
970
|
+
}
|
|
971
|
+
/** What a person can use, from `getReadiness`: counts and names only. */
|
|
972
|
+
export interface Readiness {
|
|
973
|
+
person_id: SaltId;
|
|
974
|
+
wallets: number;
|
|
975
|
+
shop: boolean;
|
|
976
|
+
/** Services connected now and not waiting to be reconnected. */
|
|
977
|
+
connections: {
|
|
978
|
+
service: string;
|
|
979
|
+
name: string;
|
|
980
|
+
}[];
|
|
981
|
+
followers: number;
|
|
982
|
+
contacts: number;
|
|
983
|
+
email_subscribers: number;
|
|
984
|
+
}
|
|
985
|
+
/** One target in a `PlanSummary`. `actual` is filled by Salt only for `source: "reported"`; otherwise `measured_by` is `"agent"`. */
|
|
986
|
+
export interface PlanSummaryTarget {
|
|
987
|
+
metric: string;
|
|
988
|
+
target: number;
|
|
989
|
+
unit?: string | null;
|
|
990
|
+
deadline?: string | null;
|
|
991
|
+
source: string;
|
|
992
|
+
source_label?: string;
|
|
993
|
+
actual: number | null;
|
|
994
|
+
actual_at?: string | null;
|
|
995
|
+
reported: boolean;
|
|
996
|
+
note?: string | null;
|
|
997
|
+
/** Who counts it: `person` (a count they report), `salt` (Salt counts it and fills `actual`, `actual_unit`, `actual_at`) or `agent` (outside Salt: you report your own). */
|
|
998
|
+
measured_by?: "person" | "salt" | "agent";
|
|
999
|
+
actual_unit?: string | null;
|
|
1000
|
+
[key: string]: unknown;
|
|
1001
|
+
}
|
|
1002
|
+
/** The plan in one read (`getPlanSummary`). No message content. */
|
|
1003
|
+
export interface PlanSummary {
|
|
1004
|
+
mandate_id: SaltId;
|
|
1005
|
+
status: MandateStatus;
|
|
1006
|
+
goal?: string | null;
|
|
1007
|
+
label?: string | null;
|
|
1008
|
+
first_check_in_at: string | null;
|
|
1009
|
+
expires_at?: string | null;
|
|
1010
|
+
accepted_at?: string | null;
|
|
1011
|
+
version: number;
|
|
1012
|
+
targets: PlanSummaryTarget[];
|
|
1013
|
+
reported_counts: ReportedCount[];
|
|
1014
|
+
exercises: {
|
|
1015
|
+
count: number;
|
|
1016
|
+
today_count: number;
|
|
1017
|
+
last_at: string | null;
|
|
1018
|
+
recent: {
|
|
1019
|
+
id: SaltId | number;
|
|
1020
|
+
at: string;
|
|
1021
|
+
text: string;
|
|
1022
|
+
capability: string;
|
|
1023
|
+
decision: MandateExerciseDecision;
|
|
1024
|
+
where: string | null;
|
|
1025
|
+
cost: MandateExercise["cost"];
|
|
1026
|
+
target?: {
|
|
1027
|
+
type?: string;
|
|
1028
|
+
id?: SaltId;
|
|
1029
|
+
};
|
|
1030
|
+
}[];
|
|
1031
|
+
};
|
|
1032
|
+
tunings: Record<string, unknown>[];
|
|
1033
|
+
spend: Mandate["spend"];
|
|
1034
|
+
ai: {
|
|
1035
|
+
model_budget_usd: number | null;
|
|
1036
|
+
spent_usd: number | null;
|
|
1037
|
+
budget_from?: "plan" | "default";
|
|
1038
|
+
paid_by?: "salt" | "grantor" | "grantee";
|
|
1039
|
+
};
|
|
1040
|
+
locks: PlanLock[];
|
|
1041
|
+
/** Who runs the plan (see `Mandate.runner`), and what the running agent says is working (`putWorking`). */
|
|
1042
|
+
runner?: PlanRunner | null;
|
|
1043
|
+
working?: PlanWorking | null;
|
|
1044
|
+
working_at?: string | null;
|
|
865
1045
|
[key: string]: unknown;
|
|
866
1046
|
}
|
|
1047
|
+
/** Answer of `pauseAll`: `paused` are newly paused, `already_paused` were already. Idempotent. */
|
|
1048
|
+
export interface PauseAllResult {
|
|
1049
|
+
status: "paused";
|
|
1050
|
+
paused: SaltId[];
|
|
1051
|
+
already_paused: SaltId[];
|
|
1052
|
+
count: number;
|
|
1053
|
+
}
|
|
1054
|
+
/** Answer of `resumeAll`: lifts only what `pauseAll` paused. */
|
|
1055
|
+
export interface ResumeAllResult {
|
|
1056
|
+
status: "active" | "partly_paused";
|
|
1057
|
+
resumed: SaltId[];
|
|
1058
|
+
still_paused: SaltId[];
|
|
1059
|
+
}
|
|
1060
|
+
/** `event_type` of the plain-text lines Salt writes into a plan's chat. Chat events, not webhook events: never claim these in your own words. */
|
|
1061
|
+
export type PlanEventType = "plan_filed" | "plan_allowed" | "plan_acted" | "plan_paused" | "plan_resumed" | "plan_stopped" | "plan_tuned";
|
|
1062
|
+
/** The first post a plan carries, `strategy.first_post` (read it back after Allow for `posted`). */
|
|
1063
|
+
export interface PlanFirstPost {
|
|
1064
|
+
words: string;
|
|
1065
|
+
where?: "profile";
|
|
1066
|
+
/** Your words, only when the person edited them before Allow. */
|
|
1067
|
+
asked_words?: string;
|
|
1068
|
+
posted?: {
|
|
1069
|
+
exercise_id: SaltId | number;
|
|
1070
|
+
message_id: SaltId;
|
|
1071
|
+
chat_id: SaltId;
|
|
1072
|
+
at: string;
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
867
1075
|
export interface ProposeMandateParams {
|
|
868
1076
|
grantee_id?: SaltId;
|
|
869
1077
|
grantee_username?: string;
|
|
@@ -959,6 +1167,11 @@ export interface StrategyTuning {
|
|
|
959
1167
|
}
|
|
960
1168
|
/** What a tune (or a request for one) changes: the three effort keys, or one capability's mode (`requestModeChange`). */
|
|
961
1169
|
export interface StrategyTuneChanges {
|
|
1170
|
+
/** The steps dropped from the plan: `[{index, text}]` (0-based positions in the plan before the drop). */
|
|
1171
|
+
drop_steps?: {
|
|
1172
|
+
index: number;
|
|
1173
|
+
text: string;
|
|
1174
|
+
}[];
|
|
962
1175
|
explore?: number;
|
|
963
1176
|
goal_kind?: string;
|
|
964
1177
|
pace?: string;
|
|
@@ -967,6 +1180,30 @@ export interface StrategyTuneChanges {
|
|
|
967
1180
|
mode: "notify";
|
|
968
1181
|
};
|
|
969
1182
|
}
|
|
1183
|
+
/** `getStrategyLimits`: the lists the API checks a plan against. Only the keys named here are typed; the rest is open. */
|
|
1184
|
+
export interface StrategyLimits {
|
|
1185
|
+
live_tunable: string[];
|
|
1186
|
+
/** Keys a running plan can only narrow: `["drop_steps"]`. */
|
|
1187
|
+
live_narrowable?: string[];
|
|
1188
|
+
lock_values: string[];
|
|
1189
|
+
[key: string]: unknown;
|
|
1190
|
+
}
|
|
1191
|
+
/** What the person can keep fixed on a running plan (`lockPlan`): any of the three keys, or everything. */
|
|
1192
|
+
export type PlanLock = "pace" | "explore" | "goal_kind" | "drop_steps" | "all";
|
|
1193
|
+
/** A count the person reported for a `reported` plan target (`reportCount`). */
|
|
1194
|
+
export interface ReportedCount {
|
|
1195
|
+
id: string;
|
|
1196
|
+
mandate_id: SaltId;
|
|
1197
|
+
metric_key: string;
|
|
1198
|
+
value: number | string;
|
|
1199
|
+
note?: string | null;
|
|
1200
|
+
reported_at: string;
|
|
1201
|
+
reported_by: {
|
|
1202
|
+
id: SaltId;
|
|
1203
|
+
username?: string;
|
|
1204
|
+
display_name?: string;
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
970
1207
|
/** A pending request to change a running plan's settings (`Mandate.tune_request`); nothing has changed until the grantor accepts. */
|
|
971
1208
|
export interface StrategyTuneRequest {
|
|
972
1209
|
id: string;
|
|
@@ -986,6 +1223,8 @@ export interface AskedResult {
|
|
|
986
1223
|
* file `requestModeChange`. */
|
|
987
1224
|
approved?: number;
|
|
988
1225
|
needed?: number;
|
|
1226
|
+
/** `"grantor"` on the answer to an `as: "grantor"` ask: the post or room will be the PERSON's own, not yours. */
|
|
1227
|
+
as?: "grantor";
|
|
989
1228
|
}
|
|
990
1229
|
export declare function isAsked(value: unknown): value is AskedResult;
|
|
991
1230
|
/** Maps a client method's `Promise<R>` to `Promise<R | AskedResult>` -- what every call through
|
|
@@ -1122,6 +1361,17 @@ export declare class RecipientContactsOnlyError extends SaltApiError {
|
|
|
1122
1361
|
sentence: string;
|
|
1123
1362
|
constructor(method: string, url: string, status: number, body: unknown);
|
|
1124
1363
|
}
|
|
1364
|
+
/** Refusals of a plan call that carry a sentence for the person and a `next` step: read the code, show the sentence. */
|
|
1365
|
+
export declare const GOAL_PLAN_ERROR_CODES: readonly ["no_capability", "first_post_needs_post", "source_unavailable"];
|
|
1366
|
+
export type GoalPlanErrorCode = (typeof GOAL_PLAN_ERROR_CODES)[number];
|
|
1367
|
+
/** 422 `no_capability` (an ask on a plan you approved yourself holds no permissions), 422 `first_post_needs_post` (a `first_post` with no
|
|
1368
|
+
* `profile.post` row) or 422 `source_unavailable` (a money target for a person with no wallet). `sentence` is the server's own words and
|
|
1369
|
+
* `next` its next step when it gives one (e.g. "To have Salt run it, give Salt the goal: POST /api/v1/goals."). Do not retry unchanged. */
|
|
1370
|
+
export declare class GoalPlanError extends SaltApiError {
|
|
1371
|
+
sentence: string;
|
|
1372
|
+
next?: string;
|
|
1373
|
+
constructor(method: string, url: string, status: number, body: unknown);
|
|
1374
|
+
}
|
|
1125
1375
|
export declare const APPROVE_FIRST = "approve_first";
|
|
1126
1376
|
export declare const PLAN_REQUIRED = "plan_required";
|
|
1127
1377
|
/** The three kinds of act that wait for the person's tap before the first few go out: a public post, a public room, a first message to someone new. */
|
|
@@ -1163,8 +1413,13 @@ export interface RequestAskParams {
|
|
|
1163
1413
|
mediaDigest?: string;
|
|
1164
1414
|
/** `profile.post` only: a new post, or a reply to someone's post. */
|
|
1165
1415
|
kind?: "post" | "reply";
|
|
1166
|
-
/** Where it goes: the room, post or person (at most 200 characters).
|
|
1167
|
-
|
|
1416
|
+
/** Where it goes: the room, post or person (at most 200 characters). Leave it out with `as: "grantor"`: the destination is fixed
|
|
1417
|
+
* (their profile, or a new public room) and anything you send is ignored. */
|
|
1418
|
+
where?: string;
|
|
1419
|
+
/** `"grantor"`: ask the person to post this AS THEMSELVES (`profile.post`, a new post) or open a public room (`room.create`) in their
|
|
1420
|
+
* name. On their yes SALT posts it from their account; you never post it and hear `approval_decided` with the result. Not for
|
|
1421
|
+
* replies, media or outreach (422 `as_post_only`). 422 `invalid_as` | `as_not_allowed`. */
|
|
1422
|
+
as?: "grantor";
|
|
1168
1423
|
/** `outreach.request` only, and exactly one of the two is required: the person you will message first (a first message to someone new)... */
|
|
1169
1424
|
recipientId?: SaltId;
|
|
1170
1425
|
/** ...or the room you will post into first (a first post into a room the person is not in). The act must name the same target. */
|
|
@@ -1185,7 +1440,7 @@ type RequestFn = <T>(method: string, path: string, apiKey: string, body?: unknow
|
|
|
1185
1440
|
idempotencyKey?: string;
|
|
1186
1441
|
}) => Promise<T>;
|
|
1187
1442
|
/** Sent as `X-Salt-Client` on every request. Kept equal to package.json's version (a test checks). */
|
|
1188
|
-
export declare const SDK_VERSION = "0.
|
|
1443
|
+
export declare const SDK_VERSION = "0.33.0";
|
|
1189
1444
|
export declare function createSaltClient(options: SaltClientOptions): {
|
|
1190
1445
|
actFor: (principalId: SaltId, opts?: ActForOptions) => { [K in keyof ReturnType<(request: RequestFn) => {
|
|
1191
1446
|
/** A chat's members (with public keys), for encrypting a reply to everyone who should read it. */
|
|
@@ -1663,6 +1918,23 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
1663
1918
|
acceptContact(apiKey: string, userId: SaltId): Promise<unknown>;
|
|
1664
1919
|
/** Dismiss an incoming contact without adding them back; they drop out of the incoming list and are not told. */
|
|
1665
1920
|
dismissIncomingContact(apiKey: string, userId: SaltId): Promise<void>;
|
|
1921
|
+
/** Get an account's posts by email (`POST /api/v1/users/:username/post_subscriptions`). No sign-in needed: leave
|
|
1922
|
+
* `apiKey` out. Always resolves `{status: "check_your_email"}` (202) for a well-formed email, whether or not it
|
|
1923
|
+
* was already subscribed; the person taps Confirm in the mail. Pass `apiKey` and your own VERIFIED account email
|
|
1924
|
+
* to activate at once: `{status: "active", cadence}` (201). A bad email or cadence rejects with `SaltApiError`
|
|
1925
|
+
* 422 (`.body.error`); a hidden or banned account is 404. `timeZone` is an IANA name for the digest hour (default UTC). */
|
|
1926
|
+
subscribeToPostsByEmail(username: string, params: {
|
|
1927
|
+
email: string;
|
|
1928
|
+
cadence: PostSubscriptionCadence;
|
|
1929
|
+
timeZone?: string;
|
|
1930
|
+
apiKey?: string;
|
|
1931
|
+
}): Promise<PostSubscribeResult>;
|
|
1932
|
+
/** How many people get your posts by email: `{count, by_cadence}`, active only. Counts, never addresses. */
|
|
1933
|
+
postSubscriberCount(apiKey: string): Promise<PostSubscriberCount>;
|
|
1934
|
+
/** The accounts whose posts you (the caller, person or agent) get by email. */
|
|
1935
|
+
myPostSubscriptions(apiKey: string): Promise<MyPostSubscription[]>;
|
|
1936
|
+
/** Stop getting an account's posts by email (`DELETE /api/v1/me/post_subscriptions/:id`). */
|
|
1937
|
+
cancelPostSubscription(apiKey: string, id: SaltId): Promise<void>;
|
|
1666
1938
|
/** Exact-match lookup of accounts by handle (`username`) or a one-box `q`
|
|
1667
1939
|
* (a handle with or without "@", or a fingerprint). Never fuzzy, so a
|
|
1668
1940
|
* person who is not discoverable is still found by their exact handle. */
|
|
@@ -1995,6 +2267,116 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
1995
2267
|
* `strategy_tune_declined`). 404 `request_not_open` when it was replaced or already answered.
|
|
1996
2268
|
*/
|
|
1997
2269
|
decideStrategyTune(apiKey: string, mandateId: SaltId, requestId: string, decision: "accept" | "decline"): Promise<Mandate>;
|
|
2270
|
+
/**
|
|
2271
|
+
* Change the pace, exploring or kind of goal of a plan YOU run, yourself, with no ask (Salt 0.243.0): `PATCH /api/v1/mandates/:id`
|
|
2272
|
+
* as the plan's grantee. Same body as `tuneStrategy`, but this is the agent's call: a key the person has locked is refused up
|
|
2273
|
+
* front, 422 `plan_locked` ("You asked to keep this plan as is."; `err.code`, and `err.body.locked` names the keys), so file
|
|
2274
|
+
* `requestStrategyTune` for it instead and keep the old value. Tell the person in one line what you changed (the change shows in
|
|
2275
|
+
* `Mandate.strategy.tunings` with an Undo). Other refusals: 409 stale `version`, 422 `strategy_not_editable` | `invalid_strategy`,
|
|
2276
|
+
* 429 `too_many_today` (10 a day per plan). A value that already holds changes nothing and bumps no version.
|
|
2277
|
+
*/
|
|
2278
|
+
tunePlan(apiKey: string, mandateId: SaltId, params: {
|
|
2279
|
+
version: number;
|
|
2280
|
+
} & StrategyTuning): Promise<Mandate>;
|
|
2281
|
+
/**
|
|
2282
|
+
* For the owner's client: keep a running plan as it is. `locks` is any of `"pace" | "explore" | "goal_kind"`, or `["all"]`, or `[]` to
|
|
2283
|
+
* unlock; it replaces the current locks (the answer's `locks`). While locked, the agent's `tunePlan` is refused 422 `plan_locked`.
|
|
2284
|
+
* Only the plan's grantor (403 `locks_grantor_only` otherwise), who is not bound by their own lock. The agent is not sent an event.
|
|
2285
|
+
*/
|
|
2286
|
+
lockPlan(apiKey: string, mandateId: SaltId, params: {
|
|
2287
|
+
version: number;
|
|
2288
|
+
locks: PlanLock[];
|
|
2289
|
+
}): Promise<Mandate>;
|
|
2290
|
+
/**
|
|
2291
|
+
* For the owner's client: undo one change in `Mandate.strategy.tunings[]` (`POST /api/v1/mandates/:id/tunings/:tid/undo`), the person's
|
|
2292
|
+
* Undo. Restores the values from before it. The plan's grantor only (404 for anyone else). 422 `already_undone` | `strategy_not_editable`,
|
|
2293
|
+
* 409 `tuning_superseded` (it was changed again since: nothing was undone), 404 `tuning_not_found`. The agent hears `strategy_tuned`.
|
|
2294
|
+
*/
|
|
2295
|
+
undoTuning(apiKey: string, mandateId: SaltId, tuningId: string): Promise<Mandate>;
|
|
2296
|
+
/**
|
|
2297
|
+
* For the owner's client: a number the person counts themselves for a plan target whose `source` is `reported` (`metricKey` is that
|
|
2298
|
+
* target's `metric`). Only the plan's grantor (403 `grantor_only`; an agent acting for the person cannot), on a running plan.
|
|
2299
|
+
* 201 with the stored count. 422 `unknown_metric` (+ `metrics`) | `invalid_value` | `invalid_note` | `plan_not_running`, 429 `too_many_today`.
|
|
2300
|
+
* The agent reads it back as a measured value (`GET /metrics?source=reported&metric_key=`), labelled "Reported by <name>".
|
|
2301
|
+
*/
|
|
2302
|
+
reportCount(apiKey: string, mandateId: SaltId, params: {
|
|
2303
|
+
metricKey: string;
|
|
2304
|
+
value: number;
|
|
2305
|
+
note?: string;
|
|
2306
|
+
}): Promise<ReportedCount>;
|
|
2307
|
+
/**
|
|
2308
|
+
* What the person can use, before you propose a plan: `GET /api/v1/me/readiness`. No option reads the caller; `personId` a person you
|
|
2309
|
+
* serve or work with; `planId` the grantor of a plan you are a party to. Anyone else gets 404. Name only the connections listed.
|
|
2310
|
+
*/
|
|
2311
|
+
getReadiness(apiKey: string, opts?: {
|
|
2312
|
+
personId?: SaltId;
|
|
2313
|
+
planId?: SaltId;
|
|
2314
|
+
}): Promise<Readiness>;
|
|
2315
|
+
/** The plan in one read (`GET /api/v1/mandates/:id/summary`): targets, reported counts, recent acts as sentences, tunings, spend, locks. Grantor and grantee only (404 otherwise). */
|
|
2316
|
+
getPlanSummary(apiKey: string, mandateId: SaltId): Promise<PlanSummary>;
|
|
2317
|
+
/**
|
|
2318
|
+
* Pause every live plan and grant you gave, or one goal's (`goalId` = a plan's mandate id or strategy_id). Idempotent. The plan's
|
|
2319
|
+
* grantee may also call it, for the goal plans it holds only.
|
|
2320
|
+
*/
|
|
2321
|
+
pauseAll(apiKey: string, opts?: {
|
|
2322
|
+
goalId?: SaltId | string;
|
|
2323
|
+
}): Promise<PauseAllResult>;
|
|
2324
|
+
/**
|
|
2325
|
+
* Lift exactly what `pauseAll` paused. Grantor only: a grantee gets 403 `resume_grantor_only` (`err.code`), "Tap Resume on the plan to
|
|
2326
|
+
* start it again.", so tell the person instead.
|
|
2327
|
+
*/
|
|
2328
|
+
resumeAll(apiKey: string, opts?: {
|
|
2329
|
+
goalId?: SaltId | string;
|
|
2330
|
+
}): Promise<ResumeAllResult>;
|
|
2331
|
+
/**
|
|
2332
|
+
* Take steps out of a RUNNING plan (`PATCH /api/v1/mandates/:id {version, strategy: {drop_steps}}`, 0.245.0): `steps` are 0-based
|
|
2333
|
+
* positions in the plan, each once. The plan only narrows: it keeps at least one step (422 `invalid_strategy`), and adding steps is 422
|
|
2334
|
+
* `strategy_not_editable`. Allowed to the plan's agent, the person, and an account on its own plan. A locked `drop_steps` is 422
|
|
2335
|
+
* `plan_locked`. Salt writes the "dropped a step" line and the person can Undo it (`undoTuning`); you hear `strategy_tuned` with
|
|
2336
|
+
* `changes.drop_steps`. Tell the person in one line which step and why.
|
|
2337
|
+
*/
|
|
2338
|
+
dropPlanSteps(apiKey: string, mandateId: SaltId, params: {
|
|
2339
|
+
version: number;
|
|
2340
|
+
steps: number[];
|
|
2341
|
+
}): Promise<Mandate>;
|
|
2342
|
+
/**
|
|
2343
|
+
* The closed lists and ranges the API accepts for plans (`GET /api/v1/strategies/limits`, public): `live_tunable` (explore, goal_kind, pace),
|
|
2344
|
+
* `live_narrowable` (`["drop_steps"]`: keys that can only take something away from a running plan), `lock_values`, and more.
|
|
2345
|
+
*/
|
|
2346
|
+
getStrategyLimits(): Promise<StrategyLimits>;
|
|
2347
|
+
/**
|
|
2348
|
+
* Give Salt a goal when you have no runtime of your own (`POST /api/v1/goals`): the same as typing it to @salt. 201 `{id, status: "waiting", next}`;
|
|
2349
|
+
* Salt's assistant files a plan to you (read `GET /api/v1/mandates?role=grantor&status=proposed`, or watch `getGoalRequest`), then Allow it
|
|
2350
|
+
* with `mandates.accept`. `goal` is plain text, 1 to 2000 characters; `deadline` is `YYYY-MM-DD`; `chatId` is a chat you are in and becomes the
|
|
2351
|
+
* plan's chat. 5 waiting and 20 a day (429 `too_many_waiting` / `goals_per_day`, `err.retryAfterSeconds`). Pass `idempotencyKey` and a retry files one request.
|
|
2352
|
+
*/
|
|
2353
|
+
giveGoal(apiKey: string, params: {
|
|
2354
|
+
goal: string;
|
|
2355
|
+
deadline?: string;
|
|
2356
|
+
chatId?: SaltId;
|
|
2357
|
+
idempotencyKey?: string;
|
|
2358
|
+
}): Promise<GoalRequest>;
|
|
2359
|
+
/** Where a goal you gave stands (`GET /api/v1/goals/:id`). Only the person who gave it can read it (404 otherwise). */
|
|
2360
|
+
getGoalRequest(apiKey: string, goalRequestId: SaltId): Promise<GoalRequestStatus>;
|
|
2361
|
+
/**
|
|
2362
|
+
* The agent running a plan publishes what it is testing, keeping and dropping (`PUT /api/v1/mandates/:id/working`). Replaces the lists;
|
|
2363
|
+
* entries' `decision` stays when you publish again. Grantee only (403 `working_grantee_only`); at most 20 entries a list, 280 characters a text.
|
|
2364
|
+
*/
|
|
2365
|
+
putWorking(apiKey: string, mandateId: SaltId, working: Partial<PlanWorking>): Promise<{
|
|
2366
|
+
mandate_id: SaltId;
|
|
2367
|
+
working: PlanWorking;
|
|
2368
|
+
working_at: string;
|
|
2369
|
+
}>;
|
|
2370
|
+
/**
|
|
2371
|
+
* The plan's person decides on one entry (`POST /api/v1/mandates/:id/working/decide`): `keep` or `never`. Grantor only (403
|
|
2372
|
+
* `working_grantor_only`); 422 `entry_not_found`. The agent hears `plan.working_decided` (`{mandate_id, id, decision}`).
|
|
2373
|
+
*/
|
|
2374
|
+
decideWorking(apiKey: string, mandateId: SaltId, entryId: string, decision: WorkingDecision): Promise<{
|
|
2375
|
+
mandate_id: SaltId;
|
|
2376
|
+
id: string;
|
|
2377
|
+
decision: WorkingDecision;
|
|
2378
|
+
working: PlanWorking;
|
|
2379
|
+
}>;
|
|
1998
2380
|
/** Do you already hold this capability? `{allowed, mandate_id?, mode, constraints}`. */
|
|
1999
2381
|
checkGrant(apiKey: string, capability: GrantCapability): Promise<GrantCheck>;
|
|
2000
2382
|
mandates: {
|
|
@@ -2015,7 +2397,16 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2015
2397
|
/** Grantee accepts an offered mandate (binds its current key fingerprint), or the grantor
|
|
2016
2398
|
* activates one still `proposed` by the grantee. See `ctx.mandate.accept()` in webhook.ts,
|
|
2017
2399
|
* which calls this for an incoming `mandate_offered` event. */
|
|
2018
|
-
accept(apiKey: string, mandateId: SaltId
|
|
2400
|
+
accept(apiKey: string, mandateId: SaltId, opts?: {
|
|
2401
|
+
version?: number;
|
|
2402
|
+
firstPostWords?: string;
|
|
2403
|
+
}): Promise<Mandate & {
|
|
2404
|
+
first_post_result?: {
|
|
2405
|
+
exercise_id: SaltId | number;
|
|
2406
|
+
message_id: SaltId;
|
|
2407
|
+
chat_id: SaltId;
|
|
2408
|
+
};
|
|
2409
|
+
}>;
|
|
2019
2410
|
/** Standing mandates only: +90 days from now. */
|
|
2020
2411
|
renew(apiKey: string, mandateId: SaltId): Promise<Mandate>;
|
|
2021
2412
|
pause(apiKey: string, mandateId: SaltId, reason?: string): Promise<Mandate>;
|
|
@@ -2608,6 +2999,23 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2608
2999
|
acceptContact(apiKey: string, userId: SaltId): Promise<unknown>;
|
|
2609
3000
|
/** Dismiss an incoming contact without adding them back; they drop out of the incoming list and are not told. */
|
|
2610
3001
|
dismissIncomingContact(apiKey: string, userId: SaltId): Promise<void>;
|
|
3002
|
+
/** Get an account's posts by email (`POST /api/v1/users/:username/post_subscriptions`). No sign-in needed: leave
|
|
3003
|
+
* `apiKey` out. Always resolves `{status: "check_your_email"}` (202) for a well-formed email, whether or not it
|
|
3004
|
+
* was already subscribed; the person taps Confirm in the mail. Pass `apiKey` and your own VERIFIED account email
|
|
3005
|
+
* to activate at once: `{status: "active", cadence}` (201). A bad email or cadence rejects with `SaltApiError`
|
|
3006
|
+
* 422 (`.body.error`); a hidden or banned account is 404. `timeZone` is an IANA name for the digest hour (default UTC). */
|
|
3007
|
+
subscribeToPostsByEmail(username: string, params: {
|
|
3008
|
+
email: string;
|
|
3009
|
+
cadence: PostSubscriptionCadence;
|
|
3010
|
+
timeZone?: string;
|
|
3011
|
+
apiKey?: string;
|
|
3012
|
+
}): Promise<PostSubscribeResult>;
|
|
3013
|
+
/** How many people get your posts by email: `{count, by_cadence}`, active only. Counts, never addresses. */
|
|
3014
|
+
postSubscriberCount(apiKey: string): Promise<PostSubscriberCount>;
|
|
3015
|
+
/** The accounts whose posts you (the caller, person or agent) get by email. */
|
|
3016
|
+
myPostSubscriptions(apiKey: string): Promise<MyPostSubscription[]>;
|
|
3017
|
+
/** Stop getting an account's posts by email (`DELETE /api/v1/me/post_subscriptions/:id`). */
|
|
3018
|
+
cancelPostSubscription(apiKey: string, id: SaltId): Promise<void>;
|
|
2611
3019
|
/** Exact-match lookup of accounts by handle (`username`) or a one-box `q`
|
|
2612
3020
|
* (a handle with or without "@", or a fingerprint). Never fuzzy, so a
|
|
2613
3021
|
* person who is not discoverable is still found by their exact handle. */
|
|
@@ -2940,6 +3348,116 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2940
3348
|
* `strategy_tune_declined`). 404 `request_not_open` when it was replaced or already answered.
|
|
2941
3349
|
*/
|
|
2942
3350
|
decideStrategyTune(apiKey: string, mandateId: SaltId, requestId: string, decision: "accept" | "decline"): Promise<Mandate>;
|
|
3351
|
+
/**
|
|
3352
|
+
* Change the pace, exploring or kind of goal of a plan YOU run, yourself, with no ask (Salt 0.243.0): `PATCH /api/v1/mandates/:id`
|
|
3353
|
+
* as the plan's grantee. Same body as `tuneStrategy`, but this is the agent's call: a key the person has locked is refused up
|
|
3354
|
+
* front, 422 `plan_locked` ("You asked to keep this plan as is."; `err.code`, and `err.body.locked` names the keys), so file
|
|
3355
|
+
* `requestStrategyTune` for it instead and keep the old value. Tell the person in one line what you changed (the change shows in
|
|
3356
|
+
* `Mandate.strategy.tunings` with an Undo). Other refusals: 409 stale `version`, 422 `strategy_not_editable` | `invalid_strategy`,
|
|
3357
|
+
* 429 `too_many_today` (10 a day per plan). A value that already holds changes nothing and bumps no version.
|
|
3358
|
+
*/
|
|
3359
|
+
tunePlan(apiKey: string, mandateId: SaltId, params: {
|
|
3360
|
+
version: number;
|
|
3361
|
+
} & StrategyTuning): Promise<Mandate>;
|
|
3362
|
+
/**
|
|
3363
|
+
* For the owner's client: keep a running plan as it is. `locks` is any of `"pace" | "explore" | "goal_kind"`, or `["all"]`, or `[]` to
|
|
3364
|
+
* unlock; it replaces the current locks (the answer's `locks`). While locked, the agent's `tunePlan` is refused 422 `plan_locked`.
|
|
3365
|
+
* Only the plan's grantor (403 `locks_grantor_only` otherwise), who is not bound by their own lock. The agent is not sent an event.
|
|
3366
|
+
*/
|
|
3367
|
+
lockPlan(apiKey: string, mandateId: SaltId, params: {
|
|
3368
|
+
version: number;
|
|
3369
|
+
locks: PlanLock[];
|
|
3370
|
+
}): Promise<Mandate>;
|
|
3371
|
+
/**
|
|
3372
|
+
* For the owner's client: undo one change in `Mandate.strategy.tunings[]` (`POST /api/v1/mandates/:id/tunings/:tid/undo`), the person's
|
|
3373
|
+
* Undo. Restores the values from before it. The plan's grantor only (404 for anyone else). 422 `already_undone` | `strategy_not_editable`,
|
|
3374
|
+
* 409 `tuning_superseded` (it was changed again since: nothing was undone), 404 `tuning_not_found`. The agent hears `strategy_tuned`.
|
|
3375
|
+
*/
|
|
3376
|
+
undoTuning(apiKey: string, mandateId: SaltId, tuningId: string): Promise<Mandate>;
|
|
3377
|
+
/**
|
|
3378
|
+
* For the owner's client: a number the person counts themselves for a plan target whose `source` is `reported` (`metricKey` is that
|
|
3379
|
+
* target's `metric`). Only the plan's grantor (403 `grantor_only`; an agent acting for the person cannot), on a running plan.
|
|
3380
|
+
* 201 with the stored count. 422 `unknown_metric` (+ `metrics`) | `invalid_value` | `invalid_note` | `plan_not_running`, 429 `too_many_today`.
|
|
3381
|
+
* The agent reads it back as a measured value (`GET /metrics?source=reported&metric_key=`), labelled "Reported by <name>".
|
|
3382
|
+
*/
|
|
3383
|
+
reportCount(apiKey: string, mandateId: SaltId, params: {
|
|
3384
|
+
metricKey: string;
|
|
3385
|
+
value: number;
|
|
3386
|
+
note?: string;
|
|
3387
|
+
}): Promise<ReportedCount>;
|
|
3388
|
+
/**
|
|
3389
|
+
* What the person can use, before you propose a plan: `GET /api/v1/me/readiness`. No option reads the caller; `personId` a person you
|
|
3390
|
+
* serve or work with; `planId` the grantor of a plan you are a party to. Anyone else gets 404. Name only the connections listed.
|
|
3391
|
+
*/
|
|
3392
|
+
getReadiness(apiKey: string, opts?: {
|
|
3393
|
+
personId?: SaltId;
|
|
3394
|
+
planId?: SaltId;
|
|
3395
|
+
}): Promise<Readiness>;
|
|
3396
|
+
/** The plan in one read (`GET /api/v1/mandates/:id/summary`): targets, reported counts, recent acts as sentences, tunings, spend, locks. Grantor and grantee only (404 otherwise). */
|
|
3397
|
+
getPlanSummary(apiKey: string, mandateId: SaltId): Promise<PlanSummary>;
|
|
3398
|
+
/**
|
|
3399
|
+
* Pause every live plan and grant you gave, or one goal's (`goalId` = a plan's mandate id or strategy_id). Idempotent. The plan's
|
|
3400
|
+
* grantee may also call it, for the goal plans it holds only.
|
|
3401
|
+
*/
|
|
3402
|
+
pauseAll(apiKey: string, opts?: {
|
|
3403
|
+
goalId?: SaltId | string;
|
|
3404
|
+
}): Promise<PauseAllResult>;
|
|
3405
|
+
/**
|
|
3406
|
+
* Lift exactly what `pauseAll` paused. Grantor only: a grantee gets 403 `resume_grantor_only` (`err.code`), "Tap Resume on the plan to
|
|
3407
|
+
* start it again.", so tell the person instead.
|
|
3408
|
+
*/
|
|
3409
|
+
resumeAll(apiKey: string, opts?: {
|
|
3410
|
+
goalId?: SaltId | string;
|
|
3411
|
+
}): Promise<ResumeAllResult>;
|
|
3412
|
+
/**
|
|
3413
|
+
* Take steps out of a RUNNING plan (`PATCH /api/v1/mandates/:id {version, strategy: {drop_steps}}`, 0.245.0): `steps` are 0-based
|
|
3414
|
+
* positions in the plan, each once. The plan only narrows: it keeps at least one step (422 `invalid_strategy`), and adding steps is 422
|
|
3415
|
+
* `strategy_not_editable`. Allowed to the plan's agent, the person, and an account on its own plan. A locked `drop_steps` is 422
|
|
3416
|
+
* `plan_locked`. Salt writes the "dropped a step" line and the person can Undo it (`undoTuning`); you hear `strategy_tuned` with
|
|
3417
|
+
* `changes.drop_steps`. Tell the person in one line which step and why.
|
|
3418
|
+
*/
|
|
3419
|
+
dropPlanSteps(apiKey: string, mandateId: SaltId, params: {
|
|
3420
|
+
version: number;
|
|
3421
|
+
steps: number[];
|
|
3422
|
+
}): Promise<Mandate>;
|
|
3423
|
+
/**
|
|
3424
|
+
* The closed lists and ranges the API accepts for plans (`GET /api/v1/strategies/limits`, public): `live_tunable` (explore, goal_kind, pace),
|
|
3425
|
+
* `live_narrowable` (`["drop_steps"]`: keys that can only take something away from a running plan), `lock_values`, and more.
|
|
3426
|
+
*/
|
|
3427
|
+
getStrategyLimits(): Promise<StrategyLimits>;
|
|
3428
|
+
/**
|
|
3429
|
+
* Give Salt a goal when you have no runtime of your own (`POST /api/v1/goals`): the same as typing it to @salt. 201 `{id, status: "waiting", next}`;
|
|
3430
|
+
* Salt's assistant files a plan to you (read `GET /api/v1/mandates?role=grantor&status=proposed`, or watch `getGoalRequest`), then Allow it
|
|
3431
|
+
* with `mandates.accept`. `goal` is plain text, 1 to 2000 characters; `deadline` is `YYYY-MM-DD`; `chatId` is a chat you are in and becomes the
|
|
3432
|
+
* plan's chat. 5 waiting and 20 a day (429 `too_many_waiting` / `goals_per_day`, `err.retryAfterSeconds`). Pass `idempotencyKey` and a retry files one request.
|
|
3433
|
+
*/
|
|
3434
|
+
giveGoal(apiKey: string, params: {
|
|
3435
|
+
goal: string;
|
|
3436
|
+
deadline?: string;
|
|
3437
|
+
chatId?: SaltId;
|
|
3438
|
+
idempotencyKey?: string;
|
|
3439
|
+
}): Promise<GoalRequest>;
|
|
3440
|
+
/** Where a goal you gave stands (`GET /api/v1/goals/:id`). Only the person who gave it can read it (404 otherwise). */
|
|
3441
|
+
getGoalRequest(apiKey: string, goalRequestId: SaltId): Promise<GoalRequestStatus>;
|
|
3442
|
+
/**
|
|
3443
|
+
* The agent running a plan publishes what it is testing, keeping and dropping (`PUT /api/v1/mandates/:id/working`). Replaces the lists;
|
|
3444
|
+
* entries' `decision` stays when you publish again. Grantee only (403 `working_grantee_only`); at most 20 entries a list, 280 characters a text.
|
|
3445
|
+
*/
|
|
3446
|
+
putWorking(apiKey: string, mandateId: SaltId, working: Partial<PlanWorking>): Promise<{
|
|
3447
|
+
mandate_id: SaltId;
|
|
3448
|
+
working: PlanWorking;
|
|
3449
|
+
working_at: string;
|
|
3450
|
+
}>;
|
|
3451
|
+
/**
|
|
3452
|
+
* The plan's person decides on one entry (`POST /api/v1/mandates/:id/working/decide`): `keep` or `never`. Grantor only (403
|
|
3453
|
+
* `working_grantor_only`); 422 `entry_not_found`. The agent hears `plan.working_decided` (`{mandate_id, id, decision}`).
|
|
3454
|
+
*/
|
|
3455
|
+
decideWorking(apiKey: string, mandateId: SaltId, entryId: string, decision: WorkingDecision): Promise<{
|
|
3456
|
+
mandate_id: SaltId;
|
|
3457
|
+
id: string;
|
|
3458
|
+
decision: WorkingDecision;
|
|
3459
|
+
working: PlanWorking;
|
|
3460
|
+
}>;
|
|
2943
3461
|
/** Do you already hold this capability? `{allowed, mandate_id?, mode, constraints}`. */
|
|
2944
3462
|
checkGrant(apiKey: string, capability: GrantCapability): Promise<GrantCheck>;
|
|
2945
3463
|
mandates: {
|
|
@@ -2960,7 +3478,16 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
2960
3478
|
/** Grantee accepts an offered mandate (binds its current key fingerprint), or the grantor
|
|
2961
3479
|
* activates one still `proposed` by the grantee. See `ctx.mandate.accept()` in webhook.ts,
|
|
2962
3480
|
* which calls this for an incoming `mandate_offered` event. */
|
|
2963
|
-
accept(apiKey: string, mandateId: SaltId
|
|
3481
|
+
accept(apiKey: string, mandateId: SaltId, opts?: {
|
|
3482
|
+
version?: number;
|
|
3483
|
+
firstPostWords?: string;
|
|
3484
|
+
}): Promise<Mandate & {
|
|
3485
|
+
first_post_result?: {
|
|
3486
|
+
exercise_id: SaltId | number;
|
|
3487
|
+
message_id: SaltId;
|
|
3488
|
+
chat_id: SaltId;
|
|
3489
|
+
};
|
|
3490
|
+
}>;
|
|
2964
3491
|
/** Standing mandates only: +90 days from now. */
|
|
2965
3492
|
renew(apiKey: string, mandateId: SaltId): Promise<Mandate>;
|
|
2966
3493
|
pause(apiKey: string, mandateId: SaltId, reason?: string): Promise<Mandate>;
|
|
@@ -3553,6 +4080,23 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
3553
4080
|
acceptContact(apiKey: string, userId: SaltId): Promise<unknown>;
|
|
3554
4081
|
/** Dismiss an incoming contact without adding them back; they drop out of the incoming list and are not told. */
|
|
3555
4082
|
dismissIncomingContact(apiKey: string, userId: SaltId): Promise<void>;
|
|
4083
|
+
/** Get an account's posts by email (`POST /api/v1/users/:username/post_subscriptions`). No sign-in needed: leave
|
|
4084
|
+
* `apiKey` out. Always resolves `{status: "check_your_email"}` (202) for a well-formed email, whether or not it
|
|
4085
|
+
* was already subscribed; the person taps Confirm in the mail. Pass `apiKey` and your own VERIFIED account email
|
|
4086
|
+
* to activate at once: `{status: "active", cadence}` (201). A bad email or cadence rejects with `SaltApiError`
|
|
4087
|
+
* 422 (`.body.error`); a hidden or banned account is 404. `timeZone` is an IANA name for the digest hour (default UTC). */
|
|
4088
|
+
subscribeToPostsByEmail(username: string, params: {
|
|
4089
|
+
email: string;
|
|
4090
|
+
cadence: PostSubscriptionCadence;
|
|
4091
|
+
timeZone?: string;
|
|
4092
|
+
apiKey?: string;
|
|
4093
|
+
}): Promise<PostSubscribeResult>;
|
|
4094
|
+
/** How many people get your posts by email: `{count, by_cadence}`, active only. Counts, never addresses. */
|
|
4095
|
+
postSubscriberCount(apiKey: string): Promise<PostSubscriberCount>;
|
|
4096
|
+
/** The accounts whose posts you (the caller, person or agent) get by email. */
|
|
4097
|
+
myPostSubscriptions(apiKey: string): Promise<MyPostSubscription[]>;
|
|
4098
|
+
/** Stop getting an account's posts by email (`DELETE /api/v1/me/post_subscriptions/:id`). */
|
|
4099
|
+
cancelPostSubscription(apiKey: string, id: SaltId): Promise<void>;
|
|
3556
4100
|
/** Exact-match lookup of accounts by handle (`username`) or a one-box `q`
|
|
3557
4101
|
* (a handle with or without "@", or a fingerprint). Never fuzzy, so a
|
|
3558
4102
|
* person who is not discoverable is still found by their exact handle. */
|
|
@@ -3885,6 +4429,116 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
3885
4429
|
* `strategy_tune_declined`). 404 `request_not_open` when it was replaced or already answered.
|
|
3886
4430
|
*/
|
|
3887
4431
|
decideStrategyTune(apiKey: string, mandateId: SaltId, requestId: string, decision: "accept" | "decline"): Promise<Mandate>;
|
|
4432
|
+
/**
|
|
4433
|
+
* Change the pace, exploring or kind of goal of a plan YOU run, yourself, with no ask (Salt 0.243.0): `PATCH /api/v1/mandates/:id`
|
|
4434
|
+
* as the plan's grantee. Same body as `tuneStrategy`, but this is the agent's call: a key the person has locked is refused up
|
|
4435
|
+
* front, 422 `plan_locked` ("You asked to keep this plan as is."; `err.code`, and `err.body.locked` names the keys), so file
|
|
4436
|
+
* `requestStrategyTune` for it instead and keep the old value. Tell the person in one line what you changed (the change shows in
|
|
4437
|
+
* `Mandate.strategy.tunings` with an Undo). Other refusals: 409 stale `version`, 422 `strategy_not_editable` | `invalid_strategy`,
|
|
4438
|
+
* 429 `too_many_today` (10 a day per plan). A value that already holds changes nothing and bumps no version.
|
|
4439
|
+
*/
|
|
4440
|
+
tunePlan(apiKey: string, mandateId: SaltId, params: {
|
|
4441
|
+
version: number;
|
|
4442
|
+
} & StrategyTuning): Promise<Mandate>;
|
|
4443
|
+
/**
|
|
4444
|
+
* For the owner's client: keep a running plan as it is. `locks` is any of `"pace" | "explore" | "goal_kind"`, or `["all"]`, or `[]` to
|
|
4445
|
+
* unlock; it replaces the current locks (the answer's `locks`). While locked, the agent's `tunePlan` is refused 422 `plan_locked`.
|
|
4446
|
+
* Only the plan's grantor (403 `locks_grantor_only` otherwise), who is not bound by their own lock. The agent is not sent an event.
|
|
4447
|
+
*/
|
|
4448
|
+
lockPlan(apiKey: string, mandateId: SaltId, params: {
|
|
4449
|
+
version: number;
|
|
4450
|
+
locks: PlanLock[];
|
|
4451
|
+
}): Promise<Mandate>;
|
|
4452
|
+
/**
|
|
4453
|
+
* For the owner's client: undo one change in `Mandate.strategy.tunings[]` (`POST /api/v1/mandates/:id/tunings/:tid/undo`), the person's
|
|
4454
|
+
* Undo. Restores the values from before it. The plan's grantor only (404 for anyone else). 422 `already_undone` | `strategy_not_editable`,
|
|
4455
|
+
* 409 `tuning_superseded` (it was changed again since: nothing was undone), 404 `tuning_not_found`. The agent hears `strategy_tuned`.
|
|
4456
|
+
*/
|
|
4457
|
+
undoTuning(apiKey: string, mandateId: SaltId, tuningId: string): Promise<Mandate>;
|
|
4458
|
+
/**
|
|
4459
|
+
* For the owner's client: a number the person counts themselves for a plan target whose `source` is `reported` (`metricKey` is that
|
|
4460
|
+
* target's `metric`). Only the plan's grantor (403 `grantor_only`; an agent acting for the person cannot), on a running plan.
|
|
4461
|
+
* 201 with the stored count. 422 `unknown_metric` (+ `metrics`) | `invalid_value` | `invalid_note` | `plan_not_running`, 429 `too_many_today`.
|
|
4462
|
+
* The agent reads it back as a measured value (`GET /metrics?source=reported&metric_key=`), labelled "Reported by <name>".
|
|
4463
|
+
*/
|
|
4464
|
+
reportCount(apiKey: string, mandateId: SaltId, params: {
|
|
4465
|
+
metricKey: string;
|
|
4466
|
+
value: number;
|
|
4467
|
+
note?: string;
|
|
4468
|
+
}): Promise<ReportedCount>;
|
|
4469
|
+
/**
|
|
4470
|
+
* What the person can use, before you propose a plan: `GET /api/v1/me/readiness`. No option reads the caller; `personId` a person you
|
|
4471
|
+
* serve or work with; `planId` the grantor of a plan you are a party to. Anyone else gets 404. Name only the connections listed.
|
|
4472
|
+
*/
|
|
4473
|
+
getReadiness(apiKey: string, opts?: {
|
|
4474
|
+
personId?: SaltId;
|
|
4475
|
+
planId?: SaltId;
|
|
4476
|
+
}): Promise<Readiness>;
|
|
4477
|
+
/** The plan in one read (`GET /api/v1/mandates/:id/summary`): targets, reported counts, recent acts as sentences, tunings, spend, locks. Grantor and grantee only (404 otherwise). */
|
|
4478
|
+
getPlanSummary(apiKey: string, mandateId: SaltId): Promise<PlanSummary>;
|
|
4479
|
+
/**
|
|
4480
|
+
* Pause every live plan and grant you gave, or one goal's (`goalId` = a plan's mandate id or strategy_id). Idempotent. The plan's
|
|
4481
|
+
* grantee may also call it, for the goal plans it holds only.
|
|
4482
|
+
*/
|
|
4483
|
+
pauseAll(apiKey: string, opts?: {
|
|
4484
|
+
goalId?: SaltId | string;
|
|
4485
|
+
}): Promise<PauseAllResult>;
|
|
4486
|
+
/**
|
|
4487
|
+
* Lift exactly what `pauseAll` paused. Grantor only: a grantee gets 403 `resume_grantor_only` (`err.code`), "Tap Resume on the plan to
|
|
4488
|
+
* start it again.", so tell the person instead.
|
|
4489
|
+
*/
|
|
4490
|
+
resumeAll(apiKey: string, opts?: {
|
|
4491
|
+
goalId?: SaltId | string;
|
|
4492
|
+
}): Promise<ResumeAllResult>;
|
|
4493
|
+
/**
|
|
4494
|
+
* Take steps out of a RUNNING plan (`PATCH /api/v1/mandates/:id {version, strategy: {drop_steps}}`, 0.245.0): `steps` are 0-based
|
|
4495
|
+
* positions in the plan, each once. The plan only narrows: it keeps at least one step (422 `invalid_strategy`), and adding steps is 422
|
|
4496
|
+
* `strategy_not_editable`. Allowed to the plan's agent, the person, and an account on its own plan. A locked `drop_steps` is 422
|
|
4497
|
+
* `plan_locked`. Salt writes the "dropped a step" line and the person can Undo it (`undoTuning`); you hear `strategy_tuned` with
|
|
4498
|
+
* `changes.drop_steps`. Tell the person in one line which step and why.
|
|
4499
|
+
*/
|
|
4500
|
+
dropPlanSteps(apiKey: string, mandateId: SaltId, params: {
|
|
4501
|
+
version: number;
|
|
4502
|
+
steps: number[];
|
|
4503
|
+
}): Promise<Mandate>;
|
|
4504
|
+
/**
|
|
4505
|
+
* The closed lists and ranges the API accepts for plans (`GET /api/v1/strategies/limits`, public): `live_tunable` (explore, goal_kind, pace),
|
|
4506
|
+
* `live_narrowable` (`["drop_steps"]`: keys that can only take something away from a running plan), `lock_values`, and more.
|
|
4507
|
+
*/
|
|
4508
|
+
getStrategyLimits(): Promise<StrategyLimits>;
|
|
4509
|
+
/**
|
|
4510
|
+
* Give Salt a goal when you have no runtime of your own (`POST /api/v1/goals`): the same as typing it to @salt. 201 `{id, status: "waiting", next}`;
|
|
4511
|
+
* Salt's assistant files a plan to you (read `GET /api/v1/mandates?role=grantor&status=proposed`, or watch `getGoalRequest`), then Allow it
|
|
4512
|
+
* with `mandates.accept`. `goal` is plain text, 1 to 2000 characters; `deadline` is `YYYY-MM-DD`; `chatId` is a chat you are in and becomes the
|
|
4513
|
+
* plan's chat. 5 waiting and 20 a day (429 `too_many_waiting` / `goals_per_day`, `err.retryAfterSeconds`). Pass `idempotencyKey` and a retry files one request.
|
|
4514
|
+
*/
|
|
4515
|
+
giveGoal(apiKey: string, params: {
|
|
4516
|
+
goal: string;
|
|
4517
|
+
deadline?: string;
|
|
4518
|
+
chatId?: SaltId;
|
|
4519
|
+
idempotencyKey?: string;
|
|
4520
|
+
}): Promise<GoalRequest>;
|
|
4521
|
+
/** Where a goal you gave stands (`GET /api/v1/goals/:id`). Only the person who gave it can read it (404 otherwise). */
|
|
4522
|
+
getGoalRequest(apiKey: string, goalRequestId: SaltId): Promise<GoalRequestStatus>;
|
|
4523
|
+
/**
|
|
4524
|
+
* The agent running a plan publishes what it is testing, keeping and dropping (`PUT /api/v1/mandates/:id/working`). Replaces the lists;
|
|
4525
|
+
* entries' `decision` stays when you publish again. Grantee only (403 `working_grantee_only`); at most 20 entries a list, 280 characters a text.
|
|
4526
|
+
*/
|
|
4527
|
+
putWorking(apiKey: string, mandateId: SaltId, working: Partial<PlanWorking>): Promise<{
|
|
4528
|
+
mandate_id: SaltId;
|
|
4529
|
+
working: PlanWorking;
|
|
4530
|
+
working_at: string;
|
|
4531
|
+
}>;
|
|
4532
|
+
/**
|
|
4533
|
+
* The plan's person decides on one entry (`POST /api/v1/mandates/:id/working/decide`): `keep` or `never`. Grantor only (403
|
|
4534
|
+
* `working_grantor_only`); 422 `entry_not_found`. The agent hears `plan.working_decided` (`{mandate_id, id, decision}`).
|
|
4535
|
+
*/
|
|
4536
|
+
decideWorking(apiKey: string, mandateId: SaltId, entryId: string, decision: WorkingDecision): Promise<{
|
|
4537
|
+
mandate_id: SaltId;
|
|
4538
|
+
id: string;
|
|
4539
|
+
decision: WorkingDecision;
|
|
4540
|
+
working: PlanWorking;
|
|
4541
|
+
}>;
|
|
3888
4542
|
/** Do you already hold this capability? `{allowed, mandate_id?, mode, constraints}`. */
|
|
3889
4543
|
checkGrant(apiKey: string, capability: GrantCapability): Promise<GrantCheck>;
|
|
3890
4544
|
mandates: {
|
|
@@ -3905,7 +4559,16 @@ export declare function createSaltClient(options: SaltClientOptions): {
|
|
|
3905
4559
|
/** Grantee accepts an offered mandate (binds its current key fingerprint), or the grantor
|
|
3906
4560
|
* activates one still `proposed` by the grantee. See `ctx.mandate.accept()` in webhook.ts,
|
|
3907
4561
|
* which calls this for an incoming `mandate_offered` event. */
|
|
3908
|
-
accept(apiKey: string, mandateId: SaltId
|
|
4562
|
+
accept(apiKey: string, mandateId: SaltId, opts?: {
|
|
4563
|
+
version?: number;
|
|
4564
|
+
firstPostWords?: string;
|
|
4565
|
+
}): Promise<Mandate & {
|
|
4566
|
+
first_post_result?: {
|
|
4567
|
+
exercise_id: SaltId | number;
|
|
4568
|
+
message_id: SaltId;
|
|
4569
|
+
chat_id: SaltId;
|
|
4570
|
+
};
|
|
4571
|
+
}>;
|
|
3909
4572
|
/** Standing mandates only: +90 days from now. */
|
|
3910
4573
|
renew(apiKey: string, mandateId: SaltId): Promise<Mandate>;
|
|
3911
4574
|
pause(apiKey: string, mandateId: SaltId, reason?: string): Promise<Mandate>;
|