@alfe.ai/openclaw-google-chat 0.0.6 → 0.0.8
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/plugin2.cjs +16 -15
- package/dist/plugin2.js +16 -15
- package/package.json +2 -2
package/dist/plugin2.cjs
CHANGED
|
@@ -51,9 +51,9 @@ var StateManager = class {
|
|
|
51
51
|
}
|
|
52
52
|
if (this.dirty) await this.flush();
|
|
53
53
|
}
|
|
54
|
-
/** Get the last-seen timestamp for a space, or
|
|
54
|
+
/** Get the last-seen timestamp for a space, or undefined if not yet tracked. */
|
|
55
55
|
getLastSeenTimestamp(spaceName) {
|
|
56
|
-
return this.state.spaces[spaceName]?.lastSeenTimestamp
|
|
56
|
+
return this.state.spaces[spaceName]?.lastSeenTimestamp;
|
|
57
57
|
}
|
|
58
58
|
/** Get the agent's userId for a space (if previously resolved). */
|
|
59
59
|
getAgentUserId(spaceName) {
|
|
@@ -66,7 +66,7 @@ var StateManager = class {
|
|
|
66
66
|
/** Update state for a space. */
|
|
67
67
|
updateSpace(spaceName, data) {
|
|
68
68
|
const existing = this.state.spaces[spaceName] ?? {
|
|
69
|
-
lastSeenTimestamp: (/* @__PURE__ */ new Date(
|
|
69
|
+
lastSeenTimestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
70
70
|
agentUserId: "",
|
|
71
71
|
peerUserId: ""
|
|
72
72
|
};
|
|
@@ -280,7 +280,7 @@ var GChatPoller = class {
|
|
|
280
280
|
} catch (err) {
|
|
281
281
|
this.log.warn(`Failed to resolve members for ${spaceName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
282
282
|
}
|
|
283
|
-
const lastSeenTimestamp = this.stateManager.getLastSeenTimestamp(spaceName)
|
|
283
|
+
const lastSeenTimestamp = this.stateManager.getLastSeenTimestamp(spaceName) ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
284
284
|
this.stateManager.updateSpace(spaceName, {
|
|
285
285
|
lastSeenTimestamp,
|
|
286
286
|
agentUserId,
|
|
@@ -303,18 +303,19 @@ var GChatPoller = class {
|
|
|
303
303
|
let agentUserId = "";
|
|
304
304
|
let peerUserId = "";
|
|
305
305
|
let peerDisplayName = null;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
306
|
+
const normalize = (s) => s.toLowerCase().replace(/[.\s_-]/g, "");
|
|
307
|
+
const agentPrefix = this.agentEmail ? normalize(this.agentEmail.split("@")[0]) : "";
|
|
308
|
+
const humans = members.filter((m) => m.member.type === "HUMAN");
|
|
309
|
+
for (const m of humans) if (agentPrefix && normalize(m.member.displayName ?? "").includes(agentPrefix)) agentUserId = m.member.name;
|
|
310
|
+
for (const m of humans) if (m.member.name !== agentUserId) {
|
|
311
|
+
peerUserId = m.member.name;
|
|
312
|
+
peerDisplayName = m.member.displayName || null;
|
|
313
|
+
break;
|
|
313
314
|
}
|
|
314
|
-
if (!agentUserId &&
|
|
315
|
-
agentUserId =
|
|
316
|
-
peerUserId =
|
|
317
|
-
peerDisplayName =
|
|
315
|
+
if (!agentUserId && humans.length >= 2) {
|
|
316
|
+
agentUserId = humans[0].member.name;
|
|
317
|
+
peerUserId = humans[1].member.name;
|
|
318
|
+
peerDisplayName = humans[1].member.displayName || null;
|
|
318
319
|
}
|
|
319
320
|
return {
|
|
320
321
|
agentUserId,
|
package/dist/plugin2.js
CHANGED
|
@@ -51,9 +51,9 @@ var StateManager = class {
|
|
|
51
51
|
}
|
|
52
52
|
if (this.dirty) await this.flush();
|
|
53
53
|
}
|
|
54
|
-
/** Get the last-seen timestamp for a space, or
|
|
54
|
+
/** Get the last-seen timestamp for a space, or undefined if not yet tracked. */
|
|
55
55
|
getLastSeenTimestamp(spaceName) {
|
|
56
|
-
return this.state.spaces[spaceName]?.lastSeenTimestamp
|
|
56
|
+
return this.state.spaces[spaceName]?.lastSeenTimestamp;
|
|
57
57
|
}
|
|
58
58
|
/** Get the agent's userId for a space (if previously resolved). */
|
|
59
59
|
getAgentUserId(spaceName) {
|
|
@@ -66,7 +66,7 @@ var StateManager = class {
|
|
|
66
66
|
/** Update state for a space. */
|
|
67
67
|
updateSpace(spaceName, data) {
|
|
68
68
|
const existing = this.state.spaces[spaceName] ?? {
|
|
69
|
-
lastSeenTimestamp: (/* @__PURE__ */ new Date(
|
|
69
|
+
lastSeenTimestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
70
70
|
agentUserId: "",
|
|
71
71
|
peerUserId: ""
|
|
72
72
|
};
|
|
@@ -280,7 +280,7 @@ var GChatPoller = class {
|
|
|
280
280
|
} catch (err) {
|
|
281
281
|
this.log.warn(`Failed to resolve members for ${spaceName}: ${err instanceof Error ? err.message : String(err)}`);
|
|
282
282
|
}
|
|
283
|
-
const lastSeenTimestamp = this.stateManager.getLastSeenTimestamp(spaceName)
|
|
283
|
+
const lastSeenTimestamp = this.stateManager.getLastSeenTimestamp(spaceName) ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
284
284
|
this.stateManager.updateSpace(spaceName, {
|
|
285
285
|
lastSeenTimestamp,
|
|
286
286
|
agentUserId,
|
|
@@ -303,18 +303,19 @@ var GChatPoller = class {
|
|
|
303
303
|
let agentUserId = "";
|
|
304
304
|
let peerUserId = "";
|
|
305
305
|
let peerDisplayName = null;
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
306
|
+
const normalize = (s) => s.toLowerCase().replace(/[.\s_-]/g, "");
|
|
307
|
+
const agentPrefix = this.agentEmail ? normalize(this.agentEmail.split("@")[0]) : "";
|
|
308
|
+
const humans = members.filter((m) => m.member.type === "HUMAN");
|
|
309
|
+
for (const m of humans) if (agentPrefix && normalize(m.member.displayName ?? "").includes(agentPrefix)) agentUserId = m.member.name;
|
|
310
|
+
for (const m of humans) if (m.member.name !== agentUserId) {
|
|
311
|
+
peerUserId = m.member.name;
|
|
312
|
+
peerDisplayName = m.member.displayName || null;
|
|
313
|
+
break;
|
|
313
314
|
}
|
|
314
|
-
if (!agentUserId &&
|
|
315
|
-
agentUserId =
|
|
316
|
-
peerUserId =
|
|
317
|
-
peerDisplayName =
|
|
315
|
+
if (!agentUserId && humans.length >= 2) {
|
|
316
|
+
agentUserId = humans[0].member.name;
|
|
317
|
+
peerUserId = humans[1].member.name;
|
|
318
|
+
peerDisplayName = humans[1].member.displayName || null;
|
|
318
319
|
}
|
|
319
320
|
return {
|
|
320
321
|
agentUserId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alfe.ai/openclaw-google-chat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "OpenClaw Google Chat plugin — DM polling and auto-reply via connected Google account",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/plugin.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"openclaw.plugin.json"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@alfe.ai/agent-api-client": "^0.0.
|
|
30
|
+
"@alfe.ai/agent-api-client": "^0.0.13",
|
|
31
31
|
"@alfe.ai/config": "^0.0.8"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|