promptopskit 0.9.0 → 0.9.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.
Files changed (37) hide show
  1. package/README.md +18 -5
  2. package/dist/{chunk-W6XHGSPJ.js → chunk-7GMCNHXJ.js} +3 -3
  3. package/dist/{chunk-SVNQNMMV.js → chunk-C5HHTLZX.js} +2 -2
  4. package/dist/{chunk-Q67E2GGD.js → chunk-D23T3X4V.js} +2 -2
  5. package/dist/{chunk-AAQNCAVA.js → chunk-EDHPVR2F.js} +3 -3
  6. package/dist/{chunk-FJ3D76IV.js → chunk-O3SRIDTH.js} +2 -2
  7. package/dist/{chunk-E2AIIPQC.js → chunk-QHAIOVQ3.js} +2 -2
  8. package/dist/{chunk-NS6OTKY2.js → chunk-QZHR2YMK.js} +22 -3
  9. package/dist/{chunk-NS6OTKY2.js.map → chunk-QZHR2YMK.js.map} +1 -1
  10. package/dist/index.cjs +21 -2
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.js +7 -7
  13. package/dist/providers/anthropic.cjs +21 -2
  14. package/dist/providers/anthropic.cjs.map +1 -1
  15. package/dist/providers/anthropic.js +2 -2
  16. package/dist/providers/gemini.cjs +21 -2
  17. package/dist/providers/gemini.cjs.map +1 -1
  18. package/dist/providers/gemini.js +2 -2
  19. package/dist/providers/llmasaservice.cjs +21 -2
  20. package/dist/providers/llmasaservice.cjs.map +1 -1
  21. package/dist/providers/llmasaservice.js +3 -3
  22. package/dist/providers/openai-responses.cjs +21 -2
  23. package/dist/providers/openai-responses.cjs.map +1 -1
  24. package/dist/providers/openai-responses.js +2 -2
  25. package/dist/providers/openai.cjs +21 -2
  26. package/dist/providers/openai.cjs.map +1 -1
  27. package/dist/providers/openai.js +2 -2
  28. package/dist/providers/openrouter.cjs +21 -2
  29. package/dist/providers/openrouter.cjs.map +1 -1
  30. package/dist/providers/openrouter.js +3 -3
  31. package/package.json +1 -1
  32. /package/dist/{chunk-W6XHGSPJ.js.map → chunk-7GMCNHXJ.js.map} +0 -0
  33. /package/dist/{chunk-SVNQNMMV.js.map → chunk-C5HHTLZX.js.map} +0 -0
  34. /package/dist/{chunk-Q67E2GGD.js.map → chunk-D23T3X4V.js.map} +0 -0
  35. /package/dist/{chunk-AAQNCAVA.js.map → chunk-EDHPVR2F.js.map} +0 -0
  36. /package/dist/{chunk-FJ3D76IV.js.map → chunk-O3SRIDTH.js.map} +0 -0
  37. /package/dist/{chunk-E2AIIPQC.js.map → chunk-QHAIOVQ3.js.map} +0 -0
package/README.md CHANGED
@@ -5,17 +5,30 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
7
7
 
8
- **Turn hardcoded AI prompts into versioned, tested application assets.**
8
+ **Prompts are becoming production code. Manage them that way.**
9
9
 
10
- Your prompts are already in Git. PromptOpsKit makes them manageable.
10
+ AI features often start with a few prompt strings. Then model settings, tools, provider quirks, context limits, environment overrides, tests, and customer-specific behavior start spreading across the codebase.
11
11
 
12
- Keep prompts, model settings, tools, input validation, shared instructions, environment overrides, and tests together in Markdown files that live in Git and ship with your app. Render provider-ready request bodies without giving up your SDK, gateway, auth, retries, routing, observability, or billing.
12
+ PromptOpsKit is an open-source toolkit for turning hardcoded AI prompts into versioned, tested application assets. Keep prompts, model settings, tools, input validation, shared instructions, environment overrides, and tests together in Markdown files that live in Git and ship with your app.
13
+
14
+ No hosted dashboard. No gateway required. No vendor lock-in. Render provider-ready request bodies while keeping your SDK, auth, routing, retries, observability, and billing.
13
15
 
