@bluefly/openstandardagents 0.4.9 → 0.5.0

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 (125) hide show
  1. package/.version.json +3 -3
  2. package/CHANGELOG.md +8 -8
  3. package/README.md +68 -58
  4. package/bin/postinstall +0 -0
  5. package/dist/.version.json +3 -3
  6. package/dist/adapters/claude-code/adapter.js +2 -2
  7. package/dist/adapters/docker/generators.js +19 -19
  8. package/dist/adapters/drupal/generator.js +76 -76
  9. package/dist/adapters/openai-agents/adapter.js +2 -2
  10. package/dist/cli/schema-driven/schema-loader.js +5 -5
  11. package/dist/mcp-server/__tests__/mcp-server.spec.js +20 -11
  12. package/dist/mcp-server/index.js +0 -0
  13. package/dist/package.json +24 -11
  14. package/dist/services/export/langchain/langchain-exporter.js +2 -2
  15. package/dist/services/export/langchain/memory-generator.js +2 -2
  16. package/dist/services/export/testing/test-generator.js +1 -1
  17. package/dist/services/taxonomy-service.d.ts +3 -3
  18. package/dist/skills/test-skill/package.json +1 -1
  19. package/dist/spec/extensions/role-manifest.md +188 -0
  20. package/dist/spec/v0.4/extensions/mcp/README.md +1 -1
  21. package/dist/spec/v0.5/agent.schema.json +2 -1
  22. package/dist/spec/v0.5/extensions/mcp/README.md +1 -1
  23. package/dist/spec/v0.5/role.schema.json +268 -0
  24. package/dist/types/index.d.ts +2 -0
  25. package/dist/types/index.js +2 -0
  26. package/dist/types/role.d.ts +126 -0
  27. package/dist/types/role.js +38 -0
  28. package/dist/validation/validator.js +1 -1
  29. package/examples/agents/01-customer-support-bot/agent.ossa.yaml +24 -31
  30. package/examples/agents/05-sales-assistant/agent.ossa.yaml +35 -23
  31. package/examples/agents/07-research-assistant/agent.ossa.yaml +27 -21
  32. package/examples/agents/10-meeting-assistant/agent.ossa.yaml +27 -35
  33. package/examples/agents/security-audit-agent.ossa.yaml +234 -0
  34. package/examples/agentscope/react-assistant/agent.ossa.yaml +36 -32
  35. package/examples/drupal/content-moderator.ossa.yaml +2 -2
  36. package/examples/drupal/drupal-contributor.ossa.yaml +247 -0
  37. package/examples/export/langchain/production-agent-with-memory/README.md +1 -1
  38. package/examples/export/langchain/production-agent-with-memory/agent.ossa.yaml +13 -23
  39. package/examples/export/langchain/production-agent-with-streaming/agent.ossa.yaml +1 -15
  40. package/examples/export/langchain/production-agent-with-tools/agent.ossa.yaml +28 -29
  41. package/examples/getting-started/01-minimal-agent.ossa.yaml +1 -1
  42. package/examples/getting-started/02-agent-with-tools.ossa.yaml +1 -1
  43. package/examples/getting-started/03-agent-with-safety.ossa.yaml +1 -1
  44. package/examples/getting-started/04-agent-with-messaging.ossa.yaml +1 -1
  45. package/examples/getting-started/05-workflow-composition.ossa.yaml +1 -1
  46. package/examples/getting-started/README.md +3 -3
  47. package/examples/getting-started/hello-world-complete.ossa.yaml +1 -1
  48. package/examples/gitlab-agents/gitlab-ci-agent.ossa.yaml +221 -0
  49. package/examples/hierarchical-agent.ossa.yaml +10 -53
  50. package/examples/kagent/ossa-kagent-anthropic.ossa.yaml +2 -25
  51. package/examples/kagent/ossa-kagent-mcp-tools.ossa.yaml +2 -30
  52. package/examples/kagent/ossa-kagent-multi-tool.ossa.yaml +2 -18
  53. package/examples/kagent/ossa-kagent-poc.ossa.yaml +2 -16
  54. package/examples/pipeline-agent.ossa.yaml +3 -3
  55. package/examples/platform-specific/claude-code-subagent.yaml +1 -1
  56. package/examples/platform-specific/cursor-coding-agent.yaml +1 -1
  57. package/examples/platform-specific/warp-terminal-agent.yaml +1 -1
  58. package/examples/production-ready/01-customer-support-bot/agent.ossa.yaml +24 -31
  59. package/examples/production-ready/05-sales-assistant/agent.ossa.yaml +35 -23
  60. package/examples/production-ready/07-research-assistant/agent.ossa.yaml +27 -19
  61. package/examples/production-ready/10-meeting-assistant/agent.ossa.yaml +27 -35
  62. package/examples/reference-implementations/python-client/examples/basic_usage.py +0 -0
  63. package/examples/reference-implementations/python-client/examples/publish_agent.py +0 -0
  64. package/examples/roles/drupal-developer.role.yaml +37 -0
  65. package/examples/roles/platform-operator.role.yaml +28 -0
  66. package/examples/roles/security-auditor.role.yaml +27 -0
  67. package/examples/swarm-agent.ossa.yaml +13 -51
  68. package/examples/team-agent.ossa.yaml +12 -61
  69. package/examples/team-lead-teammate.ossa.yaml +12 -17
  70. package/openapi/agent-communication.yaml +260 -212
  71. package/openapi/agent-crud.yaml +217 -187
  72. package/openapi/agent-discovery.yaml +119 -81
  73. package/openapi/agent-identity.yaml +219 -187
  74. package/openapi/agent-taxonomy.yaml +95 -38
  75. package/openapi/agents-md-service.yaml +103 -30
  76. package/openapi/cli/openapi.yaml +147 -40
  77. package/openapi/core/ossa-core-api.openapi.yaml +327 -271
  78. package/openapi/core/ossa-registry-api.openapi.yaml +298 -235
  79. package/openapi/core/ossa-registry.openapi.yaml +299 -159
  80. package/openapi/core/unified-agent-gateway.openapi.yaml +234 -170
  81. package/openapi/daemon-api.openapi.yaml +323 -181
  82. package/openapi/dev-cli/openapi.yaml +137 -113
  83. package/openapi/github-sync.yaml +62 -19
  84. package/openapi/marketplace-plugin.openapi.yaml +539 -466
  85. package/openapi/ossa-api.openapi.yaml +354 -213
  86. package/openapi/ossa-cli-enhancements.openapi.yaml +108 -89
  87. package/openapi/ossa-cli.yaml +260 -184
  88. package/openapi/protocols/sse-streams.yaml +66 -74
  89. package/openapi/protocols/websocket-events.yaml +61 -54
  90. package/openapi/reference-implementations/aiflow-bridge-api.openapi.yaml +37 -20
  91. package/openapi/reference-implementations/compliance-agent-api.openapi.yaml +35 -23
  92. package/openapi/reference-implementations/crewai-agent-api.openapi.yaml +29 -18
  93. package/openapi/reference-implementations/critic-agent-api.openapi.yaml +45 -19
  94. package/openapi/reference-implementations/document-analyzer-api.openapi.yaml +30 -24
  95. package/openapi/reference-implementations/drupal-agent-api.openapi.yaml +101 -50
  96. package/openapi/reference-implementations/getting-started-hello-world-api.openapi.yaml +33 -22
  97. package/openapi/reference-implementations/gitlab-ml-recommender-api.openapi.yaml +20 -16
  98. package/openapi/reference-implementations/governor-agent-api.openapi.yaml +41 -23
  99. package/openapi/reference-implementations/helm-generator.openapi.yaml +88 -46
  100. package/openapi/reference-implementations/integrator-agent-api.openapi.yaml +30 -20
  101. package/openapi/reference-implementations/judge-agent-api.openapi.yaml +22 -16
  102. package/openapi/reference-implementations/k8s-troubleshooter-api.openapi.yaml +32 -18
  103. package/openapi/reference-implementations/langchain-agent-api.openapi.yaml +32 -21
  104. package/openapi/reference-implementations/monitor-agent-api.openapi.yaml +34 -21
  105. package/openapi/reference-implementations/orchestrator-agent-api.openapi.yaml +49 -27
  106. package/openapi/reference-implementations/quickstart-support-agent-api.openapi.yaml +27 -19
  107. package/openapi/reference-implementations/self-evolving-ecosystem.openapi.yaml +427 -293
  108. package/openapi/reference-implementations/worker-agent-api.openapi.yaml +34 -23
  109. package/openapi/reference-implementations/workflow-orchestrator-api.openapi.yaml +35 -21
  110. package/openapi/release-automation.openapi.yaml +47 -13
  111. package/openapi/schemas/common/agent.yaml +30 -29
  112. package/openapi/schemas/common/errors.yaml +13 -3
  113. package/openapi/schemas/common/metadata.yaml +22 -7
  114. package/openapi/schemas/common/pagination.yaml +18 -6
  115. package/openapi/schemas/common/security.yaml +13 -5
  116. package/openapi/schemas/index.yaml +49 -42
  117. package/openapi/uadp-asyncapi.yaml +4 -2
  118. package/openapi/uadp-openapi.yaml +243 -165
  119. package/openapi/version-management.openapi.yaml +142 -135
  120. package/package.json +114 -103
  121. package/spec/extensions/role-manifest.md +188 -0
  122. package/spec/v0.4/extensions/mcp/README.md +1 -1
  123. package/spec/v0.5/agent.schema.json +2 -1
  124. package/spec/v0.5/extensions/mcp/README.md +1 -1
  125. package/spec/v0.5/role.schema.json +268 -0
