Skip to content
Merged
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 .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,8 @@ ENABLE_JAPANESE_CONTEXT_READING=false
# BEGIN GENERATED CONFIG: desktop_extensions
# Extension downloads
# END GENERATED CONFIG: desktop_extensions

# BEGIN GENERATED CONFIG: auip_interaction
# AI application interaction
# AUIP_INTERACTION_ENABLED=true
# END GENERATED CONFIG: auip_interaction
28 changes: 28 additions & 0 deletions config/catalog/general/application_interaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"id": "auip_interaction",
"title": {
"en-US": "AI application interaction",
"zh-CN": "AI 应用交互"
},
"description": {
"en-US": "Choose whether Amadeus joins AUIP applications from conversation. Creating, opening and manually using apps stays available.",
"zh-CN": "选择 Amadeus 是否从对话中参与 AUIP 应用。创建、打开和手动使用应用始终可用。"
},
"desktop": true,
"apply": "host",
"config": {
"AUIP_INTERACTION_ENABLED": {
"type": "boolean",
"title": {
"en-US": "Let Amadeus interact with applications",
"zh-CN": "允许 Amadeus 与应用交互"
},
"description": {
"en-US": "When off, chat stops evaluating AUIP and Amadeus starts no new application sessions. If applications are already open, they keep working and chat can still direct them until the last one ends; turning it back on cancels the pending shutdown. Saved across restarts.",
"zh-CN": "关闭后,聊天不再评估 AUIP,Amadeus 也不再启动新的应用会话。若已有应用在运行,它们可继续使用,聊天仍可操作,直到最后一个结束;重新开启会取消待关闭状态。跨重启保存。"
},
"default": true,
"runtime_key": "auip_interaction_enabled"
}
}
}
1 change: 1 addition & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
_catalog_values = read_catalog_environment(_ENV)
AMADEUS_CHARACTER_ID: str = _catalog_values["AMADEUS_CHARACTER_ID"]
AMADEUS_MAIN_CHAT_CHARACTER_PROMPT_JA: str = _catalog_values["AMADEUS_MAIN_CHAT_CHARACTER_PROMPT_JA"]
AUIP_INTERACTION_ENABLED: bool = _catalog_values["AUIP_INTERACTION_ENABLED"]
AUIP_ARTIFACT_STYLE_ENABLED: bool = _catalog_values["AUIP_ARTIFACT_STYLE_ENABLED"]
VTS_ENABLED: bool = _catalog_values["VTS_ENABLED"]
VTS_WS_URL: str = _catalog_values["VTS_WS_URL"]
Expand Down
37 changes: 37 additions & 0 deletions docs/auip_application_sessions.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,43 @@ The role may interpret the user's intent or narrate a verified transition, but
its prose is never proof that an action ran. Completion belongs to the
Host-accepted receipt path.

## Turning AI application interaction off

**Settings → Providers → AI application interaction** is one persisted, global
switch (`AUIP_INTERACTION_ENABLED`, default on). It applies to the running
backend immediately and is saved across restarts. It withdraws model
participation only; it is not the `AUIP_CONTROL_DECISION_ENABLED` control-path
selector, which chooses between the current and legacy proposal paths.

Turning it off while no AppSession is active takes effect at once. With any
AppSession active, the switch is **pending off**: Main Chat keeps its usual AUIP
evaluation on every turn, and every session that was active can continue, so a
user can still direct a running game from chat. The Host starts no new AppSession
while shutdown is pending, including a launch requested earlier or deferred until
Work finishes. Admission enforces this: while the switch is off or pending off,
registration through any attach ticket and a self-attach request are refused
with `auip_interaction_disabled`, and the application stays standalone, as with
"Not now". When the last active AppSession ends, the switch takes effect.
Turning it back on during that period cancels the pending shutdown.

Once it has taken effect:

- ordinary chat makes no AUIP entry or control model call and receives no app
launch candidates or focused-app context, even when historical projects,
launchable apps or active Work exist;
- Amadeus takes no participant turns, issues no automatic or controller
actions, and adds no AUIP narration; requests to collaborate or delegate are
refused with `auip_interaction_disabled`, and so is a control decided before
the last session ended;
- creating apps through Work, opening them, and using them by hand remain
available, along with AppSession identity, permission checks and receipts.
An app opened this way stays standalone, and the Work page says so instead
of waiting for it to connect. To connect it, turn the switch back on and
reopen the app.

Turning it back on restores entry, participation and narration for later turns
with no replay.

