You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`RuntimeRenderOptions` for direct adapter rendering supports `environment`, `tier`, `runtime`, `variables`, `history`, `toolRegistry`, and `strict`.
244
+
`RuntimeRenderOptions` for direct adapter rendering supports `environment`, `tier`, `runtime`, `variables`, `onContextOverflow`, `history`, `toolRegistry`, and `strict`.
Copy file name to clipboardExpand all lines: docs/prompt-format.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,13 +168,27 @@ Each entry can be either a string variable name or an object with:
168
168
169
169
- `name` — the template variable name
170
170
- `max_size`— optional UTF-8 byte limit for the injected value
171
+
- `trim`— optional trim-to-budget (`true`/`end` keeps first bytes, `start` keeps trailing bytes) applied when `max_size` is set
172
+
- `allow_regex`— optional allowlist regex; input must match (throws `POK031` on mismatch)
173
+
- `deny_regex`— optional blocklist regex; input must not match (throws `POK032` on match)
171
174
172
175
The validator warns about:
173
176
- Variables used in templates but not declared in `context.inputs`
174
177
- Variables declared in `context.inputs` but never used
175
178
176
179
At render time, PromptOpsKit also emits a non-blocking `POK030` warning when a provided variable exceeds its declared `max_size`. In source and auto modes, the warning is also written to `console.warn` to make local development issues visible early.
| `history.max_items` | `number` | Maximum history items |
145
145
@@ -152,7 +152,12 @@ context:
152
152
- account_summary
153
153
```
154
154
155
-
Object-form inputs add optional `max_size`, which is checked during `renderPrompt()` and can produce a `POK030` warning when the injected value exceeds the declared budget.
155
+
Object-form inputs add optional controls:
156
+
157
+
- `max_size`: checked during `renderPrompt()` and can produce `POK030` warnings.
158
+
- `trim`: trims incoming values to the `max_size` budget before interpolation (`true`/`end` keeps leading bytes, `start` keeps trailing bytes).
159
+
- `allow_regex`: allowlist validation before interpolation; non-matches throw `POK031`.
160
+
- `deny_regex`: blocklist validation before interpolation; matches throw `POK032`.
|`POK014`| Warning |`trim` configured without `max_size` (trim-to-budget skipped) |
37
39
|`POK020`| Error | Include resolution failed (missing file) |
38
40
|`POK021`| Error | Circular include detected |
39
41
@@ -75,6 +77,36 @@ context:
75
77
76
78
If `account_summary` is rendered with a value larger than 4096 UTF-8 bytes, `renderPrompt()` returns a `POK030` warning. In source and auto modes, PromptOpsKit also writes the warning to `console.warn` so oversized context is visible during local development.
77
79
80
+
If you want to transform oversized values before warnings/rendering (for example, summarize or redact), pass `onContextOverflow` at render time:
0 commit comments