@malloy-publisher/server 0.10.6 → 0.11.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 (34) hide show
  1. package/dist/app/api-doc.yaml +956 -125
  2. package/dist/app/assets/{EnvironmentPage-B9Q9ZYYM.js → EnvironmentPage-Dfn26tY2.js} +1 -1
  3. package/dist/app/assets/{HomePage-CVbXvH7c.js → HomePage-CNuMPINA.js} +1 -1
  4. package/dist/app/assets/MainPage-DWjs4_e3.js +1 -0
  5. package/dist/app/assets/ModelPage-GZ6hXGgw.js +2 -0
  6. package/dist/app/assets/PackagePage-_5vFWxqm.js +1 -0
  7. package/dist/app/assets/PackageSplatRoute-CTxtXKZO.js +2 -0
  8. package/dist/app/assets/{RenderedResult-B_sW7neX.es-CFeRQyYD.js → RenderedResult-r3dg2xOJ.es-t-MnqNaH.js} +3 -3
  9. package/dist/app/assets/{RouteError-BYb6Nj48.js → RouteError-y4xkvszw.js} +1 -1
  10. package/dist/app/assets/{ThemeEditorPage-CYe_2MfI.js → ThemeEditorPage-BffGFYK5.js} +1 -1
  11. package/dist/app/assets/ToggleButtonGroup-BfTJg9cJ.js +1 -0
  12. package/dist/app/assets/documentRoutes-DnpGGXs4.js +1 -0
  13. package/dist/app/assets/editPageMounted-efTmRdGK.js +2 -0
  14. package/dist/app/assets/{index-DEj7hnfZ.js → index-CG6r_Zwr.js} +1 -1
  15. package/dist/app/assets/{index-DWhQwvJR.js → index-CW23I6Cr.js} +1 -1
  16. package/dist/app/assets/index-D8JKtZm5.js +483 -0
  17. package/dist/app/assets/{index-3fArIYYK.js → index-g1sInkiO.js} +1 -1
  18. package/dist/app/assets/{index.es-CMsNTB-h.js → index.es-AXVff-Xr.js} +5 -5
  19. package/dist/app/assets/usePackageLinkNavigate-DpGlRKnc.js +1 -0
  20. package/dist/app/assets/usePackageRoute-BUdFd5dP.js +1 -0
  21. package/dist/app/index.html +1 -1
  22. package/dist/cpufeatures-gknxfsk5.node +0 -0
  23. package/dist/instrumentation.mjs +1 -1
  24. package/dist/package_load_worker.mjs +232 -190
  25. package/dist/runtime/publisher.js +58 -1
  26. package/dist/server.mjs +4518 -1138
  27. package/package.json +1 -1
  28. package/dist/app/assets/MainPage-D1Fj4Wy1.js +0 -1
  29. package/dist/app/assets/ModelPage-DmYocpWT.js +0 -2
  30. package/dist/app/assets/PackagePage-4TwX_ajC.js +0 -1
  31. package/dist/app/assets/ToggleButtonGroup-b325mGmL.js +0 -1
  32. package/dist/app/assets/documentRoutes-D_C8snHV.js +0 -1
  33. package/dist/app/assets/editPageMounted-1X99LP7v.js +0 -2
  34. package/dist/app/assets/index-CGKV9Dxi.js +0 -483
@@ -30,6 +30,7 @@ info:
30
30
  └── Environments
31
31
  ├── Connections schemas, tables, and ad-hoc SQL
32
32
  └── Packages
33
+ ├── Versions published, immutable versions and `latest`
33
34
  ├── Models query and compile
34
35
  ├── Notebooks execute a cell at a time
35
36
  ├── Data Apps static HTML data apps from public/
@@ -93,6 +94,10 @@ tags:
93
94
  description: Real-time file watching for development workflows
94
95
  - name: materializations
95
96
  description: Package-level materializations for persisting Malloy sources
97
+ - name: versions
98
+ description:
99
+ Published, immutable versions of a package, the package's `latest`
100
+ pointer, and each version's lifecycle (archive, manifest binding)
96
101
  - name: storage-destinations
97
102
  description: |
98
103
  Table lifecycle inside an environment's storage destinations, for an
@@ -1041,6 +1046,7 @@ paths:
1041
1046
  required: true
1042
1047
  schema:
1043
1048
  $ref: "#/components/schemas/IdentifierPattern"
1049
+ - $ref: "#/components/parameters/versionId"
1044
1050
  responses:
1045
1051
  "200":
1046
1052
  description: A list of schemas available in the connection with metadata
@@ -1050,10 +1056,14 @@ paths:
1050
1056
  type: array
1051
1057
  items:
1052
1058
  $ref: "#/components/schemas/Schema"
1059
+ "400":
1060
+ $ref: "#/components/responses/BadRequest"
1053
1061
  "401":
1054
1062
  $ref: "#/components/responses/Unauthorized"
1055
1063
  "404":
1056
1064
  $ref: "#/components/responses/NotFound"
1065
+ "410":
1066
+ $ref: "#/components/responses/Gone"
1057
1067
  "500":
1058
1068
  $ref: "#/components/responses/InternalServerError"
1059
1069
  "424":
@@ -1107,6 +1117,7 @@ paths:
1107
1117
  type: array
1108
1118
  items:
1109
1119
  type: string
1120
+ - $ref: "#/components/parameters/versionId"
1110
1121
  responses:
1111
1122
  "200":
1112
1123
  description: A list of table names available in the specified schema
@@ -1116,10 +1127,14 @@ paths:
1116
1127
  type: array
1117
1128
  items:
1118
1129
  $ref: "#/components/schemas/Table"
1130
+ "400":
1131
+ $ref: "#/components/responses/BadRequest"
1119
1132
  "401":
1120
1133
  $ref: "#/components/responses/Unauthorized"
1121
1134
  "404":
1122
1135
  $ref: "#/components/responses/NotFound"
1136
+ "410":
1137
+ $ref: "#/components/responses/Gone"
1123
1138
  "500":
1124
1139
  $ref: "#/components/responses/InternalServerError"
1125
1140
  "424":
@@ -1169,6 +1184,7 @@ paths:
1169
1184
  required: true
1170
1185
  schema:
1171
1186
  $ref: "#/components/schemas/PathPattern"
1187
+ - $ref: "#/components/parameters/versionId"
1172
1188
  responses:
1173
1189
  "200":
1174
1190
  description: Table information
@@ -1182,6 +1198,8 @@ paths:
1182
1198
  $ref: "#/components/responses/Unauthorized"
1183
1199
  "404":
1184
1200
  $ref: "#/components/responses/NotFound"
1201
+ "410":
1202
+ $ref: "#/components/responses/Gone"
1185
1203
  "424":
1186
1204
  $ref: "#/components/responses/ConnectionUnavailable"
1187
1205
  "500":
@@ -1219,6 +1237,7 @@ paths:
1219
1237
  required: true
1220
1238
  schema:
1221
1239
  $ref: "#/components/schemas/IdentifierPattern"
1240
+ - $ref: "#/components/parameters/versionId"
1222
1241
  requestBody:
1223
1242
  description: SQL statement to fetch the SQL source
1224
1243
  required: true
@@ -1242,6 +1261,8 @@ paths:
1242
1261
  $ref: "#/components/responses/Unauthorized"
1243
1262
  "404":
1244
1263
  $ref: "#/components/responses/NotFound"
1264
+ "410":
1265
+ $ref: "#/components/responses/Gone"
1245
1266
  "424":
1246
1267
  $ref: "#/components/responses/ConnectionUnavailable"
1247
1268
  "500":
@@ -1282,6 +1303,7 @@ paths:
1282
1303
  required: true
1283
1304
  schema:
1284
1305
  $ref: "#/components/schemas/IdentifierPattern"
1306
+ - $ref: "#/components/parameters/versionId"
1285
1307
  requestBody:
1286
1308
  description: SQL statement to execute
1287
1309
  required: true
@@ -1326,6 +1348,8 @@ paths:
1326
1348
  $ref: "#/components/responses/Forbidden"
1327
1349
  "404":
1328
1350
  $ref: "#/components/responses/NotFound"
1351
+ "410":
1352
+ $ref: "#/components/responses/Gone"
1329
1353
  "413":
1330
1354
  $ref: "#/components/responses/PayloadTooLarge"
1331
1355
  "424":
@@ -1367,6 +1391,7 @@ paths:
1367
1391
  required: true
1368
1392
  schema:
1369
1393
  $ref: "#/components/schemas/IdentifierPattern"
1394
+ - $ref: "#/components/parameters/versionId"
1370
1395
  requestBody:
1371
1396
  description: SQL statement to create the temporary table
1372
1397
  required: true
@@ -1390,6 +1415,8 @@ paths:
1390
1415
  $ref: "#/components/responses/Unauthorized"
1391
1416
  "404":
1392
1417
  $ref: "#/components/responses/NotFound"
1418
+ "410":
1419
+ $ref: "#/components/responses/Gone"
1393
1420
  "424":
1394
1421
  $ref: "#/components/responses/ConnectionUnavailable"
1395
1422
  "500":
@@ -1417,6 +1444,10 @@ paths:
1417
1444
  This endpoint does not reload. A `reload` query parameter is rejected with 400 rather
1418
1445
  than ignored, because answering 200 here reads as a reload that worked. Reload is
1419
1446
  per-package: use `GET /environments/{environmentName}/packages/{packageName}?reload=true`.
1447
+
1448
+ A package with published versions is listed once, as its `latest` version. A
1449
+ `versionId` other than empty or `latest` is rejected with 400: read one
1450
+ version with `GET /environments/{environmentName}/packages/{packageName}?versionId=`.
1420
1451
  parameters:
1421
1452
  - name: environmentName
1422
1453
  in: path
@@ -1439,8 +1470,6 @@ paths:
1439
1470
  $ref: "#/components/responses/Unauthorized"
1440
1471
  "500":
1441
1472
  $ref: "#/components/responses/InternalServerError"
1442
- "501":
1443
- $ref: "#/components/responses/NotImplemented"
1444
1473
  "503":
1445
1474
  $ref: "#/components/responses/ServiceUnavailable"
1446
1475
  post:
@@ -1452,6 +1481,50 @@ paths:
1452
1481
  Creates a new Malloy package within the specified environment. A package serves as a
1453
1482
  container for models, notebooks, embedded databases, and other resources. The package
1454
1483
  will be initialized with the provided metadata and can immediately accept content.