## Disconnect and recovery behavior

A lost application connection becomes a visible `disconnected` AppSession
Expand Down
5 changes: 5 additions & 0 deletions electron/src/renderer/components/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,8 @@ export default function SettingsPage({ send, subscribe, connected, reconnectBack
}
} else if (targetSection === 'general') {
anchor = targetId?.includes('visual') ? 'settings-vision' : targetId?.includes('translation') ? 'settings-language' : ''
} else if (targetSection === 'providers' && targetId === 'application_interaction') {
anchor = 'settings-auip-interaction'
}
if (anchor) window.setTimeout(() => document.getElementById(anchor)?.scrollIntoView({ behavior: 'smooth', block: 'start' }), 0)
}, [openCharacters, setSection])
Expand Down Expand Up @@ -1579,6 +1581,9 @@ export default function SettingsPage({ send, subscribe, connected, reconnectBack
{(Array.isArray(config.acp_credentials) ? config.acp_credentials as StartupField[] : []).map(field =>
<StartupFieldRow key={field.key} field={field} desktop={desktop} onSave={handleStartupSave}/>)}
</SettingsGroup>
<div id="settings-auip-interaction"><SettingsGroup title={catalogGroups.find(group => group.id === 'auip_interaction')!.title['en-US']} detail={catalogGroups.find(group => group.id === 'auip_interaction')!.description['en-US']}>
{renderRuntimeGroup('auip_interaction', 'CommandPrompt')}
</SettingsGroup></div>
<SettingsGroup title="Artifact appearance" detail="Generation preferences for new interactive apps. Save and restart the backend to apply.">
{artifactConfiguration.map(group => <ConfigurationCard key={group.id} group={group} desktop={desktop} onSave={handleStartupSave} icon="Palette" />)}
</SettingsGroup>
Expand Down
30 changes: 22 additions & 8 deletions electron/src/renderer/components/WorkPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,18 +556,25 @@ export default function WorkPage({ send, subscribe, connected }: WorkPageProps)
if (!launchUrl) throw new Error('The host did not return an AUIP launch descriptor.')
if (!artifactRef) throw new Error('The host did not bind the AUIP launch to an artifact.')
if (!hostSurfaceId) throw new Error('The host did not bind an AUIP surface identity.')
setAuipExperience({
artifactRef,
title: 'AUIP application',
status: 'connecting',
})
// With AI application interaction off, the Host refuses the registration,
// so the app opens on its own and no connection will follow.
const standalone = prepared.auip_interaction_enabled === false
if (!standalone) {
setAuipExperience({
artifactRef,
title: 'AUIP application',
status: 'connecting',
})
}
const opened = await window.amadeus?.openAuipApp(launchUrl, hostSurfaceId, workItemId)
if (!opened?.ok) {
throw new Error(opened?.detail || 'The desktop host refused the AUIP launch URL.')
}
setAuipLaunchFeedback({
status: 'success',
message: 'Application opened. Its one-time Attach ticket is waiting for registration.',
message: standalone
? 'AI application interaction is off, so the application opened on its own. Turn it on in Settings → Providers to let Amadeus join.'
: 'Application opened. Its one-time Attach ticket is waiting for registration.',
})
} catch (error) {
setAuipExperience(undefined)
Expand Down Expand Up @@ -721,6 +728,13 @@ export default function WorkPage({ send, subscribe, connected }: WorkPageProps)
return () => unsubscribe()
}, [applyWorkEnvelope, subscribe])

// A refused host control, e.g. auip_interaction_disabled, changes no
// AppSession state, so no auip.updated arrives to explain it.
const showAuipRefusal = useCallback((result: Record<string, unknown>) => {
if (result.ok !== false) return
setAuipExperience(previous => previous && { ...previous, operatorError: String(result.error || 'auip_request_refused') })
}, [])

