@prave/shared 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/classify.d.ts +21 -0
- package/dist/lib/classify.d.ts.map +1 -0
- package/dist/lib/classify.js +121 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +1 -0
- package/dist/schemas/api-keys.schema.d.ts +71 -0
- package/dist/schemas/api-keys.schema.d.ts.map +1 -0
- package/dist/schemas/api-keys.schema.js +29 -0
- package/dist/schemas/billing.schema.d.ts +7 -7
- package/dist/schemas/billing.schema.d.ts.map +1 -1
- package/dist/schemas/billing.schema.js +2 -2
- package/dist/schemas/credits.schema.d.ts +61 -0
- package/dist/schemas/credits.schema.d.ts.map +1 -0
- package/dist/schemas/credits.schema.js +44 -0
- package/dist/schemas/index.d.ts +4 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +4 -1
- package/dist/schemas/install.schema.d.ts +27 -5
- package/dist/schemas/install.schema.d.ts.map +1 -1
- package/dist/schemas/intelligence.schema.d.ts +82 -0
- package/dist/schemas/intelligence.schema.d.ts.map +1 -0
- package/dist/schemas/intelligence.schema.js +31 -0
- package/dist/schemas/marketplace.schema.d.ts +2 -2
- package/dist/schemas/marketplace.schema.d.ts.map +1 -1
- package/dist/schemas/marketplace.schema.js +2 -2
- package/dist/schemas/org.schema.d.ts +3 -3
- package/dist/schemas/search.schema.d.ts +41 -3
- package/dist/schemas/search.schema.d.ts.map +1 -1
- package/dist/schemas/skill-dependency.schema.d.ts +27 -5
- package/dist/schemas/skill-dependency.schema.d.ts.map +1 -1
- package/dist/schemas/skill-pr.schema.d.ts +544 -0
- package/dist/schemas/skill-pr.schema.d.ts.map +1 -0
- package/dist/schemas/skill-pr.schema.js +87 -0
- package/dist/schemas/skill-test.schema.d.ts +4 -9
- package/dist/schemas/skill-test.schema.d.ts.map +1 -1
- package/dist/schemas/skill-test.schema.js +4 -9
- package/dist/schemas/skill.schema.d.ts +76 -10
- package/dist/schemas/skill.schema.d.ts.map +1 -1
- package/dist/schemas/skill.schema.js +16 -1
- package/dist/types/categories.d.ts +5 -0
- package/dist/types/categories.d.ts.map +1 -0
- package/dist/types/categories.js +35 -0
- package/dist/types/index.d.ts +26 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -1
- package/dist/types/intelligence.d.ts +132 -0
- package/dist/types/intelligence.d.ts.map +1 -0
- package/dist/types/intelligence.js +52 -0
- package/dist/types/plan-limits.d.ts +62 -0
- package/dist/types/plan-limits.d.ts.map +1 -0
- package/dist/types/plan-limits.js +88 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SkillCategory } from '@prave/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Pull a yaml `category:` value out of SKILL.md frontmatter. Returns null
|
|
4
|
+
* when no frontmatter, no `category` key, or value isn't in the enum.
|
|
5
|
+
*/
|
|
6
|
+
export declare function extractCategoryFromFrontmatter(content: string): SkillCategory | null;
|
|
7
|
+
/**
|
|
8
|
+
* Pull a yaml `description:` from SKILL.md frontmatter, if present. Used by
|
|
9
|
+
* the import path so frontmatter authors don't pay for AI generation.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractDescriptionFromFrontmatter(content: string): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Classify a skill by frontmatter first, then by keyword score, then 'other'.
|
|
14
|
+
* Caller should still allow the user to override before insert.
|
|
15
|
+
*/
|
|
16
|
+
export declare function classifySkill(opts: {
|
|
17
|
+
name?: string | null;
|
|
18
|
+
description?: string | null;
|
|
19
|
+
content?: string | null;
|
|
20
|
+
}): SkillCategory;
|
|
21
|
+
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/lib/classify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAyClD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CASpF;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAShF;AAkDD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB,GAAG,aAAa,CAmBhB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
const RULES = [
|
|
2
|
+
{ category: 'engineering', keywords: /\b(typescript|react|api|backend|frontend|database|sql|component|refactor|build|deploy|library|framework|debug|test runner)\b/i },
|
|
3
|
+
{ category: 'devops', keywords: /\b(docker|kubernetes|k8s|ci\/cd|pipeline|terraform|ansible|helm|nginx|caddy|reverse proxy|deployment|infrastructure)\b/i },
|
|
4
|
+
{ category: 'security', keywords: /\b(auth|jwt|oauth|xss|csrf|rbac|encryption|vulnerab|pentest|threat|owasp|sanitize|escape)\b/i },
|
|
5
|
+
{ category: 'data', keywords: /\b(etl|airflow|warehouse|snowflake|bigquery|pipeline|ingest|elasticsearch|postgres|mongodb|redis)\b/i },
|
|
6
|
+
{ category: 'ai', keywords: /\b(claude|gpt|llm|prompt|embedding|rag|tokeniz|fine[- ]?tune|inference|anthropic|openai|hugging.?face|model|agent)\b/i },
|
|
7
|
+
{ category: 'design', keywords: /\b(ui|ux|figma|wireframe|mockup|color palette|typography|spacing|layout|brand|visual|prototype|usability)\b/i },
|
|
8
|
+
{ category: 'marketing', keywords: /\b(seo|sem|cro|conversion|funnel|landing page|copywriting|ad creative|paid ads|email marketing|growth|campaign|outreach|social media|trustpilot|cold email|lead magnet)\b/i },
|
|
9
|
+
{ category: 'analytics', keywords: /\b(analytics|metrics|dashboard|kpi|cohort|retention|attribution|event tracking|mixpanel|amplitude|posthog|ga4|google analytics)\b/i },
|
|
10
|
+
{ category: 'research', keywords: /\b(research|interview|survey|user testing|persona|hypothesis|experiment|methodology|literature review|customer development)\b/i },
|
|
11
|
+
{ category: 'writing', keywords: /\b(write|writing|edit|editorial|tone of voice|narrative|story|blog post|copy[- ]?edit|grammar|style guide|proofread)\b/i },
|
|
12
|
+
{ category: 'product', keywords: /\b(product[- ]?management|roadmap|backlog|user story|epic|requirement|spec(ification)?|feature flag|prd|stakeholder|prioriti[zs]ation|jira|linear)\b/i },
|
|
13
|
+
{ category: 'productivity', keywords: /\b(productivity|workflow|automation|task management|todo|note[- ]?taking|knowledge base|second brain|gtd|focus|inbox)\b/i },
|
|
14
|
+
{ category: 'workflow-orchestration', keywords: /\b(orchestrat|workflow engine|state machine|saga|step function|temporal|n8n|zapier|airflow dag|orchestration)\b/i },
|
|
15
|
+
];
|
|
16
|
+
const FRONTMATTER_RE = /^---\s*\n([\s\S]*?)\n---/;
|
|
17
|
+
const FALLBACK = 'other';
|
|
18
|
+
/**
|
|
19
|
+
* Pull a yaml `category:` value out of SKILL.md frontmatter. Returns null
|
|
20
|
+
* when no frontmatter, no `category` key, or value isn't in the enum.
|
|
21
|
+
*/
|
|
22
|
+
export function extractCategoryFromFrontmatter(content) {
|
|
23
|
+
const match = FRONTMATTER_RE.exec(content);
|
|
24
|
+
if (!match)
|
|
25
|
+
return null;
|
|
26
|
+
const fm = match[1];
|
|
27
|
+
if (!fm)
|
|
28
|
+
return null;
|
|
29
|
+
const line = fm.split('\n').find((l) => /^\s*category\s*:/i.test(l));
|
|
30
|
+
if (!line)
|
|
31
|
+
return null;
|
|
32
|
+
const raw = line.split(':').slice(1).join(':').trim().replace(/^['"]|['"]$/g, '').toLowerCase();
|
|
33
|
+
return normalizeCategory(raw);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Pull a yaml `description:` from SKILL.md frontmatter, if present. Used by
|
|
37
|
+
* the import path so frontmatter authors don't pay for AI generation.
|
|
38
|
+
*/
|
|
39
|
+
export function extractDescriptionFromFrontmatter(content) {
|
|
40
|
+
const match = FRONTMATTER_RE.exec(content);
|
|
41
|
+
if (!match)
|
|
42
|
+
return null;
|
|
43
|
+
const fm = match[1];
|
|
44
|
+
if (!fm)
|
|
45
|
+
return null;
|
|
46
|
+
const line = fm.split('\n').find((l) => /^\s*description\s*:/i.test(l));
|
|
47
|
+
if (!line)
|
|
48
|
+
return null;
|
|
49
|
+
const raw = line.split(':').slice(1).join(':').trim().replace(/^['"]|['"]$/g, '');
|
|
50
|
+
return raw.length >= 12 ? raw.slice(0, 280) : null;
|
|
51
|
+
}
|
|
52
|
+
const ALIASES = {
|
|
53
|
+
dev: 'engineering',
|
|
54
|
+
software: 'engineering',
|
|
55
|
+
coding: 'engineering',
|
|
56
|
+
programming: 'engineering',
|
|
57
|
+
ml: 'ai',
|
|
58
|
+
llm: 'ai',
|
|
59
|
+
ops: 'devops',
|
|
60
|
+
infra: 'devops',
|
|
61
|
+
infrastructure: 'devops',
|
|
62
|
+
ux: 'design',
|
|
63
|
+
ui: 'design',
|
|
64
|
+
growth: 'marketing',
|
|
65
|
+
copywriting: 'writing',
|
|
66
|
+
copy: 'writing',
|
|
67
|
+
pm: 'product',
|
|
68
|
+
'product-management': 'product',
|
|
69
|
+
};
|
|
70
|
+
function normalizeCategory(raw) {
|
|
71
|
+
if (!raw)
|
|
72
|
+
return null;
|
|
73
|
+
const key = raw.toLowerCase().trim();
|
|
74
|
+
const aliased = ALIASES[key];
|
|
75
|
+
if (aliased)
|
|
76
|
+
return aliased;
|
|
77
|
+
// Direct match against the enum literals.
|
|
78
|
+
if ([
|
|
79
|
+
'engineering',
|
|
80
|
+
'design',
|
|
81
|
+
'marketing',
|
|
82
|
+
'research',
|
|
83
|
+
'writing',
|
|
84
|
+
'analytics',
|
|
85
|
+
'productivity',
|
|
86
|
+
'devops',
|
|
87
|
+
'data',
|
|
88
|
+
'ai',
|
|
89
|
+
'security',
|
|
90
|
+
'product',
|
|
91
|
+
'workflow-orchestration',
|
|
92
|
+
'other',
|
|
93
|
+
].includes(key)) {
|
|
94
|
+
return key;
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Classify a skill by frontmatter first, then by keyword score, then 'other'.
|
|
100
|
+
* Caller should still allow the user to override before insert.
|
|
101
|
+
*/
|
|
102
|
+
export function classifySkill(opts) {
|
|
103
|
+
const text = [opts.name ?? '', opts.description ?? '', opts.content ?? ''].join('\n');
|
|
104
|
+
if (opts.content) {
|
|
105
|
+
const fm = extractCategoryFromFrontmatter(opts.content);
|
|
106
|
+
if (fm)
|
|
107
|
+
return fm;
|
|
108
|
+
}
|
|
109
|
+
let bestCategory = FALLBACK;
|
|
110
|
+
let bestScore = 0;
|
|
111
|
+
for (const rule of RULES) {
|
|
112
|
+
const matches = text.match(new RegExp(rule.keywords.source, 'gi'));
|
|
113
|
+
const score = matches ? matches.length : 0;
|
|
114
|
+
if (score > bestScore) {
|
|
115
|
+
bestScore = score;
|
|
116
|
+
bestCategory = rule.category;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Require at least 2 keyword hits before committing — single hits are noisy.
|
|
120
|
+
return bestScore >= 2 ? bestCategory : FALLBACK;
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './classify.js';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const aiProviderSchema: z.ZodEnum<["anthropic", "openai", "gemini"]>;
|
|
3
|
+
export type AiProvider = z.infer<typeof aiProviderSchema>;
|
|
4
|
+
export declare const AI_PROVIDER_LABELS: Record<AiProvider, string>;
|
|
5
|
+
export declare const setApiKeyInputSchema: z.ZodObject<{
|
|
6
|
+
provider: z.ZodEnum<["anthropic", "openai", "gemini"]>;
|
|
7
|
+
api_key: z.ZodString;
|
|
8
|
+
label: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
provider: "gemini" | "anthropic" | "openai";
|
|
11
|
+
api_key: string;
|
|
12
|
+
label?: string | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
provider: "gemini" | "anthropic" | "openai";
|
|
15
|
+
api_key: string;
|
|
16
|
+
label?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type SetApiKeyInput = z.infer<typeof setApiKeyInputSchema>;
|
|
19
|
+
export interface UserApiKeyView {
|
|
20
|
+
id: string;
|
|
21
|
+
provider: AiProvider;
|
|
22
|
+
last4: string;
|
|
23
|
+
label: string | null;
|
|
24
|
+
created_at: string;
|
|
25
|
+
updated_at: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const aiCompleteInputSchema: z.ZodObject<{
|
|
28
|
+
provider: z.ZodEnum<["anthropic", "openai", "gemini"]>;
|
|
29
|
+
before: z.ZodString;
|
|
30
|
+
after: z.ZodOptional<z.ZodString>;
|
|
31
|
+
file_type: z.ZodDefault<z.ZodEnum<["md", "json", "ts", "js", "yaml", "plain"]>>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
provider: "gemini" | "anthropic" | "openai";
|
|
34
|
+
before: string;
|
|
35
|
+
file_type: "md" | "json" | "ts" | "js" | "yaml" | "plain";
|
|
36
|
+
after?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
provider: "gemini" | "anthropic" | "openai";
|
|
39
|
+
before: string;
|
|
40
|
+
after?: string | undefined;
|
|
41
|
+
file_type?: "md" | "json" | "ts" | "js" | "yaml" | "plain" | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
export type AiCompleteInput = z.infer<typeof aiCompleteInputSchema>;
|
|
44
|
+
export declare const aiGenerateInputSchema: z.ZodObject<{
|
|
45
|
+
provider: z.ZodEnum<["anthropic", "openai", "gemini"]>;
|
|
46
|
+
prompt: z.ZodString;
|
|
47
|
+
/** Existing skill content the user is iterating on. */
|
|
48
|
+
existing_content: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
prompt: string;
|
|
51
|
+
provider: "gemini" | "anthropic" | "openai";
|
|
52
|
+
existing_content?: string | undefined;
|
|
53
|
+
}, {
|
|
54
|
+
prompt: string;
|
|
55
|
+
provider: "gemini" | "anthropic" | "openai";
|
|
56
|
+
existing_content?: string | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export type AiGenerateInput = z.infer<typeof aiGenerateInputSchema>;
|
|
59
|
+
export interface AiCompleteResult {
|
|
60
|
+
completion: string;
|
|
61
|
+
/** Tokens consumed if the provider reports them. */
|
|
62
|
+
input_tokens?: number;
|
|
63
|
+
output_tokens?: number;
|
|
64
|
+
}
|
|
65
|
+
export interface AiGenerateResult {
|
|
66
|
+
/** Full SKILL.md body the editor should drop into the buffer. */
|
|
67
|
+
content: string;
|
|
68
|
+
input_tokens?: number;
|
|
69
|
+
output_tokens?: number;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=api-keys.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/api-keys.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,gBAAgB,8CAA4C,CAAA;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAIzD,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAQ/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,UAAU,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAID,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EAKhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,qBAAqB;;;IAGhC,uDAAuD;;;;;;;;;;EAEvD,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,oDAAoD;IACpD,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const aiProviderSchema = z.enum(['anthropic', 'openai', 'gemini']);
|
|
3
|
+
export const AI_PROVIDER_LABELS = {
|
|
4
|
+
anthropic: 'Claude (Anthropic)',
|
|
5
|
+
openai: 'OpenAI',
|
|
6
|
+
gemini: 'Google Gemini',
|
|
7
|
+
};
|
|
8
|
+
export const setApiKeyInputSchema = z.object({
|
|
9
|
+
provider: aiProviderSchema,
|
|
10
|
+
api_key: z
|
|
11
|
+
.string()
|
|
12
|
+
.min(8, 'API key looks too short')
|
|
13
|
+
.max(400, 'API key looks too long')
|
|
14
|
+
.trim(),
|
|
15
|
+
label: z.string().max(80).optional(),
|
|
16
|
+
});
|
|
17
|
+
/* ── In-editor AI assistant ─────────────────────────────────────────── */
|
|
18
|
+
export const aiCompleteInputSchema = z.object({
|
|
19
|
+
provider: aiProviderSchema,
|
|
20
|
+
before: z.string().max(8000),
|
|
21
|
+
after: z.string().max(2000).optional(),
|
|
22
|
+
file_type: z.enum(['md', 'json', 'ts', 'js', 'yaml', 'plain']).default('md'),
|
|
23
|
+
});
|
|
24
|
+
export const aiGenerateInputSchema = z.object({
|
|
25
|
+
provider: aiProviderSchema,
|
|
26
|
+
prompt: z.string().min(8).max(4000),
|
|
27
|
+
/** Existing skill content the user is iterating on. */
|
|
28
|
+
existing_content: z.string().max(50_000).optional(),
|
|
29
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const planSchema: z.ZodEnum<["free", "
|
|
2
|
+
export declare const planSchema: z.ZodEnum<["free", "explorer", "creator"]>;
|
|
3
3
|
export type Plan = z.infer<typeof planSchema>;
|
|
4
4
|
export declare const subscriptionStatusSchema: z.ZodEnum<["active", "trialing", "past_due", "canceled", "incomplete", "incomplete_expired", "unpaid"]>;
|
|
5
5
|
export type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>;
|
|
@@ -9,19 +9,19 @@ export type SubscriptionStatus = z.infer<typeof subscriptionStatusSchema>;
|
|
|
9
9
|
* to talk to Stripe directly.
|
|
10
10
|
*/
|
|
11
11
|
export declare const billingProfileSchema: z.ZodObject<{
|
|
12
|
-
plan: z.ZodEnum<["free", "
|
|
12
|
+
plan: z.ZodEnum<["free", "explorer", "creator"]>;
|
|
13
13
|
stripe_customer_id: z.ZodNullable<z.ZodString>;
|
|
14
14
|
stripe_subscription_id: z.ZodNullable<z.ZodString>;
|
|
15
15
|
subscription_status: z.ZodNullable<z.ZodEnum<["active", "trialing", "past_due", "canceled", "incomplete", "incomplete_expired", "unpaid"]>>;
|
|
16
16
|
current_period_end: z.ZodNullable<z.ZodString>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
plan: "free" | "
|
|
18
|
+
plan: "free" | "explorer" | "creator";
|
|
19
19
|
stripe_customer_id: string | null;
|
|
20
20
|
stripe_subscription_id: string | null;
|
|
21
21
|
subscription_status: "active" | "trialing" | "past_due" | "canceled" | "incomplete" | "incomplete_expired" | "unpaid" | null;
|
|
22
22
|
current_period_end: string | null;
|
|
23
23
|
}, {
|
|
24
|
-
plan: "free" | "
|
|
24
|
+
plan: "free" | "explorer" | "creator";
|
|
25
25
|
stripe_customer_id: string | null;
|
|
26
26
|
stripe_subscription_id: string | null;
|
|
27
27
|
subscription_status: "active" | "trialing" | "past_due" | "canceled" | "incomplete" | "incomplete_expired" | "unpaid" | null;
|
|
@@ -29,11 +29,11 @@ export declare const billingProfileSchema: z.ZodObject<{
|
|
|
29
29
|
}>;
|
|
30
30
|
export type BillingProfile = z.infer<typeof billingProfileSchema>;
|
|
31
31
|
export declare const billingCheckoutInputSchema: z.ZodObject<{
|
|
32
|
-
plan: z.ZodEnum<["
|
|
32
|
+
plan: z.ZodEnum<["explorer", "creator"]>;
|
|
33
33
|
}, "strip", z.ZodTypeAny, {
|
|
34
|
-
plan: "
|
|
34
|
+
plan: "explorer" | "creator";
|
|
35
35
|
}, {
|
|
36
|
-
plan: "
|
|
36
|
+
plan: "explorer" | "creator";
|
|
37
37
|
}>;
|
|
38
38
|
export type BillingCheckoutInput = z.infer<typeof billingCheckoutInputSchema>;
|
|
39
39
|
export declare const billingCheckoutResponseSchema: z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/billing.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"billing.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/billing.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,UAAU,4CAA0C,CAAA;AACjE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAE7C,eAAO,MAAM,wBAAwB,yGAQnC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEzE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAM/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,0BAA0B;;;;;;EAErC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAE7E,eAAO,MAAM,6BAA6B;;;;;;;;;EAGxC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAEnF,eAAO,MAAM,2BAA2B;;;;;;EAEtC,CAAA;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export const planSchema = z.enum(['free', '
|
|
2
|
+
export const planSchema = z.enum(['free', 'explorer', 'creator']);
|
|
3
3
|
export const subscriptionStatusSchema = z.enum([
|
|
4
4
|
'active',
|
|
5
5
|
'trialing',
|
|
@@ -22,7 +22,7 @@ export const billingProfileSchema = z.object({
|
|
|
22
22
|
current_period_end: z.string().datetime().nullable(),
|
|
23
23
|
});
|
|
24
24
|
export const billingCheckoutInputSchema = z.object({
|
|
25
|
-
plan: z.enum(['
|
|
25
|
+
plan: z.enum(['explorer', 'creator']),
|
|
26
26
|
});
|
|
27
27
|
export const billingCheckoutResponseSchema = z.object({
|
|
28
28
|
url: z.string().url(),
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Credit-pack catalog. One-time purchases that top up
|
|
4
|
+
* `profiles.tester_credits_balance`. Prices target a ≥40% gross margin
|
|
5
|
+
* over Haiku 4.5 worst-case usage (~€0.015/credit).
|
|
6
|
+
*/
|
|
7
|
+
export declare const CREDIT_PACK_IDS: readonly ["pack_25", "pack_100"];
|
|
8
|
+
export declare const creditPackIdSchema: z.ZodEnum<["pack_25", "pack_100"]>;
|
|
9
|
+
export type CreditPackId = z.infer<typeof creditPackIdSchema>;
|
|
10
|
+
export interface CreditPack {
|
|
11
|
+
id: CreditPackId;
|
|
12
|
+
credits: number;
|
|
13
|
+
/** Gross price in EUR (VAT-inclusive — Stripe Tax computes the net split). */
|
|
14
|
+
price_eur: number;
|
|
15
|
+
/** Best-for hint shown on the pack card. */
|
|
16
|
+
blurb: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Two top-up tiers — entry and refill. Per-credit price is intentionally
|
|
20
|
+
* kept *higher* than every paid subscription so power users always come
|
|
21
|
+
* out ahead by upgrading instead of hoarding packs. A single big pack
|
|
22
|
+
* tier was tested and dropped: it created subscription cannibalisation
|
|
23
|
+
* (Creator @ €0.040/credit vs a hypothetical 500-pack @ €0.038/credit)
|
|
24
|
+
* and one-shot LTV with months of dormancy.
|
|
25
|
+
*/
|
|
26
|
+
export declare const CREDIT_PACKS: Record<CreditPackId, CreditPack>;
|
|
27
|
+
export declare const creditCheckoutInputSchema: z.ZodObject<{
|
|
28
|
+
pack: z.ZodEnum<["pack_25", "pack_100"]>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
pack: "pack_25" | "pack_100";
|
|
31
|
+
}, {
|
|
32
|
+
pack: "pack_25" | "pack_100";
|
|
33
|
+
}>;
|
|
34
|
+
export type CreditCheckoutInput = z.infer<typeof creditCheckoutInputSchema>;
|
|
35
|
+
export declare const creditBalanceSchema: z.ZodObject<{
|
|
36
|
+
monthly_quota: z.ZodNumber;
|
|
37
|
+
monthly_used: z.ZodNumber;
|
|
38
|
+
monthly_remaining: z.ZodNumber;
|
|
39
|
+
/** Purchased top-up balance (never expires). */
|
|
40
|
+
balance: z.ZodNumber;
|
|
41
|
+
/** Total credits available right now (monthly_remaining + balance). */
|
|
42
|
+
total_available: z.ZodNumber;
|
|
43
|
+
/** ISO timestamp when the monthly window resets. */
|
|
44
|
+
resets_at: z.ZodString;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
monthly_quota: number;
|
|
47
|
+
monthly_used: number;
|
|
48
|
+
monthly_remaining: number;
|
|
49
|
+
balance: number;
|
|
50
|
+
total_available: number;
|
|
51
|
+
resets_at: string;
|
|
52
|
+
}, {
|
|
53
|
+
monthly_quota: number;
|
|
54
|
+
monthly_used: number;
|
|
55
|
+
monthly_remaining: number;
|
|
56
|
+
balance: number;
|
|
57
|
+
total_available: number;
|
|
58
|
+
resets_at: string;
|
|
59
|
+
}>;
|
|
60
|
+
export type CreditBalance = z.infer<typeof creditBalanceSchema>;
|
|
61
|
+
//# sourceMappingURL=credits.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/credits.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,eAAe,kCAAmC,CAAA;AAC/D,eAAO,MAAM,kBAAkB,oCAA0B,CAAA;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAA;IACjB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,UAAU,CAazD,CAAA;AAED,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,mBAAmB;;;;IAI9B,gDAAgD;;IAEhD,uEAAuE;;IAEvE,oDAAoD;;;;;;;;;;;;;;;;EAEpD,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Credit-pack catalog. One-time purchases that top up
|
|
4
|
+
* `profiles.tester_credits_balance`. Prices target a ≥40% gross margin
|
|
5
|
+
* over Haiku 4.5 worst-case usage (~€0.015/credit).
|
|
6
|
+
*/
|
|
7
|
+
export const CREDIT_PACK_IDS = ['pack_25', 'pack_100'];
|
|
8
|
+
export const creditPackIdSchema = z.enum(CREDIT_PACK_IDS);
|
|
9
|
+
/**
|
|
10
|
+
* Two top-up tiers — entry and refill. Per-credit price is intentionally
|
|
11
|
+
* kept *higher* than every paid subscription so power users always come
|
|
12
|
+
* out ahead by upgrading instead of hoarding packs. A single big pack
|
|
13
|
+
* tier was tested and dropped: it created subscription cannibalisation
|
|
14
|
+
* (Creator @ €0.040/credit vs a hypothetical 500-pack @ €0.038/credit)
|
|
15
|
+
* and one-shot LTV with months of dormancy.
|
|
16
|
+
*/
|
|
17
|
+
export const CREDIT_PACKS = {
|
|
18
|
+
pack_25: {
|
|
19
|
+
id: 'pack_25',
|
|
20
|
+
credits: 25,
|
|
21
|
+
price_eur: 2,
|
|
22
|
+
blurb: 'Quick top-up when you hit the wall.',
|
|
23
|
+
},
|
|
24
|
+
pack_100: {
|
|
25
|
+
id: 'pack_100',
|
|
26
|
+
credits: 100,
|
|
27
|
+
price_eur: 6,
|
|
28
|
+
blurb: 'Best value for active builders.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export const creditCheckoutInputSchema = z.object({
|
|
32
|
+
pack: creditPackIdSchema,
|
|
33
|
+
});
|
|
34
|
+
export const creditBalanceSchema = z.object({
|
|
35
|
+
monthly_quota: z.number().int().nonnegative(),
|
|
36
|
+
monthly_used: z.number().int().nonnegative(),
|
|
37
|
+
monthly_remaining: z.number().int().nonnegative(),
|
|
38
|
+
/** Purchased top-up balance (never expires). */
|
|
39
|
+
balance: z.number().int().nonnegative(),
|
|
40
|
+
/** Total credits available right now (monthly_remaining + balance). */
|
|
41
|
+
total_available: z.number().int().nonnegative(),
|
|
42
|
+
/** ISO timestamp when the monthly window resets. */
|
|
43
|
+
resets_at: z.string().datetime(),
|
|
44
|
+
});
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export * from './skill-dependency.schema.js';
|
|
|
8
8
|
export * from './skill-test.schema.js';
|
|
9
9
|
export * from './marketplace.schema.js';
|
|
10
10
|
export * from './billing.schema.js';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './credits.schema.js';
|
|
12
12
|
export * from './install.schema.js';
|
|
13
|
+
export * from './skill-pr.schema.js';
|
|
14
|
+
export * from './intelligence.schema.js';
|
|
15
|
+
export * from './api-keys.schema.js';
|
|
13
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -8,5 +8,8 @@ export * from './skill-dependency.schema.js';
|
|
|
8
8
|
export * from './skill-test.schema.js';
|
|
9
9
|
export * from './marketplace.schema.js';
|
|
10
10
|
export * from './billing.schema.js';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './credits.schema.js';
|
|
12
12
|
export * from './install.schema.js';
|
|
13
|
+
export * from './skill-pr.schema.js';
|
|
14
|
+
export * from './intelligence.schema.js';
|
|
15
|
+
export * from './api-keys.schema.js';
|
|
@@ -35,7 +35,7 @@ export declare const installRowSchema: z.ZodObject<{
|
|
|
35
35
|
slug: z.ZodString;
|
|
36
36
|
description: z.ZodNullable<z.ZodString>;
|
|
37
37
|
content: z.ZodNullable<z.ZodString>;
|
|
38
|
-
visibility: z.ZodDefault<z.ZodEnum<["public", "private"
|
|
38
|
+
visibility: z.ZodDefault<z.ZodEnum<["public", "private"]>>;
|
|
39
39
|
source_repo: z.ZodNullable<z.ZodString>;
|
|
40
40
|
license: z.ZodDefault<z.ZodString>;
|
|
41
41
|
category: z.ZodNullable<z.ZodString>;
|
|
@@ -48,6 +48,28 @@ export declare const installRowSchema: z.ZodObject<{
|
|
|
48
48
|
purchased: z.ZodOptional<z.ZodBoolean>;
|
|
49
49
|
is_owner: z.ZodOptional<z.ZodBoolean>;
|
|
50
50
|
bookmarked: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
owner: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
52
|
+
id: z.ZodString;
|
|
53
|
+
username: z.ZodNullable<z.ZodString>;
|
|
54
|
+
display_name: z.ZodNullable<z.ZodString>;
|
|
55
|
+
avatar_url: z.ZodNullable<z.ZodString>;
|
|
56
|
+
is_creator: z.ZodBoolean;
|
|
57
|
+
is_partner: z.ZodBoolean;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
id: string;
|
|
60
|
+
username: string | null;
|
|
61
|
+
display_name: string | null;
|
|
62
|
+
avatar_url: string | null;
|
|
63
|
+
is_creator: boolean;
|
|
64
|
+
is_partner: boolean;
|
|
65
|
+
}, {
|
|
66
|
+
id: string;
|
|
67
|
+
username: string | null;
|
|
68
|
+
display_name: string | null;
|
|
69
|
+
avatar_url: string | null;
|
|
70
|
+
is_creator: boolean;
|
|
71
|
+
is_partner: boolean;
|
|
72
|
+
}>>>;
|
|
51
73
|
created_at: z.ZodString;
|
|
52
74
|
updated_at: z.ZodString;
|
|
53
75
|
}, "id" | "name" | "slug" | "description" | "visibility" | "license" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
@@ -55,7 +77,7 @@ export declare const installRowSchema: z.ZodObject<{
|
|
|
55
77
|
name: string;
|
|
56
78
|
slug: string;
|
|
57
79
|
description: string | null;
|
|
58
|
-
visibility: "public" | "private"
|
|
80
|
+
visibility: "public" | "private";
|
|
59
81
|
license: string;
|
|
60
82
|
updated_at: string;
|
|
61
83
|
}, {
|
|
@@ -64,7 +86,7 @@ export declare const installRowSchema: z.ZodObject<{
|
|
|
64
86
|
slug: string;
|
|
65
87
|
description: string | null;
|
|
66
88
|
updated_at: string;
|
|
67
|
-
visibility?: "public" | "private" |
|
|
89
|
+
visibility?: "public" | "private" | undefined;
|
|
68
90
|
license?: string | undefined;
|
|
69
91
|
}>;
|
|
70
92
|
/** Latest version from `skill_versions`, attached by the API. */
|
|
@@ -80,7 +102,7 @@ export declare const installRowSchema: z.ZodObject<{
|
|
|
80
102
|
name: string;
|
|
81
103
|
slug: string;
|
|
82
104
|
description: string | null;
|
|
83
|
-
visibility: "public" | "private"
|
|
105
|
+
visibility: "public" | "private";
|
|
84
106
|
license: string;
|
|
85
107
|
updated_at: string;
|
|
86
108
|
};
|
|
@@ -97,7 +119,7 @@ export declare const installRowSchema: z.ZodObject<{
|
|
|
97
119
|
slug: string;
|
|
98
120
|
description: string | null;
|
|
99
121
|
updated_at: string;
|
|
100
|
-
visibility?: "public" | "private" |
|
|
122
|
+
visibility?: "public" | "private" | undefined;
|
|
101
123
|
license?: string | undefined;
|
|
102
124
|
};
|
|
103
125
|
latest_version?: number | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/install.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,4DAA4D;AAC5D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMxB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEnD,wDAAwD;AACxD,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"install.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/install.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,4DAA4D;AAC5D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;EAMxB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEnD,wDAAwD;AACxD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAU3B,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjE,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,wBAAwB;IACnC,0EAA0E;;;;;;EAE1E,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|