# Open applications from the new tab page

An application is a Program with its own interface: standard HTML, CSS and JavaScript, optionally backed by Python operations. It appears beside Files, New chat, Browser and Terminal; clicking opens it in a tab, opening again selects the same instance, and closing the tab does not cancel its operations.

## Where they appear

| Place | Shows |
| --- | --- |
| **Applications** in the sidebar | Every application with icon, title, version, scope and description. Filters **All**, **Built in**, **Installed**. Row: **Open** if it has a window, enabled switch, **⋯** menu (**Show in Abilities**, **Hide from new tab** or **Show in new tab**, **Update from source**, **Uninstall**). **Install…** opens the install form. |
| **Abilities → Programs** | Plain folder view, one folder per application directory, sorted by name (`browser`, `calculator`, `auto_research`), holding real subfolders and source files. Applications under **Applications** with installed programs that have no UI; built-in tools under **Tools**. |
| Selecting an application there | Same icon, title and description, directory name, kind, version; **Open**, **Use in chat** with a single Agent entry; enabled switch; Agent entries with descriptions; location, window and permissions. Call logic folded at the bottom. A tool lists parameters; a source file shows its call logic. |

**Details of these views**

- **Uninstall** asks first and keeps the application's data. **Update from source** shows the source directory and opens the install form filled in; review the source before submitting.
- The install form requires explicit trust for Python backends and for `files.project.write`.
- An application inside an installed package is that package's subfolder, such as `auto_research/app`. Its call logic is the union of the Agent entries it registers.
- An application the Agent cannot call says so in one line: a UI-only application only opens as a window; a package that only exports Python functions for other Programs is a Python library.
- The new tab page refreshes its list when focused and every ten seconds.

## Install and open

| Command | Effect |
| --- | --- |
| `openprogram programs install /absolute/path/to/application` | Records the directory, which loads from where it is. Keep it there. Needs the worker running. |
| `… --trust` | Authorizes a Python backend and `files.project.write`. Review source and dependencies first. |
| `openprogram programs install owner/repo --trust` | A git URL or GitHub `owner/repo` is cloned into `~/.openprogram/programs/<name>/` and recorded |
| `openprogram programs list` | Id, state (`enabled`, `disabled`, `error`), directory, Agent entries and tier (`deferred` for applications). No worker needed. `--json` gives a `tiers` map per row. |
| `openprogram programs check DIRECTORY` | Validates manifest, package tree and declared backend operations; records nothing |
| `openprogram programs disable ID` | Removes interface, resource, services and Agent entries; cancels active operations. Saved in `catalog.json`, holds across restarts. |
| `openprogram programs enable ID` | Loads it again |
| `openprogram programs uninstall local.notes` | Removes the entry and cancels operations; keeps data and the schema/scope identity. A compatible reinstall restores data; an incompatible one is rejected before activation. |

Python backends run as trusted local code with your operating-system account. `files.project.write` lets it create and replace files in the bound project. A directory placed directly in `~/.openprogram/programs/` needs no `install`: the worker records it on its next scan, and one needing trust is listed as `needs trust` until installed with `--trust`.

| Stored in | What |
| --- | --- |
| `~/.openprogram/programs/<name>/` or anywhere | The application directory |
| `~/.openprogram/programs/catalog.json` | Source directory, enabled, hidden and display-title; nothing is copied |
| `~/.openprogram/programs/.runtime/` | Business data, run records, Python environments |

