@hashgraphonline/standards-agent-kit 0.0.8 → 0.0.9
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/index.es.js +52 -2
- package/dist/index.es.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/state/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -32131,7 +32131,56 @@ class $T extends Un {
|
|
|
32131
32131
|
}
|
|
32132
32132
|
}
|
|
32133
32133
|
}
|
|
32134
|
-
|
|
32134
|
+
class NT {
|
|
32135
|
+
constructor() {
|
|
32136
|
+
this.currentAgent = null, this.activeConnections = [], this.connectionMessageTimestamps = {};
|
|
32137
|
+
}
|
|
32138
|
+
// --- Agent Management ---
|
|
32139
|
+
setCurrentAgent(e) {
|
|
32140
|
+
console.log(
|
|
32141
|
+
`[OpenConvaiState] Setting active agent: ${(e == null ? void 0 : e.name) ?? "None"}`
|
|
32142
|
+
), this.currentAgent = e, this.activeConnections = [], this.connectionMessageTimestamps = {};
|
|
32143
|
+
}
|
|
32144
|
+
getCurrentAgent() {
|
|
32145
|
+
return this.currentAgent;
|
|
32146
|
+
}
|
|
32147
|
+
// --- Connection Management ---
|
|
32148
|
+
addActiveConnection(e) {
|
|
32149
|
+
this.activeConnections.some(
|
|
32150
|
+
(t) => t.connectionTopicId === e.connectionTopicId
|
|
32151
|
+
) ? console.log(
|
|
32152
|
+
`[OpenConvaiState] Connection to ${e.targetAgentName} already exists.`
|
|
32153
|
+
) : (console.log(
|
|
32154
|
+
`[OpenConvaiState] Adding active connection to ${e.targetAgentName} (${e.targetAccountId})`
|
|
32155
|
+
), this.activeConnections.push(e), this.connectionMessageTimestamps[e.connectionTopicId] = Date.now() * 1e6);
|
|
32156
|
+
}
|
|
32157
|
+
listConnections() {
|
|
32158
|
+
return [...this.activeConnections];
|
|
32159
|
+
}
|
|
32160
|
+
getConnectionByIdentifier(e) {
|
|
32161
|
+
const t = parseInt(e) - 1;
|
|
32162
|
+
return !isNaN(t) && t >= 0 && t < this.activeConnections.length ? this.activeConnections[t] : this.activeConnections.find(
|
|
32163
|
+
(n) => n.targetAccountId === e || n.connectionTopicId === e
|
|
32164
|
+
);
|
|
32165
|
+
}
|
|
32166
|
+
// --- Message Timestamp Management ---
|
|
32167
|
+
getLastTimestamp(e) {
|
|
32168
|
+
for (const t of this.activeConnections)
|
|
32169
|
+
if (t.connectionTopicId === e)
|
|
32170
|
+
return this.connectionMessageTimestamps[e] || 0;
|
|
32171
|
+
return 0;
|
|
32172
|
+
}
|
|
32173
|
+
updateTimestamp(e, t) {
|
|
32174
|
+
for (const n of this.activeConnections)
|
|
32175
|
+
if (n.connectionTopicId === e) {
|
|
32176
|
+
t > (this.connectionMessageTimestamps[e] || 0) && (console.log(
|
|
32177
|
+
`[OpenConvaiState] Updating timestamp for topic ${e} to ${t}`
|
|
32178
|
+
), this.connectionMessageTimestamps[e] = t);
|
|
32179
|
+
return;
|
|
32180
|
+
}
|
|
32181
|
+
}
|
|
32182
|
+
}
|
|
32183
|
+
async function PT(r) {
|
|
32135
32184
|
const e = process.env.HEDERA_OPERATOR_ID, t = process.env.HEDERA_OPERATOR_KEY, n = process.env.HEDERA_NETWORK || "testnet";
|
|
32136
32185
|
let i;
|
|
32137
32186
|
if (n === "mainnet" ? i = "mainnet" : (n === "testnet" || console.warn(
|
|
@@ -32173,9 +32222,10 @@ export {
|
|
|
32173
32222
|
Tx as HCS10Client,
|
|
32174
32223
|
RT as InitiateConnectionTool,
|
|
32175
32224
|
OT as ListConnectionsTool,
|
|
32225
|
+
NT as OpenConvaiState,
|
|
32176
32226
|
Ek as RegisterAgentTool,
|
|
32177
32227
|
AT as SendMessageToConnectionTool,
|
|
32178
32228
|
kk as SendMessageTool,
|
|
32179
|
-
|
|
32229
|
+
PT as initializeHCS10Client
|
|
32180
32230
|
};
|
|
32181
32231
|
//# sourceMappingURL=index.es.js.map
|