agent-alignment-protocol 0.1.7__tar.gz → 0.1.8__tar.gz

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 (24) hide show
  1. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/.gitignore +1 -0
  2. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/PKG-INFO +23 -3
  3. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/README.md +22 -2
  4. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/pyproject.toml +1 -1
  5. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/api.py +38 -2
  6. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/LICENSE +0 -0
  7. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/schemas/alignment-card.schema.json +0 -0
  8. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/schemas/ap-trace.schema.json +0 -0
  9. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/schemas/value-coherence.schema.json +0 -0
  10. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/__init__.py +0 -0
  11. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/cli/__init__.py +0 -0
  12. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/cli/main.py +0 -0
  13. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/py.typed +0 -0
  14. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/schemas/__init__.py +0 -0
  15. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/schemas/alignment_card.py +0 -0
  16. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/schemas/ap_trace.py +0 -0
  17. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/schemas/value_coherence.py +0 -0
  18. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/tracing.py +0 -0
  19. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/__init__.py +0 -0
  20. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/constants.py +0 -0
  21. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/divergence.py +0 -0
  22. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/features.py +0 -0
  23. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/models.py +0 -0
  24. {agent_alignment_protocol-0.1.7 → agent_alignment_protocol-0.1.8}/src/aap/verification/ssm.py +0 -0
@@ -71,3 +71,4 @@ traces/
71
71
  # Claude Code
72
72
  .claude/
73
73
  .mcp.json
74
+ *.tgz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-alignment-protocol
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: Agent Alignment Protocol - The missing alignment layer for the agent protocol stack
5
5
  Project-URL: Homepage, https://github.com/mnemom/aap
6
6
  Project-URL: Documentation, https://github.com/mnemom/aap#readme