14
16
  PromptOpsKit is not a prompt dashboard, LLM gateway, or hosted runtime service. It is the repo-native layer between scattered prompt strings and production AI calls.
15
17
 
18
+ ## Where this fits in the AI production stack
19
+
20
+ PromptOpsKit handles the open-source prompt asset layer: prompts, model settings, tools, input rules, overrides, and tests in Git.
21
+
22
+ As AI features grow, adjacent production concerns usually appear:
23
+
24
+ - **Provider operations** — routing, caching, cost controls, customer attribution, and gateway reliability. See LLMAsAService.
25
+ - **Customer usage and billing** — usage metering, entitlements, limits, alerts, and usage-based billing. See UsageTap.
26
+
27
+ PromptOpsKit does not require either service. It keeps the prompt layer repo-native and transport-light so teams can adopt the rest of their AI production stack when they need it.
28
+
16
29
  ## Why PromptOpsKit?
17
30
 
18
- From scattered prompt glue:
31
+ When prototypes become real product features, prompt glue is hard to review and easy to drift:
19
32
 
20
33
  - Prompt strings live inline in code
21
34
  - Model config and tools drift in separate files
@@ -23,7 +36,7 @@ From scattered prompt glue:
23
36
  - Environment logic hides in if/else branches
24
37
  - Testing is ad hoc and hard to review
25
38
 
26
- To one reviewable asset:
39
+ PromptOpsKit turns that behavior into one reviewable asset:
27
40
 
28
41
  - Prompt, model, tools, and input rules live together
29
42
  - `includes` and `defaults.md` avoid copy-paste drift
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  openaiAdapter
3
- } from "./chunk-SVNQNMMV.js";
3
+ } from "./chunk-C5HHTLZX.js";
4
4
  import {
5
5
  applyRawProviderBody,
6
6
  resolveAssetForProvider,
7
7
  withPromptInputSupport
8
- } from "./chunk-NS6OTKY2.js";
8
+ } from "./chunk-QZHR2YMK.js";
9
9
 
10
10
  // src/providers/llmasaservice.ts
11
11
  var LLMASASERVICE_BASE_URL = "https://gateway.llmasaservice.io";
@@ -127,4 +127,4 @@ export {
127
127
  createLLMAsAServiceOpenAIConfig,
128
128
  llmasaserviceAdapter
129
129
  };
130
- //# sourceMappingURL=chunk-W6XHGSPJ.js.map
130
+ //# sourceMappingURL=chunk-7GMCNHXJ.js.map
@@ -4,7 +4,7 @@ import {
4
4
  renderSections,
5
5
  resolveAssetForProvider,
6
6
  withPromptInputSupport
7
- } from "./chunk-NS6OTKY2.js";
7
+ } from "./chunk-QZHR2YMK.js";
8
8
 
9
9
  // src/providers/openai.ts