useEffect(() => {
const unsubscribe = subscribe('auip.updated', payload => {
setAuipExperience(previous => {
Expand Down Expand Up @@ -1327,14 +1341,14 @@ export default function WorkPage({ send, subscribe, connected }: WorkPageProps)
void send('auip.mode.set', {
app_session_id: auipExperience.appSessionId,
mode,
})
}).then(showAuipRefusal)
}}
onStep={() => {
if (!auipExperience.appSessionId) return
void send('auip.step', {
app_session_id: auipExperience.appSessionId,
instruction: 'Take one appropriate declared action now.',
})
}).then(showAuipRefusal)
}}
onLeave={() => {
if (!auipExperience.appSessionId) return
Expand Down
14 changes: 9 additions & 5 deletions electron/src/renderer/components/sceneCapabilityProjection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,17 +657,21 @@ export function buildCapabilityProfiles(
const modelRoles = groups(settings.model_roles)
const auipAction = findGroup(modelRoles, 'auip_action')
const auipReady = groupAvailable(auipAction)
// The user's switch outranks role readiness: off is a choice, not a fault.
const auipTurnedOff = backendFactsAvailable && settings.auip_interaction_enabled === false
const auipItem: SceneCapabilityItem = {
id: 'application_interaction',
label: 'Application interaction',
implementation: 'Host AUIP runtime · action role',
detail: groupDetail(auipAction, 'The Host owns AUIP session identity, action legality, receipts, and application attachment.'),
detail: auipTurnedOff
? 'AI application interaction is turned off. Apps can still be created, opened and used manually.'
: groupDetail(auipAction, 'The Host owns AUIP session identity, action legality, receipts, and application attachment.'),
importance: 'optional',
state: !backendFactsAvailable ? 'unknown' : auipReady ? 'ready' : 'attention',
stateLabel: !backendFactsAvailable ? 'Backend not connected' : auipReady ? 'Available' : 'Action role needs setup',
state: !backendFactsAvailable ? 'unknown' : auipTurnedOff ? 'inactive' : auipReady ? 'ready' : 'attention',
stateLabel: !backendFactsAvailable ? 'Backend not connected' : auipTurnedOff ? 'Turned off' : auipReady ? 'Available' : 'Action role needs setup',
policyLabel: 'Shared conversation capability',
currentLabel: auipAction?.active ? 'B2 action role active' : 'Observe or legacy mode',
configureSection: 'models',
currentLabel: auipTurnedOff ? 'Off' : auipAction?.active ? 'B2 action role active' : 'Observe or legacy mode',
configureSection: auipTurnedOff ? 'providers' : 'models',
}
const applicationInteraction: CapabilityProfile = {
id: 'application_interaction',
Expand Down
2 changes: 2 additions & 0 deletions electron/src/renderer/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"ACP v1 preset using a referenced DeepSeek credential.": "使用所引用 DeepSeek 凭据的 ACP v1 预设。",
"ACTIVE": "活动",
"ACTIVE SESSION": "活动会话",
"AI application interaction is turned off. Apps can still be created, opened and used manually.": "AI 应用交互已关闭。应用仍可创建、打开并手动使用。",
"AMADEUS AI WORK INTERFACE": "AMADEUS AI 工作界面",
"AUIP ASSEMBLING": "正在组装 AUIP",
"AUIP ATTACHING": "正在附加 AUIP",
Expand Down Expand Up @@ -1271,6 +1272,7 @@
"Turn Timeline / Work Plan": "轮次时间线 / 工作计划",
"Turn off automatic approval": "关闭自动审批",
"Turn this on in Companion settings.": "请在陪玩设置中开启此功能。",
"Turned off": "已关闭",
"Type a message or press mic to speak...": "输入消息,或按麦克风开始说话…",
"Type a message to start.": "输入消息开始对话。",
"Typed and spoken questions include a fresh game image. Notes and pins remain text-only.": "文字或语音提问会附上当时的新画面,笔记和标记仅保存文字。",
Expand Down
28 changes: 28 additions & 0 deletions electron/src/shared/configCatalog.generated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions electron/tests/auipInteractionSettings.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import assert from 'node:assert/strict'
import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import test from 'node:test'
import { loadTypeScript } from './helpers/loadTypeScript.mjs'

const key = 'AUIP_INTERACTION_ENABLED'

test('AI application interaction defaults on and is a live, desktop-persisted setting', () => {
const { catalogApplication, desktopCatalogFields, runtimeCatalogFields } = loadTypeScript(new URL('../src/shared/configCatalog.ts', import.meta.url))
assert.equal(desktopCatalogFields[key]?.default, true)
assert.equal(runtimeCatalogFields.auip_interaction_enabled?.key, key)
assert.equal(catalogApplication(key), 'host')
})

test('the AI application interaction choice survives desktop settings reloads', t => {
const { DesktopSettingsStore } = loadTypeScript(new URL('../src/main/desktopSettings.ts', import.meta.url), {
electron: { safeStorage: { isEncryptionAvailable: () => false } },
})
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'amadeus-auip-interaction-'))
t.after(() => fs.rmSync(directory, { recursive: true, force: true }))
const open = () => new DesktopSettingsStore(path.join(directory, 'settings.json'), path.join(directory, '.env'))
assert.equal(open().backendEnvironment({})[key], undefined)
for (const value of [false, true]) {
open().update({}, { values: { [key]: value } })
assert.equal(open().backendEnvironment({})[key], String(value))
}
assert.throws(() => open().update({}, { values: { [key]: 'sometimes' } }))
})
2 changes: 1 addition & 1 deletion electron/tests/i18nCatalog.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test('capability projection text has a translated entry in every configuration',
snapshots.push({
llm_provider: llm, wake_enabled: voice, aec_realtime_enabled: voice, aec_realtime_barge_in: voice,
wallpaper_caption_mode: caption, chat_translation_subtitles_enabled: voice,
vision_enabled: enabled, vision_mode: mode, vision_scope: scope,
vision_enabled: enabled, vision_mode: mode, vision_scope: scope, auip_interaction_enabled: voice,
model_connections: ['deepseek', 'openai', 'gemini', 'bedrock', 'local', 'hybrid_local'].map(id => group(id, configured)),
voice_configuration: [
group('speech_synthesis', configured, { TTS_BACKEND: voice ? 'gpt_sovits' : 'fish_audio' }, { active: true }),
Expand Down
18 changes: 18 additions & 0 deletions electron/tests/sceneCapabilityProjection.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,21 @@ test('Work readiness remains unknown without backend facts regardless of a store
assert.equal(capabilities.find(item => item.id === 'work_execution').state, 'unknown')
}
})

test('turning AI application interaction off reads as a choice that points to its switch', () => {
const snapshot = configuredSnapshot()
snapshot.model_roles = [group('auip_action', true, {}, { active: true, status_ok: true })]
const availability = [{ provider_id: 'pi', configured: true, ready: true, registered: true, reason: 'ready' }]
const find = settings => exports.buildCapabilityProfiles(settings, availability)
.find(item => item.id === 'application_interaction')
const on = find({ ...snapshot, auip_interaction_enabled: true })
assert.equal(on.state, 'ready')
assert.equal(on.configureSection, 'models')
const off = find({ ...snapshot, auip_interaction_enabled: false })
assert.equal(off.state, 'inactive')
assert.equal(off.stateLabel, 'Turned off')
assert.equal(off.configureSection, 'providers')
assert.match(off.scenes.find(scene => scene.sceneId === 'chat').detail, /used manually/)
// An older backend that does not report the switch keeps the previous projection.
assert.equal(find(snapshot).state, 'ready')
})
16 changes: 15 additions & 1 deletion server/auip_engagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
AuipParticipantProposal,
ControllerCallable,
)
from server.auip_runtime import PENDING_ACTION_TIMEOUT_S, AuipRuntime, runtime
from server.auip_runtime import (
PENDING_ACTION_TIMEOUT_S,
AuipRuntime,
runtime,
)
from server.event_bus import bus
from server.protocol import Method

Expand Down Expand Up @@ -100,6 +104,11 @@ def set_b2_coordinator(

async def set_mode(self, *, app_session_id: str, mode: str) -> dict[str, Any]:
clean_requested = str(mode or "").strip().lower()
if (
clean_requested in {"collaborate", "delegate"}
and not self.runtime.ai_interaction_in_effect()
):
raise AuipProtocolError("auip_interaction_disabled")
if clean_requested == "delegate" and (
self.controller is None or self.role_authorizer is None
):
Expand Down Expand Up @@ -129,6 +138,8 @@ def request_step(
expected_revision: int | None = None,
current_role_response: str = "",
) -> dict[str, Any]:
if not self.runtime.ai_interaction_in_effect():
raise AuipProtocolError("auip_interaction_disabled")
if str(reason or "") == "explicit_step":
self._cancel_deferred_automatic(app_session_id)
b2_unavailable = bool(
Expand Down Expand Up @@ -220,6 +231,9 @@ async def on_update(self, _method: str, payload: dict[str, Any]) -> None:
self._remember_receipt(receipt_key)
if app_session_id and str(payload.get("status") or "") != "active":
self._cancel_receipt_watch(app_session_id)
if not self.runtime.ai_interaction_in_effect():
# Receipt bookkeeping above stays truthful; no new turn is offered.
return
event = payload.get("event") if isinstance(payload.get("event"), dict) else None
if event is None:
return
Expand Down
Loading
Loading