1484
+
1485
+ ## Versioned publish
1486
+
1487
+ Package versioning is a server setting, `PUBLISHER_PACKAGE_VERSIONING` (`off` by
1488
+ default; `ServerStatus.packageVersioning` reports it), and a transition: a later release
1489
+ removes the setting and always publishes versions.
1490
+
1491
+ With it off, a request that carries a `location` installs the package in place,
1492
+ replacing the previous publish, as before versions, whatever its `publisher.json`
1493
+ declares; the package has no versions, and the server logs a warning that names it. A
1494
+ package that already has published versions refuses that with 409 (`reason`
1495
+ `PACKAGE_IS_VERSIONED`).
1496
+
1497
+ With it on, a request that carries a `location` publishes an immutable version of the
1498
+ package: the one its own `publisher.json` declares. The request takes no version
1499
+ parameter: the version is that field, the way `npm publish` reads `package.json`, so
1500
+ bumping it is the release action.
1501
+
1502
+ - A `publisher.json` with no `version` is refused with 400 (`reason`
1503
+ `MANIFEST_VERSION_MISSING`), and one whose `version` is not a semantic version with
1504
+ 400 (`reason` `MANIFEST_VERSION_INVALID`). Nothing is written.
1505
+ - Publishing a version the package already has, with different content, is refused with
1506
+ 409 (`reason` `VERSION_CONFLICT`). The same content again succeeds and writes no
1507
+ files, so re-loading a version onto a server that already holds it is safe to retry;
1508
+ a non-null `manifestLocation` on that request binds the version to it. A re-load
1509
+ leaves `latest` where it is, so a retried publish never undoes a rollback; it sets
1510
+ `latest` only for a package that has none. Re-publishing an archived version is
1511
+ refused with 410 (`reason`
1512
+ `VERSION_ARCHIVED`): unarchive it instead.
1513
+ - A version that does not pass the publish checks (the same ones an unversioned publish
1514
+ applies) is refused with 400, and the versions already published keep serving.
1515
+ - Under `versionPromotion: "on-publish"` (the default), the new version becomes the
1516
+ package's `latest` unless a higher version already is. Under `"explicit"`, publish
1517
+ never moves `latest`; `PUT .../packages/{packageName}/latest` does.
1518
+ - A package mounted for watch mode is the author's own source directory, so it cannot
1519
+ hold immutable versions: publishing a version of it is refused with 400.
1520
+ - The request's `description`, when sent, is the package's description. Each version
1521
+ keeps the `description` from its own publisher.json.
1522
+
1523
+ A request without a `location` registers a directory already in the environment as a
1524
+ single unversioned package, as packages loaded from `publisher.config.json` are with
1525
+ versioning off. A
1526
+ package that already has versions refuses that with 409 (`reason`
1527
+ `PACKAGE_IS_VERSIONED`).
1455
1528
  parameters:
1456
1529
  - name: environmentName
1457
1530
  in: path
@@ -1476,12 +1549,14 @@ paths:
1476
1549
  $ref: "#/components/responses/BadRequest"
1477
1550
  "401":
1478
1551
  $ref: "#/components/responses/Unauthorized"
1552
+ "409":
1553
+ $ref: "#/components/responses/Conflict"
1554
+ "410":
1555
+ $ref: "#/components/responses/Gone"
1479
1556
  "424":
1480
1557
  $ref: "#/components/responses/PackageManifestError"
1481
1558
  "500":
1482
1559
  $ref: "#/components/responses/InternalServerError"
1483
- "501":
1484
- $ref: "#/components/responses/NotImplemented"
1485
1560
  "503":
1486
1561
  $ref: "#/components/responses/ServiceUnavailable"
1487
1562
 
@@ -1494,8 +1569,9 @@ paths:
1494
1569
  description: |
1495
1570
  Retrieves detailed information about a specific package, including its models, notebooks,
1496
1571
  databases, and metadata. The reload parameter can be used to refresh the package state
1497
- from disk before returning the information. The versionId parameter allows access to
1498
- specific package versions.
1572
+ from disk before returning the information. The versionId parameter selects one
1573
+ published version of a versioned package; without it, the package's `latest` version
1574
+ is returned.
1499
1575
  parameters:
1500
1576
  - name: environmentName
1501
1577
  in: path
@@ -1509,12 +1585,7 @@ paths:
1509
1585
  required: true
1510
1586
  schema:
1511
1587
  type: string
1512
- - name: versionId
1513
- in: query
1514
- description: Version identifier for the package
1515
- required: false
1516
- schema:
1517
- $ref: "#/components/schemas/VersionIdPattern"
1588
+ - $ref: "#/components/parameters/versionId"
1518
1589
  - name: reload
1519
1590
  in: query
1520
1591
  description: |
@@ -1524,6 +1595,10 @@ paths:
1524
1595
  `true` and `false`. Any other value (`1`, `yes`, `TRUE`, or the
1525
1596
  parameter repeated) is refused with 400 rather than read as `false`,
1526
1597
  which would answer 200 without recompiling.
1598
+
1599
+ A published version is immutable, so it has nothing to reload: on a
1600
+ versioned package `reload=true` returns the version as it is,
1601
+ neither recompiling nor re-fetching it.
1527
1602
  required: false
1528
1603
  schema:
1529
1604
  type: boolean
@@ -1540,12 +1615,12 @@ paths:
1540
1615
  $ref: "#/components/responses/Unauthorized"
1541
1616
  "404":
1542
1617
  $ref: "#/components/responses/NotFound"
1618
+ "410":
1619
+ $ref: "#/components/responses/Gone"
1543
1620
  "424":
1544
1621
  $ref: "#/components/responses/PackageManifestError"
1545
1622
  "500":
1546
1623
  $ref: "#/components/responses/InternalServerError"
1547
- "501":
1548
- $ref: "#/components/responses/NotImplemented"
1549
1624
  "503":
1550
1625
  $ref: "#/components/responses/ServiceUnavailable"
1551
1626
  patch:
@@ -1553,7 +1628,24 @@ paths:
1553
1628
  - packages
1554
1629
  operationId: update-package
1555
1630
  summary: Update package configuration
1631
+ deprecated: true
1556
1632
  description: |
1633
+ DEPRECATED. In-place mutation of a package contradicts immutable versions, so this
1634
+ operation will be removed. On a package that has published versions it changes only
1635
+ what is not content: a `manifestLocation` URI is bound to the package's `latest` version
1636
+ (as `PUT .../packages/{packageName}/versions/{version}/manifest` does for any version),
1637
+ while a null or empty one leaves the binding as it is (clear it with that route), and
1638
+ `description` is the package's. `name` and the `location` the version was published from
1639
+ may be sent back unchanged. Any other change is refused with 409 (`reason`
1640
+ `PACKAGE_IS_VERSIONED`), as is a package with no `latest` yet: publish a new version to
1641
+ change content.
1642
+
1643
+ It keeps working, so that callers which predate versions do not break, and says it is
1644
+ deprecated: every response carries `Deprecation: true` and a `Link` to the package
1645
+ versions reference, every request is counted in `publisher_deprecated_usage_total`
1646
+ (`feature` `package_patch`), and the server logs a warning, once per package per run,
1647
+ naming the route that replaces it.
1648
+
1557
1649
  Updates the configuration and metadata of an existing package. This allows you to
1558
1650
  modify package settings, update the description, change the location, or update other
1559
1651
  package-level properties. The package must exist and be accessible.
@@ -1604,10 +1696,10 @@ paths:
1604
1696
  $ref: "#/components/responses/Unauthorized"
1605
1697
  "404":
1606
1698
  $ref: "#/components/responses/NotFound"
1699
+ "409":
1700
+ $ref: "#/components/responses/Conflict"
1607
1701
  "500":
1608
1702
  $ref: "#/components/responses/InternalServerError"
1609
- "501":
1610
- $ref: "#/components/responses/NotImplemented"
1611
1703
  "503":
1612
1704
  $ref: "#/components/responses/ServiceUnavailable"
1613
1705
  delete:
@@ -1619,6 +1711,13 @@ paths:
1619
1711
  Permanently deletes a package and all its associated resources including models,
1620
1712
  notebooks, databases, and metadata. This operation cannot be undone, so use with caution.
1621
1713
  The package must exist and be accessible for deletion.
1714
+
1715
+ On a versioned package this deletes every published version and its files, then, in the
1716
+ background, cleans up each version as deleting it alone does: its own auto-runs still
1717
+ running are stopped and its own `scope: version` tables reclaimed. To take one
1718
+ version out of service while keeping the rest, archive it with
1719
+ `PATCH .../packages/{packageName}/versions/{version}`; to remove one version for good,
1720
+ delete it with `DELETE .../packages/{packageName}/versions/{version}`.
1622
1721
  parameters:
1623
1722
  - name: environmentName
1624
1723
  in: path
@@ -1645,8 +1744,295 @@ paths:
1645
1744
  $ref: "#/components/responses/NotFound"
1646
1745
  "500":
1647
1746
  $ref: "#/components/responses/InternalServerError"
