@alfe.ai/openclaw-identity 0.1.25 → 0.1.27

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import plugin from "./plugin.cjs";
1
+ import { t as plugin } from "./plugin.cjs";
2
2
 
3
3
  //#region src/runtime-contract.d.ts
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import plugin from "./plugin.js";
1
+ import { t as plugin } from "./plugin.js";
2
2
 
3
3
  //#region src/runtime-contract.d.ts
4
4
 
package/dist/plugin.d.cts CHANGED
@@ -1,5 +1,45 @@
1
1
  import { TSchema } from "@sinclair/typebox";
2
2
 
3
+ //#region ../openclaw-plugin-kit/dist/index.d.ts
4
+
5
+ //# sourceMappingURL=types.d.ts.map
6
+ //#endregion
7
+ //#region src/tools.d.ts
8
+ /**
9
+ * Tool-definition helpers — the `defineTool` / `ok` / `errResult` trio that
10
+ * was copy-pasted across 8 plugins (identity, google, teams, mobile,
11
+ * whatsapp, voice, chat a2a-tools, base openclaw).
12
+ *
13
+ * Error handling is standardized on the openclaw-google variant — the only
14
+ * copy that survived non-`Error` throws (`e instanceof Error ? e.message :
15
+ * "Unknown error"`). The other copies did `(e as Error).message`, which
16
+ * crashes the tool executor when a handler throws a string/object.
17
+ */
18
+ /** Shape returned to OpenClaw from a tool `execute`. */
19
+ interface ToolResult {
20
+ content: {
21
+ type: "text";
22
+ text: string;
23
+ }[];
24
+ details: unknown;
25
+ }
26
+ /**
27
+ * An OpenClaw tool definition.
28
+ *
29
+ * `parameters` is generic because the fleet is split between TypeBox
30
+ * `TSchema` schemas (identity/google/teams/mobile/whatsapp) and plain
31
+ * JSON-Schema objects (chat a2a-tools). Instantiate with whichever schema
32
+ * type the plugin uses — the kit itself has no schema dependency.
33
+ */
34
+ interface ToolDef<TParameters = unknown> {
35
+ name: string;
36
+ description: string;
37
+ label: string;
38
+ parameters: TParameters;
39
+ execute: (toolCallId: string, params: Record<string, unknown>) => Promise<ToolResult>;
40
+ }
41
+ /** Wrap a successful handler result in the OpenClaw tool-result envelope. */
42
+ //#endregion
3
43
  //#region src/plugin.d.ts
4
44
 
