{"_id":"@civaapple/qi-llm","_rev":"2-09f012134ac77f2801852f0f1c95c5ea","name":"@civaapple/qi-llm","dist-tags":{"latest":"0.5.1"},"versions":{"0.5.0":{"name":"@civaapple/qi-llm","version":"0.5.0","license":"MIT","_id":"@civaapple/qi-llm@0.5.0","maintainers":[{"name":"civaapple","email":"civaapple@gmail.com"}],"homepage":"https://github.com/civaapple-alt/qi#readme","bugs":{"url":"https://github.com/civaapple-alt/qi/issues"},"dist":{"shasum":"795f177602af34a4327bcf50cc9b22db104db9c6","tarball":"https://registry.npmjs.org/@civaapple/qi-llm/-/qi-llm-0.5.0.tgz","fileCount":32,"integrity":"sha512-e7Xs2/ekWrAJoMz894gKAv7w+EHQleiLdCMtrB+0aLCG0OQZ+huOcrjwV6GAQCUQUdwGiSKMfQJ3RK7K0araLA==","signatures":[{"sig":"MEQCIGfCrL1DV+3jF2ZZM4rMfkF1ZYY6P+wLBi9fWbJi8PzdAiAKuTlWReoUuWkG42J9n/u6zMGmNSHcotV5EGBnMaVFxg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@civaapple%2fqi-llm@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":207545},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=22.19.0"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"9ae76a92cdcce130958d3f93c6ab5ba20149d424","_npmUser":{"name":"civaapple","email":"civaapple@gmail.com"},"repository":{"url":"git+https://github.com/civaapple-alt/qi.git","type":"git","directory":"packages/llm"},"_npmVersion":"11.16.0","description":"Portable Qi model protocol and OpenAI-compatible provider adapters","directories":{},"_nodeVersion":"24.18.0","dependencies":{"openai":"^6.48.0","@sinclair/typebox":"0.34.52"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/qi-llm_0.5.0_1785137625111_0.14457244909691336","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@civaapple/qi-llm","version":"0.5.1","description":"Portable Qi model protocol and OpenAI-compatible provider adapters","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"engines":{"node":">=22.19.0"},"dependencies":{"@sinclair/typebox":"0.34.52","openai":"^6.48.0"},"repository":{"type":"git","url":"git+https://github.com/civaapple-alt/qi.git","directory":"packages/llm"},"homepage":"https://github.com/civaapple-alt/qi#readme","bugs":{"url":"https://github.com/civaapple-alt/qi/issues"},"license":"MIT","publishConfig":{"access":"public","provenance":true},"gitHead":"8b042be6fb43eda223b619286e9b3e5cb1e1c439","_id":"@civaapple/qi-llm@0.5.1","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-2Y3MpuRw84HE9EwJ9H8YlHw3UMmnuAxmA/RpSvXYkF93gxr0TCzDZ/F6oR84k/EKI1PeUoymbjl33kuUoMAXpw==","shasum":"729b0541715186db27f2a0133912367d15966a69","tarball":"https://registry.npmjs.org/@civaapple/qi-llm/-/qi-llm-0.5.1.tgz","fileCount":32,"unpackedSize":207545,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@civaapple%2fqi-llm@0.5.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCJySvzecYtwi/eZTOcHB+Ge0JOEipptMWJFY+YX0ZS9QIgetK7Jg9ogT0tCO9hF4eHyw2LuEpAkslMW+fbL5s50MQ="}]},"_npmUser":{"name":"civaapple","email":"civaapple@gmail.com"},"directories":{},"maintainers":[{"name":"civaapple","email":"civaapple@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/qi-llm_0.5.1_1785149285484_0.20771654117932403"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T07:33:44.941Z","modified":"2026-07-27T10:48:05.907Z","0.5.0":"2026-07-27T07:33:45.236Z","0.5.1":"2026-07-27T10:48:05.631Z"},"bugs":{"url":"https://github.com/civaapple-alt/qi/issues"},"license":"MIT","homepage":"https://github.com/civaapple-alt/qi#readme","repository":{"type":"git","url":"git+https://github.com/civaapple-alt/qi.git","directory":"packages/llm"},"description":"Portable Qi model protocol and OpenAI-compatible provider adapters","maintainers":[{"name":"civaapple","email":"civaapple@gmail.com"}],"readme":"# `@civaapple/qi-llm`\n\nA small portable model plane for validated requests, streamed events, and provider adapters.\n\n## Purpose\n\nThe package separates Qi's model-facing protocol from provider SDKs. `ModelPort` accepts portable history,\ntool descriptions, capabilities, cancellation, and context metadata, then emits validated model events.\n\n## Non-goals\n\n- It does not run the Agent loop or authorize tool calls.\n- Provider response IDs and hidden server state do not become required Session truth.\n- It does not decide completion, memory, or retry policy.\n\n## Core model\n\n`ModelRequestSchema` describes portable input. A stream contains content and action proposal events with exactly\none terminal boundary. Explicit `ProviderProfile` entries choose the wire API and transport capability matrix.\n`OpenAIResponsesModelPort` maps to OpenAI-compatible Responses APIs; `OpenAIChatCompletionsModelPort` maps to\nChat Completions (assembling streamed tool arguments only after a terminal finish reason);\n`createModelPortForProfile` selects the adapter; `ScriptedModelPort` supplies deterministic fixtures.\n\n## Behavioral invariants\n\n- Validate unsupported portable inputs before network execution.\n- Do not release action proposals from an incomplete provider response.\n- Preserve cancellation and terminal stream semantics.\n- Verify that provider output belongs to the expected request/model boundary.\n\n## Failure semantics\n\nSchema, capability, provider, and cancellation failures remain distinguishable. An incomplete response never\nsilently becomes an executable tool batch.\n\n## Install and minimal use\n\n```sh\nnpm install @civaapple/qi-llm\n```\n\n```ts\nimport { ScriptedModelPort } from \"@civaapple/qi-llm\";\n\nconst model = new ScriptedModelPort([[\n  { type: \"text.delta\", delta: \"hello\" },\n  { type: \"completed\", finishReason: \"stop\" },\n]]);\n```\n\n## Public API\n\nPortable schemas and types, `ModelPort`, `OpenAIResponsesModelPort`, and `ScriptedModelPort`.\n\n## Change guide\n\nExtend the portable protocol before adding provider-only branches. Update the adapter, scripted fixtures,\ncontext compilation assumptions, and loop handling together when stream events change.\n\n## Verification\n\nUse `tests/openai-responses.test.mjs` and the model cases in `tests/llm-context.test.mjs`.\n\n## Further reading\n\n- [Portable model protocol](docs/portable-protocol.md)\n- [Provider adapters](docs/provider-adapters.md)\n- [LLM layer design](../../design/system-design.md#5-context-models-and-memory)\n","readmeFilename":"README.md"}