@penguinharness/sandbox-seatbelt · plugins/sandbox-seatbelt/src/index.ts:238

SandboxSeatbelt

component

The plugin's one module: a provider on the sandbox slot, the code half of the contribution the decorator declares (its manifest is generated into ifaces.json from here). Created per App, so a hot swap gets a fresh provider.

API

@Component({
  contributes: {
    // How the Plugins page shows this backend (read from ifaces.json, never by booting it).
    "PluginLibraryModule.cards": [
      {
        id: "sandbox-seatbelt.card",
        title: "macOS Sandbox",
        titleZh: "macOS 沙箱",
        descriptionZh:
          "PenguinHarness 的 macOS Seatbelt 沙箱后端:限制文件写入,并提供网络隔离与路径屏蔽。",
        shortDescription: "macOS: confine file writes, cut the network, mask paths.",
        shortDescriptionZh: "macOS:限制文件写入、断开网络、屏蔽路径。",
        category: "sandbox",
        icon: "icon.svg",
        preinstall: false,
      },
    ],
    "SandboxModule.providers": [
      {
        id: "sandbox-seatbelt.provider",
        name: "penguin-seatbelt",
        dimensions: ["fs-write", "network", "network-local", "mask-paths", "closed-temp"],
        defaultFor: ["darwin"],
      },
    ],
    "PluginConfigProvider.groups": [
      {
        id: "sandbox-seatbelt",
        title: "Seatbelt",
        properties: {
          runner: {
            type: "string",
            title: "sandbox-exec program",
            titleZh: "sandbox-exec 程序",
            description:
              "A path or a command on PATH; empty uses the macOS program at /usr/bin/sandbox-exec.",
            descriptionZh:
              "路径或 PATH 上的命令名;留空则使用 macOS 自带的 /usr/bin/sandbox-exec。",
            placeholder: "/usr/bin/sandbox-exec",
          },
        },
      },
    ],
  },
})
export class SandboxSeatbelt {
  @Use() private readonly config!: SeatbeltConfigReader;
  @Bind("sandbox-seatbelt.provider") provider!: SandboxProviderSource;
  setup();
}

Dependencies & Wiring

Extracted from class decorators
@Userequires (1)
@Bindbinds (1)
provider → sandbox-seatbelt.provider: SandboxProviderSource

Contributes

{
  "PluginLibraryModule.cards": [
    {
      "id": "sandbox-seatbelt.card",
      "title": "macOS Sandbox",
      "titleZh": "macOS 沙箱",
      "descriptionZh": "PenguinHarness 的 macOS Seatbelt 沙箱后端:限制文件写入,并提供网络隔离与路径屏蔽。",
      "shortDescription": "macOS: confine file writes, cut the network, mask paths.",
      "shortDescriptionZh": "macOS:限制文件写入、断开网络、屏蔽路径。",
      "category": "sandbox",
      "icon": "icon.svg",
      "preinstall": false
    }
  ],
  "SandboxModule.providers": [
    {
      "id": "sandbox-seatbelt.provider",
      "name": "penguin-seatbelt",
      "dimensions": [
        "fs-write",
        "network",
        "network-local",
        "mask-paths",
        "closed-temp"
      ],
      "defaultFor": [
        "darwin"
      ]
    }
  ],
  "PluginConfigProvider.groups": [
    {
      "id": "sandbox-seatbelt",
      "title": "Seatbelt",
      "properties": {
        "runner": {
          "type": "string",
          "title": "sandbox-exec program",
          "titleZh": "sandbox-exec 程序",
          "description": "A path or a command on PATH; empty uses the macOS program at /usr/bin/sandbox-exec.",
          "descriptionZh": "路径或 PATH 上的命令名;留空则使用 macOS 自带的 /usr/bin/sandbox-exec。",
          "placeholder": "/usr/bin/sandbox-exec"
        }
      }
    }
  ]
}

Target slots: PluginLibraryModule.cards · SandboxModule.providers · PluginConfigProvider.groups

Methods (1)

setup

setup()