@zibby/skills 0.1.96 → 0.2.1
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/README.md +1 -1
- package/dist/artifact.d.ts +1 -115
- package/dist/browser.d.ts +10 -19
- package/dist/chartRender.d.ts +46 -57
- package/dist/chartRender.js +1 -1
- package/dist/chat-memory.d.ts +26 -330
- package/dist/chat-notify.d.ts +30 -409
- package/dist/chat-notify.js +3 -3
- package/dist/chatProgress.d.ts +28 -47
- package/dist/code-scan.d.ts +52 -58
- package/dist/codeStats.d.ts +36 -136
- package/dist/codeStats.js +1 -1
- package/dist/codebaseMemory.d.ts +52 -32
- package/dist/codebaseMemory.js +2 -2
- package/dist/core-tools.d.ts +10 -131
- package/dist/datasetStore.d.ts +52 -326
- package/dist/datasetStore.js +6 -4
- package/dist/discord.d.ts +32 -68
- package/dist/figma.d.ts +5 -408
- package/dist/function-skill.d.ts +23 -135
- package/dist/function-skill.js +1 -1
- package/dist/gbrain.d.ts +46 -114
- package/dist/git-write.d.ts +45 -137
- package/dist/git-write.js +6 -6
- package/dist/git.d.ts +2 -73
- package/dist/github.d.ts +2 -1202
- package/dist/gitlab.d.ts +55 -1059
- package/dist/gitlab.js +2 -2
- package/dist/googleDocs.d.ts +39 -175
- package/dist/hubspot.d.ts +1 -381
- package/dist/index.d.ts +19 -12
- package/dist/index.js +143 -141
- package/dist/integrations.d.ts +2 -2
- package/dist/jira.d.ts +2 -532
- package/dist/jira.js +4 -4
- package/dist/kvMemory.d.ts +47 -78
- package/dist/lark.d.ts +2 -161
- package/dist/lark.js +1 -1
- package/dist/larkDocs.d.ts +35 -236
- package/dist/linear.d.ts +36 -343
- package/dist/linkedin.d.ts +10 -120
- package/dist/llm-billing.d.ts +92 -180
- package/dist/llm-billing.js +1 -1
- package/dist/memory.d.ts +11 -137
- package/dist/notion.d.ts +28 -276
- package/dist/notion.js +4 -4
- package/dist/opendesign.d.ts +24 -202
- package/dist/opendesign.js +2 -2
- package/dist/package.json +3 -2
- package/dist/plane.d.ts +40 -24
- package/dist/report.d.ts +153 -110
- package/dist/review-dedup.d.ts +8 -8
- package/dist/review.d.ts +12 -2
- package/dist/reviewMemoryIo.d.ts +37 -3
- package/dist/reviewRecord.d.ts +41 -47
- package/dist/sentry.d.ts +25 -22
- package/dist/skill-installer.d.ts +11 -86
- package/dist/slack.d.ts +1 -284
- package/dist/socialCard.d.ts +35 -89
- package/dist/test-runner.d.ts +1 -220
- package/dist/trackers/github-adapter.d.ts +39 -94
- package/dist/trackers/index.d.ts +25 -18
- package/dist/trackers/jira-adapter.d.ts +20 -88
- package/dist/trackers/linear-adapter.d.ts +24 -87
- package/dist/trackers/plane-adapter.d.ts +29 -85
- package/dist/trackers/plane-adapter.js +1 -1
- package/dist/trackers/types.d.ts +1 -186
- package/dist/triggerAgent.d.ts +26 -42
- package/dist/triggerAgent.js +1 -1
- package/dist/workflow-builder.d.ts +11 -245
- package/docs/concepts/designing-agents.md +247 -0
- package/docs/self-host/backup-restore.md +52 -0
- package/docs/self-host/index.md +75 -0
- package/docs/self-host/storage.md +50 -0
- package/docs/self-host/troubleshooting.md +48 -0
- package/docs/self-host/upgrade.md +81 -0
- package/package.json +3 -2
package/dist/datasetStore.d.ts
CHANGED
|
@@ -1,326 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
name?: undefined;
|
|
54
|
-
type?: undefined;
|
|
55
|
-
sql?: undefined;
|
|
56
|
-
params?: undefined;
|
|
57
|
-
path?: undefined;
|
|
58
|
-
content?: undefined;
|
|
59
|
-
contentBase64?: undefined;
|
|
60
|
-
contentType?: undefined;
|
|
61
|
-
prefix?: undefined;
|
|
62
|
-
cursor?: undefined;
|
|
63
|
-
};
|
|
64
|
-
required: string[];
|
|
65
|
-
};
|
|
66
|
-
} | {
|
|
67
|
-
name: string;
|
|
68
|
-
description: string;
|
|
69
|
-
input_schema: {
|
|
70
|
-
type: string;
|
|
71
|
-
properties: {
|
|
72
|
-
store: {
|
|
73
|
-
type: string;
|
|
74
|
-
description: string;
|
|
75
|
-
};
|
|
76
|
-
select: {
|
|
77
|
-
type: string;
|
|
78
|
-
description: string;
|
|
79
|
-
};
|
|
80
|
-
where: {
|
|
81
|
-
type: string;
|
|
82
|
-
description: string;
|
|
83
|
-
};
|
|
84
|
-
groupBy: {
|
|
85
|
-
type: string;
|
|
86
|
-
description: string;
|
|
87
|
-
};
|
|
88
|
-
orderBy: {
|
|
89
|
-
type: string;
|
|
90
|
-
description: string;
|
|
91
|
-
};
|
|
92
|
-
limit: {
|
|
93
|
-
type: string;
|
|
94
|
-
description: string;
|
|
95
|
-
};
|
|
96
|
-
since: {
|
|
97
|
-
type: string;
|
|
98
|
-
description: string;
|
|
99
|
-
};
|
|
100
|
-
until: {
|
|
101
|
-
type: string;
|
|
102
|
-
description: string;
|
|
103
|
-
};
|
|
104
|
-
agent: {
|
|
105
|
-
type: string;
|
|
106
|
-
description: string;
|
|
107
|
-
};
|
|
108
|
-
record?: undefined;
|
|
109
|
-
description?: undefined;
|
|
110
|
-
name?: undefined;
|
|
111
|
-
type?: undefined;
|
|
112
|
-
sql?: undefined;
|
|
113
|
-
params?: undefined;
|
|
114
|
-
path?: undefined;
|
|
115
|
-
content?: undefined;
|
|
116
|
-
contentBase64?: undefined;
|
|
117
|
-
contentType?: undefined;
|
|
118
|
-
prefix?: undefined;
|
|
119
|
-
cursor?: undefined;
|
|
120
|
-
};
|
|
121
|
-
required: any[];
|
|
122
|
-
};
|
|
123
|
-
} | {
|
|
124
|
-
name: string;
|
|
125
|
-
description: string;
|
|
126
|
-
input_schema: {
|
|
127
|
-
type: string;
|
|
128
|
-
properties: {
|
|
129
|
-
name: {
|
|
130
|
-
type: string;
|
|
131
|
-
description: string;
|
|
132
|
-
};
|
|
133
|
-
type: {
|
|
134
|
-
type: string;
|
|
135
|
-
enum: string[];
|
|
136
|
-
description: string;
|
|
137
|
-
};
|
|
138
|
-
description: {
|
|
139
|
-
type: string;
|
|
140
|
-
description: string;
|
|
141
|
-
};
|
|
142
|
-
store?: undefined;
|
|
143
|
-
record?: undefined;
|
|
144
|
-
agent?: undefined;
|
|
145
|
-
select?: undefined;
|
|
146
|
-
where?: undefined;
|
|
147
|
-
groupBy?: undefined;
|
|
148
|
-
orderBy?: undefined;
|
|
149
|
-
limit?: undefined;
|
|
150
|
-
since?: undefined;
|
|
151
|
-
until?: undefined;
|
|
152
|
-
sql?: undefined;
|
|
153
|
-
params?: undefined;
|
|
154
|
-
path?: undefined;
|
|
155
|
-
content?: undefined;
|
|
156
|
-
contentBase64?: undefined;
|
|
157
|
-
contentType?: undefined;
|
|
158
|
-
prefix?: undefined;
|
|
159
|
-
cursor?: undefined;
|
|
160
|
-
};
|
|
161
|
-
required: string[];
|
|
162
|
-
};
|
|
163
|
-
} | {
|
|
164
|
-
name: string;
|
|
165
|
-
description: string;
|
|
166
|
-
input_schema: {
|
|
167
|
-
type: string;
|
|
168
|
-
properties: {
|
|
169
|
-
store: {
|
|
170
|
-
type: string;
|
|
171
|
-
description: string;
|
|
172
|
-
};
|
|
173
|
-
sql: {
|
|
174
|
-
type: string;
|
|
175
|
-
description: string;
|
|
176
|
-
};
|
|
177
|
-
params: {
|
|
178
|
-
type: string;
|
|
179
|
-
description: string;
|
|
180
|
-
};
|
|
181
|
-
record?: undefined;
|
|
182
|
-
description?: undefined;
|
|
183
|
-
agent?: undefined;
|
|
184
|
-
select?: undefined;
|
|
185
|
-
where?: undefined;
|
|
186
|
-
groupBy?: undefined;
|
|
187
|
-
orderBy?: undefined;
|
|
188
|
-
limit?: undefined;
|
|
189
|
-
since?: undefined;
|
|
190
|
-
until?: undefined;
|
|
191
|
-
name?: undefined;
|
|
192
|
-
type?: undefined;
|
|
193
|
-
path?: undefined;
|
|
194
|
-
content?: undefined;
|
|
195
|
-
contentBase64?: undefined;
|
|
196
|
-
contentType?: undefined;
|
|
197
|
-
prefix?: undefined;
|
|
198
|
-
cursor?: undefined;
|
|
199
|
-
};
|
|
200
|
-
required: string[];
|
|
201
|
-
};
|
|
202
|
-
} | {
|
|
203
|
-
name: string;
|
|
204
|
-
description: string;
|
|
205
|
-
input_schema: {
|
|
206
|
-
type: string;
|
|
207
|
-
properties: {
|
|
208
|
-
store: {
|
|
209
|
-
type: string;
|
|
210
|
-
description: string;
|
|
211
|
-
};
|
|
212
|
-
path: {
|
|
213
|
-
type: string;
|
|
214
|
-
description: string;
|
|
215
|
-
};
|
|
216
|
-
content: {
|
|
217
|
-
type: string;
|
|
218
|
-
description: string;
|
|
219
|
-
};
|
|
220
|
-
contentBase64: {
|
|
221
|
-
type: string;
|
|
222
|
-
description: string;
|
|
223
|
-
};
|
|
224
|
-
contentType: {
|
|
225
|
-
type: string;
|
|
226
|
-
description: string;
|
|
227
|
-
};
|
|
228
|
-
record?: undefined;
|
|
229
|
-
description?: undefined;
|
|
230
|
-
agent?: undefined;
|
|
231
|
-
select?: undefined;
|
|
232
|
-
where?: undefined;
|
|
233
|
-
groupBy?: undefined;
|
|
234
|
-
orderBy?: undefined;
|
|
235
|
-
limit?: undefined;
|
|
236
|
-
since?: undefined;
|
|
237
|
-
until?: undefined;
|
|
238
|
-
name?: undefined;
|
|
239
|
-
type?: undefined;
|
|
240
|
-
sql?: undefined;
|
|
241
|
-
params?: undefined;
|
|
242
|
-
prefix?: undefined;
|
|
243
|
-
cursor?: undefined;
|
|
244
|
-
};
|
|
245
|
-
required: string[];
|
|
246
|
-
};
|
|
247
|
-
} | {
|
|
248
|
-
name: string;
|
|
249
|
-
description: string;
|
|
250
|
-
input_schema: {
|
|
251
|
-
type: string;
|
|
252
|
-
properties: {
|
|
253
|
-
store: {
|
|
254
|
-
type: string;
|
|
255
|
-
description: string;
|
|
256
|
-
};
|
|
257
|
-
path: {
|
|
258
|
-
type: string;
|
|
259
|
-
description: string;
|
|
260
|
-
};
|
|
261
|
-
record?: undefined;
|
|
262
|
-
description?: undefined;
|
|
263
|
-
agent?: undefined;
|
|
264
|
-
select?: undefined;
|
|
265
|
-
where?: undefined;
|
|
266
|
-
groupBy?: undefined;
|
|
267
|
-
orderBy?: undefined;
|
|
268
|
-
limit?: undefined;
|
|
269
|
-
since?: undefined;
|
|
270
|
-
until?: undefined;
|
|
271
|
-
name?: undefined;
|
|
272
|
-
type?: undefined;
|
|
273
|
-
sql?: undefined;
|
|
274
|
-
params?: undefined;
|
|
275
|
-
content?: undefined;
|
|
276
|
-
contentBase64?: undefined;
|
|
277
|
-
contentType?: undefined;
|
|
278
|
-
prefix?: undefined;
|
|
279
|
-
cursor?: undefined;
|
|
280
|
-
};
|
|
281
|
-
required: string[];
|
|
282
|
-
};
|
|
283
|
-
} | {
|
|
284
|
-
name: string;
|
|
285
|
-
description: string;
|
|
286
|
-
input_schema: {
|
|
287
|
-
type: string;
|
|
288
|
-
properties: {
|
|
289
|
-
store: {
|
|
290
|
-
type: string;
|
|
291
|
-
description: string;
|
|
292
|
-
};
|
|
293
|
-
prefix: {
|
|
294
|
-
type: string;
|
|
295
|
-
description: string;
|
|
296
|
-
};
|
|
297
|
-
limit: {
|
|
298
|
-
type: string;
|
|
299
|
-
description: string;
|
|
300
|
-
};
|
|
301
|
-
cursor: {
|
|
302
|
-
type: string;
|
|
303
|
-
description: string;
|
|
304
|
-
};
|
|
305
|
-
record?: undefined;
|
|
306
|
-
description?: undefined;
|
|
307
|
-
agent?: undefined;
|
|
308
|
-
select?: undefined;
|
|
309
|
-
where?: undefined;
|
|
310
|
-
groupBy?: undefined;
|
|
311
|
-
orderBy?: undefined;
|
|
312
|
-
since?: undefined;
|
|
313
|
-
until?: undefined;
|
|
314
|
-
name?: undefined;
|
|
315
|
-
type?: undefined;
|
|
316
|
-
sql?: undefined;
|
|
317
|
-
params?: undefined;
|
|
318
|
-
path?: undefined;
|
|
319
|
-
content?: undefined;
|
|
320
|
-
contentBase64?: undefined;
|
|
321
|
-
contentType?: undefined;
|
|
322
|
-
};
|
|
323
|
-
required: any[];
|
|
324
|
-
};
|
|
325
|
-
})[];
|
|
326
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* datasetStore.js — durable, queryable structured-artifact store skill.
|
|
3
|
+
*
|
|
4
|
+
* WHAT IT IS
|
|
5
|
+
* ──────────
|
|
6
|
+
* A hand-written multi-tool skill (same shape as kvMemory.js / reviewMemory.js /
|
|
7
|
+
* github.js): `serverName`, `allowedTools`, `tools[]`, `handleToolCall`, and a
|
|
8
|
+
* `resolve()` that spawns the GENERIC bin/mcp-skill.mjs. Unlike kv-memory (a
|
|
9
|
+
* key→value MEMORY for picking up where a prior run left off), this is a durable
|
|
10
|
+
* STRUCTURED-RECORD store: an agent appends arbitrary JSON records to a named
|
|
11
|
+
* store and later runs SQL-style queries/aggregations over them — e.g. to
|
|
12
|
+
* accumulate metrics across runs and produce a report.
|
|
13
|
+
*
|
|
14
|
+
* STORES v2 — NAME-BASED RESOLUTION (the shared contract)
|
|
15
|
+
* ────────────────────────────────────────────────────────
|
|
16
|
+
* Stores are auto-provisioned at DEPLOY and resolved at runtime BY NAME via env:
|
|
17
|
+
* - The run carries one `ZIBBY_STORE__<name> = <storeId>` per bound store.
|
|
18
|
+
* - The agent reads the injected "AVAILABLE STORES" prompt catalog (name +
|
|
19
|
+
* description), picks one, and passes the chosen logical `name` to the tool.
|
|
20
|
+
* - This name→storeId env map is BOTH the allowlist AND the resolver: the
|
|
21
|
+
* agent can only ever write to a declared/bound name (anti-fragmentation).
|
|
22
|
+
*
|
|
23
|
+
* BACKEND (already built — NO change here)
|
|
24
|
+
* ─────────────────────────────────────────
|
|
25
|
+
* Two routes on the SAME base URL kv-memory uses (getAccountApiUrl(), prod
|
|
26
|
+
* https://api-prod.zibby.app), authed with the SAME Bearer project token
|
|
27
|
+
* (getSessionToken()):
|
|
28
|
+
* - POST {base}/datasets/stores/{storeId}/append body { record, agent }
|
|
29
|
+
* → { ok, id, ts }
|
|
30
|
+
* - POST {base}/datasets/stores/{storeId}/query body { select?, where?,
|
|
31
|
+
* groupBy?, orderBy?, limit?, since?, until?, agent? }
|
|
32
|
+
* → { ok, rowCount, columns, rows }
|
|
33
|
+
* Plus the per-type data routes on the same base: /sql (sqlite stores) and
|
|
34
|
+
* /put /get /list /delete (file stores — blob storage by relative path).
|
|
35
|
+
* The `storeId` lives in the URL path. Tenancy (account + project) is enforced
|
|
36
|
+
* SERVER-SIDE from the Bearer token — the skill NEVER sends account/project.
|
|
37
|
+
*
|
|
38
|
+
* AUTOMATIC PER-AGENT TAGGING
|
|
39
|
+
* ────────────────────────────
|
|
40
|
+
* Appends default `agent` to the writing agent's namespace (WORKFLOW_TYPE,
|
|
41
|
+
* falling back to the literal 'agent'), so records are auto-tagged with who
|
|
42
|
+
* wrote them and `query`'s optional `agent` filter can scope to one writer.
|
|
43
|
+
*
|
|
44
|
+
* AUTH — identical to kvMemory.js / reviewMemory.js
|
|
45
|
+
* ──────────────────────────────────────────────────
|
|
46
|
+
* Calls ZIBBY'S OWN backend with PROJECT_API_TOKEN (Bearer) against
|
|
47
|
+
* ZIBBY_ACCOUNT_API_URL (default api-prod.zibby.app). Mirrors
|
|
48
|
+
* @zibby/core/backend-client.js getSessionToken()/getAccountApiUrl() rather than
|
|
49
|
+
* importing a non-existent helper, so the auth model stays identical.
|
|
50
|
+
*/
|
|
51
|
+
export declare function __clearEnsuredStores(): void;
|
|
52
|
+
export declare const datasetStoreSkill: any;
|
package/dist/datasetStore.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as f,readFileSync as b}from"node:fs";import{homedir as T}from"node:os";import{join as S,dirname as O,resolve as w}from"node:path";import{fileURLToPath as _}from"node:url";function A(){if(process.env.MCP_SKILL_PATH)return process.env.MCP_SKILL_PATH;let n=O(_(import.meta.url)),t=w(n,"..","bin","mcp-skill.mjs");return f(t)?t:null}function m(){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 n=S(T(),".zibby","config.json");return f(n)&&JSON.parse(b(n,"utf-8")).sessionToken||null}catch{return null}}function h(){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 y(){return(typeof process.env.WORKFLOW_TYPE=="string"?process.env.WORKFLOW_TYPE.trim():"")||"agent"}function I(){let n={};for(let[t,e]of Object.entries(process.env)){let r=/^ZIBBY_STORE__(.+)$/.exec(t);if(!r)continue;let o=typeof e=="string"?e.trim():"";o&&(n[r[1]]=o)}return n}var u={};function P(){for(let n of Object.keys(u))delete u[n]}function d(n){let t={...I(),...u},e=Object.keys(t),r=typeof n=="string"?n.trim():"";return r?Object.prototype.hasOwnProperty.call(t,r)?{storeId:t[r],name:r}:{error:`unknown store '${r}'; 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 N(n){let t=m();if(!t)throw new Error("No backend credential (PROJECT_API_TOKEN). Stores are only available inside a Zibby run.");let e=await fetch(`${h()}/datasets/stores/ensure`,{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok){let r=await e.text().catch(()=>"");throw new Error(`ensure_store failed (${e.status}): ${r.slice(0,300)}`)}return e.json()}async function a(n,t,e){let r=m();if(!r)throw new Error("No backend credential (PROJECT_API_TOKEN). Dataset store is only available inside a Zibby run.");let o=`${h()}/datasets/stores/${encodeURIComponent(n)}/${t}`,s=await fetch(o,{method:"POST",headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){let i=await s.text().catch(()=>"");throw new Error(`Store ${t} failed (${s.status}): ${i.slice(0,300)}`)}return s.json()}var L=Math.floor(3.5*1024*1024);async function B(n,t,e,r){let o=await a(n,"put-url",{path:t,contentType:r});if(!o?.url)throw new Error("put-url did not return an upload URL");let s=await fetch(o.url,{method:o.method||"PUT",headers:o.headers||{"Content-Type":r},body:e});if(!s.ok){let i=await s.text().catch(()=>"");throw new Error(`direct upload failed (${s.status}): ${i.slice(0,200)}`)}return{ok:!0,path:o.path||t,size:e.length,contentType:o.contentType||r,via:"presign"}}async function R(n,t){let e=await a(n,"get-url",{path:t});if(!e?.url)throw new Error("get-url did not return a download URL");let r=await fetch(e.url,{method:e.method||"GET"});if(!r.ok){let s=await r.text().catch(()=>"");throw new Error(`direct download failed (${r.status}): ${s.slice(0,200)}`)}let o=await r.arrayBuffer();return{buf:Buffer.from(o),contentType:r.headers.get("content-type")||"application/octet-stream"}}var C={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
2
|
You have one or more durable stores for STRUCTURED records that survive across
|
|
3
3
|
your stateless runs. Unlike key-value memory (for picking up where you left
|
|
4
4
|
off), this is for accumulating DATA you want to QUERY and AGGREGATE later \u2014 e.g.
|
|
@@ -37,10 +37,12 @@ Tools:
|
|
|
37
37
|
- sqlite_query: (sqlite stores) Run a SELECT (optionally with \`params\` for safe
|
|
38
38
|
binding). Returns { columns, rows }. Read-only \u2014 never changes data.
|
|
39
39
|
- file_put: (file stores) Write/overwrite ONE file at a relative path (text or
|
|
40
|
-
base64 binary
|
|
40
|
+
base64 binary). Large files are supported \u2014 they upload directly to storage,
|
|
41
|
+
no size limit you need to worry about.
|
|
41
42
|
- file_get: (file stores) Read a file back (text returned as text, binary as
|
|
42
|
-
base64).
|
|
43
|
+
base64). Large files download directly from storage; the content still comes
|
|
44
|
+
back inline.
|
|
43
45
|
- file_list: (file stores) List stored files (optionally by path prefix).
|
|
44
46
|
- file_delete: (file stores) Delete ONE file by path.
|
|
45
47
|
Pick the tool that matches the store's TYPE; using a dataset tool on a sqlite
|
|
46
|
-
store (or a file tool on either, etc.) is rejected.`,resolve(){let o=T();if(!o)return{command:null,args:[],env:{},description:this.description};let e={};for(let t of["PROJECT_API_TOKEN","ZIBBY_ACCOUNT_API_URL","ZIBBY_ENV","ZIBBY_PROD_ACCOUNT_API_URL","ZIBBY_USER_TOKEN","WORKFLOW_TYPE"])process.env[t]&&(e[t]=process.env[t]);for(let t of Object.keys(process.env))/^ZIBBY_STORE__.+$/.test(t)&&process.env[t]&&(e[t]=process.env[t]);return{type:"stdio",command:"node",args:[o,"../dist/datasetStore.js","datasetStoreSkill"],env:e,description:this.description,alwaysLoad:!1}},async handleToolCall(o,e){try{switch(o){case"dataset_append":{if(e?.record==null||typeof e.record!="object"||Array.isArray(e.record))return JSON.stringify({error:"record is required (a JSON object)"});let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});let r=typeof e?.agent=="string"&&e.agent.trim()?e.agent.trim():d(),s={record:e.record,agent:r};typeof e?.description=="string"&&e.description.trim()&&(s.description=e.description.trim());let i=await c(t.storeId,"append",s);return JSON.stringify({...i,store:t.name,storeId:t.storeId})}case"dataset_query":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});let r={};for(let i of["select","where","groupBy","orderBy","limit","since","until","agent"])e?.[i]!=null&&(r[i]=e[i]);let s=await c(t.storeId,"query",r);return JSON.stringify({...s,store:t.name,storeId:t.storeId})}case"ensure_store":{let t=typeof e?.name=="string"?e.name.trim():"";if(!t)return JSON.stringify({error:"name is required"});let r=typeof e?.type=="string"&&e.type.trim()?e.type.trim().toLowerCase():"sqlite",s=typeof e?.description=="string"?e.description.trim():"",i=await O({name:t,type:r,description:s,namespace:d()});return i?.storeId&&(p[t]=i.storeId),JSON.stringify({...i,store:t})}case"file_put":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.path!="string"||!e.path.trim())return JSON.stringify({error:'path is required (a relative file path like "reports/2026-07.json")'});let r=typeof e?.content=="string",s=typeof e?.contentBase64=="string"&&e.contentBase64.length>0;if(!r&&!s)return JSON.stringify({error:"content (text) or contentBase64 (base64 bytes) is required"});let i={path:e.path.trim()};r?i.content=e.content:i.contentBase64=e.contentBase64,typeof e?.contentType=="string"&&e.contentType.trim()&&(i.contentType=e.contentType.trim());let n=await c(t.storeId,"put",i);return JSON.stringify({...n,store:t.name,storeId:t.storeId})}case"file_get":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.path!="string"||!e.path.trim())return JSON.stringify({error:"path is required"});let r=await c(t.storeId,"get",{path:e.path.trim()}),s={ok:!0,store:t.name,storeId:t.storeId,path:r.path,size:r.size,contentType:r.contentType,lastModified:r.lastModified},i=Buffer.from(r.contentBase64||"","base64"),n=i.toString("utf8");return Buffer.compare(Buffer.from(n,"utf8"),i)===0&&!n.includes("\0")?(s.content=n,s.encoding="utf8"):(s.contentBase64=r.contentBase64,s.encoding="base64"),JSON.stringify(s)}case"file_list":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});let r={};typeof e?.prefix=="string"&&e.prefix.trim()&&(r.prefix=e.prefix.trim()),e?.limit!=null&&(r.limit=e.limit),typeof e?.cursor=="string"&&e.cursor&&(r.cursor=e.cursor);let s=await c(t.storeId,"list",r);return JSON.stringify({...s,store:t.name,storeId:t.storeId})}case"file_delete":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.path!="string"||!e.path.trim())return JSON.stringify({error:"path is required"});let r=await c(t.storeId,"delete",{path:e.path.trim()});return JSON.stringify({...r,store:t.name,storeId:t.storeId})}case"sqlite_exec":case"sqlite_query":{let t=a(e?.store);if(t.error)return JSON.stringify({error:t.error});if(typeof e?.sql!="string"||!e.sql.trim())return JSON.stringify({error:"sql is required (a non-empty SQL string)"});let r={sql:e.sql};Array.isArray(e?.params)&&(r.params=e.params);let s=await c(t.storeId,"sql",r);return JSON.stringify({...s,store:t.name,storeId:t.storeId})}default:return JSON.stringify({error:`Unknown tool: ${o}`})}}catch(t){return JSON.stringify({error:t.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:[]}},{name:"ensure_store",description:'Create (or reuse) a store ON DEMAND for THIS agent \u2014 use when you need a store that was NOT declared/bound at deploy. Idempotent by name and private to this agent: calling again with the same name returns the SAME store (safe to call at the start of every run). Returns { storeId }. For type "sqlite" you then define schema with sqlite_exec (CREATE TABLE IF NOT EXISTS) and read/write via sqlite_exec/sqlite_query using this name.',input_schema:{type:"object",properties:{name:{type:"string",description:'A short logical name for the store (e.g. "linkedin_posts"). Letters, digits, _ and - only.'},type:{type:"string",enum:["sqlite","dataset","file"],description:'Store type. "sqlite" (default) = a mutable relational DB whose schema YOU define with SQL. "dataset" = append-only JSON records for later aggregation/analytics. "file" = arbitrary file/blob storage by relative path (file_put/file_get/file_list/file_delete).'},description:{type:"string",description:"What this store is for (shown in the Storage UI)."}},required:["name"]}},{name:"sqlite_exec",description:"For SQLITE-type stores: run SQL that CHANGES data \u2014 CREATE TABLE (use IF NOT EXISTS), INSERT, UPDATE, DELETE (one or more statements in one call). The store is a real, mutable SQLite database that persists across your stateless runs. Returns { rowsModified, wrote }. Use this to build schema on the fly and to update rows / track changing state (e.g. a queue with a status column).",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:'The SQL to run. May contain multiple statements separated by ";". Prefer CREATE TABLE IF NOT EXISTS for idempotent schema.'},params:{type:"array",description:'Optional positional bind params for a SINGLE parameterized statement (safe binding of values), e.g. sql "UPDATE t SET s=? WHERE id=?" with params ["done", 1].'}},required:["sql"]}},{name:"sqlite_query",description:"For SQLITE-type stores: run a read-only SELECT (optionally with `params` for safe binding) against the store's SQLite database. Returns { columns, rows }. Never changes data. Use to read back rows/state you stored earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:"A single SELECT statement. Use ? placeholders + `params` for any values."},params:{type:"array",description:'Optional positional bind params for the SELECT, e.g. ["linkedin_personal"].'}},required:["sql"]}},{name:"file_put",description:"For FILE-type stores: write (or overwrite) ONE file at a relative path \u2014 raw JSON dumps, CSVs, images, snapshots, any blob you want to keep across your stateless runs. Text goes in `content`; binary goes base64-encoded in `contentBase64` (pass exactly one). Max 4 MiB per file. Overwriting the same path UPDATES the file. Returns { ok, path, size }.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},path:{type:"string",description:'Relative file path, e.g. "dumps/run-42.json" or "img/chart.png". Letters, digits, ".", "_", "-" and "/" only; no "..", no leading "/".'},content:{type:"string",description:"Text content (UTF-8). Use for JSON/CSV/text files."},contentBase64:{type:"string",description:"Base64-encoded binary content (images etc.). Alternative to `content`."},contentType:{type:"string",description:'Optional MIME type (e.g. "application/json", "image/png"). Defaults sensibly.'}},required:["path"]}},{name:"file_get",description:'For FILE-type stores: read ONE stored file back by its relative path. Text files come back as `content` (encoding "utf8"); binary files come back as `contentBase64` (encoding "base64"). Returns { path, size, contentType, lastModified, content|contentBase64, encoding }.',input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},path:{type:"string",description:"The relative file path to fetch (as listed by file_list / used in file_put)."}},required:["path"]}},{name:"file_list",description:'For FILE-type stores: list the stored files \u2014 each entry has { path, size, lastModified }. Optionally filter by a path `prefix` (e.g. "dumps/"). Paginated via `cursor` when there are more results.',input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},prefix:{type:"string",description:'Optional path prefix filter, e.g. "dumps/" or "reports/2026".'},limit:{type:"number",description:"Max entries to return (default/max 1000)."},cursor:{type:"string",description:"Pagination cursor from a previous file_list response (nextCursor)."}},required:[]}},{name:"file_delete",description:"For FILE-type stores: delete ONE stored file by its relative path. Returns { ok, path, deleted }. Errors if the path does not exist.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},path:{type:"string",description:"The relative file path to delete."}},required:["path"]}}]};export{w as __clearEnsuredStores,L as datasetStoreSkill};
|
|
48
|
+
store (or a file tool on either, etc.) is rejected.`,resolve(){let n=A();if(!n)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:[n,"../dist/datasetStore.js","datasetStoreSkill"],env:t,description:this.description,alwaysLoad:!1}},async handleToolCall(n,t){try{switch(n){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=d(t?.store);if(e.error)return JSON.stringify({error:e.error});let r=typeof t?.agent=="string"&&t.agent.trim()?t.agent.trim():y(),o={record:t.record,agent:r};typeof t?.description=="string"&&t.description.trim()&&(o.description=t.description.trim());let s=await a(e.storeId,"append",o);return JSON.stringify({...s,store:e.name,storeId:e.storeId})}case"dataset_query":{let e=d(t?.store);if(e.error)return JSON.stringify({error:e.error});let r={};for(let s of["select","where","groupBy","orderBy","limit","since","until","agent"])t?.[s]!=null&&(r[s]=t[s]);let o=await a(e.storeId,"query",r);return JSON.stringify({...o,store:e.name,storeId:e.storeId})}case"ensure_store":{let e=typeof t?.name=="string"?t.name.trim():"";if(!e)return JSON.stringify({error:"name is required"});let r=typeof t?.type=="string"&&t.type.trim()?t.type.trim().toLowerCase():"sqlite",o=typeof t?.description=="string"?t.description.trim():"",s=await N({name:e,type:r,description:o,namespace:y()});return s?.storeId&&(u[e]=s.storeId),JSON.stringify({...s,store:e})}case"file_put":{let e=d(t?.store);if(e.error)return JSON.stringify({error:e.error});if(typeof t?.path!="string"||!t.path.trim())return JSON.stringify({error:'path is required (a relative file path like "reports/2026-07.json")'});let r=typeof t?.content=="string",o=typeof t?.contentBase64=="string"&&t.contentBase64.length>0;if(!r&&!o)return JSON.stringify({error:"content (text) or contentBase64 (base64 bytes) is required"});let s=t.path.trim(),i=typeof t?.contentType=="string"&&t.contentType.trim()?t.contentType.trim():"",p=r?Buffer.from(t.content,"utf8"):Buffer.from(String(t.contentBase64).replace(/\s+/g,""),"base64");if(p.length>L){let g=i||(r?"text/plain; charset=utf-8":"application/octet-stream"),E=await B(e.storeId,s,p,g);return JSON.stringify({...E,store:e.name,storeId:e.storeId})}let c={path:s};r?c.content=t.content:c.contentBase64=t.contentBase64,i&&(c.contentType=i);let l=await a(e.storeId,"put",c);return JSON.stringify({...l,store:e.name,storeId:e.storeId})}case"file_get":{let e=d(t?.store);if(e.error)return JSON.stringify({error:e.error});if(typeof t?.path!="string"||!t.path.trim())return JSON.stringify({error:"path is required"});let r=t.path.trim(),o;try{o=await a(e.storeId,"get",{path:r})}catch(c){if(!/failed \(413\)/.test(c?.message||""))throw c;let l=await R(e.storeId,r);o={path:r,size:l.buf.length,contentType:l.contentType,lastModified:null,contentBase64:l.buf.toString("base64")}}let s={ok:!0,store:e.name,storeId:e.storeId,path:o.path,size:o.size,contentType:o.contentType,lastModified:o.lastModified},i=Buffer.from(o.contentBase64||"","base64"),p=i.toString("utf8");return Buffer.compare(Buffer.from(p,"utf8"),i)===0&&!p.includes("\0")?(s.content=p,s.encoding="utf8"):(s.contentBase64=o.contentBase64,s.encoding="base64"),JSON.stringify(s)}case"file_list":{let e=d(t?.store);if(e.error)return JSON.stringify({error:e.error});let r={};typeof t?.prefix=="string"&&t.prefix.trim()&&(r.prefix=t.prefix.trim()),t?.limit!=null&&(r.limit=t.limit),typeof t?.cursor=="string"&&t.cursor&&(r.cursor=t.cursor);let o=await a(e.storeId,"list",r);return JSON.stringify({...o,store:e.name,storeId:e.storeId})}case"file_delete":{let e=d(t?.store);if(e.error)return JSON.stringify({error:e.error});if(typeof t?.path!="string"||!t.path.trim())return JSON.stringify({error:"path is required"});let r=await a(e.storeId,"delete",{path:t.path.trim()});return JSON.stringify({...r,store:e.name,storeId:e.storeId})}case"sqlite_exec":case"sqlite_query":{let e=d(t?.store);if(e.error)return JSON.stringify({error:e.error});if(typeof t?.sql!="string"||!t.sql.trim())return JSON.stringify({error:"sql is required (a non-empty SQL string)"});let r={sql:t.sql};Array.isArray(t?.params)&&(r.params=t.params);let o=await a(e.storeId,"sql",r);return JSON.stringify({...o,store:e.name,storeId:e.storeId})}default:return JSON.stringify({error:`Unknown tool: ${n}`})}}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:[]}},{name:"ensure_store",description:'Create (or reuse) a store ON DEMAND for THIS agent \u2014 use when you need a store that was NOT declared/bound at deploy. Idempotent by name and private to this agent: calling again with the same name returns the SAME store (safe to call at the start of every run). Returns { storeId }. For type "sqlite" you then define schema with sqlite_exec (CREATE TABLE IF NOT EXISTS) and read/write via sqlite_exec/sqlite_query using this name.',input_schema:{type:"object",properties:{name:{type:"string",description:'A short logical name for the store (e.g. "linkedin_posts"). Letters, digits, _ and - only.'},type:{type:"string",enum:["sqlite","dataset","file"],description:'Store type. "sqlite" (default) = a mutable relational DB whose schema YOU define with SQL. "dataset" = append-only JSON records for later aggregation/analytics. "file" = arbitrary file/blob storage by relative path (file_put/file_get/file_list/file_delete).'},description:{type:"string",description:"What this store is for (shown in the Storage UI)."}},required:["name"]}},{name:"sqlite_exec",description:"For SQLITE-type stores: run SQL that CHANGES data \u2014 CREATE TABLE (use IF NOT EXISTS), INSERT, UPDATE, DELETE (one or more statements in one call). The store is a real, mutable SQLite database that persists across your stateless runs. Returns { rowsModified, wrote }. Use this to build schema on the fly and to update rows / track changing state (e.g. a queue with a status column).",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:'The SQL to run. May contain multiple statements separated by ";". Prefer CREATE TABLE IF NOT EXISTS for idempotent schema.'},params:{type:"array",description:'Optional positional bind params for a SINGLE parameterized statement (safe binding of values), e.g. sql "UPDATE t SET s=? WHERE id=?" with params ["done", 1].'}},required:["sql"]}},{name:"sqlite_query",description:"For SQLITE-type stores: run a read-only SELECT (optionally with `params` for safe binding) against the store's SQLite database. Returns { columns, rows }. Never changes data. Use to read back rows/state you stored earlier.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a sqlite-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},sql:{type:"string",description:"A single SELECT statement. Use ? placeholders + `params` for any values."},params:{type:"array",description:'Optional positional bind params for the SELECT, e.g. ["linkedin_personal"].'}},required:["sql"]}},{name:"file_put",description:"For FILE-type stores: write (or overwrite) ONE file at a relative path \u2014 raw JSON dumps, CSVs, images, snapshots, any blob you want to keep across your stateless runs. Text goes in `content`; binary goes base64-encoded in `contentBase64` (pass exactly one). Max 4 MiB per file. Overwriting the same path UPDATES the file. Returns { ok, path, size }.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES) \u2014 pick by description. NOT an id. If exactly one store is bound you may omit this."},path:{type:"string",description:'Relative file path, e.g. "dumps/run-42.json" or "img/chart.png". Letters, digits, ".", "_", "-" and "/" only; no "..", no leading "/".'},content:{type:"string",description:"Text content (UTF-8). Use for JSON/CSV/text files."},contentBase64:{type:"string",description:"Base64-encoded binary content (images etc.). Alternative to `content`."},contentType:{type:"string",description:'Optional MIME type (e.g. "application/json", "image/png"). Defaults sensibly.'}},required:["path"]}},{name:"file_get",description:'For FILE-type stores: read ONE stored file back by its relative path. Text files come back as `content` (encoding "utf8"); binary files come back as `contentBase64` (encoding "base64"). Returns { path, size, contentType, lastModified, content|contentBase64, encoding }.',input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},path:{type:"string",description:"The relative file path to fetch (as listed by file_list / used in file_put)."}},required:["path"]}},{name:"file_list",description:'For FILE-type stores: list the stored files \u2014 each entry has { path, size, lastModified }. Optionally filter by a path `prefix` (e.g. "dumps/"). Paginated via `cursor` when there are more results.',input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},prefix:{type:"string",description:'Optional path prefix filter, e.g. "dumps/" or "reports/2026".'},limit:{type:"number",description:"Max entries to return (default/max 1000)."},cursor:{type:"string",description:"Pagination cursor from a previous file_list response (nextCursor)."}},required:[]}},{name:"file_delete",description:"For FILE-type stores: delete ONE stored file by its relative path. Returns { ok, path, deleted }. Errors if the path does not exist.",input_schema:{type:"object",properties:{store:{type:"string",description:"The logical store NAME (a file-type store from AVAILABLE STORES). If exactly one store is bound you may omit this."},path:{type:"string",description:"The relative file path to delete."}},required:["path"]}}]};export{P as __clearEnsuredStores,C as datasetStoreSkill};
|
package/dist/discord.d.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discord integration — low-level API-wrapper skill.
|
|
3
|
+
*
|
|
4
|
+
* Lets an agent post messages into a Discord server the user's bot has been
|
|
5
|
+
* invited to, and discover the channels it can post to. Talks the Discord
|
|
6
|
+
* REST API (v10) directly with a static BOT token — no MCP server of its own;
|
|
7
|
+
* served over the GENERIC skill MCP binary (bin/mcp-skill.mjs), exactly like
|
|
8
|
+
* linear.js / github.js.
|
|
9
|
+
*
|
|
10
|
+
* AUTH (single chokepoint: resolveDiscordAuth):
|
|
11
|
+
* 1. resolveIntegrationToken('discord') — the Zibby-cloud path. The backend
|
|
12
|
+
* stores the bot token on the account's provider='discord' integration
|
|
13
|
+
* row (paste-based connect) and returns { token, guildId } from
|
|
14
|
+
* GET /integrations/token/discord.
|
|
15
|
+
* 2. DISCORD_BOT_TOKEN env — the self-host / local fallback (same pattern
|
|
16
|
+
* as linear.js's LINEAR_API_KEY): when the env token is present it wins,
|
|
17
|
+
* so a self-hosted run never needs the Zibby cloud at all.
|
|
18
|
+
*
|
|
19
|
+
* Discord auth header semantics (https://discord.com/developers/docs):
|
|
20
|
+
* Authorization: Bot <token>
|
|
21
|
+
* A raw token pasted without the "Bot " prefix gets it added here.
|
|
22
|
+
*
|
|
23
|
+
* FAIL-SOFT: handleToolCall never throws — every error path returns
|
|
24
|
+
* JSON.stringify({ ok:false, error }) so a notify step can't crash a workflow.
|
|
25
|
+
*
|
|
26
|
+
* Discord hard limit: message `content` is capped at 2000 chars — longer text
|
|
27
|
+
* is CHUNKED into sequential messages (split on line boundaries when possible)
|
|
28
|
+
* rather than truncated or rejected.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DISCORD_MAX_CONTENT = 2000;
|
|
1
31
|
/**
|
|
2
32
|
* Split `text` into Discord-postable chunks of <= DISCORD_MAX_CONTENT chars.
|
|
3
33
|
* Prefers newline boundaries so code blocks / paragraphs stay readable; falls
|
|
@@ -7,71 +37,5 @@
|
|
|
7
37
|
* @param {number} [max=DISCORD_MAX_CONTENT]
|
|
8
38
|
* @returns {string[]} non-empty chunks (empty input → []).
|
|
9
39
|
*/
|
|
10
|
-
export function chunkDiscordContent(text:
|
|
11
|
-
export const
|
|
12
|
-
export namespace discordSkill {
|
|
13
|
-
let id: string;
|
|
14
|
-
let serverName: string;
|
|
15
|
-
let allowedTools: string[];
|
|
16
|
-
let requiresIntegration: "discord";
|
|
17
|
-
let envKeys: string[];
|
|
18
|
-
let description: string;
|
|
19
|
-
let promptFragment: string;
|
|
20
|
-
/**
|
|
21
|
-
* Spawn spec for the GENERIC skill MCP server (bin/mcp-skill.mjs) pointed at
|
|
22
|
-
* this module's discordSkill export — the model gets real mcp__discord__*
|
|
23
|
-
* tools. Mirrors linear.js resolve() (see its docblock for the dist-relative
|
|
24
|
-
* module-path rationale). Env allow-list: the self-host token/guild vars +
|
|
25
|
-
* the backend-client vars resolveIntegrationToken needs in the child.
|
|
26
|
-
*/
|
|
27
|
-
function resolve(): {
|
|
28
|
-
command: any;
|
|
29
|
-
args: any[];
|
|
30
|
-
env: {};
|
|
31
|
-
description: string;
|
|
32
|
-
type?: undefined;
|
|
33
|
-
alwaysLoad?: undefined;
|
|
34
|
-
} | {
|
|
35
|
-
type: string;
|
|
36
|
-
command: string;
|
|
37
|
-
args: any[];
|
|
38
|
-
env: {};
|
|
39
|
-
description: string;
|
|
40
|
-
alwaysLoad: boolean;
|
|
41
|
-
};
|
|
42
|
-
function handleToolCall(name: any, args?: {}): Promise<string>;
|
|
43
|
-
let tools: ({
|
|
44
|
-
name: string;
|
|
45
|
-
description: string;
|
|
46
|
-
input_schema: {
|
|
47
|
-
type: string;
|
|
48
|
-
properties: {
|
|
49
|
-
channelId: {
|
|
50
|
-
type: string;
|
|
51
|
-
description: string;
|
|
52
|
-
};
|
|
53
|
-
text: {
|
|
54
|
-
type: string;
|
|
55
|
-
description: string;
|
|
56
|
-
};
|
|
57
|
-
guildId?: undefined;
|
|
58
|
-
};
|
|
59
|
-
required: string[];
|
|
60
|
-
};
|
|
61
|
-
} | {
|
|
62
|
-
name: string;
|
|
63
|
-
description: string;
|
|
64
|
-
input_schema: {
|
|
65
|
-
type: string;
|
|
66
|
-
properties: {
|
|
67
|
-
guildId: {
|
|
68
|
-
type: string;
|
|
69
|
-
description: string;
|
|
70
|
-
};
|
|
71
|
-
channelId?: undefined;
|
|
72
|
-
text?: undefined;
|
|
73
|
-
};
|
|
74
|
-
required?: undefined;
|
|
75
|
-
};
|
|
76
|
-
})[];
|
|
77
|
-
}
|
|
40
|
+
export declare function chunkDiscordContent(text: any, max?: number): any[];
|
|
41
|
+
export declare const discordSkill: any;
|