5
45
  interface PluginLogger {
@@ -8,23 +48,10 @@ interface PluginLogger {
8
48
  error: (...args: unknown[]) => void;
9
49
  debug: (...args: unknown[]) => void;
10
50
  }
11
- interface ToolDef {
12
- name: string;
13
- description: string;
14
- label: string;
15
- parameters: TSchema;
16
- execute: (toolCallId: string, params: Record<string, unknown>) => Promise<{
17
- content: {
18
- type: "text";
19
- text: string;
20
- }[];
21
- details: unknown;
22
- }>;
23
- }
24
51
  interface PluginApi {
25
52
  logger: PluginLogger;
26
53
  registrationMode?: "full" | "setup-only" | "setup-runtime" | "cli-metadata";
27
- registerTool: (tool: ToolDef) => void;
54
+ registerTool: (tool: ToolDef<TSchema>) => void;
28
55
  on: (event: string, handler: (...args: unknown[]) => Promise<unknown>, options?: {
29
56
  priority?: number;
30
57
  }) => void;
@@ -38,4 +65,4 @@ declare const plugin: {
38
65
  deactivate(api: PluginApi): void;
39
66
  };
40
67
  //#endregion
41
- export { plugin as default };
68
+ export { plugin as t };
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,45 @@
1
1
  import { TSchema } from "@sinclair/typebox";
2
2
 
3
+ //#region ../openclaw-plugin-kit/dist/index.d.ts
4
+
5
+ //# sourceMappingURL=types.d.ts.map
6
+ //#endregion
7
+ //#region src/tools.d.ts
8
+ /**
9
+ * Tool-definition helpers — the `defineTool` / `ok` / `errResult` trio that
10
+ * was copy-pasted across 8 plugins (identity, google, teams, mobile,
11
+ * whatsapp, voice, chat a2a-tools, base openclaw).
12
+ *
13
+ * Error handling is standardized on the openclaw-google variant — the only
14
+ * copy that survived non-`Error` throws (`e instanceof Error ? e.message :
15
+ * "Unknown error"`). The other copies did `(e as Error).message`, which
16
+ * crashes the tool executor when a handler throws a string/object.
17
+ */
18
+ /** Shape returned to OpenClaw from a tool `execute`. */
19
+ interface ToolResult {
20
+ content: {
21
+ type: "text";
22
+ text: string;
23
+ }[];
24
+ details: unknown;
25
+ }
26
+ /**
27
+ * An OpenClaw tool definition.
28
+ *
29
+ * `parameters` is generic because the fleet is split between TypeBox
30
+ * `TSchema` schemas (identity/google/teams/mobile/whatsapp) and plain
31
+ * JSON-Schema objects (chat a2a-tools). Instantiate with whichever schema
32
+ * type the plugin uses — the kit itself has no schema dependency.
33
+ */
34
+ interface ToolDef<TParameters = unknown> {
35
+ name: string;
36
+ description: string;
37
+ label: string;
38
+ parameters: TParameters;
39
+ execute: (toolCallId: string, params: Record<string, unknown>) => Promise<ToolResult>;
40
+ }
41
+ /** Wrap a successful handler result in the OpenClaw tool-result envelope. */
42
+ //#endregion
3
43
  //#region src/plugin.d.ts
4
44
 
5
45
  interface PluginLogger {
@@ -8,23 +48,10 @@ interface PluginLogger {
8
48
  error: (...args: unknown[]) => void;
9
49
  debug: (...args: unknown[]) => void;
10
50
  }
11
- interface ToolDef {
12
- name: string;
13
- description: string;
14
- label: string;
15
- parameters: TSchema;
16
- execute: (toolCallId: string, params: Record<string, unknown>) => Promise<{
17
- content: {
18
- type: "text";
19
- text: string;
20
- }[];
21
- details: unknown;
22
- }>;
23
- }
24
51
  interface PluginApi {
25
52
  logger: PluginLogger;
26
53
  registrationMode?: "full" | "setup-only" | "setup-runtime" | "cli-metadata";
27
- registerTool: (tool: ToolDef) => void;
54
+ registerTool: (tool: ToolDef<TSchema>) => void;
28
55
  on: (event: string, handler: (...args: unknown[]) => Promise<unknown>, options?: {
29
56
  priority?: number;
30
57
  }) => void;
@@ -38,4 +65,4 @@ declare const plugin: {
38
65
  deactivate(api: PluginApi): void;
39
66
  };
40
67
  //#endregion
41
- export { plugin as default };
68
+ export { plugin as t };
package/dist/plugin2.cjs CHANGED
@@ -1,5 +1,6 @@
1
1
  let _alfe_ai_config = require("@alfe.ai/config");
2
2
  let _alfe_ai_agent_api_client = require("@alfe.ai/agent-api-client");
3
+ let _alfe_ai_openclaw_plugin_kit = require("@alfe.ai/openclaw-plugin-kit");
3
4
  let _sinclair_typebox = require("@sinclair/typebox");
4
5
  let node_module = require("node:module");
5
6
  let _auriclabs_roles = require("@auriclabs/roles");
@@ -217,39 +218,6 @@ function resolveClaimedIdentity(params) {
217
218
  if (!session.ok) return { error: session.error };
218
219
  return { claimedIdentityId: session.identityId };
219
220
  }
220
- function ok(data) {
221
- return {
222
- content: [{
223
- type: "text",
224
- text: JSON.stringify(data)
225
- }],
226
- details: data
227
- };
228
- }
229
- function errResult(message) {
230
- return {
231
- content: [{
232
- type: "text",
233
- text: JSON.stringify({ error: message })
234
- }],
235
- details: { error: message }
236
- };
237
- }
238
- function defineTool(def) {
239
- return {
240
- name: def.name,
241
- description: def.description,
242
- label: def.name,
243
- parameters: def.parameters,
244
- execute: async (_toolCallId, params) => {
245
- try {
246
- return ok(await def.handler(params));
247
- } catch (e) {
248
- return errResult(e.message);
249
- }
250
- }
251
- };
252
- }
253
221
  let cachedClient = null;
254
222
  function getClient() {
255
223
  if (cachedClient) return cachedClient;
@@ -295,7 +263,7 @@ const plugin = {
295
263
  return typeof v === "function" ? v.bind(c) : v;
296
264
  } });
297
265
  const tools = [
298
- defineTool({
266
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
299
267
  name: "who_is_this",
300
268
  description: "Look up an identity by provider + platformId — returns full identity context (profile, contacts, platforms, notes, tags, recent changelog). Returns `{found:false}` for unknown senders. This tool DOES NOT create new identities.",
301
269
  parameters: _sinclair_typebox.Type.Object({
@@ -311,7 +279,7 @@ const plugin = {
311
279
  return client.getIdentityContext(result.identityId);
312
280
  }
313
281
  }),
314
- defineTool({
282
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
315
283
  name: "lookup_identity",
316
284
  description: "Search identities by name. Returns multiple matches.",
317
285
  parameters: _sinclair_typebox.Type.Object({
@@ -323,7 +291,7 @@ const plugin = {
323
291
  status: params.status
324
292
  })
325
293
  }),
326
- defineTool({
294
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
327
295
  name: "merge_identities",
328
296
  description: "Merge two identity records — transfers contacts, platforms, notes, tags, aliases to the survivor. Hard-move, transactional.",
329
297
  parameters: _sinclair_typebox.Type.Object({
@@ -338,7 +306,7 @@ const plugin = {
338
306
  }
339
307
  })
340
308
  }),
341
- defineTool({
309
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
342
310
  name: "unmerge_identities",
343
311
  description: "Reverse a merge — restore previously merged identity.",
344
312
  parameters: _sinclair_typebox.Type.Object({ mergedId: _sinclair_typebox.Type.String({ description: "Identity that was merged (has mergedInto pointer)" }) }),
@@ -347,7 +315,7 @@ const plugin = {
347
315
  id: "plugin"
348
316
  } })
349
317
  }),
350
- defineTool({
318
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
351
319
  name: "add_identity_note",
352
320
  description: "Add an observation or note about an identity. Use category 'context' for unverified affiliation claims (self-reported title/company) — those do NOT belong on the identity row directly.",
353
321
  parameters: _sinclair_typebox.Type.Object({
@@ -364,7 +332,7 @@ const plugin = {
364
332
  }
365
333
  })
366
334
  }),
367
- defineTool({
335
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
368
336
  name: "tag_identity",
369
337
  description: "Add or remove a tag on an identity.",
370
338
  parameters: _sinclair_typebox.Type.Object({
@@ -381,7 +349,7 @@ const plugin = {
381
349
  }
382
350
  })
383
351
  }),
384
- defineTool({
352
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
385
353
  name: "get_identity_changelog",
386
354
  description: "Get the changelog for an identity — versions, diffs, who changed what.",
387
355
  parameters: _sinclair_typebox.Type.Object({
@@ -390,7 +358,7 @@ const plugin = {
390
358
  }),
391
359
  handler: (params) => client.getIdentityChangelog(params.identityId, { limit: params.limit })
392
360
  }),
393
- defineTool({
361
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
394
362
  name: "rollback_identity",
395
363
  description: "Revert an identity to a previous version.",
396
364
  parameters: _sinclair_typebox.Type.Object({
@@ -405,7 +373,7 @@ const plugin = {
405
373
  }
406
374
  })
407
375
  }),
408
- defineTool({
376
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
409
377
  name: "update_identity",
410
378
  description: "Update display-shape fields on a CONTACT/person you know (an identity): name / avatarUrl / timezone / locale. NOT for your own agent profile — to set YOUR OWN profile picture use `set_avatar` or `generate_avatar`, never this tool with identityId:'agent'. Contact mutations go through the verify flow — this tool will NOT accept email or mobile. Title and company live on org membership rows, not here.",
411
379
  parameters: _sinclair_typebox.Type.Object({
@@ -421,7 +389,7 @@ const plugin = {
421
389
  return client.updateIdentity(identityId, rest);
422
390
  }
423
391
  }),
424
- defineTool({
392
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
425
393
  name: "request_identity_verification",
426
394
  description: "Send a verification phrase to the inbound user's email or mobile to prove they own that contact endpoint. Use when the inbound user has just told you their email or mobile number and you want them to confirm it. The verification ALWAYS binds to the inbound sender's identity (the WhatsApp / SMS / Discord / Google Chat / chat-web user who just spoke) — identity is server-authoritative, auto-derived from the current inbound session. There is no way to verify a different identity via this tool. If the contact you supply already lives on another existing identity (e.g. the user's Clerk web account), the merge happens automatically on confirm. To add a new contact to an already-verified canonical identity (e.g. add a new email to a Clerk account), the user must be talking from a session that already resolves to that canonical identity (post-merge, or chat-web logged in as Clerk).",
427
395
  parameters: _sinclair_typebox.Type.Object({
@@ -453,7 +421,7 @@ const plugin = {
453
421
  });
454
422
  }
455
423
  }),
456
- defineTool({
424
+ (0, _alfe_ai_openclaw_plugin_kit.defineTool)({
457
425
  name: "confirm_identity_verification",
458
426
  description: "Confirm a verification by submitting the phrase the inbound user received. Returns `{ verified, identityId, action }` where `action` is 'merged' (the verified contact already lived on another identity, which is now the survivor — the inbound identity merged into it) or 'contact_verified' (the contact was attached to the inbound identity). Identity is server-authoritative, auto-derived from the current inbound session — no override available.",
459
427
  parameters: _sinclair_typebox.Type.Object({
@@ -0,0 +1,2 @@
1
+ import { t as plugin } from "./plugin.cjs";
2
+ export { plugin as default };
@@ -0,0 +1,2 @@
1
+ import { t as plugin } from "./plugin.js";
2
+ export { plugin as default };
package/dist/plugin2.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { resolveConfig } from "@alfe.ai/config";
3
3
  import { AgentApiClient, installToolErrorCapture } from "@alfe.ai/agent-api-client";
4
+ import { defineTool } from "@alfe.ai/openclaw-plugin-kit";
4
5
  import { Type } from "@sinclair/typebox";
5
6
  import { createAbility } from "@auriclabs/roles";
6
7
  //#region src/agent-exec-gate.ts
@@ -217,39 +218,6 @@ function resolveClaimedIdentity(params) {
217
218
  if (!session.ok) return { error: session.error };
218
219
  return { claimedIdentityId: session.identityId };
219
220
  }
220
- function ok(data) {
221
- return {
222
- content: [{
223
- type: "text",
224
- text: JSON.stringify(data)
225
- }],
226
- details: data
227
- };
228
- }
229
- function errResult(message) {
230
- return {
231
- content: [{
232
- type: "text",
233
- text: JSON.stringify({ error: message })
234
- }],
235
- details: { error: message }
236
- };
237
- }
238
- function defineTool(def) {
239
- return {
240
- name: def.name,
241
- description: def.description,
242
- label: def.name,
243
- parameters: def.parameters,
244
- execute: async (_toolCallId, params) => {
245
- try {
246
- return ok(await def.handler(params));
247
- } catch (e) {
248
- return errResult(e.message);
249
- }
250
- }
251
- };
252
- }
253
221
  let cachedClient = null;
254
222
  function getClient() {
255
223
  if (cachedClient) return cachedClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw-identity",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "OpenClaw identity plugin — identity resolution, access gating, permission enforcement",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin.js",
@@ -29,8 +29,9 @@
29
29
  "dependencies": {
30
30
  "@auriclabs/roles": "0.1.1",
31
31
  "@sinclair/typebox": "^0.34.48",
32
- "@alfe.ai/agent-api-client": "0.12.0",
33
- "@alfe.ai/config": "0.3.0"
32
+ "@alfe.ai/agent-api-client": "0.14.0",
33
+ "@alfe.ai/config": "0.4.0",
34
+ "@alfe.ai/openclaw-plugin-kit": "0.1.0"
34
35
  },
35
36
  "license": "UNLICENSED",
36
37
  "homepage": "https://alfe.ai",