1648
- "501":
1649
- $ref: "#/components/responses/NotImplemented"
1747
+ "503":
1748
+ $ref: "#/components/responses/ServiceUnavailable"
1749
+
1750
+ /environments/{environmentName}/packages/{packageName}/versions:
1751
+ get:
1752
+ tags:
1753
+ - versions
1754
+ operationId: list-package-versions
1755
+ summary: List a package's published versions
1756
+ description: |
1757
+ Lists every version published to the package, highest version first, including archived
1758
+ ones (marked by `archiveStatus`). The entry marked `latest` is the version served when a
1759
+ request names no `versionId`. An unversioned package (one registered from a directory,
1760
+ or loaded from `publisher.config.json` or published with versioning off) has no versions
1761
+ and returns an empty list.
1762
+ parameters:
1763
+ - $ref: "#/components/parameters/environmentName"
1764
+ - $ref: "#/components/parameters/packageName"
1765
+ responses:
1766
+ "200":
1767
+ description: The package's versions, highest first
1768
+ content:
1769
+ application/json:
1770
+ schema:
1771
+ type: array
1772
+ items:
1773
+ $ref: "#/components/schemas/PackageVersion"
1774
+ "400":
1775
+ $ref: "#/components/responses/BadRequest"
1776
+ "401":
1777
+ $ref: "#/components/responses/Unauthorized"
1778
+ "404":
1779
+ $ref: "#/components/responses/NotFound"
1780
+ "500":
1781
+ $ref: "#/components/responses/InternalServerError"
1782
+ "503":
1783
+ $ref: "#/components/responses/ServiceUnavailable"
1784
+
1785
+ /environments/{environmentName}/packages/{packageName}/versions/{version}:
1786
+ get:
1787
+ tags:
1788
+ - versions
1789
+ operationId: get-package-version
1790
+ summary: Get one published version
1791
+ description: |
1792
+ Returns one published version, archived or not. An unknown version answers 404 with
1793
+ `reason` `VERSION_NOT_FOUND`.
1794
+ parameters:
1795
+ - $ref: "#/components/parameters/environmentName"
1796
+ - $ref: "#/components/parameters/packageName"
1797
+ - $ref: "#/components/parameters/versionPath"
1798
+ responses:
1799
+ "200":
1800
+ description: The version
1801
+ content:
1802
+ application/json:
1803
+ schema:
1804
+ $ref: "#/components/schemas/PackageVersion"
1805
+ "400":
1806
+ $ref: "#/components/responses/BadRequest"
1807
+ "401":
1808
+ $ref: "#/components/responses/Unauthorized"
1809
+ "404":
1810
+ $ref: "#/components/responses/NotFound"
1811
+ "500":
1812
+ $ref: "#/components/responses/InternalServerError"
1813
+ "503":
1814
+ $ref: "#/components/responses/ServiceUnavailable"
1815
+ patch:
1816
+ tags:
1817
+ - versions
1818
+ operationId: update-package-version
1819
+ summary: Archive or unarchive a version
1820
+ description: |
1821
+ Changes a version's lifecycle state. Content is never edited here: a published version
1822
+ is immutable.
1823
+
1824
+ - `archive` takes the version out of service: reads and queries that name it answer 410
1825
+ with `reason` `VERSION_ARCHIVED`, and it is unloaded from memory. The tables its own
1826
+ auto-runs built under `scope: version` are reclaimed in the background, with their run
1827
+ records; tables another version's run still references are kept, and so are an
1828
+ orchestrated run's, whose names and lifetime the caller that assigned them owns. Each
1829
+ table is tried once: one that cannot be dropped is left, and its run record goes all
1830
+ the same. Its
1831
+ files stay on disk, so it can be unarchived. To remove them, delete the version with
1832
+ `DELETE .../versions/{version}`.
1833
+ - `unarchive` puts it back in service. It loads again on its next read, and serves live
1834
+ until it is built again.
1835
+
1836
+ Archiving stops the version's materialization schedule, if it has one, and unarchiving
1837
+ starts it again. An archive is refused with 409 when:
1838
+
1839
+ - the version is the package's `latest` (`reason` `VERSION_IS_LATEST`): move `latest`
1840
+ first;
1841
+ - it is the package's last version in service (`reason` `VERSION_IS_LAST_ACTIVE`): a
1842
+ package always keeps one. To take the whole package out of service, delete it;
1843
+ - a materialization of that version is running (`reason` `VERSION_BUILDING`), since the
1844
+ archive would reclaim the tables that run is writing. A run that starts after the
1845
+ archive fails, and what it built is reclaimed when it ends.
1846
+
1847
+ Sending the state the version is already in changes nothing and answers 200.
1848
+ parameters:
1849
+ - $ref: "#/components/parameters/environmentName"
1850
+ - $ref: "#/components/parameters/packageName"
1851
+ - $ref: "#/components/parameters/versionPath"
1852
+ requestBody:
1853
+ required: true
1854
+ content:
1855
+ application/json:
1856
+ schema:
1857
+ $ref: "#/components/schemas/PackageVersionUpdate"
1858
+ responses:
1859
+ "200":
1860
+ description: The version after the change
1861
+ content:
1862
+ application/json:
1863
+ schema:
1864
+ $ref: "#/components/schemas/PackageVersion"
1865
+ "400":
1866
+ $ref: "#/components/responses/BadRequest"
1867
+ "401":
1868
+ $ref: "#/components/responses/Unauthorized"
1869
+ "403":
1870
+ $ref: "#/components/responses/Forbidden"
1871
+ "404":
1872
+ $ref: "#/components/responses/NotFound"
1873
+ "409":
1874
+ $ref: "#/components/responses/Conflict"
1875
+ "500":
1876
+ $ref: "#/components/responses/InternalServerError"
1877
+ "503":
1878
+ $ref: "#/components/responses/ServiceUnavailable"
1879
+ delete:
1880
+ tags:
1881
+ - versions
1882
+ operationId: delete-package-version
1883
+ summary: Delete a version
1884
+ description: |
1885
+ Removes one version for good, where an archive only takes it out of service. The version
1886
+ is unloaded from memory, and its row and its files are deleted; other versions are
1887
+ untouched. Then, in the background, its own auto-runs still running are stopped and the tables
1888
+ its own auto-runs built under `scope: version` are reclaimed with their run records, as an
1889
+ archive reclaims them. Nothing is dropped before the delete commits, so a refused delete
1890
+ changes nothing. It cannot be undone, and it frees the version id: a later publish of the
1891
+ same version is a new version, with whatever content it carries.
1892
+
1893
+ An archived version can be deleted too; that is how its files are reclaimed. Deleting the
1894
+ package's only version deletes the package with it (its row, run records and ledger), so
1895
+ no package is left with no version; while a publish of another version of the package is
1896
+ running, the package is left to that publish.
1897
+
1898
+ Each table is tried once: one that could not be dropped is left. Tables another run of the
1899
+ package still references are kept, as is an orchestrated run (its tables, and a build of it
1900
+ still running), which the caller that instructed it owns.
1901
+
1902
+ A delete is refused with 409 when:
1903
+
1904
+ - the version is the package's `latest` and other versions remain (`reason`
1905
+ `VERSION_IS_LATEST`): move `latest` first;
1906
+ - it is the package's last version in service and archived versions remain (`reason`
1907
+ `VERSION_IS_LAST_ACTIVE`): a package that has versions always keeps one in service.
1908
+ Delete the archived versions first, or delete the package.
1909
+ parameters:
1910
+ - $ref: "#/components/parameters/environmentName"
1911
+ - $ref: "#/components/parameters/packageName"
1912
+ - $ref: "#/components/parameters/versionPath"
1913
+ responses:
1914
+ "200":
1915
+ description: The version deleted
1916
+ content:
1917
+ application/json:
1918
+ schema:
1919
+ $ref: "#/components/schemas/PackageVersion"
1920
+ "400":
1921
+ $ref: "#/components/responses/BadRequest"
1922
+ "401":
1923
+ $ref: "#/components/responses/Unauthorized"
1924
+ "403":
1925
+ $ref: "#/components/responses/Forbidden"
1926
+ "404":
1927
+ $ref: "#/components/responses/NotFound"
1928
+ "409":
1929
+ $ref: "#/components/responses/Conflict"
1930
+ "500":
1931
+ $ref: "#/components/responses/InternalServerError"
1932
+ "503":
1933
+ $ref: "#/components/responses/ServiceUnavailable"
1934
+
1935
+ /environments/{environmentName}/packages/{packageName}/versions/{version}/manifest:
1936
+ put:
1937
+ tags:
1938
+ - versions
1939
+ operationId: set-package-version-manifest
1940
+ summary: Bind a version to a build manifest
1941
+ description: |
1942
+ Sets the version's `manifestLocation`, the externally computed build manifest its persist
1943
+ references resolve through, and rebinds that version's models to it right away. A null
1944
+ `manifestLocation` clears the binding and the version serves live. Only this version is
1945
+ affected.
1946
+
1947
+ This is serving state, not package content, which is why it is the one thing about a
1948
+ published version that can change. It replaces the deprecated
1949
+ `PATCH .../packages/{packageName}` for rebinding a manifest.
1950
+ parameters:
1951
+ - $ref: "#/components/parameters/environmentName"
1952
+ - $ref: "#/components/parameters/packageName"
1953
+ - $ref: "#/components/parameters/versionPath"
1954
+ requestBody:
1955
+ required: true
1956
+ content:
1957
+ application/json:
1958
+ schema:
1959
+ $ref: "#/components/schemas/PackageVersionManifest"
1960
+ responses:
1961
+ "200":
1962
+ description: >-
1963
+ The version as a package resource (`versionId` set), which is where
1964
+ the binding's outcome is reported: `manifestBindingStatus`,
1965
+ `manifestEntryCount` and `boundManifestUri`.
1966
+ content:
1967
+ application/json:
1968
+ schema:
1969
+ $ref: "#/components/schemas/Package"
1970
+ "400":
1971
+ $ref: "#/components/responses/BadRequest"
1972
+ "401":
1973
+ $ref: "#/components/responses/Unauthorized"
1974
+ "403":
1975
+ $ref: "#/components/responses/Forbidden"
1976
+ "404":
1977
+ $ref: "#/components/responses/NotFound"
1978
+ "410":
1979
+ $ref: "#/components/responses/Gone"
1980
+ "424":
1981
+ $ref: "#/components/responses/PackageManifestError"
1982
+ "500":
1983
+ $ref: "#/components/responses/InternalServerError"
1984
+ "503":
1985
+ $ref: "#/components/responses/ServiceUnavailable"
1986
+
1987
+ /environments/{environmentName}/packages/{packageName}/latest:
1988
+ put:
1989
+ tags:
1990
+ - versions
1991
+ operationId: set-package-latest-version
1992
+ summary: Point the package's latest at a version
1993
+ description: |
1994
+ Makes the named version the package's `latest`: the version served to every request that
1995
+ names no `versionId`. Nothing is rebuilt or re-fetched; the pointer moves. Pointing it at
1996
+ an earlier version is a rollback, and the next publish still moves `latest` under
1997
+ `versionPromotion: "on-publish"`.
1998
+
1999
+ This is the only way `latest` moves when the server runs with
2000
+ `versionPromotion: "explicit"`, the mode for an orchestrator that decides when a
2001
+ version is ready to serve.
2002
+
2003
+ The version must exist and must not be archived (404 `VERSION_NOT_FOUND`, 410
2004
+ `VERSION_ARCHIVED`), and it is loaded before the pointer moves: a version that fails to
2005
+ load is refused with that load's error, and `latest` stays where it was.
2006
+ parameters:
2007
+ - $ref: "#/components/parameters/environmentName"
2008
+ - $ref: "#/components/parameters/packageName"
2009
+ requestBody:
2010
+ required: true
2011
+ content:
2012
+ application/json:
2013
+ schema:
2014
+ $ref: "#/components/schemas/PackageLatestVersion"
2015
+ responses:
2016
+ "200":
2017
+ description: The version that is now latest
2018
+ content:
2019
+ application/json:
2020
+ schema:
2021
+ $ref: "#/components/schemas/PackageVersion"
2022
+ "400":
2023
+ $ref: "#/components/responses/BadRequest"
2024
+ "401":
2025
+ $ref: "#/components/responses/Unauthorized"
2026
+ "403":
2027
+ $ref: "#/components/responses/Forbidden"
2028
+ "404":
2029
+ $ref: "#/components/responses/NotFound"
2030
+ "410":
2031
+ $ref: "#/components/responses/Gone"
2032
+ "424":
2033
+ $ref: "#/components/responses/PackageManifestError"
2034
+ "500":
2035
+ $ref: "#/components/responses/InternalServerError"
1650
2036
  "503":
