Skip to content
Open
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ docs/site/.source/
docs/site/content/docs/
docs/site/node_modules/
docs/site/tsconfig.tsbuildinfo

# iOS agentd build outputs
ios/agentd/.theos/
ios/agentd/packages/
*.deb
51 changes: 51 additions & 0 deletions docs/legal/IOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# OpenPhone iOS Legal Notice

This notice governs the OpenPhone iOS materials under [`ios/`](/ios). It is not
legal advice. It states the intended scope and terms under which these
materials are made available.

## Scope of these materials

The OpenPhone iOS materials are original, OpenPhone-authored source code and
documentation for a phone-resident agent runtime. They contain **only
OpenPhone-owned code**.

These materials do **not** contain, bundle, distribute, or link to:

- any exploit, unlocking tool, bootrom or kernel exploit, or other software
that circumvents a technological protection measure,
- any tool, payload, or package whose purpose is to modify, unlock, or bypass
device security, or
- any instructions, guide, or runbook explaining how to place a device into a
modified-operating-system state.

The OpenPhone iOS agent is application-layer software that runs **on top of** a
device the owner has already prepared through separate means of their own
choosing. Reaching any such device state is solely the owner's responsibility
and is entirely out of scope for this project.

## Intended use

- **Personal, non-commercial use only.** These materials are provided for
personal research and evaluation. Commercial use requires a separate written
commercial license (see [COMMERCIAL.md](/docs/legal/COMMERCIAL)).
- **Owned devices only.** Intended solely for a device that you own.
- **Proof of concept.** Experimental proof-of-concept work, not a supported
product.
- **No warranty.** Provided "as is", without warranty of any kind, to the
fullest extent permitted by law.

## No affiliation

OpenPhone is not affiliated with, endorsed by, or sponsored by Apple Inc. Apple,
iPhone, iOS, and related marks are trademarks of Apple Inc. and are used only to
describe interoperability. See also the project [NOTICE](/docs/legal/NOTICE).

## Licensing

The OpenPhone iOS materials are OpenPhone-owned materials and are licensed under
the same terms as the rest of this repository: the PolyForm Noncommercial
License 1.0.0 for non-commercial use, with commercial use requiring a separate
written license from Dafdef, inc. See [LICENSE](/LICENSE),
[LICENSE.noncommercial](/docs/legal/LICENSE.noncommercial), and
[COMMERCIAL.md](/docs/legal/COMMERCIAL).
1 change: 1 addition & 0 deletions docs/legal/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ OpenPhone legal and licensing docs live here.
- [Licensing Notes](/docs/LICENSING)
- [Commercial Licensing](/docs/legal/COMMERCIAL)
- [Third-Party Notices](/docs/legal/THIRD_PARTY_NOTICES)
- [OpenPhone iOS Notice](/docs/legal/IOS)
77 changes: 77 additions & 0 deletions ios/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# OpenPhone iOS

OpenPhone iOS brings the OpenPhone agent to iPhone as a phone-resident runtime.
The design mirrors the Android side of this repository: the phone owns the
agent, not a host computer. A launchd daemon on the device owns task state,
tool execution, autonomy policy, memory, watchers, background jobs, audit, and
trajectories. Host-side tools exist only for install, debug, and recovery.

This is experimental proof-of-concept work, not a supported product. It targets
an owned device that already exposes a rootless runtime prefix at `/var/jb`;
reaching that state is the owner's responsibility and out of scope here.

## Legal boundary

These materials contain **only OpenPhone-authored code**. They do **not**
contain, bundle, distribute, or explain any exploit, unlocking tool, or other
means of circumventing device protections. This is application-layer software
that runs **on top of** a device the owner has already prepared through separate
means of their own choosing.

Provided for **personal, non-commercial use on a device you own**, as a proof of
concept, "as is" and without warranty. OpenPhone is not affiliated with or
endorsed by Apple Inc.; Apple, iPhone, and iOS are trademarks of Apple Inc. used
only to describe interoperability. Full terms are in
[docs/legal/IOS.md](../docs/legal/IOS.md); licensing is the repository-wide
PolyForm Noncommercial License (see [LICENSE](../LICENSE)).

## Layout

```text
agentd/ Phone-resident daemon and companion tweaks (Theos rootless build).
contracts/ iOS command/event/capability contracts and JSON schemas.
shared/ Platform-neutral contracts shared with the Android agent.
tools/ macOS install / debug / validation tooling (not the runtime).
```

## agentd

`openphone-agentd` is the runtime authority. It listens on a phone-local Unix
domain socket and serves the Android-shaped command surface (tasks, screen,
actions, memory, context, commitments, watchers, background jobs, providers,
and the model loop). Companion tweaks provide a SpringBoard hardware trigger and
in-process app UI introspection. See [agentd/README.md](agentd/README.md) for
the command list, build, and on-device debug notes.

Build the rootless package (requires Theos on the build host):

```sh
cd ios/agentd
make package
```

## Contracts

`contracts/` holds the iOS command, event, and capability definitions plus the
action/audit/trajectory JSON schemas. `shared/contracts/` is the deduplicated
set both iOS and Android are meant to build against: the model tool registry,
the model decision schema, and the canonical capability/risk list. The daemon
is the source of truth for the tool surface; keep the shared files in sync when
the daemon tool surface changes.

## Tools

