palbase 0.65.0 → 0.68.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/README.md +3 -2
- package/dist/ai/index.js +2 -2
- package/dist/ai-sdk/index.js +4 -0
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +8 -8
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{YP3QTS4L.js → 22GRHCVI.js} +1 -1
- package/dist/chunks/{CZGZTOK7.js → 2ZHSNWVZ.js} +2 -2
- package/dist/chunks/3OP3YJ63.js +22 -0
- package/dist/chunks/{5HMDOBEH.js → 4YV35XDP.js} +2 -2
- package/dist/chunks/5ZXXBM6L.js +18 -0
- package/dist/chunks/{KZZ3Y3DC.js → 622BI7EV.js} +1 -1
- package/dist/chunks/65QZXK2S.js +2 -0
- package/dist/chunks/{ZF3WKPVM.js → 7SGTDHXJ.js} +2 -2
- package/dist/chunks/D6EUPFUR.js +2 -0
- package/dist/chunks/EGWQ3EJE.js +21 -0
- package/dist/chunks/{ARRJICH3.js → EJAGO6ZV.js} +2 -2
- package/dist/chunks/{6GRY63N6.js → F4B6ELAN.js} +2 -2
- package/dist/chunks/IZWB7FGX.js +6 -0
- package/dist/chunks/{G2JBUBZO.js → J7WJF7F4.js} +2 -2
- package/dist/chunks/{DFX37NU3.js → LUUXXMXH.js} +1 -1
- package/dist/chunks/MVY4K43S.js +13 -0
- package/dist/chunks/{JHM7GTPD.js → OWLXCD3D.js} +1 -1
- package/dist/chunks/PP7MW4OT.js +2 -0
- package/dist/chunks/{DLMWZYLL.js → QFZ4GCJH.js} +2 -2
- package/dist/chunks/QQUIM4VK.js +2 -0
- package/dist/chunks/UJLFALKX.js +2 -0
- package/dist/chunks/{TEF7WS37.js → XJLAH42O.js} +1 -1
- package/dist/chunks/{XSOQNHZ5.js → XU4G5W72.js} +1 -1
- package/dist/chunks/YCDAV3WO.js +2 -0
- package/dist/cli.js +351 -364
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai-sdk.js +2 -0
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.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/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/payments-ui.js +264 -0
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +1 -1
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +4 -3
- package/package.json +19 -2
- package/types/ai/src/ai.d.ts +55 -29
- package/types/ai/src/chats.d.ts +163 -171
- package/types/ai/src/index.d.ts +5 -5
- package/types/ai/src/pools.d.ts +17 -7
- package/types/ai/src/tools.d.ts +6 -64
- package/types/ai-sdk/src/index.d.ts +166 -0
- package/types/backend/src/decorators.d.ts +3 -9
- package/types/backend/src/idempotency.d.ts +18 -0
- package/types/backend/src/index.d.ts +1 -1
- package/types/backend/src/services.d.ts +2 -2
- package/types/backend/src/stack.d.ts +2 -4
- package/types/backend/src/strings-files.d.ts +5 -6
- package/types/backend/src/upload.d.ts +2 -1
- package/types/cloud/src/generated/project.d.ts +3 -2
- package/types/cloud/src/generated/studio.d.ts +3 -3
- package/types/internal/src/chat.d.ts +56 -2
- package/types/internal/src/event.d.ts +1 -1
- package/types/internal/src/modules/ai.d.ts +939 -1133
- package/types/internal/src/modules/analytics.d.ts +1 -1
- package/types/internal/src/modules/events.d.ts +5 -4
- package/types/internal/src/modules/{purchases.d.ts → iap.d.ts} +2183 -2438
- package/types/internal/src/modules/index.d.ts +2 -1
- package/types/internal/src/modules/journeys.d.ts +1 -1
- package/types/internal/src/modules/notify.d.ts +3 -3
- package/types/internal/src/modules/payments.d.ts +3286 -0
- package/types/internal/src/modules/stores.d.ts +7 -7
- package/types/internal/src/modules/workspaces.d.ts +22 -0
- package/types/server/src/{purchases.d.ts → iap.d.ts} +7 -7
- package/types/server/src/index.d.ts +2 -1
- package/types/server/src/payments.d.ts +65 -0
- package/types/server/src/server.d.ts +4 -1
- package/types/web/src/chat.d.ts +30 -4
- package/types/web/src/client.d.ts +13 -10
- package/types/web/src/{purchases.d.ts → iap.d.ts} +46 -56
- package/types/web/src/inapp.d.ts +5 -5
- package/types/web/src/index.d.ts +4 -2
- package/types/web/src/messaging.d.ts +1 -0
- package/types/web/src/notify.d.ts +2 -2
- package/types/web/src/payments-ui/index.d.ts +7 -0
- package/types/web/src/payments-ui/payment-sheet.d.ts +13 -0
- package/types/web/src/payments-ui/qr.d.ts +9 -0
- package/types/web/src/payments-ui/saved-cards-view.d.ts +7 -0
- package/types/web/src/payments-ui/spend-qr-view.d.ts +8 -0
- package/types/web/src/payments-ui/theme.d.ts +16 -0
- package/types/web/src/payments-ui/types.d.ts +149 -0
- package/types/web/src/payments-ui/wallet-topup-sheet.d.ts +7 -0
- package/types/web/src/payments.d.ts +281 -0
- package/types/web/src/paywall/placement.d.ts +6 -8
- package/types/web/src/screen/assets.d.ts +1 -1
- package/types/web/src/screen/resolve.d.ts +3 -3
- package/types/web/src/vite.d.ts +8 -0
- package/dist/chunks/2HJQSGOO.js +0 -13
- package/dist/chunks/3TXOVBZP.js +0 -22
- package/dist/chunks/4NHRUBEF.js +0 -2
- package/dist/chunks/63TUW6P7.js +0 -18
- package/dist/chunks/BYXX373R.js +0 -21
- package/dist/chunks/CTWUVLVE.js +0 -2
- package/dist/chunks/GFG7WVN2.js +0 -2
- package/dist/chunks/KU6B2OXP.js +0 -2
- package/dist/chunks/X6JMSZBD.js +0 -6
- package/dist/chunks/ZZRRJOEP.js +0 -2
package/types/ai/src/chats.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type * as modules from '../../internal/src/modules/index.js';
|
|
2
2
|
import { type ToolResult } from '../../internal/src/tool-output.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type MachineHarness } from './pools.js';
|
|
4
|
+
import { type AgentDefinitionInput, type BackendAgent, type WorkspaceTree } from './tools.js';
|
|
4
5
|
type Module = ReturnType<typeof modules.ai.client>;
|
|
5
6
|
export type Chat = modules.ai.Chat;
|
|
6
7
|
export type ChatMessage = modules.ai.ChatMessage;
|
|
@@ -47,6 +48,103 @@ export interface AISettings {
|
|
|
47
48
|
* person_required).
|
|
48
49
|
*/
|
|
49
50
|
openSecretsForAppUsers: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether signed-in app users may trigger session handoffs (`POST /ai/chats/{chat_id}/handoff`) directly. Off by
|
|
53
|
+
* default (server-only). Enabling it is a person's alone (403 person_required for keys/tokens).
|
|
54
|
+
*/
|
|
55
|
+
allowClientHandoff: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether newly created chats automatically attach a Realtime pipe (`chat:<chat_id>`) unless `live: false` is passed.
|
|
58
|
+
*/
|
|
59
|
+
autoPipeChats: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Where a portable chat session executes (orthogonal to ExecutorTarget). */
|
|
62
|
+
export interface ComputeTarget {
|
|
63
|
+
kind: 'serverless' | 'cloud' | 'pool' | 'machine';
|
|
64
|
+
/** Runner pool id or name when kind is `pool` or `machine`. */
|
|
65
|
+
poolId?: string;
|
|
66
|
+
/** Specific enrolled runner machine id when kind is `machine`. */
|
|
67
|
+
machineId?: string;
|
|
68
|
+
/** Optional hosted cloud environment profile name when kind is `cloud`. */
|
|
69
|
+
environment?: string;
|
|
70
|
+
}
|
|
71
|
+
/** Which runtime executes turns on the chosen compute target. */
|
|
72
|
+
export interface ExecutorTarget {
|
|
73
|
+
kind: 'palbase' | 'acp';
|
|
74
|
+
/** Official local ACP CLI harness when kind is `acp`. */
|
|
75
|
+
harness?: 'claude-code' | 'codex' | 'gemini-cli';
|
|
76
|
+
/** Optional default model override. */
|
|
77
|
+
model?: string;
|
|
78
|
+
/** Optional default reasoning effort override. */
|
|
79
|
+
effort?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Two-axis portable session execution target (compute + executor). */
|
|
82
|
+
export interface ExecutionTarget {
|
|
83
|
+
compute: ComputeTarget;
|
|
84
|
+
executor: ExecutorTarget;
|
|
85
|
+
}
|
|
86
|
+
/** Opt-in automatic failover policy when a targeted machine stays offline. */
|
|
87
|
+
export interface AutoFailoverPolicy {
|
|
88
|
+
afterOfflineSeconds: number;
|
|
89
|
+
to: ExecutionTarget;
|
|
90
|
+
requireWorkspaceCleanBeforeCut?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** A handoff queued to take effect after the current active turn finishes. */
|
|
93
|
+
export interface PendingHandoff {
|
|
94
|
+
to: ExecutionTarget;
|
|
95
|
+
reason: string;
|
|
96
|
+
idempotencyKey?: string;
|
|
97
|
+
requestedAt: string;
|
|
98
|
+
}
|
|
99
|
+
/** Compact target badge returned on chats and live `session.summary.v1` broadcasts. */
|
|
100
|
+
export interface TargetSummary {
|
|
101
|
+
compute: 'mac' | 'cloud' | 'linux' | 'serverless' | (string & {});
|
|
102
|
+
machineId?: string;
|
|
103
|
+
machineName?: string;
|
|
104
|
+
machineOnline?: boolean;
|
|
105
|
+
executor: 'palbase' | 'acp' | (string & {});
|
|
106
|
+
harness?: string;
|
|
107
|
+
}
|
|
108
|
+
/** Parameters for teleporting a chat session to a new execution target (`chats.handoff`). */
|
|
109
|
+
export interface HandoffOptions {
|
|
110
|
+
to: ExecutionTarget;
|
|
111
|
+
/** When to cut over: `idle` (default), `after_turn`, or `now`. */
|
|
112
|
+
when?: 'idle' | 'after_turn' | 'now';
|
|
113
|
+
/** Grace window in seconds for parking an active turn when `when: 'now'`. */
|
|
114
|
+
graceSeconds?: number;
|
|
115
|
+
/** Caller idempotency key so retries return the same target generation without double-teleporting. */
|
|
116
|
+
idempotencyKey?: string;
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}
|
|
119
|
+
/** Result of a session teleport (`chats.handoff`). */
|
|
120
|
+
export interface HandoffResult {
|
|
121
|
+
chatId: string;
|
|
122
|
+
targetGeneration: number;
|
|
123
|
+
target: ExecutionTarget;
|
|
124
|
+
workspaceSeq: number;
|
|
125
|
+
activeRunAction: 'none' | 'queued_after_turn' | 'parked_and_resumed' | (string & {});
|
|
126
|
+
resumedResponseId?: string;
|
|
127
|
+
}
|
|
128
|
+
/** Live execution state of a chat (`chats.execution`). */
|
|
129
|
+
export interface ChatExecution {
|
|
130
|
+
chatId: string;
|
|
131
|
+
target: ExecutionTarget;
|
|
132
|
+
targetGeneration: number;
|
|
133
|
+
workspaceId?: string;
|
|
134
|
+
workspaceSeq: number;
|
|
135
|
+
machineStatus?: 'online' | 'offline' | 'waking' | (string & {});
|
|
136
|
+
machineName?: string;
|
|
137
|
+
harnesses?: MachineHarness[];
|
|
138
|
+
autoFailover: AutoFailoverPolicy | null;
|
|
139
|
+
failoverAt: string | null;
|
|
140
|
+
pendingHandoff?: PendingHandoff;
|
|
141
|
+
}
|
|
142
|
+
/** Mutable execution settings updated via `chats.updateExecution`. */
|
|
143
|
+
export interface UpdateExecutionOptions {
|
|
144
|
+
autoFailover?: AutoFailoverPolicy | null;
|
|
145
|
+
model?: string;
|
|
146
|
+
effort?: string;
|
|
147
|
+
signal?: AbortSignal;
|
|
50
148
|
}
|
|
51
149
|
export interface EndpointInput {
|
|
52
150
|
/** https: a tool at that address, called with a signed POST; mcp: an MCP server (streamable HTTP). */
|
|
@@ -82,13 +180,6 @@ export interface MemberInput {
|
|
|
82
180
|
/** The owner deletes the chat. */
|
|
83
181
|
owner?: boolean;
|
|
84
182
|
}
|
|
85
|
-
/** A git trailer every commit of a chat's workspace carries at its message's end: PalCore-Task: #12, Co-authored-by: …. */
|
|
86
|
-
export interface CommitTrailer {
|
|
87
|
-
/** Its token, as git takes one: letters, digits and -, at most 64. */
|
|
88
|
-
key: string;
|
|
89
|
-
/** One line, 512 bytes at most. */
|
|
90
|
-
value: string;
|
|
91
|
-
}
|
|
92
183
|
export interface CreateChat {
|
|
93
184
|
/**
|
|
94
185
|
* One of the project's agents by name — its backend's (a backend's ai.agent itself names it), or one it keeps, whose
|
|
@@ -104,60 +195,59 @@ export interface CreateChat {
|
|
|
104
195
|
/** Who reads it and writes to it (64 at most). */
|
|
105
196
|
members?: MemberInput[];
|
|
106
197
|
/**
|
|
107
|
-
* The project's
|
|
108
|
-
*
|
|
109
|
-
* platform's with them checked out, and what its agent commits is pushed
|
|
110
|
-
* to that branch — with a token the backend gives at each push (ai.repo).
|
|
111
|
-
*/
|
|
112
|
-
workspace?: {
|
|
113
|
-
repos: {
|
|
114
|
-
repo: string | BackendRepo;
|
|
115
|
-
branch?: string;
|
|
116
|
-
}[];
|
|
117
|
-
/** The agent pushes its commits without a person's yes (the chat's members' messages then reach the repository); otherwise a push waits for a member's approval. */
|
|
118
|
-
autoPush?: boolean;
|
|
119
|
-
/**
|
|
120
|
-
* What each of its commits carries at its message's end (16 at most): a task, a link back to the
|
|
121
|
-
* conversation, a co-author. A commit is written as the member its turn is for (MemberInput.email); a turn
|
|
122
|
-
* that is no member's commits as the platform.
|
|
123
|
-
*/
|
|
124
|
-
trailers?: CommitTrailer[];
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* The project's runner pool its workspace runs on (ai.pools), by its id or its name: its sessions run on the
|
|
128
|
-
* project's own machines enrolled there, a Mac or a Linux box. Left out, the platform's own Linux machines. A chat
|
|
129
|
-
* that names one works in a workspace; one the project has not is refused (400).
|
|
198
|
+
* The project's runner pool its workspace runs on (ai.pools), by its id or its name: shorthand for
|
|
199
|
+
* `target: { compute: { kind: 'pool', poolId }, executor: { kind: 'palbase' } }`.
|
|
130
200
|
*/
|
|
131
201
|
pool?: string;
|
|
202
|
+
/** Standalone workspaces module id (`ws_<24hex>`) bound to this chat. */
|
|
203
|
+
workspaceId?: string;
|
|
204
|
+
/** Portable two-axis execution target (compute + executor). Defaults to serverless Palbase engine. */
|
|
205
|
+
target?: ExecutionTarget;
|
|
206
|
+
/** Opt-in automatic failover policy when a pinned machine goes offline. Default null (off). */
|
|
207
|
+
autoFailover?: AutoFailoverPolicy | null;
|
|
208
|
+
/** Attach a Realtime pipe (`chat:<chat_id>`) automatically at creation. Defaults to `settings.autoPipeChats`. */
|
|
209
|
+
live?: boolean;
|
|
132
210
|
signal?: AbortSignal;
|
|
133
211
|
}
|
|
134
|
-
/** A
|
|
135
|
-
export
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}): Promise<Repo>;
|
|
151
|
-
/** A page of the project's repositories, by name (100 unless said, at most 1000; a project puts 10 000): nextCursor pages on. */
|
|
212
|
+
/** A first-class project runtime environment for AI agents (`ephemeral` or `always_on`). */
|
|
213
|
+
export type Environment = modules.ai.Environment;
|
|
214
|
+
/** An immutable pre-bake build record for a runtime environment. */
|
|
215
|
+
export type EnvironmentBuild = modules.ai.EnvironmentBuild;
|
|
216
|
+
/** Configuration for creating or updating a project runtime environment. */
|
|
217
|
+
export type EnvironmentRequest = modules.ai.EnvironmentRequest;
|
|
218
|
+
/** Container image, Dockerfile, Mac VM profile, and pre-install setup commands. */
|
|
219
|
+
export type EnvironmentRuntime = modules.ai.EnvironmentRuntime;
|
|
220
|
+
/** Compute and idle lifecycle limits for an environment. */
|
|
221
|
+
export type EnvironmentResources = modules.ai.EnvironmentResources;
|
|
222
|
+
/** Warm pool and concurrency scaling bounds. */
|
|
223
|
+
export type EnvironmentScaling = modules.ai.EnvironmentScaling;
|
|
224
|
+
/** Outbound network egress policy and Palbase DB connectivity. */
|
|
225
|
+
export type EnvironmentNetwork = modules.ai.EnvironmentNetwork;
|
|
226
|
+
/** The project's runtime environments (`ephemeral` or `always_on`) and their pre-bake builds. */
|
|
227
|
+
export interface Environments {
|
|
152
228
|
list(options?: {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
229
|
+
signal?: AbortSignal;
|
|
230
|
+
}): Promise<Environment[]>;
|
|
231
|
+
create(environment: EnvironmentRequest & {
|
|
232
|
+
name: string;
|
|
233
|
+
}, options?: {
|
|
234
|
+
signal?: AbortSignal;
|
|
235
|
+
}): Promise<Environment>;
|
|
236
|
+
get(name: string, options?: {
|
|
237
|
+
signal?: AbortSignal;
|
|
238
|
+
}): Promise<Environment>;
|
|
239
|
+
put(name: string, environment: Omit<EnvironmentRequest, 'name'>, options?: {
|
|
240
|
+
signal?: AbortSignal;
|
|
241
|
+
}): Promise<Environment>;
|
|
242
|
+
delete(name: string, options?: {
|
|
243
|
+
signal?: AbortSignal;
|
|
244
|
+
}): Promise<void>;
|
|
245
|
+
createBuild(name: string, options?: {
|
|
246
|
+
signal?: AbortSignal;
|
|
247
|
+
}): Promise<EnvironmentBuild>;
|
|
248
|
+
getBuild(name: string, buildId: string, options?: {
|
|
249
|
+
signal?: AbortSignal;
|
|
250
|
+
}): Promise<EnvironmentBuild>;
|
|
161
251
|
}
|
|
162
252
|
export interface SendMessage {
|
|
163
253
|
text: string;
|
|
@@ -518,113 +608,6 @@ export interface Voices {
|
|
|
518
608
|
signal?: AbortSignal;
|
|
519
609
|
}): Promise<ChatVoice>;
|
|
520
610
|
}
|
|
521
|
-
/** What a write of a chat's workspace left: the tree it is at now — what a tool answers with ai.answer(output, { workspaceTree }). */
|
|
522
|
-
export interface WorkspaceWrite {
|
|
523
|
-
/** The file. */
|
|
524
|
-
path: string;
|
|
525
|
-
/** The tree the workspace is at now: a file of it is read by it (workspace.file's manifest). */
|
|
526
|
-
manifestId: string;
|
|
527
|
-
/** Its place in the workspace's history. */
|
|
528
|
-
seq: number;
|
|
529
|
-
}
|
|
530
|
-
/** A token of a chat's workspace, never said again: what it may do, what it is for, when it expires. */
|
|
531
|
-
export interface WorkspaceToken {
|
|
532
|
-
/** Its id: revoked by it. */
|
|
533
|
-
id: string;
|
|
534
|
-
/** read: the workspace followed; write: followed and written, both ways. */
|
|
535
|
-
access: 'read' | 'write' | (string & {});
|
|
536
|
-
/** What it is for — the machine's name: a conflict names its writer by it. */
|
|
537
|
-
label?: string;
|
|
538
|
-
expiresAt: string;
|
|
539
|
-
/** The workspace's id in the store. */
|
|
540
|
-
workspaceId: string;
|
|
541
|
-
}
|
|
542
|
-
/**
|
|
543
|
-
* A workspace token as it is minted: the token and where it syncs, said once — on the machine,
|
|
544
|
-
* `PALAI_WORKSPACE_TOKEN=<token> palai workspace sync --url <syncUrl> <dir>`, or the token on standard input with
|
|
545
|
-
* `--token-file -`; never on the command line (palai has no --token: any process on the machine could read it).
|
|
546
|
-
*/
|
|
547
|
-
export interface WorkspaceTokenMinted extends WorkspaceToken {
|
|
548
|
-
/** The token, said once: given palai workspace sync in PALAI_WORKSPACE_TOKEN, or on its standard input (--token-file -). */
|
|
549
|
-
token: string;
|
|
550
|
-
/** Where the workspace's token routes are, at the project's own address: `palai workspace sync --url <syncUrl> <dir>`. */
|
|
551
|
-
syncUrl: string;
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* The tokens of a chat's workspace, from its server: a machine of the customer's — a developer's computer, a CI
|
|
555
|
-
* runner — syncs the workspace with one (palai workspace sync), live and both ways (write) or followed (read). While
|
|
556
|
-
* one lives the chat's workspace events are told (ai.workspace.published, ai.workspace.conflict).
|
|
557
|
-
*/
|
|
558
|
-
export interface WorkspaceTokens {
|
|
559
|
-
/**
|
|
560
|
-
* Mints one, said once: it lives ttlSeconds (1 to 604 800; an hour when left out) — no longer than an environment's
|
|
561
|
-
* token it is minted with — and answers at the project's own address alone (syncUrl). A member who mints one (the
|
|
562
|
-
* project letting its app's users in) mints it for an hour at most; it is theirs alone, and stops answering when they
|
|
563
|
-
* leave the chat or the project turns clients off. A chat whose first turn has not opened its workspace has it opened
|
|
564
|
-
* now; a chat of no workspace: 409 no_workspace.
|
|
565
|
-
*/
|
|
566
|
-
create(id: string, token: {
|
|
567
|
-
access: 'read' | 'write';
|
|
568
|
-
ttlSeconds?: number;
|
|
569
|
-
label?: string;
|
|
570
|
-
signal?: AbortSignal;
|
|
571
|
-
}): Promise<WorkspaceTokenMinted>;
|
|
572
|
-
/** Its tokens — access, label, when each expires — none of them said again: the server's every one, a member's their own. */
|
|
573
|
-
list(id: string, options?: {
|
|
574
|
-
signal?: AbortSignal;
|
|
575
|
-
}): Promise<WorkspaceToken[]>;
|
|
576
|
-
/** Revoked at once: every token route refuses it from then, and an event stream open with it ends. A member revokes their own. */
|
|
577
|
-
revoke(id: string, tokenId: string, options?: {
|
|
578
|
-
signal?: AbortSignal;
|
|
579
|
-
}): Promise<void>;
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* A file's bytes as a workspace write takes them: text (written as UTF-8), bytes, a Blob, or a stream of bytes — a
|
|
583
|
-
* stream is read here whole first (64 MiB at most), so the write says its length, as the workspace's store asks.
|
|
584
|
-
*/
|
|
585
|
-
export type WorkspaceFileBody = string | Uint8Array | Blob | ReadableStream<Uint8Array>;
|
|
586
|
-
/** A chat's workspace, from its server: a file of a tree it published, written or removed, a repository put in it at work, its sync tokens. */
|
|
587
|
-
export interface Workspaces {
|
|
588
|
-
/**
|
|
589
|
-
* A file of the chat's workspace, its bytes: from the tree it is at now, or from the one an ai.workspace.published
|
|
590
|
-
* event named (manifest) — a build's product as that publish left it. 64 MiB at most (413 file_too_large: publish a
|
|
591
|
-
* larger one as the turn's artifact); its digest is the answer's Content-Digest. Read the Response as it comes.
|
|
592
|
-
*/
|
|
593
|
-
file(id: string, path: string, options?: {
|
|
594
|
-
manifest?: string;
|
|
595
|
-
signal?: AbortSignal;
|
|
596
|
-
}): Promise<globalThis.Response>;
|
|
597
|
-
/**
|
|
598
|
-
* Puts one more of the project's repositories (ai.repos.put — one born at work too) in an open chat's workspace,
|
|
599
|
-
* beside its others, at a branch (its default unless said): cloned before the chat's next turn, and every chat
|
|
600
|
-
* working in the workspace has it (a fork too). Put again, the same. A chat of no workspace: 409 no_workspace.
|
|
601
|
-
*/
|
|
602
|
-
addRepo(id: string, repo: {
|
|
603
|
-
repo: string | BackendRepo;
|
|
604
|
-
branch?: string;
|
|
605
|
-
signal?: AbortSignal;
|
|
606
|
-
}): Promise<Chat>;
|
|
607
|
-
/**
|
|
608
|
-
* Writes one file of the chat's workspace, its bytes the body (64 MiB at most: a larger one is refused here, before it
|
|
609
|
-
* is sent — a stream as soon as it passes the bound — and by the module, 413 file_too_large): published over
|
|
610
|
-
* whatever the workspace's head holds — the write is deliberate, no conflict is made of it — and synced to every
|
|
611
|
-
* machine that holds the workspace, the session's own before the agent's next command; it is told as
|
|
612
|
-
* ai.workspace.published. path is relative to its root (repo/src/config.json): 1 to 2048 bytes, each segment 255 at
|
|
613
|
-
* most. A stream body is read whole before the write is sent, so it says its length. A backend tool that writes answers
|
|
614
|
-
* the tree it left: ai.answer(output, { workspaceTree: written }). A chat whose first turn has not opened its
|
|
615
|
-
* workspace has it opened now; a chat of no workspace: 409 no_workspace.
|
|
616
|
-
*/
|
|
617
|
-
write(id: string, path: string, body: WorkspaceFileBody, options?: {
|
|
618
|
-
contentType?: string;
|
|
619
|
-
signal?: AbortSignal;
|
|
620
|
-
}): Promise<WorkspaceWrite>;
|
|
621
|
-
/** Removes one file of the chat's workspace, as a write is made: synced to every machine that holds it. */
|
|
622
|
-
remove(id: string, path: string, options?: {
|
|
623
|
-
signal?: AbortSignal;
|
|
624
|
-
}): Promise<WorkspaceWrite>;
|
|
625
|
-
/** The tokens a machine of the customer's syncs the workspace with (palai workspace sync). */
|
|
626
|
-
readonly tokens: WorkspaceTokens;
|
|
627
|
-
}
|
|
628
611
|
export interface Chats {
|
|
629
612
|
create(chat: CreateChat): Promise<Chat>;
|
|
630
613
|
get(id: string, options?: {
|
|
@@ -633,12 +616,14 @@ export interface Chats {
|
|
|
633
616
|
/**
|
|
634
617
|
* A page of the chats, the newest first (100 unless said, at most 100):
|
|
635
618
|
* every chat, or a member's — and, with metadata, only those labelled with
|
|
636
|
-
* every one of its labels (a product's chats: { project_id: id })
|
|
619
|
+
* every one of its labels (a product's chats: { project_id: id }), or with
|
|
620
|
+
* `status: 'active'` only chats with an active/waiting turn.
|
|
637
621
|
* nextCursor pages on.
|
|
638
622
|
*/
|
|
639
623
|
list(options?: {
|
|
640
624
|
member?: string;
|
|
641
625
|
metadata?: Record<string, string>;
|
|
626
|
+
status?: 'active' | 'all';
|
|
642
627
|
limit?: number;
|
|
643
628
|
cursor?: string;
|
|
644
629
|
signal?: AbortSignal;
|
|
@@ -646,6 +631,14 @@ export interface Chats {
|
|
|
646
631
|
chats: Chat[];
|
|
647
632
|
nextCursor?: string;
|
|
648
633
|
}>;
|
|
634
|
+
/** Teleports this chat session to a new execution target (compute and/or executor), atomically advancing `targetGeneration`. */
|
|
635
|
+
handoff(id: string, options: HandoffOptions): Promise<HandoffResult>;
|
|
636
|
+
/** Reads the chat's live execution target, target generation, machine online status, probed harnesses, and auto-failover state. */
|
|
637
|
+
execution(id: string, options?: {
|
|
638
|
+
signal?: AbortSignal;
|
|
639
|
+
}): Promise<ChatExecution>;
|
|
640
|
+
/** Updates the chat's auto-failover policy and/or default model/effort without changing its compute target. */
|
|
641
|
+
updateExecution(id: string, patch: UpdateExecutionOptions): Promise<ChatExecution>;
|
|
649
642
|
/** A turn still running is stopped; its history no longer counts. */
|
|
650
643
|
delete(id: string): Promise<void>;
|
|
651
644
|
members: {
|
|
@@ -719,8 +712,6 @@ export interface Chats {
|
|
|
719
712
|
toolCalls: TurnToolCall[];
|
|
720
713
|
nextCursor?: string;
|
|
721
714
|
}>;
|
|
722
|
-
/** The chat's workspace: a file of a tree it published, a repository put in it at work. */
|
|
723
|
-
readonly workspace: Workspaces;
|
|
724
715
|
/**
|
|
725
716
|
* What happens in the chat — its messages, its turns, the answer as it is written, the tools and subagents — as a
|
|
726
717
|
* source a gateway pipes into its channel: `ctx.pipe(Palbase.ai.chats.events(id))`. The platform writes the chat
|
|
@@ -752,9 +743,8 @@ export interface Chats {
|
|
|
752
743
|
* first. As a member (as): the app of the member whose turn it is answers it (403 not_your_turn otherwise). A
|
|
753
744
|
* backend tool that returned ai.deferred() — its ToolContext's chatId and callId — is answered here too, by the
|
|
754
745
|
* server as itself (never as a member), within the while it named. A tool that wrote the chat's workspace names the
|
|
755
|
-
* tree its writes left (
|
|
756
|
-
*
|
|
757
|
-
* machine to have it.
|
|
746
|
+
* tree its writes left ({ manifestId, seq }, either or both), as an answer given at once does
|
|
747
|
+
* (ai.answer(output, { workspaceTree })): the agent's next command waits for the session's machine to have it.
|
|
758
748
|
*/
|
|
759
749
|
answer(id: string, callId: string, output: ToolResult, options?: {
|
|
760
750
|
isError?: boolean;
|
|
@@ -895,6 +885,8 @@ export interface Settings {
|
|
|
895
885
|
userMessagesPerMinute?: number;
|
|
896
886
|
historyLimitBytes?: number | null;
|
|
897
887
|
openSecretsForAppUsers?: boolean;
|
|
888
|
+
allowClientHandoff?: boolean;
|
|
889
|
+
autoPipeChats?: boolean;
|
|
898
890
|
}): Promise<AISettings>;
|
|
899
891
|
}
|
|
900
892
|
/**
|
|
@@ -907,6 +899,6 @@ export declare function chatsOf(raw: Module): {
|
|
|
907
899
|
agents: Agents;
|
|
908
900
|
endpoints: Endpoints;
|
|
909
901
|
settings: Settings;
|
|
910
|
-
|
|
902
|
+
environments: Environments;
|
|
911
903
|
};
|
|
912
904
|
export {};
|
package/types/ai/src/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { createAI, AIResponseError } from './ai.js';
|
|
2
|
-
export type { AI, AIOptions, AgentGenerate, Ask, AskImage, AskTool, ChatModel, DeepPartial, Embed, Generate, ImageRequest, Images, Job, Message, Model, Models, ObjectStream, Picture, Response, Schema, Spend, TextStream, Uploader, Usage, } from './ai.js';
|
|
2
|
+
export type { AI, AIOptions, AgentGenerate, Ask, AskImage, AskTool, Audio, ChatModel, DeepPartial, Embed, Generate, ImageRequest, Images, Job, Message, Model, Models, ObjectStream, Picture, Response, Schema, SpeechAudio, SpeechRequest, Spend, TextStream, TranscriptionRequest, TranscriptionResponse, TranscriptionSegment, Uploader, Usage, UsageKind, VideoCancelResult, VideoJob, VideoRequest, Videos, } from './ai.js';
|
|
3
3
|
export { AISchemaError, prepare } from './schema.js';
|
|
4
4
|
export { ToolError } from './tools.js';
|
|
5
5
|
export type { Infer, StandardSchema } from './schema.js';
|
|
6
6
|
export { partial } from './partial.js';
|
|
7
|
-
export type { AISettings, Agent, AgentTool, AgentVersion, Agents, Chat, ChatEvents, ChatGoal, ChatMessage, ChatStreamPart, ChatToolCall, ChatVoice, Chats,
|
|
8
|
-
export type { EnvVariable, EnvVariableOptions, EnvVariables, Pool, PoolKey, PoolKeyEnroll, PoolKeyMinted, PoolKeys, PoolMachine, PoolMachines, PoolState, Pools, SecretHostAllowance, SecretHostAllowances, SecretHostRequest, SecretHostRequests, } from './pools.js';
|
|
9
|
-
export type { AdvisorDefinition, AgentContext, AgentDefinitionInput, AgentEnvEntry, BackendAgent, BackendAgentOptions,
|
|
10
|
-
export type { AgentEvent, ChatEvent, GoalEvent, GoalKind, HistoryEvent, HistoryItem, MessageEvent, Publication, ResetEvent, TextEvent, ThinkingEvent, ToolEvent, ToolStatus, TranscriptEvent, TurnEnd, TurnEvent, TurnStatus, VoiceEvent, WaitingReason, } from '../../internal/src/chat.js';
|
|
7
|
+
export type { AISettings, Agent, AgentTool, AgentVersion, Agents, AutoFailoverPolicy, Chat, ChatEvents, ChatExecution, ChatGoal, ChatMessage, ChatStreamPart, ChatToolCall, ChatVoice, Chats, ComputeTarget, CreateChat, Decision, Endpoint, EndpointInput, Endpoints, Environment, EnvironmentBuild, EnvironmentNetwork, EnvironmentRequest, EnvironmentResources, EnvironmentRuntime, EnvironmentScaling, Environments, ExecutionTarget, ExecutorTarget, ForkChat, GoalChange, Goals, HandoffOptions, HandoffResult, MemberInput, MessageAttachment, MessageFile, MessageImage, PendingHandoff, SendMessage, SetGoal, Settings, StartVoice, TargetSummary, TurnAdvisorCost, TurnArtifact, TurnCost, TurnRunCost, TurnToolCall, UpdateExecutionOptions, VoiceCommand, Voices, } from './chats.js';
|
|
8
|
+
export type { EnvVariable, EnvVariableOptions, EnvVariables, MachineHarness, Pool, PoolKey, PoolKeyEnroll, PoolKeyMinted, PoolKeys, PoolMachine, PoolMachines, PoolState, Pools, SecretHostAllowance, SecretHostAllowances, SecretHostRequest, SecretHostRequests, } from './pools.js';
|
|
9
|
+
export type { AdvisorDefinition, AgentContext, AgentDefinitionInput, AgentEnvEntry, BackendAgent, BackendAgentOptions, BackendTool, BackendToolOptions, ChatContext, ClientTool, ClientToolOptions, DeferredAnswer, Effort, HttpsToolRef, McpToolRef, EnvInject, PlatformToolName, PlatformToolRef, PreparedOutput, SecretDescription, SubagentDefinition, Thinking, Tool, ToolAnswer, ToolContext, ToolReply, ToolWorkspace, TurnDefinition, TurnMessage, WorkspaceTree, } from './tools.js';
|
|
10
|
+
export type { AgentEvent, ChatEvent, ContextCompactedEvent, ContextOffloadedEvent, GoalEvent, GoalKind, HistoryEvent, HistoryItem, MessageEvent, Publication, ResetEvent, SessionHandedOffEvent, SessionMachineStatusEvent, SessionSummaryEvent, TextEvent, ThinkingEvent, ToolEvent, ToolStatus, TranscriptEvent, TurnEnd, TurnEvent, TurnStatus, VoiceEvent, WaitingReason, } from '../../internal/src/chat.js';
|
|
11
11
|
export type { ToolPart, ToolResult } from '../../internal/src/tool-output.js';
|
package/types/ai/src/pools.d.ts
CHANGED
|
@@ -30,30 +30,37 @@ export interface PoolKey {
|
|
|
30
30
|
revokedAt?: string;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Where a machine enrols, said with a key as it is minted: `
|
|
33
|
+
* Where a machine enrols, said with a key as it is minted: `palbase-agent enroll --url <url> --key-file <file>`, with
|
|
34
34
|
* `--server-name <serverName>` when the door's certificate names another host, and `--ca-file <file>` holding
|
|
35
35
|
* caCertificate when the door's certificate is not publicly trusted.
|
|
36
36
|
*/
|
|
37
37
|
export interface PoolKeyEnroll {
|
|
38
38
|
url: string;
|
|
39
39
|
serverName?: string;
|
|
40
|
-
/** The CA the door's certificate is signed by (PEM): saved to a file,
|
|
40
|
+
/** The CA the door's certificate is signed by (PEM): saved to a file, palbase-agent enroll --ca-file. */
|
|
41
41
|
caCertificate?: string;
|
|
42
42
|
}
|
|
43
43
|
/** A key as it is minted: the key, said once, and where a machine enrols with it. */
|
|
44
44
|
export interface PoolKeyMinted extends PoolKey {
|
|
45
45
|
key: string;
|
|
46
|
-
/** The enrolment address:
|
|
46
|
+
/** The enrolment address: palbase-agent enroll --url. */
|
|
47
47
|
enrollUrl?: string;
|
|
48
48
|
enroll?: PoolKeyEnroll;
|
|
49
49
|
}
|
|
50
|
+
/** An official local ACP CLI harness probed by palbase-agent on an enrolled machine (never reads OAuth tokens). */
|
|
51
|
+
export interface MachineHarness {
|
|
52
|
+
name: 'claude-code' | 'codex' | 'gemini-cli' | (string & {});
|
|
53
|
+
acpVersion?: string;
|
|
54
|
+
cliVersion?: string;
|
|
55
|
+
status: 'ready' | 'unauthenticated' | 'not_installed' | (string & {});
|
|
56
|
+
}
|
|
50
57
|
/** A machine of a pool: what it takes and holds, and whether it takes a new session. */
|
|
51
58
|
export interface PoolMachine {
|
|
52
59
|
/** Its id: cordoned, resumed and deleted by it (ai.machines). */
|
|
53
60
|
id: string;
|
|
54
61
|
/** online, offline, or cordoned (it takes no new session). */
|
|
55
62
|
state: 'online' | 'offline' | 'cordoned' | (string & {});
|
|
56
|
-
/** How many sessions it takes at once (
|
|
63
|
+
/** How many sessions it takes at once (palbase-agent enroll --capacity), and holds now. */
|
|
57
64
|
capacity: number;
|
|
58
65
|
used: number;
|
|
59
66
|
/** Its label, as it enrolled. */
|
|
@@ -64,6 +71,8 @@ export interface PoolMachine {
|
|
|
64
71
|
idleSince: string | null;
|
|
65
72
|
lastSeenAt: string | null;
|
|
66
73
|
registeredAt: string | null;
|
|
74
|
+
/** Official local ACP CLI harnesses reported by palbase-agent on this machine. */
|
|
75
|
+
harnesses?: MachineHarness[];
|
|
67
76
|
}
|
|
68
77
|
/** A pool's state: what the project's own scaling loop reads to add a machine or take one away. */
|
|
69
78
|
export interface PoolState {
|
|
@@ -80,11 +89,11 @@ export interface PoolState {
|
|
|
80
89
|
oldestWaitingSince: string | null;
|
|
81
90
|
machines: PoolMachine[];
|
|
82
91
|
}
|
|
83
|
-
/** A pool's enrolment keys: a machine enrols with one once (`
|
|
92
|
+
/** A pool's enrolment keys: a machine enrols with one once (`palbase-agent enroll --url <enrollUrl> --key-file <file> --capacity <n>`). */
|
|
84
93
|
export interface PoolKeys {
|
|
85
94
|
/**
|
|
86
95
|
* Mints one, said once — here, never again — with where a machine enrols (enrollUrl, enroll): saved to a file on the
|
|
87
|
-
* machine, `
|
|
96
|
+
* machine, `palbase-agent enroll --url <enrollUrl> --key-file <file> --capacity <n>` (and --server-name, --ca-file when enroll
|
|
88
97
|
* says them) — never on a command line, where any process on the machine could read it; n is how many sessions the
|
|
89
98
|
* machine runs at once (1 or more, default 1). A machine enrolled with it serves the project's sessions once whoever
|
|
90
99
|
* minted it is gone: it is never minted for an environment's token.
|
|
@@ -138,7 +147,7 @@ export interface PoolMachines {
|
|
|
138
147
|
resume(id: string, options?: {
|
|
139
148
|
signal?: AbortSignal;
|
|
140
149
|
}): Promise<void>;
|
|
141
|
-
/** A cordoned machine that holds no session leaves its pool, its
|
|
150
|
+
/** A cordoned machine that holds no session leaves its pool, its palbase-agent refused from then (409 machine_not_cordoned, machine_busy). */
|
|
142
151
|
delete(id: string, options?: {
|
|
143
152
|
signal?: AbortSignal;
|
|
144
153
|
}): Promise<void>;
|
|
@@ -318,6 +327,7 @@ export interface EnvVariables {
|
|
|
318
327
|
/** The hosts its agents' own secrets are allowed beside their definitions'. */
|
|
319
328
|
readonly allowances: SecretHostAllowances;
|
|
320
329
|
}
|
|
330
|
+
export declare function harnessOf(h: modules.ai.MachineHarness): MachineHarness;
|
|
321
331
|
export declare function poolsOf(module: Module): {
|
|
322
332
|
pools: Pools;
|
|
323
333
|
machines: PoolMachines;
|
package/types/ai/src/tools.d.ts
CHANGED
|
@@ -48,9 +48,8 @@ export interface ToolContext extends ChatContext {
|
|
|
48
48
|
subagent: string | null;
|
|
49
49
|
/**
|
|
50
50
|
* The chat's workspace as the session last wrote it, its writes flushed before the call — absent when the chat
|
|
51
|
-
* works in none. Read a file of it
|
|
52
|
-
*
|
|
53
|
-
* workspaceTree }), and the agent's next command sees it.
|
|
51
|
+
* works in none. Read a file of it via the workspaces module; a tool that writes the workspace answers the tree its
|
|
52
|
+
* writes left with ai.answer(output, { workspaceTree }), and the agent's next command sees it.
|
|
54
53
|
*/
|
|
55
54
|
workspace?: ToolWorkspace;
|
|
56
55
|
}
|
|
@@ -58,13 +57,13 @@ export interface ToolContext extends ChatContext {
|
|
|
58
57
|
export interface ToolWorkspace {
|
|
59
58
|
/** The chat whose workspace it is. */
|
|
60
59
|
chatId: string;
|
|
61
|
-
/** The tree
|
|
60
|
+
/** The tree manifest id. */
|
|
62
61
|
manifestId?: string;
|
|
63
62
|
/** Its place in the workspace's history. */
|
|
64
63
|
seq?: number;
|
|
65
64
|
}
|
|
66
65
|
/**
|
|
67
|
-
* The tree a tool's writes left a chat's workspace at
|
|
66
|
+
* The tree a tool's writes left a chat's workspace at ({ manifestId, seq }),
|
|
68
67
|
* either or both: the session's machine takes it before the agent's next command.
|
|
69
68
|
*/
|
|
70
69
|
export interface WorkspaceTree {
|
|
@@ -175,7 +174,7 @@ export interface ToolReply {
|
|
|
175
174
|
/** The tree a tool says its writes left, as the platform takes it — refused here when the platform would drop it. */
|
|
176
175
|
export declare function workspaceTreeOf(t: unknown, what: string): WireWorkspaceTree;
|
|
177
176
|
/**
|
|
178
|
-
* A backend tool's output with the tree its writes left the chat's workspace at
|
|
177
|
+
* A backend tool's output with the tree its writes left the chat's workspace at:
|
|
179
178
|
* the session's machine takes that tree before the agent's next command, so the agent sees what the tool wrote. A
|
|
180
179
|
* tool that wrote and then failed says it with its ToolError (new ToolError(message, { workspaceTree })).
|
|
181
180
|
*/
|
|
@@ -393,46 +392,13 @@ export interface BackendAgent {
|
|
|
393
392
|
tools: BackendTool[];
|
|
394
393
|
}>;
|
|
395
394
|
}
|
|
396
|
-
/** What one clone or one push of a chat's workspace asks a repository's token with: an ai.repo's token, ai.repoTokens' give. */
|
|
397
|
-
export interface RepoTokenContext {
|
|
398
|
-
/** The repository's name in the project (ai.repos.put). */
|
|
399
|
-
repo: string;
|
|
400
|
-
/** The GitHub repository, owner/name. */
|
|
401
|
-
repository: string;
|
|
402
|
-
/** Ended when the platform stops waiting for the token. */
|
|
403
|
-
signal: AbortSignal;
|
|
404
|
-
/**
|
|
405
|
-
* The app's instance of a provider, as a tool's run is given it
|
|
406
|
-
* (ChatContext.inject): a token a service of the app's mints — its GitHub
|
|
407
|
-
* App's, its sealed credentials' — from the container of the app that
|
|
408
|
-
* serves the ask. A class no module provides is refused, by name.
|
|
409
|
-
*/
|
|
410
|
-
inject<T extends object>(provider: abstract new (...args: never[]) => T): T;
|
|
411
|
-
}
|
|
412
|
-
/** What gives a repository's token when no ai.repo of its name was made: ai.repoTokens(give). */
|
|
413
|
-
export type RepoTokens = (ctx: RepoTokenContext) => string | null | undefined | Promise<string | null | undefined>;
|
|
414
|
-
/** A repository a chat's workspace works in, whose tokens the backend gives (ai.repo). */
|
|
415
|
-
export interface BackendRepo {
|
|
416
|
-
readonly kind: 'repo';
|
|
417
|
-
readonly name: string;
|
|
418
|
-
/** The GitHub repository, owner/name. */
|
|
419
|
-
readonly repository: string;
|
|
420
|
-
readonly defaultBranch: string;
|
|
421
|
-
/** The project's machine that gives its tokens (default backend). */
|
|
422
|
-
readonly machine?: string;
|
|
423
|
-
/** A token for one clone or one push of it: asked at each — a GitHub App's installation token, minted then. */
|
|
424
|
-
token(ctx: RepoTokenContext): Promise<string>;
|
|
425
|
-
}
|
|
426
395
|
/** What this process declared, for the framework to serve and to write into its build's contract. */
|
|
427
396
|
export interface DeclaredAI {
|
|
428
397
|
tools: Map<string, BackendTool>;
|
|
429
398
|
/** The app's client tools: in its contract, answered by the app — never served here. */
|
|
430
399
|
clientTools: Map<string, ClientTool>;
|
|
431
400
|
agents: Map<string, BackendAgent>;
|
|
432
|
-
|
|
433
|
-
/** The tokens of a repository put by name at run time, which no ai.repo of this process names. */
|
|
434
|
-
repoTokens?: RepoTokens;
|
|
435
|
-
/** Names declared twice (tool:<name> — a backend tool's or a client tool's —, agent:<name>, repoTokens): the framework refuses to start with one, and to write its contract. */
|
|
401
|
+
/** Names declared twice (tool:<name> — a backend tool's or a client tool's —, agent:<name>): the framework refuses to start with one, and to write its contract. */
|
|
436
402
|
twice: Set<string>;
|
|
437
403
|
}
|
|
438
404
|
/**
|
|
@@ -457,30 +423,6 @@ export declare function shownAsWritten(label: unknown): label is string;
|
|
|
457
423
|
export declare function parametersOf(schema: StandardSchema | undefined, what: string): Record<string, unknown>;
|
|
458
424
|
export declare function backendTool<S extends StandardSchema>(o: BackendToolOptions<S>): BackendTool<S>;
|
|
459
425
|
export declare function clientTool<S extends StandardSchema>(o: ClientToolOptions<S>): ClientTool;
|
|
460
|
-
/**
|
|
461
|
-
* A repository a chat's workspace works in, whose tokens this backend gives:
|
|
462
|
-
* put it with ai.repos.put(repo), and each clone and each push of a chat's
|
|
463
|
-
* workspace asks this machine for a token then (token) — a GitHub App's
|
|
464
|
-
* installation token for that one repository, say — kept nowhere. Made once,
|
|
465
|
-
* at a module's top level.
|
|
466
|
-
*/
|
|
467
|
-
export declare function backendRepo(options: {
|
|
468
|
-
name: string;
|
|
469
|
-
repository: string;
|
|
470
|
-
defaultBranch?: string;
|
|
471
|
-
machine?: string;
|
|
472
|
-
token: (ctx: RepoTokenContext) => string | Promise<string>;
|
|
473
|
-
}): BackendRepo;
|
|
474
|
-
/**
|
|
475
|
-
* The tokens of the project's repositories put by name at run time
|
|
476
|
-
* (ai.repos.put(name, { repository, backend })) — one a product makes for
|
|
477
|
-
* itself — which no ai.repo of this backend names: each clone and each push
|
|
478
|
-
* of a chat's workspace asks this machine, and give answers with a token for
|
|
479
|
-
* that one operation, or null for a repository it gives none for (the
|
|
480
|
-
* workspace is refused it). An ai.repo of the name answers for its own
|
|
481
|
-
* repository first. Given once, at a module's top level.
|
|
482
|
-
*/
|
|
483
|
-
export declare function repoTokens(give: RepoTokens): void;
|
|
484
426
|
/** What an agent of the code says of itself beside its function: what it is for, and the machine that defines it. */
|
|
485
427
|
export interface BackendAgentOptions {
|
|
486
428
|
/** What it is for, in a sentence or two (1024 characters at most): its build's contract says it, and Studio shows it. */
|