capdag 0.161.384 → 0.162.386
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/capdag.js +30 -5
- package/package.json +1 -1
package/capdag.js
CHANGED
|
@@ -4528,6 +4528,24 @@ class CartridgeRepoServer {
|
|
|
4528
4528
|
* Reasons why a cartridge attachment attempt failed.
|
|
4529
4529
|
* Mirrors Rust CartridgeAttachmentErrorKind.
|
|
4530
4530
|
*/
|
|
4531
|
+
const CartridgeLifecycle = Object.freeze({
|
|
4532
|
+
// Discovery scan has found the version directory and is about
|
|
4533
|
+
// to inspect it. Transient.
|
|
4534
|
+
DISCOVERED: 'discovered',
|
|
4535
|
+
// Reading cartridge.json, computing directory hash, validating
|
|
4536
|
+
// on-disk install context. Hashing can take seconds for large
|
|
4537
|
+
// model cartridges; runs on a background queue so other
|
|
4538
|
+
// cartridges' inspections proceed in parallel.
|
|
4539
|
+
INSPECTING: 'inspecting',
|
|
4540
|
+
// Inspection succeeded; awaiting a verdict from the registry
|
|
4541
|
+
// verifier service. Skipped for dev cartridges
|
|
4542
|
+
// (registry_url == null) and bundle cartridges.
|
|
4543
|
+
VERIFYING: 'verifying',
|
|
4544
|
+
// Cleared every gate. Caps are registered with the engine and
|
|
4545
|
+
// dispatch can route requests to this cartridge.
|
|
4546
|
+
OPERATIONAL: 'operational',
|
|
4547
|
+
});
|
|
4548
|
+
|
|
4531
4549
|
const CartridgeAttachmentErrorKind = Object.freeze({
|
|
4532
4550
|
INCOMPATIBLE: 'incompatible',
|
|
4533
4551
|
MANIFEST_INVALID: 'manifest_invalid',
|
|
@@ -4636,9 +4654,9 @@ class CartridgeRuntimeStats {
|
|
|
4636
4654
|
/**
|
|
4637
4655
|
* Full identity of an installed cartridge, including optional attachment error
|
|
4638
4656
|
* and runtime statistics.
|
|
4639
|
-
* Mirrors Rust
|
|
4657
|
+
* Mirrors Rust InstalledCartridgeRecord.
|
|
4640
4658
|
*/
|
|
4641
|
-
class
|
|
4659
|
+
class InstalledCartridgeRecord {
|
|
4642
4660
|
/**
|
|
4643
4661
|
* @param {Object} opts
|
|
4644
4662
|
* @param {string|null} [opts.registryUrl=null]
|
|
@@ -4649,8 +4667,9 @@ class InstalledCartridgeIdentity {
|
|
|
4649
4667
|
* @param {Array<Object>} [opts.capGroups=[]] - Cartridge's manifest cap_groups; each element is `{name, caps, adapter_urns}`.
|
|
4650
4668
|
* @param {CartridgeAttachmentError|null} [opts.attachmentError=null]
|
|
4651
4669
|
* @param {CartridgeRuntimeStats|null} [opts.runtimeStats=null]
|
|
4670
|
+
* @param {string} [opts.lifecycle='discovered'] - One of `discovered` | `inspecting` | `verifying` | `operational`. Mutually exclusive with attachmentError; see `machfab-mac/docs/cartridge state machine.md`.
|
|
4652
4671
|
*/
|
|
4653
|
-
constructor({ registryUrl = null, channel, id, version, sha256, capGroups = [], attachmentError = null, runtimeStats = null }) {
|
|
4672
|
+
constructor({ registryUrl = null, channel, id, version, sha256, capGroups = [], attachmentError = null, runtimeStats = null, lifecycle = 'discovered' }) {
|
|
4654
4673
|
this.registry_url = registryUrl;
|
|
4655
4674
|
this.channel = channel;
|
|
4656
4675
|
this.id = id;
|
|
@@ -4659,6 +4678,7 @@ class InstalledCartridgeIdentity {
|
|
|
4659
4678
|
this.cap_groups = capGroups;
|
|
4660
4679
|
this.attachment_error = attachmentError;
|
|
4661
4680
|
this.runtime_stats = runtimeStats;
|
|
4681
|
+
this.lifecycle = lifecycle;
|
|
4662
4682
|
}
|
|
4663
4683
|
|
|
4664
4684
|
toJSON() {
|
|
@@ -4667,6 +4687,7 @@ class InstalledCartridgeIdentity {
|
|
|
4667
4687
|
id: this.id,
|
|
4668
4688
|
version: this.version,
|
|
4669
4689
|
sha256: this.sha256,
|
|
4690
|
+
lifecycle: this.lifecycle,
|
|
4670
4691
|
};
|
|
4671
4692
|
if (this.registry_url !== null) obj.registry_url = this.registry_url;
|
|
4672
4693
|
if (this.cap_groups && this.cap_groups.length > 0) obj.cap_groups = this.cap_groups;
|
|
@@ -4676,7 +4697,7 @@ class InstalledCartridgeIdentity {
|
|
|
4676
4697
|
}
|
|
4677
4698
|
|
|
4678
4699
|
static fromJSON(d) {
|
|
4679
|
-
return new
|
|
4700
|
+
return new InstalledCartridgeRecord({
|
|
4680
4701
|
registryUrl: d.registry_url !== undefined ? d.registry_url : null,
|
|
4681
4702
|
channel: d.channel,
|
|
4682
4703
|
id: d.id,
|
|
@@ -4685,6 +4706,9 @@ class InstalledCartridgeIdentity {
|
|
|
4685
4706
|
capGroups: Array.isArray(d.cap_groups) ? d.cap_groups : [],
|
|
4686
4707
|
attachmentError: d.attachment_error ? CartridgeAttachmentError.fromJSON(d.attachment_error) : null,
|
|
4687
4708
|
runtimeStats: d.runtime_stats ? CartridgeRuntimeStats.fromJSON(d.runtime_stats) : null,
|
|
4709
|
+
// Default to 'discovered' (the safe sentinel) — never
|
|
4710
|
+
// 'operational' — when the field is missing from the wire.
|
|
4711
|
+
lifecycle: typeof d.lifecycle === 'string' ? d.lifecycle : 'discovered',
|
|
4688
4712
|
});
|
|
4689
4713
|
}
|
|
4690
4714
|
|
|
@@ -5966,10 +5990,11 @@ module.exports = {
|
|
|
5966
5990
|
CartridgeRepoServer,
|
|
5967
5991
|
CartridgeChannel,
|
|
5968
5992
|
// Bifaci — cartridge attachment & runtime identity
|
|
5993
|
+
CartridgeLifecycle,
|
|
5969
5994
|
CartridgeAttachmentErrorKind,
|
|
5970
5995
|
CartridgeAttachmentError,
|
|
5971
5996
|
CartridgeRuntimeStats,
|
|
5972
|
-
|
|
5997
|
+
InstalledCartridgeRecord,
|
|
5973
5998
|
// Registry slug
|
|
5974
5999
|
DEV_SLUG,
|
|
5975
6000
|
SLUG_HEX_LEN,
|
package/package.json
CHANGED