@ambasada/village 0.8.8 → 0.8.9
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/cli.mjs +121 -23
- package/dist/client.d.ts +8 -3
- package/dist/index.js +8 -2
- package/dist/types.d.ts +23 -2
- package/package.json +3 -3
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ambasada, type AmbasadaOptions } from "@ambasada/sdk/platform";
|
|
2
2
|
import { type IncomingRequest } from "./receipt.js";
|
|
3
|
-
import type { JobAnswer, AgentConfigInput, BuyOptions, BuyResult, ChatRequest, ChatResponse, CheckoutInput, CheckoutReceiptClaims, CheckoutDelivery, CheckoutDeliveryInput, CheckoutSession, ImageRequest, ImageResult, LedgerPage, Listing, ListingInput, MarketOffering, PaidCall, PaymentLink, PaymentLinkInput, ToolListing, ToolResult, TranscriptEntry, ChatLine, ChatProposal, ChatTurn, TransferOptions, Wallet, WebhookDelivery, WebhookEvent } from "./types.js";
|
|
3
|
+
import type { JobAnswer, AgentConfigInput, BuyOptions, BuyResult, ChatRequest, ChatResponse, CheckoutInput, CheckoutReceiptClaims, CheckoutDelivery, CheckoutDeliveryInput, CheckoutSession, ImageRequest, ImageResult, LedgerPage, Listing, ListingInput, MarketOffering, PaidCall, PaymentLink, PaymentLinkInput, ToolListing, ToolResult, TranscriptEntry, ChatLine, ChatProposal, ChatDecision, ChatTurn, TransferOptions, Wallet, WebhookDelivery, WebhookEvent } from "./types.js";
|
|
4
4
|
/** How long a utility call may take here: the API's own limit plus a margin, so the SDK never gives up on a call the API finishes and charges. */
|
|
5
5
|
export declare const CLIENT_TIMEOUT_MS: {
|
|
6
6
|
readonly llm: number;
|
|
@@ -206,8 +206,13 @@ export declare class Village extends Ambasada {
|
|
|
206
206
|
}) => Promise<ChatLine[]>;
|
|
207
207
|
/** Proposals waiting for your team. */
|
|
208
208
|
proposals: () => Promise<ChatProposal[]>;
|
|
209
|
-
/**
|
|
210
|
-
|
|
209
|
+
/**
|
|
210
|
+
* Approve (it runs now) or decline a proposal. `wait` (approve): also what the agent said after it, up to a
|
|
211
|
+
* minute (`follow_up`).
|
|
212
|
+
*/
|
|
213
|
+
decide: (id: string, decision: "approve" | "decline", reason?: string, options?: {
|
|
214
|
+
wait?: boolean;
|
|
215
|
+
}) => Promise<ChatDecision>;
|
|
211
216
|
transcript: (since?: number, limit?: number) => Promise<{
|
|
212
217
|
entries: TranscriptEntry[];
|
|
213
218
|
next_since: number;
|
package/dist/index.js
CHANGED
|
@@ -1988,8 +1988,14 @@ var Village = class extends Ambasada {
|
|
|
1988
1988
|
messages: async (options = {}) => (await this.call("GET", "/v1/agent/chat/messages", { query: { limit: options.limit ?? 50, ...options.since ? { since: options.since } : {} } })).messages,
|
|
1989
1989
|
/** Proposals waiting for your team. */
|
|
1990
1990
|
proposals: async () => (await this.call("GET", "/v1/agent/chat/proposals")).proposals,
|
|
1991
|
-
/**
|
|
1992
|
-
|
|
1991
|
+
/**
|
|
1992
|
+
* Approve (it runs now) or decline a proposal. `wait` (approve): also what the agent said after it, up to a
|
|
1993
|
+
* minute (`follow_up`).
|
|
1994
|
+
*/
|
|
1995
|
+
decide: (id, decision, reason, options = {}) => this.call("POST", `/v1/agent/chat/proposals/${encodeURIComponent(id)}`, {
|
|
1996
|
+
body: { decision, ...reason ? { reason } : {}, ...options.wait ? { wait: true } : {} },
|
|
1997
|
+
...options.wait ? { timeoutMs: CHAT_WAIT_MS + 15e3 } : {}
|
|
1998
|
+
}),
|
|
1993
1999
|
transcript: (since = 0, limit = 200) => this.call("GET", "/v1/agent/transcript", { query: { since, limit } }),
|
|
1994
2000
|
state: () => this.call("GET", "/v1/agent/state")
|
|
1995
2001
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface ReceiptClaims {
|
|
|
17
17
|
/** TON you may still spend downstream on behalf of this call. */
|
|
18
18
|
budget?: number;
|
|
19
19
|
deal_id?: string;
|
|
20
|
+
/** An async offering's call: when the buyer's max_wait_s runs out (unix seconds); `startJob(…, { deadline: call.deadline * 1000 })`. */
|
|
21
|
+
deadline?: number;
|
|
20
22
|
body_sha256: string;
|
|
21
23
|
iat: number;
|
|
22
24
|
exp: number;
|
|
@@ -156,8 +158,14 @@ export interface BuyOptions {
|
|
|
156
158
|
wait?: boolean;
|
|
157
159
|
}
|
|
158
160
|
/** What an async offering's `GET <endpoint>/jobs/<id>` says (village.jobStatus): the Gateway settles on done or failed. */
|
|
159
|
-
export type JobAnswer =
|
|
161
|
+
export type JobAnswer =
|
|
162
|
+
/** `attempts`: the failed ones so far (the template's `jobAnswer(job)`); the buyer sees "working (attempt 2, last error: …)". */
|
|
163
|
+
{
|
|
160
164
|
status: "working";
|
|
165
|
+
attempts?: {
|
|
166
|
+
at: string;
|
|
167
|
+
error: string;
|
|
168
|
+
}[];
|
|
161
169
|
} | {
|
|
162
170
|
status: "done";
|
|
163
171
|
output: unknown;
|
|
@@ -394,9 +402,22 @@ export interface ChatTurn {
|
|
|
394
402
|
/** With `wait`: how the turn ended and the agent's reply. */
|
|
395
403
|
status?: "completed" | "error" | "aborted" | "skipped" | "pending" | "running";
|
|
396
404
|
error?: string;
|
|
397
|
-
/** Still waiting: "wake" while the agent's wake runs (the turn is answered after it). */
|
|
405
|
+
/** Still waiting: "wake" while the agent's wake runs (the turn is answered after it); also on a `wait: false` send during a wake. */
|
|
398
406
|
queued?: "wake";
|
|
399
407
|
reply?: ChatLine | null;
|
|
408
|
+
/** The turn ended and the agent said nothing, even after the village asked it once more: "No reply (the model returned nothing)". */
|
|
409
|
+
no_reply?: string;
|
|
410
|
+
}
|
|
411
|
+
/** `agent.decide`: what ran, and with `wait` (approve) what the agent said after it. */
|
|
412
|
+
export interface ChatDecision {
|
|
413
|
+
id: string;
|
|
414
|
+
decision: "approve" | "decline";
|
|
415
|
+
/** The action's outcome (approve): its result, or `{ error: { code, message } }` when it failed. */
|
|
416
|
+
result: unknown;
|
|
417
|
+
/** The API's time of the decision (ms). */
|
|
418
|
+
at?: number;
|
|
419
|
+
/** With `wait`: the agent's next line (its reply, or the "no reply" card), null when a minute went by. */
|
|
420
|
+
follow_up?: ChatLine | null;
|
|
400
421
|
}
|
|
401
422
|
export interface MarketOffering {
|
|
402
423
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ambasada/village",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "The Hack A Ton add-on for Ambasada apps: TON checkout, receipts, offerings, LLM, the agent, the market; CLI commands and the local bank.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"node": ">=22"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ambasada/sdk": "^0.8.
|
|
30
|
+
"@ambasada/sdk": "^0.8.9"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.20.5",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"typescript": "~5.9.3",
|
|
36
36
|
"vitest": "^4.1.12",
|
|
37
37
|
"@ambasada/protocol": "0.1.0",
|
|
38
|
-
"@ambasada/cli": "0.8.
|
|
38
|
+
"@ambasada/cli": "0.8.9"
|
|
39
39
|
},
|
|
40
40
|
"author": "CENTYSO (https://centyso.com)",
|
|
41
41
|
"homepage": "https://ambasada.id",
|