10
10
  var openaiAdapter = withPromptInputSupport({
@@ -107,4 +107,4 @@ var openaiAdapter = withPromptInputSupport({
107
107
  export {
108
108
  openaiAdapter
109
109
  };
110
- //# sourceMappingURL=chunk-SVNQNMMV.js.map
110
+ //# sourceMappingURL=chunk-C5HHTLZX.js.map
@@ -4,7 +4,7 @@ import {
4
4
  renderSections,
5
5
  resolveAssetForProvider,
6
6
  withPromptInputSupport
7
- } from "./chunk-NS6OTKY2.js";
7
+ } from "./chunk-QZHR2YMK.js";
8
8
 
9
9
  // src/providers/anthropic.ts
10
10
  var anthropicAdapter = withPromptInputSupport({
@@ -144,4 +144,4 @@ var anthropicAdapter = withPromptInputSupport({
144
144
  export {
145
145
  anthropicAdapter
146
146
  };
147
- //# sourceMappingURL=chunk-Q67E2GGD.js.map
147
+ //# sourceMappingURL=chunk-D23T3X4V.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  openaiAdapter
3
- } from "./chunk-SVNQNMMV.js";
3
+ } from "./chunk-C5HHTLZX.js";
4
4
  import {
5
5
  applyRawProviderBody,
6
6
  resolveAssetForProvider,
7
7
  withPromptInputSupport
8
- } from "./chunk-NS6OTKY2.js";
8
+ } from "./chunk-QZHR2YMK.js";
9
9
 
10
10
  // src/providers/openrouter.ts
11
11
  var openrouterAdapter = withPromptInputSupport({
@@ -58,4 +58,4 @@ var openrouterAdapter = withPromptInputSupport({
58
58
  export {
59
59
  openrouterAdapter
60
60
  };
61
- //# sourceMappingURL=chunk-AAQNCAVA.js.map
61
+ //# sourceMappingURL=chunk-EDHPVR2F.js.map
@@ -4,7 +4,7 @@ import {
4
4
  renderSections,
5
5
  resolveAssetForProvider,
6
6
  withPromptInputSupport
7
- } from "./chunk-NS6OTKY2.js";
7
+ } from "./chunk-QZHR2YMK.js";
8
8
 
9
9
  // src/providers/gemini.ts
10
10
  var geminiAdapter = withPromptInputSupport({
@@ -120,4 +120,4 @@ var geminiAdapter = withPromptInputSupport({
120
120
  export {
121
121
  geminiAdapter
122
122
  };
123
- //# sourceMappingURL=chunk-FJ3D76IV.js.map
123
+ //# sourceMappingURL=chunk-O3SRIDTH.js.map
@@ -4,7 +4,7 @@ import {
4
4
  renderSections,
5
5
  resolveAssetForProvider,
6
6
  withPromptInputSupport
7
- } from "./chunk-NS6OTKY2.js";
7
+ } from "./chunk-QZHR2YMK.js";
8
8
 
9
9
  // src/providers/openai-responses.ts
10
10
  var openaiResponsesAdapter = withPromptInputSupport({
@@ -112,4 +112,4 @@ var openaiResponsesAdapter = withPromptInputSupport({
112
112
  export {
113
113
  openaiResponsesAdapter
114
114
  };
115
- //# sourceMappingURL=chunk-E2AIIPQC.js.map
115
+ //# sourceMappingURL=chunk-QHAIOVQ3.js.map
@@ -1726,10 +1726,29 @@ async function compressWithTheTokenCompany(input, options) {
1726
1726
  );
1727
1727
  }
1728
1728
  const data = await response.json();
1729
- if (typeof data.output !== "string" || typeof data.output_tokens !== "number" || typeof data.input_tokens !== "number" || typeof data.tokens_saved !== "number" || typeof data.compression_ratio !== "number") {
1729
+ const normalized = normalizeTheTokenCompanyCompressResponse(data);
1730
+ if (!normalized) {
1730
1731
  throw new Error("TheTokenCompany compression returned an invalid response payload.");
1731
1732
  }
1732
- return data;
1733
+ return normalized;
1734
+ }
1735
+ function normalizeTheTokenCompanyCompressResponse(data) {
1736
+ if (typeof data.output !== "string" || typeof data.output_tokens !== "number") {
1737
+ return void 0;
1738
+ }
1739
+ const inputTokens = typeof data.input_tokens === "number" ? data.input_tokens : data.original_input_tokens;
1740
+ if (typeof inputTokens !== "number") {
1741
+ return void 0;
1742
+ }
1743
+ const tokensSaved = typeof data.tokens_saved === "number" ? data.tokens_saved : inputTokens - data.output_tokens;
1744
+ const compressionRatio = typeof data.compression_ratio === "number" ? data.compression_ratio : data.output_tokens === 0 ? 0 : inputTokens / data.output_tokens;
1745
+ return {
1746
+ output: data.output,
1747
+ output_tokens: data.output_tokens,
1748
+ input_tokens: inputTokens,
1749
+ tokens_saved: tokensSaved,
1750
+ compression_ratio: compressionRatio
1751
+ };
1733
1752
  }
1734
1753
  function getEnv(name) {
1735
1754
  if (typeof process === "undefined") {
@@ -1838,4 +1857,4 @@ export {
1838
1857
  withPromptInputSupport,
1839
1858
  applyRawProviderBody
1840
1859
  };
1841
- //# sourceMappingURL=chunk-NS6OTKY2.js.map
1860
+ //# sourceMappingURL=chunk-QZHR2YMK.js.map