agent-swarm-kit 1.0.215 → 1.0.217
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/build/index.cjs +27 -0
- package/build/index.mjs +27 -0
- package/package.json +1 -1
- package/types.d.ts +17 -0
package/build/index.cjs
CHANGED
|
@@ -17384,6 +17384,8 @@ const METHOD_NAME_REMOVE$1 = "StorageUtils.remove";
|
|
|
17384
17384
|
const METHOD_NAME_GET$1 = "StorageUtils.get";
|
|
17385
17385
|
/** @private Constant for logging the list method in StorageUtils */
|
|
17386
17386
|
const METHOD_NAME_LIST$1 = "StorageUtils.list";
|
|
17387
|
+
/** @private Constant for logging the createNumericIndex method in SharedStorageUtils */
|
|
17388
|
+
const METHOD_NAME_CREATE_NUMERIC_INDEX = "StorageUtils.createNumericIndex";
|
|
17387
17389
|
/** @private Constant for logging the clear method in StorageUtils */
|
|
17388
17390
|
const METHOD_NAME_CLEAR$1 = "StorageUtils.clear";
|
|
17389
17391
|
/**
|
|
@@ -17529,6 +17531,31 @@ class StorageUtils {
|
|
|
17529
17531
|
}
|
|
17530
17532
|
return await swarm$1.storagePublicService.list(METHOD_NAME_LIST$1, payload.clientId, payload.storageName, payload.filter);
|
|
17531
17533
|
});
|
|
17534
|
+
/**
|
|
17535
|
+
* Creates a numeric index for the storage of a given client and agent.
|
|
17536
|
+
* Validates the storage name and agent-storage registration before calculating the index.
|
|
17537
|
+
* Executes within a context for logging.
|
|
17538
|
+
* The numeric index is determined based on the current number of items in the storage.
|
|
17539
|
+
* @param {Object} payload - The payload containing client, agent, and storage details.
|
|
17540
|
+
* @param {string} payload.clientId - The ID of the client whose storage is being indexed.
|
|
17541
|
+
* @param {AgentName} payload.agentName - The name of the agent associated with the storage.
|
|
17542
|
+
* @param {StorageName} payload.storageName - The name of the storage to index.
|
|
17543
|
+
* @returns {Promise<number>} A promise resolving to the next numeric index for the storage.
|
|
17544
|
+
* @throws {Error} If storage validation fails, the storage is not registered in the agent, or the storage service encounters an error.
|
|
17545
|
+
*/
|
|
17546
|
+
this.createNumericIndex = beginContext(async (payload) => {
|
|
17547
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17548
|
+
swarm$1.loggerService.log(METHOD_NAME_CREATE_NUMERIC_INDEX, {
|
|
17549
|
+
clientId: payload.clientId,
|
|
17550
|
+
storageName: payload.storageName,
|
|
17551
|
+
});
|
|
17552
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_CREATE_NUMERIC_INDEX);
|
|
17553
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
17554
|
+
throw new Error(`agent-swarm StorageUtils ${payload.storageName} not registered in ${payload.agentName} (createNumericIndex)`);
|
|
17555
|
+
}
|
|
17556
|
+
const { length } = await swarm$1.storagePublicService.list(METHOD_NAME_CREATE_NUMERIC_INDEX, payload.clientId, payload.storageName);
|
|
17557
|
+
return length + 1;
|
|
17558
|
+
});
|
|
17532
17559
|
/**
|
|
17533
17560
|
* Clears all items from the storage for a given client and agent.
|
|
17534
17561
|
* Validates the storage name and agent-storage registration before clearing via the storage service.
|
package/build/index.mjs
CHANGED
|
@@ -17382,6 +17382,8 @@ const METHOD_NAME_REMOVE$1 = "StorageUtils.remove";
|
|
|
17382
17382
|
const METHOD_NAME_GET$1 = "StorageUtils.get";
|
|
17383
17383
|
/** @private Constant for logging the list method in StorageUtils */
|
|
17384
17384
|
const METHOD_NAME_LIST$1 = "StorageUtils.list";
|
|
17385
|
+
/** @private Constant for logging the createNumericIndex method in SharedStorageUtils */
|
|
17386
|
+
const METHOD_NAME_CREATE_NUMERIC_INDEX = "StorageUtils.createNumericIndex";
|
|
17385
17387
|
/** @private Constant for logging the clear method in StorageUtils */
|
|
17386
17388
|
const METHOD_NAME_CLEAR$1 = "StorageUtils.clear";
|
|
17387
17389
|
/**
|
|
@@ -17527,6 +17529,31 @@ class StorageUtils {
|
|
|
17527
17529
|
}
|
|
17528
17530
|
return await swarm$1.storagePublicService.list(METHOD_NAME_LIST$1, payload.clientId, payload.storageName, payload.filter);
|
|
17529
17531
|
});
|
|
17532
|
+
/**
|
|
17533
|
+
* Creates a numeric index for the storage of a given client and agent.
|
|
17534
|
+
* Validates the storage name and agent-storage registration before calculating the index.
|
|
17535
|
+
* Executes within a context for logging.
|
|
17536
|
+
* The numeric index is determined based on the current number of items in the storage.
|
|
17537
|
+
* @param {Object} payload - The payload containing client, agent, and storage details.
|
|
17538
|
+
* @param {string} payload.clientId - The ID of the client whose storage is being indexed.
|
|
17539
|
+
* @param {AgentName} payload.agentName - The name of the agent associated with the storage.
|
|
17540
|
+
* @param {StorageName} payload.storageName - The name of the storage to index.
|
|
17541
|
+
* @returns {Promise<number>} A promise resolving to the next numeric index for the storage.
|
|
17542
|
+
* @throws {Error} If storage validation fails, the storage is not registered in the agent, or the storage service encounters an error.
|
|
17543
|
+
*/
|
|
17544
|
+
this.createNumericIndex = beginContext(async (payload) => {
|
|
17545
|
+
GLOBAL_CONFIG.CC_LOGGER_ENABLE_LOG &&
|
|
17546
|
+
swarm$1.loggerService.log(METHOD_NAME_CREATE_NUMERIC_INDEX, {
|
|
17547
|
+
clientId: payload.clientId,
|
|
17548
|
+
storageName: payload.storageName,
|
|
17549
|
+
});
|
|
17550
|
+
swarm$1.storageValidationService.validate(payload.storageName, METHOD_NAME_CREATE_NUMERIC_INDEX);
|
|
17551
|
+
if (!swarm$1.agentValidationService.hasStorage(payload.agentName, payload.storageName)) {
|
|
17552
|
+
throw new Error(`agent-swarm StorageUtils ${payload.storageName} not registered in ${payload.agentName} (createNumericIndex)`);
|
|
17553
|
+
}
|
|
17554
|
+
const { length } = await swarm$1.storagePublicService.list(METHOD_NAME_CREATE_NUMERIC_INDEX, payload.clientId, payload.storageName);
|
|
17555
|
+
return length + 1;
|
|
17556
|
+
});
|
|
17530
17557
|
/**
|
|
17531
17558
|
* Clears all items from the storage for a given client and agent.
|
|
17532
17559
|
* Validates the storage name and agent-storage registration before clearing via the storage service.
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -11054,6 +11054,23 @@ declare class StorageUtils implements TStorage {
|
|
|
11054
11054
|
storageName: StorageName;
|
|
11055
11055
|
filter?: (item: T) => boolean;
|
|
11056
11056
|
}) => Promise<T[]>;
|
|
11057
|
+
/**
|
|
11058
|
+
* Creates a numeric index for the storage of a given client and agent.
|
|
11059
|
+
* Validates the storage name and agent-storage registration before calculating the index.
|
|
11060
|
+
* Executes within a context for logging.
|
|
11061
|
+
* The numeric index is determined based on the current number of items in the storage.
|
|
11062
|
+
* @param {Object} payload - The payload containing client, agent, and storage details.
|
|
11063
|
+
* @param {string} payload.clientId - The ID of the client whose storage is being indexed.
|
|
11064
|
+
* @param {AgentName} payload.agentName - The name of the agent associated with the storage.
|
|
11065
|
+
* @param {StorageName} payload.storageName - The name of the storage to index.
|
|
11066
|
+
* @returns {Promise<number>} A promise resolving to the next numeric index for the storage.
|
|
11067
|
+
* @throws {Error} If storage validation fails, the storage is not registered in the agent, or the storage service encounters an error.
|
|
11068
|
+
*/
|
|
11069
|
+
createNumericIndex: (payload: {
|
|
11070
|
+
clientId: string;
|
|
11071
|
+
agentName: AgentName;
|
|
11072
|
+
storageName: StorageName;
|
|
11073
|
+
}) => Promise<number>;
|
|
11057
11074
|
/**
|
|
11058
11075
|
* Clears all items from the storage for a given client and agent.
|
|
11059
11076
|
* Validates the storage name and agent-storage registration before clearing via the storage service.
|