@@ -216,7 +216,7 @@ For the complete limitations disclosure, see [Section 10 of the Specification](d
216
216
  pip install agent-alignment-protocol
217
217
 
218
218
  # TypeScript
219
- npm install agent-alignment-protocol
219
+ npm install @mnemom/agent-alignment-protocol
220
220
  ```
221
221
 
222
222
  ## Integration
@@ -280,6 +280,26 @@ for alert in alerts:
280
280
  - Forbidden action compliance (no forbidden actions taken)
281
281
  - Behavioral similarity (semantic alignment using SSM analysis)
282
282
 
283
+ ### Action Name Matching
284
+
285
+ Bounded and forbidden action lists support flexible matching (v0.1.7+):
286
+
287
+ ```json
288
+ {
289
+ "bounded_actions": [
290
+ "search",
291
+ "exec: execute shell commands",
292
+ "cron: manage scheduled patrol jobs"
293
+ ]
294
+ }
295
+ ```
296
+
297
+ - **Exact match**: `"search"` matches action name `"search"`
298
+ - **Colon-prefix match**: `"exec: execute shell commands"` matches action name `"exec"`
299
+ - **Compound actions**: action name `"exec, read"` matches when *each* component is in the bounded list
300
+
301
+ This allows descriptive entries in alignment cards while keeping verification flexible.
302
+
283
303
  **Similarity scoring:** Each verification returns a `similarity_score` (0.0-1.0) measuring semantic similarity between the trace and declared alignment. If a trace passes structural checks but has `similarity_score < 0.50`, a `low_behavioral_similarity` warning is generated.
284
304
 
285
305
  ## Try It
@@ -314,7 +334,7 @@ No server required — runs entirely client-side via WebAssembly.
314
334
 
315
335
  ## Status
316
336
 
317
- **Current Version**: 0.1.1 (Draft)
337
+ **Current Version**: 0.1.8
318
338
 
319
339
  | Component | Status |
320
340
  |-----------|--------|
@@ -176,7 +176,7 @@ For the complete limitations disclosure, see [Section 10 of the Specification](d
176
176
  pip install agent-alignment-protocol
177
177
 
178
178
  # TypeScript
179
- npm install agent-alignment-protocol
179
+ npm install @mnemom/agent-alignment-protocol
180
180
  ```
181
181
 
182
182
  ## Integration
@@ -240,6 +240,26 @@ for alert in alerts:
240
240
  - Forbidden action compliance (no forbidden actions taken)
241
241
  - Behavioral similarity (semantic alignment using SSM analysis)
242
242
 
243
+ ### Action Name Matching
244
+
245
+ Bounded and forbidden action lists support flexible matching (v0.1.7+):
246
+
247
+ ```json
248
+ {
249
+ "bounded_actions": [
250
+ "search",
251
+ "exec: execute shell commands",
252
+ "cron: manage scheduled patrol jobs"
253
+ ]
254
+ }
255
+ ```
256
+
257
+ - **Exact match**: `"search"` matches action name `"search"`
258
+ - **Colon-prefix match**: `"exec: execute shell commands"` matches action name `"exec"`
259
+ - **Compound actions**: action name `"exec, read"` matches when *each* component is in the bounded list
260
+
261
+ This allows descriptive entries in alignment cards while keeping verification flexible.
262
+
243
263
  **Similarity scoring:** Each verification returns a `similarity_score` (0.0-1.0) measuring semantic similarity between the trace and declared alignment. If a trace passes structural checks but has `similarity_score < 0.50`, a `low_behavioral_similarity` warning is generated.
244
264
 
245
265
  ## Try It
@@ -274,7 +294,7 @@ No server required — runs entirely client-side via WebAssembly.
274
294
 
275
295
  ## Status
276
296
 
277
- **Current Version**: 0.1.1 (Draft)
297
+ **Current Version**: 0.1.8
278
298
 
279
299
  | Component | Status |
280
300
  |-----------|--------|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "agent-alignment-protocol"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "Agent Alignment Protocol - The missing alignment layer for the agent protocol stack"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -39,6 +39,42 @@ from aap.verification.models import (
39
39
  )
40
40
 
41
41
 
42
+ def action_matches_list(action_name: str, action_list: list[str]) -> bool:
43
+ """Check if a (possibly compound) action name matches any entry in a list.
44
+
45
+ Supports exact match, prefix match (before ':'), and compound name splitting.
46
+ Port of the TypeScript actionMatchesList() for SDK parity.
47
+
48
+ Args:
49
+ action_name: Action name, possibly compound (e.g. "exec, read")
50
+ action_list: List of allowed/forbidden action entries,
51
+ possibly with colon descriptions (e.g. "exec: execute shell commands")
52
+
53
+ Returns:
54
+ True if the action name matches an entry in the list
55
+ """
56
+ components = action_name.split(", ") if ", " in action_name else [action_name]
57
+
58
+ return all(
59
+ _action_component_matches(component.strip(), action_list)
60
+ for component in components
61
+ if component.strip()
62
+ )
63
+
64
+
65
+ def _action_component_matches(component: str, action_list: list[str]) -> bool:
66
+ """Check if a single action component matches any entry in the list."""
67
+ for entry in action_list:
68
+ if entry == component:
69
+ return True
70
+ colon_index = entry.find(":")
71
+ if colon_index > 0:
72
+ prefix = entry[:colon_index].strip()
73
+ if prefix == component:
74
+ return True
75
+ return False
76
+
77
+
42
78
  def verify_trace(
43
79
  trace: dict[str, Any],
44
80
  card: dict[str, Any],
@@ -103,7 +139,7 @@ def verify_trace(
103
139
 
104
140
  if action_category == "bounded":
105
141
  bounded_actions = envelope.get("bounded_actions", [])
106
- if action_name and action_name not in bounded_actions:
142
+ if action_name and not action_matches_list(action_name, bounded_actions):
107
143
  violations.append(Violation.create(
108
144
  ViolationType.UNBOUNDED_ACTION,
109
145
  f"Action '{action_name}' not in bounded_actions: {bounded_actions}",
@@ -113,7 +149,7 @@ def verify_trace(
113
149
  # Check forbidden actions
114
150
  checks_performed.append("forbidden")
115
151
  forbidden_actions = envelope.get("forbidden_actions", [])
116
- if action_name and action_name in forbidden_actions:
152
+ if action_name and action_matches_list(action_name, forbidden_actions):
117
153
  violations.append(Violation.create(
118
154
  ViolationType.FORBIDDEN_ACTION,
119
155
  f"Action '{action_name}' is in forbidden_actions",