@firstperson/firstperson 2026.1.36 → 2026.1.38

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.
Files changed (2) hide show
  1. package/index.ts +93 -0
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -12,6 +12,99 @@ const plugin = {
12
12
  register(api: OpenClawPluginApi) {
13
13
  setFirstPersonRuntime(api.runtime);
14
14
  api.registerChannel({ plugin: firstPersonPlugin });
15
+
16
+ // Profile management tools for bot agency
17
+ api.registerTool((ctx) => {
18
+ const channelConfig = ctx.config?.channels?.firstperson as { token?: string; relayUrl?: string } | undefined;
19
+ const relayToken = channelConfig?.token;
20
+ const relayUrl = channelConfig?.relayUrl ?? "https://chat.firstperson.ai";
21
+
22
+ if (!relayToken) {
23
+ return null; // Tool not available without token
24
+ }
25
+
26
+ return {
27
+ name: "firstperson_update_profile",
28
+ description: "Update your profile on the First Person app. Use this to set or change your display name, bio, or avatar that users see in the iOS app.",
29
+ inputSchema: {
30
+ type: "object" as const,
31
+ properties: {
32
+ name: {
33
+ type: "string",
34
+ description: "Your display name (1-50 characters, required)"
35
+ },
36
+ bio: {
37
+ type: "string",
38
+ description: "A short bio or description (up to 160 characters, optional)"
39
+ },
40
+ avatar_url: {
41
+ type: "string",
42
+ description: "HTTPS URL to your avatar image (optional)"
43
+ },
44
+ },
45
+ required: ["name"],
46
+ },
47
+ async handler(input: { name: string; bio?: string; avatar_url?: string }) {
48
+ const { name, bio = "", avatar_url = "" } = input;
49
+
50
+ const res = await fetch(`${relayUrl}/api/v1/profile`, {
51
+ method: "PUT",
52
+ headers: {
53
+ Authorization: `Bearer ${relayToken}`,
54
+ "Content-Type": "application/json",
55
+ },
56
+ body: JSON.stringify({ name, bio, avatar_url }),
57
+ });
58
+
59
+ if (!res.ok) {
60
+ const errorText = await res.text().catch(() => "Unknown error");
61
+ return { success: false, error: `Failed to update profile: ${res.status} - ${errorText}` };
62
+ }
63
+
64
+ const data = await res.json();
65
+ return { success: true, profile: data.profile };
66
+ },
67
+ };
68
+ }, { name: "firstperson_update_profile" });
69
+
70
+ api.registerTool((ctx) => {
71
+ const channelConfig = ctx.config?.channels?.firstperson as { token?: string; relayUrl?: string } | undefined;
72
+ const relayToken = channelConfig?.token;
73
+ const relayUrl = channelConfig?.relayUrl ?? "https://chat.firstperson.ai";
74
+
75
+ if (!relayToken) {
76
+ return null; // Tool not available without token
77
+ }
78
+
79
+ return {
80
+ name: "firstperson_get_profile",
81
+ description: "Get your current profile from the First Person app. Use this to check what name, bio, and avatar users currently see.",
82
+ inputSchema: {
83
+ type: "object" as const,
84
+ properties: {},
85
+ },
86
+ async handler() {
87
+ const res = await fetch(`${relayUrl}/api/v1/profile`, {
88
+ method: "GET",
89
+ headers: {
90
+ Authorization: `Bearer ${relayToken}`,
91
+ "Content-Type": "application/json",
92
+ },
93
+ });
94
+
95
+ if (!res.ok) {
96
+ if (res.status === 404) {
97
+ return { success: true, profile: null, message: "No profile set yet" };
98
+ }
99
+ const errorText = await res.text().catch(() => "Unknown error");
100
+ return { success: false, error: `Failed to get profile: ${res.status} - ${errorText}` };
101
+ }
102
+
103
+ const data = await res.json();
104
+ return { success: true, profile: data.profile };
105
+ },
106
+ };
107
+ }, { name: "firstperson_get_profile" });
15
108
  },
16
109
  };
17
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstperson/firstperson",
3
- "version": "2026.1.36",
3
+ "version": "2026.1.38",
4
4
  "type": "module",
5
5
  "description": "OpenClaw channel plugin for the First Person iOS app",
6
6
  "main": "index.ts",