@ambasada/sdk 0.8.8 → 0.8.10
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 +12 -1
- package/dist/errors.d.ts +2 -0
- package/dist/platform.js +11 -0
- package/dist/types.d.ts +35 -0
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AmbasadaApps } from "./apps.js";
|
|
2
2
|
import { AmbasadaAuth } from "./auth.js";
|
|
3
|
-
import type { FileOptions, Jwk, StoredFile, StoreList, StoreWrite } from "./types.js";
|
|
3
|
+
import type { FileOptions, Jwk, LogEntry, ProductLogs, StoredFile, StoreList, StoreWrite } from "./types.js";
|
|
4
4
|
export declare const DEFAULT_API_URL = "https://api.ambasada.dev";
|
|
5
5
|
export interface AmbasadaOptions {
|
|
6
6
|
/** Project key (`vk_…` from developer.ambasada.dev, or `ambasada login`). Default: `AMBASADA_API_KEY`. */
|
|
@@ -111,6 +111,17 @@ export declare class Ambasada {
|
|
|
111
111
|
/** Keys (up to 1000, optionally under a prefix) and how much of the 1 MB is used. */
|
|
112
112
|
list: (prefix?: string) => Promise<StoreList>;
|
|
113
113
|
};
|
|
114
|
+
/**
|
|
115
|
+
* The app's error log (`ambasada logs`, the Developer app's Logs). Errors in a request are recorded on their own (a
|
|
116
|
+
* 5xx); `report` is for work outside one, like a job's failed attempt (the templates' Jobs object reports each).
|
|
117
|
+
*/
|
|
118
|
+
readonly logs: {
|
|
119
|
+
report: (entry: LogEntry) => Promise<{
|
|
120
|
+
ok: true;
|
|
121
|
+
}>;
|
|
122
|
+
/** The last deploy and recent errors (what `ambasada logs` prints). */
|
|
123
|
+
recent: () => Promise<ProductLogs>;
|
|
124
|
+
};
|
|
114
125
|
}
|
|
115
126
|
export declare function cachedKeys(load: () => Promise<Jwk[]>, ttlMs?: number): () => Promise<Jwk[]>;
|
|
116
127
|
export declare function createAmbasada(options?: AmbasadaOptions): Ambasada;
|
package/dist/errors.d.ts
CHANGED
|
@@ -40,9 +40,11 @@ export declare const ERROR_STATUS: {
|
|
|
40
40
|
readonly APPROVALS_PENDING: 429;
|
|
41
41
|
readonly PROVIDER_BUDGET: 503;
|
|
42
42
|
readonly PROVIDER_DENIED: 502;
|
|
43
|
+
readonly TOOL_UNAVAILABLE: 503;
|
|
43
44
|
readonly FROZEN: 403;
|
|
44
45
|
readonly CAP_INBOX_RATE: 429;
|
|
45
46
|
readonly CAP_CHAT_RATE: 429;
|
|
47
|
+
readonly CAP_TOOLS_RATE: 429;
|
|
46
48
|
readonly NETWORK: 0;
|
|
47
49
|
readonly CONFIG: 0;
|
|
48
50
|
readonly RECEIPT_INVALID: 402;
|
package/dist/platform.js
CHANGED
|
@@ -169,12 +169,14 @@ var ERROR_STATUS = {
|
|
|
169
169
|
// LLMOK mapping (utilities stream, docs/LLMOK.md)
|
|
170
170
|
PROVIDER_BUDGET: 503,
|
|
171
171
|
PROVIDER_DENIED: 502,
|
|
172
|
+
TOOL_UNAVAILABLE: 503,
|
|
172
173
|
// Clock windows (agent stream): deploys / steering refused while frozen
|
|
173
174
|
FROZEN: 403,
|
|
174
175
|
// Exchange stream: an agent sent too many inbox messages
|
|
175
176
|
CAP_INBOX_RATE: 429,
|
|
176
177
|
// The CEO chat: too many turns for one company
|
|
177
178
|
CAP_CHAT_RATE: 429,
|
|
179
|
+
CAP_TOOLS_RATE: 429,
|
|
178
180
|
// SDK-side
|
|
179
181
|
NETWORK: 0,
|
|
180
182
|
CONFIG: 0,
|
|
@@ -767,6 +769,15 @@ var Ambasada = class {
|
|
|
767
769
|
/** Keys (up to 1000, optionally under a prefix) and how much of the 1 MB is used. */
|
|
768
770
|
list: (prefix) => this.call("GET", "/v1/store", { query: { prefix } })
|
|
769
771
|
};
|
|
772
|
+
/**
|
|
773
|
+
* The app's error log (`ambasada logs`, the Developer app's Logs). Errors in a request are recorded on their own (a
|
|
774
|
+
* 5xx); `report` is for work outside one, like a job's failed attempt (the templates' Jobs object reports each).
|
|
775
|
+
*/
|
|
776
|
+
logs = {
|
|
777
|
+
report: (entry) => this.call("POST", "/v1/product/logs", { body: entry }),
|
|
778
|
+
/** The last deploy and recent errors (what `ambasada logs` prints). */
|
|
779
|
+
recent: () => this.call("GET", "/v1/product/logs")
|
|
780
|
+
};
|
|
770
781
|
};
|
|
771
782
|
function cachedKeys(load, ttlMs = 10 * 6e4) {
|
|
772
783
|
let cached;
|
package/dist/types.d.ts
CHANGED
|
@@ -38,3 +38,38 @@ export interface StoreWrite {
|
|
|
38
38
|
used_bytes: number;
|
|
39
39
|
limit_bytes: number;
|
|
40
40
|
}
|
|
41
|
+
/** `POST /v1/product/logs`: an error the app reports itself (a job's failed attempt, work outside a request). */
|
|
42
|
+
export interface LogEntry {
|
|
43
|
+
/** Default "error" (counted in `ambasada logs`' errors); "warn" is shown, not counted. */
|
|
44
|
+
level?: "error" | "warn";
|
|
45
|
+
message: string;
|
|
46
|
+
/** The error's stack (its first frames are enough: `ambasada logs` maps them to your source). */
|
|
47
|
+
stack?: string | null;
|
|
48
|
+
/** The job it is about (`story:call_…`), shown as `job <name>`. */
|
|
49
|
+
job?: string;
|
|
50
|
+
}
|
|
51
|
+
/** One recorded error: a request (method, path, status) or a reported one (method `JOB` or `LOG`, path the job). */
|
|
52
|
+
export interface LoggedError {
|
|
53
|
+
at: string;
|
|
54
|
+
status: number | null;
|
|
55
|
+
method: string | null;
|
|
56
|
+
path: string | null;
|
|
57
|
+
message: string | null;
|
|
58
|
+
}
|
|
59
|
+
/** `GET /v1/product/logs`. */
|
|
60
|
+
export interface ProductLogs {
|
|
61
|
+
last_deploy: {
|
|
62
|
+
version: number;
|
|
63
|
+
deployed_at: string;
|
|
64
|
+
smoke: unknown;
|
|
65
|
+
template: string | null;
|
|
66
|
+
} | null;
|
|
67
|
+
errors: {
|
|
68
|
+
hourly: {
|
|
69
|
+
hour: string;
|
|
70
|
+
count: number;
|
|
71
|
+
}[];
|
|
72
|
+
total_24h: number;
|
|
73
|
+
recent: LoggedError[];
|
|
74
|
+
};
|
|
75
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ambasada/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"description": "The Ambasada platform SDK: Sign in with Ambasada, mini-app notifications, the project store, files.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=22"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ambasada/village": "^0.8.
|
|
30
|
+
"@ambasada/village": "^0.8.10"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.5",
|