@kanvas/openclaw-plugin 0.1.5 → 0.1.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.
|
@@ -154,7 +154,7 @@ export class CrmService {
|
|
|
154
154
|
`;
|
|
155
155
|
return this.client.query(query, {
|
|
156
156
|
first: 1,
|
|
157
|
-
where:
|
|
157
|
+
where: { column: "ID", operator: "EQ", value: id },
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
async createLead(input) {
|
|
@@ -457,7 +457,7 @@ export class CrmService {
|
|
|
457
457
|
}
|
|
458
458
|
`, {
|
|
459
459
|
first: 1,
|
|
460
|
-
where:
|
|
460
|
+
where: { column: "ID", operator: "EQ", value: leadId },
|
|
461
461
|
});
|
|
462
462
|
return response.data?.leads?.data?.[0]?.channels?.[0]?.slug ?? null;
|
|
463
463
|
}
|
|
@@ -811,6 +811,38 @@ export class CrmService {
|
|
|
811
811
|
`;
|
|
812
812
|
return this.client.query(query, { first });
|
|
813
813
|
}
|
|
814
|
+
async createPeopleRelationship(input) {
|
|
815
|
+
const mutation = `
|
|
816
|
+
mutation CreatePeopleRelationship($input: PeopleRelationshipInput!) {
|
|
817
|
+
createPeopleRelationship(input: $input) {
|
|
818
|
+
id
|
|
819
|
+
name
|
|
820
|
+
description
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
`;
|
|
824
|
+
return this.client.query(mutation, { input });
|
|
825
|
+
}
|
|
826
|
+
async updatePeopleRelationship(id, input) {
|
|
827
|
+
const mutation = `
|
|
828
|
+
mutation UpdatePeopleRelationship($id: ID!, $input: UpdatePeopleRelationshipInput!) {
|
|
829
|
+
updatePeopleRelationship(id: $id, input: $input) {
|
|
830
|
+
id
|
|
831
|
+
name
|
|
832
|
+
description
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
`;
|
|
836
|
+
return this.client.query(mutation, { id, input });
|
|
837
|
+
}
|
|
838
|
+
async deletePeopleRelationship(id) {
|
|
839
|
+
const mutation = `
|
|
840
|
+
mutation DeletePeopleRelationship($id: ID!) {
|
|
841
|
+
deletePeopleRelationship(id: $id)
|
|
842
|
+
}
|
|
843
|
+
`;
|
|
844
|
+
return this.client.query(mutation, { id });
|
|
845
|
+
}
|
|
814
846
|
async listContactTypes(first = 50) {
|
|
815
847
|
const query = `
|
|
816
848
|
query ContactTypes($first: Int) {
|
package/dist/index.js
CHANGED
|
@@ -103,7 +103,7 @@ export default {
|
|
|
103
103
|
await runSetup();
|
|
104
104
|
});
|
|
105
105
|
}, { commands: ["setup"] });
|
|
106
|
-
api.logger.info("Kanvas plugin registered —
|
|
106
|
+
api.logger.info("Kanvas plugin registered — 53 tools loaded");
|
|
107
107
|
},
|
|
108
108
|
};
|
|
109
109
|
const KANVAS_SYSTEM_CONTEXT = `
|
|
@@ -191,7 +191,7 @@ ALWAYS schedule follow-ups in Kanvas so the human team can see them — NEVER st
|
|
|
191
191
|
- Leads live in pipelines with stages. Always check \`kanvas_list_pipelines\` to get valid stage IDs before creating leads.
|
|
192
192
|
- Messages use \`message_verb\` to define their type (e.g. "comment", "note", "sms"). New verbs are auto-created.
|
|
193
193
|
- The \`message\` field in social messages accepts arbitrary JSON — use it to store any structured data.
|
|
194
|
-
- Filtering uses \`where:
|
|
194
|
+
- Filtering uses \`where: { column, operator, value }\` format. Common operators: "EQ", "LIKE", "IN".
|
|
195
195
|
- **Follow-ups and reminders MUST go in Kanvas** (events or messages), not local memory. The human team needs to see them in the dashboard.
|
|
196
196
|
- When updating a lead, you don't need to provide branch_id or people_id — they are auto-fetched.
|
|
197
197
|
- To add contacts to a person, call \`kanvas_list_contact_types\` first, then pass the contacts array to \`kanvas_update_people\`.
|
package/dist/tools/crm.js
CHANGED
|
@@ -447,6 +447,46 @@ export function registerCrmTools(api, service, ensureAuth) {
|
|
|
447
447
|
return toolResult(await service.listPeopleRelationships(params.first));
|
|
448
448
|
},
|
|
449
449
|
});
|
|
450
|
+
api.registerTool({
|
|
451
|
+
name: "kanvas_create_people_relationship",
|
|
452
|
+
label: "Create People Relationship",
|
|
453
|
+
description: "Create a new relationship type (e.g. Architect, Client, Consultant) for use when adding participants to leads.",
|
|
454
|
+
parameters: Type.Object({
|
|
455
|
+
name: Type.String({ description: 'Relationship name (e.g. "Architect", "Consultant", "Decision Maker")' }),
|
|
456
|
+
description: Type.Optional(Type.String({ description: "Description of this relationship type" })),
|
|
457
|
+
}),
|
|
458
|
+
async execute(_id, params) {
|
|
459
|
+
await ensureAuth();
|
|
460
|
+
return toolResult(await service.createPeopleRelationship(params));
|
|
461
|
+
},
|
|
462
|
+
});
|
|
463
|
+
api.registerTool({
|
|
464
|
+
name: "kanvas_update_people_relationship",
|
|
465
|
+
label: "Update People Relationship",
|
|
466
|
+
description: "Update a relationship type's name or description.",
|
|
467
|
+
parameters: Type.Object({
|
|
468
|
+
id: Type.String({ description: "Relationship ID" }),
|
|
469
|
+
name: Type.Optional(Type.String()),
|
|
470
|
+
description: Type.Optional(Type.String()),
|
|
471
|
+
}),
|
|
472
|
+
async execute(_id, params) {
|
|
473
|
+
await ensureAuth();
|
|
474
|
+
const { id, ...input } = params;
|
|
475
|
+
return toolResult(await service.updatePeopleRelationship(id, input));
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
api.registerTool({
|
|
479
|
+
name: "kanvas_delete_people_relationship",
|
|
480
|
+
label: "Delete People Relationship",
|
|
481
|
+
description: "Delete a relationship type.",
|
|
482
|
+
parameters: Type.Object({
|
|
483
|
+
id: Type.String({ description: "Relationship ID" }),
|
|
484
|
+
}),
|
|
485
|
+
async execute(_id, params) {
|
|
486
|
+
await ensureAuth();
|
|
487
|
+
return toolResult(await service.deletePeopleRelationship(params.id));
|
|
488
|
+
},
|
|
489
|
+
});
|
|
450
490
|
api.registerTool({
|
|
451
491
|
name: "kanvas_list_contact_types",
|
|
452
492
|
label: "List Contact Types",
|
package/package.json
CHANGED