Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/csharp/Prompty.Anthropic/Prompty.Anthropic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.0.0-alpha.7</Version>
<Version>2.0.0-alpha.8</Version>
<PackageId>Prompty.Anthropic</PackageId>
<Authors>Microsoft</Authors>
<Description>Anthropic provider for Prompty — executor and processor for Claude models via the Anthropic Messages API.</Description>
Expand Down
2 changes: 1 addition & 1 deletion runtime/csharp/Prompty.Core/Prompty.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.0.0-alpha.7</Version>
<Version>2.0.0-alpha.8</Version>
<PackageId>Prompty.Core</PackageId>
<Authors>Microsoft</Authors>
<Description>Prompty is an asset class and format for LLM prompts. Core library with loader, pipeline, renderers, parsers, and tracing.</Description>
Expand Down
2 changes: 1 addition & 1 deletion runtime/csharp/Prompty.Foundry/Prompty.Foundry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<NoWarn>OPENAI001;CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>2.0.0-alpha.7</Version>
<Version>2.0.0-alpha.8</Version>
<PackageId>Prompty.Foundry</PackageId>
<Authors>Microsoft</Authors>
<Description>Microsoft Foundry (Azure OpenAI) provider for Prompty — executor and processor for Azure-hosted models.</Description>
Expand Down
2 changes: 1 addition & 1 deletion runtime/csharp/Prompty.OpenAI/Prompty.OpenAI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<NoWarn>OPENAI001;CS1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Version>2.0.0-alpha.7</Version>
<Version>2.0.0-alpha.8</Version>
<PackageId>Prompty.OpenAI</PackageId>
<Authors>Microsoft</Authors>
<Description>OpenAI provider for Prompty — executor and processor for OpenAI chat, embedding, image, and agent APIs.</Description>
Expand Down
2 changes: 1 addition & 1 deletion runtime/python/prompty/prompty/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.0.0a7"
VERSION = "2.0.0a8"
3 changes: 2 additions & 1 deletion runtime/python/prompty/prompty/parsers/prompty.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ def _build_message(
# Validate nonce in strict mode
if nonce is not None:
msg_nonce = attrs.pop("nonce", None)
if msg_nonce != nonce:
# Compare as strings — _parse_attrs may coerce all-digit hex nonces to int
if str(msg_nonce) != nonce:
raise ValueError(
"Nonce mismatch — possible prompt injection detected "
"(strict mode is enabled). A template variable may be "
Expand Down
10 changes: 9 additions & 1 deletion runtime/rust/prompty/src/parsers/prompty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ fn build_message(
) -> Result<Message, InvokerError> {
// Validate nonce in strict mode
if let Some(expected) = expected_nonce {
let msg_nonce = attrs.get("nonce").and_then(|v| v.as_str()).unwrap_or("");
// Compare as string — parse_attrs may coerce all-digit hex nonces to Number
let msg_nonce = attrs
.get("nonce")
.map(|v| match v {
serde_json::Value::String(s) => s.clone(),
serde_json::Value::Number(n) => n.to_string(),
_ => String::new(),
})
.unwrap_or_default();
if msg_nonce != expected {
return Err(InvokerError::Parse(
"Nonce mismatch — possible prompt injection detected \
Expand Down
4 changes: 2 additions & 2 deletions runtime/typescript/packages/anthropic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prompty/anthropic",
"version": "2.0.0-alpha.7",
"version": "2.0.0-alpha.8",
"description": "Anthropic provider for Prompty — executor and processor for Anthropic Messages API",
"type": "module",
"main": "./dist/index.cjs",
Expand Down Expand Up @@ -46,7 +46,7 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"@prompty/core": "^2.0.0-alpha.7",
"@prompty/core": "^2.0.0-alpha.8",
"@anthropic-ai/sdk": ">=0.39.0"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion runtime/typescript/packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prompty/core",
"version": "2.0.0-alpha.7",
"version": "2.0.0-alpha.8",
"description": "Prompty core runtime — load, render, parse, and trace .prompty files",
"type": "module",
"main": "./dist/index.cjs",
Expand Down
5 changes: 3 additions & 2 deletions runtime/typescript/packages/core/src/parsers/prompty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@ export class PromptyChatParser implements Parser {

// Validate nonce in strict mode
if (nonce !== undefined) {
const msgNonce = attrs.nonce as string | undefined;
const msgNonce = attrs.nonce;
delete attrs.nonce;
if (msgNonce !== nonce) {
// Compare as strings — parseAttrs may coerce all-digit hex nonces to numbers
if (String(msgNonce ?? "") !== nonce) {
throw new Error(
"Nonce mismatch — possible prompt injection detected " +
"(strict mode is enabled). A template variable may be " +
Expand Down
10 changes: 5 additions & 5 deletions runtime/typescript/packages/foundry/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prompty/foundry",
"version": "2.0.0-alpha.7",
"version": "2.0.0-alpha.8",
"description": "Microsoft Foundry provider for Prompty — executor and processor for Azure AI Foundry",
"type": "module",
"main": "./dist/index.cjs",
Expand Down Expand Up @@ -46,17 +46,17 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"@prompty/core": "^2.0.0-alpha.7",
"@prompty/openai": "^2.0.0-alpha.7"
"@prompty/core": "^2.0.0-alpha.8",
"@prompty/openai": "^2.0.0-alpha.8"
},
"dependencies": {
"@azure/ai-projects": "^2.0.1",
"@azure/identity": "^4.13.1",
"openai": "^4.80.0"
},
"devDependencies": {
"@prompty/core": "^2.0.0-alpha.7",
"@prompty/openai": "^2.0.0-alpha.7",
"@prompty/core": "^2.0.0-alpha.8",
"@prompty/openai": "^2.0.0-alpha.8",
"@types/node": "^20.11.0",
"dotenv": "^16.4.0",
"tsup": "^8.4.0",
Expand Down
6 changes: 3 additions & 3 deletions runtime/typescript/packages/openai/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prompty/openai",
"version": "2.0.0-alpha.7",
"version": "2.0.0-alpha.8",
"description": "OpenAI provider for Prompty — executor and processor for OpenAI APIs",
"type": "module",
"main": "./dist/index.cjs",
Expand Down Expand Up @@ -45,13 +45,13 @@
"node": ">=18.0.0"
},
"peerDependencies": {
"@prompty/core": "^2.0.0-alpha.7"
"@prompty/core": "^2.0.0-alpha.8"
},
"dependencies": {
"openai": "^4.80.0"
},
"devDependencies": {
"@prompty/core": "^2.0.0-alpha.7",
"@prompty/core": "^2.0.0-alpha.8",
"@types/node": "^20.11.0",
"dotenv": "^16.4.0",
"tsup": "^8.4.0",
Expand Down
32 changes: 16 additions & 16 deletions vscode/prompty/packages/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions vscode/prompty/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"@anthropic-ai/sdk": "^0.39.0",
"@azure/ai-projects": "^2.0.1",
"@azure/identity": "^4.6.0",
"@prompty/anthropic": "^2.0.0-alpha.7",
"@prompty/core": "^2.0.0-alpha.7",
"@prompty/foundry": "^2.0.0-alpha.7",
"@prompty/openai": "^2.0.0-alpha.7",
"@prompty/anthropic": "^2.0.0-alpha.8",
"@prompty/core": "^2.0.0-alpha.8",
"@prompty/foundry": "^2.0.0-alpha.8",
"@prompty/openai": "^2.0.0-alpha.8",
"glob": "^11.1.0",
"openai": "^4.80.0",
"vscode-languageclient": "^9.0.1"
Expand Down
6 changes: 3 additions & 3 deletions vscode/prompty/packages/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vscode/prompty/packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"node": "*"
},
"dependencies": {
"@prompty/core": "^2.0.0-alpha.7",
"@prompty/core": "^2.0.0-alpha.8",
"jsonc-parser": "^3.3.1",
"vscode-json-languageservice": "^5.7.2",
"vscode-languageserver": "^9.0.1",
Expand All @@ -33,4 +33,4 @@
"yaml": "2.8.3"
}
}
}
}
Loading
Loading