@agimon-ai/po-ios 0.0.1-alpha.1 → 0.0.1-alpha.100
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.
- package/README.md +39 -58
- package/dist/apiContracts.cjs +190 -4
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -3
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +188 -3
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/{contracts-C54pSczx.cjs → contracts-CBAI3LG6.cjs} +51 -3
- package/dist/contracts-CBAI3LG6.cjs.map +1 -0
- package/dist/{contracts-D41ZfB5m.mjs → contracts-S4ze8Upx.mjs} +16 -4
- package/dist/contracts-S4ze8Upx.mjs.map +1 -0
- package/dist/extensions/native.mjs +1286 -0
- package/dist/extensions/native.mjs.map +1 -0
- package/dist/extensions/server.cjs +2091 -357
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +2096 -362
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +1023 -0
- package/dist/extensions/web.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +122 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/native/device-runner/PoRunner.xcodeproj/project.pbxproj +204 -0
- package/native/device-runner/PoRunner.xcodeproj/xcshareddata/xcschemes/PoRunner.xcscheme +20 -0
- package/native/device-runner/PoRunnerUITests/Runner.swift +249 -0
- package/native/sim-helper/PRIVATE_APIS.md +15 -2
- package/native/sim-helper/Sources/PoIosCore/Compaction.swift +25 -20
- package/native/sim-helper/Sources/PoIosCore/Protocol.swift +55 -3
- package/native/sim-helper/Sources/PoIosSimHelper/Backends.swift +66 -50
- package/native/sim-helper/Sources/PoIosSimHelper/PrivateApis.swift +7 -4
- package/native/sim-helper/Sources/PoIosSimHelper/ScreenRecorder.swift +102 -0
- package/native/sim-helper/Sources/PoIosSimHelper/main.swift +12 -3
- package/native/sim-helper/Tests/PoIosCoreTests/CompactionTests.swift +41 -18
- package/native/sim-helper/Tests/PoIosCoreTests/ProtocolTests.swift +36 -0
- package/package.json +115 -12
- package/src/prompts/codemode-how-to-ios/SKILL.md +60 -8
- package/dist/contracts-C54pSczx.cjs.map +0 -1
- package/dist/contracts-D41ZfB5m.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,99 +1,80 @@
|
|
|
1
1
|
# @agimon-ai/po-ios
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Lease iOS simulators from a machine-wide pool, install and launch apps, inspect accessibility, interact, capture screenshots and read logs. Paired physical phones support a narrower, explicitly approved workflow.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Requires Node.js 24 or newer, macOS, Xcode and an installed iOS simulator runtime.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Enable and use
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- macOS with Xcode and at least one iOS simulator runtime
|
|
9
|
+
Define an `ios` layer with `packages: ['@agimon-ai/po-ios']` in your presets file, include it in a preset, then run `po sync`. The package is opt-in and absent from starter configs.
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
The package is opt-in and intentionally absent from init templates. Define an `ios` layer with `packages: ['@agimon-ai/po-ios']` in your modes file, then select that layer in a major mode. The package declares poServer metadata for native server discovery.
|
|
15
|
-
|
|
16
|
-
## Use
|
|
17
|
-
|
|
18
|
-
In a code-mode `exec` script:
|
|
11
|
+
Read the [iOS guide](src/prompts/codemode-how-to-ios/SKILL.md), discover `ios`, then use code mode:
|
|
19
12
|
|
|
20
13
|
```ts
|
|
21
14
|
await ios.acquire({ label: 'login flow' });
|
|
22
|
-
|
|
23
|
-
await ios.
|
|
24
|
-
await ios.
|
|
25
|
-
await ios.
|
|
15
|
+
try {
|
|
16
|
+
const { bundleId } = await ios.install({ path: '/abs/Build/Products/Debug-iphonesimulator/App.app' });
|
|
17
|
+
await ios.launch({ bundleId });
|
|
18
|
+
await ios.screenshot();
|
|
19
|
+
} finally {
|
|
20
|
+
await ios.release();
|
|
21
|
+
}
|
|
26
22
|
```
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
Input acknowledgement is not UI completion. Use `waitFor` after actions and release the lease when finished.
|
|
25
|
+
|
|
26
|
+
Activity shows devices, lease ownership and the latest registered build. **View screen** opens the session's leased simulator without replacing the composer. Capture is authenticated and visible-only; release or ownership loss clears the image. Physical-device screen capture is unsupported.
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
Registered-build download and copy-link actions need available remote sharing and mint ephemeral bearer access. They never enable remote access implicitly. Downloading a ZIP or IPA does not establish installation success.
|
|
29
|
+
|
|
30
|
+
## Simulator pool
|
|
31
|
+
|
|
32
|
+
Each server elects one host-wide owner. Servers sharing a Po home coordinate leases through `po/db`; Po's simulators live under `<po home>/ios/devices`, not in the person's default set.
|
|
33
|
+
|
|
34
|
+
Configure the pool in the host's `<po home>/config.yaml`:
|
|
31
35
|
|
|
32
36
|
```yaml
|
|
33
37
|
ios:
|
|
34
38
|
pool:
|
|
35
|
-
maxBooted: 2
|
|
36
|
-
maxDevices: 4
|
|
37
|
-
minBooted: 0
|
|
39
|
+
maxBooted: 2
|
|
40
|
+
maxDevices: 4
|
|
41
|
+
minBooted: 0
|
|
38
42
|
idleShutdownMinutes: 10
|
|
39
43
|
waitTimeoutSeconds: 120
|
|
40
44
|
```
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
The smallest `maxBooted` among running servers wins. Configuration is read at activation. Settings saves do not interrupt leases or restart services; pending changes require an explicit iOS service restart.
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
Release uninstalls apps installed by the session and keeps the simulator warm. A dead server's devices are erased before reuse.
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
Accessibility and input use the resident Swift helper in `native/sim-helper`. First use builds it with `xcrun swift build` into `<po home>/ios/native/<hash>/`; `ios.helperPath` can select a prebuilt helper. Unsupported private API shapes fail explicitly. See [private API evidence and limits](native/sim-helper/PRIVATE_APIS.md).
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
Supported simulator trials covered portrait taps, timed swipes, US-layout ASCII typing, home and lock. Arbitrary Unicode, landscape-app touches, Siri and volume buttons return `IOS_HELPER_UNAVAILABLE`, with no clipboard or accessibility-value fallback. Unsupported text is rejected before emitting keys. An accessibility observation of a landscape interface is not proof that touch mapping works.
|
|
49
53
|
|
|
50
|
-
##
|
|
54
|
+
## Physical phones
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
`ios.devices()` lists CoreDevice-visible devices. `ios.acquireDevice({ udid })` requires a paired, reachable phone and the person's approval. Phone leases share the lease table but are never booted, erased, or counted against simulator limits.
|
|
53
57
|
|
|
54
|
-
|
|
58
|
+
Signed app install, uninstall, launch and console capture work without a UI runner. Console logs retain at most 5,000 lines for 12 hours from a process launched with `--console`; unified system logs and process/subsystem filtering are unavailable.
|
|
55
59
|
|
|
56
|
-
|
|
57
|
-
import { IOS_POOL_CONTRACT, type IosPool } from '@agimon-ai/po-ios';
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
The native server entry is also available at:
|
|
61
|
-
|
|
62
|
-
```text
|
|
63
|
-
@agimon-ai/po-ios/extensions/server
|
|
64
|
-
```
|
|
60
|
+
For accessibility and input, set `ios.device.developmentTeam` in host configuration and connect by USB. Keep the phone unlocked and awake during startup. First use builds and installs Po's signed XCUITest runner with automatic provisioning. A saved Team ID alone does not prove signing or IPA eligibility.
|
|
65
61
|
|
|
66
|
-
The
|
|
62
|
+
The runner binds only a USB IPv4 link-local address (`169.254.*`) and requires a random per-run token. It observes the foreground app launched under the lease, otherwise SpringBoard. Release stops the runner and removes its test host before freeing the lease, leaving other apps installed. Cleanup failure retains the lease for retry.
|
|
67
63
|
|
|
68
|
-
|
|
64
|
+
Phone screenshots, terminate, openUrl, home, lock and Siri are unavailable through `ios`. Volume and rotation are unverified. A swipe may leave an app; visible-row changes alone do not establish content scrolling.
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
- `services/{serviceName}/`: package logic, with `index.ts` and `type.ts`.
|
|
72
|
-
- `models/`: host-neutral state and transitions.
|
|
73
|
-
- `constants/`, `schemas/`, and `types/`: shared metadata, validation, and contracts.
|
|
74
|
-
- Private `_lib/` and `_components/` folders beside routes hold surface-private implementation and are not scanned.
|
|
66
|
+
## Evidence boundaries
|
|
75
67
|
|
|
76
|
-
|
|
68
|
+
Earlier packed-source web acceptance on source `9595ac8` covered a real simulator PNG, release clearing, Settings persistence and save conflicts. Twelve r2 story visuals were explicitly approved separately. Native-app UI execution remains unverified; approved images are not runtime acceptance.
|
|
77
69
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
The lifecycle is construct, register, `onStart`, run, `onStop`, unregister, `onDispose`. All hooks are optional and receive one typed context. The helper awaits startup before readiness. Shutdown aborts the context signal, stops work, removes registrations in reverse order, and performs final cleanup. Failed startup awaits rollback. Optional provider replacement rebinds contributions without restarting the plugin. Minor-mode actions are independent of mounting.
|
|
81
|
-
|
|
82
|
-
Factories construct state; `onStart` begins external work. `onStop` runs when the start stage was reached, including a failed `onStart`. Use `onDispose` only for remaining instance resources. Do not add empty hooks or manual registration cleanup.
|
|
70
|
+
Recorded simulator and iPhone trials cover selected installation, input, logs and cleanup paths, not the full iOS plan. Borrowed child leases remain unverified. Consult the helper evidence before relying on a platform operation; this README review did not rerun physical-device or simulator trials.
|
|
83
71
|
|
|
84
72
|
## Development
|
|
85
73
|
|
|
86
74
|
```bash
|
|
87
|
-
pnpm build
|
|
88
|
-
pnpm typecheck
|
|
89
|
-
pnpm test
|
|
90
|
-
pnpm lint
|
|
91
|
-
pnpm exec vibe-lint check .
|
|
92
|
-
npm pack --dry-run
|
|
75
|
+
pnpm exec nx run-many -t lint typecheck build test -p @agimon-ai/po-ios
|
|
93
76
|
```
|
|
94
77
|
|
|
95
|
-
Maintained by [Agimon](https://agimon.ai/about).
|
|
96
|
-
|
|
97
78
|
## License
|
|
98
79
|
|
|
99
80
|
Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
|
package/dist/apiContracts.cjs
CHANGED
|
@@ -2,13 +2,199 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
+
let _agimon_ai_po_core_apiContracts = require("@agimon-ai/po-core/apiContracts");
|
|
6
|
+
let _agimon_ai_po_core_pluginProtocol = require("@agimon-ai/po-core/pluginProtocol");
|
|
7
|
+
let typebox = require("typebox");
|
|
8
|
+
//#region src/types/iosUi.ts
|
|
9
|
+
/** JSON-only iOS UI contracts. Lease ownership and paths are resolved by the server. */
|
|
10
|
+
const iosActivityChannel = "ios_activity";
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/schemas/iosSettingsMethods.ts
|
|
13
|
+
const Availability = typebox.Type.Union([typebox.Type.Literal("available"), typebox.Type.Literal("excluded")]);
|
|
14
|
+
const Pool = typebox.Type.Object({
|
|
15
|
+
minBooted: typebox.Type.Number(),
|
|
16
|
+
maxBooted: typebox.Type.Number(),
|
|
17
|
+
maxDevices: typebox.Type.Number(),
|
|
18
|
+
idleShutdownMinutes: typebox.Type.Number(),
|
|
19
|
+
waitTimeoutSeconds: typebox.Type.Number(),
|
|
20
|
+
deviceType: typebox.Type.Optional(typebox.Type.String()),
|
|
21
|
+
runtime: typebox.Type.Optional(typebox.Type.String())
|
|
22
|
+
});
|
|
23
|
+
/** Read-only activation snapshot and discovered inventory. Never starts signing, leases or runtimes. */
|
|
24
|
+
const iosSettingsMethod = (0, _agimon_ai_po_core_pluginProtocol.definePoPluginMethod)({
|
|
25
|
+
service: "ios",
|
|
26
|
+
method: "settings",
|
|
27
|
+
scope: "host",
|
|
28
|
+
direction: "client-to-server",
|
|
29
|
+
input: typebox.Type.Object({}, { additionalProperties: false }),
|
|
30
|
+
output: typebox.Type.Object({
|
|
31
|
+
active: typebox.Type.Boolean(),
|
|
32
|
+
configFile: typebox.Type.String(),
|
|
33
|
+
applied: typebox.Type.Optional(typebox.Type.Object({
|
|
34
|
+
pool: Pool,
|
|
35
|
+
developmentTeam: typebox.Type.Optional(typebox.Type.String()),
|
|
36
|
+
availability: typebox.Type.Record(typebox.Type.String(), Availability)
|
|
37
|
+
})),
|
|
38
|
+
phones: typebox.Type.Array(typebox.Type.Object({
|
|
39
|
+
udid: typebox.Type.String(),
|
|
40
|
+
name: typebox.Type.String(),
|
|
41
|
+
paired: typebox.Type.Boolean(),
|
|
42
|
+
connected: typebox.Type.Boolean(),
|
|
43
|
+
leased: typebox.Type.Boolean(),
|
|
44
|
+
availability: Availability
|
|
45
|
+
})),
|
|
46
|
+
runtimes: typebox.Type.Array(typebox.Type.Object({
|
|
47
|
+
identifier: typebox.Type.String(),
|
|
48
|
+
name: typebox.Type.String(),
|
|
49
|
+
isAvailable: typebox.Type.Boolean(),
|
|
50
|
+
models: typebox.Type.Array(typebox.Type.Object({
|
|
51
|
+
identifier: typebox.Type.String(),
|
|
52
|
+
name: typebox.Type.String()
|
|
53
|
+
}))
|
|
54
|
+
})),
|
|
55
|
+
inventoryError: typebox.Type.Optional(typebox.Type.String()),
|
|
56
|
+
runtimeError: typebox.Type.Optional(typebox.Type.String())
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/schemas/iosUiMethods.ts
|
|
61
|
+
const address = {
|
|
62
|
+
service: "ios",
|
|
63
|
+
scope: "session",
|
|
64
|
+
direction: "client-to-server"
|
|
65
|
+
};
|
|
66
|
+
const Hash = typebox.Type.String({ pattern: "^[a-f0-9]{64}$" });
|
|
67
|
+
const CapturedAt = typebox.Type.Number({ minimum: 0 });
|
|
68
|
+
const IosActivitySchema = typebox.Type.Object({
|
|
69
|
+
supported: typebox.Type.Boolean(),
|
|
70
|
+
devices: typebox.Type.Array(typebox.Type.Object({
|
|
71
|
+
id: typebox.Type.String(),
|
|
72
|
+
name: typebox.Type.String(),
|
|
73
|
+
kind: typebox.Type.Union([typebox.Type.Literal("simulator"), typebox.Type.Literal("device")]),
|
|
74
|
+
detail: typebox.Type.String(),
|
|
75
|
+
state: typebox.Type.Union([
|
|
76
|
+
typebox.Type.Literal("owned"),
|
|
77
|
+
typebox.Type.Literal("other-session"),
|
|
78
|
+
typebox.Type.Literal("available"),
|
|
79
|
+
typebox.Type.Literal("disconnected")
|
|
80
|
+
]),
|
|
81
|
+
leaseId: typebox.Type.Optional(typebox.Type.String()),
|
|
82
|
+
capture: typebox.Type.Union([typebox.Type.Literal("available"), typebox.Type.Literal("unsupported")])
|
|
83
|
+
})),
|
|
84
|
+
build: typebox.Type.Optional(typebox.Type.Object({
|
|
85
|
+
id: typebox.Type.String(),
|
|
86
|
+
name: typebox.Type.String(),
|
|
87
|
+
size: typebox.Type.Integer({ minimum: 0 }),
|
|
88
|
+
artifactPath: typebox.Type.String(),
|
|
89
|
+
registeredAt: typebox.Type.String()
|
|
90
|
+
})),
|
|
91
|
+
error: typebox.Type.Optional(typebox.Type.String())
|
|
92
|
+
});
|
|
93
|
+
const iosStatusMethod = (0, _agimon_ai_po_core_pluginProtocol.definePoPluginMethod)({
|
|
94
|
+
...address,
|
|
95
|
+
method: "status",
|
|
96
|
+
input: typebox.Type.Object({}, { additionalProperties: false }),
|
|
97
|
+
output: IosActivitySchema
|
|
98
|
+
});
|
|
99
|
+
const iosFrameMethod = (0, _agimon_ai_po_core_pluginProtocol.definePoPluginMethod)({
|
|
100
|
+
...address,
|
|
101
|
+
method: "frame",
|
|
102
|
+
input: typebox.Type.Object({
|
|
103
|
+
leaseId: typebox.Type.String({
|
|
104
|
+
minLength: 1,
|
|
105
|
+
maxLength: 128
|
|
106
|
+
}),
|
|
107
|
+
since: typebox.Type.Optional(Hash)
|
|
108
|
+
}, { additionalProperties: false }),
|
|
109
|
+
output: typebox.Type.Union([
|
|
110
|
+
typebox.Type.Object({
|
|
111
|
+
state: typebox.Type.Literal("ok"),
|
|
112
|
+
src: typebox.Type.String({ maxLength: 6291456 }),
|
|
113
|
+
hash: Hash,
|
|
114
|
+
capturedAt: CapturedAt
|
|
115
|
+
}),
|
|
116
|
+
typebox.Type.Object({
|
|
117
|
+
state: typebox.Type.Literal("unchanged"),
|
|
118
|
+
hash: Hash,
|
|
119
|
+
capturedAt: CapturedAt
|
|
120
|
+
}),
|
|
121
|
+
typebox.Type.Object({ state: typebox.Type.Literal("released") }),
|
|
122
|
+
typebox.Type.Object({
|
|
123
|
+
state: typebox.Type.Literal("capture-unavailable"),
|
|
124
|
+
message: typebox.Type.String()
|
|
125
|
+
}),
|
|
126
|
+
typebox.Type.Object({
|
|
127
|
+
state: typebox.Type.Literal("error"),
|
|
128
|
+
message: typebox.Type.String()
|
|
129
|
+
})
|
|
130
|
+
])
|
|
131
|
+
});
|
|
132
|
+
const iosShareBuildMethod = (0, _agimon_ai_po_core_pluginProtocol.definePoPluginMethod)({
|
|
133
|
+
...address,
|
|
134
|
+
method: "shareBuild",
|
|
135
|
+
input: typebox.Type.Object({ buildId: typebox.Type.String({
|
|
136
|
+
minLength: 16,
|
|
137
|
+
maxLength: 128
|
|
138
|
+
}) }, { additionalProperties: false }),
|
|
139
|
+
output: typebox.Type.Union([typebox.Type.Object({
|
|
140
|
+
ok: typebox.Type.Literal(true),
|
|
141
|
+
url: typebox.Type.String(),
|
|
142
|
+
expiresAt: typebox.Type.Number()
|
|
143
|
+
}), typebox.Type.Object({
|
|
144
|
+
ok: typebox.Type.Literal(false),
|
|
145
|
+
reason: typebox.Type.Union([
|
|
146
|
+
typebox.Type.Literal("remote-off"),
|
|
147
|
+
typebox.Type.Literal("changed"),
|
|
148
|
+
typebox.Type.Literal("missing"),
|
|
149
|
+
typebox.Type.Literal("unavailable")
|
|
150
|
+
]),
|
|
151
|
+
message: typebox.Type.String()
|
|
152
|
+
})])
|
|
153
|
+
});
|
|
154
|
+
//#endregion
|
|
5
155
|
//#region src/schemas/apiContracts.ts
|
|
6
|
-
|
|
7
|
-
const apiContracts = (0, require("@agimon-ai/po-core/apiContracts").defineApiContract)({
|
|
156
|
+
const apiContracts = (0, _agimon_ai_po_core_apiContracts.defineApiContract)({
|
|
8
157
|
version: 1,
|
|
9
158
|
http: [],
|
|
10
|
-
|
|
11
|
-
|
|
159
|
+
dynamic: [],
|
|
160
|
+
sockets: [
|
|
161
|
+
...[
|
|
162
|
+
iosStatusMethod,
|
|
163
|
+
iosFrameMethod,
|
|
164
|
+
iosShareBuildMethod
|
|
165
|
+
].map((method) => ({
|
|
166
|
+
id: `ios.${method.method}`,
|
|
167
|
+
scope: "session",
|
|
168
|
+
service: method.service,
|
|
169
|
+
member: method.method,
|
|
170
|
+
kind: "method",
|
|
171
|
+
direction: "client-to-server",
|
|
172
|
+
description: `Session-owned iOS ${method.method}.`,
|
|
173
|
+
input: method.input,
|
|
174
|
+
output: method.output
|
|
175
|
+
})),
|
|
176
|
+
{
|
|
177
|
+
id: "ios.settings",
|
|
178
|
+
scope: "host",
|
|
179
|
+
service: iosSettingsMethod.service,
|
|
180
|
+
member: iosSettingsMethod.method,
|
|
181
|
+
kind: "method",
|
|
182
|
+
direction: "client-to-server",
|
|
183
|
+
description: "Applied iOS configuration and discovered inventory.",
|
|
184
|
+
input: iosSettingsMethod.input,
|
|
185
|
+
output: iosSettingsMethod.output
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
id: "ios.activity",
|
|
189
|
+
scope: "session",
|
|
190
|
+
service: "po.hub",
|
|
191
|
+
member: iosActivityChannel,
|
|
192
|
+
kind: "channel",
|
|
193
|
+
direction: "server-to-client",
|
|
194
|
+
description: "Real session iOS devices and registered build metadata.",
|
|
195
|
+
input: IosActivitySchema
|
|
196
|
+
}
|
|
197
|
+
]
|
|
12
198
|
});
|
|
13
199
|
//#endregion
|
|
14
200
|
exports.apiContracts = apiContracts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,4CAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"apiContracts.cjs","names":["Type","definePoPluginMethod","Type","definePoPluginMethod","defineApiContract"],"sources":["../src/types/iosUi.ts","../src/schemas/iosSettingsMethods.ts","../src/schemas/iosUiMethods.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["/** JSON-only iOS UI contracts. Lease ownership and paths are resolved by the server. */\nexport const iosActivityChannel = 'ios_activity';\nexport const iosUiService = 'ios';\nexport const iosActivityReaderEvent = 'po-ios:activity-reader';\n\nexport interface IosDeviceView {\n id: string;\n name: string;\n kind: 'simulator' | 'device';\n detail: string;\n state: 'owned' | 'other-session' | 'available' | 'disconnected';\n /** Only present for a lease owned by this session's root. */\n leaseId?: string;\n capture: 'available' | 'unsupported';\n}\n\nexport interface IosBuildView {\n id: string;\n name: string;\n size: number;\n /** Durable artifact-relative path, never a bearer URL. */\n artifactPath: string;\n registeredAt: string;\n}\n\nexport interface IosActivityPayload {\n supported: boolean;\n devices: IosDeviceView[];\n build?: IosBuildView;\n error?: string;\n}\n\nexport type IosFrameReply =\n | { state: 'ok'; src: string; hash: string; capturedAt: number }\n | { state: 'unchanged'; hash: string; capturedAt: number }\n | { state: 'released' }\n | { state: 'capture-unavailable'; message: string }\n | { state: 'error'; message: string };\n\nexport type IosBuildShareReply =\n | { ok: true; url: string; expiresAt: number }\n | { ok: false; reason: 'remote-off' | 'changed' | 'missing' | 'unavailable'; message: string };\n","import { definePoPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\nconst Availability = Type.Union([Type.Literal('available'), Type.Literal('excluded')]);\nconst Pool = Type.Object({\n minBooted: Type.Number(),\n maxBooted: Type.Number(),\n maxDevices: Type.Number(),\n idleShutdownMinutes: Type.Number(),\n waitTimeoutSeconds: Type.Number(),\n deviceType: Type.Optional(Type.String()),\n runtime: Type.Optional(Type.String()),\n});\n\n/** Read-only activation snapshot and discovered inventory. Never starts signing, leases or runtimes. */\nexport const iosSettingsMethod = definePoPluginMethod({\n service: 'ios',\n method: 'settings',\n scope: 'host',\n direction: 'client-to-server',\n input: Type.Object({}, { additionalProperties: false }),\n output: Type.Object({\n active: Type.Boolean(),\n configFile: Type.String(),\n applied: Type.Optional(\n Type.Object({\n pool: Pool,\n developmentTeam: Type.Optional(Type.String()),\n availability: Type.Record(Type.String(), Availability),\n }),\n ),\n phones: Type.Array(\n Type.Object({\n udid: Type.String(),\n name: Type.String(),\n paired: Type.Boolean(),\n connected: Type.Boolean(),\n leased: Type.Boolean(),\n availability: Availability,\n }),\n ),\n runtimes: Type.Array(\n Type.Object({\n identifier: Type.String(),\n name: Type.String(),\n isAvailable: Type.Boolean(),\n models: Type.Array(Type.Object({ identifier: Type.String(), name: Type.String() })),\n }),\n ),\n inventoryError: Type.Optional(Type.String()),\n runtimeError: Type.Optional(Type.String()),\n }),\n});\n","import { definePoPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\nimport { iosUiService } from '../types/iosUi';\n\nconst address = { service: iosUiService, scope: 'session', direction: 'client-to-server' } as const;\nconst Hash = Type.String({ pattern: '^[a-f0-9]{64}$' });\nconst CapturedAt = Type.Number({ minimum: 0 });\n\nexport const IosActivitySchema = Type.Object({\n supported: Type.Boolean(),\n devices: Type.Array(\n Type.Object({\n id: Type.String(),\n name: Type.String(),\n kind: Type.Union([Type.Literal('simulator'), Type.Literal('device')]),\n detail: Type.String(),\n state: Type.Union([\n Type.Literal('owned'),\n Type.Literal('other-session'),\n Type.Literal('available'),\n Type.Literal('disconnected'),\n ]),\n leaseId: Type.Optional(Type.String()),\n capture: Type.Union([Type.Literal('available'), Type.Literal('unsupported')]),\n }),\n ),\n build: Type.Optional(\n Type.Object({\n id: Type.String(),\n name: Type.String(),\n size: Type.Integer({ minimum: 0 }),\n artifactPath: Type.String(),\n registeredAt: Type.String(),\n }),\n ),\n error: Type.Optional(Type.String()),\n});\n\nexport const iosStatusMethod = definePoPluginMethod({\n ...address,\n method: 'status',\n input: Type.Object({}, { additionalProperties: false }),\n output: IosActivitySchema,\n});\n\nexport const iosFrameMethod = definePoPluginMethod({\n ...address,\n method: 'frame',\n input: Type.Object(\n { leaseId: Type.String({ minLength: 1, maxLength: 128 }), since: Type.Optional(Hash) },\n { additionalProperties: false },\n ),\n output: Type.Union([\n Type.Object({\n state: Type.Literal('ok'),\n src: Type.String({ maxLength: 6 * 1024 * 1024 }),\n hash: Hash,\n capturedAt: CapturedAt,\n }),\n Type.Object({ state: Type.Literal('unchanged'), hash: Hash, capturedAt: CapturedAt }),\n Type.Object({ state: Type.Literal('released') }),\n Type.Object({ state: Type.Literal('capture-unavailable'), message: Type.String() }),\n Type.Object({ state: Type.Literal('error'), message: Type.String() }),\n ]),\n});\n\nexport const iosShareBuildMethod = definePoPluginMethod({\n ...address,\n method: 'shareBuild',\n input: Type.Object({ buildId: Type.String({ minLength: 16, maxLength: 128 }) }, { additionalProperties: false }),\n output: Type.Union([\n Type.Object({ ok: Type.Literal(true), url: Type.String(), expiresAt: Type.Number() }),\n Type.Object({\n ok: Type.Literal(false),\n reason: Type.Union([\n Type.Literal('remote-off'),\n Type.Literal('changed'),\n Type.Literal('missing'),\n Type.Literal('unavailable'),\n ]),\n message: Type.String(),\n }),\n ]),\n});\n","import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\nimport { iosActivityChannel } from '../types/iosUi';\nimport { iosSettingsMethod } from './iosSettingsMethods';\nimport { IosActivitySchema, iosFrameMethod, iosShareBuildMethod, iosStatusMethod } from './iosUiMethods';\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [],\n dynamic: [],\n sockets: [\n ...[iosStatusMethod, iosFrameMethod, iosShareBuildMethod].map((method) => ({\n id: `ios.${method.method}`,\n scope: 'session' as const,\n service: method.service,\n member: method.method,\n kind: 'method' as const,\n direction: 'client-to-server' as const,\n description: `Session-owned iOS ${method.method}.`,\n input: method.input,\n output: method.output,\n })),\n {\n id: 'ios.settings',\n scope: 'host',\n service: iosSettingsMethod.service,\n member: iosSettingsMethod.method,\n kind: 'method',\n direction: 'client-to-server',\n description: 'Applied iOS configuration and discovered inventory.',\n input: iosSettingsMethod.input,\n output: iosSettingsMethod.output,\n },\n {\n id: 'ios.activity',\n scope: 'session',\n service: 'po.hub',\n member: iosActivityChannel,\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Real session iOS devices and registered build metadata.',\n input: IosActivitySchema,\n },\n ],\n});\nexport default apiContracts;\n"],"mappings":";;;;;;;;;AACA,MAAa,qBAAqB;;;ACElC,MAAM,eAAeA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,QAAQ,WAAW,GAAGA,QAAAA,KAAK,QAAQ,UAAU,CAAC,CAAC;AACrF,MAAM,OAAOA,QAAAA,KAAK,OAAO;CACvB,WAAWA,QAAAA,KAAK,OAAO;CACvB,WAAWA,QAAAA,KAAK,OAAO;CACvB,YAAYA,QAAAA,KAAK,OAAO;CACxB,qBAAqBA,QAAAA,KAAK,OAAO;CACjC,oBAAoBA,QAAAA,KAAK,OAAO;CAChC,YAAYA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,CAAC;CACvC,SAASA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,CAAC;AACtC,CAAC;;AAGD,MAAa,qBAAA,GAAoBC,kCAAAA,qBAAAA,CAAqB;CACpD,SAAS;CACT,QAAQ;CACR,OAAO;CACP,WAAW;CACX,OAAO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QAAAA,KAAK,OAAO;EACV,IAAIA,QAAAA,KAAK,QAAQ,KAAK;EACtB,QAAQA,QAAAA,KAAK,MAAM;GACjBA,QAAAA,KAAK,QAAQ,YAAY;GACzBA,QAAAA,KAAK,QAAQ,SAAS;GACtBA,QAAAA,KAAK,QAAQ,SAAS;GACtBA,QAAAA,KAAK,QAAQ,aAAa;EAC5B,CAAC;EACD,SAASA,QAAAA,KAAK,OAAO;CACvB,CAAC,CACH,CAAC;AACH,CAAC;;;AC9ED,MAAa,gBAAA,GAAeE,gCAAAA,kBAAAA,CAAkB;CAC5C,SAAS;CACT,MAAM,CAAC;CACP,SAAS,CAAC;CACV,SAAS;EACP,GAAG;GAAC;GAAiB;GAAgB;EAAmB,CAAC,CAAC,KAAK,YAAY;GACzE,IAAI,OAAO,OAAO;GAClB,OAAO;GACP,SAAS,OAAO;GAChB,QAAQ,OAAO;GACf,MAAM;GACN,WAAW;GACX,aAAa,qBAAqB,OAAO,OAAO;GAChD,OAAO,OAAO;GACd,QAAQ,OAAO;EACjB,EAAE;EACF;GACE,IAAI;GACJ,OAAO;GACP,SAAS,kBAAkB;GAC3B,QAAQ,kBAAkB;GAC1B,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO,kBAAkB;GACzB,QAAQ,kBAAkB;EAC5B;EACA;GACE,IAAI;GACJ,OAAO;GACP,SAAS;GACT,QAAQ;GACR,MAAM;GACN,WAAW;GACX,aAAa;GACb,OAAO;EACT;CACF;AACF,CAAC"}
|
package/dist/apiContracts.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
//#region src/schemas/apiContracts.d.ts
|
|
2
|
-
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
3
2
|
export declare const apiContracts: {
|
|
4
3
|
version: 1;
|
|
5
4
|
protocols?: Record<string, string> | undefined;
|
|
6
5
|
schemas?: Record<string, boolean | object> | undefined;
|
|
7
6
|
http: {
|
|
8
7
|
id: string;
|
|
9
|
-
scope: "
|
|
8
|
+
scope: "host" | "session" | "workspace";
|
|
10
9
|
basePath?: string | undefined;
|
|
11
10
|
path: string;
|
|
12
11
|
method: "DELETE" | "GET" | "HEAD" | "OPTIONS" | "PATCH" | "POST" | "PUT";
|
|
@@ -34,7 +33,7 @@ export declare const apiContracts: {
|
|
|
34
33
|
}[];
|
|
35
34
|
sockets: {
|
|
36
35
|
id: string;
|
|
37
|
-
scope: "
|
|
36
|
+
scope: "host" | "session" | "workspace";
|
|
38
37
|
description: string;
|
|
39
38
|
availability?: string | undefined;
|
|
40
39
|
service: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"apiContracts.d.mts","names":[],"sources":["../src/schemas/apiContracts.ts"],"mappings":";qBAMa"}
|
package/dist/apiContracts.mjs
CHANGED
|
@@ -1,11 +1,196 @@
|
|
|
1
1
|
import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
|
|
2
|
+
import { definePoPluginMethod } from "@agimon-ai/po-core/pluginProtocol";
|
|
3
|
+
import { Type } from "typebox";
|
|
4
|
+
//#region src/types/iosUi.ts
|
|
5
|
+
/** JSON-only iOS UI contracts. Lease ownership and paths are resolved by the server. */
|
|
6
|
+
const iosActivityChannel = "ios_activity";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/schemas/iosSettingsMethods.ts
|
|
9
|
+
const Availability = Type.Union([Type.Literal("available"), Type.Literal("excluded")]);
|
|
10
|
+
const Pool = Type.Object({
|
|
11
|
+
minBooted: Type.Number(),
|
|
12
|
+
maxBooted: Type.Number(),
|
|
13
|
+
maxDevices: Type.Number(),
|
|
14
|
+
idleShutdownMinutes: Type.Number(),
|
|
15
|
+
waitTimeoutSeconds: Type.Number(),
|
|
16
|
+
deviceType: Type.Optional(Type.String()),
|
|
17
|
+
runtime: Type.Optional(Type.String())
|
|
18
|
+
});
|
|
19
|
+
/** Read-only activation snapshot and discovered inventory. Never starts signing, leases or runtimes. */
|
|
20
|
+
const iosSettingsMethod = definePoPluginMethod({
|
|
21
|
+
service: "ios",
|
|
22
|
+
method: "settings",
|
|
23
|
+
scope: "host",
|
|
24
|
+
direction: "client-to-server",
|
|
25
|
+
input: Type.Object({}, { additionalProperties: false }),
|
|
26
|
+
output: Type.Object({
|
|
27
|
+
active: Type.Boolean(),
|
|
28
|
+
configFile: Type.String(),
|
|
29
|
+
applied: Type.Optional(Type.Object({
|
|
30
|
+
pool: Pool,
|
|
31
|
+
developmentTeam: Type.Optional(Type.String()),
|
|
32
|
+
availability: Type.Record(Type.String(), Availability)
|
|
33
|
+
})),
|
|
34
|
+
phones: Type.Array(Type.Object({
|
|
35
|
+
udid: Type.String(),
|
|
36
|
+
name: Type.String(),
|
|
37
|
+
paired: Type.Boolean(),
|
|
38
|
+
connected: Type.Boolean(),
|
|
39
|
+
leased: Type.Boolean(),
|
|
40
|
+
availability: Availability
|
|
41
|
+
})),
|
|
42
|
+
runtimes: Type.Array(Type.Object({
|
|
43
|
+
identifier: Type.String(),
|
|
44
|
+
name: Type.String(),
|
|
45
|
+
isAvailable: Type.Boolean(),
|
|
46
|
+
models: Type.Array(Type.Object({
|
|
47
|
+
identifier: Type.String(),
|
|
48
|
+
name: Type.String()
|
|
49
|
+
}))
|
|
50
|
+
})),
|
|
51
|
+
inventoryError: Type.Optional(Type.String()),
|
|
52
|
+
runtimeError: Type.Optional(Type.String())
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/schemas/iosUiMethods.ts
|
|
57
|
+
const address = {
|
|
58
|
+
service: "ios",
|
|
59
|
+
scope: "session",
|
|
60
|
+
direction: "client-to-server"
|
|
61
|
+
};
|
|
62
|
+
const Hash = Type.String({ pattern: "^[a-f0-9]{64}$" });
|
|
63
|
+
const CapturedAt = Type.Number({ minimum: 0 });
|
|
64
|
+
const IosActivitySchema = Type.Object({
|
|
65
|
+
supported: Type.Boolean(),
|
|
66
|
+
devices: Type.Array(Type.Object({
|
|
67
|
+
id: Type.String(),
|
|
68
|
+
name: Type.String(),
|
|
69
|
+
kind: Type.Union([Type.Literal("simulator"), Type.Literal("device")]),
|
|
70
|
+
detail: Type.String(),
|
|
71
|
+
state: Type.Union([
|
|
72
|
+
Type.Literal("owned"),
|
|
73
|
+
Type.Literal("other-session"),
|
|
74
|
+
Type.Literal("available"),
|
|
75
|
+
Type.Literal("disconnected")
|
|
76
|
+
]),
|
|
77
|
+
leaseId: Type.Optional(Type.String()),
|
|
78
|
+
capture: Type.Union([Type.Literal("available"), Type.Literal("unsupported")])
|
|
79
|
+
})),
|
|
80
|
+
build: Type.Optional(Type.Object({
|
|
81
|
+
id: Type.String(),
|
|
82
|
+
name: Type.String(),
|
|
83
|
+
size: Type.Integer({ minimum: 0 }),
|
|
84
|
+
artifactPath: Type.String(),
|
|
85
|
+
registeredAt: Type.String()
|
|
86
|
+
})),
|
|
87
|
+
error: Type.Optional(Type.String())
|
|
88
|
+
});
|
|
89
|
+
const iosStatusMethod = definePoPluginMethod({
|
|
90
|
+
...address,
|
|
91
|
+
method: "status",
|
|
92
|
+
input: Type.Object({}, { additionalProperties: false }),
|
|
93
|
+
output: IosActivitySchema
|
|
94
|
+
});
|
|
95
|
+
const iosFrameMethod = definePoPluginMethod({
|
|
96
|
+
...address,
|
|
97
|
+
method: "frame",
|
|
98
|
+
input: Type.Object({
|
|
99
|
+
leaseId: Type.String({
|
|
100
|
+
minLength: 1,
|
|
101
|
+
maxLength: 128
|
|
102
|
+
}),
|
|
103
|
+
since: Type.Optional(Hash)
|
|
104
|
+
}, { additionalProperties: false }),
|
|
105
|
+
output: Type.Union([
|
|
106
|
+
Type.Object({
|
|
107
|
+
state: Type.Literal("ok"),
|
|
108
|
+
src: Type.String({ maxLength: 6291456 }),
|
|
109
|
+
hash: Hash,
|
|
110
|
+
capturedAt: CapturedAt
|
|
111
|
+
}),
|
|
112
|
+
Type.Object({
|
|
113
|
+
state: Type.Literal("unchanged"),
|
|
114
|
+
hash: Hash,
|
|
115
|
+
capturedAt: CapturedAt
|
|
116
|
+
}),
|
|
117
|
+
Type.Object({ state: Type.Literal("released") }),
|
|
118
|
+
Type.Object({
|
|
119
|
+
state: Type.Literal("capture-unavailable"),
|
|
120
|
+
message: Type.String()
|
|
121
|
+
}),
|
|
122
|
+
Type.Object({
|
|
123
|
+
state: Type.Literal("error"),
|
|
124
|
+
message: Type.String()
|
|
125
|
+
})
|
|
126
|
+
])
|
|
127
|
+
});
|
|
128
|
+
const iosShareBuildMethod = definePoPluginMethod({
|
|
129
|
+
...address,
|
|
130
|
+
method: "shareBuild",
|
|
131
|
+
input: Type.Object({ buildId: Type.String({
|
|
132
|
+
minLength: 16,
|
|
133
|
+
maxLength: 128
|
|
134
|
+
}) }, { additionalProperties: false }),
|
|
135
|
+
output: Type.Union([Type.Object({
|
|
136
|
+
ok: Type.Literal(true),
|
|
137
|
+
url: Type.String(),
|
|
138
|
+
expiresAt: Type.Number()
|
|
139
|
+
}), Type.Object({
|
|
140
|
+
ok: Type.Literal(false),
|
|
141
|
+
reason: Type.Union([
|
|
142
|
+
Type.Literal("remote-off"),
|
|
143
|
+
Type.Literal("changed"),
|
|
144
|
+
Type.Literal("missing"),
|
|
145
|
+
Type.Literal("unavailable")
|
|
146
|
+
]),
|
|
147
|
+
message: Type.String()
|
|
148
|
+
})])
|
|
149
|
+
});
|
|
150
|
+
//#endregion
|
|
2
151
|
//#region src/schemas/apiContracts.ts
|
|
3
|
-
/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
|
|
4
152
|
const apiContracts = defineApiContract({
|
|
5
153
|
version: 1,
|
|
6
154
|
http: [],
|
|
7
|
-
|
|
8
|
-
|
|
155
|
+
dynamic: [],
|
|
156
|
+
sockets: [
|
|
157
|
+
...[
|
|
158
|
+
iosStatusMethod,
|
|
159
|
+
iosFrameMethod,
|
|
160
|
+
iosShareBuildMethod
|
|
161
|
+
].map((method) => ({
|
|
162
|
+
id: `ios.${method.method}`,
|
|
163
|
+
scope: "session",
|
|
164
|
+
service: method.service,
|
|
165
|
+
member: method.method,
|
|
166
|
+
kind: "method",
|
|
167
|
+
direction: "client-to-server",
|
|
168
|
+
description: `Session-owned iOS ${method.method}.`,
|
|
169
|
+
input: method.input,
|
|
170
|
+
output: method.output
|
|
171
|
+
})),
|
|
172
|
+
{
|
|
173
|
+
id: "ios.settings",
|
|
174
|
+
scope: "host",
|
|
175
|
+
service: iosSettingsMethod.service,
|
|
176
|
+
member: iosSettingsMethod.method,
|
|
177
|
+
kind: "method",
|
|
178
|
+
direction: "client-to-server",
|
|
179
|
+
description: "Applied iOS configuration and discovered inventory.",
|
|
180
|
+
input: iosSettingsMethod.input,
|
|
181
|
+
output: iosSettingsMethod.output
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "ios.activity",
|
|
185
|
+
scope: "session",
|
|
186
|
+
service: "po.hub",
|
|
187
|
+
member: iosActivityChannel,
|
|
188
|
+
kind: "channel",
|
|
189
|
+
direction: "server-to-client",
|
|
190
|
+
description: "Real session iOS devices and registered build metadata.",
|
|
191
|
+
input: IosActivitySchema
|
|
192
|
+
}
|
|
193
|
+
]
|
|
9
194
|
});
|
|
10
195
|
//#endregion
|
|
11
196
|
export { apiContracts, apiContracts as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/types/iosUi.ts","../src/schemas/iosSettingsMethods.ts","../src/schemas/iosUiMethods.ts","../src/schemas/apiContracts.ts"],"sourcesContent":["/** JSON-only iOS UI contracts. Lease ownership and paths are resolved by the server. */\nexport const iosActivityChannel = 'ios_activity';\nexport const iosUiService = 'ios';\nexport const iosActivityReaderEvent = 'po-ios:activity-reader';\n\nexport interface IosDeviceView {\n id: string;\n name: string;\n kind: 'simulator' | 'device';\n detail: string;\n state: 'owned' | 'other-session' | 'available' | 'disconnected';\n /** Only present for a lease owned by this session's root. */\n leaseId?: string;\n capture: 'available' | 'unsupported';\n}\n\nexport interface IosBuildView {\n id: string;\n name: string;\n size: number;\n /** Durable artifact-relative path, never a bearer URL. */\n artifactPath: string;\n registeredAt: string;\n}\n\nexport interface IosActivityPayload {\n supported: boolean;\n devices: IosDeviceView[];\n build?: IosBuildView;\n error?: string;\n}\n\nexport type IosFrameReply =\n | { state: 'ok'; src: string; hash: string; capturedAt: number }\n | { state: 'unchanged'; hash: string; capturedAt: number }\n | { state: 'released' }\n | { state: 'capture-unavailable'; message: string }\n | { state: 'error'; message: string };\n\nexport type IosBuildShareReply =\n | { ok: true; url: string; expiresAt: number }\n | { ok: false; reason: 'remote-off' | 'changed' | 'missing' | 'unavailable'; message: string };\n","import { definePoPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\nconst Availability = Type.Union([Type.Literal('available'), Type.Literal('excluded')]);\nconst Pool = Type.Object({\n minBooted: Type.Number(),\n maxBooted: Type.Number(),\n maxDevices: Type.Number(),\n idleShutdownMinutes: Type.Number(),\n waitTimeoutSeconds: Type.Number(),\n deviceType: Type.Optional(Type.String()),\n runtime: Type.Optional(Type.String()),\n});\n\n/** Read-only activation snapshot and discovered inventory. Never starts signing, leases or runtimes. */\nexport const iosSettingsMethod = definePoPluginMethod({\n service: 'ios',\n method: 'settings',\n scope: 'host',\n direction: 'client-to-server',\n input: Type.Object({}, { additionalProperties: false }),\n output: Type.Object({\n active: Type.Boolean(),\n configFile: Type.String(),\n applied: Type.Optional(\n Type.Object({\n pool: Pool,\n developmentTeam: Type.Optional(Type.String()),\n availability: Type.Record(Type.String(), Availability),\n }),\n ),\n phones: Type.Array(\n Type.Object({\n udid: Type.String(),\n name: Type.String(),\n paired: Type.Boolean(),\n connected: Type.Boolean(),\n leased: Type.Boolean(),\n availability: Availability,\n }),\n ),\n runtimes: Type.Array(\n Type.Object({\n identifier: Type.String(),\n name: Type.String(),\n isAvailable: Type.Boolean(),\n models: Type.Array(Type.Object({ identifier: Type.String(), name: Type.String() })),\n }),\n ),\n inventoryError: Type.Optional(Type.String()),\n runtimeError: Type.Optional(Type.String()),\n }),\n});\n","import { definePoPluginMethod } from '@agimon-ai/po-core/pluginProtocol';\nimport { Type } from 'typebox';\n\nimport { iosUiService } from '../types/iosUi';\n\nconst address = { service: iosUiService, scope: 'session', direction: 'client-to-server' } as const;\nconst Hash = Type.String({ pattern: '^[a-f0-9]{64}$' });\nconst CapturedAt = Type.Number({ minimum: 0 });\n\nexport const IosActivitySchema = Type.Object({\n supported: Type.Boolean(),\n devices: Type.Array(\n Type.Object({\n id: Type.String(),\n name: Type.String(),\n kind: Type.Union([Type.Literal('simulator'), Type.Literal('device')]),\n detail: Type.String(),\n state: Type.Union([\n Type.Literal('owned'),\n Type.Literal('other-session'),\n Type.Literal('available'),\n Type.Literal('disconnected'),\n ]),\n leaseId: Type.Optional(Type.String()),\n capture: Type.Union([Type.Literal('available'), Type.Literal('unsupported')]),\n }),\n ),\n build: Type.Optional(\n Type.Object({\n id: Type.String(),\n name: Type.String(),\n size: Type.Integer({ minimum: 0 }),\n artifactPath: Type.String(),\n registeredAt: Type.String(),\n }),\n ),\n error: Type.Optional(Type.String()),\n});\n\nexport const iosStatusMethod = definePoPluginMethod({\n ...address,\n method: 'status',\n input: Type.Object({}, { additionalProperties: false }),\n output: IosActivitySchema,\n});\n\nexport const iosFrameMethod = definePoPluginMethod({\n ...address,\n method: 'frame',\n input: Type.Object(\n { leaseId: Type.String({ minLength: 1, maxLength: 128 }), since: Type.Optional(Hash) },\n { additionalProperties: false },\n ),\n output: Type.Union([\n Type.Object({\n state: Type.Literal('ok'),\n src: Type.String({ maxLength: 6 * 1024 * 1024 }),\n hash: Hash,\n capturedAt: CapturedAt,\n }),\n Type.Object({ state: Type.Literal('unchanged'), hash: Hash, capturedAt: CapturedAt }),\n Type.Object({ state: Type.Literal('released') }),\n Type.Object({ state: Type.Literal('capture-unavailable'), message: Type.String() }),\n Type.Object({ state: Type.Literal('error'), message: Type.String() }),\n ]),\n});\n\nexport const iosShareBuildMethod = definePoPluginMethod({\n ...address,\n method: 'shareBuild',\n input: Type.Object({ buildId: Type.String({ minLength: 16, maxLength: 128 }) }, { additionalProperties: false }),\n output: Type.Union([\n Type.Object({ ok: Type.Literal(true), url: Type.String(), expiresAt: Type.Number() }),\n Type.Object({\n ok: Type.Literal(false),\n reason: Type.Union([\n Type.Literal('remote-off'),\n Type.Literal('changed'),\n Type.Literal('missing'),\n Type.Literal('unavailable'),\n ]),\n message: Type.String(),\n }),\n ]),\n});\n","import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\nimport { iosActivityChannel } from '../types/iosUi';\nimport { iosSettingsMethod } from './iosSettingsMethods';\nimport { IosActivitySchema, iosFrameMethod, iosShareBuildMethod, iosStatusMethod } from './iosUiMethods';\n\nexport const apiContracts = defineApiContract({\n version: 1,\n http: [],\n dynamic: [],\n sockets: [\n ...[iosStatusMethod, iosFrameMethod, iosShareBuildMethod].map((method) => ({\n id: `ios.${method.method}`,\n scope: 'session' as const,\n service: method.service,\n member: method.method,\n kind: 'method' as const,\n direction: 'client-to-server' as const,\n description: `Session-owned iOS ${method.method}.`,\n input: method.input,\n output: method.output,\n })),\n {\n id: 'ios.settings',\n scope: 'host',\n service: iosSettingsMethod.service,\n member: iosSettingsMethod.method,\n kind: 'method',\n direction: 'client-to-server',\n description: 'Applied iOS configuration and discovered inventory.',\n input: iosSettingsMethod.input,\n output: iosSettingsMethod.output,\n },\n {\n id: 'ios.activity',\n scope: 'session',\n service: 'po.hub',\n member: iosActivityChannel,\n kind: 'channel',\n direction: 'server-to-client',\n description: 'Real session iOS devices and registered build metadata.',\n input: IosActivitySchema,\n },\n ],\n});\nexport default apiContracts;\n"],"mappings":";;;;;AACA,MAAa,qBAAqB;;;ACElC,MAAM,eAAe,KAAK,MAAM,CAAC,KAAK,QAAQ,WAAW,GAAG,KAAK,QAAQ,UAAU,CAAC,CAAC;AACrF,MAAM,OAAO,KAAK,OAAO;CACvB,WAAW,KAAK,OAAO;CACvB,WAAW,KAAK,OAAO;CACvB,YAAY,KAAK,OAAO;CACxB,qBAAqB,KAAK,OAAO;CACjC,oBAAoB,KAAK,OAAO;CAChC,YAAY,KAAK,SAAS,KAAK,OAAO,CAAC;CACvC,SAAS,KAAK,SAAS,KAAK,OAAO,CAAC;AACtC,CAAC;;AAGD,MAAa,oBAAoB,qBAAqB;CACpD,SAAS;CACT,QAAQ;CACR,OAAO;CACP,WAAW;CACX,OAAO,KAAK,OAAO,CAAC,GAAG,EAAE,sBAAsB,MAAM,CAAC;CACtD,QAAQ,KAAK,OAAO;EAClB,QAAQ,KAAK,QAAQ;EACrB,YAAY,KAAK,OAAO;EACxB,SAAS,KAAK,SACZ,KAAK,OAAO;GACV,MAAM;GACN,iBAAiB,KAAK,SAAS,KAAK,OAAO,CAAC;GAC5C,cAAc,KAAK,OAAO,KAAK,OAAO,GAAG,YAAY;EACvD,CAAC,CACH;EACA,QAAQ,KAAK,MACX,KAAK,OAAO;GACV,MAAM,KAAK,OAAO;GAClB,MAAM,KAAK,OAAO;GAClB,QAAQ,KAAK,QAAQ;GACrB,WAAW,KAAK,QAAQ;GACxB,QAAQ,KAAK,QAAQ;GACrB,cAAc;EAChB,CAAC,CACH;EACA,UAAU,KAAK,MACb,KAAK,OAAO;GACV,YAAY,KAAK,OAAO;GACxB,MAAM,KAAK,OAAO;GAClB,aAAa,KAA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