1651
2037
  $ref: "#/components/responses/ServiceUnavailable"
1652
2038
 
@@ -1680,12 +2066,7 @@ paths:
1680
2066
  required: true
1681
2067
  schema:
1682
2068
  $ref: "#/components/schemas/IdentifierPattern"
1683
- - name: versionId
1684
- in: query
1685
- description: Version identifier for the package
1686
- required: false
1687
- schema:
1688
- $ref: "#/components/schemas/VersionIdPattern"
2069
+ - $ref: "#/components/parameters/versionId"
1689
2070
  - $ref: "#/components/parameters/includeHiddenFilesAndSources"
1690
2071
  responses:
1691
2072
  "200":
@@ -1696,14 +2077,16 @@ paths:
1696
2077
  type: array
1697
2078
  items:
1698
2079
  $ref: "#/components/schemas/Model"
2080
+ "400":
2081
+ $ref: "#/components/responses/BadRequest"
1699
2082
  "401":
1700
2083
  $ref: "#/components/responses/Unauthorized"
1701
2084
  "404":
1702
2085
  $ref: "#/components/responses/NotFound"
2086
+ "410":
2087
+ $ref: "#/components/responses/Gone"
1703
2088
  "500":
1704
2089
  $ref: "#/components/responses/InternalServerError"
1705
- "501":
1706
- $ref: "#/components/responses/NotImplemented"
1707
2090
  "503":
1708
2091
  $ref: "#/components/responses/ServiceUnavailable"
1709
2092
 
@@ -1748,12 +2131,7 @@ paths:
1748
2131
  required: true
1749
2132
  schema:
1750
2133
  $ref: "#/components/schemas/PathPattern"
1751
- - name: versionId
1752
- in: query
1753
- description: Version identifier for the package
1754
- required: false
1755
- schema:
1756
- $ref: "#/components/schemas/VersionIdPattern"
2134
+ - $ref: "#/components/parameters/versionId"
1757
2135
  - $ref: "#/components/parameters/includeHiddenFilesAndSources"
1758
2136
  responses:
1759
2137
  "200":
@@ -1762,16 +2140,18 @@ paths:
1762
2140
  "application/json":
1763
2141
  schema:
1764
2142
  $ref: "#/components/schemas/CompiledModel"
2143
+ "400":
2144
+ $ref: "#/components/responses/BadRequest"
1765
2145
  "401":
1766
2146
  $ref: "#/components/responses/Unauthorized"
1767
2147
  "404":
1768
2148
  $ref: "#/components/responses/NotFound"
2149
+ "410":
2150
+ $ref: "#/components/responses/Gone"
1769
2151
  "424":
1770
2152
  $ref: "#/components/responses/ModelCompilationError"
1771
2153
  "500":
1772
2154
  $ref: "#/components/responses/InternalServerError"
1773
- "501":
1774
- $ref: "#/components/responses/NotImplemented"
1775
2155
  put:
1776
2156
  tags:
1777
2157
  - models
@@ -1837,6 +2217,12 @@ paths:
1837
2217
  Refused with 403 when `publisher.config.json` has `frozenConfig: true`.
1838
2218
  Like every write on this server, it is unauthenticated and meant to sit
1839
2219
  behind an authenticating gateway; see docs/security-posture.md.
2220
+
2221
+ A published version is immutable, so a package with versions refuses
2222
+ this write with 409 (`reason` `PACKAGE_IS_VERSIONED`), whatever
2223
+ `versionId` names: change the file in the package's source and publish
2224
+ a new version. A `versionId` on a package with no versions answers 404
2225
+ (`reason` `VERSION_NOT_FOUND`).
1840
2226
  parameters:
1841
2227
  - name: environmentName
1842
2228
  in: path
@@ -1856,12 +2242,7 @@ paths:
1856
2242
  required: true
1857
2243
  schema:
1858
2244
  $ref: "#/components/schemas/PathPattern"
1859
- - name: versionId
1860
- in: query
1861
- description: Version identifier for the package
1862
- required: false
1863
- schema:
1864
- $ref: "#/components/schemas/VersionIdPattern"
2245
+ - $ref: "#/components/parameters/versionId"
1865
2246
  requestBody:
1866
2247
  required: true
1867
2248
  content:
@@ -1899,8 +2280,6 @@ paths:
1899
2280
  $ref: "#/components/schemas/Error"
1900
2281
  "500":
1901
2282
  $ref: "#/components/responses/InternalServerError"
1902
- "501":
1903
- $ref: "#/components/responses/NotImplemented"
1904
2283
  "503":
1905
2284
  $ref: "#/components/responses/ServiceUnavailable"
1906
2285
 
@@ -1935,7 +2314,7 @@ paths:
1935
2314
  description: Name of the package
1936
2315
  required: true
1937
2316
  schema:
1938
- $ref: "#/components/schemas/VersionIdPattern"
2317
+ type: string
1939
2318
  - name: path
1940
2319
  in: path
1941
2320
  description: Path to the model within the package
@@ -1964,12 +2343,12 @@ paths:
1964
2343
  $ref: "#/components/responses/Forbidden"
1965
2344
  "404":
1966
2345
  $ref: "#/components/responses/NotFound"
2346
+ "410":
2347
+ $ref: "#/components/responses/Gone"
1967
2348
  "413":
1968
2349
  $ref: "#/components/responses/PayloadTooLarge"
1969
2350
  "500":
1970
2351
  $ref: "#/components/responses/InternalServerError"
1971
- "501":
1972
- $ref: "#/components/responses/NotImplemented"
1973
2352
  "424":
1974
2353
  $ref: "#/components/responses/ConnectionUnavailable"
1975
2354
  "502":
@@ -2041,6 +2420,7 @@ paths:
2041
2420
  required: true
2042
2421
  schema:
2043
2422
  $ref: "#/components/schemas/PathPattern"
2423
+ - $ref: "#/components/parameters/versionId"
2044
2424
  requestBody:
2045
2425
  required: true
2046
2426
  content:
@@ -2060,6 +2440,8 @@ paths:
2060
2440
  $ref: "#/components/responses/Forbidden"
2061
2441
  "404":
2062
2442
  $ref: "#/components/responses/NotFound"
2443
+ "410":
2444
+ $ref: "#/components/responses/Gone"
2063
2445
  "424":
2064
2446
  $ref: "#/components/responses/PackageManifestError"
2065
2447
  "500":
@@ -2113,12 +2495,7 @@ paths:
2113
2495
  required: true
2114
2496
  schema:
2115
2497
  $ref: "#/components/schemas/IdentifierPattern"
2116
- - name: versionId
2117
- in: query
2118
- description: Version identifier for the package
2119
- required: false
2120
- schema:
2121
- $ref: "#/components/schemas/VersionIdPattern"
2498
+ - $ref: "#/components/parameters/versionId"
2122
2499
  responses:
2123
2500
  "200":
2124
2501
  description: The reports in the package
@@ -2128,14 +2505,16 @@ paths:
2128
2505
  type: array
2129
2506
  items:
2130
2507
  $ref: "#/components/schemas/Report"
2508
+ "400":
2509
+ $ref: "#/components/responses/BadRequest"
2131
2510
  "401":
2132
2511
  $ref: "#/components/responses/Unauthorized"
2133
2512
  "404":
2134
2513
  $ref: "#/components/responses/NotFound"
2514
+ "410":
2515
+ $ref: "#/components/responses/Gone"
2135
2516
  "500":
2136
2517
  $ref: "#/components/responses/InternalServerError"
2137
- "501":
2138
- $ref: "#/components/responses/NotImplemented"
2139
2518
  "503":
2140
2519
  $ref: "#/components/responses/ServiceUnavailable"
2141
2520
 
@@ -2176,12 +2555,7 @@ paths:
2176
2555
  required: true
2177
2556
  schema:
2178
2557
  type: string
2179
- - name: versionId
2180
- in: query
2181
- description: Version identifier for the package
2182
- required: false
2183
- schema:
2184
- $ref: "#/components/schemas/VersionIdPattern"
2558
+ - $ref: "#/components/parameters/versionId"
2185
2559
  responses:
2186
2560
  "200":
2187
2561
  description: The report manifest
@@ -2189,14 +2563,16 @@ paths:
2189
2563
  application/json:
2190
2564
  schema:
2191
2565
  $ref: "#/components/schemas/ReportManifest"
2566
+ "400":
2567
+ $ref: "#/components/responses/BadRequest"
2192
2568
  "401":
2193
2569
  $ref: "#/components/responses/Unauthorized"
2194
2570
  "404":
2195
2571
  $ref: "#/components/responses/NotFound"
2572
+ "410":
2573
+ $ref: "#/components/responses/Gone"
2196
2574
  "500":
2197
2575
  $ref: "#/components/responses/InternalServerError"
2198
- "501":
2199
- $ref: "#/components/responses/NotImplemented"
2200
2576
  "503":
2201
2577
  $ref: "#/components/responses/ServiceUnavailable"
2202
2578
 
@@ -2236,6 +2612,7 @@ paths:
2236
2612
  required: true
2237
2613
  schema:
2238
2614
  $ref: "#/components/schemas/IdentifierPattern"
2615
+ - $ref: "#/components/parameters/versionId"
2239
2616
  responses:
2240
2617
  "200":
2241
2618
  description: The skills in force for the package
@@ -2245,10 +2622,14 @@ paths:
2245
2622
  type: array
2246
2623
  items:
2247
2624
  $ref: "#/components/schemas/SkillSummary"
2625
+ "400":
2626
+ $ref: "#/components/responses/BadRequest"
2248
2627
  "401":
2249
2628
  $ref: "#/components/responses/Unauthorized"
2250
2629
  "404":
2251
2630
  $ref: "#/components/responses/NotFound"
2631
+ "410":
2632
+ $ref: "#/components/responses/Gone"
2252
2633
  "500":
2253
2634
  $ref: "#/components/responses/InternalServerError"
2254
2635
  "503":
@@ -2289,6 +2670,7 @@ paths:
2289
2670
  required: true
2290
2671
  schema:
2291
2672
  type: string
2673
+ - $ref: "#/components/parameters/versionId"
2292
2674
  responses:
2293
2675
  "200":
2294
2676
  description: The skill and its body
@@ -2296,10 +2678,14 @@ paths:
2296
2678
  application/json:
2297
2679
  schema:
2298
2680
  $ref: "#/components/schemas/Skill"
2681
+ "400":
2682
+ $ref: "#/components/responses/BadRequest"
2299
2683
  "401":
2300
2684
  $ref: "#/components/responses/Unauthorized"
2301
2685
  "404":
2302
2686
  $ref: "#/components/responses/NotFound"
