@lotics/cli 0.75.0 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { KnowledgeUpgradeEntry, KnowledgeUpgradeResolutions, ContentUpgradeResolutions, ModifiedArtifact, PackageContentBinding } from "@lotics/shared/schemas/packages";
1
2
  /**
2
3
  * The error message for a non-ok response. A genuine JSON error (a 4xx carrying
3
4
  * a `message`) surfaces verbatim; a non-JSON body (a gateway HTML page), any
@@ -89,12 +90,33 @@ export interface PackageBinding {
89
90
  roles: Record<string, string>;
90
91
  workflows: Record<string, string>;
91
92
  }
92
- /** One finding from a bespoke→package extraction (`extractAppPackage`). */
93
+ /** One finding from a bespoke→package extraction (`extractPackage`). */
93
94
  export interface ExtractFinding {
94
95
  severity: "error" | "warning" | "info";
95
96
  area: string;
96
97
  message: string;
97
98
  }
99
+ /** A package's kind — a full app blueprint, or a standalone content package. */
100
+ export type PackageKind = "app" | "content";
101
+ /** One workspace's installation of a package's content (the standalone anchor). */
102
+ export interface ContentInstallation {
103
+ id: string;
104
+ workspace_id: string;
105
+ package_id: string;
106
+ package_version: number;
107
+ /** Set when the content arrived bundled with an app install; null for a standalone content package. */
108
+ app_id: string | null;
109
+ /** The namespaced content binding: `knowledge` (alias → `kdc_` id) + `templates` (alias → `tmpl_` id). */
110
+ binding: PackageContentBinding;
111
+ installed_by: string | null;
112
+ created_at: string;
113
+ updated_at: string;
114
+ }
115
+ /** Advisory knowledge warnings surfaced by install/upgrade (never block). */
116
+ export interface KnowledgeWarnings {
117
+ /** `knowledge_expects` doc names with no matching workspace doc. */
118
+ missing_expected_docs: string[];
119
+ }
98
120
  export declare const API_BASE_URL: string;