`tools/mac/` installs, restarts, inspects, and validates the daemon over SSH or
a USB-forwarded tunnel. These are development and recovery tools and never run
the agent on the host. Connection details are supplied through environment
variables (`OPENPHONE_IOS_HOST`, `OPENPHONE_IOS_USER`, and so on); no device
identifiers or credentials are committed. See
[tools/mac/agentd/README.md](tools/mac/agentd/README.md).

## Runtime dependencies

At runtime the daemon assumes the device provides `OpenSSH` (for host tooling),
a Substrate-compatible tweak loader (for the SpringBoard tweak), a preference
loader (for the settings pane), the rootless prefix `/var/jb`, and `launchd`
(which runs the daemon from `/var/jb/Library/LaunchDaemons`). This project does
not provide or bundle those components.
70 changes: 70 additions & 0 deletions ios/agentd/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
TARGET := iphone:clang:latest:15.0
THEOS_PACKAGE_SCHEME = rootless

ifeq ($(THEOS),)
ifneq ($(wildcard $(HOME)/theos/makefiles/common.mk),)
THEOS := $(HOME)/theos
else ifneq ($(wildcard /opt/theos/makefiles/common.mk),)
THEOS := /opt/theos
else ifneq ($(wildcard /var/theos/makefiles/common.mk),)
THEOS := /var/theos
else
$(error THEOS is not set. Install Theos or run with THEOS=/path/to/theos)
endif
endif

include $(THEOS)/makefiles/common.mk

INSTALL_TARGET_PROCESSES = SpringBoard MobileSafari Preferences MobileNotes MobileSMS MobileCal com.apple.WebKit.WebContent

TOOL_NAME = openphone-agentd openphone-protected-data-helper openphone-agentctl openphone-screencap-helper
TWEAK_NAME = OpenPhoneVolumeTrigger OpenPhoneAppIntrospector
BUNDLE_NAME = OpenPhoneAgentPrefs

openphone-agentd_FILES = src/main.m
openphone-agentd_CFLAGS = -fobjc-arc -Wall -Wextra
openphone-agentd_FRAMEWORKS = Foundation AVFoundation AudioToolbox Speech
openphone-agentd_LIBRARIES = compression sqlite3
openphone-agentd_INSTALL_PATH = /usr/local/bin
openphone-agentd_CODESIGN_FLAGS = -Sentitlements.plist

openphone-protected-data-helper_FILES = src/main.m
openphone-protected-data-helper_CFLAGS = -fobjc-arc -Wall -Wextra
openphone-protected-data-helper_FRAMEWORKS = Foundation AVFoundation AudioToolbox Speech
openphone-protected-data-helper_LIBRARIES = compression sqlite3
openphone-protected-data-helper_INSTALL_PATH = /usr/local/bin

openphone-agentctl_FILES = src/agentctl.m
openphone-agentctl_CFLAGS = -fobjc-arc -Wall -Wextra
openphone-agentctl_FRAMEWORKS = Foundation
openphone-agentctl_INSTALL_PATH = /usr/local/bin

openphone-screencap-helper_FILES = src/screencap_helper.m
openphone-screencap-helper_CFLAGS = -fobjc-arc -Wall -Wextra
openphone-screencap-helper_FRAMEWORKS = Foundation CoreGraphics ImageIO
openphone-screencap-helper_INSTALL_PATH = /usr/local/bin

OpenPhoneVolumeTrigger_FILES = src/volume_trigger.xm
OpenPhoneVolumeTrigger_CFLAGS = -fobjc-arc -Wall -Wextra
OpenPhoneVolumeTrigger_FRAMEWORKS = Foundation UIKit QuartzCore AudioToolbox
OpenPhoneVolumeTrigger_INSTALL_PATH = /usr/lib/TweakInject

OpenPhoneAppIntrospector_FILES = src/app_introspector.xm
OpenPhoneAppIntrospector_CFLAGS = -fobjc-arc -Wall -Wextra
OpenPhoneAppIntrospector_FRAMEWORKS = Foundation UIKit
OpenPhoneAppIntrospector_INSTALL_PATH = /usr/lib/TweakInject

OpenPhoneAgentPrefs_FILES = src/prefs/OpenPhoneAgentPrefsRootListController.m
OpenPhoneAgentPrefs_CFLAGS = -fobjc-arc -Wall -Wextra
OpenPhoneAgentPrefs_FRAMEWORKS = Foundation UIKit
OpenPhoneAgentPrefs_LDFLAGS = -undefined dynamic_lookup
OpenPhoneAgentPrefs_INSTALL_PATH = /Library/PreferenceBundles
OpenPhoneAgentPrefs_RESOURCE_DIRS = prefs/OpenPhoneAgentPrefsResources

include $(THEOS_MAKE_PATH)/tool.mk
include $(THEOS_MAKE_PATH)/tweak.mk
include $(THEOS_MAKE_PATH)/bundle.mk

after-stage::
chmod 4755 $(THEOS_STAGING_DIR)/usr/local/bin/openphone-protected-data-helper
chmod 0755 $(THEOS_STAGING_DIR)/usr/local/bin/openphone-helper-wrapper.sh
7 changes: 7 additions & 0 deletions ios/agentd/OpenPhoneAppIntrospector.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Filter = {
Bundles = (
"com.apple.UIKit"
);
};
}
10 changes: 10 additions & 0 deletions ios/agentd/OpenPhoneVolumeTrigger.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
Filter = {
Bundles = (
"com.apple.springboard"
);
Executables = (
"SpringBoard"
);
};
}
Loading
Loading