@@ -0,0 +1,188 @@
1
+ # OSSA Role Manifest Extension
2
+
3
+ **Version:** 0.5.0
4
+ **Status:** Draft
5
+ **Last Updated:** 2026-03-13
6
+
7
+ ## Overview
8
+
9
+ This extension introduces `kind: Role` as a new OSSA manifest type. Roles define **behavioral overlays** for IDE and CLI agents (Claude Code, Cursor, Codex CLI, etc.) — configuring instructions, tool access, hooks, MCP server connections, and activation conditions.
10
+
11
+ ### Role vs Agent
12
+
13
+ | Aspect | `kind: Agent` | `kind: Role` |
14
+ |--------|--------------|--------------|
15
+ | **Purpose** | Autonomous agentic loop | Operator context overlay |
16
+ | **Execution** | Runs independently | Applied to an existing agent session |
17
+ | **Lifecycle** | Deployed, scaled, monitored | Activated, composed, switched |
18
+ | **Identity** | Has its own agent ID | Inherits the host agent's identity |
19
+ | **Example** | A code review bot | "Drupal developer" context for Claude Code |
20
+
21
+ Roles answer the question: *"What context, rules, and tools should an AI coding assistant have when working in this domain?"*
22
+
23
+ ## Manifest Structure
24
+
25
+ ```yaml
26
+ apiVersion: ossa/v0.5
27
+ kind: Role
28
+ metadata:
29
+ name: <role-name> # Required: DNS-style identifier
30
+ version: <semver> # Recommended: e.g. 1.0.0
31
+ description: <string> # Human-readable summary
32
+ labels: # Optional: key-value pairs for filtering
33
+ platform: claude-code
34
+ domain: drupal
35
+ annotations: # Optional: non-identifying metadata
36
+ org: example-corp
37
+ spec:
38
+ role: <string> # System prompt / persona definition
39
+ instructions: # Behavioral instructions
40
+ preamble: <markdown> # Prepended to every conversation
41
+ constraints: # Hard rules (MUST/MUST NOT)
42
+ - <string>
43
+ tools: # Tool access configuration
44
+ allowed: [<string>] # Allowed tool names
45
+ denied: [<string>] # Denied tool names (overrides allowed)
46
+ skills: [<string>] # OSSA skill references
47
+ hooks: # Lifecycle hooks
48
+ on_activate: <string> # Run when role is activated
49
+ on_deactivate: <string> # Run when role is deactivated
50
+ pre_commit: <string> # Run before git commits
51
+ post_save: <string> # Run after file saves
52
+ context: # Context injection
53
+ schemas: [<path>] # JSON/OpenAPI schemas to load
54
+ files: # Files to include in context
55
+ - path: <glob>
56
+ description: <string>
57
+ knowledge: [<path>] # Knowledge base files (markdown, text)
58
+ protocols: # Protocol connections
59
+ mcp: # Model Context Protocol
60
+ servers:
61
+ - name: <string>
62
+ transport: stdio | sse
63
+ command: <string> # For stdio transport
64
+ args: [<string>]
65
+ url: <string> # For SSE transport
66
+ extends: # Role composition
67
+ - role: <role-name> # Inherit from another role
68
+ override: true | false # Whether to override conflicts (default: false)
69
+ activation: # When this role should activate
70
+ file_patterns: [<glob>] # Activate when matching files are open
71
+ command: <string> # CLI command to activate (e.g. "/role drupal")
72
+ env: # Environment variable conditions
73
+ <key>: <value>
74
+ ```
75
+
76
+ ## Field Reference
77
+
78
+ ### `spec.role`
79
+
80
+ A string defining the agent's persona when this role is active. This is the system-level identity statement.
81
+
82
+ ```yaml
83
+ spec:
84
+ role: |
85
+ You are a Drupal module developer following Drupal coding standards.
86
+ You write PHP 8.2+ code with strict typing and dependency injection.
87
+ ```
88
+
89
+ ### `spec.instructions`
90
+
91
+ Structured behavioral instructions.
92
+
93
+ - **`preamble`**: Markdown content prepended to every conversation. Use for rules, conventions, and domain knowledge that should always be present.
94
+ - **`constraints`**: An array of hard rules. Each constraint is a MUST or MUST NOT statement that the agent should never violate.
95
+
96
+ ### `spec.tools`
97
+
98
+ Controls which tools the agent can use within this role.
99
+
100
+ - **`allowed`**: Whitelist of tool names. If specified, only these tools are available.
101
+ - **`denied`**: Blacklist of tool names. Takes precedence over `allowed`.
102
+ - **`skills`**: References to OSSA `kind: Skill` manifests that should be loaded.
103
+
104
+ ### `spec.hooks`
105
+
106
+ Lifecycle hooks executed at specific points. Values are command strings or script references.
107
+
108
+ - **`on_activate`**: Runs when the role is first activated in a session.
109
+ - **`on_deactivate`**: Runs when switching away from this role.
110
+ - **`pre_commit`**: Runs before git commit operations.
111
+ - **`post_save`**: Runs after file save operations.
112
+
113
+ ### `spec.context`
114
+
115
+ Injects additional context into the agent's working memory.
116
+
117
+ - **`schemas`**: Paths to JSON Schema or OpenAPI specification files. The agent can reference these for type-correct code generation.
118
+ - **`files`**: Specific files or globs to include in the agent's context window.
119
+ - **`knowledge`**: Paths to knowledge base documents (markdown, text) that provide domain reference material.
120
+
121
+ ### `spec.protocols.mcp`
122
+
123
+ MCP server connections available when this role is active.
124
+
125
+ Each server entry requires:
126
+ - **`name`**: Identifier for the MCP server.
127
+ - **`transport`**: Either `stdio` (local process) or `sse` (HTTP Server-Sent Events).
128
+ - **`command`** + **`args`**: For `stdio` transport, the command to spawn.
129
+ - **`url`**: For `sse` transport, the endpoint URL.
130
+
131
+ ### `spec.extends`
132
+
133
+ Enables role composition by inheriting from other roles.
134
+
135
+ - **`role`**: Name of the parent role to inherit from.
136
+ - **`override`**: If `true`, child fields replace parent fields. If `false` (default), child fields merge with parent fields (arrays are concatenated, objects are deep-merged).
137
+
138
+ ### `spec.activation`
139
+
140
+ Defines conditions under which this role should automatically activate.
141
+
142
+ - **`file_patterns`**: Glob patterns matched against open files. If any file matches, the role activates.
143
+ - **`command`**: A slash command (e.g., `/role drupal`) that activates the role.
144
+ - **`env`**: Environment variable conditions. All specified variables must match for activation.
145
+
146
+ ## Composition Rules
147
+
148
+ When a role extends another:
149
+
150
+ 1. **`spec.role`**: Child replaces parent (no merge).
151
+ 2. **`spec.instructions.preamble`**: Child is appended after parent.
152
+ 3. **`spec.instructions.constraints`**: Arrays are concatenated (all constraints apply).
153
+ 4. **`spec.tools.allowed`**: Intersection of parent and child (child cannot grant tools the parent denies).
154
+ 5. **`spec.tools.denied`**: Union of parent and child (denials accumulate).
155
+ 6. **`spec.tools.skills`**: Arrays are concatenated.
156
+ 7. **`spec.hooks`**: Child hooks replace parent hooks for the same lifecycle event.
157
+ 8. **`spec.context`**: All context entries are merged (files, schemas, knowledge concatenated).
158
+ 9. **`spec.protocols.mcp.servers`**: Arrays are concatenated (all servers available).
159
+ 10. **`spec.activation`**: Child activation conditions replace parent.
160
+
161
+ ## Relationship to Other OSSA Kinds
162
+
163
+ | Kind | Relationship to Role |
164
+ |------|---------------------|
165
+ | `Agent` | Roles are applied to agents. An agent can have multiple roles. |
166
+ | `Skill` | Roles reference skills via `spec.tools.skills`. Skills provide capabilities; roles provide context. |
167
+ | `Task` | Roles may influence how tasks are executed by setting constraints and tool access. |
168
+ | `Workflow` | Roles can be assigned per workflow step to change agent behavior. |
169
+
170
+ ## Platform Mapping
171
+
172
+ Roles map naturally to platform-specific configuration:
173
+
174
+ | Role Field | Claude Code | Cursor | Codex CLI |
175
+ |-----------|-------------|--------|-----------|
176
+ | `spec.role` | CLAUDE.md system prompt | .cursorrules | instructions |
177
+ | `spec.instructions.preamble` | CLAUDE.md content | .cursorrules content | --instructions |
178
+ | `spec.tools.allowed` | Tool permissions | Tool config | --tools |
179
+ | `spec.protocols.mcp` | .mcp.json servers | MCP config | MCP servers |
180
+ | `spec.activation.file_patterns` | Glob triggers | File associations | --pattern |
181
+
182
+ ## Examples
183
+
184
+ See `examples/roles/` for complete role manifests:
185
+
186
+ - `drupal-developer.role.yaml` — Drupal module development
187
+ - `security-auditor.role.yaml` — Security audit and compliance review
188
+ - `platform-operator.role.yaml` — Full-stack platform operations with composition
@@ -187,7 +187,7 @@ spec:
187
187
  - "-y"
