palbase 0.5.0 → 0.5.1
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/ai/index.js +10 -10
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +10 -10
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{COCND66P.js → 32RCJNOH.js} +3 -3
- package/dist/chunks/{2S5VK2PA.js → 3AUBDHV2.js} +1 -1
- package/dist/chunks/{2GGJKIKT.js → 7BA7LGEM.js} +2 -2
- package/dist/chunks/A7EL6JKQ.js +20 -0
- package/dist/chunks/AWHTWL65.js +2 -0
- package/dist/chunks/{RQFK2F3Q.js → B45UFKBR.js} +2 -2
- package/dist/chunks/{RBUTW6OM.js → DNHDO6AJ.js} +1 -1
- package/dist/chunks/{GUR3A4M7.js → EHJKMDP3.js} +2 -2
- package/dist/chunks/{73WBTWOK.js → FSXD7MN3.js} +2 -2
- package/dist/chunks/{C627JALV.js → KSJ6AMCG.js} +2 -2
- package/dist/chunks/PALOWH6U.js +6 -0
- package/dist/chunks/{IOIQM4QO.js → PFSUOVTB.js} +1 -1
- package/dist/chunks/{CC36MKWZ.js → QIN2NQPN.js} +2 -2
- package/dist/chunks/{R5BCF2YW.js → R43DXJZE.js} +2 -2
- package/dist/chunks/{FEHN6AHI.js → TTZRGQWF.js} +1 -1
- package/dist/chunks/{ABBUC5HE.js → ZXYDN6NA.js} +1 -1
- package/dist/cli.js +111 -111
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -2
- package/types/ai/src/ai.d.ts +20 -2
- package/types/ai/src/chats.d.ts +75 -1
- package/types/ai/src/index.d.ts +2 -2
- package/types/ai/src/tools.d.ts +35 -0
- package/types/backend/src/channels.d.ts +81 -0
- package/types/backend/src/engine.d.ts +3 -0
- package/types/backend/src/index.d.ts +2 -1
- package/types/backend/src/openapi.d.ts +3 -0
- package/types/backend/src/rooms.d.ts +10 -0
- package/types/internal/src/chat.d.ts +17 -1
- package/types/internal/src/modules/ai.d.ts +314 -0
- package/types/internal/src/modules/purchases.d.ts +1 -1
- package/types/internal/src/modules/storage.d.ts +1 -1
- package/types/web/src/ai.d.ts +25 -2
- package/types/web/src/index.d.ts +1 -1
- package/dist/chunks/6SXSYK4S.js +0 -2
- package/dist/chunks/HNMC2RJ7.js +0 -20
- package/dist/chunks/OROMWNJD.js +0 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RateLimitConfig, StandardSchemaV1 } from './decorators.js';
|
|
2
2
|
import type { RegisteredError } from './errors.js';
|
|
3
|
+
import type { ChannelRow } from './channels.js';
|
|
3
4
|
import type { RoomDeclaration } from './rooms.js';
|
|
4
5
|
import type { Route } from './router.js';
|
|
5
6
|
/** Where the platform delivers the project's events to the app. */
|
|
@@ -34,6 +35,8 @@ export interface ContractOptions {
|
|
|
34
35
|
errors?: ReadonlyMap<string, RegisteredError>;
|
|
35
36
|
/** The app's @Room classes, as their decorators declare them. */
|
|
36
37
|
rooms?: readonly RoomDeclaration[];
|
|
38
|
+
/** The owner and public channels defineChannels declares, in its order: x-palbase-channels, decided by realtime itself. */
|
|
39
|
+
channels?: readonly ChannelRow[];
|
|
37
40
|
}
|
|
38
41
|
/** What a route answers and throws, as its source declares. */
|
|
39
42
|
export interface RouteContract {
|
|
@@ -89,6 +89,16 @@ export interface RoomContext {
|
|
|
89
89
|
export interface RoomMessageContext<P = unknown> extends RoomContext {
|
|
90
90
|
payload: P;
|
|
91
91
|
}
|
|
92
|
+
/** v2 held a room a minute after its last member: twice the slowest client's heartbeat, and margin. */
|
|
93
|
+
export declare const DEFAULT_GRACE_MS = 60000;
|
|
94
|
+
/**
|
|
95
|
+
* Why `pattern` is no room's, or undefined. A pattern is a channel's: ':'
|
|
96
|
+
* segments, a "{name}" segment taking exactly one — and realtime takes a
|
|
97
|
+
* pattern it cannot decide for no room at all, silently: the room would
|
|
98
|
+
* compile, ship and never be joined. So everything it would not take is
|
|
99
|
+
* refused here, by name, while someone is looking.
|
|
100
|
+
*/
|
|
101
|
+
export declare function patternProblem(pattern: string): string | undefined;
|
|
92
102
|
/**
|
|
93
103
|
* A class whose methods manage the room `pattern` names. It is a provider a
|
|
94
104
|
* module lists (its constructor injected as any provider's), built once: what
|
|
@@ -88,7 +88,23 @@ export interface AgentEvent {
|
|
|
88
88
|
reason?: string;
|
|
89
89
|
[field: string]: unknown;
|
|
90
90
|
}
|
|
91
|
-
|
|
91
|
+
/** The chat's live voice: what was said either way (transcript), when it began and ended, and a task it handed over. */
|
|
92
|
+
export interface VoiceEvent {
|
|
93
|
+
type: 'voice';
|
|
94
|
+
seq: number;
|
|
95
|
+
voice_session_id: string;
|
|
96
|
+
kind: 'transcript' | 'started' | 'closed' | 'delegated';
|
|
97
|
+
/** A transcript's: the member speaking (user) or the voice answering (assistant). */
|
|
98
|
+
role?: 'user' | 'assistant';
|
|
99
|
+
text?: string;
|
|
100
|
+
/** A delegated task's: answer it with the voice's speak and this id. */
|
|
101
|
+
delegation_id?: string;
|
|
102
|
+
task?: string;
|
|
103
|
+
reason?: string;
|
|
104
|
+
seconds?: number;
|
|
105
|
+
[field: string]: unknown;
|
|
106
|
+
}
|
|
107
|
+
export type ChatEvent = MessageEvent | TurnEvent | TextEvent | ResetEvent | ToolEvent | AgentEvent | VoiceEvent;
|
|
92
108
|
/** Where a reader is: what it hands the stream to go on from there. */
|
|
93
109
|
export interface ChatPosition {
|
|
94
110
|
/** The id of the last journal event held. */
|
|
@@ -93,6 +93,7 @@ export type Chat = {
|
|
|
93
93
|
* Its title.
|
|
94
94
|
*/
|
|
95
95
|
title: string;
|
|
96
|
+
workspace?: ChatWorkspace;
|
|
96
97
|
};
|
|
97
98
|
/**
|
|
98
99
|
* Chats, the newest first (100 at most).
|
|
@@ -152,6 +153,19 @@ export type ChatMessage = {
|
|
|
152
153
|
*/
|
|
153
154
|
text: string;
|
|
154
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* One repository of a chat's workspace.
|
|
158
|
+
*/
|
|
159
|
+
export type ChatRepo = {
|
|
160
|
+
/**
|
|
161
|
+
* The branch it is checked out at and pushed to (the repository's default unless said).
|
|
162
|
+
*/
|
|
163
|
+
branch?: string;
|
|
164
|
+
/**
|
|
165
|
+
* The project's name for the repository (PUT /ai/repos/{name}).
|
|
166
|
+
*/
|
|
167
|
+
repo: string;
|
|
168
|
+
};
|
|
155
169
|
/**
|
|
156
170
|
* A chat to start.
|
|
157
171
|
*/
|
|
@@ -179,6 +193,20 @@ export type ChatRequest = {
|
|
|
179
193
|
* Its title (256 bytes at most).
|
|
180
194
|
*/
|
|
181
195
|
title?: string;
|
|
196
|
+
workspace?: ChatWorkspace;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* The project's repositories a chat works in, each at a branch: its turns run on a machine of the platform's with them checked out, and what its agent commits is pushed to that branch.
|
|
200
|
+
*/
|
|
201
|
+
export type ChatWorkspace = {
|
|
202
|
+
/**
|
|
203
|
+
* Lets the agent push its commits to the branches without a person's yes — the server's choice for the chat: its members' messages then reach the repository. Without it a push waits for a member's approval.
|
|
204
|
+
*/
|
|
205
|
+
auto_push?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* 1 to 8 of the project's repositories, each once.
|
|
208
|
+
*/
|
|
209
|
+
repos: ChatRepo[];
|
|
182
210
|
};
|
|
183
211
|
/**
|
|
184
212
|
* A decision made.
|
|
@@ -609,6 +637,7 @@ export type MessageRequest = {
|
|
|
609
637
|
* The member the server writes as (the server's alone).
|
|
610
638
|
*/
|
|
611
639
|
as?: string;
|
|
640
|
+
budget?: TurnBudget;
|
|
612
641
|
/**
|
|
613
642
|
* The writer's own id for it: sent again — a retry, a second tab — it is the same message, delivered once.
|
|
614
643
|
*/
|
|
@@ -687,6 +716,54 @@ export type ProviderList = {
|
|
|
687
716
|
*/
|
|
688
717
|
providers: Provider[];
|
|
689
718
|
};
|
|
719
|
+
/**
|
|
720
|
+
* A GitHub repository the project's chats work in, by the project's name for it; the project's backend gives its tokens (the framework's ai.repo), asked at each clone and each push.
|
|
721
|
+
*/
|
|
722
|
+
export type Repo = {
|
|
723
|
+
/**
|
|
724
|
+
* The project's machine that gives its tokens.
|
|
725
|
+
*/
|
|
726
|
+
backend: string;
|
|
727
|
+
/**
|
|
728
|
+
* When it was put first.
|
|
729
|
+
*/
|
|
730
|
+
created_at: string;
|
|
731
|
+
/**
|
|
732
|
+
* The branch a workspace takes when it names none.
|
|
733
|
+
*/
|
|
734
|
+
default_branch: string;
|
|
735
|
+
/**
|
|
736
|
+
* The project's name for it.
|
|
737
|
+
*/
|
|
738
|
+
name: string;
|
|
739
|
+
/**
|
|
740
|
+
* The GitHub repository, owner/name.
|
|
741
|
+
*/
|
|
742
|
+
repository: string;
|
|
743
|
+
};
|
|
744
|
+
/**
|
|
745
|
+
* The project's repositories.
|
|
746
|
+
*/
|
|
747
|
+
export type RepoPage = {
|
|
748
|
+
repos: Repo[];
|
|
749
|
+
};
|
|
750
|
+
/**
|
|
751
|
+
* A repository the project's chats work in.
|
|
752
|
+
*/
|
|
753
|
+
export type RepoRequest = {
|
|
754
|
+
/**
|
|
755
|
+
* The project's machine whose framework gives the repository's tokens (backend unless said).
|
|
756
|
+
*/
|
|
757
|
+
backend?: string;
|
|
758
|
+
/**
|
|
759
|
+
* The branch a workspace takes when it names none (main unless said).
|
|
760
|
+
*/
|
|
761
|
+
default_branch?: string;
|
|
762
|
+
/**
|
|
763
|
+
* The GitHub repository, owner/name.
|
|
764
|
+
*/
|
|
765
|
+
repository: string;
|
|
766
|
+
};
|
|
690
767
|
/**
|
|
691
768
|
* A response.
|
|
692
769
|
*/
|
|
@@ -1027,6 +1104,83 @@ export type ToolRef = {
|
|
|
1027
1104
|
*/
|
|
1028
1105
|
source: "backend" | "https" | "mcp" | "client";
|
|
1029
1106
|
};
|
|
1107
|
+
/**
|
|
1108
|
+
* One artifact a turn's agent published.
|
|
1109
|
+
*/
|
|
1110
|
+
export type TurnArtifact = {
|
|
1111
|
+
/**
|
|
1112
|
+
* Its digest (sha256:<hex>).
|
|
1113
|
+
*/
|
|
1114
|
+
checksum: string;
|
|
1115
|
+
/**
|
|
1116
|
+
* When it was published.
|
|
1117
|
+
*/
|
|
1118
|
+
created_at: string;
|
|
1119
|
+
/**
|
|
1120
|
+
* The artifact.
|
|
1121
|
+
*/
|
|
1122
|
+
id: string;
|
|
1123
|
+
/**
|
|
1124
|
+
* What it is to the engine, when it says.
|
|
1125
|
+
*/
|
|
1126
|
+
logical_type?: string;
|
|
1127
|
+
/**
|
|
1128
|
+
* Its media type, as published.
|
|
1129
|
+
*/
|
|
1130
|
+
media_type: string;
|
|
1131
|
+
/**
|
|
1132
|
+
* Its size.
|
|
1133
|
+
*/
|
|
1134
|
+
size_bytes: number;
|
|
1135
|
+
};
|
|
1136
|
+
/**
|
|
1137
|
+
* A turn's artifacts.
|
|
1138
|
+
*/
|
|
1139
|
+
export type TurnArtifacts = {
|
|
1140
|
+
artifacts: TurnArtifact[];
|
|
1141
|
+
};
|
|
1142
|
+
/**
|
|
1143
|
+
* What the turn a message starts may cost at most, its subagents' spend counted (the server's alone): past it the engine stops the turn. A message delivered into a turn already running takes that turn's.
|
|
1144
|
+
*/
|
|
1145
|
+
export type TurnBudget = {
|
|
1146
|
+
/**
|
|
1147
|
+
* US dollars, more than 0 and at most 100000; rounded up to the cent.
|
|
1148
|
+
*/
|
|
1149
|
+
max_cost_usd: number;
|
|
1150
|
+
};
|
|
1151
|
+
/**
|
|
1152
|
+
* What one turn of a chat cost so far: its model calls and its subagents', at the engine's frozen rates.
|
|
1153
|
+
*/
|
|
1154
|
+
export type TurnCost = {
|
|
1155
|
+
/**
|
|
1156
|
+
* The chat.
|
|
1157
|
+
*/
|
|
1158
|
+
chat_id: string;
|
|
1159
|
+
/**
|
|
1160
|
+
* What they cost, in billionths of a US dollar.
|
|
1161
|
+
*/
|
|
1162
|
+
cost_nano_usd: number;
|
|
1163
|
+
/**
|
|
1164
|
+
* Nothing more of the turn's use can be settled: false while it or a subagent of it runs.
|
|
1165
|
+
*/
|
|
1166
|
+
final: boolean;
|
|
1167
|
+
/**
|
|
1168
|
+
* Input tokens of the turn and its subagents.
|
|
1169
|
+
*/
|
|
1170
|
+
input_tokens: number;
|
|
1171
|
+
/**
|
|
1172
|
+
* Output tokens of the turn and its subagents.
|
|
1173
|
+
*/
|
|
1174
|
+
output_tokens: number;
|
|
1175
|
+
/**
|
|
1176
|
+
* The turn.
|
|
1177
|
+
*/
|
|
1178
|
+
response_id: string;
|
|
1179
|
+
/**
|
|
1180
|
+
* A model of the turn has no price: the cost is a lower bound.
|
|
1181
|
+
*/
|
|
1182
|
+
unpriced: boolean;
|
|
1183
|
+
};
|
|
1030
1184
|
/**
|
|
1031
1185
|
* A page of uses.
|
|
1032
1186
|
*/
|
|
@@ -1089,6 +1243,61 @@ export type Use = {
|
|
|
1089
1243
|
*/
|
|
1090
1244
|
response_id: string | null;
|
|
1091
1245
|
};
|
|
1246
|
+
/**
|
|
1247
|
+
* Text for the voice.
|
|
1248
|
+
*/
|
|
1249
|
+
export type VoiceCommand = {
|
|
1250
|
+
/**
|
|
1251
|
+
* The delegated voice part this answers (speak).
|
|
1252
|
+
*/
|
|
1253
|
+
delegation_id?: string;
|
|
1254
|
+
/**
|
|
1255
|
+
* What it is given (16 KiB at most).
|
|
1256
|
+
*/
|
|
1257
|
+
text: string;
|
|
1258
|
+
/**
|
|
1259
|
+
* speak (say this), know (keep it in mind) or instruct (behave so).
|
|
1260
|
+
*/
|
|
1261
|
+
type: "speak" | "know" | "instruct";
|
|
1262
|
+
};
|
|
1263
|
+
/**
|
|
1264
|
+
* Starts the chat's live voice.
|
|
1265
|
+
*/
|
|
1266
|
+
export type VoiceRequest = {
|
|
1267
|
+
/**
|
|
1268
|
+
* The app's WebRTC offer (an SDP).
|
|
1269
|
+
*/
|
|
1270
|
+
sdp: string;
|
|
1271
|
+
/**
|
|
1272
|
+
* The voice (the provider's default unless said).
|
|
1273
|
+
*/
|
|
1274
|
+
voice?: string;
|
|
1275
|
+
};
|
|
1276
|
+
/**
|
|
1277
|
+
* A chat's live voice.
|
|
1278
|
+
*/
|
|
1279
|
+
export type VoiceSession = {
|
|
1280
|
+
/**
|
|
1281
|
+
* The chat.
|
|
1282
|
+
*/
|
|
1283
|
+
chat_id: string;
|
|
1284
|
+
/**
|
|
1285
|
+
* The voice session.
|
|
1286
|
+
*/
|
|
1287
|
+
id: string;
|
|
1288
|
+
/**
|
|
1289
|
+
* The provider's WebRTC answer, for the app's peer connection (on start).
|
|
1290
|
+
*/
|
|
1291
|
+
sdp?: string;
|
|
1292
|
+
/**
|
|
1293
|
+
* How long it lasted (on close).
|
|
1294
|
+
*/
|
|
1295
|
+
seconds: number;
|
|
1296
|
+
/**
|
|
1297
|
+
* active, or closed.
|
|
1298
|
+
*/
|
|
1299
|
+
status?: string;
|
|
1300
|
+
};
|
|
1092
1301
|
/** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
|
|
1093
1302
|
export interface Events {
|
|
1094
1303
|
/**
|
|
@@ -1293,6 +1502,80 @@ export declare function client(t: Transport): {
|
|
|
1293
1502
|
body: ToolOutput; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1294
1503
|
signal?: AbortSignal;
|
|
1295
1504
|
}): Promise<Reply<200, ToolOutputAccepted>>;
|
|
1505
|
+
/**
|
|
1506
|
+
* A turn's artifacts
|
|
1507
|
+
*
|
|
1508
|
+
* What the turn's agent published as its output (palai.artifact.publish) — a build's product from the workspace's Mac, a screenshot, a report — kept in the project's own storage. The chat's members and the project's server read it, as they read the chat.
|
|
1509
|
+
*/
|
|
1510
|
+
listChatTurnArtifacts(input: {
|
|
1511
|
+
path: {
|
|
1512
|
+
chat_id: string; /** The turn: a message's response_id, or a turn event's. */
|
|
1513
|
+
response_id: string;
|
|
1514
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1515
|
+
signal?: AbortSignal;
|
|
1516
|
+
}): Promise<Reply<200, TurnArtifacts>>;
|
|
1517
|
+
/**
|
|
1518
|
+
* An artifact of a turn
|
|
1519
|
+
*
|
|
1520
|
+
* One artifact of the turn, its bytes as the agent published them (an attachment, never a page). One the turn did not publish is not found (404 artifact_not_found).
|
|
1521
|
+
*/
|
|
1522
|
+
getChatTurnArtifact(input: {
|
|
1523
|
+
path: {
|
|
1524
|
+
chat_id: string; /** The turn: a message's response_id, or a turn event's. */
|
|
1525
|
+
response_id: string; /** The artifact: an id of the turn's artifacts. */
|
|
1526
|
+
artifact_id: string;
|
|
1527
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1528
|
+
signal?: AbortSignal;
|
|
1529
|
+
}): Promise<Reply<200, Response>>;
|
|
1530
|
+
/**
|
|
1531
|
+
* What a turn of a chat cost
|
|
1532
|
+
*
|
|
1533
|
+
* What a turn of the chat cost so far, its subagents' calls counted — while it runs too (final false) — or what one subagent's work in it cost (an agent event's response_id). The project's server's: a member's key is refused (403 server_only).
|
|
1534
|
+
*/
|
|
1535
|
+
getChatTurnCost(input: {
|
|
1536
|
+
path: {
|
|
1537
|
+
chat_id: string; /** The turn: a message's response_id, or a turn event's. */
|
|
1538
|
+
response_id: string;
|
|
1539
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1540
|
+
signal?: AbortSignal;
|
|
1541
|
+
}): Promise<Reply<200, TurnCost>>;
|
|
1542
|
+
/**
|
|
1543
|
+
* Start a chat's voice
|
|
1544
|
+
*
|
|
1545
|
+
* Starts the chat's live voice: the app's WebRTC offer in, the answer out — the audio then goes between the app and the platform's voice provider. What is said either way is in the chat's stream as voice parts (transcripts); a task the voice hands over is a voice part of kind delegated. One voice a chat at a time (409 voice_active). A user starts at most 5 voices an hour in the project's chats (429 too_many_voices, with Retry-After) — each is the project's spend while it lasts; the server's starts are not counted.
|
|
1546
|
+
*/
|
|
1547
|
+
startChatVoice(input: {
|
|
1548
|
+
path: {
|
|
1549
|
+
chat_id: string;
|
|
1550
|
+
};
|
|
1551
|
+
body: VoiceRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1552
|
+
signal?: AbortSignal;
|
|
1553
|
+
}): Promise<Reply<201, VoiceSession>>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Close a chat's voice
|
|
1556
|
+
*
|
|
1557
|
+
* Ends the chat's voice; the answer says how long it lasted.
|
|
1558
|
+
*/
|
|
1559
|
+
closeChatVoice(input: {
|
|
1560
|
+
path: {
|
|
1561
|
+
chat_id: string; /** The voice session. */
|
|
1562
|
+
voice_id: string;
|
|
1563
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1564
|
+
signal?: AbortSignal;
|
|
1565
|
+
}): Promise<Reply<200, VoiceSession>>;
|
|
1566
|
+
/**
|
|
1567
|
+
* Tell a chat's voice
|
|
1568
|
+
*
|
|
1569
|
+
* The server's alone (a member is answered 403 server_only): a member's words would be the agent's own to every other member of the chat. Gives the chat's voice text: speak says it, know keeps it in mind, instruct changes how it behaves — speak with a delegation_id answers a task it handed over.
|
|
1570
|
+
*/
|
|
1571
|
+
commandChatVoice(input: {
|
|
1572
|
+
path: {
|
|
1573
|
+
chat_id: string; /** The voice session. */
|
|
1574
|
+
voice_id: string;
|
|
1575
|
+
};
|
|
1576
|
+
body: VoiceCommand; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1577
|
+
signal?: AbortSignal;
|
|
1578
|
+
}): Promise<Reply<202, VoiceSession>>;
|
|
1296
1579
|
/**
|
|
1297
1580
|
* Turn texts into vectors
|
|
1298
1581
|
*
|
|
@@ -1407,6 +1690,37 @@ export declare function client(t: Transport): {
|
|
|
1407
1690
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1408
1691
|
signal?: AbortSignal;
|
|
1409
1692
|
}): Promise<Reply<204, undefined>>;
|
|
1693
|
+
/**
|
|
1694
|
+
* The project's repositories
|
|
1695
|
+
*
|
|
1696
|
+
* The repositories the project's chats work in.
|
|
1697
|
+
*/
|
|
1698
|
+
listRepos(input?: {
|
|
1699
|
+
signal?: AbortSignal;
|
|
1700
|
+
}): Promise<Reply<200, RepoPage>>;
|
|
1701
|
+
/**
|
|
1702
|
+
* Put a repository
|
|
1703
|
+
*
|
|
1704
|
+
* Puts a GitHub repository the project's chats work in. Its tokens come from the project's backend (the framework's ai.repo), asked at each clone and each push — none is kept.
|
|
1705
|
+
*/
|
|
1706
|
+
putRepo(input: {
|
|
1707
|
+
path: {
|
|
1708
|
+
name: string;
|
|
1709
|
+
};
|
|
1710
|
+
body: RepoRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1711
|
+
signal?: AbortSignal;
|
|
1712
|
+
}): Promise<Reply<200, Repo>>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Delete a repository
|
|
1715
|
+
*
|
|
1716
|
+
* A chat's workspace checks it out no more.
|
|
1717
|
+
*/
|
|
1718
|
+
deleteRepo(input: {
|
|
1719
|
+
path: {
|
|
1720
|
+
name: string;
|
|
1721
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1722
|
+
signal?: AbortSignal;
|
|
1723
|
+
}): Promise<Reply<204, undefined>>;
|
|
1410
1724
|
/**
|
|
1411
1725
|
* Ask a model
|
|
1412
1726
|
*
|
|
@@ -5262,7 +5262,7 @@ export declare function client(t: Transport): {
|
|
|
5262
5262
|
to?: string; /** The periods: day, week (ISO, Monday to Sunday) or month; day unless said. */
|
|
5263
5263
|
resolution?: "day" | "week" | "month"; /** Count the stores' test purchases too (Apple's sandbox, Stripe's test mode); segment or filter by sandbox to tell them apart. */
|
|
5264
5264
|
sandbox?: boolean; /** Split the chart by a dimension (a segmentable chart's). */
|
|
5265
|
-
segment?: "store" | "platform" | "country" | "product" | "plan" | "duration" | "sandbox" | "paywall" | "experiment"; /** Keep what has, for each dimension named, one of the values given: one dimension:value a parameter, repeated for more (filter=store:
|
|
5265
|
+
segment?: "store" | "platform" | "country" | "product" | "plan" | "duration" | "sandbox" | "paywall" | "experiment"; /** Keep what has, for each dimension named, one of the values given: one dimension:value a parameter, repeated for more (filter=store:app_store&filter=country:TR&filter=country:DE), at most 20; the value is everything after the first colon (commas and colons are the value's). A segmentable chart's. */
|
|
5266
5266
|
filter?: string[]; /** The currency to report money in, for this answer: one the European Central Bank publishes a reference rate for. The project's reporting currency (settings) unless said. */
|
|
5267
5267
|
currency?: string; /** What of the money a monetary chart counts: gross (what customers paid), net_of_taxes, or proceeds (net of taxes and the store's commission); gross unless said. What the ledger does not state is estimated, and the answer says so (estimated). */
|
|
5268
5268
|
revenue_type?: "gross" | "net_of_taxes" | "proceeds"; /** The conversion charts' conversion timeframe and the lifetime charts' customer lifetime, in days from a customer's first day (0: that day); to now unless said. */
|
|
@@ -291,7 +291,7 @@ export type StorageObject = {
|
|
|
291
291
|
*/
|
|
292
292
|
export type StorageStats = {
|
|
293
293
|
/**
|
|
294
|
-
* Every bucket of the project, by name; an empty one with zeros. A platform module's own bucket is listed with its share too, though the project does not reach it otherwise: _ai holds the pictures its agents' tools returned, deleted with
|
|
294
|
+
* Every bucket of the project, by name; an empty one with zeros. A platform module's own bucket is listed with its share too, though the project does not reach it otherwise: _ai holds the pictures its agents' tools returned and, under palai/, its chats' workspaces — their files, their runs' checkpoints and the artifacts their agents published — each deleted with its chat (or once a one-shot answer is answered); counted in the project's storage as its other files are.
|
|
295
295
|
*/
|
|
296
296
|
buckets: StorageStatsBucket[];
|
|
297
297
|
/**
|
package/types/web/src/ai.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { type AgentEvent, type ToolEvent, type TurnEvent } from '../../internal/src/chat.js';
|
|
1
|
+
import { type AgentEvent, type ToolEvent, type TurnEvent, type VoiceEvent } from '../../internal/src/chat.js';
|
|
2
2
|
import { ai as aiModule } from '../../internal/src/modules/index.js';
|
|
3
3
|
import { type ToolResult } from '../../internal/src/tool-output.js';
|
|
4
4
|
import { type Transport } from '../../internal/src/transport.js';
|
|
5
5
|
import type { SessionManager } from './session.js';
|
|
6
6
|
export type Chat = aiModule.Chat;
|
|
7
|
-
export type { AgentEvent, ChatEvent, ToolEvent, TurnEvent } from '../../internal/src/chat.js';
|
|
7
|
+
export type { AgentEvent, ChatEvent, ToolEvent, TurnEvent, VoiceEvent } from '../../internal/src/chat.js';
|
|
8
8
|
export type { ToolResult } from '../../internal/src/tool-output.js';
|
|
9
9
|
/** A member's message as this client holds it: one it sent is here at once, pending until the agent has it. */
|
|
10
10
|
export interface ChatMessageView {
|
|
@@ -86,6 +86,18 @@ export interface ChatState {
|
|
|
86
86
|
approvals: ToolEvent[];
|
|
87
87
|
outputs: ToolEvent[];
|
|
88
88
|
};
|
|
89
|
+
/** The chat's live voice as it went: what was said either way, in order, and when it began, ended or handed a task over. */
|
|
90
|
+
voice: VoiceEvent[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A chat's live voice this app started (startVoice): its id, its peer connection, and stop. What the voice is
|
|
94
|
+
* told besides what it hears is the app's server's to say (the server SDK), never a member's.
|
|
95
|
+
*/
|
|
96
|
+
export interface ChatVoice {
|
|
97
|
+
readonly id: string;
|
|
98
|
+
readonly peer: RTCPeerConnection;
|
|
99
|
+
/** Ends the voice; how long it lasted, in seconds. */
|
|
100
|
+
stop(): Promise<number>;
|
|
89
101
|
}
|
|
90
102
|
export interface ChatOptions {
|
|
91
103
|
/** The journal id to follow from (default 0: the chat from its start). */
|
|
@@ -108,6 +120,7 @@ export declare class ChatSession implements AsyncIterable<ChatState> {
|
|
|
108
120
|
private readonly order;
|
|
109
121
|
private turn;
|
|
110
122
|
private readonly calls;
|
|
123
|
+
private readonly voiceParts;
|
|
111
124
|
private readonly handlers;
|
|
112
125
|
private readonly answering;
|
|
113
126
|
private readonly listeners;
|
|
@@ -163,6 +176,16 @@ export declare class ChatSession implements AsyncIterable<ChatState> {
|
|
|
163
176
|
deny(approvalId: string, reason?: string): Promise<void>;
|
|
164
177
|
/** Stops the turn the agent is working on: what it wrote stays. Its response's id, or null when none ran. */
|
|
165
178
|
stop(): Promise<string | null>;
|
|
179
|
+
/**
|
|
180
|
+
* Starts the chat's live voice from the microphone's stream: the voice's
|
|
181
|
+
* audio plays in audio (a new element unless given), and what is said
|
|
182
|
+
* either way comes into the state's voice parts. One voice a chat at a time.
|
|
183
|
+
*/
|
|
184
|
+
startVoice(options: {
|
|
185
|
+
stream: MediaStream;
|
|
186
|
+
voice?: string;
|
|
187
|
+
audio?: HTMLAudioElement;
|
|
188
|
+
}): Promise<ChatVoice>;
|
|
166
189
|
/** A message for one of the agent's subagents at work (an agent part's run_id), at its next step. */
|
|
167
190
|
sendToSubagent(runId: string, text: string): Promise<void>;
|
|
168
191
|
/** Stops following the chat. */
|
package/types/web/src/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { Auth, CredentialsLike, SignInResult, User } from './auth.js';
|
|
|
3
3
|
export { localStore, memoryStore, SessionChangedError, type AuthEvent, type Session, type SessionStore } from './session.js';
|
|
4
4
|
export { Channel, RealtimeSocket, type PushReply } from './socket.js';
|
|
5
5
|
export { Analytics, type AnalyticsOptions } from './analytics.js';
|
|
6
|
-
export { AI, ChatSession, type AgentEvent, type Chat, type ChatEvent, type ChatItem, type ChatMessageView, type ChatOptions, type ChatPart, type ChatResponse, type ChatState, type ClientToolHandlers, type ToolEvent, type ToolResult, type TurnEvent, } from './ai.js';
|
|
6
|
+
export { AI, ChatSession, type AgentEvent, type Chat, type ChatEvent, type ChatItem, type ChatMessageView, type ChatOptions, type ChatPart, type ChatResponse, type ChatState, type ChatVoice, type ClientToolHandlers, type ToolEvent, type ToolResult, type TurnEvent, type VoiceEvent, } from './ai.js';
|
|
7
7
|
export { Purchases, type CustomerInfo, type CustomerInfoListener, type MergeGrant, type Offerings } from './purchases.js';
|
|
8
8
|
export type { Paywall, PaywallRenderOptions } from './paywall/placement.js';
|
|
9
9
|
export type { PaywallAttribute } from './paywall/attributes.js';
|