{"_id":"@auto-hwp/ai-protocol","_rev":"6-4648245be068a99814ea54124161cc0d","name":"@auto-hwp/ai-protocol","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"@auto-hwp/ai-protocol","version":"0.0.1","keywords":["hwp","hwpx","llm","intent","protocol","isomorphic","prompt"],"license":"MIT OR Apache-2.0","_id":"@auto-hwp/ai-protocol@0.0.1","maintainers":[{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"}],"dist":{"shasum":"919e85e4020a7b95810cf21a744cb72054d63aaf","tarball":"https://registry.npmjs.org/@auto-hwp/ai-protocol/-/ai-protocol-0.0.1.tgz","fileCount":26,"integrity":"sha512-4CJFqzW76xUGb8XPn97MNuHVmKaDdIj8SiE2sA7x9KN/G5DohprsX4RjY6fMPRdprO7Gu8ZxIPrrKZHLykFMIQ==","signatures":[{"sig":"MEYCIQCrjah719rNfT6cEk54g7QnFlIV/xOGCR793+XYzKx4TgIhAN8JJAEa8rimXoWoDOyfLkCcUMDAem2P7objhZRDAuiK","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":97209},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"83042a5ae3df67f1379f84b5189a5ba4f30b0580","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"},"deprecated":"use >=0.0.2","_npmVersion":"10.8.2","description":"Vendor-neutral LLM protocol for auto-hwp chat-editing: EditRequest/EditResponse types, buildDocContext (R5 fence), buildSystemPrompt (INTENT-SCHEMA excerpt, allowed-intent subset), validateRequest/validateResponse (whitelist + structure). Pure, isomorphic","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^2.1.8","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/ai-protocol_0.0.1_1784714511164_0.15748472092449717","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@auto-hwp/ai-protocol","version":"0.0.2","keywords":["hwp","hwpx","llm","intent","protocol","isomorphic","prompt"],"license":"MIT OR Apache-2.0","_id":"@auto-hwp/ai-protocol@0.0.2","maintainers":[{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"}],"dist":{"shasum":"892cf6ed9f92c45fc6769786b0220ab8b409b430","tarball":"https://registry.npmjs.org/@auto-hwp/ai-protocol/-/ai-protocol-0.0.2.tgz","fileCount":26,"integrity":"sha512-RoCFwBlMPQu5gmRAl3boryhfLGoY+Fwq4Wn0sHBZDFpJGb7l3WtRv6FpwHo5J2evRU4b6FvboSq2W8B6jSTLew==","signatures":[{"sig":"MEQCIBhcjLNHHbZ+W7PZbOJqRsHu6bj6+R3GEfsoIERd9cYiAiBQM1f+SoaDXWvIok6twAAPYTDeR2Jq0l6IIBCzsYKFTg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108309},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"5fc40cdc1548c31725333bdb0ec66da0b75fec8c","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"},"_npmVersion":"10.8.2","description":"Vendor-neutral LLM protocol for auto-hwp chat-editing: EditRequest/EditResponse types, buildDocContext (R5 fence), buildSystemPrompt (INTENT-SCHEMA excerpt, allowed-intent subset), validateRequest/validateResponse (whitelist + structure). Pure, isomorphic","directories":{},"_nodeVersion":"20.19.6","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/ai-protocol_0.0.2_1785326959716_0.9873102228871162","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@auto-hwp/ai-protocol","version":"0.0.3","keywords":["hwp","hwpx","llm","intent","protocol","isomorphic","prompt"],"license":"MIT OR Apache-2.0","_id":"@auto-hwp/ai-protocol@0.0.3","maintainers":[{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"}],"dist":{"shasum":"3270e33624ee744616e20facf01792df9681882c","tarball":"https://registry.npmjs.org/@auto-hwp/ai-protocol/-/ai-protocol-0.0.3.tgz","fileCount":26,"integrity":"sha512-E1Q8p1aP/pg+HPozZ3GFfOBerRkHlMMUG2ntL2uc8V838G7cjw/QwhVPAZIpoP+cJovhE+9ViEyO6p56hswVYw==","signatures":[{"sig":"MEUCIQCgw5ayUuKg+mTua2gGhaChHcFn7SoRzQ37rlS2ZVSpNQIgWASKfzZ7sEbX8iDxLRVZPET+g+PtA1p1VV7oYYjzWto=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108309},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"d8ff8fa4f44aeb4416051c0948593fd92586737f","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"},"_npmVersion":"10.8.2","description":"Vendor-neutral LLM protocol for auto-hwp chat-editing: EditRequest/EditResponse types, buildDocContext (R5 fence), buildSystemPrompt (INTENT-SCHEMA excerpt, allowed-intent subset), validateRequest/validateResponse (whitelist + structure). Pure, isomorphic","directories":{},"_nodeVersion":"20.19.6","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/ai-protocol_0.0.3_1785390948247_0.31246109445297376","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@auto-hwp/ai-protocol","version":"0.0.4","keywords":["hwp","hwpx","llm","intent","protocol","isomorphic","prompt"],"license":"Apache-2.0","_id":"@auto-hwp/ai-protocol@0.0.4","maintainers":[{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"}],"dist":{"shasum":"90fd41eabfc21fa15bfcf7b87bc32797d765d07b","tarball":"https://registry.npmjs.org/@auto-hwp/ai-protocol/-/ai-protocol-0.0.4.tgz","fileCount":27,"integrity":"sha512-HNbKZ4/gbBbQMvBOGpqTEHurO5Rqy0leQJopz1b3SNUdu7tm2YOvRJ6O0tu8pwuABivxwYWFCiG+CtaErjrwcA==","signatures":[{"sig":"MEUCID0v1+Cjuet9rDTlr4qtdJ7R58r24v45EZEP2SCw3DN7AiEAmPG2Tx115WPz2Qcgc7TwW9jprrKpQpiqyZyKUo87YV8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":119164},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"f27d185d80595353e2de2ff67d36bd530c9e6ce7","scripts":{"test":"vitest run","build":"tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc --noEmit"},"_npmUser":{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"},"_npmVersion":"10.8.2","description":"Vendor-neutral LLM protocol for auto-hwp chat-editing: EditRequest/EditResponse types, buildDocContext (R5 fence), buildSystemPrompt (INTENT-SCHEMA excerpt, allowed-intent subset), validateRequest/validateResponse (whitelist + structure). Pure, isomorphic","directories":{},"_nodeVersion":"20.19.6","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.10","typescript":"^5.6.3"},"_npmOperationalInternal":{"tmp":"tmp/ai-protocol_0.0.4_1785411273089_0.9478226333584978","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@auto-hwp/ai-protocol","version":"0.0.5","description":"Vendor-neutral LLM protocol for auto-hwp chat-editing: EditRequest/EditResponse types, buildDocContext (R5 fence), buildSystemPrompt (INTENT-SCHEMA excerpt, allowed-intent subset), validateRequest/validateResponse (whitelist + structure). Pure, isomorphic","license":"Apache-2.0","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"build":"tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc --noEmit","test":"vitest run"},"devDependencies":{"typescript":"^5.6.3","vitest":"^4.1.10"},"keywords":["hwp","hwpx","llm","intent","protocol","isomorphic","prompt"],"engines":{"node":">=18"},"publishConfig":{"access":"public"},"pnpm":{"onlyBuiltDependencies":["esbuild"]},"_id":"@auto-hwp/ai-protocol@0.0.5","gitHead":"7a41cb663d07891ed23141ab613cfbda66b82a0f","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-t4fb/ccwS6dQSjpVwUX2+zdpQuFHnXTXDBICmnTOHU6bpds0/+IRTjjfrWzLIdpLhqFJ5qIcCxYkp5QBOtnMhg==","shasum":"8d8d5d378870e1a28b27ea62967489270398c837","tarball":"https://registry.npmjs.org/@auto-hwp/ai-protocol/-/ai-protocol-0.0.5.tgz","fileCount":27,"unpackedSize":136052,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDoHnT8uSs58rYrp/MaJLHCwYG6wTIMnJv39bE4robIuAiEA1xg7UfxBx5Eyh/wH/S9xqNFl5KYIA5kNTFwkLFZGwec="}]},"_npmUser":{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"},"directories":{},"maintainers":[{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-protocol_0.0.5_1786606679431_0.7471458422030188"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-22T10:01:51.033Z","modified":"2026-08-13T07:37:59.782Z","0.0.1":"2026-07-22T10:01:51.310Z","0.0.2":"2026-07-29T12:09:19.856Z","0.0.3":"2026-07-30T05:55:48.382Z","0.0.4":"2026-07-30T11:34:33.249Z","0.0.5":"2026-08-13T07:37:59.587Z"},"license":"Apache-2.0","keywords":["hwp","hwpx","llm","intent","protocol","isomorphic","prompt"],"description":"Vendor-neutral LLM protocol for auto-hwp chat-editing: EditRequest/EditResponse types, buildDocContext (R5 fence), buildSystemPrompt (INTENT-SCHEMA excerpt, allowed-intent subset), validateRequest/validateResponse (whitelist + structure). Pure, isomorphic","maintainers":[{"name":"kwakseongjae","email":"gkffhdnls13@gmail.com"}],"readme":"# @auto-hwp/ai-protocol\n\nThe **vendor-neutral, isomorphic** LLM protocol for auto-hwp chat-editing — the L2' of the\n[SDK layers](../../docs/SDK-LAYERS.md). It is **types + pure transforms + validation only**: the doc-context\nbuilder, the system prompt (an excerpt of [INTENT-SCHEMA](../../docs/INTENT-SCHEMA.md)), and the\nrequest/response validators. The **server proxy and the browser client import the SAME module**, so the\nwire contract can never drift between them.\n\n> **Zero fetch. Zero LLM client. Zero keys.** Which model, which vendor, streaming or not — all the\n> host's choice (R6). This package never talks to a network.\n\n```ts\n// ── server proxy (your key lives here) ──────────────────────────────\nimport { buildSystemPrompt, buildUserMessage, validateRequest, validateResponse } from \"@auto-hwp/ai-protocol\";\n\nconst check = validateRequest(await req.json());\nif (!check.ok) return badRequest(check.error);\n\nconst text = await callYourModel({                 // ← YOUR vendor, YOUR key\n  system: buildSystemPrompt(),                      // INTENT-SCHEMA excerpt; pass { allowedIntents } to narrow\n  user: buildUserMessage(check.value),              // R5 <document-content> fence applied here\n});\nreturn json({ intents: validateResponse(text, { onDrop: console.warn }) }); // whitelist + structure\n\n// ── browser client (no key, no model) ───────────────────────────────\nimport { buildDocContext } from \"@auto-hwp/ai-protocol\";\nconst docContext = buildDocContext(meta, anchors); // the string POSTed to your proxy\n```\n\n## API\n\n| Export | Role |\n|--------|------|\n| `EditRequest` / `EditResponse` / `Intent` / `Anchor` / `INTENT_VERSION` | the wire types (schema v0). |\n| `buildDocContext(meta, anchors, { maxLen? })` | the doc-context string (header + anchor lines; anchor text is untrusted). |\n| `buildUserMessage(req)` | the LLM user turn with the **R5 `<document-content>` fence**. |\n| `buildSystemPrompt({ allowedIntents? })` | the system prompt — an **excerpt of INTENT-SCHEMA** (source-line comments preserved), optionally a subset. |\n| `validateRequest(body, limits?)` | input guard (length/count caps). |\n| `validateResponse(textOrArray, { allowedIntents?, onDrop? })` | parse LLM text → **whitelist + structure check**. |\n| `DEFAULT_ALLOWED_INTENTS` / `DEFAULT_LIMITS` | the frozen whitelist + caps. |\n\n## Bring your own vendor\n\nThe only host-specific glue is *the model call itself*. Everything before it (prompt + user message) and\nafter it (parse + whitelist) is here and shared. `apps/hwp-lab/src/app/api/hwp-edit/route.ts` is a\n**documented reference proxy** (Anthropic) — copy it for any vendor.\n\n## Develop\n\n```bash\nnpm run build       # tsc → dist (JS + .d.ts)\nnpm run typecheck   # tsc --noEmit\nnpm test            # vitest (node env): context/prompt/validate — isomorphic\n```\n","readmeFilename":"README.md"}