188
188
  - "@modelcontextprotocol/server-postgres"
189
189
  env:
190
- DATABASE_URL: "postgresql://user:pass@localhost:5432/db"
190
+ DATABASE_URL: "postgresql://user:${POSTGRES_PASSWORD}@localhost:5432/db"
191
191
  capabilities:
192
192
  tools:
193
193
  listChanged: false
@@ -25,11 +25,12 @@
25
25
  "type": "string",
26
26
  "enum": [
27
27
  "Agent",
28
+ "Role",
28
29
  "Task",
29
30
  "Workflow",
30
31
  "Flow"
31
32
  ],
32
- "description": "Resource type: Agent (agentic loops), Task (deterministic steps), Workflow (composition), or Flow (streaming)"
33
+ "description": "Resource type: Agent (agentic loops), Role (IDE operator overlay), Task (deterministic steps), Workflow (composition), or Flow (streaming)"
33
34
  },
34
35
  "metadata": {
35
36
  "$ref": "#/definitions/Metadata"
@@ -187,7 +187,7 @@ spec:
187
187
  - "-y"
188
188
  - "@modelcontextprotocol/server-postgres"
189
189
  env:
190
- DATABASE_URL: "postgresql://user:pass@localhost:5432/db"
190
+ DATABASE_URL: "postgresql://user:${POSTGRES_PASSWORD}@localhost:5432/db"
191
191
  capabilities:
192
192
  tools:
193
193
  listChanged: false
@@ -0,0 +1,268 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://openstandardagents.org/schemas/v0.5/role.schema.json",
4
+ "title": "OSSA v0.5 Role Manifest Schema",
5
+ "description": "Open Standard for Software Agents (OSSA) v0.5 - Role manifest. Defines behavioral overlays for IDE/CLI agents (Claude Code, Cursor, etc.) with instructions, tool sets, hooks, MCP connections, and activation conditions.",
6
+ "type": "object",
7
+ "required": ["apiVersion", "kind", "metadata", "spec"],
8
+ "properties": {
9
+ "apiVersion": {
10
+ "type": "string",
11
+ "pattern": "^ossa/v[0-9]+(\\.[0-9]+)*(-[a-zA-Z0-9.]+)?$",
12
+ "description": "OSSA API version",
13
+ "examples": ["ossa/v0.5", "ossa/v1"]
14
+ },
15
+ "kind": {
16
+ "type": "string",
17
+ "const": "Role",
18
+ "description": "Resource type — must be Role"
19
+ },
20
+ "metadata": {
21
+ "$ref": "#/definitions/RoleMetadata"
22
+ },
23
+ "spec": {
24
+ "$ref": "#/definitions/RoleSpec"
25
+ },
26
+ "extensions": {
27
+ "type": "object",
28
+ "description": "Platform-specific extensions",
29
+ "additionalProperties": true
30
+ }
31
+ },
32
+ "definitions": {
33
+ "RoleMetadata": {
34
+ "type": "object",
35
+ "required": ["name"],
36
+ "properties": {
37
+ "name": {
38
+ "type": "string",
39
+ "pattern": "^[a-z][a-z0-9-]*$",
40
+ "description": "DNS-style role name (lowercase, hyphens)",
41
+ "examples": ["drupal-developer", "security-auditor", "platform-operator"]
42
+ },
43
+ "version": {
44
+ "type": "string",
45
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9.]+)?$",
46
+ "description": "Semantic version",
47
+ "examples": ["1.0.0", "2.1.0-beta"]
48
+ },
49
+ "description": {
50
+ "type": "string",
51
+ "description": "Human-readable description"
52
+ },
53
+ "labels": {
54
+ "type": "object",
55
+ "additionalProperties": { "type": "string" },
56
+ "description": "Key-value labels for filtering and categorization"
57
+ },
58
+ "annotations": {
59
+ "type": "object",
60
+ "additionalProperties": { "type": "string" },
61
+ "description": "Non-identifying metadata"
62
+ }
63
+ }
64
+ },
65
+ "RoleSpec": {
66
+ "type": "object",
67
+ "properties": {
68
+ "role": {
69
+ "type": "string",
70
+ "description": "System prompt / persona definition"
71
+ },
72
+ "instructions": {
73
+ "$ref": "#/definitions/RoleInstructions"
74
+ },
75
+ "tools": {
76
+ "$ref": "#/definitions/RoleTools"
77
+ },
78
+ "hooks": {
79
+ "$ref": "#/definitions/RoleHooks"
80
+ },
81
+ "context": {
82
+ "$ref": "#/definitions/RoleContext"
83
+ },
84
+ "protocols": {
85
+ "$ref": "#/definitions/RoleProtocols"
86
+ },
87
+ "extends": {
88
+ "type": "array",
89
+ "items": { "$ref": "#/definitions/RoleExtension" },
90
+ "description": "Role composition — inherit from other roles"
91
+ },
92
+ "activation": {
93
+ "$ref": "#/definitions/RoleActivation"
94
+ }
95
+ }
96
+ },
97
+ "RoleInstructions": {
98
+ "type": "object",
99
+ "properties": {
100
+ "preamble": {
101
+ "type": "string",
102
+ "description": "Markdown content prepended to every conversation"
103
+ },
104
+ "constraints": {
105
+ "type": "array",
106
+ "items": { "type": "string" },
107
+ "description": "Hard rules — MUST/MUST NOT statements"
108
+ }
109
+ }
110
+ },
111
+ "RoleTools": {
112
+ "type": "object",
113
+ "properties": {
114
+ "allowed": {
115
+ "type": "array",
116
+ "items": { "type": "string" },
117
+ "description": "Whitelist of allowed tool names"
118
+ },
119
+ "denied": {
120
+ "type": "array",
121
+ "items": { "type": "string" },
122
+ "description": "Blacklist of denied tool names (overrides allowed)"
123
+ },
124
+ "skills": {
125
+ "type": "array",
126
+ "items": { "type": "string" },
127
+ "description": "References to OSSA Skill manifests"
128
+ }
129
+ }
130
+ },
131
+ "RoleHooks": {
132
+ "type": "object",
133
+ "properties": {
134
+ "on_activate": {
135
+ "type": "string",
136
+ "description": "Run when role is activated"
137
+ },
138
+ "on_deactivate": {
139
+ "type": "string",
140
+ "description": "Run when switching away from this role"
141
+ },
142
+ "pre_commit": {
143
+ "type": "string",
144
+ "description": "Run before git commits"
145
+ },
146
+ "post_save": {
147
+ "type": "string",
148
+ "description": "Run after file saves"
149
+ }
150
+ }
151
+ },
152
+ "RoleContext": {
153
+ "type": "object",
154
+ "properties": {
155
+ "schemas": {
156
+ "type": "array",
157
+ "items": { "type": "string" },
158
+ "description": "Paths to JSON Schema or OpenAPI spec files"
159
+ },
160
+ "files": {
161
+ "type": "array",
162
+ "items": { "$ref": "#/definitions/RoleContextFile" },
163
+ "description": "Files to include in agent context"
164
+ },
165
+ "knowledge": {
166
+ "type": "array",
167
+ "items": { "type": "string" },
168
+ "description": "Paths to knowledge base documents"
169
+ }
170
+ }
171
+ },
172
+ "RoleContextFile": {
173
+ "type": "object",
174
+ "required": ["path"],
175
+ "properties": {
176
+ "path": {
177
+ "type": "string",
178
+ "description": "File path or glob pattern"
179
+ },
180
+ "description": {
181
+ "type": "string",
182
+ "description": "Description of what this file provides"
183
+ }
184
+ }
185
+ },
186
+ "RoleProtocols": {
187
+ "type": "object",
188
+ "properties": {
189
+ "mcp": {
190
+ "$ref": "#/definitions/RoleMCPConfig"
191
+ }
192
+ }
193
+ },
194
+ "RoleMCPConfig": {
195
+ "type": "object",
196
+ "properties": {
197
+ "servers": {
198
+ "type": "array",
199
+ "items": { "$ref": "#/definitions/RoleMCPServer" },
200
+ "description": "MCP servers available when this role is active"
201
+ }
202
+ }
203
+ },
204
+ "RoleMCPServer": {
205
+ "type": "object",
206
+ "required": ["name", "transport"],
207
+ "properties": {
208
+ "name": {
209
+ "type": "string",
210
+ "description": "Server identifier"
211
+ },
212
+ "transport": {
213
+ "type": "string",
214
+ "enum": ["stdio", "sse"],
215
+ "description": "Transport type"
216
+ },
217
+ "command": {
218
+ "type": "string",
219
+ "description": "Command to spawn (stdio transport)"
220
+ },
221
+ "args": {
222
+ "type": "array",
223
+ "items": { "type": "string" },
224
+ "description": "Command arguments (stdio transport)"
225
+ },
226
+ "url": {
227
+ "type": "string",
228
+ "format": "uri",
229
+ "description": "Endpoint URL (SSE transport)"
230
+ }
231
+ }
232
+ },
233
+ "RoleExtension": {
234
+ "type": "object",
235
+ "required": ["role"],
236
+ "properties": {
237
+ "role": {
238
+ "type": "string",
239
+ "description": "Name of the parent role to inherit from"
240
+ },
241
+ "override": {
242
+ "type": "boolean",
243
+ "default": false,
244
+ "description": "If true, child fields replace parent fields; if false, they merge"
245
+ }
246
+ }
247
+ },
248
+ "RoleActivation": {
249
+ "type": "object",
250
+ "properties": {
251
+ "file_patterns": {
252
+ "type": "array",
253
+ "items": { "type": "string" },
254
+ "description": "Glob patterns — activate when matching files are open"
255
+ },
256
+ "command": {
257
+ "type": "string",
258
+ "description": "CLI command to activate (e.g., /role drupal)"
259
+ },
260
+ "env": {
261
+ "type": "object",
262
+ "additionalProperties": { "type": "string" },
263
+ "description": "Environment variable conditions (all must match)"
264
+ }
265
+ }
266
+ }
267
+ }
268
+ }
@@ -22,6 +22,8 @@ export * from './security.js';
22
22
  export type { AuditConfig, DataClassification, EgressPolicy, NetworkAccessConfig, NetworkProtocol, ResourceLimits, SandboxingConfig, SandboxType, SecurityCapability, SecurityPosture, ThreatCategory, ThreatModelEntry, ThreatSeverity } from './security.js';