2687
+ "410":
2688
+ $ref: "#/components/responses/Gone"
2303
2689
  "500":
2304
2690
  $ref: "#/components/responses/InternalServerError"
2305
2691
  "503":
@@ -2331,6 +2717,7 @@ paths:
2331
2717
  required: true
2332
2718
  schema:
2333
2719
  $ref: "#/components/schemas/IdentifierPattern"
2720
+ - $ref: "#/components/parameters/versionId"
2334
2721
  responses:
2335
2722
  "200":
2336
2723
  description: The agents the package declares
@@ -2340,10 +2727,14 @@ paths:
2340
2727
  type: array
2341
2728
  items:
2342
2729
  $ref: "#/components/schemas/AgentSummary"
2730
+ "400":
2731
+ $ref: "#/components/responses/BadRequest"
2343
2732
  "401":
2344
2733
  $ref: "#/components/responses/Unauthorized"
2345
2734
  "404":
2346
2735
  $ref: "#/components/responses/NotFound"
2736
+ "410":
2737
+ $ref: "#/components/responses/Gone"
2347
2738
  "500":
2348
2739
  $ref: "#/components/responses/InternalServerError"
2349
2740
  "503":
@@ -2401,6 +2792,7 @@ paths:
2401
2792
  type: string
2402
2793
  enum: [full, summary]
2403
2794
  default: full
2795
+ - $ref: "#/components/parameters/versionId"
2404
2796
  responses:
2405
2797
  "200":
2406
2798
  description: The resolved agent
@@ -2414,6 +2806,8 @@ paths:
2414
2806
  $ref: "#/components/responses/Unauthorized"
2415
2807
  "404":
2416
2808
  $ref: "#/components/responses/NotFound"
2809
+ "410":
2810
+ $ref: "#/components/responses/Gone"
2417
2811
  "500":
2418
2812
  $ref: "#/components/responses/InternalServerError"
2419
2813
  "503":
@@ -2466,6 +2860,7 @@ paths:
2466
2860
  required: true
2467
2861
  schema:
2468
2862
  type: string
2863
+ - $ref: "#/components/parameters/versionId"
2469
2864
  responses:
2470
2865
  "200":
2471
2866
  description: The skill file
@@ -2473,10 +2868,14 @@ paths:
2473
2868
  application/json:
2474
2869
  schema:
2475
2870
  $ref: "#/components/schemas/AgentSkillRead"
2871
+ "400":
2872
+ $ref: "#/components/responses/BadRequest"
2476
2873
  "401":
2477
2874
  $ref: "#/components/responses/Unauthorized"
2478
2875
  "404":
2479
2876
  $ref: "#/components/responses/NotFound"
2877
+ "410":
2878
+ $ref: "#/components/responses/Gone"
2480
2879
  "500":
2481
2880
  $ref: "#/components/responses/InternalServerError"
2482
2881
  "503":
@@ -2544,12 +2943,7 @@ paths:
2544
2943
  required: true
2545
2944
  schema:
2546
2945
  $ref: "#/components/schemas/IdentifierPattern"
2547
- - name: versionId
2548
- in: query
2549
- description: Version identifier for the package
2550
- required: false
2551
- schema:
2552
- $ref: "#/components/schemas/VersionIdPattern"
2946
+ - $ref: "#/components/parameters/versionId"
2553
2947
  responses:
2554
2948
  "200":
2555
2949
  description: A list of dashboards in the package
@@ -2559,14 +2953,16 @@ paths:
2559
2953
  type: array
2560
2954
  items:
2561
2955
  $ref: "#/components/schemas/Dashboard"
2956
+ "400":
2957
+ $ref: "#/components/responses/BadRequest"
2562
2958
  "401":
2563
2959
  $ref: "#/components/responses/Unauthorized"
2564
2960
  "404":
2565
2961
  $ref: "#/components/responses/NotFound"
2962
+ "410":
2963
+ $ref: "#/components/responses/Gone"
2566
2964
  "500":
2567
2965
  $ref: "#/components/responses/InternalServerError"
2568
- "501":
2569
- $ref: "#/components/responses/NotImplemented"
2570
2966
  "503":
2571
2967
  $ref: "#/components/responses/ServiceUnavailable"
2572
2968
 
@@ -2622,12 +3018,7 @@ paths:
2622
3018
  schema:
2623
3019
  type: string
2624
3020
  minLength: 1
2625
- - name: versionId
2626
- in: query
2627
- description: Version identifier for the package
2628
- required: false
2629
- schema:
2630
- $ref: "#/components/schemas/VersionIdPattern"
3021
+ - $ref: "#/components/parameters/versionId"
2631
3022
  responses:
2632
3023
  "200":
2633
3024
  description: The dashboard manifest
@@ -2635,6 +3026,8 @@ paths:
2635
3026
  application/json:
2636
3027
  schema:
2637
3028
  $ref: "#/components/schemas/DashboardManifest"
3029
+ "400":
3030
+ $ref: "#/components/responses/BadRequest"
2638
3031
  "401":
2639
3032
  $ref: "#/components/responses/Unauthorized"
2640
3033
  "404":
@@ -2647,10 +3040,10 @@ paths:
2647
3040
  application/json:
2648
3041
  schema:
2649
3042
  $ref: "#/components/schemas/Error"
3043
+ "410":
3044
+ $ref: "#/components/responses/Gone"
2650
3045
  "500":
2651
3046
  $ref: "#/components/responses/InternalServerError"
2652
- "501":
2653
- $ref: "#/components/responses/NotImplemented"
2654
3047
  "503":
2655
3048
  $ref: "#/components/responses/ServiceUnavailable"
2656
3049
 
@@ -2686,12 +3079,7 @@ paths:
2686
3079
  required: true
2687
3080
  schema:
2688
3081
  $ref: "#/components/schemas/IdentifierPattern"
2689
- - name: versionId
2690
- in: query
2691
- description: Version identifier for the package
2692
- required: false
2693
- schema:
2694
- $ref: "#/components/schemas/VersionIdPattern"
3082
+ - $ref: "#/components/parameters/versionId"
2695
3083
  responses:
2696
3084
  "200":
2697
3085
  description: A list of notebooks in the package
@@ -2701,14 +3089,16 @@ paths:
2701
3089
  type: array
2702
3090
  items:
2703
3091
  $ref: "#/components/schemas/Notebook"
3092
+ "400":
3093
+ $ref: "#/components/responses/BadRequest"
2704
3094
  "401":
2705
3095
  $ref: "#/components/responses/Unauthorized"
2706
3096
  "404":
2707
3097
  $ref: "#/components/responses/NotFound"
3098
+ "410":
3099
+ $ref: "#/components/responses/Gone"
2708
3100
  "500":
2709
3101
  $ref: "#/components/responses/InternalServerError"
2710
- "501":
2711
- $ref: "#/components/responses/NotImplemented"
2712
3102
  "503":
2713
3103
  $ref: "#/components/responses/ServiceUnavailable"
2714
3104
 
@@ -2745,12 +3135,7 @@ paths:
2745
3135
  required: true
2746
3136
  schema:
2747
3137
  type: string
2748
- - name: versionId
2749
- in: query
2750
- description: Version identifier for the package
2751
- required: false
2752
- schema:
2753
- $ref: "#/components/schemas/VersionIdPattern"
3138
+ - $ref: "#/components/parameters/versionId"
2754
3139
  responses:
2755
3140
  "200":
2756
3141
  description: A Malloy notebook with raw cell contents.
@@ -2758,14 +3143,16 @@ paths:
2758
3143
  "application/json":
2759
3144
  schema:
2760
3145
  $ref: "#/components/schemas/RawNotebook"
3146
+ "400":
3147
+ $ref: "#/components/responses/BadRequest"
2761
3148
  "401":
2762
3149
  $ref: "#/components/responses/Unauthorized"
2763
3150
  "404":
2764
3151
  $ref: "#/components/responses/NotFound"
3152
+ "410":
3153
+ $ref: "#/components/responses/Gone"
2765
3154
  "500":
2766
3155
  $ref: "#/components/responses/InternalServerError"
2767
- "501":
2768
- $ref: "#/components/responses/NotImplemented"
2769
3156
 
2770
3157
  /environments/{environmentName}/packages/{packageName}/notebooks/{path}/cells/{cellIndex}:
2771
3158
  get:
@@ -2818,12 +3205,7 @@ paths:
2818
3205
  required: true
2819
3206
  schema:
2820
3207
  type: integer
2821
- - name: versionId
2822
- in: query
2823
- description: Version identifier for the package
2824
- required: false
2825
- schema:
2826
- $ref: "#/components/schemas/VersionIdPattern"
3208
+ - $ref: "#/components/parameters/versionId"
2827
3209
  - name: filter_params
2828
3210
  in: query
2829
3211
  deprecated: true
@@ -2876,12 +3258,12 @@ paths:
2876
3258
  $ref: "#/components/responses/Forbidden"
2877
3259
  "404":
2878
3260
  $ref: "#/components/responses/NotFound"
3261
+ "410":
3262
+ $ref: "#/components/responses/Gone"
2879
3263
  "413":
2880
3264
  $ref: "#/components/responses/PayloadTooLarge"
2881
3265
  "500":
2882
3266
  $ref: "#/components/responses/InternalServerError"
2883
- "501":
2884
- $ref: "#/components/responses/NotImplemented"
2885
3267
  "424":
2886
3268
  $ref: "#/components/responses/ConnectionUnavailable"
2887
3269
  "502":
@@ -2914,12 +3296,7 @@ paths:
2914
3296
  required: true
2915
3297
  schema:
2916
3298
  $ref: "#/components/schemas/IdentifierPattern"
2917
- - name: versionId
2918
- in: query
2919
- description: Version identifier for the package
2920
- required: false
2921
- schema:
2922
- $ref: "#/components/schemas/VersionIdPattern"
3299
+ - $ref: "#/components/parameters/versionId"
2923
3300
  responses:
2924
3301
  "200":
2925
3302
  description: A list of embedded databases in the package
@@ -2929,14 +3306,16 @@ paths:
2929
3306
  type: array
2930
3307
  items:
2931
3308
  $ref: "#/components/schemas/Database"
3309
+ "400":
3310
+ $ref: "#/components/responses/BadRequest"
2932
3311
  "401":
2933
3312
  $ref: "#/components/responses/Unauthorized"
2934
3313
  "404":
2935
3314
  $ref: "#/components/responses/NotFound"
3315
+ "410":
3316
+ $ref: "#/components/responses/Gone"
2936
3317
  "500":
2937
3318
  $ref: "#/components/responses/InternalServerError"
2938
- "501":
2939
- $ref: "#/components/responses/NotImplemented"
2940
3319
  "503":
2941
3320
  $ref: "#/components/responses/ServiceUnavailable"