99
121
  export declare class LoticsClient {
100
122
  private apiKey;
@@ -200,6 +222,16 @@ export declare class LoticsClient {
200
222
  * through the `context` op for production parity.
201
223
  */
202
224
  config?: Record<string, string | number | boolean> | null;
225
+ /** Package registry id this app was installed from; null for a bespoke/ejected app. */
226
+ package_id?: string | null;
227
+ /** The installed package version (upgrade pin); null for a bespoke/ejected app. */
228
+ package_version?: number | null;
229
+ /**
230
+ * Package install join — per-namespace alias→id maps (entities/fields/
231
+ * options/templates/roles) plus the `workflows` artifact registry. Null for
232
+ * a bespoke app. Used to preview what `package uninstall` will archive.
233
+ */
234
+ binding?: Record<string, Record<string, string>> | null;
203
235
  }>;
204
236
  createApp(body: {
205
237
  name: string;
@@ -212,20 +244,128 @@ export declare class LoticsClient {
212
244
  current_version_id: string | null;
213
245
  }>;
214
246
  /**
215
- * Install an app package version into the current workspace — scaffolds the
216
- * data model, deploys the package bundle, materializes its
217
- * queries/workflows/agents, and pins the installation. Returns the resulting
218
- * installation app. `version` omitted installs the latest published version.
247
+ * Install a package version into the current workspace — ONE endpoint,
248
+ * kind-branched into a discriminated response (`kind`). An `app` package
249
+ * scaffolds the data model / deploys / materializes and returns the installation
250
+ * app (+ advisory knowledge warnings); a `content` package installs only its
251
+ * doc corpus and returns the installation row. `bind_to` (content only)
252
+ * resolves a name collision by adopting an existing same-named doc as
253
+ * package-managed. `version` omitted installs the latest published version.
219
254
  */
220
- installAppPackage(package_id: string, body: {
255
+ installPackage(package_id: string, body: {
221
256
  version?: number;
257
+ /** Content-kind only: consent to adopt a same-named workspace doc on a knowledge collision. */
258
+ bind_to?: Record<string, string>;
259
+ /** App-kind only: per-knob config overrides applied over the contract defaults at install. */
260
+ config?: Record<string, string | number | boolean>;
261
+ }): Promise<{
262
+ kind: "app";
263
+ app: {
264
+ id: string;
265
+ name: string;
266
+ workspace_id: string;
267
+ package_id: string | null;
268
+ package_version: number | null;
269
+ current_version_id: string | null;
270
+ };
271
+ knowledge_warnings: KnowledgeWarnings;
272
+ } | {
273
+ kind: "content";
274
+ installation: ContentInstallation;
275
+ warnings: KnowledgeWarnings;
276
+ }>;
277
+ /**
278
+ * Uninstall a standalone content package — delete the installation row. By
279
+ * default the package-bound docs are ARCHIVED; `keep_content` retains them as
280
+ * ordinary workspace docs. Admin-only. Backs `lotics package uninstall`.
281
+ */
282
+ uninstallContentPackage(installation_id: string, opts?: {
283
+ keep_content?: boolean;
284
+ }): Promise<{
285
+ installation_id: string;
286
+ archived_doc_ids: string[];
287
+ archived_template_ids: string[];
288
+ deleted: true;
289
+ }>;
290
+ /**
291
+ * Preview upgrading a standalone content installation — the knowledge namespace's
292
+ * per-alias `entries` (added/changed/removed/drifted + a `modified` flag) plus the
293
+ * consent-requiring `templates` (a template the target changed whose live content
294
+ * was locally edited; a clean one auto-updates and is absent). No writes.
295
+ * Admin-only.
296
+ */
297
+ previewContentInstallationUpgrade(installation_id: string, opts?: {
298
+ version?: number;
299
+ }): Promise<{
300
+ installation_id: string;
301
+ package_id: string;
302
+ from_version: number;
303
+ to_version: number;
304
+ changelog: string | null;
305
+ update_available: boolean;
306
+ entries: KnowledgeUpgradeEntry[];
307
+ templates: ModifiedArtifact[];
308
+ }>;
309
+ /**
310
+ * Apply a standalone content upgrade — propagate the target version's content per
311
+ * the resolutions (`knowledge`: a modified change/removal or drift needs consent;
312
+ * `templates`: a locally-edited changed template takes revert|keep), then advance
313
+ * the pin + binding. Returns the updated installation row. Admin-only.
314
+ */
315
+ applyContentInstallationUpgrade(installation_id: string, body: {
316
+ version?: number;
317
+ resolutions?: ContentUpgradeResolutions;
318
+ }): Promise<ContentInstallation>;
319
+ /**
320
+ * List a workspace's package-managed knowledge installations, each folded with
321
+ * registry status (name, kind, official badge, latest version, update-available).
322
+ * Member-accessible (workspace-scoped); backs the settings "Managed by" badge.
323
+ */
324
+ listContentInstallations(workspace_id: string): Promise<Array<ContentInstallation & {
325
+ package_registry: {
326
+ name: string;
327
+ kind: PackageKind;
328
+ is_official: boolean;
329
+ latest_version: number;
330
+ update_available: boolean;
331
+ } | null;
332
+ }>>;
333
+ /**
334
+ * Uninstall a package installation (backs `lotics package uninstall`). Does
335
+ * everything DELETE does plus archives the installation's lifecycle
336
+ * artifacts; with `archive_tables` it also archives the scaffolded entity
337
+ * tables — refused server-side unless this installation created them
338
+ * (provenance) and nothing else references them. Admin-only.
339
+ */
340
+ uninstallAppPackage(app_id: string, body: {
341
+ archive_tables: boolean;
342
+ }): Promise<{
343
+ id: string;
344
+ uninstalled: boolean;
345
+ archived_table_ids: string[];
346
+ }>;
347
+ /**
348
+ * Partial-merge a package installation's config (backs `lotics package config
349
+ * --set`). Only the provided keys change; validated against the installed
350
+ * contract. Returns the full effective config. Admin-only.
351
+ */
352
+ updateAppPackageConfig(app_id: string, body: {
353
+ config: Record<string, string | number | boolean>;
354
+ }): Promise<{
355
+ config: Record<string, string | number | boolean>;
356
+ }>;
357
+ /**
358
+ * Retire (or `undo` un-retire) a registry package (backs `lotics package
359
+ * retire`). Retiring refuses NEW installs and hides the package from
360
+ * non-owning orgs; existing installations keep working and may still upgrade.
361
+ * Owner-org admin-only.
362
+ */
363
+ retirePackage(package_id: string, body: {
364
+ undo: boolean;
222
365
  }): Promise<{
223
366
  id: string;
224
367
  name: string;
225
- workspace_id: string;
226
- package_id: string | null;
227
- package_version: number | null;
228
- current_version_id: string | null;
368
+ retired_at: string | null;
229
369
  }>;
230
370
  /**
231
371
  * Eject an installation from its package — re-deploy the pinned version's
@@ -234,7 +374,7 @@ export declare class LoticsClient {
234
374
  * app becomes a normal bespoke app and can no longer be upgraded. Returns the
235
375
  * resulting app.
236
376
  */
237
- ejectAppPackage(app_id: string): Promise<{
377
+ ejectPackage(app_id: string): Promise<{
238
378
  id: string;
239
379
  name: string;
240
380
  workspace_id: string;
@@ -242,7 +382,7 @@ export declare class LoticsClient {
242
382
  }>;
243
383
  /**
244
384
  * Extract a DRAFT app package from an existing bespoke app — the promotion
245
- * read (docs/app_packages.md § Promotion). Pure: nothing is written. Returns
385
+ * read (docs/packages.md § Promotion). Pure: nothing is written. Returns
246
386
  * the alias-keyed draft `contract` (opaque to the CLI — the server is the
247
387
  * validating authority), the origin workspace's `binding` (which doubles as
248
388
  * the adopt binding), a findings `report` (any `error` ⇒ not publishable
@@ -250,7 +390,12 @@ export declare class LoticsClient {
250
390
  * project at their `bytes_ref` paths. Backs `lotics package extract`.
251
391
  * Admin-only.
252
392
  */
253
- extractAppPackage(app_id: string): Promise<{
393
+ extractPackage(app_id: string, opts?: {
394
+ knowledge?: Array<{
395
+ alias: string;
396
+ doc_id: string;
397
+ }>;
398
+ }): Promise<{
254
399
  contract: unknown;
255
400
  binding: PackageBinding;
256
401
  report: ExtractFinding[];
@@ -259,6 +404,13 @@ export declare class LoticsClient {
259
404
  file_id: string;
260
405
  filename: string;
261
406
  }>;
407
+ /** Knowledge doc content to write to `knowledge/<alias>.md` in the draft project. */
408
+ knowledge_files: Array<{
409
+ content_ref: string;
410
+ content: string;
411
+ }>;
412
+ /** alias → the origin workspace's kdc_ id (the adopt knowledge binding). */
413
+ knowledge_binding: Record<string, string>;
262
414
  }>;
263
415
  /**
264
416
  * Adopt a published package onto an EXISTING (bespoke or ejected) app — the
@@ -269,10 +421,12 @@ export declare class LoticsClient {
269
421
  * ConflictError names the aliases that diverge. `version` omitted adopts the
270
422
  * latest. Backs `lotics package adopt`. Admin-only.
271
423
  */
272
- adoptAppPackage(app_id: string, body: {
424
+ adoptPackage(app_id: string, body: {
273
425
  package_id: string;
274
426
  version?: number;
275
427
  binding: PackageBinding;
428
+ /** alias → this workspace's kdc_ id for the contract's knowledge docs (from extract). */
429
+ knowledge_binding?: Record<string, string>;
276
430
  }): Promise<{
277
431
  id: string;
278
432
  name: string;
@@ -292,13 +446,13 @@ export declare class LoticsClient {
292
446
  * adopts targeting it; pinned installations keep running. Owner-org
293
447
  * admin-only. Backs `lotics package yank`.
294
448
  */
295
- yankAppPackageVersion(package_id: string, version: number, yanked: boolean): Promise<{
449
+ yankPackageVersion(package_id: string, version: number, yanked: boolean): Promise<{
296
450
  package_id: string;
297
451
  version: number;
298
452
  yanked_at: string | null;
299
453
  latest_version: number;
300
454
  }>;
301
- fleetUpgradeAppPackage(package_id: string, body: {
455
+ fleetUpgradePackage(package_id: string, body: {
302
456
  version?: number;
303
457
  }): Promise<{
304
458
  package_id: string;
@@ -324,31 +478,48 @@ export declare class LoticsClient {
324
478
  * local manifest has no `package_id`), then publishes version 1 against the
325
479
  * returned id. Admin-only.
326
480
  */
327
- createAppPackage(body: {
481
+ createPackage(body: {
328
482
  name: string;
329
483
  description?: string | null;
484
+ /** 'app' (default) | 'content'. Immutable after create. */
485
+ kind?: PackageKind;
330
486
  }): Promise<{
331
487
  id: string;
332
488
  name: string;
333
489
  description: string | null;
490
+ kind: PackageKind;
334
491
  latest_version: number;
335
492
  is_official: boolean;
336
493
  created_at: string;
337
494
  updated_at: string;
338
495
  }>;
339
496
  /**
340
- * Fetch a registry app package's metadata (incl. `latest_version` and the
341
- * Lotics-backed `is_official` trust badge). Admin-only; cross-tenant by id.
497
+ * Fetch a registry app package's metadata (incl. `kind`, `latest_version` and
498
+ * the Lotics-backed `is_official` trust badge). Admin-only; cross-tenant by id.
342
499
  */
343
- getAppPackage(package_id: string): Promise<{
500
+ getPackage(package_id: string): Promise<{
344
501
  id: string;
345
502
  name: string;
346
503
  description: string | null;
504
+ kind: PackageKind;
347
505
  latest_version: number;
348
506
  is_official: boolean;
507
+ retired_at: string | null;
508
+ /** Absent from a pre-deploy server — treat undefined as not-owned (the badge under-claims, never over-claims). */
509
+ owned_by_caller?: boolean;
349
510
  created_at: string;
350
511
  updated_at: string;
351
512
  }>;
513
+ /** Version history newest-first (no contract payloads) — backs `lotics package show`. Admin-only. */
514
+ listPackageVersions(package_id: string): Promise<{
515
+ versions: Array<{
516
+ version: number;
517
+ changelog: string | null;
518
+ channel: "release" | "dev";
519
+ yanked_at: string | null;
520
+ created_at: string;
521
+ }>;
522
+ }>;
352
523
  /**
353
524
  * Publish a new immutable package version — multipart upload of the alias-keyed
354
525
  * contract (JSON) + the prebuilt code bundle (a gzipped tarball carrying
@@ -356,10 +527,12 @@ export declare class LoticsClient {
356
527
  * bundle, then allocates the next monotonic version. The `contract` is opaque
357
528
  * JSON to the transport (the server is the validating authority). Admin-only.
358
529
  */
359
- publishAppPackageVersion(package_id: string, args: {
530
+ publishPackageVersion(package_id: string, args: {
360
531
  contract: unknown;
361
532
  bundle: Buffer;
362
533
  changelog?: string | null;
534
+ /** 'dev' = dev-loop publish: pinned by the dev installation, never the installable latest. */
535
+ channel?: "release" | "dev";
363
536
  }): Promise<{
364
537
  id: string;
365
538
  package_id: string;
@@ -375,7 +548,7 @@ export declare class LoticsClient {
375
548
  * package artifacts, and bumps the pin. `version` omitted upgrades to the
376
549
  * latest. Returns the resulting app. Admin-only.
377
550
  */
378
- upgradeAppPackage(app_id: string, body: {
551
+ upgradePackage(app_id: string, body: {
379
552
  version?: number;
380
553
  /**
381
554
  * Per preview finding: drifted binding entries (`<namespace>.<alias>`)
@@ -386,6 +559,13 @@ export declare class LoticsClient {
386
559
  resolutions?: Record<string, "recreate" | "revert" | "keep" | {
387
560
  bind_to: string;
388
561
  }>;
562
+ /**
563
+ * Per bundled-knowledge finding: a consent resolution
564
+ * (`apply`/`keep`/`archive`/`recreate`/`unbind`) per alias + `bind_to`
565
+ * consents for added-doc name collisions. Consent-requiring docs left
566
+ * unresolved refuse the upgrade; unmodified changes apply automatically.
567
+ */
568
+ knowledge_resolutions?: KnowledgeUpgradeResolutions;
389
569
  }): Promise<{
390
570
  id: string;
391
571
  name: string;
@@ -399,7 +579,7 @@ export declare class LoticsClient {
399
579
  * breaking contract changes, the binding drift report, and the modified-core
400
580
  * report — with no writes. Admin-only.
401
581
  */
402
- previewAppPackageUpgrade(app_id: string, opts?: {
582
+ previewPackageUpgrade(app_id: string, opts?: {
403
583
  version?: number;
404
584
  }): Promise<{
405
585
  app_id: string;
@@ -417,6 +597,9 @@ export declare class LoticsClient {
417
597
  from: string;
418
598
  to: string;
419
599
  }>;
600
+ changed: {
601
+ templates: string[];
602
+ };
420
603
  };
421
604
  drift: Array<{
422
605
  namespace: string;
@@ -426,14 +609,21 @@ export declare class LoticsClient {
426
609
  modified: Array<{
427
610
  kind: string;
428
611
  alias: string;
612
+ baseline_unknown?: boolean;
429
613
  }>;
614
+ /**
615
+ * Bundled package-managed knowledge docs the version bump adds/changes/
616
+ * removes/drifts — the app-install analogue of a standalone knowledge
617
+ * upgrade's `entries`. Consent-requiring docs resolve via `knowledge_resolutions`.
618
+ */
619
+ knowledge: KnowledgeUpgradeEntry[];
430
620
  }>;
431
621
  /**
432
622
  * Re-bind a package role to a different workspace group (the current group
433
623
  * still exists). Re-materializes at the pinned version; refuses over
434
624
  * modified-core findings. Admin-only.
435
625
  */
436
- rebindAppPackageRole(app_id: string, body: {
626
+ rebindPackageRole(app_id: string, body: {
437
627
  role_alias: string;
438
628
  group_id: string;
439
629
  }): Promise<{
@@ -461,7 +651,7 @@ export declare class LoticsClient {
461
651
  * binding drift, and locally modified core artifacts. Read-only; backs
462
652
  * `lotics package doctor`. Admin-only.
463
653
  */
464
- getAppPackageHealth(app_id: string): Promise<{
654
+ getPackageHealth(app_id: string): Promise<{
465
655
  app_id: string;
466
656
  package_id: string;
467
657
  package_name: string;
@@ -477,6 +667,20 @@ export declare class LoticsClient {
477
667
  kind: string;
478
668
  alias: string;
479
669
  }>;
670
+ /** Package-managed knowledge docs whose bound id no longer resolves (recreate/unbind at upgrade). */
671
+ knowledge_drift: Array<{
672
+ alias: string;
673
+ name: string;
674
+ doc_id: string | null;
675
+ }>;
676
+ /** Package-managed knowledge docs the workspace edited since install (apply/keep at upgrade). */
677
+ knowledge_modified: Array<{
678
+ alias: string;
679
+ name: string;
680
+ doc_id: string | null;
681
+ }>;
682
+ /** `knowledge_expects` names the package's agents route to but it does not own (advisory). */
683
+ missing_expected_docs: string[];
480
684
  }>;
481
685
  /**
482
686
  * Reset a package installation in a DEV workspace — drop the package-owned
@@ -484,7 +688,7 @@ export declare class LoticsClient {
484
688
  * workspaces (a non-dev workspace is refused). Returns the resulting app.
485
689
  * Admin-only.
486
690
  */
487
- resetAppPackage(app_id: string): Promise<{
691
+ resetPackage(app_id: string): Promise<{
488
692
  id: string;
489
693
  name: string;
490
694
  workspace_id: string;
package/dist/client.js CHANGED
@@ -204,13 +204,80 @@ export class LoticsClient {
204
204
  return this.request("POST", "/v1/apps", body);
205
205
  }
206
206
  /**
207
- * Install an app package version into the current workspace — scaffolds the
208
- * data model, deploys the package bundle, materializes its
209
- * queries/workflows/agents, and pins the installation. Returns the resulting
210
- * installation app. `version` omitted installs the latest published version.
207
+ * Install a package version into the current workspace — ONE endpoint,
208
+ * kind-branched into a discriminated response (`kind`). An `app` package
209
+ * scaffolds the data model / deploys / materializes and returns the installation
210
+ * app (+ advisory knowledge warnings); a `content` package installs only its
211
+ * doc corpus and returns the installation row. `bind_to` (content only)
212
+ * resolves a name collision by adopting an existing same-named doc as
213
+ * package-managed. `version` omitted installs the latest published version.
211
214
  */
212
- async installAppPackage(package_id, body) {
213
- return this.request("POST", `/v1/app-packages/${encodeURIComponent(package_id)}/installations`, body);
215
+ async installPackage(package_id, body) {
216
+ return this.request("POST", `/v1/packages/${encodeURIComponent(package_id)}/installations`, body);
217
+ }
218
+ /**
219
+ * Uninstall a standalone content package — delete the installation row. By
220
+ * default the package-bound docs are ARCHIVED; `keep_content` retains them as
221
+ * ordinary workspace docs. Admin-only. Backs `lotics package uninstall`.
222
+ */
223
+ async uninstallContentPackage(installation_id, opts = {}) {
224
+ const qs = opts.keep_content ? "?keep_content=true" : "";
225
+ return this.request("DELETE", `/v1/content-installations/${encodeURIComponent(installation_id)}${qs}`);
226
+ }
227
+ /**
228
+ * Preview upgrading a standalone content installation — the knowledge namespace's
229
+ * per-alias `entries` (added/changed/removed/drifted + a `modified` flag) plus the
230
+ * consent-requiring `templates` (a template the target changed whose live content
231
+ * was locally edited; a clean one auto-updates and is absent). No writes.
232
+ * Admin-only.
233
+ */
234
+ async previewContentInstallationUpgrade(installation_id, opts = {}) {
235
+ const qs = opts.version !== undefined ? `?version=${opts.version}` : "";
236
+ return this.request("GET", `/v1/content-installations/${encodeURIComponent(installation_id)}/upgrade${qs}`);
237
+ }
238
+ /**
239
+ * Apply a standalone content upgrade — propagate the target version's content per
240
+ * the resolutions (`knowledge`: a modified change/removal or drift needs consent;
241
+ * `templates`: a locally-edited changed template takes revert|keep), then advance
242
+ * the pin + binding. Returns the updated installation row. Admin-only.
243
+ */
244
+ async applyContentInstallationUpgrade(installation_id, body) {
245
+ return this.request("POST", `/v1/content-installations/${encodeURIComponent(installation_id)}/upgrade`, body);
246
+ }
247
+ /**
248
+ * List a workspace's package-managed knowledge installations, each folded with
249
+ * registry status (name, kind, official badge, latest version, update-available).
250
+ * Member-accessible (workspace-scoped); backs the settings "Managed by" badge.
251
+ */
252
+ async listContentInstallations(workspace_id) {
253
+ return this.request("GET", `/v1/workspaces/${encodeURIComponent(workspace_id)}/content-installations`);
254
+ }
255
+ /**
256
+ * Uninstall a package installation (backs `lotics package uninstall`). Does
257
+ * everything DELETE does plus archives the installation's lifecycle
258
+ * artifacts; with `archive_tables` it also archives the scaffolded entity
259
+ * tables — refused server-side unless this installation created them
260
+ * (provenance) and nothing else references them. Admin-only.
261
+ */
262
+ async uninstallAppPackage(app_id, body) {
263
+ return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/uninstall`, body);
264
+ }
265
+ /**
266
+ * Partial-merge a package installation's config (backs `lotics package config
267
+ * --set`). Only the provided keys change; validated against the installed
268
+ * contract. Returns the full effective config. Admin-only.
269
+ */
270
+ async updateAppPackageConfig(app_id, body) {
271
+ return this.request("PATCH", `/v1/apps/${encodeURIComponent(app_id)}/package-config`, body);
272
+ }
273
+ /**
274
+ * Retire (or `undo` un-retire) a registry package (backs `lotics package
275
+ * retire`). Retiring refuses NEW installs and hides the package from
276
+ * non-owning orgs; existing installations keep working and may still upgrade.
277
+ * Owner-org admin-only.
278
+ */
279
+ async retirePackage(package_id, body) {
280
+ return this.request("POST", `/v1/packages/${encodeURIComponent(package_id)}/retire`, body);
214
281
  }
215
282
  /**
216
283
  * Eject an installation from its package — re-deploy the pinned version's
@@ -219,12 +286,12 @@ export class LoticsClient {
219
286
  * app becomes a normal bespoke app and can no longer be upgraded. Returns the
220
287
  * resulting app.
221
288
  */
222
- async ejectAppPackage(app_id) {
289
+ async ejectPackage(app_id) {
223
290
  return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/eject`);
224
291
  }
225
292
  /**
226
293
  * Extract a DRAFT app package from an existing bespoke app — the promotion
227
- * read (docs/app_packages.md § Promotion). Pure: nothing is written. Returns
294
+ * read (docs/packages.md § Promotion). Pure: nothing is written. Returns
228
295
  * the alias-keyed draft `contract` (opaque to the CLI — the server is the
229
296
  * validating authority), the origin workspace's `binding` (which doubles as
230
297
  * the adopt binding), a findings `report` (any `error` ⇒ not publishable
@@ -232,8 +299,13 @@ export class LoticsClient {
232
299
  * project at their `bytes_ref` paths. Backs `lotics package extract`.
233
300
  * Admin-only.
234
301
  */
235
- async extractAppPackage(app_id) {
236
- return this.request("GET", `/v1/apps/${encodeURIComponent(app_id)}/package-extract`);
302
+ async extractPackage(app_id, opts = {}) {
303
+ // The knowledge declaration ([{alias, doc_id}]) rides as a JSON-string query
304
+ // param — extract stays a GET (a pure read); the server validates it.
305
+ const qs = opts.knowledge && opts.knowledge.length > 0
306
+ ? `?knowledge=${encodeURIComponent(JSON.stringify(opts.knowledge))}`
307
+ : "";
308
+ return this.request("GET", `/v1/apps/${encodeURIComponent(app_id)}/package-extract${qs}`);
237
309
  }
238
310
  /**
239
311
  * Adopt a published package onto an EXISTING (bespoke or ejected) app — the
@@ -244,7 +316,7 @@ export class LoticsClient {
244
316
  * ConflictError names the aliases that diverge. `version` omitted adopts the
245
317
  * latest. Backs `lotics package adopt`. Admin-only.
246
318
  */
247
- async adoptAppPackage(app_id, body) {
319
+ async adoptPackage(app_id, body) {
248
320
  return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-adopt`, body);
249
321
  }
250
322
  /**
@@ -260,11 +332,11 @@ export class LoticsClient {
260
332
  * adopts targeting it; pinned installations keep running. Owner-org
261
333
  * admin-only. Backs `lotics package yank`.
262
334
  */
263
- async yankAppPackageVersion(package_id, version, yanked) {
264
- return this.request("POST", `/v1/app-packages/${encodeURIComponent(package_id)}/versions/${version}/yank`, { yanked });
335
+ async yankPackageVersion(package_id, version, yanked) {
336
+ return this.request("POST", `/v1/packages/${encodeURIComponent(package_id)}/versions/${version}/yank`, { yanked });
265
337
  }
266
- async fleetUpgradeAppPackage(package_id, body) {
267
- return this.request("POST", `/v1/app-packages/${encodeURIComponent(package_id)}/fleet-upgrade`, body);
338
+ async fleetUpgradePackage(package_id, body) {
339
+ return this.request("POST", `/v1/packages/${encodeURIComponent(package_id)}/fleet-upgrade`, body);
268
340
  }
269
341
  // --- App packages (registry authoring + dev harness) ---
270
342
  /**
@@ -273,15 +345,19 @@ export class LoticsClient {
273
345
  * local manifest has no `package_id`), then publishes version 1 against the
274
346
  * returned id. Admin-only.
275
347
  */
276
- async createAppPackage(body) {
277
- return this.request("POST", "/v1/app-packages", body);
348
+ async createPackage(body) {
349
+ return this.request("POST", "/v1/packages", body);
278
350
  }
279
351
  /**
280
- * Fetch a registry app package's metadata (incl. `latest_version` and the
281
- * Lotics-backed `is_official` trust badge). Admin-only; cross-tenant by id.
352
+ * Fetch a registry app package's metadata (incl. `kind`, `latest_version` and
353
+ * the Lotics-backed `is_official` trust badge). Admin-only; cross-tenant by id.
282
354
  */
283
- async getAppPackage(package_id) {
284
- return this.request("GET", `/v1/app-packages/${encodeURIComponent(package_id)}`);
355
+ async getPackage(package_id) {
356
+ return this.request("GET", `/v1/packages/${encodeURIComponent(package_id)}`);
357
+ }
358
+ /** Version history newest-first (no contract payloads) — backs `lotics package show`. Admin-only. */
359
+ async listPackageVersions(package_id) {
360
+ return this.request("GET", `/v1/packages/${encodeURIComponent(package_id)}/versions`);
285
361
  }
286
362
  /**
287
363
  * Publish a new immutable package version — multipart upload of the alias-keyed
@@ -290,13 +366,15 @@ export class LoticsClient {
290
366
  * bundle, then allocates the next monotonic version. The `contract` is opaque
291
367
  * JSON to the transport (the server is the validating authority). Admin-only.
292
368
  */
293
- async publishAppPackageVersion(package_id, args) {
369
+ async publishPackageVersion(package_id, args) {
294
370
  const formData = new FormData();
295
371
  formData.append("contract", JSON.stringify(args.contract));
296
372
  formData.append("bundle", new Blob([new Uint8Array(args.bundle)], { type: "application/gzip" }), "bundle.tar.gz");
297
373
  if (args.changelog)
298
374
  formData.append("changelog", args.changelog);
299
- const url = `${this.baseUrl}/v1/app-packages/${encodeURIComponent(package_id)}/versions`;
375
+ if (args.channel)
376
+ formData.append("channel", args.channel);
377
+ const url = `${this.baseUrl}/v1/packages/${encodeURIComponent(package_id)}/versions`;
300
378
  const response = await fetch(url, {
301
379
  method: "POST",
302
380
  headers: this.buildHeaders(), // no Content-Type — fetch sets the multipart boundary
@@ -313,7 +391,7 @@ export class LoticsClient {
313
391
  * package artifacts, and bumps the pin. `version` omitted upgrades to the
314
392
  * latest. Returns the resulting app. Admin-only.
315
393
  */
316
- async upgradeAppPackage(app_id, body) {
394
+ async upgradePackage(app_id, body) {
317
395
  return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-upgrade`, body);
318
396
  }
319
397
  /**
@@ -321,7 +399,7 @@ export class LoticsClient {
321
399
  * breaking contract changes, the binding drift report, and the modified-core
322
400
  * report — with no writes. Admin-only.
323
401
  */
324
- async previewAppPackageUpgrade(app_id, opts = {}) {
402
+ async previewPackageUpgrade(app_id, opts = {}) {
325
403
  const query = opts.version !== undefined ? `?version=${opts.version}` : "";
326
404
  return this.request("GET", `/v1/apps/${encodeURIComponent(app_id)}/package-upgrade${query}`);
327
405
  }
@@ -330,7 +408,7 @@ export class LoticsClient {
330
408
  * still exists). Re-materializes at the pinned version; refuses over
331
409
  * modified-core findings. Admin-only.
332
410
  */
333
- async rebindAppPackageRole(app_id, body) {
411
+ async rebindPackageRole(app_id, body) {
334
412
  return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-rebind-role`, body);
335
413
  }
336
414
  /**
@@ -346,7 +424,7 @@ export class LoticsClient {
346
424
  * binding drift, and locally modified core artifacts. Read-only; backs
347
425
  * `lotics package doctor`. Admin-only.
348
426
  */
349
- async getAppPackageHealth(app_id) {
427
+ async getPackageHealth(app_id) {
350
428
  return this.request("GET", `/v1/apps/${encodeURIComponent(app_id)}/package-health`);
351
429
  }
352
430
  /**
@@ -355,7 +433,7 @@ export class LoticsClient {
355
433
  * workspaces (a non-dev workspace is refused). Returns the resulting app.
356
434
  * Admin-only.
357
435
  */
358
- async resetAppPackage(app_id) {
436
+ async resetPackage(app_id) {
359
437
  return this.request("POST", `/v1/apps/${encodeURIComponent(app_id)}/package-reset`);
360
438
  }
361
439
  /**