Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(pi): extend the cross-end schedule contract to Pi so mobile identifies/creates Pi automations
Chris2e25ed9a204f
diff --git a/apps/mobile/app/automations/[deviceId].tsx b/apps/mobile/app/automations/[deviceId].tsxindex f389cae29a..172e8cbf06 100644--- a/apps/mobile/app/automations/[deviceId].tsx+++ b/apps/mobile/app/automations/[deviceId].tsx@@ -1300,6 +1300,13 @@ function ScheduleFormCard({onPress={() => onChange(updateDraftAgentKind(draft, 'codex'))}testID="automations.form.agentCodex"/>+ <SegmentButton+ active={draft.agentKind === 'pi'}+ disabled={busy || hasRealBinding}+ label="Pi"+ onPress={() => onChange(updateDraftAgentKind(draft, 'pi'))}+ testID="automations.form.agentPi"+ /></View></View>@@ -1309,7 +1316,7 @@ function ScheduleFormCard({autoCapitalize="none"editable={!busy}onChangeText={(value) => setField('model', value)}- placeholder={hasRealBinding ? t('devices.automations.form.modelPlaceholderBound') : draft.agentKind === 'codex' ? 'gpt-5.5' : 'claude-sonnet-4-6'}+ placeholder={hasRealBinding ? t('devices.automations.form.modelPlaceholderBound') : draft.agentKind === 'codex' ? 'gpt-5.5' : draft.agentKind === 'pi' ? t('devices.automations.form.modelPlaceholderPiDefault') : 'claude-sonnet-4-6'}placeholderTextColor={colors.textTertiary}style={styles.input}testID="automations.form.modelInput"@@ -1331,7 +1338,7 @@ function ScheduleFormCard({/></View>- {draft.agentKind === 'codex' && !hideWorkspaceFields ? (+ {(draft.agentKind === 'codex' || draft.agentKind === 'pi') && !hideWorkspaceFields ? (<ToggleRowactive={draft.fastMode}disabled={busy}diff --git a/apps/mobile/src/__tests__/scheduleModel.test.ts b/apps/mobile/src/__tests__/scheduleModel.test.tsindex 0f04ab85bd..29c485a9f2 100644--- a/apps/mobile/src/__tests__/scheduleModel.test.ts+++ b/apps/mobile/src/__tests__/scheduleModel.test.ts@@ -102,6 +102,12 @@ describe('schedule model', () => {});});+ it('labels a Pi automation as Pi (not silently mis-shown as Claude)', () => {+ // 桌面创建的 agentKind:'pi' 任务在手机上必须正确标识为 Pi,而不是回落到 Claude。+ expect(summarizeSchedule(schedule({ agentKind: 'pi' }), [], NOW).detail)+ .toBe('cron 0 9 * * * · 新任务 · Pi · xdt-maker');+ });+it('summarizes persistent and bound schedule session behavior', () => {expect(summarizeSchedule(schedule({persistentSession: true,diff --git a/apps/mobile/src/i18n/locales/en/devices.json b/apps/mobile/src/i18n/locales/en/devices.jsonindex 1a875015a6..d97b9c5931 100644--- a/apps/mobile/src/i18n/locales/en/devices.json+++ b/apps/mobile/src/i18n/locales/en/devices.json@@ -249,6 +249,7 @@},"useWorktree": "Use worktree","modelPlaceholderBound": "Follow session",+ "modelPlaceholderPiDefault": "Leave blank for default model","fastMode": "Fast Mode","notifyDesktop": "Desktop Notifications","notifyFeishu": "Feishu Notifications",diff --git a/apps/mobile/src/i18n/locales/ja/devices.json b/apps/mobile/src/i18n/locales/ja/devices.jsonindex 462a097693..ca8110a830 100644--- a/apps/mobile/src/i18n/locales/ja/devices.json+++ b/apps/mobile/src/i18n/locales/ja/devices.json@@ -249,6 +249,7 @@},"useWorktree": "worktree を使用","modelPlaceholderBound": "セッションに従う",+ "modelPlaceholderPiDefault": "空欄でデフォルトモデル","fastMode": "Fast モード","notifyDesktop": "デスクトップ通知","notifyFeishu": "Feishu 通知",diff --git a/apps/mobile/src/i18n/locales/ko/devices.json b/apps/mobile/src/i18n/locales/ko/devices.jsonindex b355d5c168..2b19278944 100644--- a/apps/mobile/src/i18n/locales/ko/devices.json+++ b/apps/mobile/src/i18n/locales/ko/devices.json@@ -249,6 +249,7 @@},"useWorktree": "worktree 사용","modelPlaceholderBound": "세션 따르기",+ "modelPlaceholderPiDefault": "비워두면 기본 모델","fastMode": "Fast 모드","notifyDesktop": "데스크톱 알림","notifyFeishu": "Feishu 알림",diff --git a/apps/mobile/src/i18n/locales/zh-CN/devices.json b/apps/mobile/src/i18n/locales/zh-CN/devices.jsonindex 9985d4be2d..ce7be0767c 100644--- a/apps/mobile/src/i18n/locales/zh-CN/devices.json+++ b/apps/mobile/src/i18n/locales/zh-CN/devices.json@@ -249,6 +249,7 @@},"useWorktree": "使用 worktree","modelPlaceholderBound": "跟随任务",+ "modelPlaceholderPiDefault": "留空使用默认模型","fastMode": "Fast 模式","notifyDesktop": "桌面通知","notifyFeishu": "飞书通知",diff --git a/packages/maker-shared/src/__tests__/scheduleForm.test.ts b/packages/maker-shared/src/__tests__/scheduleForm.test.tsindex 28e3e1ae6e..caa6b3de4b 100644--- a/packages/maker-shared/src/__tests__/scheduleForm.test.ts+++ b/packages/maker-shared/src/__tests__/scheduleForm.test.ts@@ -173,6 +173,20 @@ describe('mobile schedule form model', () => {expect(buildMobileScheduleInput({ ...claude, name: 'Claude', prompt: 'run' })).not.toHaveProperty('fastMode');});+ it('supports Pi automations: blank default model (host-resolved) and explicit fast mode', () => {+ // Pi 模型来自动态 BYOM 目录:切到 Pi 时 model 留空 → 序列化省略 → host 解析默认。+ const draft = updateDraftAgentKind(createMobileScheduleDraft(null), 'pi');+ expect(draft.model).toBe('');+ const input = buildMobileScheduleInput({ ...draft, name: 'Pi task', prompt: 'run', fastMode: true });+ expect(input).toMatchObject({ agentKind: 'pi', fastMode: true });+ // 空模型不写入(host 解析默认),而非发一个空串把默认覆盖掉。+ expect(hasOwn(input, 'model')).toBe(false);++ // 用户在自由文本框显式指定 Pi 模型时照常带上。+ const withModel = buildMobileScheduleInput({ ...draft, name: 'Pi task', prompt: 'run', model: 'my-local-model' });+ expect(withModel).toMatchObject({ agentKind: 'pi', model: 'my-local-model' });+ });+it('validates required fields and supported interval-style cron presets', () => {const draft = createMobileScheduleDraft(null);expect(validateMobileScheduleDraft(draft)).toMatchObject({ field: 'name' });diff --git a/packages/maker-shared/src/scheduleForm.ts b/packages/maker-shared/src/scheduleForm.tsindex e176366376..95e3d6804d 100644--- a/packages/maker-shared/src/scheduleForm.ts+++ b/packages/maker-shared/src/scheduleForm.ts@@ -294,7 +294,9 @@ export function buildMobileScheduleInput(draft: MobileScheduleDraft): RemoteScheif (model) input.model = model;const effort = draft.effort.trim();if (isMobileScheduleEffort(effort)) input.effort = effort;- if (draft.agentKind === 'codex') input.fastMode = draft.fastMode;+ // Fast 对 Codex 与 Pi 都生效(runner 对 claude-code 忽略此字段,并按模型 supportsFastMode+ // 收口);只序列化 codex 会让 Pi 任务里开的 Fast 被静默丢弃。+ if (draft.agentKind === 'codex' || draft.agentKind === 'pi') input.fastMode = draft.fastMode;return input;}@@ -413,7 +415,11 @@ function hasTemplateParam(params: Record<string, string>, key: string): boolean}function defaultModelFor(agentKind: RemoteScheduleAgentKind): string {- return agentKind === 'codex' ? DEFAULT_CODEX_MODEL : DEFAULT_CLAUDE_MODEL;+ if (agentKind === 'codex') return DEFAULT_CODEX_MODEL;+ // Pi 模型来自动态 BYOM 供应商目录,没有固定默认 id;留空 → 序列化时省略 → host 解析+ // 该 Pi agent 的当前默认模型(用户仍可在自由文本模型框里显式指定)。+ if (agentKind === 'pi') return '';+ return DEFAULT_CLAUDE_MODEL;}function validateIntervalMinutes(value: string): string | null {diff --git a/packages/maker-shared/src/scheduleModel.ts b/packages/maker-shared/src/scheduleModel.tsindex 84f53f2d84..711a395844 100644--- a/packages/maker-shared/src/scheduleModel.ts+++ b/packages/maker-shared/src/scheduleModel.ts@@ -354,6 +354,7 @@ function formatRunDuration(ms: number): string {function humanizeAgentKind(agentKind: RemoteSchedule['agentKind']): string {if (agentKind === 'codex') return 'Codex';+ if (agentKind === 'pi') return 'Pi';return 'Claude';}diff --git a/packages/maker-shared/src/scheduleTypes.ts b/packages/maker-shared/src/scheduleTypes.tsindex 75f2d7a247..e1ee4c8ea6 100644--- a/packages/maker-shared/src/scheduleTypes.ts+++ b/packages/maker-shared/src/scheduleTypes.ts@@ -1,5 +1,5 @@export type RemoteScheduleStatus = 'active' | 'paused' | 'expired';-export type RemoteScheduleAgentKind = 'claude-code' | 'codex';+export type RemoteScheduleAgentKind = 'claude-code' | 'codex' | 'pi';export type RemoteScheduleWorkspaceKind = 'project' | 'dialogue';export type RemoteScheduleRunStatus = 'running' | 'success' | 'failed' | 'aborted' | 'interrupted' | 'skipped';export type RemoteScheduleExecutionMode = 'agent' | 'script';