Requested by ZhehanZ · project thread
Summary of changes
- A skill is filed under the app its first step acts in (
Routine.workingApp). A launch counts for the app it opens, not the app it was sent from. Steps still recorded in the app that Home left are passed over until a step is recorded somewhere else. The home screen and Poki count for no app. This is the app the Memory page groups by, the app "routines for this app" offers, and the app a run launches first. - A run records its steps in the app it went to (its own app launched first, or a launch step), so a task saved again after a run keeps its app.
- An agent's
editthat replaces the steps works the app out again. - Upgrade: the memory file now carries
appRule: 1. A file or backup without it (everything 0.4.5 and earlier wrote) has its skills, and the change log's copies of them, worked out again once, when it is opened or imported. Opening writesagent-memory.jsonback but leaves the backup copy inDocuments/AgentBackupalone, because that copy may be a restore from Poki Setup that is not merged in yet. A skill whose steps name no app keeps its own app, or moves to Other if that app was the home screen or Poki. docs/ios-core.mddescribes the rule.
Motivation (Closes #N)
Part of #529 (0.4.6 blocker): Xiaohongshu and 12306 skills showed up under WeChat.
Computer.routine(named:) took the app of the first step that named an element, else the first step's app. A launch step is recorded with the app in front before it. Poki does not read the screen between finishing one task and launching the next app, so in Poki's chat that is the app the previous task ended in. Xiaohongshu and 12306 are mostly tapped at points, so no step named an element and the launch's stale app won. testATaskSavedAfterOneInAnotherAppIsFiledUnderTheAppItWorkedIn reproduces it on main: a WeChat task, then a Xiaohongshu task by points, saves as "3 steps in com.tencent.xin".
Test plan
swift test --package-path native/ios/PokiCoreon Linux (Swift 6.4.2): all 341 tests pass, including the 10 new ones inRoutineAppTests.- With main's rule in place, 9 of the 10 new tests fail. The 10th checks that a file already kept by the new rule is left alone.
- Not run yet: the iOS app build and a phone. The change stays inside PokiCore and changes no public API. Still to check on a phone that has 0.4.5 skills: after the update, the Memory page shows the Xiaohongshu and 12306 skills under their own apps.
Overlap with #518
#518 renames routines to skills, gives MemoryFile its own coding keys, and keeps the old first-element rule in Skill.inferredApp(from:). Whichever of the two merges second needs appRule added to MemoryFile's coding keys, and workingApp used in place of inferredApp at save and in migrated(). Without the key, the file would be regrouped and written on every launch, and testAFileKeptByThisRuleIsNotWorkedOutAgain fails. If #518 lands first, this branch will be rebased onto it.
Screenshots or screen recording
N/A. No UI change: the Memory page reads the corrected app.
AI assistance: Other.
Thanks for finding how the previous app gets recorded. Could you port the stale-app and replay fixes onto main while keeping the last operated app as the skill’s owner?