@acrylblends/system-prompt 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # acryl-system-prompt
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Ported from ACRYL (`plugins/acryl-system-prompt`, see `provenance.json`): the frame's agent gets the prompt shape ACRYL IDE's agent has.
4
+
5
+ The shaping of the system prompt in the shape pi.dev builds its own (`packages/coding-agent/src/core/system-prompt.ts`): one identity line, then
6
+ every section as a tagged block. It is a pass-through on the harness's `system-prompt/assemble` waterfall: only the identity line is replaced, sections
7
+ are tagged and empties dropped, and every other section keeps its upstream text, so harness updates still reach the model. It records what upstream
8
+ contributed (`acrylSystemPrompt.lastUpstream()`), so a harness update shows exactly what changed.
9
+
10
+ It adds one section of its own right after the identity, the reply style (`<reply_style>`): plain, short sentences and never an em dash or en dash
11
+ in replies, comments or files, a plain `-` instead.
12
+
13
+ Config (row `acryl-system-prompt`): `identity`, `style` (empty leaves the reply style out), `tagSections`, `dropEmpty`. `acryl-app-context` contributes the `acryl:plugin-router` section this
14
+ plugin tags `<acryl_plugin_docs>`.
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: acryl-system-prompt
3
+ name: '@acrylblends/system-prompt'
package/lib/index.js ADDED
@@ -0,0 +1,33 @@
1
+ import { DEFAULT_IDENTITY, DEFAULT_STYLE, STYLE_SECTION, shapeSections, upstreamSnapshot } from "./transform.js";
2
+ import Schema from "@deepseek-ai/schemastery";
3
+ //#region src/index.ts
4
+ const name = "@acrylblends/system-prompt";
5
+ const inject = ["systemPrompt"];
6
+ const Config = Schema.object({
7
+ identity: Schema.string().default(DEFAULT_IDENTITY).description("The opening identity line (replaces the harness \"You are an AI agent powered by ...\" line)."),
8
+ style: Schema.string().default(DEFAULT_STYLE).description("How the agent writes its replies; empty leaves the section out."),
9
+ tagSections: Schema.boolean().default(true).description("Wrap every section in a pi.dev-style tag."),
10
+ dropEmpty: Schema.boolean().default(true).description("Drop sections with no text.")
11
+ });
12
+ function apply(ctx, config) {
13
+ let upstream = [];
14
+ ctx.provide("acrylSystemPrompt", { lastUpstream: () => upstream });
15
+ const systemPrompt = ctx.systemPrompt;
16
+ if (config.style.trim() !== "") ctx.effect(() => systemPrompt.section({
17
+ ...STYLE_SECTION,
18
+ text: config.style
19
+ }), "acryl-system-prompt: reply style");
20
+ const on = ctx.on.bind(ctx);
21
+ ctx.effect(() => on("system-prompt/assemble", async (_assembly, _context, next) => {
22
+ const assembled = await next();
23
+ upstream = upstreamSnapshot(assembled.sections);
24
+ return {
25
+ ...assembled,
26
+ sections: shapeSections(assembled.sections, config)
27
+ };
28
+ }), "acryl-system-prompt: assemble listener");
29
+ }
30
+ //#endregion
31
+ export { Config, apply, inject, name };
32
+
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * ACRYL system prompt shaping (ACRYL spec 037, pi.dev-like prompt). pi.dev owns one builder function that produces a structured, tagged prompt; the\n * frame composes its agent's prompt from the harness's sections (a pinned upstream we do not fork), so this plugin applies the same shape as a\n * pass-through: on the harness's `system-prompt/assemble` waterfall it puts the identity first, wraps every other section in a tag, drops empty ones,\n * and records what upstream contributed so a harness update shows exactly what changed. It rewrites nothing else.\n *\n * It also contributes one section of its own, the reply style (`acryl:reply-style`, tagged `<reply_style>`): plain words and no em dash.\n *\n * Provides: `acrylSystemPrompt` ({ lastUpstream() }) and the reply style section. Requires: `systemPrompt`.\n */\nimport type { Context } from '@deepseek-ai/cordis'\nimport Schema from '@deepseek-ai/schemastery'\nimport { DEFAULT_IDENTITY, DEFAULT_STYLE, type PromptSection, STYLE_SECTION, shapeSections, upstreamSnapshot } from './transform.ts'\n\nexport const name = 'acryl-system-prompt'\nexport const inject = ['systemPrompt']\n\nexport interface Config {\n identity: string\n style: string\n tagSections: boolean\n dropEmpty: boolean\n}\n\nexport const Config: Schema<Config> = Schema.object({\n identity: Schema.string().default(DEFAULT_IDENTITY).description('The opening identity line (replaces the harness \"You are an AI agent powered by ...\" line).'),\n style: Schema.string().default(DEFAULT_STYLE).description('How the agent writes its replies; empty leaves the section out.'),\n tagSections: Schema.boolean().default(true).description('Wrap every section in a pi.dev-style tag.'),\n dropEmpty: Schema.boolean().default(true).description('Drop sections with no text.'),\n})\n\n/** The assembled prompt as the waterfall passes it: its sections, and whatever else the harness carries, kept as it is. */\ninterface Assembled {\n readonly sections: readonly PromptSection[]\n}\n\ninterface SystemPrompt {\n section(section: { name: string; order: number; text: string }): () => void\n}\n\ntype AssembleListener = (assembly: unknown, context: unknown, next: () => Promise<Assembled>) => Promise<Assembled>\n\nexport function apply(ctx: Context, config: Config): void {\n let upstream: { name: string; hash: string }[] = []\n ctx.provide('acrylSystemPrompt', { lastUpstream: () => upstream })\n const systemPrompt = (ctx as unknown as { systemPrompt: SystemPrompt }).systemPrompt\n if (config.style.trim() !== '')\n ctx.effect(() => systemPrompt.section({ ...STYLE_SECTION, text: config.style }), 'acryl-system-prompt: reply style')\n const on = ctx.on.bind(ctx) as unknown as (name: 'system-prompt/assemble', listener: AssembleListener) => () => void\n ctx.effect(() => on('system-prompt/assemble', async (_assembly, _context, next) => {\n const assembled = await next()\n upstream = upstreamSnapshot(assembled.sections)\n return { ...assembled, sections: shapeSections(assembled.sections, config) }\n }), 'acryl-system-prompt: assemble listener')\n}\n"],"mappings":";;;AAcA,MAAa,OAAO;AACpB,MAAa,SAAS,CAAC,cAAc;AASrC,MAAa,SAAyB,OAAO,OAAO;CAClD,UAAU,OAAO,OAAO,CAAC,CAAC,QAAQ,gBAAgB,CAAC,CAAC,YAAY,+FAA6F;CAC7J,OAAO,OAAO,OAAO,CAAC,CAAC,QAAQ,aAAa,CAAC,CAAC,YAAY,iEAAiE;CAC3H,aAAa,OAAO,QAAQ,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY,2CAA2C;CACnG,WAAW,OAAO,QAAQ,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,YAAY,6BAA6B;AACrF,CAAC;AAaD,SAAgB,MAAM,KAAc,QAAsB;CACxD,IAAI,WAA6C,CAAC;CAClD,IAAI,QAAQ,qBAAqB,EAAE,oBAAoB,SAAS,CAAC;CACjE,MAAM,eAAgB,IAAkD;CACxE,IAAI,OAAO,MAAM,KAAK,MAAM,IAC1B,IAAI,aAAa,aAAa,QAAQ;EAAE,GAAG;EAAe,MAAM,OAAO;CAAM,CAAC,GAAG,kCAAkC;CACrH,MAAM,KAAK,IAAI,GAAG,KAAK,GAAG;CAC1B,IAAI,aAAa,GAAG,0BAA0B,OAAO,WAAW,UAAU,SAAS;EACjF,MAAM,YAAY,MAAM,KAAK;EAC7B,WAAW,iBAAiB,UAAU,QAAQ;EAC9C,OAAO;GAAE,GAAG;GAAW,UAAU,cAAc,UAAU,UAAU,MAAM;EAAE;CAC7E,CAAC,GAAG,wCAAwC;AAC9C"}
@@ -0,0 +1,86 @@
1
+ import { createHash } from "node:crypto";
2
+ //#region src/transform.ts
3
+ /** pi.dev opens its prompt with one identity line ("You are an expert coding assistant operating inside pi, ..."). This is the Blends app builder's. */
4
+ const DEFAULT_IDENTITY = "You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app's plugins when asked.";
5
+ /**
6
+ * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything
7
+ * ACRYL writes, which a model otherwise breaks in nearly every answer).
8
+ */
9
+ const DEFAULT_STYLE = "Write replies in plain, short sentences the person can act on. Never use the em dash character (U+2014) or the en dash (U+2013) in replies, code comments or files you write; use a plain hyphen-minus (-) or a comma instead.";
10
+ /** The reply style's section: right after the identity line (the harness identity is -1000, the deployment persona 0). */
11
+ const STYLE_SECTION = {
12
+ name: "acryl:reply-style",
13
+ order: -900
14
+ };
15
+ /** Section names the harness registers for its identity line. */
16
+ const IDENTITY_SECTION = "harness:identity";
17
+ /** Readable tag names for sections whose harness name is not tag-friendly (pi.dev uses tags such as `docs`, `cwd`, `skills`). */
18
+ const TAG_ALIASES = {
19
+ "deployment:persona-prefix": "persona",
20
+ "deployment:persona-suffix": "cwd",
21
+ "acryl:plugin-router": "acryl_plugin_docs",
22
+ "acryl:reply-style": "reply_style"
23
+ };
24
+ /** `tool:read` becomes `tool_read`; anything outside `[a-z0-9_-]` becomes `_`, and a tag never starts with a digit or separator. */
25
+ function tagName(sectionName) {
26
+ const alias = TAG_ALIASES[sectionName];
27
+ if (alias !== void 0) return alias;
28
+ const tag = sectionName.toLowerCase().replace(/[^a-z0-9_-]+/gu, "_").replace(/^[^a-z]+/u, "").replace(/_+$/u, "");
29
+ return tag === "" ? "section" : tag;
30
+ }
31
+ /** A section whose text already is one complete tagged block (the plugin docs router carries its own tag). */
32
+ const alreadyTagged = (text) => /^<([a-z][a-z0-9_-]*)>[\s\S]*<\/\1>\s*$/u.test(text.trim());
33
+ /**
34
+ * Shape the harness's assembled sections the way pi.dev's `buildSystemPromptSections` shapes its own: an untagged opening identity line,
35
+ * then every other section as a tagged block, with empty sections dropped. Nothing else is rewritten: every section that is not the
36
+ * identity passes through with its upstream text unchanged, so upstream improvements to tool guidance still reach the model.
37
+ * @param sections - upstream sections in final order.
38
+ */
39
+ function shapeSections(sections, options = {}) {
40
+ const identity = options.identity ?? "You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app's plugins when asked.";
41
+ const tagSections = options.tagSections ?? true;
42
+ const dropEmpty = options.dropEmpty ?? true;
43
+ const out = [];
44
+ for (const section of sections) {
45
+ if (section.name === "harness:identity") {
46
+ out.push({
47
+ name: section.name,
48
+ text: identity
49
+ });
50
+ continue;
51
+ }
52
+ const text = String(section.text ?? "");
53
+ if (dropEmpty && text.trim() === "") continue;
54
+ if (!tagSections || alreadyTagged(text)) {
55
+ out.push({
56
+ name: section.name,
57
+ text
58
+ });
59
+ continue;
60
+ }
61
+ const tag = tagName(section.name);
62
+ out.push({
63
+ name: section.name,
64
+ text: `<${tag}>\n${text.trim()}\n</${tag}>`
65
+ });
66
+ }
67
+ return out;
68
+ }
69
+ /** Text that legitimately differs per run (the web surface section names its random local port) must not look like drift. */
70
+ function normalizeVolatile(text) {
71
+ return String(text ?? "").replace(/\b(127\.0\.0\.1|localhost|0\.0\.0\.0):\d+/gu, "$1:<port>");
72
+ }
73
+ /**
74
+ * What upstream contributed, for drift detection: name and a short hash of the text, excluding ACRYL's own sections (they carry
75
+ * machine-specific paths and are ours to change). Variables such as `{{cwd}}` are not yet interpolated at this stage, so the hashes are stable.
76
+ */
77
+ function upstreamSnapshot(sections) {
78
+ return sections.filter((section) => !section.name.startsWith("acryl:")).map((section) => ({
79
+ name: section.name,
80
+ hash: createHash("sha256").update(normalizeVolatile(section.text)).digest("hex").slice(0, 12)
81
+ }));
82
+ }
83
+ //#endregion
84
+ export { DEFAULT_IDENTITY, DEFAULT_STYLE, IDENTITY_SECTION, STYLE_SECTION, normalizeVolatile, shapeSections, tagName, upstreamSnapshot };
85
+
86
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.js","names":[],"sources":["../src/transform.ts"],"sourcesContent":["import { createHash } from 'node:crypto'\n\n/** pi.dev opens its prompt with one identity line (\"You are an expert coding assistant operating inside pi, ...\"). This is the Blends app builder's. */\nexport const DEFAULT_IDENTITY =\n 'You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app\\'s plugins when asked.'\n\n/**\n * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything\n * ACRYL writes, which a model otherwise breaks in nearly every answer).\n */\nexport const DEFAULT_STYLE =\n 'Write replies in plain, short sentences the person can act on. Never use the em dash character (U+2014) or the en dash (U+2013) in replies, code comments or files you write; use a plain hyphen-minus (-) or a comma instead.'\n\n/** The reply style's section: right after the identity line (the harness identity is -1000, the deployment persona 0). */\nexport const STYLE_SECTION = { name: 'acryl:reply-style', order: -900 } as const\n\n/** Section names the harness registers for its identity line. */\nexport const IDENTITY_SECTION = 'harness:identity'\n\n/** Readable tag names for sections whose harness name is not tag-friendly (pi.dev uses tags such as `docs`, `cwd`, `skills`). */\nconst TAG_ALIASES: Readonly<Record<string, string>> = {\n 'deployment:persona-prefix': 'persona',\n 'deployment:persona-suffix': 'cwd',\n 'acryl:plugin-router': 'acryl_plugin_docs',\n 'acryl:reply-style': 'reply_style',\n}\n\n/** One section of the assembled prompt, as the harness's `system-prompt/assemble` waterfall carries it. */\nexport interface PromptSection {\n readonly name: string\n readonly text: string\n}\n\nexport interface ShapeOptions {\n readonly identity?: string\n readonly tagSections?: boolean\n readonly dropEmpty?: boolean\n}\n\n/** `tool:read` becomes `tool_read`; anything outside `[a-z0-9_-]` becomes `_`, and a tag never starts with a digit or separator. */\nexport function tagName(sectionName: string): string {\n const alias = TAG_ALIASES[sectionName]\n if (alias !== undefined) return alias\n const tag = sectionName.toLowerCase().replace(/[^a-z0-9_-]+/gu, '_').replace(/^[^a-z]+/u, '').replace(/_+$/u, '')\n return tag === '' ? 'section' : tag\n}\n\n/** A section whose text already is one complete tagged block (the plugin docs router carries its own tag). */\nconst alreadyTagged = (text: string): boolean => /^<([a-z][a-z0-9_-]*)>[\\s\\S]*<\\/\\1>\\s*$/u.test(text.trim())\n\n/**\n * Shape the harness's assembled sections the way pi.dev's `buildSystemPromptSections` shapes its own: an untagged opening identity line,\n * then every other section as a tagged block, with empty sections dropped. Nothing else is rewritten: every section that is not the\n * identity passes through with its upstream text unchanged, so upstream improvements to tool guidance still reach the model.\n * @param sections - upstream sections in final order.\n */\nexport function shapeSections(sections: readonly PromptSection[], options: ShapeOptions = {}): PromptSection[] {\n const identity = options.identity ?? DEFAULT_IDENTITY\n const tagSections = options.tagSections ?? true\n const dropEmpty = options.dropEmpty ?? true\n const out: PromptSection[] = []\n for (const section of sections) {\n if (section.name === IDENTITY_SECTION) {\n out.push({ name: section.name, text: identity })\n continue\n }\n const text = String(section.text ?? '')\n if (dropEmpty && text.trim() === '') continue\n if (!tagSections || alreadyTagged(text)) {\n out.push({ name: section.name, text })\n continue\n }\n const tag = tagName(section.name)\n out.push({ name: section.name, text: `<${tag}>\\n${text.trim()}\\n</${tag}>` })\n }\n return out\n}\n\n/** Text that legitimately differs per run (the web surface section names its random local port) must not look like drift. */\nexport function normalizeVolatile(text: string): string {\n return String(text ?? '').replace(/\\b(127\\.0\\.0\\.1|localhost|0\\.0\\.0\\.0):\\d+/gu, '$1:<port>')\n}\n\n/**\n * What upstream contributed, for drift detection: name and a short hash of the text, excluding ACRYL's own sections (they carry\n * machine-specific paths and are ours to change). Variables such as `{{cwd}}` are not yet interpolated at this stage, so the hashes are stable.\n */\nexport function upstreamSnapshot(sections: readonly PromptSection[]): { name: string; hash: string }[] {\n return sections\n .filter(section => !section.name.startsWith('acryl:'))\n .map(section => ({ name: section.name, hash: createHash('sha256').update(normalizeVolatile(section.text)).digest('hex').slice(0, 12) }))\n}\n"],"mappings":";;;AAGA,MAAa,mBACX;;;;;AAMF,MAAa,gBACX;;AAGF,MAAa,gBAAgB;CAAE,MAAM;CAAqB,OAAO;AAAK;;AAGtE,MAAa,mBAAmB;;AAGhC,MAAM,cAAgD;CACpD,6BAA6B;CAC7B,6BAA6B;CAC7B,uBAAuB;CACvB,qBAAqB;AACvB;;AAeA,SAAgB,QAAQ,aAA6B;CACnD,MAAM,QAAQ,YAAY;CAC1B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,MAAM,YAAY,YAAY,CAAC,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC,QAAQ,aAAa,EAAE,CAAC,CAAC,QAAQ,QAAQ,EAAE;CAChH,OAAO,QAAQ,KAAK,YAAY;AAClC;;AAGA,MAAM,iBAAiB,SAA0B,0CAA0C,KAAK,KAAK,KAAK,CAAC;;;;;;;AAQ3G,SAAgB,cAAc,UAAoC,UAAwB,CAAC,GAAoB;CAC7G,MAAM,WAAW,QAAQ,YAAA;CACzB,MAAM,cAAc,QAAQ,eAAe;CAC3C,MAAM,YAAY,QAAQ,aAAa;CACvC,MAAM,MAAuB,CAAC;CAC9B,KAAK,MAAM,WAAW,UAAU;EAC9B,IAAI,QAAQ,SAAA,oBAA2B;GACrC,IAAI,KAAK;IAAE,MAAM,QAAQ;IAAM,MAAM;GAAS,CAAC;GAC/C;EACF;EACA,MAAM,OAAO,OAAO,QAAQ,QAAQ,EAAE;EACtC,IAAI,aAAa,KAAK,KAAK,MAAM,IAAI;EACrC,IAAI,CAAC,eAAe,cAAc,IAAI,GAAG;GACvC,IAAI,KAAK;IAAE,MAAM,QAAQ;IAAM;GAAK,CAAC;GACrC;EACF;EACA,MAAM,MAAM,QAAQ,QAAQ,IAAI;EAChC,IAAI,KAAK;GAAE,MAAM,QAAQ;GAAM,MAAM,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,MAAM,IAAI;EAAG,CAAC;CAC9E;CACA,OAAO;AACT;;AAGA,SAAgB,kBAAkB,MAAsB;CACtD,OAAO,OAAO,QAAQ,EAAE,CAAC,CAAC,QAAQ,+CAA+C,WAAW;AAC9F;;;;;AAMA,SAAgB,iBAAiB,UAAsE;CACrG,OAAO,SACJ,QAAO,YAAW,CAAC,QAAQ,KAAK,WAAW,QAAQ,CAAC,CAAC,CACrD,KAAI,aAAY;EAAE,MAAM,QAAQ;EAAM,MAAM,WAAW,QAAQ,CAAC,CAAC,OAAO,kBAAkB,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;CAAE,EAAE;AAC3I"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * ACRYL system prompt shaping (ACRYL spec 037, pi.dev-like prompt). pi.dev owns one builder function that produces a structured, tagged prompt; the
3
+ * frame composes its agent's prompt from the harness's sections (a pinned upstream we do not fork), so this plugin applies the same shape as a
4
+ * pass-through: on the harness's `system-prompt/assemble` waterfall it puts the identity first, wraps every other section in a tag, drops empty ones,
5
+ * and records what upstream contributed so a harness update shows exactly what changed. It rewrites nothing else.
6
+ *
7
+ * It also contributes one section of its own, the reply style (`acryl:reply-style`, tagged `<reply_style>`): plain words and no em dash.
8
+ *
9
+ * Provides: `acrylSystemPrompt` ({ lastUpstream() }) and the reply style section. Requires: `systemPrompt`.
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import Schema from '@deepseek-ai/schemastery';
13
+ export declare const name = "@acrylblends/system-prompt";
14
+ export declare const inject: string[];
15
+ export interface Config {
16
+ identity: string;
17
+ style: string;
18
+ tagSections: boolean;
19
+ dropEmpty: boolean;
20
+ }
21
+ export declare const Config: Schema<Config>;
22
+ export declare function apply(ctx: Context, config: Config): void;
@@ -0,0 +1,43 @@
1
+ /** pi.dev opens its prompt with one identity line ("You are an expert coding assistant operating inside pi, ..."). This is the Blends app builder's. */
2
+ export declare const DEFAULT_IDENTITY = "You are an expert coding assistant operating inside an ACRYL Blends app, an app made of Cordis plugins that blend.yaml composes and that you extend by writing plugins. You help users by reading files, executing commands, editing code, and writing new files, and by building, changing and removing the app's plugins when asked.";
3
+ /**
4
+ * How the agent writes its replies to the person: plain words, short, and with a plain dash instead of an em dash (the owner's rule for everything
5
+ * ACRYL writes, which a model otherwise breaks in nearly every answer).
6
+ */
7
+ export declare const DEFAULT_STYLE = "Write replies in plain, short sentences the person can act on. Never use the em dash character (U+2014) or the en dash (U+2013) in replies, code comments or files you write; use a plain hyphen-minus (-) or a comma instead.";
8
+ /** The reply style's section: right after the identity line (the harness identity is -1000, the deployment persona 0). */
9
+ export declare const STYLE_SECTION: {
10
+ readonly name: "acryl:reply-style";
11
+ readonly order: -900;
12
+ };
13
+ /** Section names the harness registers for its identity line. */
14
+ export declare const IDENTITY_SECTION = "harness:identity";
15
+ /** One section of the assembled prompt, as the harness's `system-prompt/assemble` waterfall carries it. */
16
+ export interface PromptSection {
17
+ readonly name: string;
18
+ readonly text: string;
19
+ }
20
+ export interface ShapeOptions {
21
+ readonly identity?: string;
22
+ readonly tagSections?: boolean;
23
+ readonly dropEmpty?: boolean;
24
+ }
25
+ /** `tool:read` becomes `tool_read`; anything outside `[a-z0-9_-]` becomes `_`, and a tag never starts with a digit or separator. */
26
+ export declare function tagName(sectionName: string): string;
27
+ /**
28
+ * Shape the harness's assembled sections the way pi.dev's `buildSystemPromptSections` shapes its own: an untagged opening identity line,
29
+ * then every other section as a tagged block, with empty sections dropped. Nothing else is rewritten: every section that is not the
30
+ * identity passes through with its upstream text unchanged, so upstream improvements to tool guidance still reach the model.
31
+ * @param sections - upstream sections in final order.
32
+ */
33
+ export declare function shapeSections(sections: readonly PromptSection[], options?: ShapeOptions): PromptSection[];
34
+ /** Text that legitimately differs per run (the web surface section names its random local port) must not look like drift. */
35
+ export declare function normalizeVolatile(text: string): string;
36
+ /**
37
+ * What upstream contributed, for drift detection: name and a short hash of the text, excluding ACRYL's own sections (they carry
38
+ * machine-specific paths and are ours to change). Variables such as `{{cwd}}` are not yet interpolated at this stage, so the hashes are stable.
39
+ */
40
+ export declare function upstreamSnapshot(sections: readonly PromptSection[]): {
41
+ name: string;
42
+ hash: string;
43
+ }[];
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@acrylblends/system-prompt",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "ACRYL's own shaping of the system prompt on top of the harness's sections: the app builder's identity, pi.dev-style tagged sections, no empty sections, and a drift record of what upstream contributes",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/acrylblends/acrylblends.git",
9
+ "directory": "ide/acryl-system-prompt"
10
+ },
11
+ "type": "module",
12
+ "main": "lib/index.js",
13
+ "types": "lib/types/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./lib/types/index.d.ts",
17
+ "default": "./lib/index.js"
18
+ },
19
+ "./transform": {
20
+ "types": "./lib/types/transform.d.ts",
21
+ "default": "./lib/transform.js"
22
+ },
23
+ "./package.json": "./package.json"
24
+ },
25
+ "dsh": {
26
+ "bundle": {
27
+ "patch": "./cordis.patch.yml"
28
+ }
29
+ },
30
+ "files": [
31
+ "cordis.patch.yml",
32
+ "lib/**",
33
+ "README.md"
34
+ ],
35
+ "engines": {
36
+ "node": "^22.19.0 || >=24.0.0"
37
+ },
38
+ "scripts": {
39
+ "build": "node scripts/clean.mjs && tsdown && tsc -p tsconfig.json --emitDeclarationOnly",
40
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.tests.json --noEmit",
41
+ "test": "vitest run",
42
+ "check": "pnpm run build && pnpm run typecheck && pnpm run test",
43
+ "prepack": "pnpm run check"
44
+ },
45
+ "dependencies": {
46
+ "@deepseek-ai/schemastery": "~3.18.4"
47
+ },
48
+ "peerDependencies": {
49
+ "@deepseek-ai/cordis": "^4.0.4"
50
+ },
51
+ "devDependencies": {
52
+ "@deepseek-ai/cordis": "4.0.4",
53
+ "@types/node": "^24.0.0",
54
+ "tsdown": "0.23.0",
55
+ "typescript": "6.0.3",
56
+ "vitest": "5.0.3"
57
+ }
58
+ }