2942
3321
 
@@ -2969,6 +3348,7 @@ paths:
2969
3348
  required: true
2970
3349
  schema:
2971
3350
  $ref: "#/components/schemas/IdentifierPattern"
3351
+ - $ref: "#/components/parameters/versionId"
2972
3352
  responses:
2973
3353
  "200":
2974
3354
  description: A list of data apps in the package
@@ -2984,10 +3364,10 @@ paths:
2984
3364
  $ref: "#/components/responses/Unauthorized"
2985
3365
  "404":
2986
3366
  $ref: "#/components/responses/NotFound"
3367
+ "410":
3368
+ $ref: "#/components/responses/Gone"
2987
3369
  "500":
2988
3370
  $ref: "#/components/responses/InternalServerError"
2989
- "501":
2990
- $ref: "#/components/responses/NotImplemented"
2991
3371
  "503":
2992
3372
  $ref: "#/components/responses/ServiceUnavailable"
2993
3373
 
@@ -3013,6 +3393,11 @@ paths:
3013
3393
  package changes.
3014
3394
  - periodic `: heartbeat` comments to keep idle proxies from closing
3015
3395
  the connection.
3396
+
3397
+ `versionId` is accepted so a data app can send it on every call, but a
3398
+ published version never changes: its stream carries `hello`, `mode` and
3399
+ heartbeats and no `changed` event. Watch mode only ever mounts
3400
+ unversioned packages.
3016
3401
  parameters:
3017
3402
  - name: environmentName
3018
3403
  in: path
@@ -3026,6 +3411,7 @@ paths:
3026
3411
  required: true
3027
3412
  schema:
3028
3413
  $ref: "#/components/schemas/IdentifierPattern"
3414
+ - $ref: "#/components/parameters/versionId"
3029
3415
  responses:
3030
3416
  "200":
3031
3417
  description: An open Server-Sent Events stream of change events
@@ -3040,6 +3426,8 @@ paths:
3040
3426
  $ref: "#/components/responses/Unauthorized"
3041
3427
  "404":
3042
3428
  $ref: "#/components/responses/NotFound"
3429
+ "410":
3430
+ $ref: "#/components/responses/Gone"
3043
3431
  "500":
3044
3432
  $ref: "#/components/responses/InternalServerError"
3045
3433
  "503":
@@ -3194,6 +3582,8 @@ paths:
3194
3582
  application/json:
3195
3583
  schema:
3196
3584
  $ref: "#/components/schemas/Materialization"
3585
+ "400":
3586
+ $ref: "#/components/responses/BadRequest"
3197
3587
  "404":
3198
3588
  $ref: "#/components/responses/NotFound"
3199
3589
  "409":
@@ -3202,14 +3592,18 @@ paths:
3202
3592
  application/json:
3203
3593
  schema:
3204
3594
  $ref: "#/components/schemas/Error"
3595
+ "410":
3596
+ $ref: "#/components/responses/Gone"
3205
3597
  get:
3206
3598
  tags:
3207
3599
  - materializations
3208
3600
  operationId: list-materializations
3209
3601
  summary: List materializations for a package
3210
- description:
3602
+ description: >-
3211
3603
  Returns the materialization history for the package, ordered by
3212
- most recent first.
3604
+ most recent first. For a package with published versions, the runs of
3605
+ one version (the one `versionId` names, or `latest`), together with
3606
+ the runs from before the package's first versioned publish.
3213
3607
  parameters:
3214
3608
  - $ref: "#/components/parameters/environmentName"
3215
3609
  - $ref: "#/components/parameters/packageName"
@@ -3227,6 +3621,7 @@ paths:
3227
3621
  type: integer
3228
3622
  minimum: 0
3229
3623
  description: Number of materializations to skip
3624
+ - $ref: "#/components/parameters/versionId"
3230
3625
  responses:
3231
3626
  "200":
3232
3627
  description: List of materializations
@@ -3236,8 +3631,12 @@ paths:
3236
3631
  type: array
3237
3632
  items:
3238
3633
  $ref: "#/components/schemas/Materialization"
3634
+ "400":
3635
+ $ref: "#/components/responses/BadRequest"
3239
3636
  "404":
3240
3637
  $ref: "#/components/responses/NotFound"
3638
+ "410":
3639
+ $ref: "#/components/responses/Gone"
3241
3640
 
3242
3641
  /environments/{environmentName}/packages/{packageName}/materializations/{materializationId}:
3243
3642
  get:
@@ -3245,10 +3644,16 @@ paths:
3245
3644
  - materializations
3246
3645
  operationId: get-materialization
3247
3646
  summary: Get a specific materialization
3647
+ description: >-
3648
+ A run's id is unique, so with no `versionId` the run is found whichever
3649
+ version built it. Naming a version also requires the run to be that
3650
+ version's (or one from before the package's first versioned publish);
3651
+ the same holds for stopping and deleting a run.
3248
3652
  parameters:
3249
3653
  - $ref: "#/components/parameters/environmentName"
3250
3654
  - $ref: "#/components/parameters/packageName"
3251
3655
  - $ref: "#/components/parameters/materializationId"
3656
+ - $ref: "#/components/parameters/versionId"
3252
3657
  responses:
3253
3658
  "200":
3254
3659
  description: Materialization details
@@ -3256,8 +3661,12 @@ paths:
3256
3661
  application/json:
3257
3662
  schema:
3258
3663
  $ref: "#/components/schemas/Materialization"
3664
+ "400":
3665
+ $ref: "#/components/responses/BadRequest"
3259
3666
  "404":
3260
3667
  $ref: "#/components/responses/NotFound"
3668
+ "410":
3669
+ $ref: "#/components/responses/Gone"
3261
3670
  post:
3262
3671
  tags:
3263
3672
  - materializations
@@ -3279,6 +3688,7 @@ paths:
3279
3688
  enum:
3280
3689
  - stop
3281
3690
  description: Action to perform on the materialization
3691
+ - $ref: "#/components/parameters/versionId"
3282
3692
  responses:
3283
3693
  "200":
3284
3694
  description: Materialization cancelled (action=stop)
@@ -3296,6 +3706,8 @@ paths:
3296
3706
  application/json:
3297
3707
  schema:
3298
3708
  $ref: "#/components/schemas/Error"
3709
+ "410":
3710
+ $ref: "#/components/responses/Gone"
3299
3711
  delete:
3300
3712
  tags:
3301
3713
  - materializations
@@ -3325,6 +3737,7 @@ paths:
3325
3737
  schema:
3326
3738
  type: boolean
3327
3739
  default: false
3740
+ - $ref: "#/components/parameters/versionId"
3328
3741
  responses:
3329
3742
  "204":
3330
3743
  description: Materialization deleted
@@ -3338,6 +3751,8 @@ paths:
3338
3751
  application/json:
3339
3752
  schema:
3340
3753
  $ref: "#/components/schemas/Error"
3754
+ "410":
3755
+ $ref: "#/components/responses/Gone"
3341
3756
 
3342
3757
  /environments/{environmentName}/storageDestinations/{destinationName}/schemas/{schemaName}/tables:
3343
3758
  get:
@@ -3497,14 +3912,38 @@ components:
3497
3912
  application/json:
3498
3913
  schema:
3499
3914
  $ref: "#/components/schemas/Error"
3500
- InternalServerError:
3501
- description: The server encountered an internal error
3915
+ Conflict:
3916
+ description: |
3917
+ The request conflicts with the package's current state. `reason` says
3918
+ which conflict:
3919
+ * VERSION_CONFLICT: the version is already published with different
3920
+ content. Bump the `version` in publisher.json and publish again.
3921
+ * PACKAGE_IS_VERSIONED: the package has published versions, which are
3922
+ immutable, so it cannot be changed in place.
3923
+ * VERSION_IS_LATEST: the version is the package's `latest` and cannot
3924
+ be archived, or deleted while other versions remain. Move `latest` first.
3925
+ * VERSION_IS_LAST_ACTIVE: the version is the package's last one in
3926
+ service and cannot be archived, or deleted while archived versions
3927
+ remain. Delete the package instead.
3928
+ * VERSION_BUILDING: a materialization of the version is running, and
3929
+ archiving or deleting it would drop the tables it is writing. Wait for
3930
+ it, or stop it.
3502
3931
  content:
3503
3932
  application/json:
3504
3933
  schema:
3505
3934
  $ref: "#/components/schemas/Error"
3506
- NotImplemented:
3507
- description: The requested operation is not implemented
3935
+ Gone:
3936
+ description: |
3937
+ The version the request names (by `versionId`, the path, or the
3938
+ publisher.json of the tree being published) has been archived
3939
+ (`reason` VERSION_ARCHIVED). It is out of service until it is
3940
+ unarchived; the package's other versions are unaffected.
3941
+ content:
3942
+ application/json:
3943
+ schema:
3944
+ $ref: "#/components/schemas/Error"
3945
+ InternalServerError:
3946
+ description: The server encountered an internal error
3508
3947
  content:
3509
3948
  application/json:
3510
3949
  schema:
@@ -3668,8 +4107,168 @@ components:
3668
4107
 
3669
4108
  VersionIdPattern:
3670
4109
  type: string
