@refrakt-md/ai 0.9.7 → 0.9.9
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/prompt.d.ts +2 -19
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +1 -86
- package/dist/prompt.js.map +1 -1
- package/package.json +2 -2
package/dist/prompt.d.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* without requiring a runtime dependency.
|
|
4
|
-
*/
|
|
5
|
-
export interface RuneInfo {
|
|
6
|
-
name: string;
|
|
7
|
-
aliases: string[];
|
|
8
|
-
description: string;
|
|
9
|
-
reinterprets: Record<string, string>;
|
|
10
|
-
schema: {
|
|
11
|
-
attributes?: Record<string, {
|
|
12
|
-
type?: unknown;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
matches?: unknown;
|
|
15
|
-
}>;
|
|
16
|
-
};
|
|
17
|
-
/** AI prompt extension from community/official packages — additional context appended after description */
|
|
18
|
-
prompt?: string;
|
|
19
|
-
}
|
|
1
|
+
import { type RuneInfo } from '@refrakt-md/runes';
|
|
2
|
+
export type { RuneInfo };
|
|
20
3
|
/** Returns mode-specific writing guidance, if any. */
|
|
21
4
|
export declare function getModeGuidance(mode: string): string | undefined;
|
|
22
5
|
/**
|
package/dist/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEhF,YAAY,EAAE,QAAQ,EAAE,CAAC;AAgIzB,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAC/B,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,IAAI,CAAC,EAAE,MAAM,GACX,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBlB;AAED,wBAAgB,oBAAoB,CACnC,KAAK,EAAE,MAAM,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
|
@@ -1,89 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const EXCLUDED_RUNES = new Set([
|
|
3
|
-
'error',
|
|
4
|
-
'tab',
|
|
5
|
-
'accordion-item',
|
|
6
|
-
'budget-category',
|
|
7
|
-
'budget-line-item',
|
|
8
|
-
'conversation-message',
|
|
9
|
-
'reveal-step',
|
|
10
|
-
'note',
|
|
11
|
-
'form-field',
|
|
12
|
-
]);
|
|
13
|
-
/** Attributes to hide from the AI prompt (rune.attribute format) */
|
|
14
|
-
const HIDDEN_ATTRIBUTES = new Set([
|
|
15
|
-
'feature.split',
|
|
16
|
-
]);
|
|
17
|
-
import { RUNE_EXAMPLES } from '@refrakt-md/runes';
|
|
18
|
-
function attributeTypeName(type) {
|
|
19
|
-
if (type === String)
|
|
20
|
-
return 'string';
|
|
21
|
-
if (type === Number)
|
|
22
|
-
return 'number';
|
|
23
|
-
if (type === Boolean)
|
|
24
|
-
return 'boolean';
|
|
25
|
-
if (type === Array)
|
|
26
|
-
return 'array';
|
|
27
|
-
if (typeof type === 'function' && type.name) {
|
|
28
|
-
return type.name;
|
|
29
|
-
}
|
|
30
|
-
return 'unknown';
|
|
31
|
-
}
|
|
32
|
-
function describeAttribute(name, attr) {
|
|
33
|
-
const parts = [` - ${name}: `];
|
|
34
|
-
if (Array.isArray(attr.matches) && attr.matches.length > 0) {
|
|
35
|
-
const values = attr.matches
|
|
36
|
-
.filter((m) => typeof m === 'string')
|
|
37
|
-
.map((v) => `"${v}"`)
|
|
38
|
-
.join(' | ');
|
|
39
|
-
parts.push(values);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
parts.push(attributeTypeName(attr.type));
|
|
43
|
-
}
|
|
44
|
-
parts.push(attr.required ? ' (required)' : ' (optional)');
|
|
45
|
-
return parts.join('');
|
|
46
|
-
}
|
|
47
|
-
function describeRune(rune) {
|
|
48
|
-
const lines = [];
|
|
49
|
-
lines.push(`### ${rune.name}`);
|
|
50
|
-
if (rune.description) {
|
|
51
|
-
lines.push(rune.description);
|
|
52
|
-
}
|
|
53
|
-
if (rune.aliases.length > 0) {
|
|
54
|
-
lines.push(`Aliases: ${rune.aliases.join(', ')}`);
|
|
55
|
-
}
|
|
56
|
-
// AI prompt extension from package
|
|
57
|
-
if (rune.prompt) {
|
|
58
|
-
lines.push(rune.prompt);
|
|
59
|
-
}
|
|
60
|
-
// Attributes
|
|
61
|
-
const attrs = rune.schema.attributes;
|
|
62
|
-
if (attrs && Object.keys(attrs).length > 0) {
|
|
63
|
-
const entries = Object.entries(attrs).filter(([name]) => !HIDDEN_ATTRIBUTES.has(`${rune.name}.${name}`));
|
|
64
|
-
if (entries.length > 0) {
|
|
65
|
-
lines.push('Attributes:');
|
|
66
|
-
for (const [attrName, attrDef] of entries) {
|
|
67
|
-
lines.push(describeAttribute(attrName, attrDef));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Reinterprets
|
|
72
|
-
const reinterprets = Object.entries(rune.reinterprets);
|
|
73
|
-
if (reinterprets.length > 0) {
|
|
74
|
-
lines.push('Content interpretation:');
|
|
75
|
-
for (const [element, meaning] of reinterprets) {
|
|
76
|
-
lines.push(` - ${element} → ${meaning}`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Example
|
|
80
|
-
const example = RUNE_EXAMPLES[rune.name];
|
|
81
|
-
if (example) {
|
|
82
|
-
lines.push('Example:');
|
|
83
|
-
lines.push(example);
|
|
84
|
-
}
|
|
85
|
-
return lines.join('\n');
|
|
86
|
-
}
|
|
1
|
+
import { describeRune, EXCLUDED_RUNES } from '@refrakt-md/runes';
|
|
87
2
|
const BASE_INSTRUCTIONS = `You are a content author for a website built with refrakt.md.
|
|
88
3
|
Write content using Markdoc tags called "runes" ({% tag %} syntax).
|
|
89
4
|
|
package/dist/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAiB,MAAM,mBAAmB,CAAC;AAIhF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;sDAa4B,CAAC;AAEvD,2EAA2E;AAC3E,MAAM,aAAa,GAA2B;IAC7C,OAAO,EAAE;;;;;;;;;gDASsC;IAE/C,IAAI,EAAE;;;;;;;;;;;gEAWyD;IAE/D,OAAO,EAAE;;;;;;;;;;;;gDAYsC;IAE/C,SAAS,EAAE;;;;;;;;;;;;;;;;uLAgB2K;IAEtL,MAAM,EAAE;;;;;;;;;wDAS+C;IAEvD,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAuCkE;CAC1E,CAAC;AAEF,sDAAsD;AACtD,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACxC,KAA+B,EAC/B,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"}
|
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.9.
|
|
4
|
+
"version": "0.9.9",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"build": "tsc"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@refrakt-md/runes": "0.9.
|
|
32
|
+
"@refrakt-md/runes": "0.9.9"
|
|
33
33
|
}
|
|
34
34
|
}
|