23
23
  export { isOssaSkill } from './skill.js';
24
24
  export type { OssaSkill } from './skill.js';
25
+ export { createRoleManifest, isOssaRole } from './role.js';
26
+ export type { OssaRole, RoleActivation, RoleContext, RoleExtension, RoleHooks, RoleInstructions, RoleMCPServer, RoleProtocols, RoleSpec, RoleTools } from './role.js';
25
27
  export { isOssaMCPServer } from './mcp-server-manifest.js';
26
28
  export type { OssaMCPServer } from './mcp-server-manifest.js';
27
29
  export * from './protocols.js';
@@ -21,6 +21,8 @@ export * from './architect.js';
21
21
  export * from './security.js';
22
22
  // Export Skill types (AgentSkills / OSSA skills)
23
23
  export { isOssaSkill } from './skill.js';
24
+ // Export Role types (v0.5 — IDE operator contexts)
25
+ export { createRoleManifest, isOssaRole } from './role.js';
24
26
  // Export MCP server manifest types
25
27
  export { isOssaMCPServer } from './mcp-server-manifest.js';
26
28
  // Export Protocol Declaration types (v0.5)
@@ -0,0 +1,126 @@
1
+ /**
2
+ * OSSA Role Manifest Types
3
+ * Type definitions for role.ossa.yaml manifests (kind: Role)
4
+ *
5
+ * Roles define behavioral overlays for IDE/CLI agents (Claude Code, Cursor, etc.)
6
+ * Unlike Agents (autonomous loops), Roles configure operator context — instructions,
7
+ * tool access, hooks, MCP connections, and activation conditions.
8
+ */
9
+ export interface OssaRole {
10
+ apiVersion: string;
11
+ kind: 'Role';
12
+ metadata: RoleMetadata;
13
+ spec: RoleSpec;
14
+ extensions?: Record<string, unknown>;
15
+ }
16
+ export interface RoleMetadata {
17
+ /** DNS-style role name (lowercase, hyphens) */
18
+ name: string;
19
+ /** Semantic version */
20
+ version?: string;
21
+ /** Human-readable description */
22
+ description?: string;
23
+ /** Key-value labels for filtering and categorization */
24
+ labels?: Record<string, string>;
25
+ /** Non-identifying metadata */
26
+ annotations?: Record<string, string>;
27
+ }
28
+ export interface RoleSpec {
29
+ /** System prompt / persona definition */
30
+ role?: string;
31
+ /** Behavioral instructions */
32
+ instructions?: RoleInstructions;
33
+ /** Tool access configuration */
34
+ tools?: RoleTools;
35
+ /** Lifecycle hooks */
36
+ hooks?: RoleHooks;
37
+ /** Context injection */
38
+ context?: RoleContext;
39
+ /** Protocol connections */
40
+ protocols?: RoleProtocols;
41
+ /** Role composition — inherit from other roles */
42
+ extends?: RoleExtension[];
43
+ /** Activation conditions */
44
+ activation?: RoleActivation;
45
+ }
46
+ export interface RoleInstructions {
47
+ /** Markdown content prepended to every conversation */
48
+ preamble?: string;
49
+ /** Hard rules — MUST/MUST NOT statements */
50
+ constraints?: string[];
51
+ }
52
+ export interface RoleTools {
53
+ /** Whitelist of allowed tool names */
54
+ allowed?: string[];
55
+ /** Blacklist of denied tool names (overrides allowed) */
56
+ denied?: string[];
57
+ /** References to OSSA Skill manifests */
58
+ skills?: string[];
59
+ }
60
+ export interface RoleHooks {
61
+ /** Run when role is activated */
62
+ on_activate?: string;
63
+ /** Run when switching away from this role */
64
+ on_deactivate?: string;
65
+ /** Run before git commits */
66
+ pre_commit?: string;
67
+ /** Run after file saves */
68
+ post_save?: string;
69
+ }
70
+ export interface RoleContext {
71
+ /** Paths to JSON Schema or OpenAPI spec files */
72
+ schemas?: string[];
73
+ /** Files to include in agent context */
74
+ files?: RoleContextFile[];
75
+ /** Paths to knowledge base documents */
76
+ knowledge?: string[];
77
+ }
78
+ export interface RoleContextFile {
79
+ /** File path or glob pattern */
80
+ path: string;
81
+ /** Description of what this file provides */
82
+ description?: string;
83
+ }
84
+ export interface RoleProtocols {
85
+ /** MCP server connections */
86
+ mcp?: RoleMCPConfig;
87
+ }
88
+ export interface RoleMCPConfig {
89
+ /** MCP servers available when this role is active */
90
+ servers?: RoleMCPServer[];
91
+ }
92
+ export interface RoleMCPServer {
93
+ /** Server identifier */
94
+ name: string;
95
+ /** Transport type */
96
+ transport: 'stdio' | 'sse';
97
+ /** Command to spawn (stdio transport) */
98
+ command?: string;
99
+ /** Command arguments (stdio transport) */
100
+ args?: string[];
101
+ /** Endpoint URL (SSE transport) */
102
+ url?: string;
103
+ }
104
+ export interface RoleExtension {
105
+ /** Name of the parent role to inherit from */
106
+ role: string;
107
+ /** If true, child fields replace parent fields; if false, they merge */
108
+ override?: boolean;
109
+ }
110
+ export interface RoleActivation {
111
+ /** Glob patterns — activate when matching files are open */
112
+ file_patterns?: string[];
113
+ /** CLI command to activate (e.g., "/role drupal") */
114
+ command?: string;
115
+ /** Environment variable conditions (all must match) */
116
+ env?: Record<string, string>;
117
+ }
118
+ /**
119
+ * Type guard for OssaRole
120
+ */
121
+ export declare function isOssaRole(obj: unknown): obj is OssaRole;
122
+ /**
123
+ * Create a minimal OssaRole manifest
124
+ */
125
+ export declare function createRoleManifest(name: string, description: string, role?: string): OssaRole;
126
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * OSSA Role Manifest Types
3
+ * Type definitions for role.ossa.yaml manifests (kind: Role)
4
+ *
5
+ * Roles define behavioral overlays for IDE/CLI agents (Claude Code, Cursor, etc.)
6
+ * Unlike Agents (autonomous loops), Roles configure operator context — instructions,
7
+ * tool access, hooks, MCP connections, and activation conditions.
8
+ */
9
+ /**
10
+ * Type guard for OssaRole
11
+ */
12
+ export function isOssaRole(obj) {
13
+ if (!obj || typeof obj !== 'object')
14
+ return false;
15
+ const o = obj;
16
+ return (o.kind === 'Role' &&
17
+ typeof o.apiVersion === 'string' &&
18
+ o.metadata != null &&
19
+ o.spec != null);
20
+ }
21
+ /**
22
+ * Create a minimal OssaRole manifest
23
+ */
24
+ export function createRoleManifest(name, description, role) {
25
+ return {
26
+ apiVersion: 'ossa/v0.5',
27
+ kind: 'Role',
28
+ metadata: {
29
+ name,
30
+ version: '1.0.0',
31
+ description,
32
+ },
33
+ spec: {
34
+ ...(role ? { role } : {}),
35
+ },
36
+ };
37
+ }
38
+ //# sourceMappingURL=role.js.map
@@ -22,7 +22,7 @@ export class OSSAValidator {
22
22
  });
23
23
  addFormats(this.ajv);
24
24
  // Load schema
25
- const defaultSchemaPath = join(__dirname, '../spec/v0.4/agent.schema.json');
25
+ const defaultSchemaPath = join(__dirname, '../spec/v0.5/agent.schema.json');
26
26
  const resolvedPath = schemaPath || defaultSchemaPath;
27
27
  try {
28
28
  const schemaContent = readFileSync(resolvedPath, 'utf-8');