3671
- pattern: "^[a-zA-Z0-9_.-]+$"
3672
- description: Version identifier pattern supporting dots and dashes
4110
+ pattern: '^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$'
4111
+ description: >-
4112
+ A package version: a semantic version (SemVer 2.0), MAJOR.MINOR.PATCH
4113
+ with an optional pre-release suffix (`-rc1`, `-alpha.2`) and optional
4114
+ build metadata (`+20231120.deadbeef`). Pre-release and
4115
+ build suffixes are accepted so release-candidate builds can be
4116
+ published. A numeric identifier may have leading zeros (`01.0.0`),
4117
+ which strict SemVer 2.0 does not allow, so a version a system in front
4118
+ of Publisher validated with this same pattern is never refused. Such a
4119
+ version compares equal to the one without the zeros, and a package
4120
+ holds only one of the two: publishing the other is 409
4121
+ `VERSION_CONFLICT`.
4122
+
4123
+ PackageVersion:
4124
+ type: object
4125
+ description: >-
4126
+ One published version of a package. Its content is immutable; what
4127
+ changes over its life is its lifecycle state (`archiveStatus`), whether
4128
+ it is the package's `latest`, and the build manifest it is bound to.
4129
+ required:
4130
+ - resource
4131
+ - packageName
4132
+ - id
4133
+ - latest
4134
+ - archiveStatus
4135
+ - archivedAt
4136
+ - promotedAt
4137
+ - demotedAt
4138
+ - contentHash
4139
+ - manifestLocation
4140
+ - gitCommitSha
4141
+ - gitRef
4142
+ - createdAt
4143
+ - updatedAt
4144
+ properties:
4145
+ resource:
4146
+ type: string
4147
+ readOnly: true
4148
+ description: Resource path to the version
4149
+ packageName:
4150
+ type: string
4151
+ readOnly: true
4152
+ description: The package this version belongs to
4153
+ id:
4154
+ $ref: "#/components/schemas/VersionIdPattern"
4155
+ description: >-
4156
+ The version, from the package's publisher.json: the value a
4157
+ `versionId` names everywhere else.
4158
+ latest:
4159
+ type: boolean
4160
+ readOnly: true
4161
+ description: >-
4162
+ Whether this is the package's `latest` version, the one served when a
4163
+ request names no `versionId`.
4164
+ archiveStatus:
4165
+ type: string
4166
+ readOnly: true
4167
+ enum: [archive, unarchive]
4168
+ description: >-
4169
+ `unarchive` while the version is in service; `archive` once it has
4170
+ been taken out of service (reads that name it answer 410). Each
4171
+ value is named for the action that sets it.
4172
+ archivedAt:
4173
+ type: ["string", "null"]
4174
+ format: date-time
4175
+ readOnly: true
4176
+ description: When the version was archived; null while it is in service.
4177
+ promotedAt:
4178
+ type: ["string", "null"]
4179
+ format: date-time
4180
+ readOnly: true
4181
+ description: >-
4182
+ When the version last became the package's `latest`; null if it
4183
+ never has.
4184
+ demotedAt:
4185
+ type: ["string", "null"]
4186
+ format: date-time
4187
+ readOnly: true
4188
+ description: >-
4189
+ When the version last stopped being the package's `latest`; null if
4190
+ it never has.
4191
+ description:
4192
+ type: string
4193
+ readOnly: true
4194
+ description: The `description` from the version's publisher.json
4195
+ location:
4196
+ type: string
4197
+ readOnly: true
4198
+ description: >-
4199
+ Where the version was published from. A version whose files are
4200
+ missing on disk is fetched again from here, and checked against
4201
+ `contentHash` before it is served.
4202
+ contentHash:
4203
+ type: string
4204
+ readOnly: true
4205
+ description: >-
4206
+ SHA-256 (hex) over the version's files. Publishing the same version
4207
+ with the same content again succeeds and changes nothing; with
4208
+ different content it is refused with 409 VERSION_CONFLICT.
4209
+ manifestLocation:
4210
+ type: ["string", "null"]
4211
+ readOnly: true
4212
+ description: >-
4213
+ The build manifest this version is bound to (see
4214
+ `Package.manifestLocation`); null when it serves live. Set with
4215
+ `PUT .../versions/{version}/manifest`.
4216
+ gitCommitSha:
4217
+ type: ["string", "null"]
4218
+ readOnly: true
4219
+ description: >-
4220
+ Git commit the version was published from, when the publisher
4221
+ recorded it. Reserved: nothing records it yet.
4222
+ gitRef:
4223
+ type: ["string", "null"]
4224
+ readOnly: true
4225
+ description: Git ref the version was published from. Reserved, like `gitCommitSha`.
4226
+ createdAt:
4227
+ type: string
4228
+ format: date-time
4229
+ readOnly: true
4230
+ description: When the version was published
4231
+ updatedAt:
4232
+ type: string
4233
+ format: date-time
4234
+ readOnly: true
4235
+ description: When the version's lifecycle state or binding last changed
4236
+
4237
+ PackageVersionUpdate:
4238
+ type: object
4239
+ description: A lifecycle change to a published version
4240
+ properties:
4241
+ archiveStatus:
4242
+ type: string
4243
+ enum: [archive, unarchive]
4244
+ description: >-
4245
+ `archive` takes the version out of service; `unarchive` puts it back.
4246
+ required:
4247
+ - archiveStatus
4248
+
4249
+ PackageVersionManifest:
4250
+ type: object
4251
+ description: The build manifest to bind a published version to
4252
+ properties:
4253
+ manifestLocation:
4254
+ type: ["string", "null"]
4255
+ minLength: 1
4256
+ description: >-
4257
+ Where the build manifest to bind is: a gs:// or s3:// URI, a
4258
+ file:// URL, or an absolute path on this server (a mounted volume).
4259
+ Null clears the binding and serves live. An empty string or a
4260
+ relative path is refused with 400.
4261
+ required:
4262
+ - manifestLocation
4263
+
4264
+ PackageLatestVersion:
4265
+ type: object
4266
+ description: The version to make the package's `latest`
4267
+ properties:
4268
+ version:
4269
+ $ref: "#/components/schemas/VersionIdPattern"
4270
+ required:
4271
+ - version
3673
4272
 
3674
4273
  PathPattern:
3675
4274
  type: string
@@ -3685,7 +4284,17 @@ components:
3685
4284
  description: Unix timestamp of the status check
3686
4285
  environments:
3687
4286
  type: array
3688
- description: List of available environments
4287
+ description: >-
4288
+ List of available environments. Each environment's `packages` lists
4289
+ one entry per package, as `GET .../packages` does, except that a
4290
+ versioned package is listed once for EVERY version this server holds,
4291
+ each entry with its own `versionId`, `archiveStatus` and `loaded`. A
4292
+ loaded version's entry also carries its manifest binding
4293
+ (`manifestBindingStatus`, `boundManifestUri`); an unloaded one (an
4294
+ archived version, or one not loaded since the server started) carries only
4295
+ its name and version. An orchestrator reconciles what a server holds
4296
+ from this list, so it names every version rather than only `latest`
4297
+ or only what is in memory; `resource` keeps its shape.
3689
4298
  items:
3690
4299
  $ref: "#/components/schemas/Environment"
3691
4300
  initialized:
@@ -3711,6 +4320,25 @@ components:
3711
4320
  This server's release version, for example "0.8.2". Use it to tell
3712
4321
  which build answered, for instance to rule out an old copy served
3713
4322
  from the npx cache.
4323
+ packageVersioning:
4324
+ type: string
4325
+ enum: ["off", "on"]
4326
+ readOnly: true
4327
+ description: >-
4328
+ "on" when a publish from a location publishes an immutable
4329
+ version (`PUBLISHER_PACKAGE_VERSIONING=on`); "off" when it installs
4330
+ the package in place, as before versions. Reads and the versions
4331
+ routes answer in both. Absent from a server that predates
4332
+ versions, which reads as "off": how an orchestrator talking to
4333
+ servers mid-rollout tells which ones publish native versions.
4334
+ versionPromotion:
4335
+ type: string
4336
+ enum: ["on-publish", "explicit"]
4337
+ readOnly: true
4338
+ description: >-
4339
+ The `versionPromotion` setting this server runs with. With
4340
+ "explicit", a publish never moves a package's `latest`; only
4341
+ `PUT .../packages/{packageName}/latest` does.
3714
4342
  emptyReason:
3715
4343
  type: string
3716
4344
  readOnly: true
@@ -4037,6 +4665,47 @@ components:
4037
4665
  name:
4038
4666
  type: string
4039
4667
  description: Package name
4668
+ versionId:
4669
+ oneOf:
4670
+ - $ref: "#/components/schemas/VersionIdPattern"
4671
+ - type: "null"
4672
+ readOnly: true
4673
+ description: >-
4674
+ The published version this response describes. Absent for a package
4675
+ that has no published versions. A request that names no `versionId`
4676
+ is answered with the package's `latest` version, so this is how a
4677
+ caller learns which version it got. In a package listing it is null
4678
+ for a package none of whose versions is `latest` yet (under
4679
+ `versionPromotion: explicit`, before `PUT .../latest`). Set from the
4680
+ version's publisher.json at publish; never sent by a client.
4681
+ latestVersion:
4682
+ oneOf:
4683
+ - $ref: "#/components/schemas/VersionIdPattern"
4684
+ - type: "null"
4685
+ readOnly: true
4686
+ description: >-
4687
+ The package's `latest` version. Absent for a package that has no
4688
+ published versions, and null while none of its versions is `latest`.
4689
+ Equal to `versionId` unless the request named another one.
4690
+ loaded:
4691
+ type: boolean
4692
+ readOnly: true
4693
+ description: >-
4694
+ Set only on a version's entry in `GET /status`: whether this server
4695
+ holds the version in memory. A published version that is not loaded
4696
+ (an archived one, or one not loaded since the server started) is still
4697
+ held, so it is still listed, with `loaded: false` and only its
4698
+ `resource`, name, version, `latestVersion`, `archiveStatus` and
4699
+ `status`. It loads when a request next names it. A version still
4700
+ being published is listed only under `includeLoading`, with
4701
+ `loaded: false`, no `archiveStatus`, and `status.loading`.
4702
+ archiveStatus:
4703
+ type: string
4704
+ enum: [archive, unarchive]
4705
+ readOnly: true
4706
+ description: >-
4707
+ Set only on a version's entry in `GET /status`, except one still
4708
+ being published: whether the version is archived.
4040
4709
  description:
4041
4710
  type: string
4042
4711
  description: Package description
@@ -4394,9 +5063,12 @@ components:
4394
5063
  manifestLocation:
4395
5064
  type: ["string", "null"]
4396
5065
  description: |
4397
- URI (gs:// or s3://) of the externally-computed manifest for this package.
4398
- On (re)load the publisher reads it and binds persist references
4399
- (sourceEntityId -> physicalTableName). Null = serve live.
5066
+ Where the externally-computed manifest for this package is: a gs://
5067
+ or s3:// URI, a file:// URL, or an absolute path on this server (a
5068
+ mounted volume). On (re)load the publisher reads it and binds
5069
+ persist references (sourceEntityId -> physicalTableName). Null =
5070
+ serve live. For a package with published versions, a relative path
5071
+ is refused with 400.
4400
5072
  queryMetadata:
4401
5073
  oneOf:
4402
5074
  - $ref: "#/components/schemas/QueryMetadata"
@@ -4536,6 +5208,12 @@ components:
4536
5208
  `loadingSince` is when the in-progress load began, so a caller can
4537
5209
  bound one that never completes. Which tables a serving copy answers
4538
5210
  from is a separate question, answered by `manifestBindingStatus`.
5211
+ A publish of a package version is a load from its download until
5212
+ it settles, and while it runs every entry of that package reports
5213
+ `loading`. With `includeLoading=true`, once its tree has named the
5214
+ version, a version the package does not hold yet is listed as its
5215
+ own entry, with its `versionId`, `loaded: false` and `loading`,
5216
+ unless an unversioned copy of the package still serves.
4539
5217
 
4540
5218
  A package that is loading for the first time, so is not yet
4541
5219
  serving, is listed only where a caller asks for it:
@@ -4707,6 +5385,30 @@ components:
4707
5385
  The task file's Markdown. Only on the resolved agent, not the
