@refrakt-md/ai 0.4.0 → 0.5.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/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/chat.d.ts +17 -0
- package/dist/modes/chat.d.ts.map +1 -0
- package/dist/modes/chat.js +124 -0
- package/dist/modes/chat.js.map +1 -0
- package/dist/modes/write.d.ts +5 -0
- package/dist/modes/write.d.ts.map +1 -0
- package/dist/modes/write.js +57 -0
- package/dist/modes/write.js.map +1 -0
- package/dist/prompt.d.ts +9 -1
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +271 -21
- package/dist/prompt.js.map +1 -1
- package/dist/providers/anthropic.d.ts +3 -1
- package/dist/providers/anthropic.d.ts.map +1 -1
- package/dist/providers/anthropic.js +17 -3
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/gemini.d.ts +32 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +91 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/ollama.d.ts.map +1 -1
- package/dist/providers/ollama.js +15 -1
- package/dist/providers/ollama.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
export { generateSystemPrompt } from './prompt.js';
|
|
1
|
+
export { generateSystemPrompt, generateSystemPromptParts, getModeGuidance } from './prompt.js';
|
|
2
2
|
export type { RuneInfo } from './prompt.js';
|
|
3
3
|
export type { AIProvider, CompletionOptions, Message } from './provider.js';
|
|
4
4
|
export { createAnthropicProvider } from './providers/anthropic.js';
|
|
5
5
|
export type { AnthropicOptions } from './providers/anthropic.js';
|
|
6
6
|
export { createOllamaProvider } from './providers/ollama.js';
|
|
7
7
|
export type { OllamaOptions } from './providers/ollama.js';
|
|
8
|
+
export { createGeminiProvider } from './providers/gemini.js';
|
|
9
|
+
export type { GeminiOptions } from './providers/gemini.js';
|
|
10
|
+
export { writePrompt } from './modes/write.js';
|
|
11
|
+
export type { WritePromptOptions } from './modes/write.js';
|
|
12
|
+
export { CHAT_MODES, CHAT_MODE_LIST, getChatModeRunes } from './modes/chat.js';
|
|
13
|
+
export type { ChatMode, ChatModeDefinition } from './modes/chat.js';
|
|
8
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC/F,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { generateSystemPrompt } from './prompt.js';
|
|
1
|
+
export { generateSystemPrompt, generateSystemPromptParts, getModeGuidance } from './prompt.js';
|
|
2
2
|
export { createAnthropicProvider } from './providers/anthropic.js';
|
|
3
3
|
export { createOllamaProvider } from './providers/ollama.js';
|
|
4
|
+
export { createGeminiProvider } from './providers/gemini.js';
|
|
5
|
+
export { writePrompt } from './modes/write.js';
|
|
6
|
+
export { CHAT_MODES, CHAT_MODE_LIST, getChatModeRunes } from './modes/chat.js';
|
|
4
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ChatMode = 'general' | 'code' | 'content' | 'marketing' | 'travel' | 'design' | 'full';
|
|
2
|
+
export interface ChatModeDefinition {
|
|
3
|
+
id: ChatMode;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
/** Parent rune names included in this mode. null = all runes (full mode). */
|
|
7
|
+
runes: string[] | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const CHAT_MODES: Record<ChatMode, ChatModeDefinition>;
|
|
10
|
+
/** Ordered list for UI rendering */
|
|
11
|
+
export declare const CHAT_MODE_LIST: ChatModeDefinition[];
|
|
12
|
+
/**
|
|
13
|
+
* Returns the expanded set of rune names for a mode, including child companions.
|
|
14
|
+
* Returns undefined for 'full' mode (no filtering).
|
|
15
|
+
*/
|
|
16
|
+
export declare function getChatModeRunes(mode: ChatMode): Set<string> | undefined;
|
|
17
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/modes/chat.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEnG,MAAM,WAAW,kBAAkB;IAClC,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CACvB;AAkCD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAgE3D,CAAC;AAEF,oCAAoC;AACpC,eAAO,MAAM,cAAc,EAAE,kBAAkB,EAQ9C,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAcxE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/** Maps parent runes to their child-only companion runes */
|
|
2
|
+
const CHILD_RUNE_MAP = {
|
|
3
|
+
pricing: ['tier'],
|
|
4
|
+
comparison: ['comparison-column', 'comparison-row'],
|
|
5
|
+
symbol: ['symbol-group', 'symbol-member'],
|
|
6
|
+
conversation: ['conversation-message'],
|
|
7
|
+
annotate: ['note'],
|
|
8
|
+
form: ['form-field'],
|
|
9
|
+
bento: ['bento-cell'],
|
|
10
|
+
storyboard: ['storyboard-panel'],
|
|
11
|
+
reveal: ['reveal-step'],
|
|
12
|
+
'design-context': ['palette', 'typography', 'spacing', 'swatch'],
|
|
13
|
+
};
|
|
14
|
+
const CORE_RUNES = [
|
|
15
|
+
'hint',
|
|
16
|
+
'grid',
|
|
17
|
+
'tabs',
|
|
18
|
+
'accordion',
|
|
19
|
+
'details',
|
|
20
|
+
'steps',
|
|
21
|
+
'figure',
|
|
22
|
+
'embed',
|
|
23
|
+
'sidenote',
|
|
24
|
+
'datatable',
|
|
25
|
+
'comparison',
|
|
26
|
+
'codegroup',
|
|
27
|
+
];
|
|
28
|
+
/** Page-level content runes — included in general, content, and marketing modes */
|
|
29
|
+
const PAGE_RUNES = ['hero', 'cta', 'feature'];
|
|
30
|
+
export const CHAT_MODES = {
|
|
31
|
+
general: {
|
|
32
|
+
id: 'general',
|
|
33
|
+
label: 'General',
|
|
34
|
+
description: 'Core runes for everyday content',
|
|
35
|
+
runes: [...CORE_RUNES, ...PAGE_RUNES],
|
|
36
|
+
},
|
|
37
|
+
code: {
|
|
38
|
+
id: 'code',
|
|
39
|
+
label: 'Code & Docs',
|
|
40
|
+
description: 'Technical docs, API references, and code showcases',
|
|
41
|
+
runes: [...CORE_RUNES, 'sandbox', 'preview', 'diff', 'compare', 'symbol', 'api', 'diagram'],
|
|
42
|
+
},
|
|
43
|
+
content: {
|
|
44
|
+
id: 'content',
|
|
45
|
+
label: 'Content',
|
|
46
|
+
description: 'Editorial content, guides, and storytelling',
|
|
47
|
+
runes: [
|
|
48
|
+
...CORE_RUNES,
|
|
49
|
+
...PAGE_RUNES,
|
|
50
|
+
'timeline',
|
|
51
|
+
'changelog',
|
|
52
|
+
'howto',
|
|
53
|
+
'recipe',
|
|
54
|
+
'testimonial',
|
|
55
|
+
'annotate',
|
|
56
|
+
'conversation',
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
marketing: {
|
|
60
|
+
id: 'marketing',
|
|
61
|
+
label: 'Marketing',
|
|
62
|
+
description: 'Landing pages, pricing, and business content',
|
|
63
|
+
runes: [
|
|
64
|
+
...CORE_RUNES,
|
|
65
|
+
...PAGE_RUNES,
|
|
66
|
+
'pricing',
|
|
67
|
+
'testimonial',
|
|
68
|
+
'bento',
|
|
69
|
+
'cast',
|
|
70
|
+
'organization',
|
|
71
|
+
'event',
|
|
72
|
+
'storyboard',
|
|
73
|
+
'form',
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
travel: {
|
|
77
|
+
id: 'travel',
|
|
78
|
+
label: 'Travel',
|
|
79
|
+
description: 'Maps, itineraries, and location-based content',
|
|
80
|
+
runes: [...CORE_RUNES, 'map', 'timeline', 'recipe', 'event', 'cast'],
|
|
81
|
+
},
|
|
82
|
+
design: {
|
|
83
|
+
id: 'design',
|
|
84
|
+
label: 'Design',
|
|
85
|
+
description: 'Design systems, tokens, and visual prototyping',
|
|
86
|
+
runes: [...CORE_RUNES, 'sandbox', 'preview', 'swatch', 'palette', 'typography', 'spacing', 'design-context'],
|
|
87
|
+
},
|
|
88
|
+
full: {
|
|
89
|
+
id: 'full',
|
|
90
|
+
label: 'Full',
|
|
91
|
+
description: 'All runes available',
|
|
92
|
+
runes: null,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
/** Ordered list for UI rendering */
|
|
96
|
+
export const CHAT_MODE_LIST = [
|
|
97
|
+
CHAT_MODES.general,
|
|
98
|
+
CHAT_MODES.code,
|
|
99
|
+
CHAT_MODES.content,
|
|
100
|
+
CHAT_MODES.marketing,
|
|
101
|
+
CHAT_MODES.travel,
|
|
102
|
+
CHAT_MODES.design,
|
|
103
|
+
CHAT_MODES.full,
|
|
104
|
+
];
|
|
105
|
+
/**
|
|
106
|
+
* Returns the expanded set of rune names for a mode, including child companions.
|
|
107
|
+
* Returns undefined for 'full' mode (no filtering).
|
|
108
|
+
*/
|
|
109
|
+
export function getChatModeRunes(mode) {
|
|
110
|
+
const def = CHAT_MODES[mode];
|
|
111
|
+
if (!def.runes)
|
|
112
|
+
return undefined;
|
|
113
|
+
const expanded = new Set(def.runes);
|
|
114
|
+
for (const name of def.runes) {
|
|
115
|
+
const children = CHILD_RUNE_MAP[name];
|
|
116
|
+
if (children) {
|
|
117
|
+
for (const child of children) {
|
|
118
|
+
expanded.add(child);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return expanded;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/modes/chat.ts"],"names":[],"mappings":"AAUA,4DAA4D;AAC5D,MAAM,cAAc,GAA6B;IAChD,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,UAAU,EAAE,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;IACnD,MAAM,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;IACzC,YAAY,EAAE,CAAC,sBAAsB,CAAC;IACtC,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,CAAC,YAAY,CAAC;IACpB,KAAK,EAAE,CAAC,YAAY,CAAC;IACrB,UAAU,EAAE,CAAC,kBAAkB,CAAC;IAChC,MAAM,EAAE,CAAC,aAAa,CAAC;IACvB,gBAAgB,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;CAChE,CAAC;AAEF,MAAM,UAAU,GAAG;IAClB,MAAM;IACN,MAAM;IACN,MAAM;IACN,WAAW;IACX,SAAS;IACT,OAAO;IACP,QAAQ;IACR,OAAO;IACP,UAAU;IACV,WAAW;IACX,YAAY;IACZ,WAAW;CACF,CAAC;AAEX,mFAAmF;AACnF,MAAM,UAAU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B;AAYD,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CA+ChE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const FRONTMATTER_INSTRUCTION = `
|
|
2
|
+
|
|
3
|
+
## File format
|
|
4
|
+
|
|
5
|
+
Every page should begin with YAML frontmatter:
|
|
6
|
+
---
|
|
7
|
+
title: Page Title
|
|
8
|
+
description: A brief description
|
|
9
|
+
---`;
|
|
10
|
+
export function writePrompt(options) {
|
|
11
|
+
if (!options?.multiFile) {
|
|
12
|
+
return FRONTMATTER_INSTRUCTION;
|
|
13
|
+
}
|
|
14
|
+
return FRONTMATTER_INSTRUCTION + `
|
|
15
|
+
|
|
16
|
+
## Multi-file output
|
|
17
|
+
|
|
18
|
+
You are generating multiple content files for a site. Separate each file with a marker line:
|
|
19
|
+
|
|
20
|
+
--- FILE: path/to/file.md ---
|
|
21
|
+
|
|
22
|
+
Rules:
|
|
23
|
+
- The path is relative to the content directory (e.g. \`index.md\`, \`docs/getting-started.md\`, \`blog/first-post.md\`).
|
|
24
|
+
- Start your output with the first file marker.
|
|
25
|
+
- Every file must begin with YAML frontmatter (title, description).
|
|
26
|
+
- For a \`_layout.md\` file, include only frontmatter with layout-level metadata.
|
|
27
|
+
- Use directory nesting for logical sections (e.g. \`docs/\`, \`blog/\`).
|
|
28
|
+
- Do NOT use \`../\` in file paths.
|
|
29
|
+
|
|
30
|
+
Example structure:
|
|
31
|
+
|
|
32
|
+
--- FILE: _layout.md ---
|
|
33
|
+
---
|
|
34
|
+
title: My Site
|
|
35
|
+
description: A documentation site
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
--- FILE: index.md ---
|
|
39
|
+
---
|
|
40
|
+
title: Home
|
|
41
|
+
description: Welcome to the site
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
{% hero %}
|
|
45
|
+
# Welcome
|
|
46
|
+
...
|
|
47
|
+
{% /hero %}
|
|
48
|
+
|
|
49
|
+
--- FILE: docs/getting-started.md ---
|
|
50
|
+
---
|
|
51
|
+
title: Getting Started
|
|
52
|
+
description: Learn the basics
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
Content here...`;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/modes/write.ts"],"names":[],"mappings":"AAIA,MAAM,uBAAuB,GAAG;;;;;;;;IAQ5B,CAAC;AAEL,MAAM,UAAU,WAAW,CAAC,OAA4B;IACvD,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;QACzB,OAAO,uBAAuB,CAAC;IAChC,CAAC;IAED,OAAO,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyClB,CAAC;AACjB,CAAC"}
|
package/dist/prompt.d.ts
CHANGED
|
@@ -15,5 +15,13 @@ export interface RuneInfo {
|
|
|
15
15
|
}>;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
/** Returns mode-specific writing guidance, if any. */
|
|
19
|
+
export declare function getModeGuidance(mode: string): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the system prompt as two separate parts for cache-aware usage:
|
|
22
|
+
* [0] Base instructions (role description, writing rules) — stable across all modes
|
|
23
|
+
* [1] Rune vocabulary (available runes section) + optional mode guidance — varies by mode
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateSystemPromptParts(runes: Record<string, RuneInfo>, includeRunes?: Set<string>, mode?: string): [string, string];
|
|
26
|
+
export declare function generateSystemPrompt(runes: Record<string, RuneInfo>, includeRunes?: Set<string>, mode?: string): string;
|
|
19
27
|
//# sourceMappingURL=prompt.d.ts.map
|
package/dist/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":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AAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,IAAI,CAAC,EAAE,MAAM,GACX,MAAM,CAER"}
|
package/dist/prompt.js
CHANGED
|
@@ -10,6 +10,11 @@ const EXCLUDED_RUNES = new Set([
|
|
|
10
10
|
'changelog-release',
|
|
11
11
|
'breadcrumb-item',
|
|
12
12
|
'cast-member',
|
|
13
|
+
'map-pin',
|
|
14
|
+
]);
|
|
15
|
+
/** Attributes to hide from the AI prompt (rune.attribute format) */
|
|
16
|
+
const HIDDEN_ATTRIBUTES = new Set([
|
|
17
|
+
'feature.split',
|
|
13
18
|
]);
|
|
14
19
|
/** Usage examples for each author-facing rune */
|
|
15
20
|
const RUNE_EXAMPLES = {
|
|
@@ -351,6 +356,132 @@ graph TD
|
|
|
351
356
|
This is a margin note that provides additional context
|
|
352
357
|
without interrupting the main flow of the text.
|
|
353
358
|
{% /sidenote %}`,
|
|
359
|
+
preview: `{% preview title="Button Variants" theme="auto" responsive="mobile,tablet,desktop" %}
|
|
360
|
+
\`\`\`html
|
|
361
|
+
<button class="rf-btn rf-btn--primary">Primary</button>
|
|
362
|
+
<button class="rf-btn rf-btn--secondary">Secondary</button>
|
|
363
|
+
\`\`\`
|
|
364
|
+
|
|
365
|
+
<button class="rf-btn rf-btn--primary">Primary</button>
|
|
366
|
+
<button class="rf-btn rf-btn--secondary">Secondary</button>
|
|
367
|
+
{% /preview %}`,
|
|
368
|
+
sandbox: `{% sandbox framework="tailwind" %}
|
|
369
|
+
<div class="flex items-center gap-4 p-6 bg-white rounded-xl shadow-lg max-w-sm">
|
|
370
|
+
<img src="https://i.pravatar.cc/80" alt="Avatar" class="w-16 h-16 rounded-full" />
|
|
371
|
+
<div>
|
|
372
|
+
<h3 class="text-lg font-semibold text-gray-900">Jane Doe</h3>
|
|
373
|
+
<p class="text-sm text-gray-500">Product Designer</p>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
{% /sandbox %}`,
|
|
377
|
+
map: `{% map zoom="13" height="large" %}
|
|
378
|
+
## Landmarks
|
|
379
|
+
- **Eiffel Tower** - *Iconic iron lattice tower* - 48.8566, 2.3522
|
|
380
|
+
- **Louvre Museum** - *World's largest art museum* - 48.8606, 2.3376
|
|
381
|
+
|
|
382
|
+
## Parks
|
|
383
|
+
- **Jardin du Luxembourg** - 48.8462, 2.3372
|
|
384
|
+
{% /map %}`,
|
|
385
|
+
swatch: `{% swatch color="#2563EB" label="Ultramarine" /%}`,
|
|
386
|
+
palette: `{% palette title="Brand Colors" showContrast="true" showA11y="true" %}
|
|
387
|
+
## Primary
|
|
388
|
+
- Blue: #2563EB
|
|
389
|
+
- Indigo: #4F46E5
|
|
390
|
+
- Purple: #7C3AED
|
|
391
|
+
|
|
392
|
+
## Neutrals
|
|
393
|
+
- Gray: #F9FAFB, #F3F4F6, #E5E7EB, #D1D5DB, #9CA3AF, #6B7280, #4B5563, #374151, #1F2937, #111827
|
|
394
|
+
{% /palette %}`,
|
|
395
|
+
typography: `{% typography title="Font System" sample="The quick brown fox jumps over the lazy dog" %}
|
|
396
|
+
- heading: Inter (600, 700)
|
|
397
|
+
- body: Inter (400, 500)
|
|
398
|
+
- mono: JetBrains Mono (400, 500)
|
|
399
|
+
{% /typography %}`,
|
|
400
|
+
spacing: `{% spacing title="Design Tokens" %}
|
|
401
|
+
## Spacing
|
|
402
|
+
- unit: 4px
|
|
403
|
+
- scale: 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32
|
|
404
|
+
|
|
405
|
+
## Radius
|
|
406
|
+
- sm: 4px
|
|
407
|
+
- md: 8px
|
|
408
|
+
- lg: 12px
|
|
409
|
+
- full: 9999px
|
|
410
|
+
|
|
411
|
+
## Shadows
|
|
412
|
+
- sm: 0 1px 2px rgba(0,0,0,0.05)
|
|
413
|
+
- md: 0 4px 6px rgba(0,0,0,0.1)
|
|
414
|
+
- lg: 0 10px 15px rgba(0,0,0,0.1)
|
|
415
|
+
{% /spacing %}`,
|
|
416
|
+
'design-context': `{% design-context title="Brand Tokens" %}
|
|
417
|
+
|
|
418
|
+
{% typography %}
|
|
419
|
+
- heading: Inter (400, 600, 700)
|
|
420
|
+
- body: Source Sans Pro (400, 600)
|
|
421
|
+
- mono: Fira Code (400)
|
|
422
|
+
{% /typography %}
|
|
423
|
+
|
|
424
|
+
{% palette %}
|
|
425
|
+
## Brand
|
|
426
|
+
- Primary: #2563EB
|
|
427
|
+
- Secondary: #7C3AED
|
|
428
|
+
- Accent: #F59E0B
|
|
429
|
+
{% /palette %}
|
|
430
|
+
|
|
431
|
+
{% spacing %}
|
|
432
|
+
## Spacing
|
|
433
|
+
- unit: 4px
|
|
434
|
+
- scale: 4, 8, 12, 16, 24, 32, 48, 64
|
|
435
|
+
{% /spacing %}
|
|
436
|
+
|
|
437
|
+
{% /design-context %}`,
|
|
438
|
+
bento: `{% bento columns=3 %}
|
|
439
|
+
## Fast Builds
|
|
440
|
+
|
|
441
|
+
Static generation with incremental rebuilds for instant deployments.
|
|
442
|
+
|
|
443
|
+
### Type-Safe Content
|
|
444
|
+
|
|
445
|
+
Every rune produces typed, validated output.
|
|
446
|
+
|
|
447
|
+
### Zero Config
|
|
448
|
+
|
|
449
|
+
Convention-based project structure — just write Markdown.
|
|
450
|
+
|
|
451
|
+
## Open Source
|
|
452
|
+
|
|
453
|
+
Free forever, community-driven, and fully extensible.
|
|
454
|
+
{% /bento %}`,
|
|
455
|
+
form: `{% form action="/api/contact" method="POST" success="Thanks! We'll be in touch." %}
|
|
456
|
+
# Contact Us
|
|
457
|
+
|
|
458
|
+
- Name (required)
|
|
459
|
+
- Email (required, placeholder: "you@example.com")
|
|
460
|
+
- Company (optional)
|
|
461
|
+
|
|
462
|
+
> What are you interested in?
|
|
463
|
+
- Product demo
|
|
464
|
+
- Partnership
|
|
465
|
+
- Support
|
|
466
|
+
- Other
|
|
467
|
+
|
|
468
|
+
- Message (required)
|
|
469
|
+
|
|
470
|
+
**Send Message**
|
|
471
|
+
{% /form %}`,
|
|
472
|
+
storyboard: `{% storyboard columns=3 style="clean" %}
|
|
473
|
+

|
|
474
|
+
|
|
475
|
+
We start by understanding your audience and goals.
|
|
476
|
+
|
|
477
|
+

|
|
478
|
+
|
|
479
|
+
Our team creates wireframes and visual prototypes.
|
|
480
|
+
|
|
481
|
+

|
|
482
|
+
|
|
483
|
+
We ship, measure, and iterate together.
|
|
484
|
+
{% /storyboard %}`,
|
|
354
485
|
};
|
|
355
486
|
function attributeTypeName(type) {
|
|
356
487
|
if (type === String)
|
|
@@ -393,9 +524,12 @@ function describeRune(rune) {
|
|
|
393
524
|
// Attributes
|
|
394
525
|
const attrs = rune.schema.attributes;
|
|
395
526
|
if (attrs && Object.keys(attrs).length > 0) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
lines.push(
|
|
527
|
+
const entries = Object.entries(attrs).filter(([name]) => !HIDDEN_ATTRIBUTES.has(`${rune.name}.${name}`));
|
|
528
|
+
if (entries.length > 0) {
|
|
529
|
+
lines.push('Attributes:');
|
|
530
|
+
for (const [attrName, attrDef] of entries) {
|
|
531
|
+
lines.push(describeAttribute(attrName, attrDef));
|
|
532
|
+
}
|
|
399
533
|
}
|
|
400
534
|
}
|
|
401
535
|
// Reinterprets
|
|
@@ -414,34 +548,150 @@ function describeRune(rune) {
|
|
|
414
548
|
}
|
|
415
549
|
return lines.join('\n');
|
|
416
550
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
.filter(rune => !EXCLUDED_RUNES.has(rune.name))
|
|
420
|
-
.map(rune => describeRune(rune))
|
|
421
|
-
.join('\n\n');
|
|
422
|
-
return `You are a content author for a website built with refrakt.md.
|
|
423
|
-
Write Markdown files using Markdoc tags called "runes" ({% tag %} syntax).
|
|
551
|
+
const BASE_INSTRUCTIONS = `You are a content author for a website built with refrakt.md.
|
|
552
|
+
Write content using Markdoc tags called "runes" ({% tag %} syntax).
|
|
424
553
|
|
|
425
554
|
Content inside a rune is reinterpreted — a heading inside {% cta %}
|
|
426
555
|
becomes the hero headline, while inside {% nav %} it becomes a group title.
|
|
427
556
|
This context-dependent meaning is what makes runes powerful.
|
|
428
557
|
|
|
429
|
-
Every page should begin with YAML frontmatter:
|
|
430
|
-
---
|
|
431
|
-
title: Page Title
|
|
432
|
-
description: A brief description
|
|
433
|
-
---
|
|
434
|
-
|
|
435
558
|
## Writing rules
|
|
436
559
|
|
|
437
560
|
- Use standard Markdown for body text (paragraphs, bold, italic, links, images, code fences, lists).
|
|
438
561
|
- Use runes ({% tag %} ... {% /tag %}) for semantic structure.
|
|
439
562
|
- Runes can be nested where it makes sense (e.g. {% tier %} inside {% pricing %}).
|
|
440
563
|
- Horizontal rules (---) delimit grid cells inside {% grid %} and {% codegroup %}.
|
|
441
|
-
- Do NOT invent rune names that are not listed below
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
564
|
+
- Do NOT invent rune names that are not listed below.`;
|
|
565
|
+
/** Mode-specific writing guidance appended to the rune vocabulary layer */
|
|
566
|
+
const MODE_GUIDANCE = {
|
|
567
|
+
general: `## General Mode Guidelines
|
|
568
|
+
|
|
569
|
+
You have access to core layout runes plus page-level runes (hero, cta, feature). Use them when the user asks for structured content:
|
|
570
|
+
- {% hero %} for page introductions with headline + call-to-action links
|
|
571
|
+
- {% cta %} for standalone call-to-action sections
|
|
572
|
+
- {% feature %} for listing product/service features with descriptions
|
|
573
|
+
- {% grid %} for multi-column layouts
|
|
574
|
+
- {% tabs %}, {% accordion %}, {% details %} for organizing content
|
|
575
|
+
- {% steps %} for sequential instructions
|
|
576
|
+
- {% comparison %} for side-by-side data tables`,
|
|
577
|
+
code: `## Code & Docs Mode Guidelines
|
|
578
|
+
|
|
579
|
+
Use code-focused runes to create rich technical documentation:
|
|
580
|
+
- {% codegroup %} for showing the same concept in multiple languages
|
|
581
|
+
- {% diff %} for before/after code comparisons
|
|
582
|
+
- {% compare %} for side-by-side code blocks
|
|
583
|
+
- {% api %} for REST API endpoint documentation with parameters and responses
|
|
584
|
+
- {% symbol %} for type/class/function reference documentation
|
|
585
|
+
- {% diagram %} for architecture and flow diagrams (Mermaid syntax)
|
|
586
|
+
- {% sandbox %} + {% preview %} for live HTML/CSS/JS demos
|
|
587
|
+
- {% steps %} for tutorials and setup guides
|
|
588
|
+
- {% tabs %} for platform-specific instructions (npm/yarn/pnpm)`,
|
|
589
|
+
content: `## Content Mode Guidelines
|
|
590
|
+
|
|
591
|
+
Use editorial and storytelling runes to create engaging content:
|
|
592
|
+
- {% hero %} for page introductions with headline + call-to-action links
|
|
593
|
+
- {% cta %} for standalone call-to-action sections
|
|
594
|
+
- {% feature %} for listing highlights or benefits
|
|
595
|
+
- {% timeline %} for chronological narratives or history
|
|
596
|
+
- {% changelog %} for release notes and version history
|
|
597
|
+
- {% howto %} for step-by-step tutorials with estimated time
|
|
598
|
+
- {% recipe %} for recipes with ingredients, steps, and metadata
|
|
599
|
+
- {% testimonial %} for quotes with attribution and star ratings
|
|
600
|
+
- {% annotate %} for adding margin notes to content
|
|
601
|
+
- {% conversation %} for dialogue-style content`,
|
|
602
|
+
marketing: `## Marketing Mode Guidelines
|
|
603
|
+
|
|
604
|
+
You are creating marketing and business content. Use runes to create polished, structured pages:
|
|
605
|
+
- {% hero %} for the page introduction — headline, description, and call-to-action links
|
|
606
|
+
- {% feature %} for showcasing product benefits or service highlights
|
|
607
|
+
- {% pricing %} with {% tier %} children for pricing tables
|
|
608
|
+
- {% testimonial %} for customer quotes with ratings
|
|
609
|
+
- {% cta %} for call-to-action sections (newsletter signup, free trial, etc.)
|
|
610
|
+
- {% bento %} for feature grids with visual cards
|
|
611
|
+
- {% cast %} for team or speaker listings
|
|
612
|
+
- {% organization %} for business info (address, hours, contact)
|
|
613
|
+
- {% event %} for upcoming events or launches
|
|
614
|
+
- {% storyboard %} for visual narratives or process explanations
|
|
615
|
+
- {% form %} for contact forms or lead capture
|
|
616
|
+
- {% accordion %} or {% details %} for FAQ sections
|
|
617
|
+
|
|
618
|
+
A typical landing page structure: hero → features → social proof (testimonials) → pricing → CTA. Use this as a starting pattern when asked to create landing pages or marketing pages.`,
|
|
619
|
+
travel: `## Travel Mode Guidelines
|
|
620
|
+
|
|
621
|
+
Use location and experience runes to create travel content:
|
|
622
|
+
- {% map %} for interactive maps with pinned locations and categories
|
|
623
|
+
- {% timeline %} for day-by-day itineraries
|
|
624
|
+
- {% recipe %} for local cuisine with ingredients and steps
|
|
625
|
+
- {% event %} for local events, festivals, or activities
|
|
626
|
+
- {% cast %} for travel companions, local guides, or notable people
|
|
627
|
+
- {% grid %} for photo galleries or destination comparisons
|
|
628
|
+
- {% tabs %} for organizing by day, region, or category`,
|
|
629
|
+
design: `## Design Mode Guidelines
|
|
630
|
+
|
|
631
|
+
CRITICAL: Raw HTML written as Markdown will NOT render as HTML — Markdoc treats it as plain text. Users will see literal <div>, <section> tags.
|
|
632
|
+
|
|
633
|
+
When creating UI components, layouts, or visual prototypes, ALWAYS nest a sandbox inside a preview rune. This gives users a rendered preview with source code panel, responsive viewports, and theme toggling:
|
|
634
|
+
|
|
635
|
+
{% preview source=true responsive="mobile,tablet,desktop" %}
|
|
636
|
+
{% sandbox framework="tailwind" %}
|
|
637
|
+
<section class="py-20 px-4 bg-gradient-to-br from-indigo-600 to-purple-700 text-center">
|
|
638
|
+
<h1 class="text-5xl font-bold text-white mb-4">Ship faster</h1>
|
|
639
|
+
<p class="text-xl text-white/90 mb-8 max-w-2xl mx-auto">Build beautiful products.</p>
|
|
640
|
+
<div class="flex gap-4 justify-center">
|
|
641
|
+
<a href="#" class="px-6 py-3 bg-white text-indigo-700 rounded-lg font-semibold">Get Started</a>
|
|
642
|
+
<a href="#" class="px-6 py-3 border border-white/30 text-white rounded-lg">Learn More</a>
|
|
643
|
+
</div>
|
|
644
|
+
</section>
|
|
645
|
+
{% /sandbox %}
|
|
646
|
+
{% /preview %}
|
|
647
|
+
|
|
648
|
+
Use data-source attributes to create separate source code tabs:
|
|
649
|
+
|
|
650
|
+
{% preview source=true responsive="mobile,tablet,desktop" %}
|
|
651
|
+
{% sandbox framework="tailwind" %}
|
|
652
|
+
<style data-source="CSS">
|
|
653
|
+
.hero { background: linear-gradient(to bottom right, var(--color-primary), var(--color-secondary)); }
|
|
654
|
+
</style>
|
|
655
|
+
<section class="hero" data-source="HTML">
|
|
656
|
+
<h1>Headline</h1>
|
|
657
|
+
</section>
|
|
658
|
+
{% /sandbox %}
|
|
659
|
+
{% /preview %}
|
|
660
|
+
|
|
661
|
+
A bare {% sandbox %} (without preview) is acceptable for small inline demos that do not need source/viewport controls.
|
|
662
|
+
|
|
663
|
+
### Design tokens in sandbox:
|
|
664
|
+
|
|
665
|
+
When design tokens are active, they are auto-injected into sandbox iframes as CSS custom properties:
|
|
666
|
+
- CSS: var(--font-heading), var(--color-primary), var(--radius-md)
|
|
667
|
+
- Tailwind: token names become theme extensions (font-heading, text-primary, rounded-md)
|
|
668
|
+
- Prefer token-based values over hardcoded colors/fonts when tokens exist.`,
|
|
669
|
+
};
|
|
670
|
+
/** Returns mode-specific writing guidance, if any. */
|
|
671
|
+
export function getModeGuidance(mode) {
|
|
672
|
+
return MODE_GUIDANCE[mode];
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Returns the system prompt as two separate parts for cache-aware usage:
|
|
676
|
+
* [0] Base instructions (role description, writing rules) — stable across all modes
|
|
677
|
+
* [1] Rune vocabulary (available runes section) + optional mode guidance — varies by mode
|
|
678
|
+
*/
|
|
679
|
+
export function generateSystemPromptParts(runes, includeRunes, mode) {
|
|
680
|
+
const runeDescriptions = Object.values(runes)
|
|
681
|
+
.filter(rune => !EXCLUDED_RUNES.has(rune.name))
|
|
682
|
+
.filter(rune => !includeRunes || includeRunes.has(rune.name))
|
|
683
|
+
.map(rune => describeRune(rune))
|
|
684
|
+
.join('\n\n');
|
|
685
|
+
let runeVocab = `## Available Runes\n\n${runeDescriptions}`;
|
|
686
|
+
if (mode) {
|
|
687
|
+
const guidance = MODE_GUIDANCE[mode];
|
|
688
|
+
if (guidance) {
|
|
689
|
+
runeVocab += '\n\n' + guidance;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return [BASE_INSTRUCTIONS, runeVocab];
|
|
693
|
+
}
|
|
694
|
+
export function generateSystemPrompt(runes, includeRunes, mode) {
|
|
695
|
+
return generateSystemPromptParts(runes, includeRunes, mode).join('\n\n');
|
|
446
696
|
}
|
|
447
697
|
//# sourceMappingURL=prompt.js.map
|
package/dist/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAkBA,oEAAoE;AACpE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC9B,OAAO;IACP,YAAY;IACZ,MAAM;IACN,KAAK;IACL,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,aAAa;
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAkBA,oEAAoE;AACpE,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC9B,OAAO;IACP,YAAY;IACZ,MAAM;IACN,KAAK;IACL,iBAAiB;IACjB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,aAAa;IACb,SAAS;CACT,CAAC,CAAC;AAEH,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACjC,eAAe;CACf,CAAC,CAAC;AAEH,iDAAiD;AACjD,MAAM,aAAa,GAA2B;IAC7C,IAAI,EAAE;;YAEK;IAEX,GAAG,EAAE;;;;;;;WAOK;IAEV,OAAO,EAAE;;;;;;;;;;;;;;eAcK;IAEd,IAAI,EAAE;;;;;;;;;;YAUK;IAEX,KAAK,EAAE;;;;;;;;;;;;aAYK;IAEZ,IAAI,EAAE;;;;;;;;;;;;YAYK;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,YAA0B,EAC1B,IAAa;IAEb,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;SAC3C,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC9C,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,YAAY,IAAI,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SAC5D,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SAC/B,IAAI,CAAC,MAAM,CAAC,CAAC;IAEf,IAAI,SAAS,GAAG,yBAAyB,gBAAgB,EAAE,CAAC;IAE5D,IAAI,IAAI,EAAE,CAAC;QACV,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,QAAQ,EAAE,CAAC;YACd,SAAS,IAAI,MAAM,GAAG,QAAQ,CAAC;QAChC,CAAC;IACF,CAAC;IAED,OAAO,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,oBAAoB,CACnC,KAA+B,EAC/B,YAA0B,EAC1B,IAAa;IAEb,OAAO,yBAAyB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -3,6 +3,8 @@ export interface AnthropicOptions {
|
|
|
3
3
|
apiKey: string;
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
defaultModel?: string;
|
|
6
|
+
/** Wrap system prompt blocks with cache_control for Anthropic prompt caching */
|
|
7
|
+
promptCaching?: boolean;
|
|
6
8
|
/** Override fetch for testing */
|
|
7
9
|
fetch?: typeof globalThis.fetch;
|
|
8
10
|
}
|
|
@@ -13,7 +15,7 @@ interface AnthropicMessage {
|
|
|
13
15
|
export declare function formatAnthropicRequest(options: CompletionOptions, defaults: {
|
|
14
16
|
model: string;
|
|
15
17
|
}): {
|
|
16
|
-
system: string
|
|
18
|
+
system: string[];
|
|
17
19
|
messages: AnthropicMessage[];
|
|
18
20
|
model: string;
|
|
19
21
|
max_tokens: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAW,MAAM,gBAAgB,CAAC;AAE7E,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAChC;AAED,UAAU,gBAAgB;IACzB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAW,MAAM,gBAAgB,CAAC;AAE7E,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gFAAgF;IAChF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAChC;AAED,UAAU,gBAAgB;IACzB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAmBxG;AAED,wBAAuB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAmClF;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,GAAG,UAAU,CA6C7E"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function formatAnthropicRequest(options, defaults) {
|
|
2
|
-
|
|
2
|
+
const system = [];
|
|
3
3
|
const messages = [];
|
|
4
4
|
for (const msg of options.messages) {
|
|
5
5
|
if (msg.role === 'system') {
|
|
6
|
-
system
|
|
6
|
+
system.push(msg.content);
|
|
7
7
|
}
|
|
8
8
|
else {
|
|
9
9
|
messages.push({ role: msg.role, content: msg.content });
|
|
@@ -61,7 +61,21 @@ export function createAnthropicProvider(options) {
|
|
|
61
61
|
return {
|
|
62
62
|
name: 'anthropic',
|
|
63
63
|
async *complete(completionOptions) {
|
|
64
|
-
const
|
|
64
|
+
const formatted = formatAnthropicRequest(completionOptions, { model: defaultModel });
|
|
65
|
+
// Build system field: cached content blocks or plain string
|
|
66
|
+
let system;
|
|
67
|
+
if (formatted.system.length > 0) {
|
|
68
|
+
system = options.promptCaching
|
|
69
|
+
? formatted.system.map(text => ({ type: 'text', text, cache_control: { type: 'ephemeral' } }))
|
|
70
|
+
: formatted.system.join('\n\n');
|
|
71
|
+
}
|
|
72
|
+
const body = {
|
|
73
|
+
system,
|
|
74
|
+
messages: formatted.messages,
|
|
75
|
+
model: formatted.model,
|
|
76
|
+
max_tokens: formatted.max_tokens,
|
|
77
|
+
stream: formatted.stream,
|
|
78
|
+
};
|
|
65
79
|
const response = await fetchFn(`${baseUrl}/v1/messages`, {
|
|
66
80
|
method: 'POST',
|
|
67
81
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,sBAAsB,CACrC,OAA0B,EAC1B,QAA2B;IAE3B,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAuB,EAAE,CAAC;IAExC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACP,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC;IACF,CAAC;IAED,OAAO;QACN,MAAM;QACN,QAAQ;QACR,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK;QACtC,UAAU,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI;QACrC,MAAM,EAAE,IAAI;KACZ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,iBAAiB,CAAC,QAAkB;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IAC3B,IAAI,CAAC,IAAI;QAAE,OAAO;IAElB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IAChC,MAAM,O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C;gBAClB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,wBAAwB,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;YACtE,CAAC;YAED,KAAK,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AIProvider, CompletionOptions } from '../provider.js';
|
|
2
|
+
export interface GeminiOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
defaultModel?: string;
|
|
6
|
+
/** Override fetch for testing */
|
|
7
|
+
fetch?: typeof globalThis.fetch;
|
|
8
|
+
}
|
|
9
|
+
interface GeminiContent {
|
|
10
|
+
role: 'user' | 'model';
|
|
11
|
+
parts: {
|
|
12
|
+
text: string;
|
|
13
|
+
}[];
|
|
14
|
+
}
|
|
15
|
+
export declare function formatGeminiRequest(options: CompletionOptions, defaults: {
|
|
16
|
+
model: string;
|
|
17
|
+
}): {
|
|
18
|
+
contents: GeminiContent[];
|
|
19
|
+
systemInstruction?: {
|
|
20
|
+
parts: {
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
generationConfig: {
|
|
25
|
+
maxOutputTokens: number;
|
|
26
|
+
temperature?: number;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare function parseGeminiSSE(response: Response): AsyncIterable<string>;
|
|
30
|
+
export declare function createGeminiProvider(options: GeminiOptions): AIProvider;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=gemini.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.d.ts","sourceRoot":"","sources":["../../src/providers/gemini.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAW,MAAM,gBAAgB,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAChC;AAED,UAAU,aAAa;IACtB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1B;AAED,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB;IACF,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,iBAAiB,CAAC,EAAE;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IAClD,gBAAgB,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACpE,CAgCA;AAED,wBAAuB,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAmC/E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,UAAU,CA6BvE"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export function formatGeminiRequest(options, defaults) {
|
|
2
|
+
const systemParts = [];
|
|
3
|
+
const contents = [];
|
|
4
|
+
for (const msg of options.messages) {
|
|
5
|
+
if (msg.role === 'system') {
|
|
6
|
+
systemParts.push(msg.content);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
contents.push({
|
|
10
|
+
role: msg.role === 'assistant' ? 'model' : 'user',
|
|
11
|
+
parts: [{ text: msg.content }],
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const generationConfig = {
|
|
16
|
+
maxOutputTokens: options.maxTokens ?? 4096,
|
|
17
|
+
};
|
|
18
|
+
if (options.temperature !== undefined) {
|
|
19
|
+
generationConfig.temperature = options.temperature;
|
|
20
|
+
}
|
|
21
|
+
const systemInstruction = systemParts.length > 0
|
|
22
|
+
? { parts: [{ text: systemParts.join('\n\n') }] }
|
|
23
|
+
: undefined;
|
|
24
|
+
return {
|
|
25
|
+
contents,
|
|
26
|
+
...(systemInstruction ? { systemInstruction } : {}),
|
|
27
|
+
generationConfig,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export async function* parseGeminiSSE(response) {
|
|
31
|
+
const body = response.body;
|
|
32
|
+
if (!body)
|
|
33
|
+
return;
|
|
34
|
+
const reader = body.getReader();
|
|
35
|
+
const decoder = new TextDecoder();
|
|
36
|
+
let buffer = '';
|
|
37
|
+
try {
|
|
38
|
+
while (true) {
|
|
39
|
+
const { done, value } = await reader.read();
|
|
40
|
+
if (done)
|
|
41
|
+
break;
|
|
42
|
+
buffer += decoder.decode(value, { stream: true });
|
|
43
|
+
const lines = buffer.split('\n');
|
|
44
|
+
buffer = lines.pop();
|
|
45
|
+
for (const line of lines) {
|
|
46
|
+
if (!line.startsWith('data: '))
|
|
47
|
+
continue;
|
|
48
|
+
const data = line.slice(6);
|
|
49
|
+
try {
|
|
50
|
+
const parsed = JSON.parse(data);
|
|
51
|
+
const text = parsed.candidates?.[0]?.content?.parts?.[0]?.text;
|
|
52
|
+
if (text) {
|
|
53
|
+
yield text;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// skip non-JSON lines
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
reader.releaseLock();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function createGeminiProvider(options) {
|
|
67
|
+
const baseUrl = options.baseUrl ?? 'https://generativelanguage.googleapis.com/v1beta';
|
|
68
|
+
const defaultModel = options.defaultModel ?? 'gemini-2.0-flash';
|
|
69
|
+
const fetchFn = options.fetch ?? globalThis.fetch;
|
|
70
|
+
return {
|
|
71
|
+
name: 'gemini',
|
|
72
|
+
async *complete(completionOptions) {
|
|
73
|
+
const model = completionOptions.model ?? defaultModel;
|
|
74
|
+
const body = formatGeminiRequest(completionOptions, { model });
|
|
75
|
+
const url = `${baseUrl}/models/${model}:streamGenerateContent?alt=sse&key=${options.apiKey}`;
|
|
76
|
+
const response = await fetchFn(url, {
|
|
77
|
+
method: 'POST',
|
|
78
|
+
headers: {
|
|
79
|
+
'content-type': 'application/json',
|
|
80
|
+
},
|
|
81
|
+
body: JSON.stringify(body),
|
|
82
|
+
});
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
const text = await response.text();
|
|
85
|
+
throw new Error(`Gemini API error (${response.status}): ${text}`);
|
|
86
|
+
}
|
|
87
|
+
yield* parseGeminiSSE(response);
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../src/providers/gemini.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,mBAAmB,CAClC,OAA0B,EAC1B,QAA2B;IAM3B,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACP,QAAQ,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,GAAG,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;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E,MAAM,CAAA;KAAE,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"ollama.d.ts","sourceRoot":"","sources":["../../src/providers/ollama.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAChC;AAED,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAyBnH;AAED,wBAAuB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAkClF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,UAAU,CA2BxE"}
|
package/dist/providers/ollama.js
CHANGED
|
@@ -4,9 +4,23 @@ export function formatOllamaRequest(options, defaults) {
|
|
|
4
4
|
reqOptions.temperature = options.temperature;
|
|
5
5
|
if (options.maxTokens !== undefined)
|
|
6
6
|
reqOptions.num_predict = options.maxTokens;
|
|
7
|
+
// Merge multiple system messages into one
|
|
8
|
+
const systemParts = [];
|
|
9
|
+
const nonSystem = [];
|
|
10
|
+
for (const msg of options.messages) {
|
|
11
|
+
if (msg.role === 'system') {
|
|
12
|
+
systemParts.push(msg.content);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
nonSystem.push(msg);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const messages = systemParts.length > 0
|
|
19
|
+
? [{ role: 'system', content: systemParts.join('\n\n') }, ...nonSystem]
|
|
20
|
+
: nonSystem;
|
|
7
21
|
return {
|
|
8
22
|
model: options.model ?? defaults.model,
|
|
9
|
-
messages
|
|
23
|
+
messages,
|
|
10
24
|
stream: true,
|
|
11
25
|
...(Object.keys(reqOptions).length > 0 ? { options: reqOptions } : {}),
|
|
12
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ollama.js","sourceRoot":"","sources":["../../src/providers/ollama.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,mBAAmB,CAClC,OAA0B,EAC1B,QAA2B;IAE3B,MAAM,UAAU,GAAmD,EAAE,CAAC;IACtE,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;QAAE,UAAU,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACpF,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;QAAE,UAAU,CAAC,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAEhF,OAAO;
|
|
1
|
+
{"version":3,"file":"ollama.js","sourceRoot":"","sources":["../../src/providers/ollama.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,mBAAmB,CAClC,OAA0B,EAC1B,QAA2B;IAE3B,MAAM,UAAU,GAAmD,EAAE,CAAC;IACtE,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS;QAAE,UAAU,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IACpF,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS;QAAE,UAAU,CAAC,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC;IAEhF,0CAA0C;IAC1C,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,MAAM,SAAS,GAAc,EAAE,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACp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IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;aAC1B,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBAClB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACnC,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC;YACnE,CAAC;YAED,KAAK,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QACpC,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/ai",
|
|
3
3
|
"description": "AI content generation for refrakt.md",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"build": "tsc"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@refrakt-md/runes": "0.
|
|
26
|
+
"@refrakt-md/runes": "0.5.1"
|
|
27
27
|
}
|
|
28
28
|
}
|