@zibby/skills 0.1.73 → 0.1.75
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.ts +3 -1
- package/dist/index.js +179 -158
- package/dist/linkedin.d.ts +36 -0
- package/dist/linkedin.js +5 -2
- package/dist/package.json +9 -4
- package/dist/report.d.ts +10 -10
- package/dist/socialCard.d.ts +89 -0
- package/dist/socialCard.js +19 -0
- package/docs/packages/agent-workflow.md +1 -1
- package/package.json +9 -4
package/dist/linkedin.d.ts
CHANGED
|
@@ -74,6 +74,24 @@ export function linkedinApi(path: any, opts?: {}, provider?: string): Promise<{
|
|
|
74
74
|
headers: Headers;
|
|
75
75
|
body: {};
|
|
76
76
|
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Upload a LOCAL image file to LinkedIn's Images API and return its
|
|
79
|
+
* `urn:li:image:...` URN, ready to attach to a post via
|
|
80
|
+
* requestBody.content.media = { id: <urn>, altText }.
|
|
81
|
+
*
|
|
82
|
+
* Uses the SAME provider/token/gate as the post (resolveProviderToken):
|
|
83
|
+
* 1. initializeUpload — POST /rest/images?action=initializeUpload with
|
|
84
|
+
* { initializeUploadRequest: { owner: <author urn> } } (through linkedinApi,
|
|
85
|
+
* so it carries the versioned-API headers + the personal-tier gate). Reads
|
|
86
|
+
* value.uploadUrl + value.image from the response.
|
|
87
|
+
* 2. single-request upload — PUT the raw file bytes to uploadUrl with
|
|
88
|
+
* Authorization: Bearer <same provider token> + the image Content-Type.
|
|
89
|
+
* 3. return value.image (the image URN).
|
|
90
|
+
*
|
|
91
|
+
* Throws on any non-2xx / missing field — handleToolCall catches it and returns
|
|
92
|
+
* { ok:false, error } so a bad image can't crash the run or cause a post.
|
|
93
|
+
*/
|
|
94
|
+
export function uploadImage(provider: any, ownerUrn: any, imagePath: any, mimeType: any): Promise<any>;
|
|
77
95
|
export const PERSONAL_REFUSAL: "You haven't connected your own LinkedIn account \u2014 connect it at https://studio.zibby.dev/integrations (LinkedIn). For privacy, I can't post or act as anyone else's LinkedIn (including the project owner's) on your behalf.";
|
|
78
96
|
export namespace linkedinSkill {
|
|
79
97
|
let id: string;
|
|
@@ -108,6 +126,8 @@ export namespace linkedinSkill {
|
|
|
108
126
|
organizationUrn?: undefined;
|
|
109
127
|
text?: undefined;
|
|
110
128
|
visibility?: undefined;
|
|
129
|
+
imagePath?: undefined;
|
|
130
|
+
imageAltText?: undefined;
|
|
111
131
|
dry_run?: undefined;
|
|
112
132
|
};
|
|
113
133
|
required?: undefined;
|
|
@@ -135,6 +155,14 @@ export namespace linkedinSkill {
|
|
|
135
155
|
enum: string[];
|
|
136
156
|
description: string;
|
|
137
157
|
};
|
|
158
|
+
imagePath: {
|
|
159
|
+
type: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
imageAltText: {
|
|
163
|
+
type: string;
|
|
164
|
+
description: string;
|
|
165
|
+
};
|
|
138
166
|
dry_run: {
|
|
139
167
|
type: string;
|
|
140
168
|
description: string;
|
|
@@ -157,6 +185,14 @@ export namespace linkedinSkill {
|
|
|
157
185
|
enum: string[];
|
|
158
186
|
description: string;
|
|
159
187
|
};
|
|
188
|
+
imagePath: {
|
|
189
|
+
type: string;
|
|
190
|
+
description: string;
|
|
191
|
+
};
|
|
192
|
+
imageAltText: {
|
|
193
|
+
type: string;
|
|
194
|
+
description: string;
|
|
195
|
+
};
|
|
160
196
|
dry_run: {
|
|
161
197
|
type: string;
|
|
162
198
|
description: string;
|
package/dist/linkedin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as L,readFileSync as w}from"fs";import{fileURLToPath as A}from"url";import{dirname as T,resolve as P}from"path";import{resolveIntegrationToken as y,clearTokenCache as N}from"@zibby/core/backend-client.js";function S(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let t=T(A(import.meta.url)),e=P(t,"..","bin","mcp-skill.mjs");return L(e)?e:null}function E(){let t=String(process.env.ZIBBY_INJECTED_LINKEDIN_TOKEN||"").trim();if(!t)return null;let e=String(process.env.ZIBBY_INJECTED_LINKEDIN_MEMBER_ID||"").trim();return{token:t,memberId:e}}function v(){return String(process.env.ZIBBY_CHAT_STRICT_PERSONAL||"").trim()==="1"}function O(){return String(process.env.ZIBBY_SENDER_IS_NON_OWNER||"").trim()==="1"}var R="You haven't connected your own LinkedIn account \u2014 connect it at https://studio.zibby.dev/integrations (LinkedIn). For privacy, I can't post or act as anyone else's LinkedIn (including the project owner's) on your behalf.";function f(){let t=E();if(t)return t;if(v()||O())throw new Error(R);return null}var x="202506",D="https://api.linkedin.com";function b(t){if(t==null)return null;let e=String(t).trim();if(!e)return null;let n=e.match(/urn:li:organization:(\d+)/i);return n?n[1]:/^\d+$/.test(e)?e:null}function _(t){if(!t)return"";if(t.localizedName)return String(t.localizedName);let e=t.name&&t.name.localized;if(e&&typeof e=="object"){let n=Object.values(e)[0];if(n)return String(n)}return""}function h(t,e){return t?typeof t.get=="function"?t.get(e):t[e]||t[e.toLowerCase()]||null:null}async function p(t,e={},n="linkedin_business"){let l=async()=>{let i;if(n==="linkedin_personal"){let s=f();s&&(i=s.token)}if(i||({token:i}=await y(n)),typeof i!="string"||!i)throw new Error("LinkedIn is not connected: no access token available. Connect LinkedIn in Integrations.");let a=t.startsWith("https://")?t:`${D}${t}`,o=await fetch(a,{method:e.method||"GET",headers:{Authorization:`Bearer ${i}`,"LinkedIn-Version":x,"X-Restli-Protocol-Version":"2.0.0",Accept:"application/json",...e.body?{"Content-Type":"application/json"}:{},...e.headers},body:e.body?JSON.stringify(e.body):void 0});if(!o.ok){let s=await o.text().catch(()=>"");throw new Error(`LinkedIn API ${o.status}: ${s.slice(0,300)}`)}let r=await o.text().catch(()=>""),u={};if(r&&r.trim())try{u=JSON.parse(r)}catch{u={raw:r}}return{status:o.status,headers:o.headers,body:u}};try{return await l()}catch(i){let a=String(i?.message||i||"").toLowerCase();if(!(a.includes("token")||a.includes("401")||a.includes("unauthorized")))throw i;return N(n),l()}}async function U(t){let e;if(t==="linkedin_personal"){let n=f();n&&(e=n.token)}if(e||({token:e}=await y(t)),typeof e!="string"||!e)throw new Error("LinkedIn is not connected: no access token available. Connect LinkedIn in Integrations.");return e}function B(t){switch(String(t||"").toLowerCase().match(/\.([a-z0-9]+)$/)?.[1]){case"jpg":case"jpeg":return"image/jpeg";case"gif":return"image/gif";case"webp":return"image/webp";default:return"image/png"}}async function k(t,e,n,l){if(typeof n!="string"||!n.trim())throw new Error("imagePath (a local image file path) is required to upload an image");let{body:i}=await p("/rest/images?action=initializeUpload",{method:"POST",body:{initializeUploadRequest:{owner:e}}},t),a=i?.value?.uploadUrl,o=i?.value?.image;if(!a||!o)throw new Error(`LinkedIn image initializeUpload returned no uploadUrl/image (got: ${JSON.stringify(i).slice(0,200)})`);let r=w(n),u=await U(t),s=await fetch(a,{method:"PUT",headers:{Authorization:`Bearer ${u}`,"Content-Type":l||B(n)},body:r});if(!s.ok){let c=await s.text().catch(()=>"");throw new Error(`LinkedIn image upload ${s.status}: ${c.slice(0,300)}`)}return o}var j={id:"linkedin",serverName:"linkedin",allowedTools:["mcp__linkedin__*"],envKeys:[],description:"LinkedIn \u2014 (business) list admin Organizations + create DRAFT posts on a company Page, and (personal) PUBLISH a post to your own member profile feed",promptFragment:`## LinkedIn (connected)
|
|
2
2
|
You can post to LinkedIn two ways \u2014 an ORG company Page (business) and your own member PROFILE (personal). Each path needs its own LinkedIn integration connected.
|
|
3
3
|
|
|
4
4
|
Business (company Page) \u2014 DRAFT only:
|
|
@@ -8,7 +8,10 @@ Business (company Page) \u2014 DRAFT only:
|
|
|
8
8
|
Personal (your own profile) \u2014 PUBLISHES IMMEDIATELY:
|
|
9
9
|
- linkedin_publish_post: PUBLISH a post to your OWN member profile feed. Pass text (the post body) + optional visibility ('PUBLIC' default, or 'CONNECTIONS'). UNLIKE the org draft tool, this PUBLISHES the post immediately \u2014 LinkedIn has no DRAFT state for member profiles, so there is no human review step. Returns { postUrn }. Set dry_run:true to VALIDATE which member profile the post would publish to (and preview the text) WITHOUT publishing \u2014 nothing is posted; returns { dryRun, target, wouldPostAs, textPreview }. Use this to confirm the identity before an approved publish. (needs LinkedIn Personal connected)
|
|
10
10
|
|
|
11
|
+
Attaching an image (optional, both tools):
|
|
12
|
+
- Both linkedin_create_draft_post and linkedin_publish_post accept imagePath (a LOCAL image file path, e.g. a PNG returned by social_card_render) + optional imageAltText. When imagePath is set, the image is uploaded to LinkedIn's Images API (same connected account/token as the post) and attached to the post as its media. On a dry_run nothing is uploaded \u2014 the result just reports imageWouldAttach:true.
|
|
13
|
+
|
|
11
14
|
Notes:
|
|
12
15
|
- Org-page posts are ALWAYS created as a DRAFT; personal-profile posts are ALWAYS published live \u2014 choose the tool accordingly.
|
|
13
16
|
- PUBLISHING IS OUTWARD-FACING AND IRREVERSIBLE. linkedin_publish_post posts live to a real audience the instant you call it \u2014 there is no undo and no draft state for member profiles. Only call it after the human has EXPLICITLY approved publishing THIS specific text in THIS conversation. If you wrote or edited the text, show it and get an explicit "yes, publish" first; if you are unsure, HOLD/draft rather than publish. The org draft tool (linkedin_create_draft_post) is the safe default when a human still needs to review.
|
|
14
|
-
- If the relevant LinkedIn integration is not connected these tools return { ok:false, error }; treat that as "LinkedIn unavailable" and continue.`,resolve(){let t=
|
|
17
|
+
- If the relevant LinkedIn integration is not connected these tools return { ok:false, error }; treat that as "LinkedIn unavailable" and continue.`,resolve(){let t=S();if(!t)return{command:null,args:[],env:{},description:this.description};let e={};for(let n of["ZIBBY_INJECTED_LINKEDIN_TOKEN","ZIBBY_INJECTED_LINKEDIN_MEMBER_ID","ZIBBY_SENDER_IS_NON_OWNER","ZIBBY_CHAT_STRICT_PERSONAL"])process.env[n]&&(e[n]=process.env[n]);return{type:"stdio",command:"node",args:[t,"../dist/linkedin.js","linkedinSkill"],env:e,description:this.description,alwaysLoad:!0}},async handleToolCall(t,e){try{switch(t){case"linkedin_list_organizations":{let{body:n}=await p("/rest/organizationAcls?q=roleAssignee&role=ADMINISTRATOR&state=APPROVED",{},"linkedin_business"),l=Array.isArray(n.elements)?n.elements:[],i=[];for(let a of l){let o=a.organizationalTarget||a["organizationalTarget~"]||a.organization,r=b(o);if(!r)continue;let u="",s="";try{let c=(await p(`/rest/organizations/${r}`,{},"linkedin_business")).body;u=_(c),s=c.vanityName||""}catch{}i.push({id:r,urn:`urn:li:organization:${r}`,name:u,vanityName:s})}return JSON.stringify({ok:!0,count:i.length,organizations:i})}case"linkedin_create_draft_post":{let n=e?.organizationUrn||e?.organizationId||e?.organization||e?.orgId,l=b(n);if(!l)return JSON.stringify({ok:!1,error:"A valid organizationId or organizationUrn (urn:li:organization:{id}) is required"});let i=e?.text;if(typeof i!="string"||!i.trim())return JSON.stringify({ok:!1,error:"text (the post commentary) is required"});let a=e?.visibility?String(e.visibility).toUpperCase():"PUBLIC",o=`urn:li:organization:${l}`,r=typeof e?.imagePath=="string"?e.imagePath.trim():"",u=typeof e?.imageAltText=="string"?e.imageAltText:"";if(e?.dry_run===!0)try{let d="";try{let g=(await p(`/rest/organizations/${l}`,{},"linkedin_business")).body;d=_(g)}catch{}return JSON.stringify({dryRun:!0,target:"organization",wouldPostAs:{name:d,id:l,urn:o},visibility:a,textPreview:i,...r?{imageWouldAttach:!0,imagePath:r}:{},note:"DRY RUN \u2014 nothing was posted"})}catch(d){return JSON.stringify({dryRun:!0,ok:!1,error:d.message})}let s={author:o,commentary:i,visibility:a,distribution:{feedDistribution:"MAIN_FEED",targetEntities:[],thirdPartyDistributionChannels:[]},lifecycleState:"DRAFT",isReshareDisabledByAuthor:!1};if(r){let d=await k("linkedin_business",o,r);s.content={media:{id:d,altText:u||""}}}let c=await p("/rest/posts",{method:"POST",body:s},"linkedin_business"),m=h(c.headers,"x-restli-id")||h(c.headers,"x-linkedin-id")||c.body?.id||null;return JSON.stringify({ok:!0,postUrn:m,author:o,lifecycleState:"DRAFT",visibility:a,status:c.status})}case"linkedin_publish_post":{let n=f(),l=n?n.memberId:(await y("linkedin_personal")).memberId;if(!l)return JSON.stringify({ok:!1,error:"LinkedIn (personal) not connected or member id unavailable \u2014 reconnect LinkedIn Personal"});let i=e?.text;if(typeof i!="string"||!i.trim())return JSON.stringify({ok:!1,error:"text (the post body) is required"});let a=e?.visibility?String(e.visibility).toUpperCase():"PUBLIC",o=`urn:li:person:${l}`,r=typeof e?.imagePath=="string"?e.imagePath.trim():"",u=typeof e?.imageAltText=="string"?e.imageAltText:"";if(e?.dry_run===!0)try{let d=(await p("/v2/userinfo",{},"linkedin_personal")).body,g=d?.name||[d?.given_name,d?.family_name].filter(Boolean).join(" ")||"",I=d?.sub?String(d.sub):l;return JSON.stringify({dryRun:!0,target:"member",wouldPostAs:{name:g,id:I,urn:`urn:li:person:${I}`},visibility:a,textPreview:i,...r?{imageWouldAttach:!0,imagePath:r}:{},note:"DRY RUN \u2014 nothing was posted"})}catch(d){return JSON.stringify({dryRun:!0,ok:!1,error:d.message})}let s={author:o,commentary:i,visibility:a,distribution:{feedDistribution:"MAIN_FEED",targetEntities:[],thirdPartyDistributionChannels:[]},lifecycleState:"PUBLISHED",isReshareDisabledByAuthor:!1};if(r){let d=await k("linkedin_personal",o,r);s.content={media:{id:d,altText:u||""}}}let c=await p("/rest/posts",{method:"POST",body:s},"linkedin_personal"),m=h(c.headers,"x-restli-id")||h(c.headers,"x-linkedin-id")||c.body?.id||null;return JSON.stringify({ok:!0,postUrn:m,author:o,lifecycleState:"PUBLISHED",visibility:a,status:c.status})}default:return JSON.stringify({ok:!1,error:`Unknown tool: ${t}`})}}catch(n){return JSON.stringify({ok:!1,error:n.message})}},tools:[{name:"linkedin_list_organizations",description:"List the LinkedIn Organizations (company Pages) the authenticated member ADMINISTERS. Returns [{ id, urn, name, vanityName }]. Call this first to choose the author org for a draft post.",input_schema:{type:"object",properties:{}}},{name:"linkedin_create_draft_post",description:"Create a DRAFT post on a LinkedIn Organization (company Page). The post is created in DRAFT state (never published automatically) so a human can review and publish it in LinkedIn. Returns the created post URN. Optionally ATTACH an image: pass imagePath (a local PNG file path, e.g. one returned by social_card_render) and it is uploaded to LinkedIn and attached to the post. Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded (a set imagePath is reported as imageWouldAttach:true).",input_schema:{type:"object",properties:{organizationId:{type:"string",description:'The numeric organization id (e.g. "12345"). Alternative to organizationUrn.'},organizationUrn:{type:"string",description:'The organization URN, e.g. "urn:li:organization:12345". Alternative to organizationId.'},text:{type:"string",description:"The post commentary (the body text of the post)."},visibility:{type:"string",enum:["PUBLIC"],description:"Post visibility. Defaults to PUBLIC."},imagePath:{type:"string",description:"Optional. A LOCAL image file path (e.g. a PNG returned by social_card_render). When set, the image is uploaded to LinkedIn and attached to the post as its media. Not uploaded on a dry_run."},imageAltText:{type:"string",description:"Optional alt text for the attached image (accessibility). Only used when imagePath is set."},dry_run:{type:"boolean",description:"Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded. Returns { dryRun, target, wouldPostAs, visibility, textPreview, imageWouldAttach? }. Defaults to false."}},required:["text"]}},{name:"linkedin_publish_post",description:"PUBLISH a post to the authenticated member's OWN LinkedIn profile feed (personal). UNLIKE linkedin_create_draft_post (which only drafts on a company Page), this PUBLISHES the post IMMEDIATELY \u2014 LinkedIn has no DRAFT state for member profiles, so there is no human review step. Returns the created post URN. Requires the LinkedIn Personal integration connected. Optionally ATTACH an image: pass imagePath (a local PNG file path, e.g. one returned by social_card_render) and it is uploaded to LinkedIn and attached to the post. Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded (a set imagePath is reported as imageWouldAttach:true).",input_schema:{type:"object",properties:{text:{type:"string",description:"The post body (the commentary text of the post)."},visibility:{type:"string",enum:["PUBLIC","CONNECTIONS"],description:"Post visibility: PUBLIC (anyone) or CONNECTIONS (your connections only). Defaults to PUBLIC."},imagePath:{type:"string",description:"Optional. A LOCAL image file path (e.g. a PNG returned by social_card_render). When set, the image is uploaded to LinkedIn and attached to the post as its media. Not uploaded on a dry_run."},imageAltText:{type:"string",description:"Optional alt text for the attached image (accessibility). Only used when imagePath is set."},dry_run:{type:"boolean",description:"Set dry_run:true to VALIDATE which LinkedIn account/profile the post would go to (and preview the text) WITHOUT posting \u2014 nothing is published or uploaded. Returns { dryRun, target, wouldPostAs, visibility, textPreview, imageWouldAttach? }. Defaults to false."}},required:["text"]}}]};export{R as PERSONAL_REFUSAL,v as chatStrictPersonal,E as injectedPersonalToken,p as linkedinApi,j as linkedinSkill,b as parseOrgId,f as personalTierCredentialGate,O as senderIsNonOwner,k as uploadImage};
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/skills",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.74",
|
|
4
4
|
"description": "Built-in skill definitions for the Zibby agent-workflow framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -121,12 +121,17 @@
|
|
|
121
121
|
"zod": "^3.23.0 || ^4.0.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
|
-
"@zibby/core": ">=0.1.44"
|
|
124
|
+
"@zibby/core": ">=0.1.44",
|
|
125
|
+
"better-sqlite3": "^12.6.2"
|
|
126
|
+
},
|
|
127
|
+
"peerDependenciesMeta": {
|
|
128
|
+
"better-sqlite3": {
|
|
129
|
+
"optional": true
|
|
130
|
+
}
|
|
125
131
|
},
|
|
126
132
|
"optionalDependencies": {
|
|
127
133
|
"@zibby/mcp-browser": "^0.1.8",
|
|
128
|
-
"@zibby/mcp-memory": "*"
|
|
129
|
-
"better-sqlite3": "^12.6.2"
|
|
134
|
+
"@zibby/mcp-memory": "*"
|
|
130
135
|
},
|
|
131
136
|
"devDependencies": {
|
|
132
137
|
"@eslint/js": "^10.0.1",
|
package/dist/report.d.ts
CHANGED
|
@@ -170,13 +170,13 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
170
170
|
severity: z.ZodOptional<z.ZodEnum<["ok", "info", "warn", "critical"]>>;
|
|
171
171
|
}, "strip", z.ZodTypeAny, {
|
|
172
172
|
sub?: string;
|
|
173
|
-
label?: string;
|
|
174
173
|
value?: string;
|
|
174
|
+
label?: string;
|
|
175
175
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
176
176
|
}, {
|
|
177
177
|
sub?: string;
|
|
178
|
-
label?: string;
|
|
179
178
|
value?: string;
|
|
179
|
+
label?: string;
|
|
180
180
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
181
181
|
}>, "many">;
|
|
182
182
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -184,8 +184,8 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
184
184
|
kind?: "breakdown";
|
|
185
185
|
rows?: {
|
|
186
186
|
sub?: string;
|
|
187
|
-
label?: string;
|
|
188
187
|
value?: string;
|
|
188
|
+
label?: string;
|
|
189
189
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
190
190
|
}[];
|
|
191
191
|
}, {
|
|
@@ -193,8 +193,8 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
193
193
|
kind?: "breakdown";
|
|
194
194
|
rows?: {
|
|
195
195
|
sub?: string;
|
|
196
|
-
label?: string;
|
|
197
196
|
value?: string;
|
|
197
|
+
label?: string;
|
|
198
198
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
199
199
|
}[];
|
|
200
200
|
}>, z.ZodObject<{
|
|
@@ -231,8 +231,8 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
231
231
|
kind?: "breakdown";
|
|
232
232
|
rows?: {
|
|
233
233
|
sub?: string;
|
|
234
|
-
label?: string;
|
|
235
234
|
value?: string;
|
|
235
|
+
label?: string;
|
|
236
236
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
237
237
|
}[];
|
|
238
238
|
} | {
|
|
@@ -261,8 +261,8 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
261
261
|
kind?: "breakdown";
|
|
262
262
|
rows?: {
|
|
263
263
|
sub?: string;
|
|
264
|
-
label?: string;
|
|
265
264
|
value?: string;
|
|
265
|
+
label?: string;
|
|
266
266
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
267
267
|
}[];
|
|
268
268
|
} | {
|
|
@@ -282,7 +282,6 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
282
282
|
}>>;
|
|
283
283
|
}, "strip", z.ZodTypeAny, {
|
|
284
284
|
title?: string;
|
|
285
|
-
subtitle?: string;
|
|
286
285
|
headline?: {
|
|
287
286
|
summary?: string;
|
|
288
287
|
primary?: string;
|
|
@@ -292,6 +291,7 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
292
291
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
293
292
|
};
|
|
294
293
|
};
|
|
294
|
+
subtitle?: string;
|
|
295
295
|
sections?: ({
|
|
296
296
|
title?: string;
|
|
297
297
|
values?: number[];
|
|
@@ -314,8 +314,8 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
314
314
|
kind?: "breakdown";
|
|
315
315
|
rows?: {
|
|
316
316
|
sub?: string;
|
|
317
|
-
label?: string;
|
|
318
317
|
value?: string;
|
|
318
|
+
label?: string;
|
|
319
319
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
320
320
|
}[];
|
|
321
321
|
} | {
|
|
@@ -329,7 +329,6 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
329
329
|
};
|
|
330
330
|
}, {
|
|
331
331
|
title?: string;
|
|
332
|
-
subtitle?: string;
|
|
333
332
|
headline?: {
|
|
334
333
|
summary?: string;
|
|
335
334
|
primary?: string;
|
|
@@ -339,6 +338,7 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
339
338
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
340
339
|
};
|
|
341
340
|
};
|
|
341
|
+
subtitle?: string;
|
|
342
342
|
sections?: ({
|
|
343
343
|
title?: string;
|
|
344
344
|
values?: number[];
|
|
@@ -361,8 +361,8 @@ export const reportObjectSchema: z.ZodObject<{
|
|
|
361
361
|
kind?: "breakdown";
|
|
362
362
|
rows?: {
|
|
363
363
|
sub?: string;
|
|
364
|
-
label?: string;
|
|
365
364
|
value?: string;
|
|
365
|
+
label?: string;
|
|
366
366
|
severity?: "ok" | "info" | "warn" | "critical";
|
|
367
367
|
}[];
|
|
368
368
|
} | {
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export namespace socialCardSkill {
|
|
2
|
+
let id: string;
|
|
3
|
+
let serverName: string;
|
|
4
|
+
let allowedTools: string[];
|
|
5
|
+
let description: string;
|
|
6
|
+
let promptFragment: string;
|
|
7
|
+
function resolve({ sessionPath, nodeName }?: {}): {
|
|
8
|
+
command: any;
|
|
9
|
+
args: any[];
|
|
10
|
+
env: {};
|
|
11
|
+
description: string;
|
|
12
|
+
type?: undefined;
|
|
13
|
+
alwaysLoad?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
type: string;
|
|
16
|
+
command: string;
|
|
17
|
+
args: any[];
|
|
18
|
+
env: {
|
|
19
|
+
ZIBBY_NODE_SESSION_PATH: any;
|
|
20
|
+
ZIBBY_SESSION_PATH: any;
|
|
21
|
+
};
|
|
22
|
+
description: string;
|
|
23
|
+
alwaysLoad: boolean;
|
|
24
|
+
};
|
|
25
|
+
function handleToolCall(name: any, args: any): Promise<string>;
|
|
26
|
+
let tools: {
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
input_schema: {
|
|
30
|
+
type: string;
|
|
31
|
+
properties: {
|
|
32
|
+
headline: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
eyebrow: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
subhead: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
stat: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
footer: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
diagram: {
|
|
53
|
+
type: string;
|
|
54
|
+
items: {
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
theme: {
|
|
60
|
+
type: string;
|
|
61
|
+
enum: string[];
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
accent: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
};
|
|
68
|
+
width: {
|
|
69
|
+
type: string;
|
|
70
|
+
description: string;
|
|
71
|
+
};
|
|
72
|
+
height: {
|
|
73
|
+
type: string;
|
|
74
|
+
description: string;
|
|
75
|
+
};
|
|
76
|
+
filename: {
|
|
77
|
+
type: string;
|
|
78
|
+
description: string;
|
|
79
|
+
};
|
|
80
|
+
output: {
|
|
81
|
+
type: string;
|
|
82
|
+
enum: string[];
|
|
83
|
+
description: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
required: string[];
|
|
87
|
+
};
|
|
88
|
+
}[];
|
|
89
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{createRequire as ne}from"node:module";import{existsSync as G,mkdirSync as oe,writeFileSync as z}from"node:fs";import{dirname as Z,join as F,resolve as q}from"node:path";import{fileURLToPath as J}from"node:url";var re=ne(import.meta.url),C=null;function ie(){return C||(C=re("@resvg/resvg-js")),C}var K=1200,ae=627,se=4096,ce=320,le="#3b82f6",k="Noto Sans",de=3;function he(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let e=Z(J(import.meta.url)),t=q(e,"..","bin","mcp-skill.mjs");return G(t)?t:null}function fe(){let e=Z(J(import.meta.url)),t=q(e,"..","assets","fonts");return["NotoSans-Regular.ttf","NotoSans-Bold.ttf"].map(n=>F(t,n)).filter(n=>G(n))}function ue(){let e=process.env.ZIBBY_NODE_SESSION_PATH,t=process.env.ZIBBY_SESSION_PATH,n=e||(t?F(t,"social-card"):F(process.cwd(),".zibby","output","social-cards"));return oe(n,{recursive:!0}),n}function U(e,t){let n=Number(e);return Number.isFinite(n)?Math.max(ce,Math.min(se,Math.round(n))):t}function _(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function pe(e){return typeof e!="string"?null:e.trim().replace(/\.(png|svg)$/i,"").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^[.-]+|[.-]+$/g,"")||null}function ge(e,t){if(typeof e!="string")return t;let n=e.trim();return/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(n)?n:t}function X(e,t,n){return String(e).length*t*n}function E(e,t,n,h){let a=String(e).trim().split(/\s+/).filter(Boolean),o=[],r="";for(let i of a){let f=r?`${r} ${i}`:i;r&&X(f,n,h)>t?(o.push(r),r=i):r=f}return r&&o.push(r),o.length?o:[""]}function me(e){return e==="light"?{bg:"#ffffff",fg:"#0b0f14",muted:"#5b6673",pillText:"#0b0f14",checkFg:"#ffffff",divider:"#e2e6ea"}:{bg:"#0b0f14",fg:"#e9edf1",muted:"#8b98a5",pillText:"#e9edf1",checkFg:"#0b0f14",divider:"#22303c"}}function j(e,t,n,h,a){let o=(Array.isArray(e)?e:[]).map(l=>String(l??"").trim()).filter(Boolean).slice(0,de);if(o.length<2)return null;let r=24,i=54,f=26,m=90,y=17,b=o.map(l=>Math.max(96,X(l,r,.58)+f*2)),$=b.reduce((l,p)=>l+p,0)+m*(o.length-1),s=t-$/2,c=n+i/2,x=[];for(let l=0;l<o.length;l++){let p=b[l];if(x.push(`<rect x="${s.toFixed(1)}" y="${n}" width="${p.toFixed(1)}" height="${i}" rx="${i/2}" fill="${a}" fill-opacity="0.12" stroke="${a}" stroke-opacity="0.55" stroke-width="1.5"/>`,`<text x="${(s+p/2).toFixed(1)}" y="${(c+r*.35).toFixed(1)}" text-anchor="middle" font-family="${k}" font-size="${r}" font-weight="700" fill="${h.pillText}">${_(o[l])}</text>`),s+=p,l<o.length-1){let A=s,S=s+m,N=(A+S)/2;x.push(`<line x1="${A.toFixed(1)}" y1="${c}" x2="${S.toFixed(1)}" y2="${c}" stroke="${a}" stroke-opacity="0.55" stroke-width="2"/>`,`<circle cx="${N.toFixed(1)}" cy="${c}" r="${y}" fill="${a}"/>`,`<path d="M ${(N-8).toFixed(1)} ${c.toFixed(1)} l 5 5 l 9 -11" fill="none" stroke="${h.checkFg}" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>`),s=S}}return{svg:x.join(`
|
|
2
|
+
`),height:i}}function ye(e){let{width:t,height:n,theme:h,accent:a}=e,o=me(h),r=t/2,i=Math.round(t*.07),f=t-i*2,m=String(e.headline).trim(),y=e.eyebrow?String(e.eyebrow).trim().toUpperCase():"",b=e.subhead?String(e.subhead).trim():"",$=e.stat?String(e.stat).trim():"",s=e.footer?String(e.footer).trim():"",c=t/K,x=Math.round(22*c),l=Math.round(29*c),p=b?E(b,f,l,.52):[],A=Math.round(l*1.28),S=4,N=Math.round(26*c),T=Math.round(20*c),B=Math.round(24*c),D=Math.round(30*c),P=!!($||s),R=i,Q=P?Math.round(110*c):i,H=n-R-Q,M=j(e.diagram,r,0,o,a),W=(d,w)=>{let O=S+N;return y&&(O+=x+T),O+=w.length*Math.round(d*1.16),p.length&&(O+=B+p.length*A),M&&(O+=D+M.height),O},I=[76,66,58,50,44,38].map(d=>Math.round(d*c)),V=4,v=I[I.length-1],L=E(m,f,v,.6);for(let d of I){let w=E(m,f,d,.6);if(w.length<=V&&W(d,w)<=H){v=d,L=w;break}}let ee=Math.round(v*1.16),te=W(v,L),u=R+Math.max(0,(H-te)/2),g=[];g.push(`<rect x="0" y="0" width="${t}" height="${n}" fill="${o.bg}"/>`);let Y=Math.round(60*c);g.push(`<rect x="${(r-Y/2).toFixed(1)}" y="${u}" width="${Y}" height="${S}" rx="2" fill="${a}"/>`),u+=S+N,y&&(g.push(`<text x="${r}" y="${(u+x*.82).toFixed(1)}" text-anchor="middle" font-family="${k}" font-size="${x}" font-weight="700" letter-spacing="3" fill="${a}">${_(y)}</text>`),u+=x+T);for(let d of L)g.push(`<text x="${r}" y="${(u+v*.82).toFixed(1)}" text-anchor="middle" font-family="${k}" font-size="${v}" font-weight="700" fill="${o.fg}">${_(d)}</text>`),u+=ee;if(p.length){u+=B;for(let d of p)g.push(`<text x="${r}" y="${(u+l*.82).toFixed(1)}" text-anchor="middle" font-family="${k}" font-size="${l}" font-weight="400" fill="${o.muted}">${_(d)}</text>`),u+=A}if(M){u+=D;let d=j(e.diagram,r,u,o,a);d&&g.push(d.svg)}if(P){let d=Math.round(24*c),w=n-Math.round(46*c);s&&g.push(`<text x="${i}" y="${w}" text-anchor="start" font-family="${k}" font-size="${d}" font-weight="400" fill="${o.muted}">${_(s)}</text>`),$&&g.push(`<text x="${t-i}" y="${w}" text-anchor="end" font-family="${k}" font-size="${d}" font-weight="700" fill="${a}">${_($)}</text>`)}return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}" viewBox="0 0 ${t} ${n}">
|
|
3
|
+
${g.join(`
|
|
4
|
+
`)}
|
|
5
|
+
</svg>`}function be(e){let{Resvg:t}=ie();return new t(e,{font:{fontFiles:fe(),loadSystemFonts:!0,defaultFontFamily:k}}).render().asPng()}var ke={id:"social-card",serverName:"social_card",allowedTools:["mcp__social_card__*"],description:'Social card \u2014 render a branded LinkedIn "concept card" PNG locally (bold headline + eyebrow + optional stat/footer/diagram); nothing leaves the box',promptFragment:`## Social Card (branded concept card, local)
|
|
6
|
+
You can render a BRANDED concept card PNG with the social_card_render tool \u2014 the
|
|
7
|
+
clean, high-signal LinkedIn "concept card" style (bold headline + small uppercase
|
|
8
|
+
eyebrow + optional stat/footer + optional A\u2014\u2713\u2014B diagram). Give it STRUCTURED
|
|
9
|
+
fields that capture the ONE key idea of your post:
|
|
10
|
+
- headline (required): the big, bold line \u2014 the single takeaway.
|
|
11
|
+
- eyebrow: a short uppercase kicker (e.g. "MY WORKFLOW", "OPEN SOURCE").
|
|
12
|
+
- subhead: one supporting line under the headline.
|
|
13
|
+
- stat / footer: e.g. stat "11.8k stars", footer "Apache 2.0".
|
|
14
|
+
- diagram: 2-3 short labels rendered as a chain, e.g. ["Claude Code","Codex"].
|
|
15
|
+
- theme ('dark' default | 'light'), accent (hex).
|
|
16
|
+
It renders server-side to a PNG in the run's output folder and returns
|
|
17
|
+
{ ok:true, files:[{ path, format:'png', bytes }] }. Pass the returned \`path\` as
|
|
18
|
+
\`imagePath\` when you draft/publish a LinkedIn post to ATTACH the card as the
|
|
19
|
+
post image. No browser, no external service \u2014 the data never leaves the machine.`,resolve({sessionPath:e,nodeName:t}={}){let n=he();if(!n)return{command:null,args:[],env:{},description:this.description};let h={},a=e&&t?F(e,t):null;a&&(h.ZIBBY_NODE_SESSION_PATH=a),e&&(h.ZIBBY_SESSION_PATH=e);for(let o of["ZIBBY_NODE_SESSION_PATH","ZIBBY_SESSION_PATH"])!h[o]&&process.env[o]&&(h[o]=process.env[o]);return{type:"stdio",command:"node",args:[n,"../dist/socialCard.js","socialCardSkill"],env:h,description:this.description,alwaysLoad:!0}},async handleToolCall(e,t){if(e!=="social_card_render")return JSON.stringify({error:`Unknown tool: ${e}`});try{let n=t?.headline;if(typeof n!="string"||!n.trim())return JSON.stringify({error:"headline (the big bold line) is required and must be a non-empty string."});let h=U(t?.width,K),a=U(t?.height,ae),o=t?.theme==="light"?"light":"dark",r=ge(t?.accent,le),i;try{i=ye({width:h,height:a,theme:o,accent:r,headline:n,eyebrow:t?.eyebrow,subhead:t?.subhead,stat:t?.stat,footer:t?.footer,diagram:t?.diagram})}catch(s){return JSON.stringify({error:`Card layout failed: ${s.message}`})}let f;try{f=be(i)}catch(s){return JSON.stringify({error:`PNG rasterization failed: ${s.message}`})}let m=ue(),y=pe(t?.filename)||`social-card-${Date.now()}`,b=F(m,`${y}.png`);z(b,f);let $=[{path:b,format:"png",bytes:f.length}];if(t?.output==="both"||t?.output==="svg"){let s=F(m,`${y}.svg`);z(s,i,"utf-8"),$.push({path:s,format:"svg",bytes:Buffer.byteLength(i,"utf-8")})}return JSON.stringify({ok:!0,width:h,height:a,theme:o,files:$})}catch(n){return JSON.stringify({error:`social_card_render failed: ${n.message}`})}},tools:[{name:"social_card_render",description:'Render a BRANDED "concept card" PNG LOCALLY (no external service) from structured fields \u2014 the clean LinkedIn concept-card style: bold headline + small uppercase eyebrow + optional supporting subhead, stat, footer, and an A\u2014\u2713\u2014B diagram. Returns { ok:true, files:[{ path, format:"png", bytes }] }. Pass the returned `path` as `imagePath` to a LinkedIn post tool to attach it as the post image. Example: { "headline":"No more copy-paste between AI tools", "eyebrow":"MY WORKFLOW", "stat":"11.8k stars", "footer":"Apache 2.0", "diagram":["Claude Code","Codex"] }.',input_schema:{type:"object",properties:{headline:{type:"string",description:"REQUIRED. The big, bold line \u2014 the single key idea/takeaway. Word-wrapped + auto-sized."},eyebrow:{type:"string",description:'Small uppercase kicker above the headline (e.g. "MY WORKFLOW", "OPEN SOURCE"). Rendered uppercased in the accent color.'},subhead:{type:"string",description:"One supporting line under the headline (muted)."},stat:{type:"string",description:'Optional stat, shown bottom-right in the accent color (e.g. "11.8k stars", "3x faster").'},footer:{type:"string",description:'Optional footer, shown bottom-left (muted) (e.g. "Apache 2.0", a repo name).'},diagram:{type:"array",items:{type:"string"},description:'Optional 2-3 short labels rendered as a chain of pills joined by a checkmark (A \u2014\u2713\u2014 B), e.g. ["Claude Code","Codex"].'},theme:{type:"string",enum:["dark","light"],description:"Card theme (default 'dark' \u2014 near-black bg, off-white text)."},accent:{type:"string",description:'Accent hex color (e.g. "#f97316"). Defaults to a tasteful blue (#3b82f6).'},width:{type:"number",description:"Image width in px (default 1200 \u2014 LinkedIn 1.91:1 link image)."},height:{type:"number",description:"Image height in px (default 627)."},filename:{type:"string",description:"Optional file basename (no extension); defaults to social-card-<timestamp>."},output:{type:"string",enum:["png","both"],description:"Which file(s) to write (default 'png'; 'both' also writes the .svg)."}},required:["headline"]}}]};export{ke as socialCardSkill};
|
|
@@ -21,7 +21,7 @@ npm install @zibby/agent-workflow
|
|
|
21
21
|
|---|---|
|
|
22
22
|
| `WorkflowGraph` | The graph builder. `addNode`, `addEdge`, `addConditionalEdges`, `setEntryPoint`, `run`. |
|
|
23
23
|
| `WorkflowAgent` | Base class your `graph.mjs` exports — has `buildGraph()`. |
|
|
24
|
-
| `Node
|
|
24
|
+
| `Node` | Internal node class (rarely used directly). |
|
|
25
25
|
| `WorkflowState` | History-tracked state passed between nodes. |
|
|
26
26
|
| `AgentStrategy` | Base class for custom agent strategies. |
|
|
27
27
|
| `registerStrategy`, `listStrategies`, `getAgentStrategy`, `invokeAgent` | Strategy registry. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zibby/skills",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.75",
|
|
4
4
|
"description": "Built-in skill definitions for the Zibby agent-workflow framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -121,12 +121,17 @@
|
|
|
121
121
|
"zod": "^3.23.0 || ^4.0.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
124
|
-
"@zibby/core": ">=0.1.44"
|
|
124
|
+
"@zibby/core": ">=0.1.44",
|
|
125
|
+
"better-sqlite3": "^12.6.2"
|
|
126
|
+
},
|
|
127
|
+
"peerDependenciesMeta": {
|
|
128
|
+
"better-sqlite3": {
|
|
129
|
+
"optional": true
|
|
130
|
+
}
|
|
125
131
|
},
|
|
126
132
|
"optionalDependencies": {
|
|
127
133
|
"@zibby/mcp-browser": "^0.1.8",
|
|
128
|
-
"@zibby/mcp-memory": "*"
|
|
129
|
-
"better-sqlite3": "^12.6.2"
|
|
134
|
+
"@zibby/mcp-memory": "*"
|
|
130
135
|
},
|
|
131
136
|
"devDependencies": {
|
|
132
137
|
"@eslint/js": "^10.0.1",
|