| Built-in | What it does | Disabling removes |
| --- | --- | --- |
| `browser` | The built-in browser that `computer_use` operates | `type="browser"`, with and without `app` naming your own browser; windows and the screen keep working |
| `workflow_recording` | [Workflow recording](https://fzkuji.github.io/OpenProgram/docs/capabilities/workflows/recording.html); its window starts a recording without the composer | The composer's **Record a workflow** and the routes |
| `office_editor` (**ONLYOFFICE**) | Word, Excel and PowerPoint in the file window; its window starts a blank file in the current project and lists its Office documents | Those files offer only the original-file download |
| `meeting` | [Meetings](https://fzkuji.github.io/OpenProgram/docs/capabilities/meetings.html): records a call, transcribes it, summarizes in a new chat | Meetings |

`browser`, `office_editor`, `workflow_recording` and `meeting` take `enable` and `disable` too, the same as their enabled switch. Tools (`bash`, `read`, `goal` …) are always given to the Agent and cannot be disabled. Packages adding tools or a screen from Claude Code, Codex, OpenCode or Hermes install as an application: add an `application.json`. See [Plugins](https://fzkuji.github.io/OpenProgram/docs/capabilities/plugins.html).

| Scope | Instances |
| --- | --- |
| Global | One shared instance for the owner |
| Project | One per project, separate business data. Uses the selected project when opened; changing the conversation's project does not rebind. No current project: a single saved binding is reused; first use or several bindings opens a chooser, which also accepts a new folder. |

Examples: [calculator](https://github.com/Fzkuji/OpenProgram/tree/main/examples/applications/calculator), [PDF editor](https://github.com/Fzkuji/OpenProgram/tree/main/examples/applications/pdf_editor) (reads, annotates and reorganizes the project's PDFs; uses your model only when you ask for a summary), [Auto Research](https://github.com/Fzkuji/OpenProgram/tree/main/examples/applications/auto_research) (runs one task of a research project at a time: field surveys, ideas, paper checks, citation checks, reviews and venue checklists)

## Application package

```
{
  "id": "local.notes",
  "title": "Notes",
  "description": "Keeps notes per project and summarises them on request.",
  "icon": "notebook-pen",
  "version": "1.0.0",
  "scope": "global",
  "dataSchema": 1,
  "ui": {"root": "ui", "entry": "index.html"},
  "capabilities": ["storage.app", "model.invoke"],
  "backend": {"kind": "python", "entry": "backend:operations"},
  "operations": {
    "summarize": {
      "agent": true,
      "input": {"type": "object"},
      "output": {"type": "string"}
    }
  }
}
```

| Field | Rule |
| --- | --- |
| `application.json` | In the package root |
| `title`, `description` | Shown on the New tab page, Applications page and Abilities. Description: one plain sentence, one line, at most 300 characters. Without `application.json` a Program uses the first `# Heading` of its `README.md` and the first sentence below it, or its directory name. |
| `icon` | Glyph on those pages and the tab. Any other name, or none: a generic tile coloured from the id. |
| `ui.root`, `ui.entry` | Root is relative to the package, entry to the root. Keep Python and private configuration outside `ui.root`. |
| `backend` | Exports a dictionary of callables taking `(input, context)` and returning JSON, sync or async |
| `backend.dependencies` | Exact pins, such as `["package-name==1.2.3"]`. One Python environment per set, created on first use; it also uses the installed host framework. |
| `operations` | Input and output are JSON Schema. Only `agent: true` is callable through the Program client. |

**Icon names**

`calculator`, `book-open`, `file-search`, `file-text`, `file-pdf`, `telescope`, `notebook-pen`, `table`, `chart-column`, `database`, `image`, `music`, `video`, `map`, `calendar`, `globe`, `code`, `terminal`, `mail`, `message-square`, `list-checks`, `languages`, `pen-tool`, `palette`, `sigma`, `flask-conical`, `briefcase`, `bot`, `sparkles`

| Capability | Grants the backend |
| --- | --- |
| `storage.app` | `context.load()` and `context.save()`: the instance's saved state |
| `model.invoke` | An ambient Runtime for `llm()` and `agent()` |
| `files.project.read` | `context.read_file(relative_path)` inside the bound project |
| `files.project.write` | `context.write_file(relative_path, content)` inside the bound project; needs a Python backend and `--trust` |
| `chat` | The page, not the backend: `chat.*` conversations of its own, shown with your composer in place of the right sidebar |
| `storage.files` | `context.files`: a directory of the instance's own, for recordings and other large files |
| `speech` | `context.transcribe(path)`, `context.diarize(chunks)` and `context.speech_readiness()` with the engine of **Settings → Voice**, on files in `context.files`; needs `storage.files` |
| `conversation` | `context.open_conversation(title)` and `context.converse(session_id, text)`: a turn of your default Agent without tools, in a conversation the application opened; the page can show it with `conversations.show(id)` |
| `audio.record` | The page: `audio.start`, `audio.stop`, `audio.status`. The App records the microphone and the computer's sound until stopped, even with the window closed, and hands each 30-second chunk to the operation named in `recording.ingest`, then runs `recording.finish`; needs `storage.files` |

Capabilities restrict the host bridge, not the operating-system permissions of trusted Python. Backends are checked in a separate process before registration; listing applications does not import their code.

**Sandbox**

- Web UI runs in a sandboxed iframe with an opaque origin. Its interface need not use OpenProgram components.
- Bundle frontend dependencies locally and use relative asset URLs, including JavaScript module imports.
- Blocked: remote scripts, direct owner API access, nested frames and form navigation.
- A resource URL authorizes reads of only that application's UI directory at the digest it was opened with; it is not an owner credential.

## Browser and Python APIs

| `window.openprogramApp` | Does |
| --- | --- |
| `load()` | Returns `{value, version}` |
| `save(value, version)` | Saves only if that version is current; reload after a concurrent-write error |
| `run(operation, input, requestKey)` | Returns a durable run record. Reuse the key when retrying; different input with it is rejected. |
| `runs()` | Recent runs |
| `status(id, after)` | Status, result, error, pending question, events after a cursor |
| `cancel(id)` | Cancels execution |
| `answer(id, requestId, answer)` | Answers its current question |
| `chat.open(key, folder)` | Needs `chat`. Opens the conversation kept under `key`, one per key, working in `folder`; returns `{session_id, project_id, folder}` |
| `chat.place(rect)` | Puts the composer at `{left, right, bottom}` in page pixels; `null` hides it |
| `chat.note(text)` | Sent to the model beside each next message, up to 16,000 characters: what the page is showing |
| `chat.send(text)` | Sends `text` as the owner's message, after the reply that is running: for a button such as “draft this” |
| `chat.reveal()`, `chat.close()` | Opens the conversation in a chat tab; closes it here |
| `on(event, listener)` | `"chat"`: the open conversation's messages, tool steps and whether a reply is running. `"composer"`: its height. Returns an unsubscribe function. |

Runs from another instance are inaccessible through this bridge.

| Python `context` | Does |
| --- | --- |
| `load()`, `save(value, expected_version=...)` | Instance state |
| `progress(value)` | Reports progress |
| `ask(question)` | Application questions. Runtime workflow interactions needing predeclared durable waits keep their requirements. |
| `read_file(relative_path)` | Needs the capability and a bound project |
| `write_file(relative_path, content)` | Text or bytes. Refuses a path resolving outside the project, symlinks included, and any path into `.git`. Writes a temporary file and renames, so readers never see a partial file. Returns `path` and `bytes`. |

Model-enabled operations can call `llm()` and `agent()`; credentials stay in the backend.

Programs use the same operations:

```
from openprogram.programs._authoring.application_client import run, status

job = run("local.notes", "summarize", {"text": "..."}, request_key="summary-1")
print(status(job["id"]))
```

| CLI | Effect |
| --- | --- |
| `openprogram programs run APP OPERATION --input JSON` | Starts an operation; `--project ID` for project scope |
| `openprogram programs status RUN_ID` | Status and events |
| `openprogram programs cancel RUN_ID` | Cancels |

## Persistence and lifecycle

| Event | Result |
| --- | --- |
| Load | Content digest of the directory, ignoring `.git`, `node_modules`, `__pycache__`, `.venv` |
| Source edited | Reloads with a new digest; a reopened page and new operations use the edit. A page or resource `open` from before is refused; reopen. Running operations continue. |
| Edit changes `dataSchema` or `scope`, or adds a Python backend or `files.project.write` without trust | Stops loading until installed again |
| Schema or scope change at install | Rejected before activation. No automatic data migrations. |
| Worker stopped | Unfinished Python is reported as interrupted after restart, never resumed. Persist progress and start another operation after reviewing. |
| Project moved | Same instance and data |
| Project missing, replaced or unverified | New operations blocked; saved data readable. The bound ID is resolved before starting and before each project file read. |
| Older registrations | Load from their recorded source; copies in `.runtime/versions/` only if that directory is gone |

| Limit | Value |
| --- | --- |
| State | Per instance, SQLite, 4 MiB JSON value |
| Events | 1 MiB |
| Execution status | Existing execution store; model calls in the session-node writer under application run storage |

| Owner API | Effect |
| --- | --- |
| `PATCH /api/applications/{id}` | `enabled`, `hidden`, `display_title`. Hiding does not cancel a task; disabling does. |

## Run one on its own

1. On the **Applications** page, open the application's **⋯** menu and choose **Export as an application of its own…**.
2. Choose where to save it (Downloads unless you browse elsewhere) and click **Export**. It takes about half a minute; then **Show in Finder** shows **Meetings.app**.
3. Open it: the application opens in a window of its own, with the same window and operations as in the App.
4. Close the window: it stops by itself ten minutes later, unless it is still recording or working.

| Question | Answer |
| --- | --- |
| Needs OpenProgram? | No: the export carries its own Python and OpenProgram (Meetings: 287 MB). Models and voice come from this computer's OpenProgram settings at each launch; the export holds no keys. |
| Its data | `~/Library/Application Support/OpenProgram Applications/<id>`, separate from the App's |
| Conversations | A conversation the application opens shows in a side panel, where you can ask follow-up questions |
| Not exportable | Applications that declare `chat` or have project scope: their menu has no Export |
| From the terminal | `openprogram programs export meeting --output FOLDER` |
| Other systems | `--format dir` writes a folder with `run.sh` and `run.cmd` |
| On another Mac | It is unsigned: the first time, choose Open from its context menu |

Not implemented: non-Python backend adapters, MCP Apps compatibility, embedding native GUI windows.

## Use an application as a resource

Enabled applications appear as `application.<id>` in `resource(action="describe")`, reflecting install, disable, update and uninstall without a restart. The Resources view and top tab open the same instance in the same sandboxed frame.

| Action | Behaviour |
| --- | --- |
| `open` | Accepts `project_id` for project scope. Associates the instance with the calling session. Returns the `instance_id` and `digest` to use; an older digest is rejected after an update. |
| `observe` | Instance state and recent runs |
| `act` | A declared Agent-visible operation and a stable `request_key` |
| `status`, `cancel`, `answer` | Need a run of that exact instance |
| `save` | Uses the expected storage version when `storage.app` is declared |
| `release` | Removes the session association; keeps instance, data and running operations. Hiding its view also leaves operations running. |

| Agent entries | Rule |
| --- | --- |
| Name | `<id>__<operation>`, other characters than letters, digits, `_` and `-` replaced by `_`: `local_notes__summarize` |
| Input | The operation input as `input`, plus `project_id` for project scope. Waits for the run and returns it. A run waiting on a question returns its id, for `status`, `answer` or `cancel`. |
| Exposure | Need approval, like `resource`. Deferred: the model sees names and loads a schema with `tool_search`. Opening the application for a conversation loads nothing: the catalog notes it is open and the model loads its entries by name. |
| `agent: false` | No entry |

Owner API for a window: `POST /api/applications/{id}/open` with `session_id` associates; `POST /api/applications/{id}/close` with `instance_id` and `session_id` releases.

**Generate a starter package**

| Step | Detail |
| --- | --- |
| Generate | `POST /api/applications/scaffold` with `path`, `app_id` and `title`, also through the [framework tool](https://fzkuji.github.io/OpenProgram/docs/capabilities/framework-control.html) |
| Target | The parent directory must exist and the target must not |
| Package | Separates `backend/operations.py`, `ui/index.html` and `application.json`; UI and Agent both call the declared read/save operations |
| Install | Review, then `/api/applications/install` with the source path and `trust: true` |
| New operations | In the backend and manifest, not inside UI events |
