palbase 0.43.1 → 0.44.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.
Files changed (56) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +3 -3
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/{JS6QFPSR.js → 34R3K5US.js} +1 -1
  8. package/dist/chunks/{3BBJOHNC.js → 4UCIQG2Y.js} +1 -1
  9. package/dist/chunks/{EI3CP3O7.js → 5CCR2TT2.js} +2 -2
  10. package/dist/chunks/{KZDJTCZ6.js → B2UB6NXM.js} +1 -1
  11. package/dist/chunks/C23X4BLJ.js +18 -0
  12. package/dist/chunks/{YGF3LZZE.js → CSQQWUK3.js} +1 -1
  13. package/dist/chunks/{AX7C33RW.js → D3YUJVZV.js} +1 -1
  14. package/dist/chunks/{QINBTLCQ.js → H46O3FTO.js} +2 -2
  15. package/dist/chunks/{B5IZJXZU.js → J4STW4ES.js} +1 -1
  16. package/dist/chunks/K4C4USMS.js +2 -0
  17. package/dist/chunks/{LJM66WKM.js → MMATRRQU.js} +2 -2
  18. package/dist/chunks/{DDUOUX5Y.js → NBS26HGY.js} +1 -1
  19. package/dist/chunks/{WDVR33AO.js → NVOPULRM.js} +2 -2
  20. package/dist/chunks/{CEXZKCGA.js → NZSNVZQT.js} +2 -2
  21. package/dist/chunks/{CKVGJBDE.js → OIZX76IE.js} +2 -2
  22. package/dist/chunks/{2W3ELCC2.js → OS7P6J4N.js} +2 -2
  23. package/dist/chunks/{IQMWDELL.js → P6TUNAHK.js} +2 -2
  24. package/dist/chunks/{2MAP5CJ6.js → Q6UBSQPN.js} +2 -2
  25. package/dist/chunks/{QDP5IIMZ.js → QKZQMN7B.js} +2 -2
  26. package/dist/chunks/{SVUVPTA4.js → R2ED6W3Q.js} +2 -2
  27. package/dist/chunks/{USJJR7ID.js → URWXDZAD.js} +2 -2
  28. package/dist/chunks/{ISTUIM3X.js → WWHXFMDI.js} +7 -7
  29. package/dist/chunks/{P5PHOIEQ.js → YIJIXCUR.js} +2 -2
  30. package/dist/cli.js +149 -149
  31. package/dist/cloud/index.js +2 -2
  32. package/dist/refuse/ai.js +1 -1
  33. package/dist/refuse/backend.js +1 -1
  34. package/dist/refuse/cloud.js +1 -1
  35. package/dist/refuse/server.js +1 -1
  36. package/dist/server/index.js +2 -2
  37. package/dist/server/testing.js +2 -2
  38. package/dist/web/index.js +2 -2
  39. package/dist/web/message.js +2 -2
  40. package/dist/web/palbe.js +2 -2
  41. package/dist/web/paywall.js +2 -2
  42. package/dist/web/push-sw.js +1 -1
  43. package/dist/web/ssr.js +2 -2
  44. package/dist/web/vite.js +2 -2
  45. package/package.json +2 -2
  46. package/types/ai/src/ai.d.ts +21 -1
  47. package/types/ai/src/chats.d.ts +107 -3
  48. package/types/ai/src/index.d.ts +3 -2
  49. package/types/ai/src/pools.d.ts +177 -0
  50. package/types/ai/src/tools.d.ts +71 -3
  51. package/types/cloud/src/generated/project.d.ts +1 -1
  52. package/types/cloud/src/generated/studio.d.ts +10 -0
  53. package/types/internal/src/modules/ai.d.ts +1051 -70
  54. package/types/internal/src/modules/events.d.ts +2 -2
  55. package/dist/chunks/U5ZYNBB2.js +0 -2
  56. package/dist/chunks/Y5S3P3BL.js +0 -18
@@ -73,7 +73,7 @@ export type Agent = {
73
73
  updated_by?: string;
74
74
  };
75
75
  /**
76
- * What an agent is: its instructions, model, tools and subagents, and the shape of its one-shot answers.
76
+ * What an agent is: its instructions, model, tools and subagents, its own variables and setup script, and the shape of its one-shot answers.
77
77
  */
