capdag 0.119.263 → 0.124.274

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 CHANGED
@@ -3008,7 +3008,7 @@ class CapSetEntry {
3008
3008
  }
3009
3009
 
3010
3010
  /**
3011
- * Unified registry for cap sets (providers and plugins)
3011
+ * Unified registry for cap sets (providers and cartridges)
3012
3012
  * Provides capability host discovery using subset matching.
3013
3013
  */
3014
3014
  class CapMatrix {
@@ -3804,7 +3804,7 @@ const StdinSourceKind = {
3804
3804
 
3805
3805
  /**
3806
3806
  * Represents the source for stdin data.
3807
- * For plugins (via gRPC/XPC), using FileReference avoids size limits
3807
+ * For cartridges (via gRPC/XPC), using FileReference avoids size limits
3808
3808
  * by letting the receiving side read the file locally.
3809
3809
  */
3810
3810
  class StdinSource {
@@ -3838,7 +3838,7 @@ class StdinSource {
3838
3838
 
3839
3839
  /**
3840
3840
  * Create a StdinSource from a file reference
3841
- * Used for plugins to read files locally instead of sending bytes over the wire.
3841
+ * Used for cartridges to read files locally instead of sending bytes over the wire.
3842
3842
  * @param {string} trackedFileId - ID for lifecycle management
3843
3843
  * @param {string} originalPath - Original file path (for logging/debugging)
3844
3844
  * @param {Uint8Array|Buffer|null} securityBookmark - Security bookmark data
@@ -3872,13 +3872,13 @@ class StdinSource {
3872
3872
  }
3873
3873
 
3874
3874
  // =============================================================================
3875
- // Plugin Repository System
3875
+ // Cartridge Repository System
3876
3876
  // =============================================================================
3877
3877
 
3878
3878
  /**
3879
- * Plugin capability summary from registry
3879
+ * Cartridge capability summary from registry
3880
3880
  */
3881
- class PluginCapSummary {
3881
+ class CartridgeCapSummary {
3882
3882
  constructor(urn, title, description = '') {
3883
3883
  this.urn = urn;
3884
3884
  this.title = title;
@@ -3887,9 +3887,9 @@ class PluginCapSummary {
3887
3887
  }
3888
3888
 
3889
3889
  /**
3890
- * Plugin information from registry
3890
+ * Cartridge information from registry
3891
3891
  */
3892
- class PluginInfo {
3892
+ class CartridgeInfo {
3893
3893
  constructor(data) {
3894
3894
  this.id = data.id;
3895
3895
  this.name = data.name;
@@ -3900,7 +3900,7 @@ class PluginInfo {
3900
3900
  this.teamId = data.teamId || '';
3901
3901
  this.signedAt = data.signedAt || '';
3902
3902
  this.minAppVersion = data.minAppVersion || '';
3903
- this.caps = (data.caps || []).map(c => new PluginCapSummary(c.urn, c.title, c.description || ''));
3903
+ this.caps = (data.caps || []).map(c => new CartridgeCapSummary(c.urn, c.title, c.description || ''));
3904
3904
  this.categories = data.categories || [];
3905
3905
  this.tags = data.tags || [];
3906
3906
  this.changelog = data.changelog || {};
@@ -3909,35 +3909,32 @@ class PluginInfo {
3909
3909
  this.packageName = data.packageName || '';
3910
3910
  this.packageSha256 = data.packageSha256 || '';
3911
3911
  this.packageSize = data.packageSize || 0;
3912
- this.binaryName = data.binaryName || '';
3913
- this.binarySha256 = data.binarySha256 || '';
3914
- this.binarySize = data.binarySize || 0;
3915
3912
  this.availableVersions = data.availableVersions || [];
3916
3913
  }
3917
3914
 
3918
3915
  /**
3919
- * Check if plugin is signed (has team_id and signed_at)
3916
+ * Check if cartridge is signed (has team_id and signed_at)
3920
3917
  */
3921
3918
  isSigned() {
3922
3919
  return this.teamId.length > 0 && this.signedAt.length > 0;
3923
3920
  }
3924
3921
 
3925
3922
  /**
3926
- * Check if binary download info is available
3923
+ * Check if package download info is available
3927
3924
  */
3928
- hasBinary() {
3929
- return this.binaryName.length > 0 && this.binarySha256.length > 0;
3925
+ hasPackage() {
3926
+ return this.packageName.length > 0 && this.packageSha256.length > 0;
3930
3927
  }
3931
3928
  }
3932
3929
 
3933
3930
  /**
3934
- * Plugin suggestion for a missing cap
3931
+ * Cartridge suggestion for a missing cap
3935
3932
  */
3936
- class PluginSuggestion {
3933
+ class CartridgeSuggestion {
3937
3934
  constructor(data) {
3938
- this.pluginId = data.pluginId;
3939
- this.pluginName = data.pluginName;
3940
- this.pluginDescription = data.pluginDescription;
3935
+ this.cartridgeId = data.cartridgeId;
3936
+ this.cartridgeName = data.cartridgeName;
3937
+ this.cartridgeDescription = data.cartridgeDescription;
3941
3938
  this.capUrn = data.capUrn;
3942
3939
  this.capTitle = data.capTitle;
3943
3940
  this.latestVersion = data.latestVersion;
@@ -3947,23 +3944,23 @@ class PluginSuggestion {
3947
3944
  }
3948
3945
 
3949
3946
  /**
3950
- * Plugin registry cache entry
3947
+ * Cartridge registry cache entry
3951
3948
  */
3952
- class PluginRepoCache {
3949
+ class CartridgeRepoCache {
3953
3950
  constructor(repoUrl) {
3954
- this.plugins = new Map(); // plugin_id -> PluginInfo
3955
- this.capToPlugins = new Map(); // cap_urn -> [plugin_ids]
3951
+ this.cartridges = new Map(); // cartridge_id -> CartridgeInfo
3952
+ this.capToCartridges = new Map(); // cap_urn -> [cartridge_ids]
3956
3953
  this.lastUpdated = Date.now();
3957
3954
  this.repoUrl = repoUrl;
3958
3955
  }
3959
3956
  }
3960
3957
 
3961
3958
  /**
3962
- * Plugin repository client - fetches and caches plugin registry
3959
+ * Cartridge repository client - fetches and caches cartridge registry
3963
3960
  */
3964
- class PluginRepoClient {
3961
+ class CartridgeRepoClient {
3965
3962
  constructor(cacheTtlSeconds = 3600) {
3966
- this.caches = new Map(); // repo_url -> PluginRepoCache
3963
+ this.caches = new Map(); // repo_url -> CartridgeRepoCache
3967
3964
  this.cacheTtl = cacheTtlSeconds * 1000; // Convert to milliseconds
3968
3965
  }
3969
3966
 
@@ -3974,32 +3971,32 @@ class PluginRepoClient {
3974
3971
  const response = await fetch(repoUrl);
3975
3972
 
3976
3973
  if (!response.ok) {
3977
- throw new Error(`Plugin registry request failed: HTTP ${response.status} from ${repoUrl}`);
3974
+ throw new Error(`Cartridge registry request failed: HTTP ${response.status} from ${repoUrl}`);
3978
3975
  }
3979
3976
 
3980
3977
  const data = await response.json();
3981
3978
 
3982
- if (!data.plugins || !Array.isArray(data.plugins)) {
3983
- throw new Error(`Invalid plugin registry response from ${repoUrl}: missing plugins array`);
3979
+ if (!data.cartridges || !Array.isArray(data.cartridges)) {
3980
+ throw new Error(`Invalid cartridge registry response from ${repoUrl}: missing cartridges array`);
3984
3981
  }
3985
3982
 
3986
- return data.plugins.map(p => new PluginInfo(p));
3983
+ return data.cartridges.map(p => new CartridgeInfo(p));
3987
3984
  }
3988
3985
 
3989
3986
  /**
3990
3987
  * Update cache from registry data
3991
3988
  */
3992
- updateCache(repoUrl, plugins) {
3993
- const cache = new PluginRepoCache(repoUrl);
3989
+ updateCache(repoUrl, cartridges) {
3990
+ const cache = new CartridgeRepoCache(repoUrl);
3994
3991
 
3995
- for (const plugin of plugins) {
3996
- cache.plugins.set(plugin.id, plugin);
3992
+ for (const cartridge of cartridges) {
3993
+ cache.cartridges.set(cartridge.id, cartridge);
3997
3994
 
3998
- for (const cap of plugin.caps) {
3999
- if (!cache.capToPlugins.has(cap.urn)) {
4000
- cache.capToPlugins.set(cap.urn, []);
3995
+ for (const cap of cartridge.caps) {
3996
+ if (!cache.capToCartridges.has(cap.urn)) {
3997
+ cache.capToCartridges.set(cap.urn, []);
4001
3998
  }
4002
- cache.capToPlugins.get(cap.urn).push(plugin.id);
3999
+ cache.capToCartridges.get(cap.urn).push(cartridge.id);
4003
4000
  }
4004
4001
  }
4005
4002
 
@@ -4014,15 +4011,15 @@ class PluginRepoClient {
4014
4011
  }
4015
4012
 
4016
4013
  /**
4017
- * Sync plugin data from repository URLs
4014
+ * Sync cartridge data from repository URLs
4018
4015
  */
4019
4016
  async syncRepos(repoUrls) {
4020
4017
  for (const repoUrl of repoUrls) {
4021
4018
  try {
4022
- const plugins = await this.fetchRegistry(repoUrl);
4023
- this.updateCache(repoUrl, plugins);
4019
+ const cartridges = await this.fetchRegistry(repoUrl);
4020
+ this.updateCache(repoUrl, cartridges);
4024
4021
  } catch (e) {
4025
- console.warn(`Failed to sync plugin repo ${repoUrl}: ${e.message}`);
4022
+ console.warn(`Failed to sync cartridge repo ${repoUrl}: ${e.message}`);
4026
4023
  // Continue with other repos
4027
4024
  }
4028
4025
  }
@@ -4042,31 +4039,31 @@ class PluginRepoClient {
4042
4039
  }
4043
4040
 
4044
4041
  /**
4045
- * Get plugin suggestions for a cap URN
4042
+ * Get cartridge suggestions for a cap URN
4046
4043
  */
4047
4044
  getSuggestionsForCap(capUrn) {
4048
4045
  const suggestions = [];
4049
4046
 
4050
4047
  for (const cache of this.caches.values()) {
4051
- const pluginIds = cache.capToPlugins.get(capUrn);
4052
- if (!pluginIds) continue;
4048
+ const cartridgeIds = cache.capToCartridges.get(capUrn);
4049
+ if (!cartridgeIds) continue;
4053
4050
 
4054
- for (const pluginId of pluginIds) {
4055
- const plugin = cache.plugins.get(pluginId);
4056
- if (!plugin) continue;
4051
+ for (const cartridgeId of cartridgeIds) {
4052
+ const cartridge = cache.cartridges.get(cartridgeId);
4053
+ if (!cartridge) continue;
4057
4054
 
4058
- const capInfo = plugin.caps.find(c => c.urn === capUrn);
4055
+ const capInfo = cartridge.caps.find(c => c.urn === capUrn);
4059
4056
  if (!capInfo) continue;
4060
4057
 
4061
- const pageUrl = plugin.pageUrl || cache.repoUrl;
4058
+ const pageUrl = cartridge.pageUrl || cache.repoUrl;
4062
4059
 
4063
- suggestions.push(new PluginSuggestion({
4064
- pluginId: plugin.id,
4065
- pluginName: plugin.name,
4066
- pluginDescription: plugin.description,
4060
+ suggestions.push(new CartridgeSuggestion({
4061
+ cartridgeId: cartridge.id,
4062
+ cartridgeName: cartridge.name,
4063
+ cartridgeDescription: cartridge.description,
4067
4064
  capUrn: capUrn,
4068
4065
  capTitle: capInfo.title,
4069
- latestVersion: plugin.version,
4066
+ latestVersion: cartridge.version,
4070
4067
  repoUrl: cache.repoUrl,
4071
4068
  pageUrl: pageUrl
4072
4069
  }));
@@ -4077,25 +4074,25 @@ class PluginRepoClient {
4077
4074
  }
4078
4075
 
4079
4076
  /**
4080
- * Get all available plugins from all repos
4077
+ * Get all available cartridges from all repos
4081
4078
  */
4082
- getAllPlugins() {
4083
- const plugins = [];
4079
+ getAllCartridges() {
4080
+ const cartridges = [];
4084
4081
  for (const cache of this.caches.values()) {
4085
- for (const [pluginId, pluginInfo] of cache.plugins) {
4086
- plugins.push([pluginId, pluginInfo]);
4082
+ for (const [cartridgeId, cartridgeInfo] of cache.cartridges) {
4083
+ cartridges.push([cartridgeId, cartridgeInfo]);
4087
4084
  }
4088
4085
  }
4089
- return plugins;
4086
+ return cartridges;
4090
4087
  }
4091
4088
 
4092
4089
  /**
4093
- * Get all available cap URNs from plugins
4090
+ * Get all available cap URNs from cartridges
4094
4091
  */
4095
4092
  getAllAvailableCaps() {
4096
4093
  const caps = new Set();
4097
4094
  for (const cache of this.caches.values()) {
4098
- for (const capUrn of cache.capToPlugins.keys()) {
4095
+ for (const capUrn of cache.capToCartridges.keys()) {
4099
4096
  caps.add(capUrn);
4100
4097
  }
4101
4098
  }
@@ -4103,13 +4100,13 @@ class PluginRepoClient {
4103
4100
  }
4104
4101
 
4105
4102
  /**
4106
- * Get plugin info by ID
4103
+ * Get cartridge info by ID
4107
4104
  */
4108
- getPlugin(pluginId) {
4105
+ getCartridge(cartridgeId) {
4109
4106
  for (const cache of this.caches.values()) {
4110
- const plugin = cache.plugins.get(pluginId);
4111
- if (plugin) {
4112
- return plugin;
4107
+ const cartridge = cache.cartridges.get(cartridgeId);
4108
+ if (cartridge) {
4109
+ return cartridge;
4113
4110
  }
4114
4111
  }
4115
4112
  return null;
@@ -4133,9 +4130,9 @@ class PluginRepoClient {
4133
4130
  }
4134
4131
 
4135
4132
  /**
4136
- * Plugin repository server - serves registry data with queries
4133
+ * Cartridge repository server - serves registry data with queries
4137
4134
  */
4138
- class PluginRepoServer {
4135
+ class CartridgeRepoServer {
4139
4136
  constructor(registry) {
4140
4137
  this.registry = registry;
4141
4138
  this.validateRegistry();
@@ -4151,8 +4148,8 @@ class PluginRepoServer {
4151
4148
  if (this.registry.schemaVersion !== '3.0') {
4152
4149
  throw new Error(`Unsupported registry schema version: ${this.registry.schemaVersion}. Required: 3.0`);
4153
4150
  }
4154
- if (!this.registry.plugins || typeof this.registry.plugins !== 'object') {
4155
- throw new Error('Registry must have plugins object');
4151
+ if (!this.registry.cartridges || typeof this.registry.cartridges !== 'object') {
4152
+ throw new Error('Registry must have cartridges object');
4156
4153
  }
4157
4154
  }
4158
4155
 
@@ -4161,13 +4158,10 @@ class PluginRepoServer {
4161
4158
  */
4162
4159
  validateVersionData(id, version, versionData) {
4163
4160
  if (!versionData.platform) {
4164
- throw new Error(`Plugin ${id} v${version}: missing required field 'platform'`);
4161
+ throw new Error(`Cartridge ${id} v${version}: missing required field 'platform'`);
4165
4162
  }
4166
4163
  if (!versionData.package || !versionData.package.name) {
4167
- throw new Error(`Plugin ${id} v${version}: missing required field 'package'`);
4168
- }
4169
- if (!versionData.binary || !versionData.binary.name) {
4170
- throw new Error(`Plugin ${id} v${version}: missing required field 'binary'`);
4164
+ throw new Error(`Cartridge ${id} v${version}: missing required field 'package'`);
4171
4165
  }
4172
4166
  }
4173
4167
 
@@ -4202,85 +4196,82 @@ class PluginRepoServer {
4202
4196
  }
4203
4197
 
4204
4198
  /**
4205
- * Transform registry to flat plugin array
4199
+ * Transform registry to flat cartridge array
4206
4200
  */
4207
- transformToPluginArray() {
4208
- const pluginsObject = this.registry.plugins || {};
4209
- const plugins = [];
4201
+ transformToCartridgeArray() {
4202
+ const cartridgesObject = this.registry.cartridges || {};
4203
+ const cartridges = [];
4210
4204
 
4211
- for (const [id, plugin] of Object.entries(pluginsObject)) {
4212
- const latestVersion = plugin.latestVersion;
4213
- const versionData = plugin.versions[latestVersion];
4205
+ for (const [id, cartridge] of Object.entries(cartridgesObject)) {
4206
+ const latestVersion = cartridge.latestVersion;
4207
+ const versionData = cartridge.versions[latestVersion];
4214
4208
 
4215
4209
  if (!versionData) {
4216
- throw new Error(`Plugin ${id}: latest version ${latestVersion} not found in versions`);
4210
+ throw new Error(`Cartridge ${id}: latest version ${latestVersion} not found in versions`);
4217
4211
  }
4218
4212
 
4219
4213
  // Validate required fields - fail hard
4220
4214
  this.validateVersionData(id, latestVersion, versionData);
4221
4215
 
4222
4216
  // Get all version numbers sorted descending
4223
- const availableVersions = Object.keys(plugin.versions).sort((a, b) => {
4217
+ const availableVersions = Object.keys(cartridge.versions).sort((a, b) => {
4224
4218
  return this.compareVersions(b, a);
4225
4219
  });
4226
4220
 
4227
- // Build flat plugin object with latest version data
4228
- const packageUrl = `https://machinefabric.com/plugins/packages/${versionData.package.name}`;
4229
- plugins.push({
4221
+ // Build flat cartridge object with latest version data
4222
+ const packageUrl = `https://machinefabric.com/cartridges/packages/${versionData.package.name}`;
4223
+ cartridges.push({
4230
4224
  id,
4231
- name: plugin.name,
4225
+ name: cartridge.name,
4232
4226
  version: latestVersion,
4233
- description: plugin.description,
4234
- author: plugin.author,
4235
- pageUrl: plugin.pageUrl || packageUrl,
4236
- teamId: plugin.teamId,
4227
+ description: cartridge.description,
4228
+ author: cartridge.author,
4229
+ pageUrl: cartridge.pageUrl || packageUrl,
4230
+ teamId: cartridge.teamId,
4237
4231
  signedAt: versionData.releaseDate,
4238
- minAppVersion: versionData.minAppVersion || plugin.minAppVersion,
4239
- caps: plugin.caps || [],
4240
- categories: plugin.categories,
4241
- tags: plugin.tags,
4242
- changelog: this.buildChangelogMap(plugin.versions),
4243
- // Distribution fields - ALL REQUIRED
4232
+ minAppVersion: versionData.minAppVersion || cartridge.minAppVersion,
4233
+ caps: cartridge.caps || [],
4234
+ categories: cartridge.categories,
4235
+ tags: cartridge.tags,
4236
+ changelog: this.buildChangelogMap(cartridge.versions),
4237
+ // Distribution fields
4244
4238
  platform: versionData.platform,
4245
4239
  packageName: versionData.package.name,
4246
4240
  packageSha256: versionData.package.sha256,
4247
4241
  packageSize: versionData.package.size,
4248
- binaryName: versionData.binary.name,
4249
- binarySha256: versionData.binary.sha256,
4250
- binarySize: versionData.binary.size,
4251
4242
  // All available versions
4252
4243
  availableVersions
4253
4244
  });
4254
4245
  }
4255
4246
 
4256
- return plugins;
4247
+ return cartridges;
4257
4248
  }
4258
4249
 
4259
4250
  /**
4260
- * Get all plugins (API response format)
4251
+ * Get all cartridges (API response format)
4261
4252
  */
4262
- getPlugins() {
4253
+ getCartridges() {
4263
4254
  return {
4264
- plugins: this.transformToPluginArray()
4255
+ cartridges: this.transformToCartridgeArray()
4265
4256
  };
4266
4257
  }
4267
4258
 
4268
4259
  /**
4269
- * Get plugin by ID
4260
+ * Get cartridge by ID
4270
4261
  */
4271
- getPluginById(id) {
4272
- const plugins = this.transformToPluginArray();
4273
- return plugins.find(p => p.id === id);
4262
+ getCartridgeById(id) {
4263
+ const cartridges = this.transformToCartridgeArray();
4264
+ return cartridges.find(p => p.id === id);
4274
4265
  }
4275
4266
 
4276
4267
  /**
4277
- * Search plugins by query
4268
+ * Search cartridges by query
4278
4269
  */
4279
- searchPlugins(query) {
4280
- const plugins = this.transformToPluginArray();
4270
+ searchCartridges(query) {
4271
+ const cartridges = this.transformToCartridgeArray();
4281
4272
  const lowerQuery = query.toLowerCase();
4282
4273
 
4283
- return plugins.filter(p =>
4274
+ return cartridges.filter(p =>
4284
4275
  p.name.toLowerCase().includes(lowerQuery) ||
4285
4276
  p.description.toLowerCase().includes(lowerQuery) ||
4286
4277
  p.tags.some(t => t.toLowerCase().includes(lowerQuery)) ||
@@ -4289,19 +4280,19 @@ class PluginRepoServer {
4289
4280
  }
4290
4281
 
4291
4282
  /**
4292
- * Get plugins by category
4283
+ * Get cartridges by category
4293
4284
  */
4294
- getPluginsByCategory(category) {
4295
- const plugins = this.transformToPluginArray();
4296
- return plugins.filter(p => p.categories.includes(category));
4285
+ getCartridgesByCategory(category) {
4286
+ const cartridges = this.transformToCartridgeArray();
4287
+ return cartridges.filter(p => p.categories.includes(category));
4297
4288
  }
4298
4289
 
4299
4290
  /**
4300
- * Get plugins that provide a specific cap
4291
+ * Get cartridges that provide a specific cap
4301
4292
  */
4302
- getPluginsByCap(capUrn) {
4303
- const plugins = this.transformToPluginArray();
4304
- return plugins.filter(p => p.caps.some(c => c.urn === capUrn));
4293
+ getCartridgesByCap(capUrn) {
4294
+ const cartridges = this.transformToCartridgeArray();
4295
+ return cartridges.filter(p => p.caps.some(c => c.urn === capUrn));
4305
4296
  }
4306
4297
  }
4307
4298
 
@@ -5515,13 +5506,13 @@ module.exports = {
5515
5506
  CapGraph,
5516
5507
  StdinSource,
5517
5508
  StdinSourceKind,
5518
- // Plugin Repository
5519
- PluginCapSummary,
5520
- PluginInfo,
5521
- PluginSuggestion,
5522
- PluginRepoCache,
5523
- PluginRepoClient,
5524
- PluginRepoServer,
5509
+ // Cartridge Repository
5510
+ CartridgeCapSummary,
5511
+ CartridgeInfo,
5512
+ CartridgeSuggestion,
5513
+ CartridgeRepoCache,
5514
+ CartridgeRepoClient,
5515
+ CartridgeRepoServer,
5525
5516
  // Machine notation
5526
5517
  MachineSyntaxError,
5527
5518
  MachineSyntaxErrorCodes,