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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ build
dist
*.tsbuildinfo

# Generated by Next: the route-types import path differs between `next dev`
# and `next typegen`/`next build`, so a tracked copy churns on every checkout.
next-env.d.ts


# Debug
npm-debug.log*
Expand Down
77 changes: 77 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Contributor Covenant Code of Conduct

## Our pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our standards

Examples of behavior that contributes to a positive environment for our community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **open@pascal.app**. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community impact**: A violation through a single incident or series of actions.

**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary ban

**Community impact**: A serious violation of community standards, including sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent ban

**Community impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/inclusion).

For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A 3D building editor built with React Three Fiber and WebGPU.
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![npm @pascal-app/core](https://img.shields.io/npm/v/@pascal-app/core?label=%40pascal-app%2Fcore)](https://www.npmjs.com/package/@pascal-app/core)
[![npm @pascal-app/viewer](https://img.shields.io/npm/v/@pascal-app/viewer?label=%40pascal-app%2Fviewer)](https://www.npmjs.com/package/@pascal-app/viewer)
[![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/SaBRA9t2)
[![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?logo=discord&logoColor=white)](https://discord.gg/XRKsDcpqgS)
[![X (Twitter)](https://img.shields.io/badge/follow-%40pascal__app-black?logo=x&logoColor=white)](https://x.com/pascal_app)

https://github.com/user-attachments/assets/8b50e7cf-cebe-4579-9cf3-8786b35f7b6b
Expand Down Expand Up @@ -439,6 +439,17 @@ npm publish --workspace=@pascal-app/viewer --access public

---

## Contributing

Bug fixes, features, docs and ideas are all welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md) for setup, code style and the PR flow.

- New node kinds and sidebar panels ship as [plugins](https://editor.pascal.app/docs/developers/plugins) rather than edits to the built-ins — [`pascalorg/plugin-trees`](https://github.com/pascalorg/plugin-trees) is a worked example
- Questions and ideas go to [Discussions](https://github.com/pascalorg/editor/discussions); reproducible bugs go to [Issues](https://github.com/pascalorg/editor/issues)
- Participation is covered by our [Code of Conduct](CODE_OF_CONDUCT.md)
- Security problems go to [SECURITY.md](SECURITY.md), not a public issue

---

## Contributors

<a href="https://github.com/Aymericr"><img src="https://avatars.githubusercontent.com/u/4444492?v=4" width="60" height="60" alt="Aymeric Rabot" style="border-radius:50%"></a>
Expand Down
34 changes: 34 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Security policy

## Reporting a vulnerability

Please do not open a public issue, pull request, or discussion for a security problem.

Report it privately through either channel:

- [GitHub private vulnerability reporting](https://github.com/pascalorg/editor/security/advisories/new) — preferred
- Email **security@pascal.app**

Include what you have: affected package or route, version or commit, reproduction steps, and the impact you believe it has. A proof of concept helps a lot; a rough description is still worth sending.

We aim to acknowledge a report within three working days and to keep you updated while we work on a fix. We will credit you in the advisory unless you would rather stay anonymous.

## Supported versions

Fixes land on `main` and ship in the next release of the affected package. The `@pascal-app/*` packages are pre-1.0 and only the latest published version of each receives security fixes.

## Scope

In scope:

- The packages published from this repo — `@pascal-app/core`, `@pascal-app/viewer`, `@pascal-app/editor`, `@pascal-app/nodes`, `@pascal-app/mcp`, `@pascal-app/ifc-converter`
- The standalone editor app in `apps/editor`
- The scene save API and the MCP server surface, including anything that lets untrusted scene data reach a parser, a renderer, or a stored graph

Out of scope:

- Findings that require a user to run untrusted code in their own browser console
- Denial of service through a deliberately enormous local scene file
- Automated scanner output with no demonstrated impact

The hosted service at editor.pascal.app is operated separately. Vulnerabilities there are welcome at the same address.
6 changes: 0 additions & 6 deletions apps/ifc-converter/next-env.d.ts

This file was deleted.

92 changes: 92 additions & 0 deletions packages/mcp/src/tools/output-schema-contract.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { describe, expect, test } from 'bun:test'
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js'
import { DoorNode, WallNode, ZoneNode } from '@pascal-app/core/schema'
import { SceneBridge } from '../bridge/scene-bridge'
import { createPascalMcpServer } from '../server'

/**
* Every real MCP host (Claude Desktop, Claude Code, Codex, Cursor) calls
* `tools/list` before `tools/call`. Once the SDK client has cached a tool's
* output schema it validates `structuredContent` against it with
* `additionalProperties: false`, so a payload field that the schema does not
* declare fails the call with -32602 in production while passing every test
* that never listed the tools first.
*
* These read-only tools are exercised through a client that lists first, which
* is the only configuration where that mismatch is observable.
*/
async function connectListedClient() {
const bridge = new SceneBridge()
bridge.setScene({}, [])
bridge.loadDefault()

const level = Object.values(bridge.getNodes()).find((n) => n.type === 'level')
if (!level) throw new Error('default scene has no level')
const wall = WallNode.parse({ start: [0, 0], end: [4, 0] })
bridge.createNode(wall, level.id)
bridge.createNode(DoorNode.parse({ wallId: wall.id, position: [2, 1.05, 0] }), wall.id)
bridge.createNode(
ZoneNode.parse({
name: 'Room',
polygon: [
[0, 0],
[4, 0],
[4, 3],
[0, 3],
],
}),
level.id,
)

const server = createPascalMcpServer({ bridge })
const [srvT, cliT] = InMemoryTransport.createLinkedPair()
const client = new Client({ name: 'output-schema-contract', version: '0.0.0' })
await Promise.all([server.connect(srvT), client.connect(cliT)])
await client.listTools()
return { bridge, client, levelId: level.id }
}

describe('registered tool output schemas', () => {
test('read-only tools satisfy their declared output schema for a listed client', async () => {
const { client, levelId } = await connectListedClient()

const calls: Array<{ name: string; arguments: Record<string, unknown> }> = [
{ name: 'get_scene', arguments: {} },
{ name: 'list_levels', arguments: {} },
{ name: 'get_level_summary', arguments: { levelId } },
{ name: 'get_walls', arguments: { levelId } },
{ name: 'get_zones', arguments: { levelId } },
{ name: 'verify_scene', arguments: {} },
{ name: 'validate_scene', arguments: {} },
{ name: 'check_collisions', arguments: {} },
{ name: 'find_nodes', arguments: { type: 'wall' } },
{ name: 'export_json', arguments: {} },
{ name: 'list_templates', arguments: {} },
]

const failures: string[] = []
for (const call of calls) {
try {
const result = await client.callTool(call)
if (result.isError) failures.push(`${call.name}: isError`)
} catch (err) {
failures.push(`${call.name}: ${err instanceof Error ? err.message : String(err)}`)
}
}

expect(failures).toEqual([])
})

test('create_from_template declares the no-store saveSkipped field', async () => {
const { client } = await connectListedClient()

const result = await client.callTool({
name: 'create_from_template',
arguments: { id: 'garden-house', save: true },
})

expect(result.isError).toBeFalsy()
expect((result.structuredContent as { saveSkipped?: boolean }).saveSkipped).toBe(true)
})
})
1 change: 1 addition & 0 deletions packages/mcp/src/tools/scene-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const listLevelsOutput = {
export const getLevelSummaryOutput = {
levelId: z.string(),
levelName: z.string().optional(),
floorIndex: z.number(),
role: z.string(),
metadataRole: z.string().nullable(),
isOccupiedStory: z.boolean(),
Expand Down
2 changes: 2 additions & 0 deletions packages/mcp/src/tools/templates/create-from-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ export const createFromTemplateOutput = {
templateId: z.string(),
rootNodeIds: z.array(z.string()),
nodeCount: z.number(),
/** Present when `save: true` was requested but no store was attached. */
saveSkipped: z.boolean().optional(),
/** Present when `save: true` (and a store was available). */
scene: z
.object({
Expand Down
Loading