78
78
  export type AgentDefinition = {
79
79
  advisor?: Advisor;
@@ -89,6 +89,12 @@ export type AgentDefinition = {
89
89
  * How hard the model thinks: none, minimal, low, medium, high, xhigh, max — which rungs a model takes is its catalogue entry's (GET /ai/models, efforts). Left out: the platform's.
90
90
  */
91
91
  effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
92
+ /**
93
+ * The agent's own variables, name → value (names: upper-case letters, digits and _, not PALAI_…; 64 at most; a value 32 KiB at most): every command of its sessions has them, on every pool, beside the project's (PUT /ai/env/{key}), masked in a transcript. A value is never answered again: a definition read back says each name with an empty value, and a name written with an empty value keeps the value it has.
94
+ */
95
+ env?: {
96
+ [key: string]: string;
97
+ };
92
98
  /**
93
99
  * Its instructions.
94
100
  */
@@ -111,6 +117,10 @@ export type AgentDefinition = {
111
117
  output?: {
112
118
  [key: string]: unknown;
113
119
  };
120
+ /**
121
+ * A shell script each of its sessions runs once at its start, before the agent's first command, on every pool (64 KiB at most).
122
+ */
123
+ setup?: string;
114
124
  /**
115
125
  * Its subagents (16 at most).
116
126
  */
@@ -252,6 +262,10 @@ export type Chat = {
252
262
  metadata: {
253
263
  [key: string]: string;
254
264
  };
265
+ /**
266
+ * The project's runner pool its workspace runs on, by its id; absent: the platform's own Linux machines. A fork runs on its chat's.
267
+ */
268
+ pool?: string;
255
269
  /**
256
270
  * Its title.
257
271
  */
@@ -511,6 +525,10 @@ export type ChatRequest = {
511
525
  metadata?: {
512
526
  [key: string]: string;
513
527
  };
528
+ /**
529
+ * The project's runner pool its workspace runs on (GET /ai/pools), by its id or its name; one the project has not: 400. None: the platform's own Linux machines. A chat that names one works in a workspace.
530
+ */
531
+ pool?: string;
514
532
  /**
515
533
  * Its title (256 bytes at most).
516
534
  */
@@ -732,6 +750,10 @@ export type Endpoint = {
732
750
  * Its address.
733
751
  */
734
752
  url: string;
753
+ /**
754
+ * The endpoint — an MCP server or an HTTPS tool — is the project's own, reading or writing a chat's workspace: each call tells it the tree it is made at (an MCP server in its _meta palbase/workspace, an HTTPS tool in its context.workspace: the chat's id and the tree), and the tree its answer names is waited for. False: it is told nothing of the chat's workspace (an HTTPS tool is told the turn's chat_id as ever). The project's backend's tools are told the workspace always.
755
+ */
756
+ workspace: boolean;
735
757
  };
736
758
  /**
737
759
  * The project's endpoints.
@@ -768,6 +790,49 @@ export type EndpointRequest = {
768
790
  * An https:// address on the public internet.
769
791
  */
770
792
  url: string;
793
+ /**
794
+ * True for an endpoint of the project's own — an MCP server or an HTTPS tool — that reads or writes a chat's workspace: each call tells it the tree it is made at (an MCP server in its _meta palbase/workspace, an HTTPS tool in its context.workspace: the chat's id, manifest_id and seq), and the tree its answer names (an MCP result's _meta palbase/workspace_tree, an HTTPS answer's workspace_tree) is waited for. False (the default, which every endpoint put before an HTTPS tool took the setting has): any server's address — a third party's API or MCP server — told nothing of the chat's workspace, a tree it answers ignored. The project's backend's tools are told the workspace always.
795
+ */
796
+ workspace?: boolean;
797
+ };
798
+ /**
799
+ * The project's variables.
800
+ */
801
+ export type EnvList = {
802
+ /**
803
+ * Their names, sorted.
804
+ */
805
+ variables: EnvVar[];
806
+ };
807
+ /**
808
+ * A variable's value.
809
+ */
810
+ export type EnvRequest = {
811
+ /**
812
+ * Whether it is a secret (the default): said so in the list. Every value is masked in a transcript either way.
813
+ */
814
+ secret?: boolean;
815
+ /**
816
+ * Its value: 1 byte to 32 KiB, no NUL. Sealed, never answered, never logged.
817
+ */
818
+ value: string;
819
+ };
820
+ /**
821
+ * One of the project's variables: its name, never its value.
822
+ */
823
+ export type EnvVar = {
824
+ /**
825
+ * Its name.
826
+ */
827
+ key: string;
828
+ /**
829
+ * Whether it is a secret.
830
+ */
831
+ secret: boolean;
832
+ /**
833
+ * When it was last set.
834
+ */
835
+ updated_at: string;
771
836
  };
772
837
  export type ErrorResponse = {
773
838
  /**
@@ -1430,6 +1495,238 @@ export type NewMember = {
1430
1495
  */
1431
1496
  user_id: string;
1432
1497
  };
1498
+ /**
1499
+ * A runner pool of the project's.
1500
+ */
1501
+ export type Pool = {
1502
+ /**
1503
+ * Its machines' architecture: amd64 or arm64.
1504
+ */
1505
+ arch: string;
1506
+ /**
1507
+ * How many sessions its machines take at once (listed pools).
1508
+ */
1509
+ capacity_total?: number;
1510
+ /**
1511
+ * How many they hold now (listed pools).
1512
+ */
1513
+ capacity_used?: number;
1514
+ /**
1515
+ * When it was made.
1516
+ */
1517
+ created_at?: string;
1518
+ /**
1519
+ * Its id.
1520
+ */
1521
+ id: string;
1522
+ /**
1523
+ * How many machines it has (listed pools).
1524
+ */
1525
+ machines?: number;
1526
+ /**
1527
+ * Its name.
1528
+ */
1529
+ name: string;
1530
+ /**
1531
+ * Its machines' operating system: linux or macos.
1532
+ */
1533
+ os: string;
1534
+ /**
1535
+ * How many sessions wait for a place on the pool's machines: parked until one of them has room (listed pools).
1536
+ */
1537
+ waiting?: number;
1538
+ };
1539
+ /**
1540
+ * A pool's single-use enrolment key.
1541
+ */
1542
+ export type PoolKey = {
1543
+ /**
1544
+ * When it was minted.
1545
+ */
1546
+ created_at?: string;
1547
+ enroll?: PoolKeyEnroll;
1548
+ /**
1549
+ * The enrolment address (enroll.url), said with the key as it is minted: `palai enroll --url`.
1550
+ */
1551
+ enroll_url?: string;
1552
+ /**
1553
+ * When it can no longer be used.
1554
+ */
1555
+ expires_at?: string;
1556
+ /**
1557
+ * Its id: revoke it by it.
1558
+ */
1559
+ id: string;
1560
+ /**
1561
+ * The key, said once — as it is minted, never again: saved to a file on the machine, `palai enroll --url <enroll_url> --key-file <file> --capacity <n>`.
1562
+ */
1563
+ key?: string;
1564
+ /**
1565
+ * What it is for.
1566
+ */
1567
+ label?: string;
1568
+ /**
1569
+ * When a machine last enrolled with it.
1570
+ */
1571
+ last_used_at?: string;
1572
+ /**
1573
+ * When it was revoked.
1574
+ */
1575
+ revoked_at?: string;
1576
+ };
1577
+ /**
1578
+ * Where a machine enrols with it, said with the key as it is minted (never in a list): `palai enroll --url <url> --key-file <file>`, with `--server-name <server_name>` when the door's certificate names another host, and `--ca-file <file>` holding ca_certificate when the door's certificate is not publicly trusted.
1579
+ */
1580
+ export type PoolKeyEnroll = {
1581
+ /**
1582
+ * The CA the door's certificate is signed by (PEM), when it is not publicly trusted: saved to a file, `palai enroll --ca-file`.
1583
+ */
1584
+ ca_certificate?: string;
1585
+ /**
1586
+ * The name the door's certificate carries, when it differs from the address's host: `palai enroll --server-name`.
1587
+ */
1588
+ server_name?: string;
1589
+ /**
1590
+ * The enrolment address: `palai enroll --url`.
1591
+ */
1592
+ url: string;
1593
+ };
1594
+ /**
1595
+ * A pool's enrolment keys.
1596
+ */
1597
+ export type PoolKeyList = {
1598
+ /**
1599
+ * The keys, none said.
1600
+ */
1601
+ keys: PoolKey[];
1602
+ };
1603
+ /**
1604
+ * An enrolment key to mint.
1605
+ */
1606
+ export type PoolKeyRequest = {
1607
+ /**
1608
+ * What it is for — the machine it enrols: 128 bytes of UTF-8 at most (maxLength counts characters, so a label of fewer may still be too long), with no control character, no format character (a bidi override or isolate, a zero-width space or joiner, a byte order mark) and no line or paragraph separator — a label is shown as it was written.
1609
+ */
1610
+ label?: string;
1611
+ };
1612
+ /**
1613
+ * The project's runner pools.
1614
+ */
1615
+ export type PoolList = {
1616
+ /**
1617
+ * The pools.
1618
+ */
1619
+ pools: Pool[];
1620
+ };
1621
+ /**
1622
+ * A machine of a pool.
1623
+ */
1624
+ export type PoolMachine = {
1625
+ /**
1626
+ * Its architecture.
1627
+ */
1628
+ arch?: string;
1629
+ /**
1630
+ * How many sessions it takes at once (--capacity).
1631
+ */
1632
+ capacity: number;
1633
+ /**
1634
+ * Its id: cordon, resume or delete it by it.
1635
+ */
1636
+ id: string;
1637
+ /**
1638
+ * Since when it holds none (null: it holds one).
1639
+ */
1640
+ idle_since?: string | null;
1641
+ /**
1642
+ * Its label, as it enrolled.
1643
+ */
1644
+ label?: string;
1645
+ /**
1646
+ * When it was last heard from.
1647
+ */
1648
+ last_seen_at?: string | null;
1649
+ /**
1650
+ * Its operating system.
1651
+ */
1652
+ os?: string;
1653
+ /**
1654
+ * When it enrolled.
1655
+ */
1656
+ registered_at?: string | null;
1657
+ /**
1658
+ * online, offline, or cordoned (it takes no new session).
1659
+ */
1660
+ state: "online" | "offline" | "cordoned";
1661
+ /**
1662
+ * How many it holds now.
1663
+ */
1664
+ used: number;
1665
+ };
1666
+ /**
1667
+ * A runner pool to make: of one type.
1668
+ */
1669
+ export type PoolRequest = {
1670
+ /**
1671
+ * Its machines' architecture.
1672
+ */
1673
+ arch: "amd64" | "arm64";
1674
+ /**
1675
+ * Its name: lowercase letters, digits, _ and -, starting with a letter, at most 64; the project's once.
1676
+ */
1677
+ name: string;
1678
+ /**
1679
+ * Its machines' operating system.
1680
+ */
1681
+ os: "linux" | "macos";
1682
+ };
1683
+ /**
1684
+ * A pool's state: what its owner's scaling loop reads.
1685
+ */
1686
+ export type PoolState = {
1687
+ /**
1688
+ * How many sessions its machines take at once.
1689
+ */
1690
+ capacity_total: number;
1691
+ /**
1692
+ * How many they hold now.
1693
+ */
1694
+ capacity_used: number;
1695
+ /**
1696
+ * Its machines.
1697
+ */
1698
+ machines: PoolMachine[];
1699
+ /**
1700
+ * Since when the oldest waits (null: none waits).
1701
+ */
1702
+ oldest_waiting_since?: string | null;
1703
+ pool: PoolStateOf;
1704
+ /**
1705
+ * How many sessions wait for a place on the pool's machines: parked until one of them has room — what a scaling loop adds a machine for.
1706
+ */
1707
+ waiting: number;
1708
+ };
1709
+ /**
1710
+ * The pool a state is of.
1711
+ */
1712
+ export type PoolStateOf = {
1713
+ /**
1714
+ * amd64 or arm64.
1715
+ */
1716
+ arch: string;
1717
+ /**
1718
+ * Its id.
1719
+ */
1720
+ id: string;
1721
+ /**
1722
+ * Its name.
1723
+ */
1724
+ name: string;
1725
+ /**
1726
+ * linux or macos.
1727
+ */
1728
+ os: string;
1729
+ };
1433
1730
  /**
1434
1731
  * A provider the project connected with its own key.
1435
1732
  */
@@ -1923,125 +2220,365 @@ export type Subagent = {
1923
2220
  tools?: ToolRef[];
1924
2221
  };
1925
2222
  /**
1926
- * A role a text model is chosen by.
2223
+ * One path as a writer changed it.
1927
2224
  */
1928
- export type TextModel = {
1929
- /**
1930
- * What it is for.
1931
- */
1932
- description: string;
2225
+ export type SyncChange = {
2226
+ now?: SyncEntry;
1933
2227
  /**
1934
- * The role.
2228
+ * The path.
1935
2229
  */
1936
- role: string;
2230
+ path: string;
2231
+ previous?: SyncEntry;
1937
2232
  };
1938
2233
  /**
1939
- * The support line's answer: what to do, and whether it was logged as something Palbase lacks — then with the case it was logged under.
2234
+ * A writer's changes.
1940
2235
  */
1941
- export type SupportAnswer = {
2236
+ export type SyncChangeSet = {
1942
2237
  /**
1943
- * The answer, in the question's language, naming the documentation it is taken from.
2238
+ * Its changes, each with what it last knew of its path.
1944
2239
  */
1945
- answer: string;
2240
+ changes: SyncChange[];
1946
2241
  /**
1947
- * The case's id (sup_…), given only when the question was logged: what the asker holds of it, and what the mail sent when it is closed names. An answer that logged nothing has no case.
2242
+ * The head the writer last applied in full.
1948
2243
  */
1949
- case?: string;
2244
+ known_seq: number;
1950
2245
  /**
1951
- * Whether the question was logged as something Palbase lacks: the asker is mailed when it is closed.
2246
+ * Why it publishes.
1952
2247
  */
1953
- logged: boolean;
2248
+ reason?: string;
1954
2249
  };
1955
2250
  /**
1956
- * A question to Palbase's support line.
2251
+ * The store's answer to a publish.
1957
2252
  */
1958
- export type SupportQuestion = {
1959
- /**
1960
- * What the asker's project shows (at most 32768 characters): its machines, their last builds, a failed build's log. Credential-shaped values are masked before the model or anyone else reads it.
1961
- */
1962
- context?: string;
2253
+ export type SyncChangeSetResult = {
1963
2254
  /**
1964
- * The question, in any language. Credential-shaped values are masked before the model or anyone else reads it.
2255
+ * The paths applied.
1965
2256
  */
1966
- question: string;
1967
- };
1968
- /**
1969
- * A tool an agent of the project's may be given, as a ToolRef names it.
1970
- */
1971
- export type Tool = {
2257
+ applied?: string[];
1972
2258
  /**
1973
- * Every call waits for a person's yes.
2259
+ * What changed since known_seq that the writer has not seen.
1974
2260
  */
1975
- approval: boolean;
2261
+ catch_up?: SyncPathState[];
1976
2262
  /**
1977
- * What it does.
2263
+ * known_seq is older than the kept history: catch_up is the whole tree.
1978
2264
  */
1979
- description: string;
2265
+ catch_up_full?: boolean;
1980
2266
  /**
1981
- * backend, client: the machine whose build declares it.
2267
+ * The changes that lost.
1982
2268
  */
1983
- machine?: string;
2269
+ conflicts?: SyncConflict[];
1984
2270
  /**
1985
- * Its name.
2271
+ * The head's tree now.
1986
2272
  */
1987
- name: string;
2273
+ manifest_id: string;
1988
2274
  /**
1989
- * What it takes, as a JSON Schema (an MCP server says its own when it is called).
2275
+ * The head's sequence now.
1990
2276
  */
1991
- parameters?: {
1992
- [key: string]: unknown;
1993
- };
2277
+ seq: number;
1994
2278
  /**
1995
- * backend: the backend's function; client: the app answers it; https, mcp: an endpoint of the project's; platform: the platform's.
2279
+ * Its checksum.
1996
2280
  */
1997
- source: "backend" | "client" | "https" | "mcp" | "platform";
2281
+ tree_checksum?: string;
1998
2282
  };
1999
2283
  /**
2000
- * A part of what a tool returned.
2284
+ * What changed since a sequence, as it is at the head (none: the head alone).
2001
2285
  */
2002
- export type ToolContent = {
2286
+ export type SyncChanges = {
2003
2287
  /**
2004
- * An image as base64 (5 MiB at most).
2288
+ * Each changed path, as it is at the head.
2005
2289
  */
2006
- data?: string;
2290
+ changes?: SyncPathState[];
2007
2291
  /**
2008
- * An image's type: image/png, image/jpeg, image/webp or image/gif.
2292
+ * since is older than the kept history (or 0): changes is the whole tree.
2009
2293
  */
2010
- media_type?: string;
2294
+ full?: boolean;
2011
2295
  /**
2012
- * The text.
2296
+ * The head's tree.
2013
2297
  */
2014
- text?: string;
2298
+ manifest_id: string;
2015
2299
  /**
2016
- * text or image.
2300
+ * The head's sequence.
2017
2301
  */
2018
- type: "text" | "image";
2302
+ seq: number;
2303
+ /**
2304
+ * The sequence asked from.
2305
+ */
2306
+ since?: number;
2307
+ /**
2308
+ * The head's tree's checksum.
2309
+ */
2310
+ tree_checksum?: string;
2019
2311
  };
2020
2312
  /**
2021
- * The tools the project's agents may be given.
2313
+ * A change that lost: the path had changed in the store since the writer saw it.
2022
2314
  */
2023
- export type ToolList = {
2315
+ export type SyncConflict = {
2024
2316
  /**
2025
- * The backend's (its builds that serve), the project's endpoints, then the platform's.
2317
+ * The conflict: read it by it (GET /ai/workspace-sync/conflicts/{conflict_id}).
2026
2318
  */
2027
- tools: Tool[];
2319
+ id: string;
2320
+ lost?: SyncEntry;
2321
+ /**
2322
+ * The path.
2323
+ */
2324
+ path: string;
2325
+ winner?: SyncEntry;
2028
2326
  };
2029
2327
  /**
2030
- * What an app's tool returned (1 MiB of text and 4 images at most).
2328
+ * A conflict as the workspace's history keeps it.
2031
2329
  */
2032
- export type ToolOutput = {
2330
+ export type SyncConflictDetail = {
2033
2331
  /**
2034
- * The member the project's server acts as: held to that member's rules — their turn (403 not_your_turn) (the server's alone: a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Left out, the server acts as itself.
2332
+ * When it lost.
2035
2333
  */
2036
- as?: string;
2334
+ created_at?: string;
2037
2335
  /**
2038
- * The tool failed; the output says why.
2336
+ * The conflict.
2039
2337
  */
2040
- is_error?: boolean;
2338
+ id: string;
2339
+ lost?: SyncEntry;
2041
2340
  /**
2042
- * Text and images: the agent is shown both.
2341
+ * The tree the store was at.
2043
2342
  */
2044
- output: ToolContent[];
2343
+ manifest_id?: string;
2344
+ /**
2345
+ * The path.
2346
+ */
2347
+ path: string;
2348
+ read?: SyncGrant;
2349
+ winner?: SyncEntry;
2350
+ /**
2351
+ * Who wrote the version that lost.
2352
+ */
2353
+ writer?: string;
2354
+ };
2355
+ /**
2356
+ * What a path is in a tree: a file (its digest, size and mode) or a directory.
2357
+ */
2358
+ export type SyncEntry = {
2359
+ /**
2360
+ * A file's bytes' digest: sha256:<hex>.
2361
+ */
2362
+ digest?: string;
2363
+ /**
2364
+ * file or dir.
2365
+ */
2366
+ kind: "file" | "dir";
2367
+ /**
2368
+ * A file's mode.
2369
+ */
2370
+ mode?: number;
2371
+ /**
2372
+ * A file's size in bytes.
2373
+ */
2374
+ size?: number;
2375
+ };
2376
+ /**
2377
+ * One presigned request.
2378
+ */
2379
+ export type SyncGrant = {
2380
+ /**
2381
+ * The headers it is made with.
2382
+ */
2383
+ headers?: {
2384
+ [key: string]: string;
2385
+ };
2386
+ /**
2387
+ * Its method.
2388
+ */
2389
+ method: string;
2390
+ /**
2391
+ * Its address, signed.
2392
+ */
2393
+ url: string;
2394
+ };
2395
+ /**
2396
+ * The blobs to transfer, by their digests.
2397
+ */
2398
+ export type SyncGrantRequest = {
2399
+ /**
2400
+ * Blobs it will read.
2401
+ */
2402
+ get?: string[];
2403
+ /**
2404
+ * Blobs the writer will upload.
2405
+ */
2406
+ put?: string[];
2407
+ };
2408
+ /**
2409
+ * Each digest asked for, and its grant (a put the store holds already is absent).
2410
+ */
2411
+ export type SyncGrants = {
2412
+ /**
2413
+ * Reads, by digest.
2414
+ */
2415
+ get?: {
2416
+ [key: string]: SyncGrant;
2417
+ };
2418
+ /**
2419
+ * Uploads, by digest.
2420
+ */
2421
+ put?: {
2422
+ [key: string]: SyncGrant;
2423
+ };
2424
+ };
2425
+ /**
2426
+ * A path as it is at a head (state null: absent).
2427
+ */
2428
+ export type SyncPathState = {
2429
+ /**
2430
+ * The path, relative to the workspace's root.
2431
+ */
2432
+ path: string;
2433
+ state: SyncEntry;
2434
+ };
2435
+ /**
2436
+ * The store's refusal (RFC 9457).
2437
+ */
2438
+ export type SyncProblem = {
2439
+ /**
2440
+ * Its stable code.
2441
+ */
2442
+ code?: string;
2443
+ /**
2444
+ * Its sentence.
2445
+ */
2446
+ detail?: string;
2447
+ /**
2448
+ * Its status.
2449
+ */
2450
+ status?: number;
2451
+ /**
2452
+ * Its title.
2453
+ */
2454
+ title?: string;
2455
+ /**
2456
+ * Its type.
2457
+ */
2458
+ type?: string;
2459
+ [key: string]: unknown;
2460
+ };
2461
+ /**
2462
+ * A role a text model is chosen by.
2463
+ */
2464
+ export type TextModel = {
2465
+ /**
2466
+ * What it is for.
2467
+ */
2468
+ description: string;
2469
+ /**
2470
+ * The role.
2471
+ */
2472
+ role: string;
2473
+ };
2474
+ /**
2475
+ * The support line's answer: what to do, and whether it was logged as something Palbase lacks — then with the case it was logged under.
2476
+ */
2477
+ export type SupportAnswer = {
2478
+ /**
2479
+ * The answer, in the question's language, naming the documentation it is taken from.
2480
+ */
2481
+ answer: string;
2482
+ /**
2483
+ * The case's id (sup_…), given only when the question was logged: what the asker holds of it, and what the mail sent when it is closed names. An answer that logged nothing has no case.
2484
+ */
2485
+ case?: string;
2486
+ /**
2487
+ * Whether the question was logged as something Palbase lacks: the asker is mailed when it is closed.
2488
+ */
2489
+ logged: boolean;
2490
+ };
2491
+ /**
2492
+ * A question to Palbase's support line.
2493
+ */
2494
+ export type SupportQuestion = {
2495
+ /**
2496
+ * What the asker's project shows (at most 32768 characters): its machines, their last builds, a failed build's log. Credential-shaped values are masked before the model or anyone else reads it.
2497
+ */
2498
+ context?: string;
2499
+ /**
2500
+ * The question, in any language. Credential-shaped values are masked before the model or anyone else reads it.
2501
+ */
2502
+ question: string;
2503
+ };
2504
+ /**
2505
+ * A tool an agent of the project's may be given, as a ToolRef names it.
2506
+ */
2507
+ export type Tool = {
2508
+ /**
2509
+ * Every call waits for a person's yes.
2510
+ */
2511
+ approval: boolean;
2512
+ /**
2513
+ * What it does.
2514
+ */
2515
+ description: string;
2516
+ /**
2517
+ * backend, client: the machine whose build declares it.
2518
+ */
2519
+ machine?: string;
2520
+ /**
2521
+ * Its name.
2522
+ */
2523
+ name: string;
2524
+ /**
2525
+ * What it takes, as a JSON Schema (an MCP server says its own when it is called).
2526
+ */
2527
+ parameters?: {
2528
+ [key: string]: unknown;
2529
+ };
2530
+ /**
2531
+ * backend: the backend's function; client: the app answers it; https, mcp: an endpoint of the project's; platform: the platform's.
2532
+ */
2533
+ source: "backend" | "client" | "https" | "mcp" | "platform";
2534
+ };
2535
+ /**
2536
+ * A part of what a tool returned.
2537
+ */
2538
+ export type ToolContent = {
2539
+ /**
2540
+ * An image as base64 (5 MiB at most).
2541
+ */
2542
+ data?: string;
2543
+ /**
2544
+ * An image's type: image/png, image/jpeg, image/webp or image/gif.
2545
+ */
2546
+ media_type?: string;
2547
+ /**
2548
+ * The text.
2549
+ */
2550
+ text?: string;
2551
+ /**
2552
+ * text or image.
2553
+ */
2554
+ type: "text" | "image";
2555
+ };
2556
+ /**
2557
+ * The tools the project's agents may be given.
2558
+ */
2559
+ export type ToolList = {
2560
+ /**
2561
+ * The backend's (its builds that serve), the project's endpoints, then the platform's.
2562
+ */
2563
+ tools: Tool[];
2564
+ };
2565
+ /**
2566
+ * What an app's tool returned (1 MiB of text and 4 images at most).
2567
+ */
2568
+ export type ToolOutput = {
2569
+ /**
2570
+ * The member the project's server acts as: held to that member's rules — their turn (403 not_your_turn) (the server's alone: a user sending it is answered 400; one who is not a member of the chat, 403 not_a_member). Left out, the server acts as itself.
2571
+ */
2572
+ as?: string;
2573
+ /**
2574
+ * The tool failed; the output says why.
2575
+ */
2576
+ is_error?: boolean;
2577
+ /**
2578
+ * Text and images: the agent is shown both.
2579
+ */
2580
+ output: ToolContent[];
2581
+ workspace_tree?: WorkspaceTree;
2045
2582
  };
2046
2583
  /**
2047
2584
  * An app's answer the turn was given.
@@ -2572,6 +3109,91 @@ export type WorkspaceChange = {
2572
3109
  */
2573
3110
  size_bytes: number;
2574
3111
  };
3112
+ /**
3113
+ * The path both wrote.
3114
+ */
3115
+ export type WorkspaceConflict = {
3116
+ /**
3117
+ * The conflict: the version that lost is kept in the workspace's history 30 days, read by it (GET /ai/workspace-sync/conflicts/{conflict_id}).
3118
+ */
3119
+ id: string;
3120
+ lost: WorkspaceEntry;
3121
+ /**
3122
+ * The path.
3123
+ */
3124
+ path: string;
3125
+ winner: WorkspaceEntry;
3126
+ };
3127
+ /**
3128
+ * A writer's change of the chat's workspace that lost: the path had changed in the store since the writer saw it — the first to reach the store wins.
3129
+ */
3130
+ export type WorkspaceConflictEvent = {
3131
+ /**
3132
+ * The chat.
3133
+ */
3134
+ chat_id: string;
3135
+ conflict: WorkspaceConflict;
3136
+ /**
3137
+ * The tree the store was at when it kept the change aside.
3138
+ */
3139
+ manifest_id: string;
3140
+ /**
3141
+ * The chat's labels.
3142
+ */
3143
+ metadata: {
3144
+ [key: string]: string;
3145
+ };
3146
+ /**
3147
+ * Its sequence.
3148
+ */
3149
+ seq: number;
3150
+ /**
3151
+ * Who wrote the version that lost: the session's machine, a machine syncing the workspace (its token's label), the project's backend.
3152
+ */
3153
+ writer: string;
3154
+ };
3155
+ /**
3156
+ * What a path is in a tree: a file or a directory (null: absent).
3157
+ */
3158
+ export type WorkspaceEntry = {
3159
+ /**
3160
+ * A file's digest (sha256:<hex>).
3161
+ */
3162
+ digest?: string;
3163
+ /**
3164
+ * file or dir.
3165
+ */
3166
+ kind: string;
3167
+ /**
3168
+ * A file's mode.
3169
+ */
3170
+ mode?: number;
3171
+ /**
3172
+ * A file's size in bytes.
3173
+ */
3174
+ size?: number;
3175
+ };
3176
+ /**
3177
+ * A file's bytes.
3178
+ */
3179
+ export type WorkspaceFileBytes = Blob;
3180
+ /**
3181
+ * What a write of a workspace's file left.
3182
+ */
3183
+ export type WorkspaceFileWritten = {
3184
+ /**
3185
+ * The tree the workspace is at now: read a file of it by it (GET …/workspace/files?manifest=).
3186
+ */
3187
+ manifest_id: string;
3188
+ /**
3189
+ * The file.
3190
+ */
3191
+ path: string;
3192
+ /**
3193
+ * Its place in the workspace's history.
3194
+ */
3195
+ seq: number;
3196
+ };
2575
3197
  /**
2576
3198
  * A tree the chat's workspace published: its machine publishes whenever the files are quiet for a moment — mid-turn, as a build writes its product — and once more as it lets the workspace go.
2577
3199
  */
@@ -2667,6 +3289,103 @@ export type WorkspaceRepoRequest = {
2667
3289
  */
2668
3290
  repo: string;
2669
3291
  };
3292
+ /**
3293
+ * A workspace token, not said.
3294
+ */
3295
+ export type WorkspaceToken = {
3296
+ /**
3297
+ * read or write.
3298
+ */
3299
+ access: string;
3300
+ /**
3301
+ * When it expires.
3302
+ */
3303
+ expires_at: string;
3304
+ /**
3305
+ * Its id: revoke it by it.
3306
+ */
3307
+ id: string;
3308
+ /**
3309
+ * What it is for.
3310
+ */
3311
+ label?: string;
3312
+ /**
3313
+ * The workspace's id in the store.
3314
+ */
3315
+ workspace_id: string;
3316
+ };
3317
+ /**
3318
+ * A chat's workspace's tokens.
3319
+ */
3320
+ export type WorkspaceTokenList = {
3321
+ /**
3322
+ * The tokens, none said.
3323
+ */
3324
+ tokens: WorkspaceToken[];
3325
+ };
3326
+ /**
3327
+ * A workspace token as it is minted: said once.
3328
+ */
3329
+ export type WorkspaceTokenMinted = {
3330
+ /**
3331
+ * read or write.
3332
+ */
3333
+ access: string;
3334
+ /**
3335
+ * When it expires.
3336
+ */
3337
+ expires_at: string;
3338
+ /**
3339
+ * Its id: revoke it by it.
3340
+ */
3341
+ id: string;
3342
+ /**
3343
+ * What it is for.
3344
+ */
3345
+ label?: string;
3346
+ /**
3347
+ * Where the workspace's token routes are, at the project's own address: `palai workspace sync --url <sync_url> <dir>`.
3348
+ */
3349
+ sync_url: string;
3350
+ /**
3351
+ * The token, said once: given `palai workspace sync` in its environment (PALAI_WORKSPACE_TOKEN) or on its standard input (--token-file -), never on its command line.
3352
+ */
3353
+ token: string;
3354
+ /**
3355
+ * The workspace's id in the store.
3356
+ */
3357
+ workspace_id: string;
3358
+ };
3359
+ /**
3360
+ * A workspace token to mint.
3361
+ */
3362
+ export type WorkspaceTokenRequest = {
3363
+ /**
3364
+ * read: the workspace followed; write: followed and written, both ways.
3365
+ */
3366
+ access: "read" | "write";
3367
+ /**
3368
+ * What it is for — the machine's name, say: a conflict names its writer by it. 128 bytes of UTF-8 at most (maxLength counts characters, so a label of fewer may still be too long), with no control character, no format character (a bidi override or isolate, a zero-width space or joiner, a byte order mark) and no line or paragraph separator — a label is shown as it was written.
3369
+ */
3370
+ label?: string;
3371
+ /**
3372
+ * How long it lives: 1 to 604800 (none: an hour) — a member's 1 to 3600; no longer than an environment's token it is minted with.
3373
+ */
3374
+ ttl_seconds?: number;
3375
+ };
3376
+ /**
3377
+ * The tree the tool's writes left the chat's workspace at, as a write of it answered them (PUT /ai/chats/{chat_id}/workspace/files): its manifest, its place in the workspace's history, either or both. A call that answered later names it as one answered at once does (workspace_tree): the agent's next command waits for the session's machine to have it. Left out: the tool wrote nothing there.
3378
+ */
3379
+ export type WorkspaceTree = {
3380
+ /**
3381
+ * The tree's manifest (a write's manifest_id).
3382
+ */
3383
+ manifest_id?: string;
3384
+ /**
3385
+ * Its place in the workspace's history (a write's seq).
3386
+ */
3387
+ seq?: number;
3388
+ };
2670
3389
  /** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
2671
3390
  export interface Events {
2672
3391
  /**
@@ -2697,6 +3416,10 @@ export interface Events {
2697
3416
  * ai.voice.started: a chat's voice began.
2698
3417
  */
2699
3418
  "ai.voice.started": VoiceEvent;
3419
+ /**
3420
+ * ai.workspace.conflict: a writer's change of a chat's workspace lost — the path had changed since the writer saw it; the version that lost is kept 30 days in the workspace's history.
3421
+ */
3422
+ "ai.workspace.conflict": WorkspaceConflictEvent;
2700
3423
  /**
2701
3424
  * ai.workspace.published: a chat's workspace published a tree — what its files are now, with the files it changed; read one of them by the tree (GET /ai/chats/{chat_id}/workspace/files?manifest=).
2702
3425
  */
@@ -3096,7 +3819,7 @@ export declare function client(t: Transport): {
3096
3819
  /**
3097
3820
  * Answer an app's tool call
3098
3821
  *
3099
- * The answer of a client tool's call, made by the app's code: the turn waiting for it goes on. The first answer is the one. Given by the app of the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as). A call of the project's backend (or an HTTPS tool of its) that answered {"deferred": true} — its work outlasts a call — is answered here too, by the project's server as itself, within the while it named (a minute to a day; an hour), and by no member.
3822
+ * The answer of a client tool's call, made by the app's code: the turn waiting for it goes on. The first answer is the one. Given by the app of the member whose message began the turn (403 not_your_turn for any other) — or by the project's server, for any turn, or as that member (as). A call of the project's backend (or an HTTPS tool of its) that answered {"deferred": true} — its work outlasts a call — is answered here too, by the project's server as itself, within the while it named (a minute to a day; an hour), and by no member. An answer whose tool wrote the chat's workspace names the tree its writes left (workspace_tree), as an answer given at once does: the agent's next command waits for the session's machine to have it (400 for one that names no tree).
3100
3823
  */
3101
3824
  answerChatToolCall(input: {
3102
3825
  path: {
@@ -3109,7 +3832,7 @@ export declare function client(t: Transport): {
3109
3832
  /**
3110
3833
  * A turn's artifacts
3111
3834
  *
3112
- * 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.
3835
+ * What the turn's agent published as its output (palai.artifact.publish) — a build's product, 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.
3113
3836
  */
3114
3837
  listChatTurnArtifacts(input: {
3115
3838
  path: {
@@ -3201,7 +3924,7 @@ export declare function client(t: Transport): {
3201
3924
  /**
3202
3925
  * A file of the chat's workspace
3203
3926
  *
3204
- * A file of the chat's workspace, its bytes (an attachment, never a page): from the tree the workspace is at now, or from the one an ai.workspace.published event named (manifest) — a build's product as that publish left it. Read by the chat's members and the project's server, as they read the chat. Served up to 64 MiB (413 file_too_large past it: publish a larger one as the turn's artifact); its digest is Content-Digest. A project reads 4 files at once (429 too_many_reads, Retry-After), and a file is written for no longer than its bytes take at 256 KiB/s and a minute more. A chat that works in no workspace yet, a tree of another workspace, a path its tree does not name: 404 file_not_found.
3927
+ * A file of the chat's workspace, its bytes (an attachment, never a page): from the tree the workspace is at now, or from the one an ai.workspace.published event named (manifest) — a build's product as that publish left it. Read by the chat's members and the project's server, as they read the chat. Served up to 64 MiB (413 file_too_large past it: publish a larger one as the turn's artifact); its digest is Content-Digest. Each of the module's servers reads 4 of a project's files at once (429 too_many_reads, Retry-After), and a file is written for no longer than its bytes take at 256 KiB/s and a minute more. A chat that works in no workspace yet, a tree of another workspace, a path its tree does not name: 404 file_not_found.
3205
3928
  */
3206
3929
  getChatWorkspaceFile(input: {
3207
3930
  path: {
@@ -3213,6 +3936,36 @@ export declare function client(t: Transport): {
3213
3936
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3214
3937
  signal?: AbortSignal;
3215
3938
  }): Promise<Reply<200, Response>>;
3939
+ /**
3940
+ * Write a file of the chat's workspace
3941
+ *
3942
+ * The customer's backend writes one file of the chat's workspace, its bytes the body (64 MiB at most: 413 file_too_large; each of the module's servers writes 2 of a project's at once, more are told to ask again: 429 too_many_reads): published over whatever the workspace's head holds — the write is deliberate, no conflict is made of it — and synced from there to every machine that holds the workspace, the session's own before the agent's next command. A body that says its length (Content-Length) is forwarded as it arrives; one sent in chunks is read whole first, to the same 64 MiB. What it published is told as ai.workspace.published. A chat whose first turn has not opened its workspace has it opened now. The project's server's, and a member's who may write the chat; a chat that works in no workspace: 409 no_workspace.
3943
+ */
3944
+ putChatWorkspaceFile(input: {
3945
+ path: {
3946
+ chat_id: string;
3947
+ };
3948
+ query: {
3949
+ path: string;
3950
+ };
3951
+ body: BodyInit;
3952
+ contentType?: string; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3953
+ signal?: AbortSignal;
3954
+ }): Promise<Reply<200, WorkspaceFileWritten>>;
3955
+ /**
3956
+ * Remove a file of the chat's workspace
3957
+ *
3958
+ * The customer's backend removes one file of the chat's workspace, as a write is (PUT): synced to every machine that holds it. The project's server's, and a member's who may write the chat.
3959
+ */
3960
+ deleteChatWorkspaceFile(input: {
3961
+ path: {
3962
+ chat_id: string;
3963
+ };
3964
+ query: {
3965
+ path: string;
3966
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3967
+ signal?: AbortSignal;
3968
+ }): Promise<Reply<200, WorkspaceFileWritten>>;
3216
3969
  /**
3217
3970
  * Put a repository in the chat's workspace
3218
3971
  *
@@ -3225,6 +3978,41 @@ export declare function client(t: Transport): {
3225
3978
  body: WorkspaceRepoRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3226
3979
  signal?: AbortSignal;
3227
3980
  }): Promise<Reply<200, Chat>>;
3981
+ /**
3982
+ * The workspace's tokens
3983
+ *
3984
+ * Its tokens — access, label, when each expires — none of them said again: the project's server's answer is every token of the workspace, a member's the ones they minted.
3985
+ */
3986
+ listChatWorkspaceTokens(input: {
3987
+ path: {
3988
+ chat_id: string;
3989
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3990
+ signal?: AbortSignal;
3991
+ }): Promise<Reply<200, WorkspaceTokenList>>;
3992
+ /**
3993
+ * Mint a workspace token
3994
+ *
3995
+ * A token of the chat's workspace for a machine of the customer's to sync it with — `PALAI_WORKSPACE_TOKEN=<token> palai workspace sync --url <sync_url> <dir>` (or the token on standard input: `--token-file -`; never on the command line): live and always both ways (write), or followed (read) — said once, here. It lives ttl_seconds (an hour when none, 7 days at most) — no longer than an environment's token it is minted with — and answers at the project's own address alone (sync_url, the workspace's token routes). While one lives the chat's workspace events are told (ai.workspace.published, ai.workspace.conflict). A chat whose first turn has not opened its workspace has it opened now. The project's server's, and a member's who may write the chat: a member's token lives an hour at most, is theirs alone to list and revoke, and answers only while they are in the chat and the project lets its users talk to its agents (settings.clients) — taking them out, or turning clients off, revokes it. A chat that works in no workspace: 409 no_workspace.
3996
+ */
3997
+ createChatWorkspaceToken(input: {
3998
+ path: {
3999
+ chat_id: string;
4000
+ };
4001
+ body: WorkspaceTokenRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4002
+ signal?: AbortSignal;
4003
+ }): Promise<Reply<201, WorkspaceTokenMinted>>;
4004
+ /**
4005
+ * Revoke a workspace token
4006
+ *
4007
+ * Revoked at once: every token route refuses it from then, an open event stream with it ends. The project's server revokes any token of the workspace; a member, one they minted (another's is not found).
4008
+ */
4009
+ revokeChatWorkspaceToken(input: {
4010
+ path: {
4011
+ chat_id: string; /** The token's id. */
4012
+ token: string;
4013
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4014
+ signal?: AbortSignal;
4015
+ }): Promise<Reply<204, undefined>>;
3228
4016
  /**
3229
4017
  * Turn texts into vectors
3230
4018
  *
@@ -3245,7 +4033,7 @@ export declare function client(t: Transport): {
3245
4033
  /**
3246
4034
  * Put a tool endpoint
3247
4035
  *
3248
- * A tool at an HTTPS address of the project's — called with a signed POST {tool, call_id, input, context: {chat_id, agent, user, metadata, turn_id, run_id, subagent} — the turn, and the run that called: the agent's own, or a subagent's at work (subagent names which, null for the agent)} and answered {output, is_error} or plain text — or an MCP server, whose tools an agent may use. The answer says an https tool's signing secret, once.
4036
+ * A tool at an HTTPS address of the project's — called with a signed POST {tool, call_id, input, context: {chat_id, agent, user, metadata, turn_id, run_id, subagent, workspace} — the turn, the run that called: the agent's own, or a subagent's at work (subagent names which, null for the agent), and, in a chat that works in a workspace, the workspace as the session last wrote it, flushed before the call: workspace {chat_id, manifest_id, seq} (read its files at that tree, GET /ai/chats/{chat_id}/workspace/files?manifest=)} — and answered {output, is_error, workspace_tree?} or plain text: a tool that wrote the workspace (PUT /ai/chats/{chat_id}/workspace/files) answers workspace_tree {manifest_id, seq} — the tree its writes left, either or both — and the agent's next command sees it — or an MCP server, whose tools an agent may use: when the project says it is its own (workspace: true), told the same tree in its tools/call's _meta (palbase/workspace), answering it in its result's _meta (palbase/workspace_tree); a third party's server is told nothing of a chat or its workspace. The answer says an https tool's signing secret, once.
3249
4037
  */
3250
4038
  putEndpoint(input: {
3251
4039
  path: {
@@ -3265,6 +4053,37 @@ export declare function client(t: Transport): {
3265
4053
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3266
4054
  signal?: AbortSignal;
3267
4055
  }): Promise<Reply<204, undefined>>;
4056
+ /**
4057
+ * The project's variables
4058
+ *
4059
+ * Their names, whether each is a secret, and when each was set: never a value.
4060
+ */
4061
+ listEnv(input?: {
4062
+ signal?: AbortSignal;
4063
+ }): Promise<Reply<200, EnvList>>;
4064
+ /**
4065
+ * Set a variable
4066
+ *
4067
+ * One of the project's variables or secrets, set or set anew: every command of every session of its agents begun from now has it — on the platform's Linux machines and on the project's own pools, Linux and Mac — beside the agent's own (its definition's env), masked wherever a transcript would show it. The value is sealed where the sessions run and never answered, nor logged; a refusal never repeats it.
4068
+ */
4069
+ putEnv(input: {
4070
+ path: {
4071
+ key: string;
4072
+ };
4073
+ body: EnvRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4074
+ signal?: AbortSignal;
4075
+ }): Promise<Reply<200, EnvVar>>;
4076
+ /**
4077
+ * Remove a variable
4078
+ *
4079
+ * Sessions begun from now no longer have it.
4080
+ */
4081
+ deleteEnv(input: {
4082
+ path: {
4083
+ key: string;
4084
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4085
+ signal?: AbortSignal;
4086
+ }): Promise<Reply<204, undefined>>;
3268
4087
  /**
3269
4088
  * Make pictures
3270
4089
  *
@@ -3300,6 +4119,39 @@ export declare function client(t: Transport): {
3300
4119
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3301
4120
  signal?: AbortSignal;
3302
4121
  }): Promise<Reply<200, Response>>;
4122
+ /**
4123
+ * Delete a machine
4124
+ *
4125
+ * A cordoned machine that holds no session leaves its pool; its `palai` agent is refused from then. One not cordoned: 409 machine_not_cordoned; one that holds a session: 409 machine_busy.
4126
+ */
4127
+ deleteMachine(input: {
4128
+ path: {
4129
+ machine: string;
4130
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4131
+ signal?: AbortSignal;
4132
+ }): Promise<Reply<204, undefined>>;
4133
+ /**
4134
+ * Cordon a machine
4135
+ *
4136
+ * The machine takes no new session; the sessions it holds run on. Delete it once it holds none (its state says used 0).
4137
+ */
4138
+ cordonMachine(input: {
4139
+ path: {
4140
+ machine: string;
4141
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4142
+ signal?: AbortSignal;
4143
+ }): Promise<Reply<204, undefined>>;
4144
+ /**
4145
+ * Resume a machine
4146
+ *
4147
+ * A cordoned machine takes sessions again.
4148
+ */
4149
+ resumeMachine(input: {
4150
+ path: {
4151
+ machine: string;
4152
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4153
+ signal?: AbortSignal;
4154
+ }): Promise<Reply<204, undefined>>;
3303
4155
  /**
3304
4156
  * What a project may name
3305
4157
  *
@@ -3308,6 +4160,79 @@ export declare function client(t: Transport): {
3308
4160
  listModels(input?: {
3309
4161
  signal?: AbortSignal;
3310
4162
  }): Promise<Reply<200, Models>>;
4163
+ /**
4164
+ * Revoke an enrolment key
4165
+ *
4166
+ * No machine enrols with it any more; the machines enrolled with it before are not touched (cordon and delete one: /ai/machines/{machine}).
4167
+ */
4168
+ revokePoolKey(input: {
4169
+ path: {
4170
+ key: string;
4171
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4172
+ signal?: AbortSignal;
4173
+ }): Promise<Reply<204, undefined>>;
4174
+ /**
4175
+ * The project's runner pools
4176
+ *
4177
+ * Every pool of the project's, with what its machines hold: how many machines, the sessions they take and take now (capacity_total, capacity_used), and how many sessions wait for a place (waiting).
4178
+ */
4179
+ listPools(input?: {
4180
+ signal?: AbortSignal;
4181
+ }): Promise<Reply<200, PoolList>>;
4182
+ /**
4183
+ * Make a runner pool
4184
+ *
4185
+ * A pool of one type — its machines' operating system (linux or macos) and architecture (amd64 or arm64) — that the project's own machines enrol into with the `palai` agent and a single-use key (POST /ai/pools/{pool}/keys). A chat that names it (POST /ai/chats {pool}) runs its workspace's sessions there. Managed through the API, the SDK and the CLI (palbase ai pools): the project scales it itself, reading its state (GET /ai/pools/{pool}/state). A name taken already: 409 pool_exists.
4186
+ */
4187
+ createPool(input: {
4188
+ body: PoolRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4189
+ signal?: AbortSignal;
4190
+ }): Promise<Reply<201, Pool>>;
4191
+ /**
4192
+ * Delete a runner pool
4193
+ *
4194
+ * A pool with no machine left in it: cordon each machine, delete it once it holds no session (DELETE /ai/machines/{machine}), then the pool. One with machines: 409 pool_not_empty.
4195
+ */
4196
+ deletePool(input: {
4197
+ path: {
4198
+ pool: string;
4199
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4200
+ signal?: AbortSignal;
4201
+ }): Promise<Reply<204, undefined>>;
4202
+ /**
4203
+ * A pool's enrolment keys
4204
+ *
4205
+ * Its single-use enrolment keys — when each was made, used, revoked, and when it expires — none of them said again.
4206
+ */
4207
+ listPoolKeys(input: {
4208
+ path: {
4209
+ pool: string;
4210
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4211
+ signal?: AbortSignal;
4212
+ }): Promise<Reply<200, PoolKeyList>>;
4213
+ /**
4214
+ * Mint an enrolment key
4215
+ *
4216
+ * A single-use key a machine of the project's enrols into the pool with (saved to a file on the machine: `palai enroll --key-file <file> --capacity <n>` — never on a command line), said once, here. A machine enrolled with it serves the project's sessions once whoever minted it is gone: never minted for an environment's token.
4217
+ */
4218
+ createPoolKey(input: {
4219
+ path: {
4220
+ pool: string;
4221
+ };
4222
+ body: PoolKeyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4223
+ signal?: AbortSignal;
4224
+ }): Promise<Reply<201, PoolKey>>;
4225
+ /**
4226
+ * A runner pool's state
4227
+ *
4228
+ * What the project's own scaling loop reads — no webhook tells it: each machine (online, offline or cordoned; the sessions it takes and holds; since when it is idle; when it was last seen), the pool's capacity and what it holds, how many sessions wait for a place and since when the oldest has waited. Scale up by enrolling machines; scale down by cordoning one (it takes no new session) and deleting it once it holds none.
4229
+ */
4230
+ getPoolState(input: {
4231
+ path: {
4232
+ pool: string;
4233
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4234
+ signal?: AbortSignal;
4235
+ }): Promise<Reply<200, PoolState>>;
3311
4236
  /**
3312
4237
  * The project's own provider keys
3313
4238
  *
@@ -3478,5 +4403,61 @@ export declare function client(t: Transport): {
3478
4403
  }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
3479
4404
  signal?: AbortSignal;
3480
4405
  }): Promise<Reply<200, UsagePage>>;
4406
+ /**
4407
+ * What changed since a sequence
4408
+ *
4409
+ * Every path whose state at the head differs from its state at since, as it is at the head (since 0, or older than the kept history: the whole tree, full). Called with the workspace token alone (Authorization: Bearer), at the project's own address — forwarded as it came to the workspace's store, whose answer it is (its refusals are its own problem documents, application/problem+json); a token this project did not mint, revoked or expired is refused here (401 invalid_token). This is the wire `palai workspace sync` speaks: its shapes are the store's.
4410
+ */
4411
+ getWorkspaceSyncChanges(input?: {
4412
+ query?: {
4413
+ since?: number;
4414
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4415
+ signal?: AbortSignal;
4416
+ }): Promise<Reply<200, SyncChanges>>;
4417
+ /**
4418
+ * Publish the writer's changes
4419
+ *
4420
+ * The writer's changes, each with what it last knew of its path (previous): applied only while the path still is that — the first to reach the store wins; a change that lost is kept aside as a conflict, in the workspace's history for 30 days (ai.workspace.conflict) — answered with the head, what was applied, what lost, and what changed since known_seq that the writer has not seen (catch_up). A write token's alone. Called with the workspace token alone (Authorization: Bearer), at the project's own address — forwarded as it came to the workspace's store, whose answer it is (its refusals are its own problem documents, application/problem+json); a token this project did not mint, revoked or expired is refused here (401 invalid_token). This is the wire `palai workspace sync` speaks: its shapes are the store's.
4421
+ */
4422
+ createWorkspaceSyncChangeSet(input: {
4423
+ body: SyncChangeSet; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4424
+ signal?: AbortSignal;
4425
+ }): Promise<Reply<200, SyncChangeSetResult>>;
4426
+ /**
4427
+ * A conflict, and the version that lost
4428
+ *
4429
+ * A conflict as the workspace's history keeps it (30 days): the path, the version that lost with a signed request to read its bytes (read), the one that won, the tree and the writer. Called with the workspace token alone (Authorization: Bearer), at the project's own address — forwarded as it came to the workspace's store, whose answer it is (its refusals are its own problem documents, application/problem+json); a token this project did not mint, revoked or expired is refused here (401 invalid_token). This is the wire `palai workspace sync` speaks: its shapes are the store's.
4430
+ */
4431
+ getWorkspaceSyncConflict(input: {
4432
+ path: {
4433
+ conflict_id: string;
4434
+ }; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4435
+ signal?: AbortSignal;
4436
+ }): Promise<Reply<200, SyncConflictDetail>>;
4437
+ /**
4438
+ * The workspace's events, as they happen
4439
+ *
4440
+ * An event stream (text/event-stream), passed on unbuffered: `event: head` when the head moves ({workspace_id, manifest_id, seq}) and `event: conflict` when a writer's change lost ({id, path, lost, winner}), with a comment line every 15 seconds. Each of the module's servers that answer the project's address holds 4 streams of a token open at once, 16 of a workspace, 64 of a project's tokens together — apart from the project's response streams (429 too_many_streams): the bounds are a server's, not the project's whole; a stream ends when its token is revoked, expires, or is a member's whose member left the chat. Called with the workspace token alone (Authorization: Bearer), at the project's own address — forwarded as it came to the workspace's store, whose answer it is (its refusals are its own problem documents, application/problem+json); a token this project did not mint, revoked or expired is refused here (401 invalid_token). This is the wire `palai workspace sync` speaks: its shapes are the store's.
4441
+ */
4442
+ getWorkspaceSyncEvents(input?: {
4443
+ signal?: AbortSignal;
4444
+ }): Promise<Reply<200, Response>>;
4445
+ /**
4446
+ * Signed transfers of the workspace's blobs
4447
+ *
4448
+ * Presigned requests for the blobs the writer will upload (put) and read (get), by their digests: a blob the store holds already is not in put — nothing to upload. Called with the workspace token alone (Authorization: Bearer), at the project's own address — forwarded as it came to the workspace's store, whose answer it is (its refusals are its own problem documents, application/problem+json); a token this project did not mint, revoked or expired is refused here (401 invalid_token). This is the wire `palai workspace sync` speaks: its shapes are the store's.
4449
+ */
4450
+ createWorkspaceSyncGrants(input: {
4451
+ body: SyncGrantRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
4452
+ signal?: AbortSignal;
4453
+ }): Promise<Reply<200, SyncGrants>>;
4454
+ /**
4455
+ * Where the workspace's head is
4456
+ *
4457
+ * The tree the workspace is at: its manifest, its sequence and its checksum. Called with the workspace token alone (Authorization: Bearer), at the project's own address — forwarded as it came to the workspace's store, whose answer it is (its refusals are its own problem documents, application/problem+json); a token this project did not mint, revoked or expired is refused here (401 invalid_token). This is the wire `palai workspace sync` speaks: its shapes are the store's.
4458
+ */
4459
+ getWorkspaceSyncHead(input?: {
4460
+ signal?: AbortSignal;
4461
+ }): Promise<Reply<200, SyncChanges>>;
3481
4462
  };
3482
4463
  export type Client = ReturnType<typeof client>;