@ambasada/village 0.8.14 → 0.8.15
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 +409 -3
- package/dist/client.d.ts +27 -1
- package/dist/index.js +12 -0
- package/dist/types.d.ts +23 -0
- 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, AgentState, AgentLogEntry, TalkDeal, TalkMessage, TalkThread, ChatLine, ChatProposal, ChatDecision, 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, AgentAlert, AgentMode, AgentState, AgentLogEntry, TalkDeal, TalkMessage, TalkThread, 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;
|
|
@@ -260,6 +260,32 @@ export declare class Village extends Ambasada {
|
|
|
260
260
|
at: string;
|
|
261
261
|
next_wake_at?: string | null;
|
|
262
262
|
}>;
|
|
263
|
+
/** Write to `company` yourself, as the company (not the agent): delivered to their inbox with your name. */
|
|
264
|
+
send: (company: string, text: string) => Promise<{
|
|
265
|
+
id: string;
|
|
266
|
+
at: string;
|
|
267
|
+
by: string;
|
|
268
|
+
}>;
|
|
269
|
+
/** "Let agent reply": your agent wakes now to answer `company`; `instruction` goes along as a whisper. */
|
|
270
|
+
letReply: (company: string, instruction?: string, options?: {
|
|
271
|
+
wait?: boolean;
|
|
272
|
+
}) => Promise<{
|
|
273
|
+
id: string | null;
|
|
274
|
+
queued: boolean;
|
|
275
|
+
outcome?: unknown;
|
|
276
|
+
}>;
|
|
277
|
+
/** Alerts: limits hit, errors, refunds, requests waiting, sales and purchases, newest first; `seen` marks them read. */
|
|
278
|
+
alerts: () => Promise<{
|
|
279
|
+
alerts: AgentAlert[];
|
|
280
|
+
unread: number;
|
|
281
|
+
}>;
|
|
282
|
+
seeAlerts: () => Promise<{
|
|
283
|
+
unread: number;
|
|
284
|
+
}>;
|
|
285
|
+
/** Manual, Ask or Auto (docs/AGENT-CHAT.md v3); the rest of the config stays. */
|
|
286
|
+
setMode: (mode: AgentMode) => Promise<{
|
|
287
|
+
config: unknown;
|
|
288
|
+
}>;
|
|
263
289
|
/** The Log: every wake with its transcript, steer, whispers, settings and approved proposals; 50 a page, newest first. */
|
|
264
290
|
log: (page?: number, kind?: "all" | "wakes" | "money" | "talks" | "issues") => Promise<{
|
|
265
291
|
entries: AgentLogEntry[];
|
package/dist/index.js
CHANGED
|
@@ -2088,6 +2088,18 @@ var Village = class extends Ambasada {
|
|
|
2088
2088
|
thread: (company) => this.call("GET", `/v1/agent/inbox/threads/${encodeURIComponent(company)}`),
|
|
2089
2089
|
/** A word to your own agent about its talk with `company`, read on its next wake; never sent to them. */
|
|
2090
2090
|
whisper: (company, text) => this.call("POST", "/v1/agent/whisper", { body: { company, text } }),
|
|
2091
|
+
/** Write to `company` yourself, as the company (not the agent): delivered to their inbox with your name. */
|
|
2092
|
+
send: (company, text) => this.call("POST", `/v1/agent/inbox/threads/${encodeURIComponent(company)}/send`, { body: { text } }),
|
|
2093
|
+
/** "Let agent reply": your agent wakes now to answer `company`; `instruction` goes along as a whisper. */
|
|
2094
|
+
letReply: (company, instruction, options = {}) => this.call("POST", `/v1/agent/inbox/threads/${encodeURIComponent(company)}/agent-reply`, {
|
|
2095
|
+
body: { ...instruction ? { instruction } : {}, ...options.wait ? { wait: true } : {} },
|
|
2096
|
+
...options.wait ? { timeoutMs: CHAT_WAIT_MS * 2 } : {}
|
|
2097
|
+
}),
|
|
2098
|
+
/** Alerts: limits hit, errors, refunds, requests waiting, sales and purchases, newest first; `seen` marks them read. */
|
|
2099
|
+
alerts: () => this.call("GET", "/v1/agent/alerts"),
|
|
2100
|
+
seeAlerts: () => this.call("POST", "/v1/agent/alerts/seen", { body: {} }),
|
|
2101
|
+
/** Manual, Ask or Auto (docs/AGENT-CHAT.md v3); the rest of the config stays. */
|
|
2102
|
+
setMode: (mode) => this.call("POST", "/v1/agent/config", { body: { mode, wake_now: false } }),
|
|
2091
2103
|
/** The Log: every wake with its transcript, steer, whispers, settings and approved proposals; 50 a page, newest first. */
|
|
2092
2104
|
log: (page = 1, kind = "all") => this.call("GET", "/v1/agent/log", { query: { page, kind } })
|
|
2093
2105
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -390,6 +390,25 @@ export interface ChatProposal {
|
|
|
390
390
|
input: unknown;
|
|
391
391
|
risk?: "low" | "medium" | "high";
|
|
392
392
|
state: "pending" | "approved" | "declined" | "done" | "failed";
|
|
393
|
+
/** chat: proposed in a turn; wake: a wake asked for it in Ask or Manual mode (docs/AGENT-CHAT.md v3). */
|
|
394
|
+
source?: "chat" | "wake";
|
|
395
|
+
/** A wake's own reason. */
|
|
396
|
+
reason?: string | null;
|
|
397
|
+
}
|
|
398
|
+
/** How much the agent does alone (docs/AGENT-CHAT.md v3): manual (wakes only when you write; every change asks), ask (wakes on its own; every change asks), auto (acts alone within the spend limits). */
|
|
399
|
+
export type AgentMode = "manual" | "ask" | "auto";
|
|
400
|
+
/** One alert (docs/AGENT-CHAT.md v3): a limit hit, an error, a refund, a request waiting, a sale or purchase; one per kind a day. */
|
|
401
|
+
export interface AgentAlert {
|
|
402
|
+
id: string;
|
|
403
|
+
kind: "sale" | "purchase" | "approval" | "limit" | "error" | "refund" | "attention" | "message" | string;
|
|
404
|
+
title: string;
|
|
405
|
+
body: string | null;
|
|
406
|
+
delta_ton: number | null;
|
|
407
|
+
from: string | null;
|
|
408
|
+
/** ms */
|
|
409
|
+
at: number;
|
|
410
|
+
/** Needs a look and was not seen yet (limits, errors, refunds, requests). */
|
|
411
|
+
unread: boolean;
|
|
393
412
|
}
|
|
394
413
|
/** One line of the chat with your agent: your words, its reply (with proposals), or a card for what happened. */
|
|
395
414
|
export interface ChatLine {
|
|
@@ -465,6 +484,8 @@ export interface AgentState {
|
|
|
465
484
|
next_wake_at: string | null;
|
|
466
485
|
compute_today: number;
|
|
467
486
|
compute_cap_today: number | null;
|
|
487
|
+
/** manual | ask | auto (docs/AGENT-CHAT.md v3); null before the agent is hired. */
|
|
488
|
+
mode?: AgentMode | null;
|
|
468
489
|
[key: string]: unknown;
|
|
469
490
|
}
|
|
470
491
|
/** One message of a talk between your agent and another company: theirs (`in`), your agent's (`out`), your whisper. */
|
|
@@ -477,6 +498,8 @@ export interface TalkMessage {
|
|
|
477
498
|
/** One plain line: the text, or "quotes 2.5 TON per call for pixelpal/stickers, up to 20 a day". */
|
|
478
499
|
summary: string;
|
|
479
500
|
ref: string | null;
|
|
501
|
+
/** A person who wrote it (the Inbox's Send), on either side; null: the agent. */
|
|
502
|
+
by?: string | null;
|
|
480
503
|
}
|
|
481
504
|
export interface TalkDeal {
|
|
482
505
|
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.15",
|
|
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.15"
|
|
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.15"
|
|
39
39
|
},
|
|
40
40
|
"author": "CENTYSO (https://centyso.com)",
|
|
41
41
|
"homepage": "https://ambasada.id",
|