@zibby/skills 0.1.50 → 0.1.52

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.
@@ -0,0 +1,103 @@
1
+ export namespace datasetStoreSkill {
2
+ let id: string;
3
+ let serverName: string;
4
+ let allowedTools: string[];
5
+ let description: string;
6
+ let promptFragment: string;
7
+ function resolve(): {
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
+ description: string;
20
+ alwaysLoad: boolean;
21
+ };
22
+ function handleToolCall(name: any, args: any): Promise<string>;
23
+ let tools: ({
24
+ name: string;
25
+ description: string;
26
+ input_schema: {
27
+ type: string;
28
+ properties: {
29
+ store: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ record: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ description: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ agent: {
42
+ type: string;
43
+ description: string;
44
+ };
45
+ select?: undefined;
46
+ where?: undefined;
47
+ groupBy?: undefined;
48
+ orderBy?: undefined;
49
+ limit?: undefined;
50
+ since?: undefined;
51
+ until?: undefined;
52
+ };
53
+ required: string[];
54
+ };
55
+ } | {
56
+ name: string;
57
+ description: string;
58
+ input_schema: {
59
+ type: string;
60
+ properties: {
61
+ store: {
62
+ type: string;
63
+ description: string;
64
+ };
65
+ select: {
66
+ type: string;
67
+ description: string;
68
+ };
69
+ where: {
70
+ type: string;
71
+ description: string;
72
+ };
73
+ groupBy: {
74
+ type: string;
75
+ description: string;
76
+ };
77
+ orderBy: {
78
+ type: string;
79
+ description: string;
80
+ };
81
+ limit: {
82
+ type: string;
83
+ description: string;
84
+ };
85
+ since: {
86
+ type: string;
87
+ description: string;
88
+ };
89
+ until: {
90
+ type: string;
91
+ description: string;
92
+ };
93
+ agent: {
94
+ type: string;
95
+ description: string;
96
+ };
97
+ record?: undefined;
98
+ description?: undefined;
99
+ };
100
+ required: any[];
101
+ };
102
+ })[];
103
+ }
@@ -0,0 +1,19 @@
1
+ import{existsSync as c,readFileSync as u}from"node:fs";import{homedir as p}from"node:os";import{join as l,dirname as y,resolve as m}from"node:path";import{fileURLToPath as f}from"node:url";function g(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let r=y(f(import.meta.url)),t=m(r,"..","bin","mcp-skill.mjs");return c(t)?t:null}function h(){if(process.env.PROJECT_API_TOKEN)return process.env.PROJECT_API_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return process.env.ZIBBY_USER_TOKEN;try{let r=l(p(),".zibby","config.json");return c(r)&&JSON.parse(u(r,"utf-8")).sessionToken||null}catch{return null}}function O(){return process.env.ZIBBY_ACCOUNT_API_URL?process.env.ZIBBY_ACCOUNT_API_URL.replace(/\/$/,""):(process.env.ZIBBY_ENV||"prod")==="local"?"http://localhost:3001":process.env.ZIBBY_PROD_ACCOUNT_API_URL||"https://api-prod.zibby.app"}function b(){return(typeof process.env.WORKFLOW_TYPE=="string"?process.env.WORKFLOW_TYPE.trim():"")||"agent"}function _(){let r={};for(let[t,e]of Object.entries(process.env)){let o=/^ZIBBY_STORE__(.+)$/.exec(t);if(!o)continue;let n=typeof e=="string"?e.trim():"";n&&(r[o[1]]=n)}return r}function i(r){let t=_(),e=Object.keys(t),o=typeof r=="string"?r.trim():"";return o?Object.prototype.hasOwnProperty.call(t,o)?{storeId:t[o],name:o}:{error:`unknown store '${o}'; available: ${e.join(", ")}`}:e.length===1?{storeId:t[e[0]],name:e[0]}:e.length===0?{error:"no stores bound to this agent"}:{error:`multiple stores are bound; pass \`store\` (one of: ${e.join(", ")})`}}async function a(r,t,e){let o=h();if(!o)throw new Error("No backend credential (PROJECT_API_TOKEN). Dataset store is only available inside a Zibby run.");let n=`${O()}/datasets/stores/${encodeURIComponent(r)}/${t}`,s=await fetch(n,{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){let d=await s.text().catch(()=>"");throw new Error(`Store ${t} failed (${s.status}): ${d.slice(0,300)}`)}return s.json()}var T={id:"dataset-store",serverName:"dataset_store",allowedTools:["mcp__dataset_store__*"],description:"Dataset store \u2014 a durable, queryable store for structured JSON records; append rows now, run SQL-style aggregations/reports later",promptFragment:`## Dataset Store (durable, queryable structured-record store)
2
+ You have one or more durable stores for STRUCTURED records that survive across
3
+ your stateless runs. Unlike key-value memory (for picking up where you left
4
+ off), this is for accumulating DATA you want to QUERY and AGGREGATE later \u2014 e.g.
5
+ per-run metrics, processed items, findings \u2014 and turn into a report.
6
+
7
+ Your bound stores are listed in the "AVAILABLE STORES" block below (each with a
8
+ name + description). Pick one BY DESCRIPTION and pass its \`store\` NAME (e.g.
9
+ "scorecards") to the tools \u2014 NOT an id. If exactly one store is bound you may
10
+ omit \`store\` and it defaults to that one. You can ONLY write to a bound store
11
+ name; any other name is rejected. Each appended record is an arbitrary JSON
12
+ object, auto-tagged with YOUR agent type so you can later filter to your writes.
13
+
14
+ Tools:
15
+ - dataset_append: Append ONE structured JSON \`record\` to a store (by \`store\`
16
+ name). Use to durably persist a row of data each run (e.g. {repo, stars, ts}).
17
+ - dataset_query: Run a SQL-style query over a store \u2014 select/aggregate
18
+ (count|sum|avg|min|max), filter (where), group (groupBy), order, limit, and
19
+ bound by month (since/until). Use to compute reports from what you've stored.`,resolve(){let r=g();if(!r)return{command:null,args:[],env:{},description:this.description};let t={};for(let e of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_USER_TOKEN","WORKFLOW_TYPE"])process.env[e]&&(t[e]=process.env[e]);for(let e of Object.keys(process.env))/^ZIBBY_STORE__.+$/.test(e)&&process.env[e]&&(t[e]=process.env[e]);return{type:"stdio",command:"node",args:[r,"../dist/datasetStore.js","datasetStoreSkill"],env:t,description:this.description,alwaysLoad:!1}},async handleToolCall(r,t){try{switch(r){case"dataset_append":{if(t?.record==null||typeof t.record!="object"||Array.isArray(t.record))return JSON.stringify({error:"record is required (a JSON object)"});let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});let o=typeof t?.agent=="string"&&t.agent.trim()?t.agent.trim():b(),n={record:t.record,agent:o};typeof t?.description=="string"&&t.description.trim()&&(n.description=t.description.trim());let s=await a(e.storeId,"append",n);return JSON.stringify({...s,store:e.name,storeId:e.storeId})}case"dataset_query":{let e=i(t?.store);if(e.error)return JSON.stringify({error:e.error});let o={};for(let s of["select","where","groupBy","orderBy","limit","since","until","agent"])t?.[s]!=null&&(o[s]=t[s]);let n=await a(e.storeId,"query",o);return JSON.stringify({...n,store:e.name,storeId:e.storeId})}default:return JSON.stringify({error:`Unknown tool: ${r}`})}}catch(e){return JSON.stringify({error:e.message})}},tools:[{name:"dataset_append",description:"Append ONE structured JSON record to a bound store, durably. Records persist across your stateless runs and are auto-tagged with your agent type so you can filter to your own writes later. Use to accumulate data you will query/aggregate (e.g. per-run metrics, processed items). Append ONE record per call.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to write to (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store; you can ONLY write to a bound store name.'},record:{type:"object",description:'An arbitrary JSON object \u2014 one row of data. Its keys become queryable fields (e.g. {"repo":"owner/x","stars":1200}). One record per call.'},description:{type:"string",description:"Optional, informational note about this write. The store already exists from deploy, so this is not required and does not create anything."},agent:{type:"string",description:"Optional writing-agent tag. Defaults to your own agent type \u2014 leave unset to auto-tag."}},required:["record"]}},{name:"dataset_query",description:"Run a SQL-style query over a bound store to build reports: select/aggregate (count|sum|avg|min|max), filter, group, order, limit, and bound by month. Returns { columns, rows }. Use this to compute summaries/aggregations from records you appended earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:'The logical store NAME to query (e.g. "scorecards"), taken from the AVAILABLE STORES list \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this and it defaults to that store.'},select:{type:"array",description:"Columns to return. Each item is { field?, agg?, as? }. agg \u2208 count|sum|avg|min|max; omit field for count(*). Omit `select` entirely to return raw rows."},where:{type:"array",description:"Filters, ANDed. Each item is { field, op, value }; op \u2208 eq|ne|gt|gte|lt|lte|like. `field` is a JSON key of the stored record."},groupBy:{type:"array",description:"Field names to group by (array of strings) for aggregation."},orderBy:{type:"array",description:"Sort spec. Each item is { field|as, dir }; dir \u2208 asc|desc."},limit:{type:"number",description:"Maximum number of rows to return."},since:{type:"string",description:"Inclusive lower bound month, 'yyyy-MM' (e.g. '2026-01')."},until:{type:"string",description:"Inclusive upper bound month, 'yyyy-MM' (e.g. '2026-06')."},agent:{type:"string",description:"Filter to records written by one agent namespace. Omit to query across all writers."}},required:[]}}]};export{T as datasetStoreSkill};
package/dist/index.d.ts CHANGED
@@ -20,6 +20,7 @@ export namespace SKILLS {
20
20
  let CORE_TOOLS: string;
21
21
  let CHAT_MEMORY: string;
22
22
  let KV_MEMORY: string;
23
+ let DATASET_STORE: string;
23
24
  let CODEBASE_MEMORY: string;
24
25
  let WORKFLOW_BUILDER: string;
25
26
  let OPENAI_BILLING: string;
@@ -44,12 +45,13 @@ import { sentrySkill } from './sentry.js';
44
45
  import { memorySkill } from './memory.js';
45
46
  import { chatMemorySkill } from './chat-memory.js';
46
47
  import { kvMemorySkill } from './kvMemory.js';
48
+ import { datasetStoreSkill } from './datasetStore.js';
47
49
  import { codebaseMemorySkill } from './codebaseMemory.js';
48
50
  import { testRunnerSkill } from './test-runner.js';
49
51
  import { skillInstallerSkill } from './skill-installer.js';
50
52
  import { coreToolsSkill } from './core-tools.js';
51
53
  import { workflowBuilderSkill } from './workflow-builder.js';
52
- export { browserSkill, jiraSkill, githubSkill, gitlabSkill, figmaSkill, linearSkill, planeSkill, opendesignSkill, gitSkill, gitWriteSkill, slackSkill, larkSkill, notionSkill, chatNotifySkill, sentrySkill, memorySkill, chatMemorySkill, kvMemorySkill, codebaseMemorySkill, testRunnerSkill, testRunnerSkill as runnerSkill, skillInstallerSkill, coreToolsSkill, workflowBuilderSkill };
54
+ export { browserSkill, jiraSkill, githubSkill, gitlabSkill, figmaSkill, linearSkill, planeSkill, opendesignSkill, gitSkill, gitWriteSkill, slackSkill, larkSkill, notionSkill, chatNotifySkill, sentrySkill, memorySkill, chatMemorySkill, kvMemorySkill, datasetStoreSkill, codebaseMemorySkill, testRunnerSkill, testRunnerSkill as runnerSkill, skillInstallerSkill, coreToolsSkill, workflowBuilderSkill };
53
55
  export { openaiBillingSkill, anthropicBillingSkill, cursorAdminSkill, fetchOpenAICosts, fetchOpenAIProjects, fetchAnthropicCosts, fetchAnthropicWorkspaces, fetchCursorSpend, fetchAllProviders, groupByKey, meanStddev } from "./llm-billing.js";
54
56
  export { reportObjectSchema, reportToBlockKit, reportToLarkCard, SEVERITIES as REPORT_SEVERITIES } from "./report.js";
55
57
  export { skill, functionSkill } from "./function-skill.js";