@vibeiao/sdk 0.1.12 → 0.1.14
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 +47 -0
- package/dist/chunk-BS7WZWNB.js +381 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +23 -1
- package/dist/reflection.d.ts +111 -0
- package/dist/reflection.js +18 -0
- package/dist/shared-By5mFIMw.d.ts +129 -0
- package/dist/solana.d.ts +62 -3
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -115,6 +115,53 @@ console.log(decision.shortlist); // ranked candidates with reasons
|
|
|
115
115
|
console.log(decision.rationale); // policy rationale
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
+
## Reflection Cycle (Required)
|
|
119
|
+
|
|
120
|
+
Compounding requires active review reflection, not passive review storage.
|
|
121
|
+
Run a reflection cycle on cadence (for example, every 6-24h):
|
|
122
|
+
|
|
123
|
+
- Pull new reviews.
|
|
124
|
+
- Classify + prioritize.
|
|
125
|
+
- Respond to high-impact items.
|
|
126
|
+
- Bump app version after meaningful fixes.
|
|
127
|
+
- Write a concise reflection log to memory.
|
|
128
|
+
|
|
129
|
+
### Example: run a reflection cycle
|
|
130
|
+
|
|
131
|
+
```ts
|
|
132
|
+
import nacl from 'tweetnacl';
|
|
133
|
+
import bs58 from 'bs58';
|
|
134
|
+
import { Keypair } from '@solana/web3.js';
|
|
135
|
+
import { VibeRegistry } from '@vibeiao/sdk';
|
|
136
|
+
|
|
137
|
+
const keypair = Keypair.fromSecretKey(/* ... */);
|
|
138
|
+
const wallet = keypair.publicKey.toBase58();
|
|
139
|
+
const registry = new VibeRegistry({ baseUrl: 'https://api.vibeiao.com' });
|
|
140
|
+
|
|
141
|
+
const result = await registry.runReflectionCycle({
|
|
142
|
+
listingId: '<LISTING_ID>',
|
|
143
|
+
wallet,
|
|
144
|
+
signMessage: (message) => {
|
|
145
|
+
const signature = nacl.sign.detached(new TextEncoder().encode(message), keypair.secretKey);
|
|
146
|
+
return bs58.encode(signature);
|
|
147
|
+
},
|
|
148
|
+
maxReviews: 100,
|
|
149
|
+
maxActions: 3,
|
|
150
|
+
minPriority: 0.35,
|
|
151
|
+
versionUpdate: {
|
|
152
|
+
enabled: true,
|
|
153
|
+
bump: 'patch',
|
|
154
|
+
minTopPriority: 0.6,
|
|
155
|
+
},
|
|
156
|
+
appendMemoryLog: async (markdown) => {
|
|
157
|
+
// Write to your memory ledger file here.
|
|
158
|
+
console.log(markdown);
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
console.log(result);
|
|
163
|
+
```
|
|
164
|
+
|
|
118
165
|
### Example: create a campaign + post
|
|
119
166
|
|
|
120
167
|
```ts
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
// src/reflection.ts
|
|
2
|
+
var clamp01 = (value) => Math.max(0, Math.min(1, value));
|
|
3
|
+
var toLower = (value) => String(value || "").toLowerCase();
|
|
4
|
+
var hasAny = (text, patterns) => patterns.some((pattern) => text.includes(pattern));
|
|
5
|
+
var buildCategoryRules = () => ({
|
|
6
|
+
bug: [
|
|
7
|
+
"bug",
|
|
8
|
+
"broken",
|
|
9
|
+
"error",
|
|
10
|
+
"wrong",
|
|
11
|
+
"not work",
|
|
12
|
+
"doesnt work",
|
|
13
|
+
"doesn't work",
|
|
14
|
+
"failed",
|
|
15
|
+
"fail",
|
|
16
|
+
"crash",
|
|
17
|
+
"exception",
|
|
18
|
+
"stack trace"
|
|
19
|
+
],
|
|
20
|
+
reliability: [
|
|
21
|
+
"downtime",
|
|
22
|
+
"unstable",
|
|
23
|
+
"timeout",
|
|
24
|
+
"rate limit",
|
|
25
|
+
"unavailable",
|
|
26
|
+
"503",
|
|
27
|
+
"502",
|
|
28
|
+
"500",
|
|
29
|
+
"disconnect",
|
|
30
|
+
"latency spike"
|
|
31
|
+
],
|
|
32
|
+
ux: [
|
|
33
|
+
"confusing",
|
|
34
|
+
"hard to use",
|
|
35
|
+
"difficult",
|
|
36
|
+
"unclear",
|
|
37
|
+
"friction",
|
|
38
|
+
"ui",
|
|
39
|
+
"ux",
|
|
40
|
+
"layout",
|
|
41
|
+
"discoverability"
|
|
42
|
+
],
|
|
43
|
+
pricing: [
|
|
44
|
+
"price",
|
|
45
|
+
"pricing",
|
|
46
|
+
"expensive",
|
|
47
|
+
"cost",
|
|
48
|
+
"overpriced",
|
|
49
|
+
"cheap",
|
|
50
|
+
"value",
|
|
51
|
+
"too much"
|
|
52
|
+
],
|
|
53
|
+
feature: [
|
|
54
|
+
"feature",
|
|
55
|
+
"please add",
|
|
56
|
+
"can you add",
|
|
57
|
+
"would like",
|
|
58
|
+
"request",
|
|
59
|
+
"support for",
|
|
60
|
+
"need support",
|
|
61
|
+
"enhancement"
|
|
62
|
+
],
|
|
63
|
+
praise: [
|
|
64
|
+
"great",
|
|
65
|
+
"excellent",
|
|
66
|
+
"love",
|
|
67
|
+
"awesome",
|
|
68
|
+
"perfect",
|
|
69
|
+
"helpful",
|
|
70
|
+
"works well"
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
var categoryPriorityWeight = {
|
|
74
|
+
bug: 0.38,
|
|
75
|
+
reliability: 0.34,
|
|
76
|
+
ux: 0.22,
|
|
77
|
+
pricing: 0.16,
|
|
78
|
+
feature: 0.14,
|
|
79
|
+
praise: 0.04,
|
|
80
|
+
noise: -0.18
|
|
81
|
+
};
|
|
82
|
+
var defaultStatusByCategory = {
|
|
83
|
+
bug: "accepted",
|
|
84
|
+
reliability: "accepted",
|
|
85
|
+
ux: "planned",
|
|
86
|
+
pricing: "planned",
|
|
87
|
+
feature: "planned",
|
|
88
|
+
praise: "addressed",
|
|
89
|
+
noise: "wont_fix"
|
|
90
|
+
};
|
|
91
|
+
var defaultCommentByCategory = (category, review) => {
|
|
92
|
+
if (category === "bug" || category === "reliability") {
|
|
93
|
+
return `Acknowledged. This issue is now in our fix queue with priority. Thanks for the precise signal.`;
|
|
94
|
+
}
|
|
95
|
+
if (category === "ux") {
|
|
96
|
+
return `Acknowledged. We will improve usability/clarity in the next iteration.`;
|
|
97
|
+
}
|
|
98
|
+
if (category === "pricing") {
|
|
99
|
+
return `Acknowledged. We are reviewing pricing against value and usage outcomes.`;
|
|
100
|
+
}
|
|
101
|
+
if (category === "feature") {
|
|
102
|
+
return `Acknowledged. Feature request recorded and prioritized with current roadmap constraints.`;
|
|
103
|
+
}
|
|
104
|
+
if (category === "praise") {
|
|
105
|
+
return `Thanks for the feedback. We'll continue shipping improvements on top of this version (${review.app_version}).`;
|
|
106
|
+
}
|
|
107
|
+
return `Reviewed. No concrete or reproducible issue found from this report.`;
|
|
108
|
+
};
|
|
109
|
+
var inferCategory = (review) => {
|
|
110
|
+
const text = `${toLower(review.comment)} ${toLower(review.agent_response_comment)}`.trim();
|
|
111
|
+
const rating = Number(review.rating);
|
|
112
|
+
const rules = buildCategoryRules();
|
|
113
|
+
if (hasAny(text, rules.bug)) return "bug";
|
|
114
|
+
if (hasAny(text, rules.reliability)) return "reliability";
|
|
115
|
+
if (hasAny(text, rules.ux)) return "ux";
|
|
116
|
+
if (hasAny(text, rules.pricing)) return "pricing";
|
|
117
|
+
if (hasAny(text, rules.feature)) return "feature";
|
|
118
|
+
if (hasAny(text, rules.praise) || rating >= 4.5) return "praise";
|
|
119
|
+
if (!text || text.length < 12) return "noise";
|
|
120
|
+
if (rating <= 2) return "bug";
|
|
121
|
+
if (rating >= 4) return "praise";
|
|
122
|
+
return "feature";
|
|
123
|
+
};
|
|
124
|
+
var ratingWeight = (rating) => {
|
|
125
|
+
if (rating <= 1) return 1;
|
|
126
|
+
if (rating <= 2) return 0.82;
|
|
127
|
+
if (rating <= 3) return 0.55;
|
|
128
|
+
if (rating <= 4) return 0.3;
|
|
129
|
+
return 0.18;
|
|
130
|
+
};
|
|
131
|
+
var recencyWeight = (createdAt, nowMs) => {
|
|
132
|
+
const createdMs = new Date(createdAt).getTime();
|
|
133
|
+
if (!Number.isFinite(createdMs)) return 0;
|
|
134
|
+
const ageDays = (nowMs - createdMs) / (1e3 * 60 * 60 * 24);
|
|
135
|
+
if (ageDays <= 1) return 0.1;
|
|
136
|
+
if (ageDays <= 7) return 0.05;
|
|
137
|
+
if (ageDays <= 30) return 0.02;
|
|
138
|
+
return 0;
|
|
139
|
+
};
|
|
140
|
+
var classifyReview = (review) => inferCategory(review);
|
|
141
|
+
var scoreReviewPriority = (review, options = {}) => {
|
|
142
|
+
const category = classifyReview(review);
|
|
143
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
144
|
+
const ratingScore = ratingWeight(Number(review.rating));
|
|
145
|
+
const categoryScore = categoryPriorityWeight[category];
|
|
146
|
+
const unresolvedBonus = review.agent_response_status ? 0 : 0.12;
|
|
147
|
+
const recency = recencyWeight(review.created_at, nowMs);
|
|
148
|
+
return clamp01(ratingScore + categoryScore + unresolvedBonus + recency);
|
|
149
|
+
};
|
|
150
|
+
var buildReflectionCandidate = (review, options = {}) => {
|
|
151
|
+
const category = classifyReview(review);
|
|
152
|
+
const priority = scoreReviewPriority(review, options);
|
|
153
|
+
const suggestedStatus = defaultStatusByCategory[category];
|
|
154
|
+
const rationale = [
|
|
155
|
+
`category:${category}`,
|
|
156
|
+
`rating:${Number(review.rating).toFixed(1)}`,
|
|
157
|
+
review.agent_response_status ? "already_responded" : "pending_response"
|
|
158
|
+
];
|
|
159
|
+
if (!review.redeem_signature) rationale.push("offchain_review_signal");
|
|
160
|
+
return {
|
|
161
|
+
review,
|
|
162
|
+
category,
|
|
163
|
+
priority,
|
|
164
|
+
suggestedStatus,
|
|
165
|
+
suggestedComment: defaultCommentByCategory(category, review),
|
|
166
|
+
rationale
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
var emptySummary = () => ({
|
|
170
|
+
total: 0,
|
|
171
|
+
byCategory: {
|
|
172
|
+
bug: 0,
|
|
173
|
+
reliability: 0,
|
|
174
|
+
ux: 0,
|
|
175
|
+
pricing: 0,
|
|
176
|
+
feature: 0,
|
|
177
|
+
praise: 0,
|
|
178
|
+
noise: 0
|
|
179
|
+
},
|
|
180
|
+
averagePriority: 0,
|
|
181
|
+
topPriority: 0
|
|
182
|
+
});
|
|
183
|
+
var buildReflectionBacklog = (reviews, options = {}) => {
|
|
184
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
185
|
+
const source = options.includeResponded ? reviews : reviews.filter((review) => !review.agent_response_status);
|
|
186
|
+
const candidates = source.map((review) => buildReflectionCandidate(review, { nowMs })).sort((a, b) => b.priority - a.priority);
|
|
187
|
+
const summary = emptySummary();
|
|
188
|
+
summary.total = candidates.length;
|
|
189
|
+
if (!candidates.length) {
|
|
190
|
+
return {
|
|
191
|
+
listingId: reviews[0]?.listing_id || "",
|
|
192
|
+
generatedAt: new Date(nowMs).toISOString(),
|
|
193
|
+
candidates,
|
|
194
|
+
summary
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
let totalPriority = 0;
|
|
198
|
+
candidates.forEach((candidate) => {
|
|
199
|
+
summary.byCategory[candidate.category] += 1;
|
|
200
|
+
totalPriority += candidate.priority;
|
|
201
|
+
summary.topPriority = Math.max(summary.topPriority, candidate.priority);
|
|
202
|
+
});
|
|
203
|
+
summary.averagePriority = totalPriority / candidates.length;
|
|
204
|
+
return {
|
|
205
|
+
listingId: candidates[0].review.listing_id,
|
|
206
|
+
generatedAt: new Date(nowMs).toISOString(),
|
|
207
|
+
candidates,
|
|
208
|
+
summary
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
var reflectionResponseMessage = (reviewId, status, timestamp) => `VIBEIAO-REVIEW-RESPONSE:${reviewId}:${status}:${timestamp}`;
|
|
212
|
+
var reflectionVersionMessage = (listingId, version, timestamp) => `VIBEIAO-LISTING-VERSION:${listingId}:${version}:${timestamp}`;
|
|
213
|
+
var parseVersion = (value) => {
|
|
214
|
+
const match = String(value || "").trim().match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
215
|
+
if (!match) return null;
|
|
216
|
+
return {
|
|
217
|
+
major: Number(match[1]),
|
|
218
|
+
minor: Number(match[2]),
|
|
219
|
+
patch: Number(match[3])
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
var bumpSemver = (currentVersion, bump = "patch") => {
|
|
223
|
+
const parsed = parseVersion(currentVersion);
|
|
224
|
+
if (!parsed) return null;
|
|
225
|
+
if (bump === "major") return `${parsed.major + 1}.0.0`;
|
|
226
|
+
if (bump === "minor") return `${parsed.major}.${parsed.minor + 1}.0`;
|
|
227
|
+
return `${parsed.major}.${parsed.minor}.${parsed.patch + 1}`;
|
|
228
|
+
};
|
|
229
|
+
var dedupe = (values, max = 500) => {
|
|
230
|
+
const seen = /* @__PURE__ */ new Set();
|
|
231
|
+
const result = [];
|
|
232
|
+
for (const value of values) {
|
|
233
|
+
const key = String(value || "").trim();
|
|
234
|
+
if (!key || seen.has(key)) continue;
|
|
235
|
+
seen.add(key);
|
|
236
|
+
result.push(key);
|
|
237
|
+
}
|
|
238
|
+
return result.slice(-max);
|
|
239
|
+
};
|
|
240
|
+
var unwrap = (response) => {
|
|
241
|
+
if (response.error) {
|
|
242
|
+
throw new Error(response.error);
|
|
243
|
+
}
|
|
244
|
+
return response.data;
|
|
245
|
+
};
|
|
246
|
+
var buildMemoryMarkdown = (listingId, plan, acted, updatedVersion) => {
|
|
247
|
+
const lines = [
|
|
248
|
+
`## Reflection Cycle (${(/* @__PURE__ */ new Date()).toISOString()})`,
|
|
249
|
+
`- Listing: ${listingId}`,
|
|
250
|
+
`- Candidates: ${plan.summary.total}`,
|
|
251
|
+
`- Actions: ${acted.length}`,
|
|
252
|
+
`- Top priority: ${plan.summary.topPriority.toFixed(2)}`
|
|
253
|
+
];
|
|
254
|
+
if (updatedVersion) {
|
|
255
|
+
lines.push(`- Version bumped to: ${updatedVersion}`);
|
|
256
|
+
}
|
|
257
|
+
acted.slice(0, 5).forEach((action) => {
|
|
258
|
+
lines.push(
|
|
259
|
+
`- Action ${action.reviewId}: ${action.category} (${action.priority.toFixed(2)}) -> ${action.status}`
|
|
260
|
+
);
|
|
261
|
+
});
|
|
262
|
+
return lines.join("\n");
|
|
263
|
+
};
|
|
264
|
+
var runReflectionCycle = async (options) => {
|
|
265
|
+
const now = options.now || Date.now;
|
|
266
|
+
const nowMs = now();
|
|
267
|
+
const maxReviews = Math.max(1, options.maxReviews ?? 100);
|
|
268
|
+
const maxActions = Math.max(1, options.maxActions ?? 3);
|
|
269
|
+
const minPriority = clamp01(options.minPriority ?? 0.35);
|
|
270
|
+
const loadedCheckpoint = options.store ? await options.store.load() : null;
|
|
271
|
+
const checkpoint = loadedCheckpoint || {};
|
|
272
|
+
const seenIds = new Set(checkpoint.processedReviewIds || []);
|
|
273
|
+
const reviews = unwrap(
|
|
274
|
+
await options.client.getListingReviews(options.listingId, { limit: maxReviews, offset: 0 })
|
|
275
|
+
);
|
|
276
|
+
const filtered = reviews.filter((review) => {
|
|
277
|
+
if (!review?.id) return false;
|
|
278
|
+
if (seenIds.has(review.id)) return false;
|
|
279
|
+
if (review.agent_response_status) return false;
|
|
280
|
+
return true;
|
|
281
|
+
});
|
|
282
|
+
const plan = buildReflectionBacklog(filtered, { nowMs, includeResponded: false });
|
|
283
|
+
const candidates = plan.candidates.filter((candidate) => candidate.priority >= minPriority);
|
|
284
|
+
const selected = candidates.slice(0, maxActions);
|
|
285
|
+
const actions = [];
|
|
286
|
+
for (const candidate of selected) {
|
|
287
|
+
const timestamp = now();
|
|
288
|
+
const message = reflectionResponseMessage(
|
|
289
|
+
candidate.review.id,
|
|
290
|
+
candidate.suggestedStatus,
|
|
291
|
+
timestamp
|
|
292
|
+
);
|
|
293
|
+
const signature = await options.signMessage(message);
|
|
294
|
+
await unwrap(
|
|
295
|
+
await options.client.respondToListingReview(options.listingId, candidate.review.id, {
|
|
296
|
+
wallet: options.wallet,
|
|
297
|
+
signature,
|
|
298
|
+
status: candidate.suggestedStatus,
|
|
299
|
+
comment: candidate.suggestedComment,
|
|
300
|
+
timestamp
|
|
301
|
+
})
|
|
302
|
+
);
|
|
303
|
+
actions.push({
|
|
304
|
+
reviewId: candidate.review.id,
|
|
305
|
+
category: candidate.category,
|
|
306
|
+
priority: candidate.priority,
|
|
307
|
+
status: candidate.suggestedStatus
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
let updatedVersion;
|
|
311
|
+
const versionUpdate = options.versionUpdate;
|
|
312
|
+
const allowVersionUpdate = Boolean(versionUpdate?.enabled);
|
|
313
|
+
if (allowVersionUpdate && options.client.updateListingVersion && actions.length > 0 && plan.summary.topPriority >= (versionUpdate?.minTopPriority ?? 0.6)) {
|
|
314
|
+
const listingResponse = options.client.getListing ? await options.client.getListing(options.listingId) : null;
|
|
315
|
+
const currentVersion = listingResponse?.data?.app_version || checkpoint.lastVersion || "1.0.0";
|
|
316
|
+
const nextVersion = versionUpdate?.nextVersion || bumpSemver(String(currentVersion), versionUpdate?.bump || "patch");
|
|
317
|
+
if (nextVersion) {
|
|
318
|
+
const timestamp = now();
|
|
319
|
+
const message = reflectionVersionMessage(options.listingId, nextVersion, timestamp);
|
|
320
|
+
const signature = await options.signMessage(message);
|
|
321
|
+
await unwrap(
|
|
322
|
+
await options.client.updateListingVersion(options.listingId, {
|
|
323
|
+
wallet: options.wallet,
|
|
324
|
+
signature,
|
|
325
|
+
version: nextVersion,
|
|
326
|
+
timestamp
|
|
327
|
+
})
|
|
328
|
+
);
|
|
329
|
+
updatedVersion = nextVersion;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
const processedReviewIds = dedupe([
|
|
333
|
+
...checkpoint.processedReviewIds || [],
|
|
334
|
+
...filtered.map((review) => review.id)
|
|
335
|
+
]);
|
|
336
|
+
const lastReviewAt = reviews.map((review) => review.created_at).filter(Boolean).sort().at(-1);
|
|
337
|
+
const nextCheckpoint = {
|
|
338
|
+
...checkpoint,
|
|
339
|
+
processedReviewIds,
|
|
340
|
+
lastReviewAt: lastReviewAt || checkpoint.lastReviewAt,
|
|
341
|
+
lastVersion: updatedVersion || checkpoint.lastVersion,
|
|
342
|
+
updatedAt: new Date(nowMs).toISOString()
|
|
343
|
+
};
|
|
344
|
+
if (options.store) {
|
|
345
|
+
await options.store.save(nextCheckpoint);
|
|
346
|
+
}
|
|
347
|
+
if (options.appendMemoryLog) {
|
|
348
|
+
const markdown = buildMemoryMarkdown(options.listingId, plan, actions, updatedVersion);
|
|
349
|
+
await options.appendMemoryLog(markdown);
|
|
350
|
+
}
|
|
351
|
+
return {
|
|
352
|
+
listingId: options.listingId,
|
|
353
|
+
fetched: reviews.length,
|
|
354
|
+
considered: filtered.length,
|
|
355
|
+
acted: actions.length,
|
|
356
|
+
generatedAt: new Date(nowMs).toISOString(),
|
|
357
|
+
updatedVersion,
|
|
358
|
+
checkpoint: nextCheckpoint,
|
|
359
|
+
actions,
|
|
360
|
+
summary: plan.summary
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
var createInMemoryReflectionStore = (initial = null) => {
|
|
364
|
+
let checkpoint = initial;
|
|
365
|
+
return {
|
|
366
|
+
load: async () => checkpoint,
|
|
367
|
+
save: async (next) => {
|
|
368
|
+
checkpoint = { ...next };
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
export {
|
|
374
|
+
classifyReview,
|
|
375
|
+
scoreReviewPriority,
|
|
376
|
+
buildReflectionCandidate,
|
|
377
|
+
buildReflectionBacklog,
|
|
378
|
+
bumpSemver,
|
|
379
|
+
runReflectionCycle,
|
|
380
|
+
createInMemoryReflectionStore
|
|
381
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
|
-
import { L as ListingRecord, a as ListingType, b as ListingStatus, C as ClaimPurpose, c as ClaimResponse, V as VerifiedClaimResponse, d as ListingInput, e as ListingReviewRecord, T as TicketVerifyResponse } from './
|
|
3
|
-
export { f as fetchSolBalance, g as fetchTokenBalance, h as fetchTokenBalances } from './solana-3VMnBZH6.js';
|
|
2
|
+
import { L as ListingRecord, a as ListingType, b as ListingStatus, C as ClaimPurpose, c as ClaimResponse, V as VerifiedClaimResponse, d as ListingInput, e as ListingReviewRecord, T as TicketVerifyResponse } from './shared-By5mFIMw.js';
|
|
4
3
|
import { SelfReliancePolicy } from './selfReliance.js';
|
|
5
4
|
export { SelfReliance, createAutoSelfReliance, createSelfRelianceMonitor, createSelfReliancePolicy, createSurvivalMiddleware, withSurvival } from './selfReliance.js';
|
|
5
|
+
import { ReflectionCycleOptions, ReflectionCycleResult } from './reflection.js';
|
|
6
|
+
export { ReflectionActionStatus, ReflectionCandidate, ReflectionCategory, ReflectionCheckpoint, ReflectionClient, ReflectionPlan, ReflectionStore, buildReflectionBacklog, buildReflectionCandidate, bumpSemver, classifyReview, createInMemoryReflectionStore, runReflectionCycle, scoreReviewPriority } from './reflection.js';
|
|
7
|
+
export { fetchSolBalance, fetchTokenBalance, fetchTokenBalances } from './solana.js';
|
|
6
8
|
import '@coral-xyz/anchor';
|
|
7
9
|
|
|
8
10
|
declare const VIBEIAO_IDL: {
|
|
@@ -1042,6 +1044,7 @@ declare class VibeRegistry {
|
|
|
1042
1044
|
id: string;
|
|
1043
1045
|
app_version: string;
|
|
1044
1046
|
}>;
|
|
1047
|
+
runReflectionCycle(options: Omit<ReflectionCycleOptions, 'client'>): Promise<ReflectionCycleResult>;
|
|
1045
1048
|
getLeaderboard(filters?: LeaderboardQuery): Promise<LeaderboardEntry[]>;
|
|
1046
1049
|
getListingAnalytics(listingId: string, window?: string): Promise<AnalyticsPoint[]>;
|
|
1047
1050
|
getListingBuybacks(listingId: string, limit?: number): Promise<BuybackEvent[]>;
|
|
@@ -1099,4 +1102,4 @@ declare const getResourceSnapshot: (options: {
|
|
|
1099
1102
|
apiBase?: string;
|
|
1100
1103
|
}) => Promise<ResourceSnapshot>;
|
|
1101
1104
|
|
|
1102
|
-
export { type AgentResourceProvidersManifest, type AnalyticsPoint, type ApiCreditProvider, type ApiCreditProviderFactoryOptions, type ApiCreditProviderPreset, type ApiCreditProviderPresetInput, type ApiResponse, type BuybackEvent, ClaimPurpose, ClaimResponse, LISTING_NAME_MAX_LENGTH, LISTING_NAME_RECOMMENDED_MAX, LISTING_TAGLINE_MAX_LENGTH, LISTING_TAGLINE_RECOMMENDED_MAX, type LeaderboardEntry, type LeaderboardQuery, ListingInput, type ListingNamingValidationOptions, type ListingNamingValidationResult, type ListingQuery, ListingRecord, type ListingReviewCreatePayload, ListingReviewRecord, type ListingReviewResponsePayload, ListingStatus, ListingType, type ListingVersionPayload, type MarketingCampaign, type MarketingLinkOptions, type MemoryPingChallengeResponse, type MemoryPingPayload, type OpenRouterCredits, type ProcurementCandidate, type ProcurementDecision, type ProcurementTaskProfile, type ProcurementWeights, type ResourceProviderManifestEntry, type ResourceSnapshot, ReviewGate, type ReviewGateRecord, type ReviewRequiredPayload, type SdkUpdateCheckOptions, type SdkUpdatePolicyCheckOptions, SdkUpdateRequiredError, type SdkUpdateStatus, TicketVerifyResponse, VIBEIAO_IDL, VerifiedClaimResponse, VibeClient, type VibeClientOptions, VibeRegistry, assertSurvivalProvidersConfigured, buildBadgeMarkdown, buildClaimMessage, buildJupiterSwapUrl, buildListingVersionMessage, buildMemoryPingMessage, buildOwnerTransferMessage, buildProcurementPrompt, buildRaydiumSwapUrl, buildReviewPrompt, buildReviewRequired, buildReviewResponseMessage, buildSdkUpdateCommand, buildShareCopy, buildShareLink, buildTradeLinks, checkForSdkUpdate, checkForSdkUpdatePolicy, compareVersions, createApiCreditProvider, createApiCreditProviders, createApiCreditProvidersFromManifest, createCampaign, decideProcurementForTask, getResourceSnapshot, normalizeListingText, rankListingsForTask, sanitizeListingNaming, scoreListingForTask, validateListingNaming };
|
|
1105
|
+
export { type AgentResourceProvidersManifest, type AnalyticsPoint, type ApiCreditProvider, type ApiCreditProviderFactoryOptions, type ApiCreditProviderPreset, type ApiCreditProviderPresetInput, type ApiResponse, type BuybackEvent, ClaimPurpose, ClaimResponse, LISTING_NAME_MAX_LENGTH, LISTING_NAME_RECOMMENDED_MAX, LISTING_TAGLINE_MAX_LENGTH, LISTING_TAGLINE_RECOMMENDED_MAX, type LeaderboardEntry, type LeaderboardQuery, ListingInput, type ListingNamingValidationOptions, type ListingNamingValidationResult, type ListingQuery, ListingRecord, type ListingReviewCreatePayload, ListingReviewRecord, type ListingReviewResponsePayload, ListingStatus, ListingType, type ListingVersionPayload, type MarketingCampaign, type MarketingLinkOptions, type MemoryPingChallengeResponse, type MemoryPingPayload, type OpenRouterCredits, type ProcurementCandidate, type ProcurementDecision, type ProcurementTaskProfile, type ProcurementWeights, ReflectionCycleOptions, ReflectionCycleResult, type ResourceProviderManifestEntry, type ResourceSnapshot, ReviewGate, type ReviewGateRecord, type ReviewRequiredPayload, type SdkUpdateCheckOptions, type SdkUpdatePolicyCheckOptions, SdkUpdateRequiredError, type SdkUpdateStatus, TicketVerifyResponse, VIBEIAO_IDL, VerifiedClaimResponse, VibeClient, type VibeClientOptions, VibeRegistry, assertSurvivalProvidersConfigured, buildBadgeMarkdown, buildClaimMessage, buildJupiterSwapUrl, buildListingVersionMessage, buildMemoryPingMessage, buildOwnerTransferMessage, buildProcurementPrompt, buildRaydiumSwapUrl, buildReviewPrompt, buildReviewRequired, buildReviewResponseMessage, buildSdkUpdateCommand, buildShareCopy, buildShareLink, buildTradeLinks, checkForSdkUpdate, checkForSdkUpdatePolicy, compareVersions, createApiCreditProvider, createApiCreditProviders, createApiCreditProvidersFromManifest, createCampaign, decideProcurementForTask, getResourceSnapshot, normalizeListingText, rankListingsForTask, sanitizeListingNaming, scoreListingForTask, validateListingNaming };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildReflectionBacklog,
|
|
3
|
+
buildReflectionCandidate,
|
|
4
|
+
bumpSemver,
|
|
5
|
+
classifyReview,
|
|
6
|
+
createInMemoryReflectionStore,
|
|
7
|
+
runReflectionCycle,
|
|
8
|
+
scoreReviewPriority
|
|
9
|
+
} from "./chunk-BS7WZWNB.js";
|
|
1
10
|
import {
|
|
2
11
|
SelfReliance,
|
|
3
12
|
createAutoSelfReliance,
|
|
@@ -114,7 +123,7 @@ var ReviewGate = class {
|
|
|
114
123
|
var DEFAULT_API_BASE = "https://api.vibeiao.com";
|
|
115
124
|
var DEFAULT_WEB_BASE = "https://vibeiao.com";
|
|
116
125
|
var DEFAULT_SDK_PACKAGE = "@vibeiao/sdk";
|
|
117
|
-
var DEFAULT_SDK_VERSION = "0.1.
|
|
126
|
+
var DEFAULT_SDK_VERSION = "0.1.13" ? "0.1.13" : "0.1.4";
|
|
118
127
|
var DEFAULT_SDK_REGISTRY = "https://registry.npmjs.org";
|
|
119
128
|
var DEFAULT_SDK_POLICY_PATH = "/v1/sdk/policy";
|
|
120
129
|
var DEFAULT_SDK_CHECK_INTERVAL_MS = 1e3 * 60 * 30;
|
|
@@ -707,6 +716,12 @@ var VibeRegistry = class {
|
|
|
707
716
|
async updateListingVersion(listingId, payload) {
|
|
708
717
|
return unwrap(await this.client.updateListingVersion(listingId, payload));
|
|
709
718
|
}
|
|
719
|
+
async runReflectionCycle(options) {
|
|
720
|
+
return runReflectionCycle({
|
|
721
|
+
...options,
|
|
722
|
+
client: this.client
|
|
723
|
+
});
|
|
724
|
+
}
|
|
710
725
|
async getLeaderboard(filters = {}) {
|
|
711
726
|
return unwrap(await this.client.getLeaderboard(filters));
|
|
712
727
|
}
|
|
@@ -1104,6 +1119,8 @@ export {
|
|
|
1104
1119
|
buildOwnerTransferMessage,
|
|
1105
1120
|
buildProcurementPrompt,
|
|
1106
1121
|
buildRaydiumSwapUrl,
|
|
1122
|
+
buildReflectionBacklog,
|
|
1123
|
+
buildReflectionCandidate,
|
|
1107
1124
|
buildReviewPrompt,
|
|
1108
1125
|
buildReviewRequired,
|
|
1109
1126
|
buildReviewResponseMessage,
|
|
@@ -1111,14 +1128,17 @@ export {
|
|
|
1111
1128
|
buildShareCopy,
|
|
1112
1129
|
buildShareLink,
|
|
1113
1130
|
buildTradeLinks,
|
|
1131
|
+
bumpSemver,
|
|
1114
1132
|
checkForSdkUpdate,
|
|
1115
1133
|
checkForSdkUpdatePolicy,
|
|
1134
|
+
classifyReview,
|
|
1116
1135
|
compareVersions,
|
|
1117
1136
|
createApiCreditProvider,
|
|
1118
1137
|
createApiCreditProviders,
|
|
1119
1138
|
createApiCreditProvidersFromManifest,
|
|
1120
1139
|
createAutoSelfReliance,
|
|
1121
1140
|
createCampaign,
|
|
1141
|
+
createInMemoryReflectionStore,
|
|
1122
1142
|
createSelfRelianceMonitor,
|
|
1123
1143
|
createSelfReliancePolicy,
|
|
1124
1144
|
createSurvivalMiddleware,
|
|
@@ -1129,8 +1149,10 @@ export {
|
|
|
1129
1149
|
getResourceSnapshot,
|
|
1130
1150
|
normalizeListingText,
|
|
1131
1151
|
rankListingsForTask,
|
|
1152
|
+
runReflectionCycle,
|
|
1132
1153
|
sanitizeListingNaming,
|
|
1133
1154
|
scoreListingForTask,
|
|
1155
|
+
scoreReviewPriority,
|
|
1134
1156
|
validateListingNaming,
|
|
1135
1157
|
withSurvival
|
|
1136
1158
|
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { e as ListingReviewRecord, L as ListingRecord } from './shared-By5mFIMw.js';
|
|
2
|
+
|
|
3
|
+
type ReflectionApiResponse<T> = {
|
|
4
|
+
data?: T;
|
|
5
|
+
error?: string;
|
|
6
|
+
details?: unknown;
|
|
7
|
+
};
|
|
8
|
+
type ReflectionCategory = 'bug' | 'reliability' | 'ux' | 'pricing' | 'feature' | 'praise' | 'noise';
|
|
9
|
+
type ReflectionActionStatus = 'accepted' | 'addressed' | 'planned' | 'disputed' | 'wont_fix';
|
|
10
|
+
interface ReflectionClient {
|
|
11
|
+
getListingReviews: (listingId: string, options?: {
|
|
12
|
+
limit?: number;
|
|
13
|
+
offset?: number;
|
|
14
|
+
}) => Promise<ReflectionApiResponse<ListingReviewRecord[]>>;
|
|
15
|
+
respondToListingReview: (listingId: string, reviewId: string, payload: {
|
|
16
|
+
wallet: string;
|
|
17
|
+
signature: string;
|
|
18
|
+
status: ReflectionActionStatus;
|
|
19
|
+
comment?: string;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
}) => Promise<ReflectionApiResponse<ListingReviewRecord>>;
|
|
22
|
+
getListing?: (listingId: string) => Promise<ReflectionApiResponse<ListingRecord>>;
|
|
23
|
+
updateListingVersion?: (listingId: string, payload: {
|
|
24
|
+
wallet: string;
|
|
25
|
+
signature: string;
|
|
26
|
+
version: string;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
}) => Promise<ReflectionApiResponse<{
|
|
29
|
+
id: string;
|
|
30
|
+
app_version: string;
|
|
31
|
+
}>>;
|
|
32
|
+
}
|
|
33
|
+
interface ReflectionCheckpoint {
|
|
34
|
+
lastReviewAt?: string;
|
|
35
|
+
processedReviewIds?: string[];
|
|
36
|
+
lastVersion?: string;
|
|
37
|
+
updatedAt?: string;
|
|
38
|
+
}
|
|
39
|
+
interface ReflectionStore {
|
|
40
|
+
load: () => Promise<ReflectionCheckpoint | null> | ReflectionCheckpoint | null;
|
|
41
|
+
save: (checkpoint: ReflectionCheckpoint) => Promise<void> | void;
|
|
42
|
+
}
|
|
43
|
+
interface ReflectionCandidate {
|
|
44
|
+
review: ListingReviewRecord;
|
|
45
|
+
category: ReflectionCategory;
|
|
46
|
+
priority: number;
|
|
47
|
+
suggestedStatus: ReflectionActionStatus;
|
|
48
|
+
suggestedComment: string;
|
|
49
|
+
rationale: string[];
|
|
50
|
+
}
|
|
51
|
+
interface ReflectionPlan {
|
|
52
|
+
listingId: string;
|
|
53
|
+
generatedAt: string;
|
|
54
|
+
candidates: ReflectionCandidate[];
|
|
55
|
+
summary: {
|
|
56
|
+
total: number;
|
|
57
|
+
byCategory: Record<ReflectionCategory, number>;
|
|
58
|
+
averagePriority: number;
|
|
59
|
+
topPriority: number;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
interface ReflectionCycleOptions {
|
|
63
|
+
client: ReflectionClient;
|
|
64
|
+
listingId: string;
|
|
65
|
+
wallet: string;
|
|
66
|
+
signMessage: (message: string) => Promise<string> | string;
|
|
67
|
+
maxReviews?: number;
|
|
68
|
+
maxActions?: number;
|
|
69
|
+
minPriority?: number;
|
|
70
|
+
store?: ReflectionStore;
|
|
71
|
+
appendMemoryLog?: (markdown: string) => Promise<void> | void;
|
|
72
|
+
versionUpdate?: {
|
|
73
|
+
enabled?: boolean;
|
|
74
|
+
nextVersion?: string;
|
|
75
|
+
bump?: 'patch' | 'minor' | 'major';
|
|
76
|
+
minTopPriority?: number;
|
|
77
|
+
};
|
|
78
|
+
now?: () => number;
|
|
79
|
+
}
|
|
80
|
+
interface ReflectionCycleResult {
|
|
81
|
+
listingId: string;
|
|
82
|
+
fetched: number;
|
|
83
|
+
considered: number;
|
|
84
|
+
acted: number;
|
|
85
|
+
generatedAt: string;
|
|
86
|
+
updatedVersion?: string;
|
|
87
|
+
checkpoint: ReflectionCheckpoint;
|
|
88
|
+
actions: Array<{
|
|
89
|
+
reviewId: string;
|
|
90
|
+
category: ReflectionCategory;
|
|
91
|
+
priority: number;
|
|
92
|
+
status: ReflectionActionStatus;
|
|
93
|
+
}>;
|
|
94
|
+
summary: ReflectionPlan['summary'];
|
|
95
|
+
}
|
|
96
|
+
declare const classifyReview: (review: ListingReviewRecord) => ReflectionCategory;
|
|
97
|
+
declare const scoreReviewPriority: (review: ListingReviewRecord, options?: {
|
|
98
|
+
nowMs?: number;
|
|
99
|
+
}) => number;
|
|
100
|
+
declare const buildReflectionCandidate: (review: ListingReviewRecord, options?: {
|
|
101
|
+
nowMs?: number;
|
|
102
|
+
}) => ReflectionCandidate;
|
|
103
|
+
declare const buildReflectionBacklog: (reviews: ListingReviewRecord[], options?: {
|
|
104
|
+
nowMs?: number;
|
|
105
|
+
includeResponded?: boolean;
|
|
106
|
+
}) => ReflectionPlan;
|
|
107
|
+
declare const bumpSemver: (currentVersion: string, bump?: "patch" | "minor" | "major") => string;
|
|
108
|
+
declare const runReflectionCycle: (options: ReflectionCycleOptions) => Promise<ReflectionCycleResult>;
|
|
109
|
+
declare const createInMemoryReflectionStore: (initial?: ReflectionCheckpoint | null) => ReflectionStore;
|
|
110
|
+
|
|
111
|
+
export { type ReflectionActionStatus, type ReflectionCandidate, type ReflectionCategory, type ReflectionCheckpoint, type ReflectionClient, type ReflectionCycleOptions, type ReflectionCycleResult, type ReflectionPlan, type ReflectionStore, buildReflectionBacklog, buildReflectionCandidate, bumpSemver, classifyReview, createInMemoryReflectionStore, runReflectionCycle, scoreReviewPriority };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildReflectionBacklog,
|
|
3
|
+
buildReflectionCandidate,
|
|
4
|
+
bumpSemver,
|
|
5
|
+
classifyReview,
|
|
6
|
+
createInMemoryReflectionStore,
|
|
7
|
+
runReflectionCycle,
|
|
8
|
+
scoreReviewPriority
|
|
9
|
+
} from "./chunk-BS7WZWNB.js";
|
|
10
|
+
export {
|
|
11
|
+
buildReflectionBacklog,
|
|
12
|
+
buildReflectionCandidate,
|
|
13
|
+
bumpSemver,
|
|
14
|
+
classifyReview,
|
|
15
|
+
createInMemoryReflectionStore,
|
|
16
|
+
runReflectionCycle,
|
|
17
|
+
scoreReviewPriority
|
|
18
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
type ListingType = 'agent' | 'human';
|
|
2
|
+
type ListingStatus = 'grind' | 'ipo' | 'web2';
|
|
3
|
+
type ClaimPurpose = 'agent_register' | 'owner_claim' | 'mission';
|
|
4
|
+
|
|
5
|
+
interface ListingInput {
|
|
6
|
+
listingType: ListingType;
|
|
7
|
+
name: string;
|
|
8
|
+
tagline: string;
|
|
9
|
+
description: string;
|
|
10
|
+
category: string;
|
|
11
|
+
priceUsdc: number;
|
|
12
|
+
appVersion?: string;
|
|
13
|
+
imageUrl?: string;
|
|
14
|
+
productUrl: string;
|
|
15
|
+
endpointUrl?: string;
|
|
16
|
+
manifestUrl?: string;
|
|
17
|
+
listingSeed?: string;
|
|
18
|
+
chainListingAccount?: string;
|
|
19
|
+
walletMode?: 'single' | 'multisig';
|
|
20
|
+
agentWallet?: string;
|
|
21
|
+
ownerWallet?: string;
|
|
22
|
+
revenueWallet?: string;
|
|
23
|
+
ethWallet?: string;
|
|
24
|
+
llmRequired?: boolean;
|
|
25
|
+
llmBillingEnabled?: boolean;
|
|
26
|
+
llmProvider?: string;
|
|
27
|
+
runtime?: 'openrouter' | null;
|
|
28
|
+
runtimeConfig?: Record<string, unknown>;
|
|
29
|
+
buybackBps?: number;
|
|
30
|
+
ticketPrice: number;
|
|
31
|
+
targetRevenue: number;
|
|
32
|
+
}
|
|
33
|
+
interface ListingRecord {
|
|
34
|
+
id: string;
|
|
35
|
+
listing_type: ListingType;
|
|
36
|
+
status: ListingStatus;
|
|
37
|
+
name: string;
|
|
38
|
+
tagline: string;
|
|
39
|
+
description: string;
|
|
40
|
+
category: string;
|
|
41
|
+
app_version?: string | null;
|
|
42
|
+
rating_avg?: number | null;
|
|
43
|
+
rating_count?: number | null;
|
|
44
|
+
image_url?: string | null;
|
|
45
|
+
product_url: string;
|
|
46
|
+
endpoint_url?: string | null;
|
|
47
|
+
manifest_url?: string | null;
|
|
48
|
+
memory_root?: string | null;
|
|
49
|
+
memory_last_seen_at?: string | null;
|
|
50
|
+
memory_status?: 'fresh' | 'stale' | 'unknown' | null;
|
|
51
|
+
price_usdc?: number | null;
|
|
52
|
+
price_updated_at?: string | null;
|
|
53
|
+
creator_wallet_id?: string | null;
|
|
54
|
+
creator_wallet_address?: string | null;
|
|
55
|
+
revenue_wallet_id?: string | null;
|
|
56
|
+
revenue_wallet_address?: string | null;
|
|
57
|
+
llm_required?: boolean | null;
|
|
58
|
+
llm_billing_enabled?: boolean | null;
|
|
59
|
+
llm_provider?: string | null;
|
|
60
|
+
runtime?: string | null;
|
|
61
|
+
runtime_config?: Record<string, unknown> | null;
|
|
62
|
+
buyback_bps?: number | null;
|
|
63
|
+
ticket_price: number;
|
|
64
|
+
target_revenue: number;
|
|
65
|
+
revenue: number;
|
|
66
|
+
tickets_sold: number;
|
|
67
|
+
token_address?: string | null;
|
|
68
|
+
token_symbol?: string | null;
|
|
69
|
+
buyback_total: number;
|
|
70
|
+
platform_buyback_total?: number | null;
|
|
71
|
+
listing_seed?: string | null;
|
|
72
|
+
chain_listing_account?: string | null;
|
|
73
|
+
created_at: string;
|
|
74
|
+
updated_at: string;
|
|
75
|
+
}
|
|
76
|
+
interface ListingReviewRecord {
|
|
77
|
+
id: string;
|
|
78
|
+
listing_id: string;
|
|
79
|
+
reviewer_wallet_id: string;
|
|
80
|
+
reviewer_wallet_address?: string | null;
|
|
81
|
+
rating: number;
|
|
82
|
+
comment: string;
|
|
83
|
+
app_version: string;
|
|
84
|
+
redeem_signature?: string | null;
|
|
85
|
+
redeem_block_time?: number | null;
|
|
86
|
+
agent_response_status?: string | null;
|
|
87
|
+
agent_response_comment?: string | null;
|
|
88
|
+
agent_response_wallet_address?: string | null;
|
|
89
|
+
agent_responded_at?: string | null;
|
|
90
|
+
created_at: string;
|
|
91
|
+
}
|
|
92
|
+
interface ClaimResponse {
|
|
93
|
+
id: string;
|
|
94
|
+
nonce: string;
|
|
95
|
+
purpose: ClaimPurpose;
|
|
96
|
+
status: string;
|
|
97
|
+
expires_at: string;
|
|
98
|
+
message: string;
|
|
99
|
+
}
|
|
100
|
+
interface VerifiedClaimResponse {
|
|
101
|
+
id: string;
|
|
102
|
+
nonce: string;
|
|
103
|
+
purpose: ClaimPurpose;
|
|
104
|
+
status: string;
|
|
105
|
+
verified_at: string;
|
|
106
|
+
}
|
|
107
|
+
interface TicketVerifyResponse {
|
|
108
|
+
isValid: boolean;
|
|
109
|
+
listingId?: string;
|
|
110
|
+
listingAccount?: string;
|
|
111
|
+
wallet?: string;
|
|
112
|
+
receipt?: string;
|
|
113
|
+
count?: string;
|
|
114
|
+
lastPurchasedAt?: string;
|
|
115
|
+
lastRedeemedAt?: string;
|
|
116
|
+
source?: 'receipt' | 'redeem' | 'ticket';
|
|
117
|
+
reason?: string;
|
|
118
|
+
minCount?: number;
|
|
119
|
+
maxAgeSec?: number | null;
|
|
120
|
+
blockTime?: number | null;
|
|
121
|
+
reviewRequired?: boolean;
|
|
122
|
+
reviewListingId?: string;
|
|
123
|
+
reviewSignature?: string;
|
|
124
|
+
reviewAppVersion?: string;
|
|
125
|
+
reviewUrl?: string;
|
|
126
|
+
error?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type { ClaimPurpose as C, ListingRecord as L, TicketVerifyResponse as T, VerifiedClaimResponse as V, ListingType as a, ListingStatus as b, ClaimResponse as c, ListingInput as d, ListingReviewRecord as e };
|
package/dist/solana.d.ts
CHANGED
|
@@ -1,3 +1,62 @@
|
|
|
1
|
-
import '@coral-xyz/anchor';
|
|
2
|
-
import '@solana/web3.js';
|
|
3
|
-
|
|
1
|
+
import { Program, Idl } from '@coral-xyz/anchor';
|
|
2
|
+
import { Connection, PublicKey, Keypair } from '@solana/web3.js';
|
|
3
|
+
import { L as ListingRecord } from './shared-By5mFIMw.js';
|
|
4
|
+
|
|
5
|
+
type WalletLike = {
|
|
6
|
+
publicKey: PublicKey;
|
|
7
|
+
signTransaction: <T>(tx: T) => Promise<T>;
|
|
8
|
+
signAllTransactions: <T>(txs: T[]) => Promise<T[]>;
|
|
9
|
+
};
|
|
10
|
+
type WalletAdapterLike = {
|
|
11
|
+
publicKey: PublicKey;
|
|
12
|
+
signTransaction: <T>(tx: T) => Promise<T>;
|
|
13
|
+
signAllTransactions?: <T>(txs: T[]) => Promise<T[]>;
|
|
14
|
+
};
|
|
15
|
+
type SignerLike = WalletAdapterLike | Keypair;
|
|
16
|
+
interface ProtocolConfig {
|
|
17
|
+
platformTreasury: string;
|
|
18
|
+
buybackTreasury: string;
|
|
19
|
+
}
|
|
20
|
+
interface VibePaymentsOptions {
|
|
21
|
+
connection: Connection;
|
|
22
|
+
wallet: SignerLike;
|
|
23
|
+
programId: string | PublicKey;
|
|
24
|
+
commitment?: 'processed' | 'confirmed' | 'finalized';
|
|
25
|
+
}
|
|
26
|
+
interface PurchaseTicketInput {
|
|
27
|
+
listingAccount: string;
|
|
28
|
+
creatorWallet: string;
|
|
29
|
+
revenueWallet: string;
|
|
30
|
+
platformTreasury?: string;
|
|
31
|
+
buybackTreasury?: string;
|
|
32
|
+
}
|
|
33
|
+
interface PurchaseListingInput {
|
|
34
|
+
listing: ListingRecord;
|
|
35
|
+
platformTreasury?: string;
|
|
36
|
+
buybackTreasury?: string;
|
|
37
|
+
}
|
|
38
|
+
declare const toLamports: (sol: number) => any;
|
|
39
|
+
declare const toSol: (lamports: number | bigint) => number;
|
|
40
|
+
declare const deriveListingPda: (creator: PublicKey, seed: Uint8Array, programId: PublicKey) => [PublicKey, number];
|
|
41
|
+
declare const deriveTicketReceiptPda: (listing: PublicKey, buyer: PublicKey, programId: PublicKey) => [PublicKey, number];
|
|
42
|
+
declare const deriveConfigPda: (programId: PublicKey) => [PublicKey, number];
|
|
43
|
+
declare const fetchSolBalance: (connection: Connection, wallet: string | PublicKey) => Promise<number>;
|
|
44
|
+
declare const fetchTokenBalance: (connection: Connection, wallet: string | PublicKey, mint: string | PublicKey) => Promise<number>;
|
|
45
|
+
declare const fetchTokenBalances: (connection: Connection, wallet: string | PublicKey, mints: Array<string | PublicKey>) => Promise<Record<string, number>>;
|
|
46
|
+
declare class VibePayments {
|
|
47
|
+
private connection;
|
|
48
|
+
private wallet;
|
|
49
|
+
private programId;
|
|
50
|
+
private commitment;
|
|
51
|
+
constructor(options: VibePaymentsOptions);
|
|
52
|
+
getProgramId(): string;
|
|
53
|
+
getProgram(): Program<Idl>;
|
|
54
|
+
fetchProtocolConfig(): Promise<ProtocolConfig>;
|
|
55
|
+
getTicketReceiptAddress(listingAccount: string, buyer?: PublicKey): string;
|
|
56
|
+
purchaseTicket(input: PurchaseTicketInput): Promise<string>;
|
|
57
|
+
purchaseTicketForListing(input: PurchaseListingInput): Promise<string>;
|
|
58
|
+
redeemTicket(listingAccount: string): Promise<string>;
|
|
59
|
+
updateTicketPrice(listingAccount: string, priceSol: number): Promise<string>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { type ProtocolConfig, type PurchaseListingInput, type PurchaseTicketInput, type SignerLike, VibePayments, type VibePaymentsOptions, type WalletAdapterLike, type WalletLike, deriveConfigPda, deriveListingPda, deriveTicketReceiptPda, fetchSolBalance, fetchTokenBalance, fetchTokenBalances, toLamports, toSol };
|
package/package.json
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
"name": "@vibeiao/sdk",
|
|
3
3
|
"private": false,
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.14",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/index.js",
|
|
10
10
|
"./solana": "./dist/solana.js",
|
|
11
11
|
"./self-reliance": "./dist/selfReliance.js",
|
|
12
|
-
"./memory": "./dist/memory.js"
|
|
12
|
+
"./memory": "./dist/memory.js",
|
|
13
|
+
"./reflection": "./dist/reflection.js"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
15
16
|
"dist",
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"access": "public"
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
|
-
"build": "tsup src/index.ts src/memory.ts src/selfReliance.ts src/solana.ts --format esm --dts --tsconfig tsconfig.json --out-dir dist --define.__VIBEIAO_SDK_VERSION__=\\\"$npm_package_version\\\"",
|
|
23
|
+
"build": "tsup src/index.ts src/memory.ts src/selfReliance.ts src/solana.ts src/reflection.ts --format esm --dts --tsconfig tsconfig.json --out-dir dist --define.__VIBEIAO_SDK_VERSION__=\\\"$npm_package_version\\\"",
|
|
23
24
|
"test:e2e-memory": "pnpm build && node --test test/memory.e2e.test.mjs"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|