4708
5386
  listing.
4709
5387
 
5388
+ AgentBudget:
5389
+ type: object
5390
+ readOnly: true
5391
+ description: >-
5392
+ The run limits an agent declares. Validated and exposed only: the
5393
+ server never enforces them. A platform that runs the agent decides
5394
+ how to apply them and may clamp each to its own maximum. Every field
5395
+ is optional and only the fields the manifest sets are present; an
5396
+ unset field keeps the platform's default. Absent when the manifest
5397
+ sets none.
5398
+ properties:
5399
+ turns:
5400
+ type: integer
5401
+ minimum: 1
5402
+ wall_clock_minutes:
5403
+ type: integer
5404
+ minimum: 1
5405
+ llm_tokens:
5406
+ type: integer
5407
+ minimum: 1
5408
+ job_minutes:
5409
+ type: integer
5410
+ minimum: 1
5411
+
4710
5412
  AgentSummary:
4711
5413
  type: object
4712
5414
  readOnly: true
@@ -4724,6 +5426,8 @@ components:
4724
5426
  type: array
4725
5427
  items:
4726
5428
  $ref: "#/components/schemas/AgentSchedule"
5429
+ budget:
5430
+ $ref: "#/components/schemas/AgentBudget"
4727
5431
 
4728
5432
  AgentSkillFile:
4729
5433
  type: object
@@ -4777,6 +5481,12 @@ components:
4777
5481
  type: string
4778
5482
  package:
4779
5483
  type: string
5484
+ versionId:
5485
+ $ref: "#/components/schemas/VersionIdPattern"
5486
+ description: >-
5487
+ The published version the definition was read from. Absent for a
5488
+ package that has no published versions. Pass it as `?versionId=`
5489
+ to fetch the same definition again after `latest` moves.
4780
5490
  sourceContentSha:
4781
5491
  type: string
4782
5492
  description: The package's `sourceContentSha` at the load this definition came from.
@@ -4816,6 +5526,8 @@ components:
4816
5526
  type: array
4817
5527
  items:
4818
5528
  $ref: "#/components/schemas/AgentSchedule"
5529
+ budget:
5530
+ $ref: "#/components/schemas/AgentBudget"
4819
5531
  warnings:
4820
5532
  type: array
4821
5533
  items:
@@ -5472,6 +6184,22 @@ components:
5472
6184
  packageName:
5473
6185
  type: string
5474
6186
  description: Name of the package containing this data app
6187
+ versionId:
6188
+ oneOf:
6189
+ - $ref: "#/components/schemas/VersionIdPattern"
6190
+ - type: "null"
6191
+ readOnly: true
6192
+ description: >-
6193
+ The published version this data app was listed from. Absent for a
6194
+ package that has no published versions. A link that must keep opening
6195
+ this version after `latest` moves carries it as `?versionId=`, as
6196
+ `resource` does. The static route serving the page reads it only
6197
+ when it names a version the package has: otherwise (a package with
6198
+ no versions, or a `versionId` that is no version of this package)
6199
+ it serves the files of `latest`, so a router that forwards a page's
6200
+ query string unchanged keeps working. The page's queries, through
6201
+ the data-app runtime, follow the same rule. Files the page loads by
6202
+ relative URL carry no `?versionId=`, so they come from `latest`.
5475
6203
  path:
5476
6204
  type: string
5477
6205
  description: Relative path to the HTML file within its package directory
@@ -6141,7 +6869,15 @@ components:
6141
6869
  result with type metadata for rendering.'
6142
6870
  versionId:
6143
6871
  type: string
6144
- description: Version ID
6872
+ description: >-
6873
+ The published version of the package to query. `latest`, omitted or
6874
+ empty, the query runs against the package's `latest` version. An unknown version
6875
+ answers 404 (`reason` VERSION_NOT_FOUND) and an archived one 410
6876
+ (`reason` VERSION_ARCHIVED). A `versionId` in the request's query
6877
+ string, as a proxy forwarding a page's URL sends, is read the same way;
6878
+ when both name a version they must agree, or the request answers 400.
6879
+ It is not declared as a query parameter, so generated clients keep
6880
+ their argument order.
6145
6881
  filterParams:
6146
6882
  type: object
6147
6883
  deprecated: true
@@ -7560,8 +8296,39 @@ components:
7560
8296
  client generated before it -- on the one field whose purpose is to
7561
8297
  grow. Callers must treat an unrecognized value as absent.
7562
8298
 
8299
+ The package-version values let a caller tell "forgot to bump the
8300
+ version" from "the model is broken", which share a status code:
8301
+
8302
+ * MANIFEST_VERSION_MISSING (400): with package versioning on, a
8303
+ publish whose publisher.json has no `version`.
8304
+ * MANIFEST_VERSION_INVALID (400): such a publish whose `version`
8305
+ is not a semantic version.
8306
+ * VERSION_CONFLICT (409): that version is already published with
8307
+ different content.
8308
+ * PACKAGE_IS_VERSIONED (409): the package has published versions,
8309
+ so it cannot be changed in place (a write, or a publish with
8310
+ package versioning off).
8311
+ * VERSION_IS_LATEST (409): the package's `latest` version cannot be
8312
+ archived, or deleted while other versions remain.
8313
+ * VERSION_IS_LAST_ACTIVE (409): the package's last version in
8314
+ service cannot be archived, or deleted while archived versions
8315
+ remain.
8316
+ * VERSION_BUILDING (409): a materialization of the version is
8317
+ running, so it cannot be archived or deleted yet.
8318
+ * VERSION_ID_INVALID (400): a requested `versionId` is not a
8319
+ semantic version.
8320
+ * VERSION_NOT_LATEST (400): an auto-run of a version other than
8321
+ `latest`, in a package whose versions share their tables. A
8322
+ package with no `latest` yet refuses none.
8323
+ * VERSION_NOT_FOUND (404): the package has no such version.
8324
+ * VERSION_ARCHIVED (410): the version is archived.
8325
+
7563
8326
  Known values: TABLE_NOT_FOUND, CONNECTION_FAILED,
7564
- CONNECTION_AUTH_FAILED, CONNECTION_NOT_FOUND.
8327
+ CONNECTION_AUTH_FAILED, CONNECTION_NOT_FOUND,
8328
+ MANIFEST_VERSION_MISSING, MANIFEST_VERSION_INVALID,
8329
+ VERSION_CONFLICT, PACKAGE_IS_VERSIONED, VERSION_IS_LATEST,
8330
+ VERSION_IS_LAST_ACTIVE, VERSION_BUILDING, VERSION_ID_INVALID,
8331
+ VERSION_NOT_LATEST, VERSION_NOT_FOUND, VERSION_ARCHIVED.
7565
8332
  problems:
7566
8333
  type: array
7567
8334
  description: |
@@ -7860,6 +8627,38 @@ components:
7860
8627
  caller-assigned names from the package's already-compiled build plan
7861
8628
  (read off `Package.buildPlan`).
7862
8629
  properties:
8630
+ versionId:
8631
+ type: string
8632
+ description: >-
8633
+ The published version of the package to build. `latest`, omitted or
8634
+ empty, the package's `latest` version is built. An unknown version answers 404
8635
+ (`reason` VERSION_NOT_FOUND) and an archived one 410 (`reason`
8636
+ VERSION_ARCHIVED). Carried in the body rather than the query string
8637
+ because the body is optional: a new optional query parameter ahead
8638
+ of it would move the body argument of every generated client.
8639
+
8640
+ The run records the version it built in `metadata.versionId`, with
8641
+ the package's materialization scope in `metadata.scope`, which
8642
+ decides whose tables it builds. Under `scope: "version"` each
8643
+ version builds into tables of its own: a self-assigned name gains
8644
+ the version and a hash of the environment, package and version as
8645
+ a suffix (`order_summary__v1_2_0_3f9c2a1b`), so no other package's
8646
+ version builds the same table. Under
8647
+ `scope: "package"` (the default) the versions share the package's
8648
+ tables, so an auto-run (no `buildInstructions`) of a version other
8649
+ than `latest` is refused with 400 (`reason` VERSION_NOT_LATEST): it
8650
+ would rebuild the table `latest` serves. While the package has no
8651
+ `latest` (`explicit` promotion, before the first `PUT …/latest`),
8652
+ an auto-run of any named version builds. Pass `buildInstructions`
8653
+ to build any version into tables you name, other than the ones the
8654
+ versions share. A run with `buildInstructions`, or under
8655
+ `scope: "version"`, holds its own version's slot, so one such run is
8656
+ active per version at a time; an auto-run under `scope: "package"`
8657
+ writes the shared tables, so one is active per package. A second run
8658
+ where one is already active answers 409, and so does a run with
8659
+ `buildInstructions` that would write a table another active run of
8660
+ the package writes. An auto-run learns its tables only when it
8661
+ starts building, so one that would write such a table fails then.
7863
8662
  buildInstructions:
7864
8663
  oneOf:
7865
8664
  - $ref: "#/components/schemas/BuildInstructions"
@@ -9224,3 +10023,35 @@ components:
9224
10023
  description: ID of the materialization
9225
10024
  schema:
9226
10025
  type: string
10026
+ versionId:
10027
+ name: versionId
10028
+ in: query
10029
+ required: false
10030
+ allowEmptyValue: true
10031
+ description: |
10032
+ The published version of the package to serve, a semantic version such
10033
+ as `1.2.0` or `1.2.0-rc1`. `latest`, omitted or empty (`versionId=`,
10034
+ which a proxy forwarding a page's query string may send), the request
10035
+ is served from the package's `latest` version.
10036
+
10037
+ Any other value that is not a semantic version answers 400 with `reason`
10038
+ VERSION_ID_INVALID, so a malformed value is told apart from a missing
10039
+ version. An unknown version answers 404 with `reason` VERSION_NOT_FOUND,
10040
+ and an archived one answers 410 with `reason` VERSION_ARCHIVED. A
10041
+ package that has no versions (one loaded from `publisher.config.json`
10042
+ or registered from a directory) is served as before when this is
10043
+ omitted, and answers 404 VERSION_NOT_FOUND when it is given.
10044
+
10045
+ Build metadata must be percent-encoded: send `1.2.0+build.5` as
10046
+ `1.2.0%2Bbuild.5`, since a bare `+` in a query string decodes to a space.
10047
+ schema:
10048
+ type: string
10049
+ versionPath:
10050
+ name: version
10051
+ in: path
10052
+ required: true
10053
+ description: |
10054
+ A published version of the package, a semantic version such as `1.2.0`.
10055
+ Percent-encode build metadata (`+` as `%2B`).
10056
+ schema:
10057
+ $ref: "#/components/schemas/VersionIdPattern"