@agent-native/core 0.92.12 → 0.94.0
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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +64 -0
- package/corpus/core/docs/content/a2a-protocol.mdx +21 -5
- package/corpus/core/docs/content/actions.mdx +9 -23
- package/corpus/core/docs/content/agent-mentions.mdx +31 -29
- package/corpus/core/docs/content/agent-native-toolkit.mdx +15 -6
- package/corpus/core/docs/content/agent-surfaces.mdx +9 -13
- package/corpus/core/docs/content/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/authentication.mdx +10 -3
- package/corpus/core/docs/content/automation-connectors.mdx +123 -0
- package/corpus/core/docs/content/automations.mdx +17 -3
- package/corpus/core/docs/content/blueprint-installer.mdx +11 -4
- package/corpus/core/docs/content/cli-adapters.mdx +9 -6
- package/corpus/core/docs/content/client.mdx +16 -0
- package/corpus/core/docs/content/cloneable-saas.mdx +14 -11
- package/corpus/core/docs/content/code-agents-ui.mdx +65 -0
- package/corpus/core/docs/content/components.mdx +30 -14
- package/corpus/core/docs/content/context-awareness.mdx +27 -15
- package/corpus/core/docs/content/creating-templates.mdx +15 -9
- package/corpus/core/docs/content/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/data-programs.mdx +1 -1
- package/corpus/core/docs/content/database.mdx +17 -5
- package/corpus/core/docs/content/deployment.mdx +19 -18
- package/corpus/core/docs/content/dispatch.mdx +6 -2
- package/corpus/core/docs/content/drop-in-agent.mdx +10 -4
- package/corpus/core/docs/content/durable-background-runs.mdx +9 -5
- package/corpus/core/docs/content/durable-resume.mdx +9 -4
- package/corpus/core/docs/content/embedding-sdk.mdx +26 -8
- package/corpus/core/docs/content/evals.mdx +3 -5
- package/corpus/core/docs/content/extensions.mdx +23 -2
- package/corpus/core/docs/content/external-agents.mdx +25 -34
- package/corpus/core/docs/content/faq.mdx +8 -0
- package/corpus/core/docs/content/file-uploads.mdx +12 -3
- package/corpus/core/docs/content/frames.mdx +16 -0
- package/corpus/core/docs/content/generative-ui.mdx +1 -1
- package/corpus/core/docs/content/getting-started.mdx +34 -21
- package/corpus/core/docs/content/harness-agents.mdx +8 -4
- package/corpus/core/docs/content/human-approval.mdx +8 -3
- package/corpus/core/docs/content/internationalization.mdx +9 -4
- package/corpus/core/docs/content/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/local-file-mode.mdx +14 -8
- package/corpus/core/docs/content/locales/ar-SA/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/ar-SA/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/ar-SA/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/ar-SA/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ar-SA/components.mdx +11 -1
- package/corpus/core/docs/content/locales/ar-SA/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/ar-SA/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/ar-SA/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/ar-SA/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +2 -7
- package/corpus/core/docs/content/locales/ar-SA/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/ar-SA/messaging.mdx +84 -15
- package/corpus/core/docs/content/locales/ar-SA/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/ar-SA/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/ar-SA/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/ar-SA/server.mdx +17 -10
- package/corpus/core/docs/content/locales/ar-SA/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/ar-SA/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/ar-SA/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/ar-SA/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/ar-SA/template-clips.mdx +4 -3
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/ar-SA/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/ar-SA/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/ar-SA/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/ar-SA/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/ar-SA/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/ar-SA/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/ar-SA/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/de-DE/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/de-DE/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/de-DE/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/de-DE/components.mdx +11 -1
- package/corpus/core/docs/content/locales/de-DE/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/de-DE/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/de-DE/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/de-DE/extensions.mdx +10 -0
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +3 -7
- package/corpus/core/docs/content/locales/de-DE/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/de-DE/messaging.mdx +92 -15
- package/corpus/core/docs/content/locales/de-DE/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/de-DE/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/de-DE/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/de-DE/server.mdx +18 -10
- package/corpus/core/docs/content/locales/de-DE/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/de-DE/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/de-DE/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/de-DE/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/de-DE/template-clips.mdx +4 -3
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/de-DE/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/de-DE/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/de-DE/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/de-DE/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/de-DE/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/de-DE/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/de-DE/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/es-ES/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/es-ES/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/es-ES/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/es-ES/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/es-ES/components.mdx +11 -1
- package/corpus/core/docs/content/locales/es-ES/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/es-ES/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/es-ES/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/es-ES/extensions.mdx +10 -0
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +3 -7
- package/corpus/core/docs/content/locales/es-ES/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/es-ES/messaging.mdx +91 -15
- package/corpus/core/docs/content/locales/es-ES/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/es-ES/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/es-ES/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/es-ES/server.mdx +17 -10
- package/corpus/core/docs/content/locales/es-ES/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/es-ES/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/es-ES/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/es-ES/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/es-ES/template-clips.mdx +4 -3
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/es-ES/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/es-ES/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/es-ES/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/es-ES/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/es-ES/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/es-ES/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/es-ES/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/fr-FR/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/fr-FR/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/fr-FR/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/fr-FR/components.mdx +11 -1
- package/corpus/core/docs/content/locales/fr-FR/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/fr-FR/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/fr-FR/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/fr-FR/extensions.mdx +10 -0
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +3 -7
- package/corpus/core/docs/content/locales/fr-FR/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/fr-FR/messaging.mdx +91 -15
- package/corpus/core/docs/content/locales/fr-FR/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/fr-FR/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/fr-FR/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/fr-FR/server.mdx +17 -10
- package/corpus/core/docs/content/locales/fr-FR/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/fr-FR/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/fr-FR/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/fr-FR/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/fr-FR/template-clips.mdx +4 -3
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/fr-FR/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/fr-FR/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/fr-FR/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/fr-FR/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/fr-FR/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/fr-FR/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/fr-FR/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/hi-IN/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/hi-IN/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/hi-IN/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/hi-IN/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/hi-IN/components.mdx +11 -1
- package/corpus/core/docs/content/locales/hi-IN/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/hi-IN/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/hi-IN/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/hi-IN/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +2 -7
- package/corpus/core/docs/content/locales/hi-IN/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/hi-IN/messaging.mdx +81 -15
- package/corpus/core/docs/content/locales/hi-IN/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/hi-IN/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/hi-IN/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/hi-IN/server.mdx +17 -10
- package/corpus/core/docs/content/locales/hi-IN/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/hi-IN/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/hi-IN/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/hi-IN/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/hi-IN/template-clips.mdx +4 -3
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/hi-IN/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/hi-IN/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/hi-IN/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/hi-IN/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/hi-IN/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/hi-IN/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/hi-IN/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/ja-JP/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/ja-JP/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/ja-JP/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/ja-JP/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ja-JP/components.mdx +11 -1
- package/corpus/core/docs/content/locales/ja-JP/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/ja-JP/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/ja-JP/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/ja-JP/extensions.mdx +9 -0
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +2 -7
- package/corpus/core/docs/content/locales/ja-JP/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/ja-JP/messaging.mdx +81 -15
- package/corpus/core/docs/content/locales/ja-JP/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/ja-JP/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/ja-JP/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/ja-JP/server.mdx +17 -10
- package/corpus/core/docs/content/locales/ja-JP/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/ja-JP/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/ja-JP/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/ja-JP/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/ja-JP/template-clips.mdx +4 -4
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/ja-JP/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/ja-JP/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/ja-JP/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/ja-JP/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/ja-JP/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/ja-JP/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/ja-JP/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/ko-KR/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/ko-KR/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/ko-KR/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/ko-KR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/ko-KR/components.mdx +11 -1
- package/corpus/core/docs/content/locales/ko-KR/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/ko-KR/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/ko-KR/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/extensions.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +2 -7
- package/corpus/core/docs/content/locales/ko-KR/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/ko-KR/messaging.mdx +80 -15
- package/corpus/core/docs/content/locales/ko-KR/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/ko-KR/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/ko-KR/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/ko-KR/server.mdx +17 -10
- package/corpus/core/docs/content/locales/ko-KR/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/ko-KR/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/ko-KR/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/ko-KR/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/ko-KR/template-clips.mdx +4 -4
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/ko-KR/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/ko-KR/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/ko-KR/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/ko-KR/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/ko-KR/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/ko-KR/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/ko-KR/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/pt-BR/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/pt-BR/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/pt-BR/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/pt-BR/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/pt-BR/components.mdx +11 -1
- package/corpus/core/docs/content/locales/pt-BR/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/pt-BR/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/pt-BR/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/pt-BR/extensions.mdx +9 -0
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +3 -7
- package/corpus/core/docs/content/locales/pt-BR/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/pt-BR/messaging.mdx +88 -15
- package/corpus/core/docs/content/locales/pt-BR/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/pt-BR/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/pt-BR/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/pt-BR/server.mdx +17 -10
- package/corpus/core/docs/content/locales/pt-BR/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/pt-BR/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/pt-BR/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/pt-BR/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/pt-BR/template-clips.mdx +4 -3
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/pt-BR/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/pt-BR/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/pt-BR/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/pt-BR/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/pt-BR/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/pt-BR/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/pt-BR/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/zh-CN/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-CN/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/zh-CN/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/zh-CN/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-CN/components.mdx +11 -1
- package/corpus/core/docs/content/locales/zh-CN/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/zh-CN/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/zh-CN/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-CN/extensions.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +2 -7
- package/corpus/core/docs/content/locales/zh-CN/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/zh-CN/messaging.mdx +78 -15
- package/corpus/core/docs/content/locales/zh-CN/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/zh-CN/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/zh-CN/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/zh-CN/server.mdx +16 -10
- package/corpus/core/docs/content/locales/zh-CN/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/zh-CN/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/zh-CN/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/zh-CN/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/zh-CN/template-clips.mdx +4 -4
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/zh-CN/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/zh-CN/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-CN/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/zh-CN/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/zh-CN/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-CN/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/zh-CN/workspace.mdx +19 -18
- package/corpus/core/docs/content/locales/zh-TW/actions.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/agent-native-toolkit.mdx +2 -2
- package/corpus/core/docs/content/locales/zh-TW/agent-surfaces.mdx +8 -10
- package/corpus/core/docs/content/locales/zh-TW/agent-teams.mdx +1 -0
- package/corpus/core/docs/content/locales/zh-TW/authentication.mdx +1 -1
- package/corpus/core/docs/content/locales/zh-TW/components.mdx +11 -1
- package/corpus/core/docs/content/locales/zh-TW/creating-templates.mdx +3 -7
- package/corpus/core/docs/content/locales/zh-TW/cross-app-sso.mdx +16 -6
- package/corpus/core/docs/content/locales/zh-TW/deployment.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-TW/extensions.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +2 -7
- package/corpus/core/docs/content/locales/zh-TW/key-concepts.mdx +13 -20
- package/corpus/core/docs/content/locales/zh-TW/messaging.mdx +78 -15
- package/corpus/core/docs/content/locales/zh-TW/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/locales/zh-TW/notifications.mdx +18 -10
- package/corpus/core/docs/content/locales/zh-TW/processors.mdx +11 -5
- package/corpus/core/docs/content/locales/zh-TW/server.mdx +16 -10
- package/corpus/core/docs/content/locales/zh-TW/sharing.mdx +10 -10
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.mdx +34 -17
- package/corpus/core/docs/content/locales/zh-TW/template-assets.mdx +16 -13
- package/corpus/core/docs/content/locales/zh-TW/template-brain.mdx +3 -1
- package/corpus/core/docs/content/locales/zh-TW/template-clips.mdx +4 -4
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +4 -1
- package/corpus/core/docs/content/locales/zh-TW/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/locales/zh-TW/template-mail.mdx +8 -0
- package/corpus/core/docs/content/locales/zh-TW/tracking.mdx +9 -6
- package/corpus/core/docs/content/locales/zh-TW/using-your-agent.mdx +0 -7
- package/corpus/core/docs/content/locales/zh-TW/voice-input.mdx +6 -0
- package/corpus/core/docs/content/locales/zh-TW/workspace-connections.mdx +9 -2
- package/corpus/core/docs/content/locales/zh-TW/workspace.mdx +19 -18
- package/corpus/core/docs/content/mcp-apps.mdx +14 -32
- package/corpus/core/docs/content/mcp-clients.mdx +48 -54
- package/corpus/core/docs/content/mcp-protocol.mdx +25 -10
- package/corpus/core/docs/content/messaging.mdx +238 -48
- package/corpus/core/docs/content/multi-app-workspace.mdx +11 -96
- package/corpus/core/docs/content/multi-tenancy.mdx +5 -5
- package/corpus/core/docs/content/native-chat-ui.mdx +4 -4
- package/corpus/core/docs/content/notifications.mdx +19 -12
- package/corpus/core/docs/content/observability.mdx +2 -4
- package/corpus/core/docs/content/observational-memory.mdx +7 -3
- package/corpus/core/docs/content/onboarding.mdx +9 -2
- package/corpus/core/docs/content/plan-plugin.mdx +10 -2
- package/corpus/core/docs/content/pr-visual-recap.mdx +1 -1
- package/corpus/core/docs/content/processors.mdx +11 -5
- package/corpus/core/docs/content/pure-agent-apps.mdx +5 -1
- package/corpus/core/docs/content/real-time-collaboration.mdx +30 -67
- package/corpus/core/docs/content/recurring-jobs.mdx +8 -6
- package/corpus/core/docs/content/routing.mdx +3 -4
- package/corpus/core/docs/content/sandbox-adapters.mdx +30 -53
- package/corpus/core/docs/content/security.mdx +8 -0
- package/corpus/core/docs/content/server.mdx +17 -10
- package/corpus/core/docs/content/sharing.mdx +10 -10
- package/corpus/core/docs/content/skills-guide.mdx +35 -16
- package/corpus/core/docs/content/template-analytics.mdx +11 -8
- package/corpus/core/docs/content/template-assets.mdx +16 -13
- package/corpus/core/docs/content/template-brain.mdx +3 -1
- package/corpus/core/docs/content/template-calendar.mdx +12 -4
- package/corpus/core/docs/content/template-chat.mdx +4 -4
- package/corpus/core/docs/content/template-clips.mdx +6 -3
- package/corpus/core/docs/content/template-content.mdx +23 -18
- package/corpus/core/docs/content/template-design.mdx +7 -1
- package/corpus/core/docs/content/template-dispatch.mdx +5 -1
- package/corpus/core/docs/content/template-mail.mdx +14 -2
- package/corpus/core/docs/content/template-plan.mdx +22 -15
- package/corpus/core/docs/content/template-slides.mdx +11 -3
- package/corpus/core/docs/content/toolkit-agent-ux.mdx +46 -3
- package/corpus/core/docs/content/toolkit-collaboration.mdx +58 -4
- package/corpus/core/docs/content/toolkit-command-navigation.mdx +8 -2
- package/corpus/core/docs/content/toolkit-comments-review.mdx +10 -2
- package/corpus/core/docs/content/toolkit-history.mdx +8 -3
- package/corpus/core/docs/content/toolkit-observability.mdx +48 -2
- package/corpus/core/docs/content/toolkit-org-team.mdx +8 -2
- package/corpus/core/docs/content/toolkit-resources.mdx +45 -2
- package/corpus/core/docs/content/toolkit-settings.mdx +8 -2
- package/corpus/core/docs/content/toolkit-setup-connections.mdx +7 -2
- package/corpus/core/docs/content/toolkit-sharing.mdx +46 -3
- package/corpus/core/docs/content/toolkit-ui.mdx +82 -11
- package/corpus/core/docs/content/tracking.mdx +10 -8
- package/corpus/core/docs/content/using-your-agent.mdx +0 -12
- package/corpus/core/docs/content/voice-input.mdx +7 -1
- package/corpus/core/docs/content/what-is-agent-native.mdx +7 -8
- package/corpus/core/docs/content/workspace-connections.mdx +16 -23
- package/corpus/core/docs/content/workspace-management.mdx +16 -4
- package/corpus/core/docs/content/workspace.mdx +19 -18
- package/corpus/core/package.json +5 -1
- package/corpus/core/src/a2a/artifact-response.ts +131 -2
- package/corpus/core/src/a2a/client.ts +10 -0
- package/corpus/core/src/a2a/handlers.ts +40 -76
- package/corpus/core/src/a2a/types.ts +2 -0
- package/corpus/core/src/agent/context-xray/tokenize.ts +6 -1
- package/corpus/core/src/agent/durable-background.ts +24 -0
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +9 -5
- package/corpus/core/src/agent/engine/anthropic-engine.ts +2 -4
- package/corpus/core/src/agent/engine/builder-engine.ts +5 -7
- package/corpus/core/src/agent/engine/index.ts +1 -0
- package/corpus/core/src/agent/engine/registry.ts +40 -0
- package/corpus/core/src/agent/harness/ai-sdk-adapter.ts +6 -1
- package/corpus/core/src/agent/harness/background.ts +96 -19
- package/corpus/core/src/agent/harness/index.ts +11 -0
- package/corpus/core/src/agent/harness/lifecycle.ts +498 -0
- package/corpus/core/src/agent/harness/runner.ts +38 -0
- package/corpus/core/src/agent/harness/store.ts +22 -3
- package/corpus/core/src/agent/model-config.ts +4 -1
- package/corpus/core/src/agent/production-agent.ts +205 -9
- package/corpus/core/src/agent/run-manager.ts +135 -11
- package/corpus/core/src/agent/run-store.ts +225 -15
- package/corpus/core/src/agent/types.ts +23 -0
- package/corpus/core/src/application-state/index.ts +1 -0
- package/corpus/core/src/application-state/store.ts +32 -0
- package/corpus/core/src/audit/record.ts +31 -0
- package/corpus/core/src/audit/store.ts +69 -3
- package/corpus/core/src/audit/types.ts +13 -0
- package/corpus/core/src/automation/index.ts +802 -0
- package/corpus/core/src/cli/code-agent-connector.ts +263 -8
- package/corpus/core/src/cli/code-agent-executor.ts +15 -1
- package/corpus/core/src/cli/create.ts +12 -5
- package/corpus/core/src/cli/design-connect.ts +596 -36
- package/corpus/core/src/client/AgentPanel.tsx +92 -44
- package/corpus/core/src/client/AssistantChat.tsx +324 -149
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +36 -40
- package/corpus/core/src/client/RunStuckBanner.tsx +69 -20
- package/corpus/core/src/client/agent-chat-adapter.ts +54 -5
- package/corpus/core/src/client/appearance.ts +8 -5
- package/corpus/core/src/client/automation.ts +22 -0
- package/corpus/core/src/client/chat/connectors.ts +293 -29
- package/corpus/core/src/client/chat/message-components.tsx +23 -1
- package/corpus/core/src/client/chat/run-recovery.tsx +67 -50
- package/corpus/core/src/client/chat/runtime.ts +126 -25
- package/corpus/core/src/client/chat/tool-call-display.tsx +45 -4
- package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +294 -0
- package/corpus/core/src/client/composer/TiptapComposer.tsx +29 -20
- package/corpus/core/src/client/composer/VoiceButton.tsx +20 -0
- package/corpus/core/src/client/composer/index.ts +22 -0
- package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +640 -0
- package/corpus/core/src/client/guided-questions.tsx +12 -3
- package/corpus/core/src/client/index.ts +48 -0
- package/corpus/core/src/client/integrations/api.ts +295 -0
- package/corpus/core/src/client/integrations/index.ts +26 -0
- package/corpus/core/src/client/settings/DemoModeSection.tsx +4 -3
- package/corpus/core/src/client/settings/SettingsPanel.tsx +4 -0
- package/corpus/core/src/client/settings/SettingsTabsPage.tsx +95 -37
- package/corpus/core/src/client/transcription/use-live-transcription.ts +68 -5
- package/corpus/core/src/client/use-chat-models.ts +17 -17
- package/corpus/core/src/client/use-db-sync.ts +108 -7
- package/corpus/core/src/client/use-run-stuck-detection.ts +41 -3
- package/corpus/core/src/code-agents/background-controller.ts +18 -0
- package/corpus/core/src/collab/ydoc-manager.ts +41 -6
- package/corpus/core/src/db/migrations.ts +17 -1
- package/corpus/core/src/demo/fetch-interceptor.ts +16 -11
- package/corpus/core/src/deploy/build.ts +59 -3
- package/corpus/core/src/deploy/workspace-deploy.ts +37 -2
- package/corpus/core/src/file-upload/types.ts +2 -0
- package/corpus/core/src/index.ts +37 -0
- package/corpus/core/src/integrations/a2a-continuations-store.ts +6 -4
- package/corpus/core/src/integrations/adapters/discord.ts +362 -0
- package/corpus/core/src/integrations/adapters/index.ts +29 -0
- package/corpus/core/src/integrations/adapters/microsoft-teams.ts +411 -0
- package/corpus/core/src/integrations/adapters/slack.ts +900 -27
- package/corpus/core/src/integrations/adapters/telegram.ts +54 -15
- package/corpus/core/src/integrations/adapters/whatsapp.ts +41 -17
- package/corpus/core/src/integrations/awaiting-input-store.ts +130 -0
- package/corpus/core/src/integrations/catalog.ts +571 -0
- package/corpus/core/src/integrations/computer-supervision-store.ts +423 -0
- package/corpus/core/src/integrations/computer-supervision.ts +213 -0
- package/corpus/core/src/integrations/controls-store.ts +187 -0
- package/corpus/core/src/integrations/index.ts +129 -1
- package/corpus/core/src/integrations/installations-store.ts +677 -0
- package/corpus/core/src/integrations/integration-memory.ts +187 -0
- package/corpus/core/src/integrations/pending-tasks-retry-job.ts +6 -6
- package/corpus/core/src/integrations/pending-tasks-store.ts +83 -5
- package/corpus/core/src/integrations/plugin.ts +916 -49
- package/corpus/core/src/integrations/remote-commands-store.ts +334 -3
- package/corpus/core/src/integrations/remote-devices-store.ts +68 -9
- package/corpus/core/src/integrations/remote-json-safety.ts +127 -0
- package/corpus/core/src/integrations/remote-run-events-store.ts +104 -19
- package/corpus/core/src/integrations/remote-types.ts +66 -3
- package/corpus/core/src/integrations/scope-store.ts +498 -0
- package/corpus/core/src/integrations/slack-manifest.ts +78 -0
- package/corpus/core/src/integrations/slack-oauth.ts +343 -0
- package/corpus/core/src/integrations/types.ts +179 -0
- package/corpus/core/src/integrations/usage-budget-store.ts +906 -0
- package/corpus/core/src/integrations/webhook-handler.ts +723 -53
- package/corpus/core/src/jobs/scheduler.ts +100 -2
- package/corpus/core/src/jobs/tools.ts +45 -9
- package/corpus/core/src/localization/default-messages.ts +28 -0
- package/corpus/core/src/mcp-client/config.ts +48 -2
- package/corpus/core/src/mcp-client/index.ts +35 -2
- package/corpus/core/src/mcp-client/tool-policy.ts +182 -0
- package/corpus/core/src/provider-api/index.ts +72 -1
- package/corpus/core/src/resources/handlers.ts +88 -14
- package/corpus/core/src/resources/script-helpers.ts +36 -7
- package/corpus/core/src/resources/store.ts +59 -52
- package/corpus/core/src/scripts/call-agent.ts +107 -1
- package/corpus/core/src/secrets/register-framework-secrets.ts +27 -4
- package/corpus/core/src/server/agent-chat-plugin.ts +356 -127
- package/corpus/core/src/server/auth.ts +10 -14
- package/corpus/core/src/server/builder-design-systems.ts +16 -1
- package/corpus/core/src/server/edge.ts +18 -0
- package/corpus/core/src/server/index.ts +42 -0
- package/corpus/core/src/server/realtime-voice.ts +590 -0
- package/corpus/core/src/server/request-context.ts +18 -0
- package/corpus/core/src/server/social-og-image.ts +3 -2
- package/corpus/core/src/shared/reasoning-effort.ts +61 -19
- package/corpus/core/src/styles/agent-conversation.css +17 -0
- package/corpus/core/src/styles/agent-native.css +62 -44
- package/corpus/core/src/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/core/src/templates/default/AGENTS.md +7 -3
- package/corpus/core/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/core/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
- package/corpus/core/src/templates/workspace-core/AGENTS.md +3 -2
- package/corpus/core/src/usage/store.ts +37 -2
- package/corpus/templates/analytics/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/analytics/.agents/skills/provider-api/SKILL.md +23 -0
- package/corpus/templates/analytics/.builder/skills/provider-api/SKILL.md +15 -0
- package/corpus/templates/analytics/actions/save-monitor.ts +25 -2
- package/corpus/templates/analytics/app/lib/data-sources.ts +28 -0
- package/corpus/templates/analytics/changelog/2026-07-10-agent-created-uptime-monitors-now-return-a-direct-link-to-th.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-10-dashboard-email-reports-still-arrive-when-screenshot-capture-temporarily-fails.md +6 -0
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +3 -7
- package/corpus/templates/analytics/server/lib/credential-keys.ts +12 -0
- package/corpus/templates/analytics/server/lib/dashboard-report.ts +5 -1
- package/corpus/templates/analytics/server/lib/provider-credentials.ts +2 -0
- package/corpus/templates/analytics/server/routes/api/test-connection.post.ts +16 -0
- package/corpus/templates/assets/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/brain/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/brain/app/lib/settings-navigation.ts +22 -0
- package/corpus/templates/brain/app/routes/settings.tsx +367 -252
- package/corpus/templates/brain/changelog/2026-07-10-brain-settings-now-separate-assistant-behavior-publishing-re.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-10-organization-settings-now-opens-directly-from-the-workspace-.md +6 -0
- package/corpus/templates/calendar/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/calendar/.agents/skills/event-management/SKILL.md +36 -4
- package/corpus/templates/calendar/AGENTS.md +4 -0
- package/corpus/templates/calendar/actions/create-event.ts +7 -19
- package/corpus/templates/calendar/actions/delete-event.ts +10 -3
- package/corpus/templates/calendar/actions/rsvp-event.ts +1 -1
- package/corpus/templates/calendar/actions/update-event.ts +4 -3
- package/corpus/templates/calendar/app/components/calendar/CommandPalette.tsx +98 -108
- package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +100 -13
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +12 -4
- package/corpus/templates/calendar/app/components/calendar/EventAttendeesSection.tsx +97 -90
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +3 -3
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +86 -8
- package/corpus/templates/calendar/app/components/calendar/EventDialog.tsx +3 -1
- package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +12 -4
- package/corpus/templates/calendar/app/hooks/use-events.ts +1 -0
- package/corpus/templates/calendar/app/lib/event-account-selection.ts +36 -0
- package/corpus/templates/calendar/app/lib/event-form-initialization.ts +21 -0
- package/corpus/templates/calendar/app/lib/event-mutation-inputs.ts +18 -0
- package/corpus/templates/calendar/app/pages/CalendarView.tsx +119 -26
- package/corpus/templates/calendar/changelog/2026-07-10-choose-which-connected-google-account-receives-a-new-event-w.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-10-event-guest-details-and-option-menus-now-use-valid-accessibl.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-10-natural-language-event-phrases-stay-available-as-quick-creat.md +6 -0
- package/corpus/templates/calendar/server/db/schema.ts +2 -0
- package/corpus/templates/calendar/server/handlers/bookings.ts +43 -6
- package/corpus/templates/calendar/server/handlers/events.ts +28 -9
- package/corpus/templates/calendar/server/lib/google-calendar.ts +66 -38
- package/corpus/templates/calendar/server/plugins/db.ts +5 -0
- package/corpus/templates/chat/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +12 -3
- package/corpus/templates/clips/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +1 -1
- package/corpus/templates/clips/.agents/skills/recording/SKILL.md +17 -1
- package/corpus/templates/clips/.agents/skills/video-sharing/SKILL.md +8 -0
- package/corpus/templates/clips/AGENTS.md +12 -5
- package/corpus/templates/clips/actions/finalize-recording.ts +63 -23
- package/corpus/templates/clips/actions/get-recording-player-data.ts +6 -2
- package/corpus/templates/clips/actions/lib/ensure-seekable-video.ts +72 -9
- package/corpus/templates/clips/actions/list-recordings.ts +19 -3
- package/corpus/templates/clips/actions/navigate.ts +2 -0
- package/corpus/templates/clips/actions/regenerate-title.ts +53 -7
- package/corpus/templates/clips/actions/reprocess-recording.ts +20 -6
- package/corpus/templates/clips/actions/request-transcript.ts +168 -72
- package/corpus/templates/clips/actions/save-browser-transcript.ts +11 -9
- package/corpus/templates/clips/actions/view-screen.ts +57 -5
- package/corpus/templates/clips/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/clips/app/components/library/empty-state.tsx +2 -0
- package/corpus/templates/clips/app/components/library/library-grid.tsx +69 -42
- package/corpus/templates/clips/app/components/library/library-layout.tsx +15 -1
- package/corpus/templates/clips/app/components/library/recording-card.tsx +81 -68
- package/corpus/templates/clips/app/components/library/search-bar.tsx +4 -3
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +101 -53
- package/corpus/templates/clips/app/components/player/delete-recording-menu.tsx +9 -3
- package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +102 -0
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -1
- package/corpus/templates/clips/app/components/player/video-player.tsx +10 -1
- package/corpus/templates/clips/app/hooks/use-auto-title.ts +14 -0
- package/corpus/templates/clips/app/hooks/use-library.ts +1 -1
- package/corpus/templates/clips/app/hooks/use-navigation-state.ts +10 -2
- package/corpus/templates/clips/app/i18n/ar-SA.ts +7 -1
- package/corpus/templates/clips/app/i18n/de-DE.ts +7 -1
- package/corpus/templates/clips/app/i18n/en-US.ts +7 -1
- package/corpus/templates/clips/app/i18n/es-ES.ts +7 -1
- package/corpus/templates/clips/app/i18n/fr-FR.ts +7 -1
- package/corpus/templates/clips/app/i18n/hi-IN.ts +7 -1
- package/corpus/templates/clips/app/i18n/ja-JP.ts +7 -1
- package/corpus/templates/clips/app/i18n/ko-KR.ts +7 -1
- package/corpus/templates/clips/app/i18n/pt-BR.ts +7 -1
- package/corpus/templates/clips/app/i18n/zh-CN.ts +8 -1
- package/corpus/templates/clips/app/i18n/zh-TW.ts +8 -1
- package/corpus/templates/clips/app/lib/recording-visibility.ts +70 -0
- package/corpus/templates/clips/app/routes/_app.shared.tsx +20 -0
- package/corpus/templates/clips/app/routes/download.tsx +24 -8
- package/corpus/templates/clips/app/routes/embed.$shareId.tsx +2 -0
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +115 -2
- package/corpus/templates/clips/app/routes/record.tsx +62 -0
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +25 -16
- package/corpus/templates/clips/changelog/2026-07-10-clips-desktop-is-now-available-for-linux-with-appimage-debia.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-clips-downloads-updates-sooner-in-the-background-and-offers-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-clips-shared-with-you-now-appear-in-a-searchable-shared-with.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-clips-with-missing-mobile-video-frames-can-be-repaired-witho.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-comment-replies-now-open-inline-and-focus-immediately-while-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-dismissed-upload-warnings-now-keep-recordings-in-clip-drafts.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-dragging-the-meeting-recorder-no-longer-opens-the-expanded.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-finishing-meeting-notes-no-longer-opens-your-browser.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-meeting-recordings-now-keep-microphone-audio-and-recover-tra.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-mobile-camera-recordings-pause-while-backgrounded.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-mp4-downloads-now-show-progress-immediately-after-the-option.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-recording-pages-now-open-as-soon-as-you-stop-with-a-share-li.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-recording-pause-and-resume-controls-now-respond-reliably-on-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-recordings-now-seek-smoothly-downloads-use-the-correct-file-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-s3-compatible-storage-now-saves-hosted-recordings-without-re.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-starting-and-joining-a-meeting-now-closes-the-desktop-popover.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-timestamped-comments-now-appear-over-the-video-as-playback-r.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-transcript-backed-titles-and-summaries-now-finish-after-recording.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-10-zoom-meetings-now-open-directly-in-the-desktop-app.md +6 -0
- package/corpus/templates/clips/chrome-extension/src/overlay.ts +49 -7
- package/corpus/templates/clips/desktop/README.md +22 -6
- package/corpus/templates/clips/desktop/package.json +1 -1
- package/corpus/templates/clips/desktop/src/app.tsx +102 -61
- package/corpus/templates/clips/desktop/src/components/ReadinessPanel.tsx +15 -9
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +8 -14
- package/corpus/templates/clips/desktop/src/lib/finalization-guard.ts +22 -0
- package/corpus/templates/clips/desktop/src/lib/meeting-join-url.ts +33 -0
- package/corpus/templates/clips/desktop/src/lib/pause-transition.ts +79 -0
- package/corpus/templates/clips/desktop/src/lib/permissions.ts +3 -1
- package/corpus/templates/clips/desktop/src/lib/pill-interaction.ts +19 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +187 -159
- package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +3 -2
- package/corpus/templates/clips/desktop/src/lib/updater.ts +26 -4
- package/corpus/templates/clips/desktop/src/overlays/finalizing.tsx +4 -8
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +3 -2
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +32 -6
- package/corpus/templates/clips/desktop/src/overlays/toolbar.tsx +50 -5
- package/corpus/templates/clips/desktop/src/styles.css +11 -19
- package/corpus/templates/clips/desktop/src-tauri/Cargo.toml +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +2 -2
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +2 -1
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +121 -4
- package/corpus/templates/clips/desktop/src-tauri/src/native_speech.rs +97 -17
- package/corpus/templates/clips/desktop/src-tauri/src/permission_status.rs +11 -7
- package/corpus/templates/clips/desktop/src-tauri/src/whisper_speech.rs +80 -5
- package/corpus/templates/clips/desktop/src-tauri/tauri.conf.json +1 -1
- package/corpus/templates/clips/desktop/src-tauri/tauri.linux.conf.json +11 -0
- package/corpus/templates/clips/netlify.toml +3 -0
- package/corpus/templates/clips/server/lib/post-finalize-dispatch.ts +106 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +9 -1
- package/corpus/templates/clips/server/lib/resumable-upload-provider.ts +52 -0
- package/corpus/templates/clips/server/lib/s3-upload-provider.ts +433 -85
- package/corpus/templates/clips/server/lib/video-remux.ts +114 -0
- package/corpus/templates/clips/server/routes/api/_agent-native-background/post-finalize-worker.post.ts +109 -0
- package/corpus/templates/clips/server/routes/api/clips-updater.json.get.ts +22 -11
- package/corpus/templates/clips/server/routes/api/public-recording.get.ts +4 -2
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +47 -5
- package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/chunk.post.ts +10 -2
- package/corpus/templates/clips/shared/share-loader-response.ts +12 -0
- package/corpus/templates/clips/shared/transcript-status.ts +40 -0
- package/corpus/templates/clips/vitest.config.ts +23 -0
- package/corpus/templates/content/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/content/.agents/skills/content/SKILL.md +57 -5
- package/corpus/templates/content/AGENTS.md +65 -55
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +10 -16
- package/corpus/templates/content/actions/_database-source-utils.ts +58 -11
- package/corpus/templates/content/actions/_property-utils.ts +30 -2
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +312 -114
- package/corpus/templates/content/actions/submit-content-database-form.ts +497 -0
- package/corpus/templates/content/actions/update-content-database-view.ts +8 -1
- package/corpus/templates/content/actions/view-screen.ts +4 -1
- package/corpus/templates/content/agent-native.app-skill.json +1 -1
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +28 -9
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +250 -64
- package/corpus/templates/content/app/components/editor/database/FormView.tsx +460 -0
- package/corpus/templates/content/app/components/editor/database/navigation-state.ts +3 -0
- package/corpus/templates/content/app/components/editor/database/settings.tsx +30 -37
- package/corpus/templates/content/app/components/editor/database/shared.tsx +2 -0
- package/corpus/templates/content/app/components/editor/database/view-config.ts +29 -1
- package/corpus/templates/content/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/content/app/hooks/use-content-database.ts +22 -0
- package/corpus/templates/content/app/i18n/zh-TW.ts +21 -0
- package/corpus/templates/content/app/i18n-data.ts +225 -0
- package/corpus/templates/content/changelog/2026-07-10-builder-backed-properties-now-load-current-source-values-as-.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-builder-database-refreshes-now-stay-explicit-and-accurate.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-database-form-views-now-collect-ordered-required-answers-and.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-database-tables-now-use-a-quieter-more-compact-layout-with-c.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-open-documents-no-longer-make-constant-background-requests-w.md +6 -0
- package/corpus/templates/content/changelog/2026-07-10-slack-intake-routes-to-content-database-forms.md +6 -0
- package/corpus/templates/content/parity/matrix.md +1 -0
- package/corpus/templates/content/parity/matrix.ts +18 -0
- package/corpus/templates/content/shared/api.ts +27 -1
- package/corpus/templates/content/shared/database-form.ts +53 -0
- package/corpus/templates/design/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/design/.agents/skills/design-generation/SKILL.md +26 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +106 -16
- package/corpus/templates/design/AGENTS.md +79 -18
- package/corpus/templates/design/DESIGN.md +1 -1
- package/corpus/templates/design/DEVELOPING.md +1 -1
- package/corpus/templates/design/FIGMA_INTEROPERABILITY.md +116 -0
- package/corpus/templates/design/actions/create-design-from-template.ts +220 -0
- package/corpus/templates/design/actions/create-design-system.ts +92 -16
- package/corpus/templates/design/actions/delete-design-template.ts +28 -0
- package/corpus/templates/design/actions/delete-file.ts +7 -0
- package/corpus/templates/design/actions/edit-design.ts +3 -0
- package/corpus/templates/design/actions/export-design-as-figma-svg.ts +137 -5
- package/corpus/templates/design/actions/export-pdf.ts +1 -1
- package/corpus/templates/design/actions/generate-design.ts +3 -0
- package/corpus/templates/design/actions/get-design-snapshot.ts +9 -0
- package/corpus/templates/design/actions/get-figma-connection-status.ts +26 -0
- package/corpus/templates/design/actions/get-figma-design-context.ts +138 -0
- package/corpus/templates/design/actions/get-figma-styles.ts +2 -2
- package/corpus/templates/design/actions/import-figma-clipboard.ts +112 -16
- package/corpus/templates/design/actions/import-figma-frame.ts +15 -4
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +4 -0
- package/corpus/templates/design/actions/list-design-templates.ts +118 -0
- package/corpus/templates/design/actions/navigate.ts +16 -2
- package/corpus/templates/design/actions/provider-api-request.ts +11 -1
- package/corpus/templates/design/actions/save-design-as-template.ts +156 -0
- package/corpus/templates/design/actions/set-active-breakpoint.ts +13 -4
- package/corpus/templates/design/actions/take-design-screenshot.ts +73 -3
- package/corpus/templates/design/actions/update-file.ts +39 -22
- package/corpus/templates/design/actions/view-screen.ts +36 -1
- package/corpus/templates/design/actions/write-local-file.ts +50 -38
- package/corpus/templates/design/app/components/design/AutoLayoutSuggestionDialog.tsx +151 -0
- package/corpus/templates/design/app/components/design/CanvasContextMenu.tsx +20 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +383 -29
- package/corpus/templates/design/app/components/design/DesignEditorSkeleton.tsx +3 -3
- package/corpus/templates/design/app/components/design/DesignImportPanel.tsx +384 -9
- package/corpus/templates/design/app/components/design/EditPanel.tsx +105 -32
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +131 -46
- package/corpus/templates/design/app/components/design/TweaksPanel.tsx +6 -0
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +545 -54
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +40 -0
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +1 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +1 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +5 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/create-providers.ts +2 -0
- package/corpus/templates/design/app/components/design/code-workbench/workspace/localhost-provider.ts +3 -1
- package/corpus/templates/design/app/components/design/code-workbench/workspace/types.ts +2 -0
- package/corpus/templates/design/app/components/design/edit-panel/element-identity.ts +19 -0
- package/corpus/templates/design/app/components/design/edit-panel/frame-presets-panel.tsx +1 -0
- package/corpus/templates/design/app/components/design/edit-panel/interaction-state-helpers.ts +27 -0
- package/corpus/templates/design/app/components/design/inspector/InteractionStatePanel.tsx +137 -81
- package/corpus/templates/design/app/components/design/inspector/frame-size-presets.ts +25 -5
- package/corpus/templates/design/app/components/design/multi-screen/chrome-transitions.ts +1 -1
- package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +350 -3
- package/corpus/templates/design/app/components/design/multi-screen/overview-layout.ts +13 -0
- package/corpus/templates/design/app/components/design/multi-screen/types.ts +22 -1
- package/corpus/templates/design/app/components/design/types.ts +4 -0
- package/corpus/templates/design/app/components/design-system/ProductionDesignSystemShowcase.tsx +208 -0
- package/corpus/templates/design/app/components/editor/FigmaLinkComposerBubble.tsx +321 -0
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +24 -4
- package/corpus/templates/design/app/components/layout/Layout.tsx +16 -2
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +2 -0
- package/corpus/templates/design/app/components/templates/TemplatePreview.tsx +72 -0
- package/corpus/templates/design/app/global.css +2 -35
- package/corpus/templates/design/app/hooks/use-navigation-state.ts +10 -0
- package/corpus/templates/design/app/i18n/zh-TW.ts +127 -5
- package/corpus/templates/design/app/i18n-breakpoints.ts +209 -0
- package/corpus/templates/design/app/i18n-data.ts +1317 -59
- package/corpus/templates/design/app/i18n-template-feature.ts +458 -0
- package/corpus/templates/design/app/lib/clipboard-content-lineage.ts +64 -0
- package/corpus/templates/design/app/lib/design-clipboard-managed-styles.ts +247 -0
- package/corpus/templates/design/app/lib/design-clipboard.ts +259 -0
- package/corpus/templates/design/app/lib/design-file-upload.ts +87 -0
- package/corpus/templates/design/app/lib/design-import.ts +198 -13
- package/corpus/templates/design/app/lib/desktop-design-preview.ts +423 -0
- package/corpus/templates/design/app/lib/figma-clipboard.ts +74 -8
- package/corpus/templates/design/app/lib/figma-connection.ts +161 -0
- package/corpus/templates/design/app/lib/figma-svg-copy.ts +814 -22
- package/corpus/templates/design/app/lib/figma-url.ts +77 -0
- package/corpus/templates/design/app/lib/pending-generation.ts +35 -0
- package/corpus/templates/design/app/pages/DesignSystems.tsx +236 -177
- package/corpus/templates/design/app/pages/Index.tsx +38 -0
- package/corpus/templates/design/app/pages/Templates.tsx +498 -0
- package/corpus/templates/design/app/pages/design-editor/auto-layout-suggestion.ts +328 -0
- package/corpus/templates/design/app/pages/design-editor/clone-idrefs.ts +113 -0
- package/corpus/templates/design/app/pages/design-editor/created-screen-navigation.ts +55 -0
- package/corpus/templates/design/app/pages/design-editor/editor-session.ts +32 -0
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +49 -2
- package/corpus/templates/design/app/pages/design-editor/export-capture.ts +296 -0
- package/corpus/templates/design/app/pages/design-editor/history.ts +101 -2
- package/corpus/templates/design/app/pages/design-editor/latest-write-queue.ts +56 -0
- package/corpus/templates/design/app/pages/design-editor/layout-operations.ts +28 -1
- package/corpus/templates/design/app/pages/design-editor/overview-camera.ts +34 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +202 -6
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +92 -0
- package/corpus/templates/design/app/pages/design-editor/performance-buffer-guard.ts +80 -0
- package/corpus/templates/design/app/pages/design-editor/save-failure.ts +58 -0
- package/corpus/templates/design/app/routes/templates.tsx +4 -6
- package/corpus/templates/design/changelog/2026-07-10-app-workspaces-now-use-clean-borderless-main-surfaces-throug.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-ask-chat-what-s-in-a-figma-file-or-frame-structure-screensho.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-canvas-edits-now-reject-malformed-html-before-it-can-corrupt.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-complex-designs-now-export-as-valid-secure-svgs-and-crisp-ra.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-complex-figma-masks-arcs-rich-text-transformed-images-and-ad.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-concurrent-agent-and-artboard-edits-no-longer-show-misleadin.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-copied-layers-paste-across-designs-and-browser-tabs.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-copy-and-download-editable-figma-svg.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-copying-design-text-now-pastes-readable-text-into-other-apps.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-deleted-screens-can-be-restored-with-undo-and-removed-again-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-design-changes-now-save-before-switching-apps-and-retry-when.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-design-stays-usable-on-phones-by-keeping-editor-panels-and-f.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-designs-with-html-examples-inside-alpine-attributes-or-comme.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-download-all-screens-as-one-multi-page-pdf-from-the-overview.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-duplicated-layers-now-keep-labels-aria-relationships-fragmen.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fig-import-results-stay-compact.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-figma-imports-now-load-real-fonts-fix-rotated-gradient-dashe.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-figma-links-in-chat-and-the-import-tab-now-offer-secure-one-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-cmd-z-not-restoring-content-after-an-agent-driven-desi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-download-pdf-being-unreachable-from-the-export-panel-e.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-dragging-a-layer-out-of-an-auto-layout-row-column-no-l.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-figma-svg-export-text-wrapping-sizing-and-inner-layer.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-hiding-or-locking-one-layer-no-longer-hides-or-blocks-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-png-screenshots-of-tall-screens-being-cropped-to-one-v.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-fixed-png-svg-exports-capturing-broken-layout-when-webfonts-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-frame-tool-now-offers-standard-ad-unit-size-presets-medium-r.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-full-view-controls-stay-within-their-frame-instead-of-coveri.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-hover-focus-focus-visible-pressed-and-disabled-states-now-pr.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-interactive-designs-no-longer-appear-blank-in-the-canvas-whe.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-layer-drops-now-land-in-the-intended-grid-row-stay-visually-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-local-code-workspaces-now-keep-unsaved-edits-across-panel-sw.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-local-visual-editing-now-keeps-authenticated-sessions-shared.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-long-overview-editing-sessions-lots-of-pan-zoom-screen-switc.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-long-running-agent-work-no-longer-shows-a-premature-stuck-wa.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-managed-figma-connections-are-recognized-automatically.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-new-designs-can-open-directly-in-the-editor-without-a-pr.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-new-screens-are-selected-and-revealed-immediately.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-new-text-layers-undo-as-one-safe-creation.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-preview-and-apply-inferred-auto-layout-without-changing-yo.md +5 -0
- package/corpus/templates/design/changelog/2026-07-10-print-pdf-exports-and-paper-size-presets-letter-a4-now-match.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-rapid-breakpoint-and-edit-scope-changes-no-longer-jump-back-.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-responsive-breakpoint-previews-stay-visible-while-panning-ac.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-responsive-frame-editing.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-reusable-design-templates.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-rich-design-clipboard-markers-are-now-accepted-only-from-the.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-screen-overview-frames-now-use-a-clearer-interact-action-wit.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-start-designs-from-source-linked-material-3-carbon-or-primer.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-tweaks-guidance.md +6 -0
- package/corpus/templates/design/changelog/2026-07-10-uploaded-fig-files-can-now-become-editable-design-screens-wi.md +6 -0
- package/corpus/templates/design/e2e/helpers.ts +18 -7
- package/corpus/templates/design/package.json +2 -0
- package/corpus/templates/design/scripts/qa-figma-stress-import.ts +96 -0
- package/corpus/templates/design/server/db/index.ts +10 -0
- package/corpus/templates/design/server/db/schema.ts +44 -0
- package/corpus/templates/design/server/handlers/import-design-file.ts +114 -80
- package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +19 -6
- package/corpus/templates/design/server/lib/design-export.ts +240 -3
- package/corpus/templates/design/server/lib/design-template-data.ts +89 -0
- package/corpus/templates/design/server/lib/design-to-figma-svg.ts +250 -26
- package/corpus/templates/design/server/lib/fig-file-decoder.ts +839 -0
- package/corpus/templates/design/server/lib/fig-file-import.ts +287 -0
- package/corpus/templates/design/server/lib/fig-file-limits.ts +3 -0
- package/corpus/templates/design/server/lib/fig-file-to-html.ts +2568 -0
- package/corpus/templates/design/server/lib/figma-design-context.ts +359 -0
- package/corpus/templates/design/server/lib/figma-node-import.ts +478 -22
- package/corpus/templates/design/server/lib/figma-node-to-html.ts +554 -29
- package/corpus/templates/design/server/lib/local-figma-qa-upload.ts +112 -0
- package/corpus/templates/design/server/lib/verify-write-grant.ts +16 -2
- package/corpus/templates/design/server/lib/visible-clipboard-html.ts +13 -3
- package/corpus/templates/design/server/plugins/agent-chat.ts +7 -0
- package/corpus/templates/design/server/plugins/db.ts +42 -0
- package/corpus/templates/design/server/plugins/local-figma-qa-upload.ts +7 -0
- package/corpus/templates/design/server/register-secrets.ts +8 -8
- package/corpus/templates/design/server/routes/api/qa-figma-import-assets/[assetId].get.ts +46 -0
- package/corpus/templates/design/server/source-workspace.ts +131 -13
- package/corpus/templates/design/shared/code-layer.ts +105 -28
- package/corpus/templates/design/shared/design-system-templates.ts +301 -0
- package/corpus/templates/design/shared/design-template-presets.ts +195 -0
- package/corpus/templates/design/shared/figma-url.ts +8 -0
- package/corpus/templates/design/shared/html-integrity.ts +401 -0
- package/corpus/templates/design/shared/interaction-states.ts +318 -23
- package/corpus/templates/design/shared/locked-layers.ts +151 -0
- package/corpus/templates/dispatch/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/dispatch/AGENTS.md +10 -2
- package/corpus/templates/dispatch/actions/view-screen.ts +11 -0
- package/corpus/templates/dispatch/app/hooks/use-navigation-state.ts +13 -0
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +51 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +572 -1
- package/corpus/templates/dispatch/app/routes/operations.tsx +1 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-connect-slack-workspaces-with-oauth-and-manage-channel-ident.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-dispatch-now-has-a-cleaner-chat-history-and-quieter-sidebar-.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-microsoft-teams-bots-and-discord-slash-commands-can-now-conn.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-operations-console-brings-agent-monitoring-and-database-inspection-tog.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-10-slack-and-telegram-now-route-uptime-monitor-requests-to-anal.md +6 -0
- package/corpus/templates/forms/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/forms/.agents/skills/form-publishing/SKILL.md +7 -0
- package/corpus/templates/forms/AGENTS.md +4 -0
- package/corpus/templates/forms/actions/create-form.ts +44 -7
- package/corpus/templates/forms/actions/lib/assert-publishable-form.ts +38 -0
- package/corpus/templates/forms/actions/patch-form-fields.ts +4 -0
- package/corpus/templates/forms/actions/update-form.ts +2 -36
- package/corpus/templates/forms/app/i18n/ar-SA.ts +3 -0
- package/corpus/templates/forms/app/i18n/de-DE.ts +3 -0
- package/corpus/templates/forms/app/i18n/en-US.ts +3 -0
- package/corpus/templates/forms/app/i18n/es-ES.ts +3 -0
- package/corpus/templates/forms/app/i18n/fr-FR.ts +3 -0
- package/corpus/templates/forms/app/i18n/hi-IN.ts +3 -0
- package/corpus/templates/forms/app/i18n/ja-JP.ts +3 -0
- package/corpus/templates/forms/app/i18n/ko-KR.ts +3 -0
- package/corpus/templates/forms/app/i18n/pt-BR.ts +3 -0
- package/corpus/templates/forms/app/i18n/zh-CN.ts +2 -0
- package/corpus/templates/forms/app/i18n/zh-TW.ts +3 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +17 -0
- package/corpus/templates/forms/changelog/2026-07-10-agent-created-published-forms-now-return-the-anonymous-publi.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-10-published-forms-can-no-longer-be-edited-into-an-unusable-emp.md +6 -0
- package/corpus/templates/forms/server/handlers/submissions.ts +4 -3
- package/corpus/templates/forms/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/forms/shared/types.ts +5 -0
- package/corpus/templates/mail/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/mail/actions/get-integration-statuses.ts +36 -0
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +3 -2
- package/corpus/templates/mail/app/components/email/IntegrationsSidebar.tsx +3 -3
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +2 -2
- package/corpus/templates/mail/app/hooks/use-apollo.ts +5 -71
- package/corpus/templates/mail/app/hooks/use-draft-queue.ts +1 -1
- package/corpus/templates/mail/app/hooks/use-integrations.ts +51 -48
- package/corpus/templates/mail/app/lib/integration-status.ts +31 -0
- package/corpus/templates/mail/app/lib/sync-invalidation.ts +5 -0
- package/corpus/templates/mail/app/pages/SettingsPage.tsx +3 -0
- package/corpus/templates/mail/app/root.tsx +22 -12
- package/corpus/templates/mail/changelog/2026-07-10-email-content-backgrounds-now-blend-cleanly-with-dark-mode.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-10-mail-navigation-now-uses-a-clean-borderless-drawer.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-10-mail-settings-now-group-drafting-automation-and-connected-se.md +6 -0
- package/corpus/templates/mail/changelog/2026-07-10-organization-settings-now-opens-directly-from-the-workspace-.md +6 -0
- package/corpus/templates/plan/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/corpus/templates/plan/app/lib/plan-local-bridge.ts +4 -1
- package/corpus/templates/plan/changelog/2026-07-10-local-plans-now-keep-valid-content-visible-when-one-generate.md +6 -0
- package/corpus/templates/plan/server/lib/local-plan-files.ts +4 -1
- package/corpus/templates/slides/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +88 -2
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/a2a/client.d.ts +9 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +1 -0
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +24 -69
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/types.d.ts +2 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/agent/context-xray/tokenize.d.ts.map +1 -1
- package/dist/agent/context-xray/tokenize.js +6 -1
- package/dist/agent/context-xray/tokenize.js.map +1 -1
- package/dist/agent/durable-background.d.ts +11 -0
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +17 -0
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +8 -3
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +2 -4
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +2 -3
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/index.d.ts +1 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +1 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +13 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +33 -0
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/harness/ai-sdk-adapter.d.ts.map +1 -1
- package/dist/agent/harness/ai-sdk-adapter.js +3 -1
- package/dist/agent/harness/ai-sdk-adapter.js.map +1 -1
- package/dist/agent/harness/background.d.ts +9 -9
- package/dist/agent/harness/background.d.ts.map +1 -1
- package/dist/agent/harness/background.js +77 -19
- package/dist/agent/harness/background.js.map +1 -1
- package/dist/agent/harness/index.d.ts +1 -0
- package/dist/agent/harness/index.d.ts.map +1 -1
- package/dist/agent/harness/index.js +1 -0
- package/dist/agent/harness/index.js.map +1 -1
- package/dist/agent/harness/lifecycle.d.ts +45 -0
- package/dist/agent/harness/lifecycle.d.ts.map +1 -0
- package/dist/agent/harness/lifecycle.js +318 -0
- package/dist/agent/harness/lifecycle.js.map +1 -0
- package/dist/agent/harness/runner.d.ts.map +1 -1
- package/dist/agent/harness/runner.js +29 -1
- package/dist/agent/harness/runner.js.map +1 -1
- package/dist/agent/harness/store.d.ts +2 -0
- package/dist/agent/harness/store.d.ts.map +1 -1
- package/dist/agent/harness/store.js +17 -3
- package/dist/agent/harness/store.js.map +1 -1
- package/dist/agent/model-config.d.ts +2 -2
- package/dist/agent/model-config.d.ts.map +1 -1
- package/dist/agent/model-config.js +4 -1
- package/dist/agent/model-config.js.map +1 -1
- package/dist/agent/production-agent.d.ts +40 -2
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +150 -9
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +44 -2
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +90 -9
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +109 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +206 -15
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/types.d.ts +22 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/application-state/index.d.ts +1 -1
- package/dist/application-state/index.d.ts.map +1 -1
- package/dist/application-state/index.js +1 -1
- package/dist/application-state/index.js.map +1 -1
- package/dist/application-state/store.d.ts +6 -0
- package/dist/application-state/store.d.ts.map +1 -1
- package/dist/application-state/store.js +31 -0
- package/dist/application-state/store.js.map +1 -1
- package/dist/audit/record.d.ts.map +1 -1
- package/dist/audit/record.js +29 -0
- package/dist/audit/record.js.map +1 -1
- package/dist/audit/store.d.ts.map +1 -1
- package/dist/audit/store.js +62 -3
- package/dist/audit/store.js.map +1 -1
- package/dist/audit/types.d.ts +13 -0
- package/dist/audit/types.d.ts.map +1 -1
- package/dist/audit/types.js.map +1 -1
- package/dist/automation/index.d.ts +193 -0
- package/dist/automation/index.d.ts.map +1 -0
- package/dist/automation/index.js +464 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/cli/code-agent-connector.d.ts +9 -0
- package/dist/cli/code-agent-connector.d.ts.map +1 -1
- package/dist/cli/code-agent-connector.js +212 -10
- package/dist/cli/code-agent-connector.js.map +1 -1
- package/dist/cli/code-agent-executor.d.ts +2 -0
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +8 -1
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +10 -3
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/design-connect.d.ts.map +1 -1
- package/dist/cli/design-connect.js +492 -35
- package/dist/cli/design-connect.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +7 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +38 -13
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +21 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +147 -49
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +17 -38
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/RunStuckBanner.d.ts +14 -1
- package/dist/client/RunStuckBanner.d.ts.map +1 -1
- package/dist/client/RunStuckBanner.js +35 -7
- package/dist/client/RunStuckBanner.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +4 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +49 -4
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/appearance.d.ts +4 -2
- package/dist/client/appearance.d.ts.map +1 -1
- package/dist/client/appearance.js +8 -5
- package/dist/client/appearance.js.map +1 -1
- package/dist/client/automation.d.ts +14 -0
- package/dist/client/automation.d.ts.map +1 -0
- package/dist/client/automation.js +9 -0
- package/dist/client/automation.js.map +1 -0
- package/dist/client/chat/connectors.d.ts.map +1 -1
- package/dist/client/chat/connectors.js +206 -28
- package/dist/client/chat/connectors.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +17 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts +4 -0
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +12 -10
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/chat/runtime.d.ts.map +1 -1
- package/dist/client/chat/runtime.js +84 -24
- package/dist/client/chat/runtime.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +8 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +21 -3
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts +54 -0
- package/dist/client/composer/RealtimeVoiceMode.d.ts.map +1 -0
- package/dist/client/composer/RealtimeVoiceMode.js +63 -0
- package/dist/client/composer/RealtimeVoiceMode.js.map +1 -0
- package/dist/client/composer/TiptapComposer.d.ts +1 -0
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +25 -20
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/composer/VoiceButton.d.ts.map +1 -1
- package/dist/client/composer/VoiceButton.js +9 -0
- package/dist/client/composer/VoiceButton.js.map +1 -1
- package/dist/client/composer/index.d.ts +2 -0
- package/dist/client/composer/index.d.ts.map +1 -1
- package/dist/client/composer/index.js +2 -0
- package/dist/client/composer/index.js.map +1 -1
- package/dist/client/composer/useRealtimeVoiceMode.d.ts +56 -0
- package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +1 -0
- package/dist/client/composer/useRealtimeVoiceMode.js +492 -0
- package/dist/client/composer/useRealtimeVoiceMode.js.map +1 -0
- package/dist/client/guided-questions.d.ts.map +1 -1
- package/dist/client/guided-questions.js +7 -2
- package/dist/client/guided-questions.js.map +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +3 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/integrations/api.d.ts +115 -0
- package/dist/client/integrations/api.d.ts.map +1 -0
- package/dist/client/integrations/api.js +123 -0
- package/dist/client/integrations/api.js.map +1 -0
- package/dist/client/integrations/index.d.ts +1 -0
- package/dist/client/integrations/index.d.ts.map +1 -1
- package/dist/client/integrations/index.js +1 -0
- package/dist/client/integrations/index.js.map +1 -1
- package/dist/client/settings/DemoModeSection.d.ts.map +1 -1
- package/dist/client/settings/DemoModeSection.js +4 -3
- package/dist/client/settings/DemoModeSection.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +4 -0
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsTabsPage.d.ts +10 -3
- package/dist/client/settings/SettingsTabsPage.d.ts.map +1 -1
- package/dist/client/settings/SettingsTabsPage.js +49 -11
- package/dist/client/settings/SettingsTabsPage.js.map +1 -1
- package/dist/client/transcription/use-live-transcription.d.ts.map +1 -1
- package/dist/client/transcription/use-live-transcription.js +59 -5
- package/dist/client/transcription/use-live-transcription.js.map +1 -1
- package/dist/client/use-chat-models.d.ts.map +1 -1
- package/dist/client/use-chat-models.js +6 -14
- package/dist/client/use-chat-models.js.map +1 -1
- package/dist/client/use-db-sync.d.ts.map +1 -1
- package/dist/client/use-db-sync.js +87 -7
- package/dist/client/use-db-sync.js.map +1 -1
- package/dist/client/use-run-stuck-detection.d.ts +16 -1
- package/dist/client/use-run-stuck-detection.d.ts.map +1 -1
- package/dist/client/use-run-stuck-detection.js +23 -4
- package/dist/client/use-run-stuck-detection.js.map +1 -1
- package/dist/code-agents/background-controller.d.ts +1 -1
- package/dist/code-agents/background-controller.d.ts.map +1 -1
- package/dist/code-agents/background-controller.js +17 -1
- package/dist/code-agents/background-controller.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/ydoc-manager.d.ts +9 -1
- package/dist/collab/ydoc-manager.d.ts.map +1 -1
- package/dist/collab/ydoc-manager.js +30 -6
- package/dist/collab/ydoc-manager.js.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +4 -2
- package/dist/db/migrations.js.map +1 -1
- package/dist/demo/fetch-interceptor.d.ts +5 -1
- package/dist/demo/fetch-interceptor.d.ts.map +1 -1
- package/dist/demo/fetch-interceptor.js +16 -12
- package/dist/demo/fetch-interceptor.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +49 -4
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/workspace-deploy.d.ts.map +1 -1
- package/dist/deploy/workspace-deploy.js +31 -2
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/file-upload/types.d.ts +2 -0
- package/dist/file-upload/types.d.ts.map +1 -1
- package/dist/file-upload/types.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/a2a-continuations-store.d.ts.map +1 -1
- package/dist/integrations/a2a-continuations-store.js +6 -4
- package/dist/integrations/a2a-continuations-store.js.map +1 -1
- package/dist/integrations/adapters/discord.d.ts +3 -0
- package/dist/integrations/adapters/discord.d.ts.map +1 -0
- package/dist/integrations/adapters/discord.js +261 -0
- package/dist/integrations/adapters/discord.js.map +1 -0
- package/dist/integrations/adapters/index.d.ts +4 -0
- package/dist/integrations/adapters/index.d.ts.map +1 -0
- package/dist/integrations/adapters/index.js +26 -0
- package/dist/integrations/adapters/index.js.map +1 -0
- package/dist/integrations/adapters/microsoft-teams.d.ts +5 -0
- package/dist/integrations/adapters/microsoft-teams.d.ts.map +1 -0
- package/dist/integrations/adapters/microsoft-teams.js +295 -0
- package/dist/integrations/adapters/microsoft-teams.js.map +1 -0
- package/dist/integrations/adapters/slack.d.ts +10 -2
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +772 -27
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/adapters/telegram.d.ts +0 -2
- package/dist/integrations/adapters/telegram.d.ts.map +1 -1
- package/dist/integrations/adapters/telegram.js +49 -15
- package/dist/integrations/adapters/telegram.js.map +1 -1
- package/dist/integrations/adapters/whatsapp.d.ts +0 -2
- package/dist/integrations/adapters/whatsapp.d.ts.map +1 -1
- package/dist/integrations/adapters/whatsapp.js +40 -17
- package/dist/integrations/adapters/whatsapp.js.map +1 -1
- package/dist/integrations/awaiting-input-store.d.ts +27 -0
- package/dist/integrations/awaiting-input-store.d.ts.map +1 -0
- package/dist/integrations/awaiting-input-store.js +112 -0
- package/dist/integrations/awaiting-input-store.js.map +1 -0
- package/dist/integrations/catalog.d.ts +75 -0
- package/dist/integrations/catalog.d.ts.map +1 -0
- package/dist/integrations/catalog.js +451 -0
- package/dist/integrations/catalog.js.map +1 -0
- package/dist/integrations/computer-supervision-store.d.ts +65 -0
- package/dist/integrations/computer-supervision-store.d.ts.map +1 -0
- package/dist/integrations/computer-supervision-store.js +296 -0
- package/dist/integrations/computer-supervision-store.js.map +1 -0
- package/dist/integrations/computer-supervision.d.ts +11 -0
- package/dist/integrations/computer-supervision.d.ts.map +1 -0
- package/dist/integrations/computer-supervision.js +160 -0
- package/dist/integrations/computer-supervision.js.map +1 -0
- package/dist/integrations/controls-store.d.ts +44 -0
- package/dist/integrations/controls-store.d.ts.map +1 -0
- package/dist/integrations/controls-store.js +129 -0
- package/dist/integrations/controls-store.js.map +1 -0
- package/dist/integrations/index.d.ts +19 -4
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +14 -2
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/installations-store.d.ts +112 -0
- package/dist/integrations/installations-store.d.ts.map +1 -0
- package/dist/integrations/installations-store.js +493 -0
- package/dist/integrations/installations-store.js.map +1 -0
- package/dist/integrations/integration-memory.d.ts +24 -0
- package/dist/integrations/integration-memory.d.ts.map +1 -0
- package/dist/integrations/integration-memory.js +136 -0
- package/dist/integrations/integration-memory.js.map +1 -0
- package/dist/integrations/pending-tasks-retry-job.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-retry-job.js +6 -5
- package/dist/integrations/pending-tasks-retry-job.js.map +1 -1
- package/dist/integrations/pending-tasks-store.d.ts +17 -0
- package/dist/integrations/pending-tasks-store.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-store.js +71 -5
- package/dist/integrations/pending-tasks-store.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +725 -38
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/remote-commands-store.d.ts +15 -1
- package/dist/integrations/remote-commands-store.d.ts.map +1 -1
- package/dist/integrations/remote-commands-store.js +273 -3
- package/dist/integrations/remote-commands-store.js.map +1 -1
- package/dist/integrations/remote-devices-store.d.ts +4 -3
- package/dist/integrations/remote-devices-store.d.ts.map +1 -1
- package/dist/integrations/remote-devices-store.js +49 -2
- package/dist/integrations/remote-devices-store.js.map +1 -1
- package/dist/integrations/remote-json-safety.d.ts +6 -0
- package/dist/integrations/remote-json-safety.d.ts.map +1 -0
- package/dist/integrations/remote-json-safety.js +114 -0
- package/dist/integrations/remote-json-safety.js.map +1 -0
- package/dist/integrations/remote-run-events-store.d.ts +11 -1
- package/dist/integrations/remote-run-events-store.d.ts.map +1 -1
- package/dist/integrations/remote-run-events-store.js +85 -17
- package/dist/integrations/remote-run-events-store.js.map +1 -1
- package/dist/integrations/remote-types.d.ts +54 -3
- package/dist/integrations/remote-types.d.ts.map +1 -1
- package/dist/integrations/remote-types.js.map +1 -1
- package/dist/integrations/scope-store.d.ts +65 -0
- package/dist/integrations/scope-store.d.ts.map +1 -0
- package/dist/integrations/scope-store.js +361 -0
- package/dist/integrations/scope-store.js.map +1 -0
- package/dist/integrations/slack-manifest.d.ts +66 -0
- package/dist/integrations/slack-manifest.d.ts.map +1 -0
- package/dist/integrations/slack-manifest.js +70 -0
- package/dist/integrations/slack-manifest.js.map +1 -0
- package/dist/integrations/slack-oauth.d.ts +99 -0
- package/dist/integrations/slack-oauth.d.ts.map +1 -0
- package/dist/integrations/slack-oauth.js +226 -0
- package/dist/integrations/slack-oauth.js.map +1 -0
- package/dist/integrations/types.d.ts +144 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js +16 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/usage-budget-store.d.ts +84 -0
- package/dist/integrations/usage-budget-store.d.ts.map +1 -0
- package/dist/integrations/usage-budget-store.js +650 -0
- package/dist/integrations/usage-budget-store.js.map +1 -0
- package/dist/integrations/webhook-handler.d.ts +4 -0
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +548 -51
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/scheduler.d.ts +6 -0
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +83 -4
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +43 -11
- package/dist/jobs/tools.js.map +1 -1
- package/dist/localization/default-messages.d.ts +26 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +26 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp-client/config.d.ts.map +1 -1
- package/dist/mcp-client/config.js +44 -3
- package/dist/mcp-client/config.js.map +1 -1
- package/dist/mcp-client/index.d.ts +6 -1
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +11 -3
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/mcp-client/tool-policy.d.ts +24 -0
- package/dist/mcp-client/tool-policy.d.ts.map +1 -0
- package/dist/mcp-client/tool-policy.js +139 -0
- package/dist/mcp-client/tool-policy.js.map +1 -0
- package/dist/observability/routes.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/index.d.ts +4 -4
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +72 -1
- package/dist/provider-api/index.js.map +1 -1
- package/dist/resources/handlers.d.ts.map +1 -1
- package/dist/resources/handlers.js +57 -15
- package/dist/resources/handlers.js.map +1 -1
- package/dist/resources/script-helpers.d.ts.map +1 -1
- package/dist/resources/script-helpers.js +34 -8
- package/dist/resources/script-helpers.js.map +1 -1
- package/dist/resources/store.d.ts +10 -0
- package/dist/resources/store.d.ts.map +1 -1
- package/dist/resources/store.js +54 -47
- package/dist/resources/store.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +106 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/secrets/register-framework-secrets.d.ts +3 -4
- package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
- package/dist/secrets/register-framework-secrets.js +25 -4
- package/dist/secrets/register-framework-secrets.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/agent-chat-plugin.d.ts +15 -4
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +300 -118
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +10 -14
- package/dist/server/auth.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +3 -1
- package/dist/server/builder-design-systems.d.ts.map +1 -1
- package/dist/server/builder-design-systems.js +9 -2
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/edge.d.ts +1 -1
- package/dist/server/edge.d.ts.map +1 -1
- package/dist/server/edge.js +1 -1
- package/dist/server/edge.js.map +1 -1
- package/dist/server/index.d.ts +4 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +4 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/realtime-voice.d.ts +53 -0
- package/dist/server/realtime-voice.d.ts.map +1 -0
- package/dist/server/realtime-voice.js +404 -0
- package/dist/server/realtime-voice.js.map +1 -0
- package/dist/server/request-context.d.ts +18 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/social-og-image.d.ts.map +1 -1
- package/dist/server/social-og-image.js +3 -2
- package/dist/server/social-og-image.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/reasoning-effort.d.ts +20 -0
- package/dist/shared/reasoning-effort.d.ts.map +1 -1
- package/dist/shared/reasoning-effort.js +52 -18
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/styles/agent-conversation.css +17 -0
- package/dist/styles/agent-native.css +62 -44
- package/dist/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/dist/templates/default/AGENTS.md +7 -3
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
- package/dist/templates/workspace-core/AGENTS.md +3 -2
- package/dist/usage/store.d.ts +7 -0
- package/dist/usage/store.d.ts.map +1 -1
- package/dist/usage/store.js +24 -3
- package/dist/usage/store.js.map +1 -1
- package/docs/content/a2a-protocol.mdx +21 -5
- package/docs/content/actions.mdx +9 -23
- package/docs/content/agent-mentions.mdx +31 -29
- package/docs/content/agent-native-toolkit.mdx +15 -6
- package/docs/content/agent-surfaces.mdx +9 -13
- package/docs/content/agent-teams.mdx +1 -0
- package/docs/content/authentication.mdx +10 -3
- package/docs/content/automation-connectors.mdx +123 -0
- package/docs/content/automations.mdx +17 -3
- package/docs/content/blueprint-installer.mdx +11 -4
- package/docs/content/cli-adapters.mdx +9 -6
- package/docs/content/client.mdx +16 -0
- package/docs/content/cloneable-saas.mdx +14 -11
- package/docs/content/code-agents-ui.mdx +65 -0
- package/docs/content/components.mdx +30 -14
- package/docs/content/context-awareness.mdx +27 -15
- package/docs/content/creating-templates.mdx +15 -9
- package/docs/content/cross-app-sso.mdx +16 -6
- package/docs/content/data-programs.mdx +1 -1
- package/docs/content/database.mdx +17 -5
- package/docs/content/deployment.mdx +19 -18
- package/docs/content/dispatch.mdx +6 -2
- package/docs/content/drop-in-agent.mdx +10 -4
- package/docs/content/durable-background-runs.mdx +9 -5
- package/docs/content/durable-resume.mdx +9 -4
- package/docs/content/embedding-sdk.mdx +26 -8
- package/docs/content/evals.mdx +3 -5
- package/docs/content/extensions.mdx +23 -2
- package/docs/content/external-agents.mdx +25 -34
- package/docs/content/faq.mdx +8 -0
- package/docs/content/file-uploads.mdx +12 -3
- package/docs/content/frames.mdx +16 -0
- package/docs/content/generative-ui.mdx +1 -1
- package/docs/content/getting-started.mdx +34 -21
- package/docs/content/harness-agents.mdx +8 -4
- package/docs/content/human-approval.mdx +8 -3
- package/docs/content/internationalization.mdx +9 -4
- package/docs/content/key-concepts.mdx +13 -20
- package/docs/content/local-file-mode.mdx +14 -8
- package/docs/content/locales/ar-SA/actions.mdx +2 -2
- package/docs/content/locales/ar-SA/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/ar-SA/agent-surfaces.mdx +8 -10
- package/docs/content/locales/ar-SA/agent-teams.mdx +1 -0
- package/docs/content/locales/ar-SA/authentication.mdx +1 -1
- package/docs/content/locales/ar-SA/components.mdx +11 -1
- package/docs/content/locales/ar-SA/creating-templates.mdx +3 -7
- package/docs/content/locales/ar-SA/cross-app-sso.mdx +16 -6
- package/docs/content/locales/ar-SA/deployment.mdx +8 -0
- package/docs/content/locales/ar-SA/extensions.mdx +8 -0
- package/docs/content/locales/ar-SA/external-agents.mdx +2 -7
- package/docs/content/locales/ar-SA/key-concepts.mdx +13 -20
- package/docs/content/locales/ar-SA/messaging.mdx +84 -15
- package/docs/content/locales/ar-SA/multi-tenancy.mdx +5 -5
- package/docs/content/locales/ar-SA/notifications.mdx +18 -10
- package/docs/content/locales/ar-SA/processors.mdx +11 -5
- package/docs/content/locales/ar-SA/server.mdx +17 -10
- package/docs/content/locales/ar-SA/sharing.mdx +10 -10
- package/docs/content/locales/ar-SA/skills-guide.mdx +34 -17
- package/docs/content/locales/ar-SA/template-assets.mdx +16 -13
- package/docs/content/locales/ar-SA/template-brain.mdx +3 -1
- package/docs/content/locales/ar-SA/template-clips.mdx +4 -3
- package/docs/content/locales/ar-SA/template-design.mdx +4 -1
- package/docs/content/locales/ar-SA/template-dispatch.mdx +5 -1
- package/docs/content/locales/ar-SA/template-mail.mdx +8 -0
- package/docs/content/locales/ar-SA/tracking.mdx +9 -6
- package/docs/content/locales/ar-SA/using-your-agent.mdx +0 -7
- package/docs/content/locales/ar-SA/voice-input.mdx +6 -0
- package/docs/content/locales/ar-SA/workspace-connections.mdx +9 -2
- package/docs/content/locales/ar-SA/workspace.mdx +19 -18
- package/docs/content/locales/de-DE/actions.mdx +2 -2
- package/docs/content/locales/de-DE/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/de-DE/agent-surfaces.mdx +8 -10
- package/docs/content/locales/de-DE/agent-teams.mdx +1 -0
- package/docs/content/locales/de-DE/authentication.mdx +1 -1
- package/docs/content/locales/de-DE/components.mdx +11 -1
- package/docs/content/locales/de-DE/creating-templates.mdx +3 -7
- package/docs/content/locales/de-DE/cross-app-sso.mdx +16 -6
- package/docs/content/locales/de-DE/deployment.mdx +8 -0
- package/docs/content/locales/de-DE/extensions.mdx +10 -0
- package/docs/content/locales/de-DE/external-agents.mdx +3 -7
- package/docs/content/locales/de-DE/key-concepts.mdx +13 -20
- package/docs/content/locales/de-DE/messaging.mdx +92 -15
- package/docs/content/locales/de-DE/multi-tenancy.mdx +5 -5
- package/docs/content/locales/de-DE/notifications.mdx +18 -10
- package/docs/content/locales/de-DE/processors.mdx +11 -5
- package/docs/content/locales/de-DE/server.mdx +18 -10
- package/docs/content/locales/de-DE/sharing.mdx +10 -10
- package/docs/content/locales/de-DE/skills-guide.mdx +34 -17
- package/docs/content/locales/de-DE/template-assets.mdx +16 -13
- package/docs/content/locales/de-DE/template-brain.mdx +3 -1
- package/docs/content/locales/de-DE/template-clips.mdx +4 -3
- package/docs/content/locales/de-DE/template-design.mdx +4 -1
- package/docs/content/locales/de-DE/template-dispatch.mdx +5 -1
- package/docs/content/locales/de-DE/template-mail.mdx +8 -0
- package/docs/content/locales/de-DE/tracking.mdx +9 -6
- package/docs/content/locales/de-DE/using-your-agent.mdx +0 -7
- package/docs/content/locales/de-DE/voice-input.mdx +6 -0
- package/docs/content/locales/de-DE/workspace-connections.mdx +9 -2
- package/docs/content/locales/de-DE/workspace.mdx +19 -18
- package/docs/content/locales/es-ES/actions.mdx +2 -2
- package/docs/content/locales/es-ES/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/es-ES/agent-surfaces.mdx +8 -10
- package/docs/content/locales/es-ES/agent-teams.mdx +1 -0
- package/docs/content/locales/es-ES/authentication.mdx +1 -1
- package/docs/content/locales/es-ES/components.mdx +11 -1
- package/docs/content/locales/es-ES/creating-templates.mdx +3 -7
- package/docs/content/locales/es-ES/cross-app-sso.mdx +16 -6
- package/docs/content/locales/es-ES/deployment.mdx +8 -0
- package/docs/content/locales/es-ES/extensions.mdx +10 -0
- package/docs/content/locales/es-ES/external-agents.mdx +3 -7
- package/docs/content/locales/es-ES/key-concepts.mdx +13 -20
- package/docs/content/locales/es-ES/messaging.mdx +91 -15
- package/docs/content/locales/es-ES/multi-tenancy.mdx +5 -5
- package/docs/content/locales/es-ES/notifications.mdx +18 -10
- package/docs/content/locales/es-ES/processors.mdx +11 -5
- package/docs/content/locales/es-ES/server.mdx +17 -10
- package/docs/content/locales/es-ES/sharing.mdx +10 -10
- package/docs/content/locales/es-ES/skills-guide.mdx +34 -17
- package/docs/content/locales/es-ES/template-assets.mdx +16 -13
- package/docs/content/locales/es-ES/template-brain.mdx +3 -1
- package/docs/content/locales/es-ES/template-clips.mdx +4 -3
- package/docs/content/locales/es-ES/template-design.mdx +4 -1
- package/docs/content/locales/es-ES/template-dispatch.mdx +5 -1
- package/docs/content/locales/es-ES/template-mail.mdx +8 -0
- package/docs/content/locales/es-ES/tracking.mdx +9 -6
- package/docs/content/locales/es-ES/using-your-agent.mdx +0 -7
- package/docs/content/locales/es-ES/voice-input.mdx +6 -0
- package/docs/content/locales/es-ES/workspace-connections.mdx +9 -2
- package/docs/content/locales/es-ES/workspace.mdx +19 -18
- package/docs/content/locales/fr-FR/actions.mdx +2 -2
- package/docs/content/locales/fr-FR/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/fr-FR/agent-surfaces.mdx +8 -10
- package/docs/content/locales/fr-FR/agent-teams.mdx +1 -0
- package/docs/content/locales/fr-FR/authentication.mdx +1 -1
- package/docs/content/locales/fr-FR/components.mdx +11 -1
- package/docs/content/locales/fr-FR/creating-templates.mdx +3 -7
- package/docs/content/locales/fr-FR/cross-app-sso.mdx +16 -6
- package/docs/content/locales/fr-FR/deployment.mdx +8 -0
- package/docs/content/locales/fr-FR/extensions.mdx +10 -0
- package/docs/content/locales/fr-FR/external-agents.mdx +3 -7
- package/docs/content/locales/fr-FR/key-concepts.mdx +13 -20
- package/docs/content/locales/fr-FR/messaging.mdx +91 -15
- package/docs/content/locales/fr-FR/multi-tenancy.mdx +5 -5
- package/docs/content/locales/fr-FR/notifications.mdx +18 -10
- package/docs/content/locales/fr-FR/processors.mdx +11 -5
- package/docs/content/locales/fr-FR/server.mdx +17 -10
- package/docs/content/locales/fr-FR/sharing.mdx +10 -10
- package/docs/content/locales/fr-FR/skills-guide.mdx +34 -17
- package/docs/content/locales/fr-FR/template-assets.mdx +16 -13
- package/docs/content/locales/fr-FR/template-brain.mdx +3 -1
- package/docs/content/locales/fr-FR/template-clips.mdx +4 -3
- package/docs/content/locales/fr-FR/template-design.mdx +4 -1
- package/docs/content/locales/fr-FR/template-dispatch.mdx +5 -1
- package/docs/content/locales/fr-FR/template-mail.mdx +8 -0
- package/docs/content/locales/fr-FR/tracking.mdx +9 -6
- package/docs/content/locales/fr-FR/using-your-agent.mdx +0 -7
- package/docs/content/locales/fr-FR/voice-input.mdx +6 -0
- package/docs/content/locales/fr-FR/workspace-connections.mdx +9 -2
- package/docs/content/locales/fr-FR/workspace.mdx +19 -18
- package/docs/content/locales/hi-IN/actions.mdx +2 -2
- package/docs/content/locales/hi-IN/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/hi-IN/agent-surfaces.mdx +8 -10
- package/docs/content/locales/hi-IN/agent-teams.mdx +1 -0
- package/docs/content/locales/hi-IN/authentication.mdx +1 -1
- package/docs/content/locales/hi-IN/components.mdx +11 -1
- package/docs/content/locales/hi-IN/creating-templates.mdx +3 -7
- package/docs/content/locales/hi-IN/cross-app-sso.mdx +16 -6
- package/docs/content/locales/hi-IN/deployment.mdx +8 -0
- package/docs/content/locales/hi-IN/extensions.mdx +8 -0
- package/docs/content/locales/hi-IN/external-agents.mdx +2 -7
- package/docs/content/locales/hi-IN/key-concepts.mdx +13 -20
- package/docs/content/locales/hi-IN/messaging.mdx +81 -15
- package/docs/content/locales/hi-IN/multi-tenancy.mdx +5 -5
- package/docs/content/locales/hi-IN/notifications.mdx +18 -10
- package/docs/content/locales/hi-IN/processors.mdx +11 -5
- package/docs/content/locales/hi-IN/server.mdx +17 -10
- package/docs/content/locales/hi-IN/sharing.mdx +10 -10
- package/docs/content/locales/hi-IN/skills-guide.mdx +34 -17
- package/docs/content/locales/hi-IN/template-assets.mdx +16 -13
- package/docs/content/locales/hi-IN/template-brain.mdx +3 -1
- package/docs/content/locales/hi-IN/template-clips.mdx +4 -3
- package/docs/content/locales/hi-IN/template-design.mdx +4 -1
- package/docs/content/locales/hi-IN/template-dispatch.mdx +5 -1
- package/docs/content/locales/hi-IN/template-mail.mdx +8 -0
- package/docs/content/locales/hi-IN/tracking.mdx +9 -6
- package/docs/content/locales/hi-IN/using-your-agent.mdx +0 -7
- package/docs/content/locales/hi-IN/voice-input.mdx +6 -0
- package/docs/content/locales/hi-IN/workspace-connections.mdx +9 -2
- package/docs/content/locales/hi-IN/workspace.mdx +19 -18
- package/docs/content/locales/ja-JP/actions.mdx +2 -2
- package/docs/content/locales/ja-JP/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/ja-JP/agent-surfaces.mdx +8 -10
- package/docs/content/locales/ja-JP/agent-teams.mdx +1 -0
- package/docs/content/locales/ja-JP/authentication.mdx +1 -1
- package/docs/content/locales/ja-JP/components.mdx +11 -1
- package/docs/content/locales/ja-JP/creating-templates.mdx +3 -7
- package/docs/content/locales/ja-JP/cross-app-sso.mdx +16 -6
- package/docs/content/locales/ja-JP/deployment.mdx +8 -0
- package/docs/content/locales/ja-JP/extensions.mdx +9 -0
- package/docs/content/locales/ja-JP/external-agents.mdx +2 -7
- package/docs/content/locales/ja-JP/key-concepts.mdx +13 -20
- package/docs/content/locales/ja-JP/messaging.mdx +81 -15
- package/docs/content/locales/ja-JP/multi-tenancy.mdx +5 -5
- package/docs/content/locales/ja-JP/notifications.mdx +18 -10
- package/docs/content/locales/ja-JP/processors.mdx +11 -5
- package/docs/content/locales/ja-JP/server.mdx +17 -10
- package/docs/content/locales/ja-JP/sharing.mdx +10 -10
- package/docs/content/locales/ja-JP/skills-guide.mdx +34 -17
- package/docs/content/locales/ja-JP/template-assets.mdx +16 -13
- package/docs/content/locales/ja-JP/template-brain.mdx +3 -1
- package/docs/content/locales/ja-JP/template-clips.mdx +4 -4
- package/docs/content/locales/ja-JP/template-design.mdx +4 -1
- package/docs/content/locales/ja-JP/template-dispatch.mdx +5 -1
- package/docs/content/locales/ja-JP/template-mail.mdx +8 -0
- package/docs/content/locales/ja-JP/tracking.mdx +9 -6
- package/docs/content/locales/ja-JP/using-your-agent.mdx +0 -7
- package/docs/content/locales/ja-JP/voice-input.mdx +6 -0
- package/docs/content/locales/ja-JP/workspace-connections.mdx +9 -2
- package/docs/content/locales/ja-JP/workspace.mdx +19 -18
- package/docs/content/locales/ko-KR/actions.mdx +2 -2
- package/docs/content/locales/ko-KR/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/ko-KR/agent-surfaces.mdx +8 -10
- package/docs/content/locales/ko-KR/agent-teams.mdx +1 -0
- package/docs/content/locales/ko-KR/authentication.mdx +1 -1
- package/docs/content/locales/ko-KR/components.mdx +11 -1
- package/docs/content/locales/ko-KR/creating-templates.mdx +3 -7
- package/docs/content/locales/ko-KR/cross-app-sso.mdx +16 -6
- package/docs/content/locales/ko-KR/deployment.mdx +8 -0
- package/docs/content/locales/ko-KR/extensions.mdx +8 -0
- package/docs/content/locales/ko-KR/external-agents.mdx +2 -7
- package/docs/content/locales/ko-KR/key-concepts.mdx +13 -20
- package/docs/content/locales/ko-KR/messaging.mdx +80 -15
- package/docs/content/locales/ko-KR/multi-tenancy.mdx +5 -5
- package/docs/content/locales/ko-KR/notifications.mdx +18 -10
- package/docs/content/locales/ko-KR/processors.mdx +11 -5
- package/docs/content/locales/ko-KR/server.mdx +17 -10
- package/docs/content/locales/ko-KR/sharing.mdx +10 -10
- package/docs/content/locales/ko-KR/skills-guide.mdx +34 -17
- package/docs/content/locales/ko-KR/template-assets.mdx +16 -13
- package/docs/content/locales/ko-KR/template-brain.mdx +3 -1
- package/docs/content/locales/ko-KR/template-clips.mdx +4 -4
- package/docs/content/locales/ko-KR/template-design.mdx +4 -1
- package/docs/content/locales/ko-KR/template-dispatch.mdx +5 -1
- package/docs/content/locales/ko-KR/template-mail.mdx +8 -0
- package/docs/content/locales/ko-KR/tracking.mdx +9 -6
- package/docs/content/locales/ko-KR/using-your-agent.mdx +0 -7
- package/docs/content/locales/ko-KR/voice-input.mdx +6 -0
- package/docs/content/locales/ko-KR/workspace-connections.mdx +9 -2
- package/docs/content/locales/ko-KR/workspace.mdx +19 -18
- package/docs/content/locales/pt-BR/actions.mdx +2 -2
- package/docs/content/locales/pt-BR/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/pt-BR/agent-surfaces.mdx +8 -10
- package/docs/content/locales/pt-BR/agent-teams.mdx +1 -0
- package/docs/content/locales/pt-BR/authentication.mdx +1 -1
- package/docs/content/locales/pt-BR/components.mdx +11 -1
- package/docs/content/locales/pt-BR/creating-templates.mdx +3 -7
- package/docs/content/locales/pt-BR/cross-app-sso.mdx +16 -6
- package/docs/content/locales/pt-BR/deployment.mdx +8 -0
- package/docs/content/locales/pt-BR/extensions.mdx +9 -0
- package/docs/content/locales/pt-BR/external-agents.mdx +3 -7
- package/docs/content/locales/pt-BR/key-concepts.mdx +13 -20
- package/docs/content/locales/pt-BR/messaging.mdx +88 -15
- package/docs/content/locales/pt-BR/multi-tenancy.mdx +5 -5
- package/docs/content/locales/pt-BR/notifications.mdx +18 -10
- package/docs/content/locales/pt-BR/processors.mdx +11 -5
- package/docs/content/locales/pt-BR/server.mdx +17 -10
- package/docs/content/locales/pt-BR/sharing.mdx +10 -10
- package/docs/content/locales/pt-BR/skills-guide.mdx +34 -17
- package/docs/content/locales/pt-BR/template-assets.mdx +16 -13
- package/docs/content/locales/pt-BR/template-brain.mdx +3 -1
- package/docs/content/locales/pt-BR/template-clips.mdx +4 -3
- package/docs/content/locales/pt-BR/template-design.mdx +4 -1
- package/docs/content/locales/pt-BR/template-dispatch.mdx +5 -1
- package/docs/content/locales/pt-BR/template-mail.mdx +8 -0
- package/docs/content/locales/pt-BR/tracking.mdx +9 -6
- package/docs/content/locales/pt-BR/using-your-agent.mdx +0 -7
- package/docs/content/locales/pt-BR/voice-input.mdx +6 -0
- package/docs/content/locales/pt-BR/workspace-connections.mdx +9 -2
- package/docs/content/locales/pt-BR/workspace.mdx +19 -18
- package/docs/content/locales/zh-CN/actions.mdx +2 -2
- package/docs/content/locales/zh-CN/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/zh-CN/agent-surfaces.mdx +8 -10
- package/docs/content/locales/zh-CN/agent-teams.mdx +1 -0
- package/docs/content/locales/zh-CN/authentication.mdx +1 -1
- package/docs/content/locales/zh-CN/components.mdx +11 -1
- package/docs/content/locales/zh-CN/creating-templates.mdx +3 -7
- package/docs/content/locales/zh-CN/cross-app-sso.mdx +16 -6
- package/docs/content/locales/zh-CN/deployment.mdx +8 -0
- package/docs/content/locales/zh-CN/extensions.mdx +6 -0
- package/docs/content/locales/zh-CN/external-agents.mdx +2 -7
- package/docs/content/locales/zh-CN/key-concepts.mdx +13 -20
- package/docs/content/locales/zh-CN/messaging.mdx +78 -15
- package/docs/content/locales/zh-CN/multi-tenancy.mdx +5 -5
- package/docs/content/locales/zh-CN/notifications.mdx +18 -10
- package/docs/content/locales/zh-CN/processors.mdx +11 -5
- package/docs/content/locales/zh-CN/server.mdx +16 -10
- package/docs/content/locales/zh-CN/sharing.mdx +10 -10
- package/docs/content/locales/zh-CN/skills-guide.mdx +34 -17
- package/docs/content/locales/zh-CN/template-assets.mdx +16 -13
- package/docs/content/locales/zh-CN/template-brain.mdx +3 -1
- package/docs/content/locales/zh-CN/template-clips.mdx +4 -4
- package/docs/content/locales/zh-CN/template-design.mdx +4 -1
- package/docs/content/locales/zh-CN/template-dispatch.mdx +5 -1
- package/docs/content/locales/zh-CN/template-mail.mdx +8 -0
- package/docs/content/locales/zh-CN/tracking.mdx +9 -6
- package/docs/content/locales/zh-CN/using-your-agent.mdx +0 -7
- package/docs/content/locales/zh-CN/voice-input.mdx +6 -0
- package/docs/content/locales/zh-CN/workspace-connections.mdx +9 -2
- package/docs/content/locales/zh-CN/workspace.mdx +19 -18
- package/docs/content/locales/zh-TW/actions.mdx +2 -2
- package/docs/content/locales/zh-TW/agent-native-toolkit.mdx +2 -2
- package/docs/content/locales/zh-TW/agent-surfaces.mdx +8 -10
- package/docs/content/locales/zh-TW/agent-teams.mdx +1 -0
- package/docs/content/locales/zh-TW/authentication.mdx +1 -1
- package/docs/content/locales/zh-TW/components.mdx +11 -1
- package/docs/content/locales/zh-TW/creating-templates.mdx +3 -7
- package/docs/content/locales/zh-TW/cross-app-sso.mdx +16 -6
- package/docs/content/locales/zh-TW/deployment.mdx +8 -0
- package/docs/content/locales/zh-TW/extensions.mdx +6 -0
- package/docs/content/locales/zh-TW/external-agents.mdx +2 -7
- package/docs/content/locales/zh-TW/key-concepts.mdx +13 -20
- package/docs/content/locales/zh-TW/messaging.mdx +78 -15
- package/docs/content/locales/zh-TW/multi-tenancy.mdx +5 -5
- package/docs/content/locales/zh-TW/notifications.mdx +18 -10
- package/docs/content/locales/zh-TW/processors.mdx +11 -5
- package/docs/content/locales/zh-TW/server.mdx +16 -10
- package/docs/content/locales/zh-TW/sharing.mdx +10 -10
- package/docs/content/locales/zh-TW/skills-guide.mdx +34 -17
- package/docs/content/locales/zh-TW/template-assets.mdx +16 -13
- package/docs/content/locales/zh-TW/template-brain.mdx +3 -1
- package/docs/content/locales/zh-TW/template-clips.mdx +4 -4
- package/docs/content/locales/zh-TW/template-design.mdx +4 -1
- package/docs/content/locales/zh-TW/template-dispatch.mdx +5 -1
- package/docs/content/locales/zh-TW/template-mail.mdx +8 -0
- package/docs/content/locales/zh-TW/tracking.mdx +9 -6
- package/docs/content/locales/zh-TW/using-your-agent.mdx +0 -7
- package/docs/content/locales/zh-TW/voice-input.mdx +6 -0
- package/docs/content/locales/zh-TW/workspace-connections.mdx +9 -2
- package/docs/content/locales/zh-TW/workspace.mdx +19 -18
- package/docs/content/mcp-apps.mdx +14 -32
- package/docs/content/mcp-clients.mdx +48 -54
- package/docs/content/mcp-protocol.mdx +25 -10
- package/docs/content/messaging.mdx +238 -48
- package/docs/content/multi-app-workspace.mdx +11 -96
- package/docs/content/multi-tenancy.mdx +5 -5
- package/docs/content/native-chat-ui.mdx +4 -4
- package/docs/content/notifications.mdx +19 -12
- package/docs/content/observability.mdx +2 -4
- package/docs/content/observational-memory.mdx +7 -3
- package/docs/content/onboarding.mdx +9 -2
- package/docs/content/plan-plugin.mdx +10 -2
- package/docs/content/pr-visual-recap.mdx +1 -1
- package/docs/content/processors.mdx +11 -5
- package/docs/content/pure-agent-apps.mdx +5 -1
- package/docs/content/real-time-collaboration.mdx +30 -67
- package/docs/content/recurring-jobs.mdx +8 -6
- package/docs/content/routing.mdx +3 -4
- package/docs/content/sandbox-adapters.mdx +30 -53
- package/docs/content/security.mdx +8 -0
- package/docs/content/server.mdx +17 -10
- package/docs/content/sharing.mdx +10 -10
- package/docs/content/skills-guide.mdx +35 -16
- package/docs/content/template-analytics.mdx +11 -8
- package/docs/content/template-assets.mdx +16 -13
- package/docs/content/template-brain.mdx +3 -1
- package/docs/content/template-calendar.mdx +12 -4
- package/docs/content/template-chat.mdx +4 -4
- package/docs/content/template-clips.mdx +6 -3
- package/docs/content/template-content.mdx +23 -18
- package/docs/content/template-design.mdx +7 -1
- package/docs/content/template-dispatch.mdx +5 -1
- package/docs/content/template-mail.mdx +14 -2
- package/docs/content/template-plan.mdx +22 -15
- package/docs/content/template-slides.mdx +11 -3
- package/docs/content/toolkit-agent-ux.mdx +46 -3
- package/docs/content/toolkit-collaboration.mdx +58 -4
- package/docs/content/toolkit-command-navigation.mdx +8 -2
- package/docs/content/toolkit-comments-review.mdx +10 -2
- package/docs/content/toolkit-history.mdx +8 -3
- package/docs/content/toolkit-observability.mdx +48 -2
- package/docs/content/toolkit-org-team.mdx +8 -2
- package/docs/content/toolkit-resources.mdx +45 -2
- package/docs/content/toolkit-settings.mdx +8 -2
- package/docs/content/toolkit-setup-connections.mdx +7 -2
- package/docs/content/toolkit-sharing.mdx +46 -3
- package/docs/content/toolkit-ui.mdx +82 -11
- package/docs/content/tracking.mdx +10 -8
- package/docs/content/using-your-agent.mdx +0 -12
- package/docs/content/voice-input.mdx +7 -1
- package/docs/content/what-is-agent-native.mdx +7 -8
- package/docs/content/workspace-connections.mdx +16 -23
- package/docs/content/workspace-management.mdx +16 -4
- package/docs/content/workspace.mdx +19 -18
- package/package.json +5 -1
- package/src/templates/default/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/src/templates/default/AGENTS.md +7 -3
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +22 -9
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +6 -3
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +25 -0
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +15 -0
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
- package/src/templates/workspace-core/AGENTS.md +3 -2
- package/corpus/core/docs/content/locales/ar-SA/migration-workbench.mdx +0 -76
- package/corpus/core/docs/content/locales/de-DE/migration-workbench.mdx +0 -76
- package/corpus/core/docs/content/locales/es-ES/migration-workbench.mdx +0 -76
- package/corpus/core/docs/content/locales/fr-FR/migration-workbench.mdx +0 -76
- package/corpus/core/docs/content/locales/hi-IN/migration-workbench.mdx +0 -74
- package/corpus/core/docs/content/locales/ja-JP/migration-workbench.mdx +0 -76
- package/corpus/core/docs/content/locales/ko-KR/migration-workbench.mdx +0 -74
- package/corpus/core/docs/content/locales/pt-BR/migration-workbench.mdx +0 -76
- package/corpus/core/docs/content/locales/zh-CN/migration-workbench.mdx +0 -74
- package/corpus/core/docs/content/locales/zh-TW/migration-workbench.mdx +0 -74
- package/corpus/core/docs/content/migration-workbench.mdx +0 -74
- package/corpus/core/docs/content/toolkit-app-adapters.mdx +0 -55
- package/corpus/core/docs/content/toolkit-collaboration-ui.mdx +0 -60
- package/corpus/core/docs/content/toolkit-sharing-ui.mdx +0 -45
- package/corpus/core/docs/content/toolkit-shell-hooks.mdx +0 -36
- package/docs/content/locales/ar-SA/migration-workbench.mdx +0 -76
- package/docs/content/locales/de-DE/migration-workbench.mdx +0 -76
- package/docs/content/locales/es-ES/migration-workbench.mdx +0 -76
- package/docs/content/locales/fr-FR/migration-workbench.mdx +0 -76
- package/docs/content/locales/hi-IN/migration-workbench.mdx +0 -74
- package/docs/content/locales/ja-JP/migration-workbench.mdx +0 -76
- package/docs/content/locales/ko-KR/migration-workbench.mdx +0 -74
- package/docs/content/locales/pt-BR/migration-workbench.mdx +0 -76
- package/docs/content/locales/zh-CN/migration-workbench.mdx +0 -74
- package/docs/content/locales/zh-TW/migration-workbench.mdx +0 -74
- package/docs/content/migration-workbench.mdx +0 -74
- package/docs/content/toolkit-app-adapters.mdx +0 -55
- package/docs/content/toolkit-collaboration-ui.mdx +0 -60
- package/docs/content/toolkit-sharing-ui.mdx +0 -45
- package/docs/content/toolkit-shell-hooks.mdx +0 -36
|
@@ -2,9 +2,14 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { assertValidComputerCommandEnvelope } from "../integrations/computer-supervision.js";
|
|
6
|
+
import { serializeBoundedRemoteJson } from "../integrations/remote-json-safety.js";
|
|
5
7
|
import { executeDenyCodeAgentApproval, executePendingCodeAgentApproval, } from "./code-agent-executor.js";
|
|
6
8
|
import { appendCodeAgentTranscriptEvent, codeAgentRunTranscriptPath, codeAgentStoreRoot, createCodeAgentRunRecord, getCodeAgentRunRecord, listCodeAgentRunRecords, normalizeCodeAgentPermissionMode, queueCodeAgentFollowUp, updateCodeAgentRunRecord, } from "./code-agent-runs.js";
|
|
7
9
|
const DEVICE_PATH_ENV = "AGENT_NATIVE_REMOTE_DEVICE_PATH";
|
|
10
|
+
const COMPUTER_BRIDGE_URL_ENV = "AGENT_NATIVE_COMPUTER_BRIDGE_URL";
|
|
11
|
+
const COMPUTER_BRIDGE_TOKEN_ENV = "AGENT_NATIVE_COMPUTER_BRIDGE_TOKEN";
|
|
12
|
+
const COMPUTER_CAPABILITIES_ENV = "AGENT_NATIVE_COMPUTER_CAPABILITIES";
|
|
8
13
|
const DEFAULT_POLL_INTERVAL_MS = 2_000;
|
|
9
14
|
const MAX_POLL_INTERVAL_MS = 30_000;
|
|
10
15
|
const MAX_TRANSCRIPT_EVENTS_PER_BATCH = 50;
|
|
@@ -73,6 +78,7 @@ class RemoteCodeAgentConnector {
|
|
|
73
78
|
transcriptCursors = new Map();
|
|
74
79
|
remoteRunIds = new Set();
|
|
75
80
|
stopped = false;
|
|
81
|
+
computerBridge = loadLocalComputerBridgeConfig();
|
|
76
82
|
constructor(config, relayUrl, output) {
|
|
77
83
|
this.config = config;
|
|
78
84
|
this.relayUrl = relayUrl;
|
|
@@ -115,6 +121,9 @@ class RemoteCodeAgentConnector {
|
|
|
115
121
|
}
|
|
116
122
|
finally {
|
|
117
123
|
options.signal?.removeEventListener("abort", onAbort);
|
|
124
|
+
if (this.computerBridge) {
|
|
125
|
+
await callLocalComputerBridgeTool(this.computerBridge, "computer_revoke_control", { reason: "connector-stopped" }).catch(() => undefined);
|
|
126
|
+
}
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
async pollOnce() {
|
|
@@ -130,6 +139,7 @@ class RemoteCodeAgentConnector {
|
|
|
130
139
|
"status",
|
|
131
140
|
"run-events",
|
|
132
141
|
],
|
|
142
|
+
computerCapabilities: this.computerBridge?.capabilities ?? {},
|
|
133
143
|
activeRunIds: Array.from(this.remoteRunIds),
|
|
134
144
|
});
|
|
135
145
|
const commands = normalizeCommands(response);
|
|
@@ -156,6 +166,8 @@ class RemoteCodeAgentConnector {
|
|
|
156
166
|
return this.deny(command);
|
|
157
167
|
case "stop":
|
|
158
168
|
return this.stop(command);
|
|
169
|
+
case "computer-operation":
|
|
170
|
+
return this.computerOperation(command);
|
|
159
171
|
case "status":
|
|
160
172
|
return this.status(command);
|
|
161
173
|
default:
|
|
@@ -165,6 +177,9 @@ class RemoteCodeAgentConnector {
|
|
|
165
177
|
};
|
|
166
178
|
}
|
|
167
179
|
}
|
|
180
|
+
async computerOperation(command) {
|
|
181
|
+
return dispatchComputerOperationToLocalBridge(this.computerBridge, command.params.envelope);
|
|
182
|
+
}
|
|
168
183
|
createRun(command) {
|
|
169
184
|
const prompt = firstTextValue(command.params.prompt, command.params.message, command.params.input);
|
|
170
185
|
if (!prompt) {
|
|
@@ -307,13 +322,40 @@ class RemoteCodeAgentConnector {
|
|
|
307
322
|
const result = await executeDenyCodeAgentApproval(runId);
|
|
308
323
|
return { ok: true, runId, run: result ?? getCodeAgentRunRecord(runId) };
|
|
309
324
|
}
|
|
310
|
-
stop(command) {
|
|
325
|
+
async stop(command) {
|
|
311
326
|
const runId = firstStringValue(command.params.runId);
|
|
312
|
-
|
|
313
|
-
|
|
327
|
+
const taskId = firstStringValue(command.params.taskId);
|
|
328
|
+
let revokeError;
|
|
329
|
+
if (this.computerBridge) {
|
|
330
|
+
try {
|
|
331
|
+
await callLocalComputerBridgeTool(this.computerBridge, "computer_revoke_control", { taskId, runId, reason: "remote-stop" });
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
revokeError = error instanceof Error ? error.message : String(error);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else if (taskId || command.params.computer === true) {
|
|
338
|
+
revokeError = "Local authenticated computer bridge is unavailable.";
|
|
339
|
+
}
|
|
340
|
+
if (!runId) {
|
|
341
|
+
return taskId
|
|
342
|
+
? {
|
|
343
|
+
ok: !revokeError,
|
|
344
|
+
taskId,
|
|
345
|
+
revoked: !revokeError,
|
|
346
|
+
error: revokeError,
|
|
347
|
+
}
|
|
348
|
+
: { ok: false, error: "Missing runId." };
|
|
349
|
+
}
|
|
314
350
|
const run = getCodeAgentRunRecord(runId);
|
|
315
|
-
if (!run)
|
|
316
|
-
return {
|
|
351
|
+
if (!run) {
|
|
352
|
+
return {
|
|
353
|
+
ok: !revokeError && Boolean(this.computerBridge),
|
|
354
|
+
runId,
|
|
355
|
+
revoked: !revokeError && Boolean(this.computerBridge),
|
|
356
|
+
error: revokeError ?? `Run not found: ${runId}`,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
317
359
|
const active = activeRunners.get(runId);
|
|
318
360
|
const pid = active?.child.pid ?? Number(run.metadata?.runnerPid);
|
|
319
361
|
let killed = false;
|
|
@@ -359,7 +401,14 @@ class RemoteCodeAgentConnector {
|
|
|
359
401
|
stopError: killError,
|
|
360
402
|
},
|
|
361
403
|
});
|
|
362
|
-
return {
|
|
404
|
+
return {
|
|
405
|
+
ok: !killError && !revokeError,
|
|
406
|
+
runId,
|
|
407
|
+
run: updated,
|
|
408
|
+
killed,
|
|
409
|
+
controlRevoked: !revokeError && Boolean(this.computerBridge),
|
|
410
|
+
error: revokeError ?? killError,
|
|
411
|
+
};
|
|
363
412
|
}
|
|
364
413
|
status(command) {
|
|
365
414
|
const runId = firstStringValue(command.params.runId);
|
|
@@ -458,14 +507,26 @@ class RemoteCodeAgentConnector {
|
|
|
458
507
|
}
|
|
459
508
|
}
|
|
460
509
|
async postCommandResult(command, result) {
|
|
510
|
+
let safeResult;
|
|
511
|
+
try {
|
|
512
|
+
safeResult = boundedConnectorResult(result);
|
|
513
|
+
}
|
|
514
|
+
catch (error) {
|
|
515
|
+
safeResult = {
|
|
516
|
+
ok: false,
|
|
517
|
+
error: error instanceof Error
|
|
518
|
+
? `Connector result rejected: ${error.message}`
|
|
519
|
+
: "Connector result rejected as unsafe.",
|
|
520
|
+
};
|
|
521
|
+
}
|
|
461
522
|
await this.postJson("/_agent-native/integrations/remote/result", {
|
|
462
523
|
deviceId: this.config.deviceId,
|
|
463
524
|
commandId: command.id,
|
|
464
525
|
kind: command.kind,
|
|
465
|
-
ok:
|
|
466
|
-
status:
|
|
467
|
-
result,
|
|
468
|
-
errorMessage: typeof
|
|
526
|
+
ok: safeResult.ok !== false,
|
|
527
|
+
status: safeResult.ok === false ? "failed" : "completed",
|
|
528
|
+
result: safeResult,
|
|
529
|
+
errorMessage: typeof safeResult.error === "string" ? safeResult.error : undefined,
|
|
469
530
|
});
|
|
470
531
|
}
|
|
471
532
|
async postJson(pathname, body) {
|
|
@@ -664,6 +725,147 @@ function normalizeRelayUrl(value) {
|
|
|
664
725
|
return null;
|
|
665
726
|
}
|
|
666
727
|
}
|
|
728
|
+
export function loadLocalComputerBridgeConfig(env = process.env) {
|
|
729
|
+
const rawUrl = firstStringValue(env[COMPUTER_BRIDGE_URL_ENV]);
|
|
730
|
+
const token = firstStringValue(env[COMPUTER_BRIDGE_TOKEN_ENV]);
|
|
731
|
+
const rawCapabilities = firstStringValue(env[COMPUTER_CAPABILITIES_ENV]);
|
|
732
|
+
if (!rawUrl || !token || !rawCapabilities)
|
|
733
|
+
return null;
|
|
734
|
+
let url;
|
|
735
|
+
try {
|
|
736
|
+
url = new URL(rawUrl);
|
|
737
|
+
}
|
|
738
|
+
catch {
|
|
739
|
+
return null;
|
|
740
|
+
}
|
|
741
|
+
const host = url.hostname.toLowerCase();
|
|
742
|
+
if ((url.protocol !== "http:" && url.protocol !== "https:") ||
|
|
743
|
+
(host !== "localhost" && host !== "127.0.0.1" && host !== "[::1]")) {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
try {
|
|
747
|
+
const value = JSON.parse(rawCapabilities);
|
|
748
|
+
const capabilities = normalizeComputerCapabilities(value);
|
|
749
|
+
if (!hasComputerCapability(capabilities))
|
|
750
|
+
return null;
|
|
751
|
+
return { url: url.toString(), token, capabilities };
|
|
752
|
+
}
|
|
753
|
+
catch {
|
|
754
|
+
return null;
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
export async function callLocalComputerBridgeTool(config, toolName, args, fetchImpl = fetch) {
|
|
758
|
+
const response = await fetchImpl(config.url, {
|
|
759
|
+
method: "POST",
|
|
760
|
+
headers: {
|
|
761
|
+
accept: "application/json, text/event-stream",
|
|
762
|
+
authorization: `Bearer ${config.token}`,
|
|
763
|
+
"content-type": "application/json",
|
|
764
|
+
},
|
|
765
|
+
body: JSON.stringify({
|
|
766
|
+
jsonrpc: "2.0",
|
|
767
|
+
id: `computer-bridge-${Date.now()}`,
|
|
768
|
+
method: "tools/call",
|
|
769
|
+
params: { name: toolName, arguments: args },
|
|
770
|
+
}),
|
|
771
|
+
signal: AbortSignal.timeout(30_000),
|
|
772
|
+
});
|
|
773
|
+
if (!response.ok) {
|
|
774
|
+
throw new Error(`Local computer bridge returned ${response.status}`);
|
|
775
|
+
}
|
|
776
|
+
const text = await response.text();
|
|
777
|
+
const payload = parseMcpResponse(text);
|
|
778
|
+
if (!isObject(payload)) {
|
|
779
|
+
throw new Error("Local computer bridge returned an invalid response");
|
|
780
|
+
}
|
|
781
|
+
if (payload.error) {
|
|
782
|
+
const error = isObject(payload.error) ? payload.error : {};
|
|
783
|
+
throw new Error(firstStringValue(error.message) ?? "Local computer bridge rejected call");
|
|
784
|
+
}
|
|
785
|
+
return boundedJsonValue(payload.result, "Local computer bridge result");
|
|
786
|
+
}
|
|
787
|
+
export async function dispatchComputerOperationToLocalBridge(config, rawEnvelope, fetchImpl = fetch) {
|
|
788
|
+
if (!config) {
|
|
789
|
+
throw new Error("Local authenticated computer bridge is unavailable.");
|
|
790
|
+
}
|
|
791
|
+
const envelope = await assertValidComputerCommandEnvelope(rawEnvelope);
|
|
792
|
+
const result = await callLocalComputerBridgeTool(config, "computer_operation", { envelope }, fetchImpl);
|
|
793
|
+
return boundedConnectorResult({
|
|
794
|
+
ok: true,
|
|
795
|
+
taskId: envelope.taskId,
|
|
796
|
+
runId: envelope.runId,
|
|
797
|
+
sequence: envelope.sequence,
|
|
798
|
+
idempotencyKey: envelope.idempotencyKey,
|
|
799
|
+
actionHash: envelope.approval.actionHash,
|
|
800
|
+
operationClass: envelope.operationClass,
|
|
801
|
+
bridgeResult: result,
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
function normalizeComputerCapabilities(value) {
|
|
805
|
+
if (!isObject(value))
|
|
806
|
+
return {};
|
|
807
|
+
const browser = isObject(value.browser) ? value.browser : null;
|
|
808
|
+
const desktop = isObject(value.desktop) ? value.desktop : null;
|
|
809
|
+
return {
|
|
810
|
+
...(browser
|
|
811
|
+
? {
|
|
812
|
+
browser: {
|
|
813
|
+
observe: browser.observe === true,
|
|
814
|
+
control: browser.control === true,
|
|
815
|
+
provider: firstStringValue(browser.provider) ?? null,
|
|
816
|
+
version: firstStringValue(browser.version) ?? null,
|
|
817
|
+
},
|
|
818
|
+
}
|
|
819
|
+
: {}),
|
|
820
|
+
...(desktop
|
|
821
|
+
? {
|
|
822
|
+
desktop: {
|
|
823
|
+
observe: desktop.observe === true,
|
|
824
|
+
control: desktop.control === true,
|
|
825
|
+
accessibility: desktop.accessibility === true,
|
|
826
|
+
screenCapture: desktop.screenCapture === true,
|
|
827
|
+
provider: firstStringValue(desktop.provider) ?? null,
|
|
828
|
+
version: firstStringValue(desktop.version) ?? null,
|
|
829
|
+
},
|
|
830
|
+
}
|
|
831
|
+
: {}),
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function hasComputerCapability(capabilities) {
|
|
835
|
+
return Boolean(capabilities.browser?.observe ||
|
|
836
|
+
capabilities.browser?.control ||
|
|
837
|
+
capabilities.desktop?.observe ||
|
|
838
|
+
capabilities.desktop?.control);
|
|
839
|
+
}
|
|
840
|
+
function parseMcpResponse(text) {
|
|
841
|
+
const trimmed = text.trim();
|
|
842
|
+
if (!trimmed)
|
|
843
|
+
throw new Error("Local computer bridge returned no response");
|
|
844
|
+
if (!trimmed.startsWith("data:"))
|
|
845
|
+
return JSON.parse(trimmed);
|
|
846
|
+
const data = trimmed
|
|
847
|
+
.split(/\r?\n/)
|
|
848
|
+
.filter((line) => line.startsWith("data:"))
|
|
849
|
+
.map((line) => line.slice(5).trim())
|
|
850
|
+
.filter((line) => line && line !== "[DONE]")
|
|
851
|
+
.at(-1);
|
|
852
|
+
if (!data)
|
|
853
|
+
throw new Error("Local computer bridge returned no MCP result");
|
|
854
|
+
return JSON.parse(data);
|
|
855
|
+
}
|
|
856
|
+
function boundedJsonValue(value, label) {
|
|
857
|
+
return JSON.parse(serializeBoundedRemoteJson(value ?? null, {
|
|
858
|
+
label,
|
|
859
|
+
maxBytes: 128_000,
|
|
860
|
+
}));
|
|
861
|
+
}
|
|
862
|
+
function boundedConnectorResult(value) {
|
|
863
|
+
const parsed = boundedJsonValue(value, "Remote connector result");
|
|
864
|
+
if (!isObject(parsed)) {
|
|
865
|
+
throw new Error("Remote connector result must be an object");
|
|
866
|
+
}
|
|
867
|
+
return parsed;
|
|
868
|
+
}
|
|
667
869
|
function firstStringValue(...values) {
|
|
668
870
|
for (const value of values) {
|
|
669
871
|
if (typeof value !== "string")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-agent-connector.js","sourceRoot":"","sources":["../../src/cli/code-agent-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,wBAAwB,GAIzB,MAAM,sBAAsB,CAAC;AAqC9B,MAAM,eAAe,GAAG,iCAAiC,CAAC;AAC1D,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,+BAA+B,GAAG,EAAE,CAAC;AAE3C,MAAM,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;AAEvD,MAAM,UAAU,sBAAsB;IACpC,OAAO,IAAI,CAAC,OAAO,CACjB,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,oBAAoB,CAAC,CACjE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,UAAU,GAAG,sBAAsB,EAAE;IAErC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAY,CAAC;QACxE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,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AAS,CAAC;AACnB,CAAC;AAED,SAAS,eAAe,CAAC,MAAc;IACrC,OAAO,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,GAAW;IACpD,OAAO,KAAK,CAAC,MAAM,IAAI,GAAG;QACxB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,GAAG,EAAE;YACH,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,EAAE,CAAC;QACZ,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { spawn, type ChildProcess } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nimport {\n executeDenyCodeAgentApproval,\n executePendingCodeAgentApproval,\n} from \"./code-agent-executor.js\";\nimport {\n appendCodeAgentTranscriptEvent,\n codeAgentRunTranscriptPath,\n codeAgentStoreRoot,\n createCodeAgentRunRecord,\n getCodeAgentRunRecord,\n listCodeAgentRunRecords,\n normalizeCodeAgentPermissionMode,\n queueCodeAgentFollowUp,\n updateCodeAgentRunRecord,\n type CodeAgentPermissionMode,\n type CodeAgentRunRecord,\n type CodeAgentTranscriptEvent,\n} from \"./code-agent-runs.js\";\n\nexport interface RemoteCodeAgentDeviceConfig {\n token: string;\n relayUrl?: string;\n deviceId?: string;\n deviceName?: string;\n pollIntervalMs?: number;\n}\n\nexport interface RunCodeAgentConnectorOptions {\n relayUrl?: string;\n output?: NodeJS.WritableStream;\n signal?: AbortSignal;\n once?: boolean;\n}\n\ninterface RemoteCommand {\n id: string;\n kind: string;\n params: Record<string, unknown>;\n raw: Record<string, unknown>;\n}\n\ninterface TranscriptCursor {\n offset: number;\n seq: number;\n}\n\ninterface RunnerProcess {\n child: ChildProcess;\n runId: string;\n cwd: string;\n command: string;\n startedAt: string;\n}\n\nconst DEVICE_PATH_ENV = \"AGENT_NATIVE_REMOTE_DEVICE_PATH\";\nconst DEFAULT_POLL_INTERVAL_MS = 2_000;\nconst MAX_POLL_INTERVAL_MS = 30_000;\nconst MAX_TRANSCRIPT_EVENTS_PER_BATCH = 50;\n\nconst activeRunners = new Map<string, RunnerProcess>();\n\nexport function remoteDeviceConfigPath(): string {\n return path.resolve(\n process.env[DEVICE_PATH_ENV] ??\n path.join(os.homedir(), \".agent-native\", \"remote-device.json\"),\n );\n}\n\nexport function loadRemoteCodeAgentDeviceConfig(\n configPath = remoteDeviceConfigPath(),\n): RemoteCodeAgentDeviceConfig | null {\n try {\n const raw = JSON.parse(fs.readFileSync(configPath, \"utf-8\")) as unknown;\n if (!isObject(raw)) return null;\n const token = firstStringValue(\n raw.token,\n raw.deviceToken,\n raw.relayToken,\n raw.accessToken,\n raw.bearerToken,\n );\n if (!token) return null;\n const pollIntervalMs = Number(raw.pollIntervalMs);\n return {\n token,\n relayUrl: firstStringValue(raw.relayUrl, raw.url, raw.baseUrl),\n deviceId: firstStringValue(raw.deviceId, raw.id),\n deviceName: firstStringValue(raw.deviceName, raw.name),\n pollIntervalMs:\n Number.isFinite(pollIntervalMs) && pollIntervalMs > 0\n ? Math.min(Math.max(pollIntervalMs, 500), MAX_POLL_INTERVAL_MS)\n : undefined,\n };\n } catch {\n return null;\n }\n}\n\nexport async function runCodeAgentConnector(\n options: RunCodeAgentConnectorOptions = {},\n): Promise<number> {\n const output = options.output ?? process.stdout;\n const configPath = remoteDeviceConfigPath();\n const config = loadRemoteCodeAgentDeviceConfig(configPath);\n if (!config) {\n output.write(\n [\n \"Agent-Native Code remote connector is not paired.\",\n \"\",\n `Expected device config: ${configPath}`,\n \"Pair this device from Agent Native, or set AGENT_NATIVE_REMOTE_DEVICE_PATH to a JSON file containing a device token.\",\n \"Then run: agent-native code serve --relay-url <relay-url>\",\n \"\",\n ].join(\"\\n\"),\n );\n return 1;\n }\n\n const relayUrl = normalizeRelayUrl(options.relayUrl ?? config.relayUrl);\n if (!relayUrl) {\n output.write(\n [\n \"Agent-Native Code remote connector needs a relay URL.\",\n \"\",\n \"Run: agent-native code serve --relay-url https://your-agent-native-app.example\",\n `Or add \"relayUrl\" to ${configPath}.`,\n \"\",\n ].join(\"\\n\"),\n );\n return 1;\n }\n\n const connector = new RemoteCodeAgentConnector(config, relayUrl, output);\n await connector.run({ signal: options.signal, once: options.once });\n return 0;\n}\n\nclass RemoteCodeAgentConnector {\n private readonly transcriptCursors = new Map<string, TranscriptCursor>();\n private readonly remoteRunIds = new Set<string>();\n private stopped = false;\n\n constructor(\n private readonly config: RemoteCodeAgentDeviceConfig,\n private readonly relayUrl: string,\n private readonly output: NodeJS.WritableStream,\n ) {\n for (const run of listCodeAgentRunRecords()) {\n if (isRemoteStartedRun(run, relayUrl)) {\n this.remoteRunIds.add(run.id);\n this.transcriptCursors.set(run.id, { offset: 0, seq: 0 });\n }\n }\n }\n\n async run(options: { signal?: AbortSignal; once?: boolean } = {}) {\n const onAbort = () => {\n this.stopped = true;\n };\n if (options.signal) {\n if (options.signal.aborted) this.stopped = true;\n else options.signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n\n this.output.write(\n `Agent-Native Code remote connector serving ${this.relayUrl}\\n`,\n );\n\n let backoffMs = this.pollIntervalMs();\n try {\n while (!this.stopped) {\n try {\n await this.pollOnce();\n await this.flushRemoteRunEvents();\n backoffMs = this.pollIntervalMs();\n if (options.once) break;\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n this.output.write(`Remote connector poll failed: ${message}\\n`);\n backoffMs = Math.min(backoffMs * 2, MAX_POLL_INTERVAL_MS);\n }\n await sleep(backoffMs, options.signal);\n }\n } finally {\n options.signal?.removeEventListener(\"abort\", onAbort);\n }\n }\n\n private async pollOnce() {\n const response = await this.postJson(\n \"/_agent-native/integrations/remote/poll\",\n {\n deviceId: this.config.deviceId,\n deviceName: this.config.deviceName ?? os.hostname(),\n capabilities: [\n \"create-run\",\n \"append-followup\",\n \"approve\",\n \"deny\",\n \"stop\",\n \"status\",\n \"run-events\",\n ],\n activeRunIds: Array.from(this.remoteRunIds),\n },\n );\n const commands = normalizeCommands(response);\n for (const command of commands) {\n const result = await this.dispatchCommand(command).catch((err) => ({\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n }));\n await this.postCommandResult(command, result);\n }\n }\n\n private async dispatchCommand(command: RemoteCommand) {\n switch (normalizeKind(command.kind)) {\n case \"create-run\":\n return this.createRun(command);\n case \"append-followup\":\n case \"append-follow-up\":\n case \"followup\":\n case \"follow-up\":\n return this.appendFollowUp(command);\n case \"approve\":\n return this.approve(command);\n case \"deny\":\n return this.deny(command);\n case \"stop\":\n return this.stop(command);\n case \"status\":\n return this.status(command);\n default:\n return {\n ok: false,\n error: `Unsupported remote command kind: ${command.kind}`,\n };\n }\n }\n\n private createRun(command: RemoteCommand) {\n const prompt = firstTextValue(\n command.params.prompt,\n command.params.message,\n command.params.input,\n );\n if (!prompt) {\n return { ok: false, error: \"Missing prompt.\" };\n }\n const goalId = firstStringValue(command.params.goalId) ?? \"task\";\n const cwd = resolveCommandCwd(command.params.cwd);\n const permissionMode =\n normalizeCodeAgentPermissionMode(command.params.permissionMode) ??\n \"full-auto\";\n const engine = firstStringValue(command.params.engine);\n const model = firstStringValue(command.params.model);\n const effort = firstStringValue(\n command.params.effort,\n command.params.reasoningEffort,\n );\n const metadata = isObject(command.params.metadata)\n ? command.params.metadata\n : {};\n const run = createCodeAgentRunRecord({\n goalId,\n title: firstStringValue(command.params.title) ?? titleFromPrompt(prompt),\n subtitle: \"Remote coding task\",\n status: \"queued\",\n phase: \"queued\",\n permissionMode,\n cwd,\n progress: {\n label: \"Queued\",\n completed: 0,\n total: 1,\n percent: 0,\n },\n details: [\n { label: \"Prompt\", value: truncateForDisplay(prompt, 160) },\n { label: \"Agent\", value: \"Remote connector\" },\n { label: \"Mode\", value: permissionMode },\n ],\n metadata: {\n ...metadata,\n prompt,\n source: \"remote-connector\",\n engine,\n model,\n effort,\n remote: {\n commandId: command.id,\n deviceId: this.config.deviceId,\n relayUrl: this.relayUrl,\n },\n },\n });\n\n appendCodeAgentTranscriptEvent({\n runId: run.id,\n kind: \"user\",\n message: prompt,\n metadata: { source: \"remote-initial-prompt\", commandId: command.id },\n });\n appendCodeAgentTranscriptEvent({\n runId: run.id,\n kind: \"status\",\n message: \"Remote Agent-Native Code run queued.\",\n metadata: { status: \"queued\", phase: \"queued\", commandId: command.id },\n });\n this.remoteRunIds.add(run.id);\n this.transcriptCursors.set(run.id, { offset: 0, seq: 0 });\n this.spawnRunner(run.id, cwd, permissionMode);\n return { ok: true, runId: run.id, run };\n }\n\n private appendFollowUp(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n const prompt = firstTextValue(\n command.params.prompt,\n command.params.message,\n );\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n if (!prompt) return { ok: false, error: \"Missing prompt.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n\n const permissionMode =\n normalizeCodeAgentPermissionMode(command.params.permissionMode) ??\n undefined;\n const activeRun = permissionMode\n ? (updateCodeAgentRunRecord(runId, { permissionMode }) ?? run)\n : run;\n const followUpMode =\n firstStringValue(command.params.followUpMode) === \"queued\"\n ? \"queued\"\n : \"immediate\";\n const runnerActive = activeRunners.has(activeRun.id);\n const shouldQueue = activeRun.status === \"needs-approval\" || runnerActive;\n const event = appendCodeAgentTranscriptEvent({\n runId: activeRun.id,\n kind: \"user\",\n message: prompt,\n metadata: {\n source: \"remote-follow-up\",\n commandId: command.id,\n followUpMode,\n delivery: shouldQueue ? followUpMode : \"run-now\",\n },\n });\n\n if (shouldQueue) {\n queueCodeAgentFollowUp({\n runId: activeRun.id,\n prompt,\n mode: followUpMode,\n eventId: event.id,\n permissionMode,\n source: \"remote-follow-up\",\n createdAt: event.createdAt,\n });\n } else {\n this.spawnRunner(activeRun.id, activeRun.cwd, permissionMode);\n }\n this.remoteRunIds.add(activeRun.id);\n return { ok: true, runId: activeRun.id, event, queued: shouldQueue };\n }\n\n private async approve(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n // executePendingCodeAgentApproval now auto-resumes inline after running the\n // approved command, so no separate spawnRunner call is needed.\n const result = await executePendingCodeAgentApproval(runId);\n return { ok: true, runId, run: result ?? getCodeAgentRunRecord(runId) };\n }\n\n private async deny(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: \"Remote approval denied.\",\n metadata: { source: \"remote-connector\", commandId: command.id },\n });\n // Auto-resume so the model can adapt its plan after the denial.\n const result = await executeDenyCodeAgentApproval(runId);\n return { ok: true, runId, run: result ?? getCodeAgentRunRecord(runId) };\n }\n\n private stop(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n const active = activeRunners.get(runId);\n const pid = active?.child.pid ?? Number(run.metadata?.runnerPid);\n let killed = false;\n let killError: string | undefined;\n if (Number.isFinite(pid) && pid > 0) {\n try {\n process.kill(pid, \"SIGTERM\");\n killed = true;\n } catch (err) {\n killError = err instanceof Error ? err.message : String(err);\n }\n }\n activeRunners.delete(runId);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: killed\n ? \"Remote stop requested for Agent-Native Code runner.\"\n : \"Remote stop requested; no active runner process was found.\",\n metadata: {\n source: \"remote-connector\",\n commandId: command.id,\n pid: Number.isFinite(pid) ? pid : undefined,\n killed,\n killError,\n },\n });\n const updated = updateCodeAgentRunRecord(runId, {\n status: \"paused\",\n phase: \"stopped\",\n progress: {\n label: \"Stopped\",\n completed: 0,\n total: 1,\n percent: 0,\n },\n metadata: {\n runnerState: \"stopped\",\n stoppedAt: new Date().toISOString(),\n stoppedBy: \"remote-connector\",\n stopSignalSent: killed,\n stopError: killError,\n },\n });\n return { ok: !killError, runId, run: updated, killed, error: killError };\n }\n\n private status(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (runId) {\n const run = getCodeAgentRunRecord(runId);\n return run\n ? { ok: true, runId, run, runner: runnerStatus(runId) }\n : { ok: false, runId, error: `Run not found: ${runId}` };\n }\n return {\n ok: true,\n runs: listCodeAgentRunRecords().slice(0, 20),\n activeRunIds: Array.from(activeRunners.keys()),\n };\n }\n\n private spawnRunner(\n runId: string,\n cwd: string,\n permissionMode?: CodeAgentPermissionMode,\n ) {\n if (activeRunners.has(runId)) return;\n const invocation = resolveCodeAgentCliInvocation();\n const child = spawn(\n invocation.command,\n [...invocation.args, \"code\", \"run\", runId],\n {\n cwd,\n detached: true,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n env: {\n ...process.env,\n AGENT_NATIVE_CODE_AGENTS_HOME: codeAgentStoreRoot(),\n ...(permissionMode\n ? { AGENT_NATIVE_CODE_AGENT_PERMISSION_MODE: permissionMode }\n : {}),\n },\n },\n );\n const runnerCommand = `${invocation.command} ${[\n ...invocation.args,\n \"code\",\n \"run\",\n runId,\n ].join(\" \")}`;\n const startedAt = new Date().toISOString();\n activeRunners.set(runId, {\n child,\n runId,\n cwd,\n command: runnerCommand,\n startedAt,\n });\n updateCodeAgentRunRecord(runId, {\n status: \"running\",\n phase: \"executing\",\n metadata: {\n runnerState: \"running\",\n runnerPid: child.pid,\n runnerCommand,\n runnerCwd: cwd,\n runnerStartedAt: startedAt,\n },\n });\n child.stdout?.on(\"data\", (chunk) => appendRunnerOutput(runId, chunk));\n child.stderr?.on(\"data\", (chunk) =>\n appendRunnerOutput(runId, chunk, \"runner-stderr\"),\n );\n child.on(\"exit\", (code, signal) => {\n activeRunners.delete(runId);\n updateCodeAgentRunRecord(runId, {\n metadata: {\n runnerState: \"exited\",\n runnerExitedAt: new Date().toISOString(),\n runnerExitCode: code,\n runnerExitSignal: signal,\n },\n });\n });\n child.unref();\n }\n\n private async flushRemoteRunEvents() {\n for (const runId of this.remoteRunIds) {\n const cursor = this.transcriptCursors.get(runId) ?? { offset: 0, seq: 0 };\n const batch = readTranscriptBatch(runId, cursor.offset);\n if (batch.events.length === 0) {\n this.transcriptCursors.set(runId, {\n offset: batch.nextOffset,\n seq: cursor.seq,\n });\n continue;\n }\n await this.postJson(\"/_agent-native/integrations/remote/run-events\", {\n deviceId: this.config.deviceId,\n remoteRunId: runId,\n cursor: { offset: batch.nextOffset },\n events: batch.events.map((event, index) => ({\n seq: cursor.seq + index,\n event,\n })),\n });\n this.transcriptCursors.set(runId, {\n offset: batch.nextOffset,\n seq: cursor.seq + batch.events.length,\n });\n }\n }\n\n private async postCommandResult(\n command: RemoteCommand,\n result: Record<string, unknown>,\n ) {\n await this.postJson(\"/_agent-native/integrations/remote/result\", {\n deviceId: this.config.deviceId,\n commandId: command.id,\n kind: command.kind,\n ok: result.ok !== false,\n status: result.ok === false ? \"failed\" : \"completed\",\n result,\n errorMessage: typeof result.error === \"string\" ? result.error : undefined,\n });\n }\n\n private async postJson(pathname: string, body: unknown): Promise<unknown> {\n const url = new URL(pathname, this.relayUrl);\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n authorization: `Bearer ${this.config.token}`,\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(body),\n });\n if (!response.ok) {\n throw new Error(`${url.pathname} returned ${response.status}`);\n }\n const text = await response.text();\n return text ? JSON.parse(text) : null;\n }\n\n private pollIntervalMs() {\n return this.config.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n }\n}\n\nfunction normalizeCommands(value: unknown): RemoteCommand[] {\n const rawCommands = Array.isArray(value)\n ? value\n : isObject(value) && Array.isArray(value.commands)\n ? value.commands\n : isObject(value) && isObject(value.command)\n ? [value.command]\n : isObject(value) && firstStringValue(value.kind, value.type)\n ? [value]\n : [];\n return rawCommands\n .map((raw): RemoteCommand | null => {\n if (!isObject(raw)) return null;\n const kind = firstStringValue(\n raw.kind,\n raw.type,\n raw.command,\n raw.action,\n );\n if (!kind) return null;\n const params = isObject(raw.params)\n ? raw.params\n : isObject(raw.payload)\n ? raw.payload\n : isObject(raw.args)\n ? raw.args\n : raw;\n return {\n id:\n firstStringValue(raw.id, raw.commandId, raw.requestId) ??\n `${normalizeKind(kind)}-${Date.now()}`,\n kind,\n params,\n raw,\n };\n })\n .filter((command): command is RemoteCommand => Boolean(command));\n}\n\nfunction normalizeKind(value: string): string {\n return value.trim().toLowerCase().replaceAll(\"_\", \"-\");\n}\n\nfunction readTranscriptBatch(runId: string, offset: number) {\n const transcriptPath = codeAgentRunTranscriptPath(runId);\n if (!fs.existsSync(transcriptPath)) {\n return { events: [] as CodeAgentTranscriptEvent[], nextOffset: 0 };\n }\n const stat = fs.statSync(transcriptPath);\n const safeOffset = Math.max(0, Math.min(offset, stat.size));\n const fd = fs.openSync(transcriptPath, \"r\");\n try {\n const length = Math.min(stat.size - safeOffset, 256_000);\n if (length <= 0) {\n return {\n events: [] as CodeAgentTranscriptEvent[],\n nextOffset: safeOffset,\n };\n }\n const buffer = Buffer.alloc(length);\n fs.readSync(fd, buffer, 0, length, safeOffset);\n const text = buffer.toString(\"utf-8\");\n const lines = text.split(/\\r?\\n/);\n const hasTrailingNewline = /\\r?\\n$/.test(text);\n const completeLines = hasTrailingNewline ? lines : lines.slice(0, -1);\n const selected = completeLines\n .filter(Boolean)\n .slice(0, MAX_TRANSCRIPT_EVENTS_PER_BATCH);\n const consumedBytes = Buffer.byteLength(\n selected.map((line) => `${line}\\n`).join(\"\"),\n \"utf-8\",\n );\n return {\n events: selected\n .map((line) => parseTranscriptEvent(line))\n .filter((event): event is CodeAgentTranscriptEvent => Boolean(event)),\n nextOffset: safeOffset + consumedBytes,\n };\n } finally {\n fs.closeSync(fd);\n }\n}\n\nfunction parseTranscriptEvent(line: string): CodeAgentTranscriptEvent | null {\n try {\n const parsed = JSON.parse(line) as unknown;\n if (!isObject(parsed)) return null;\n if (\n parsed.schemaVersion !== 1 ||\n typeof parsed.id !== \"string\" ||\n typeof parsed.runId !== \"string\" ||\n typeof parsed.kind !== \"string\" ||\n typeof parsed.message !== \"string\" ||\n typeof parsed.createdAt !== \"string\"\n ) {\n return null;\n }\n if (\n parsed.kind !== \"user\" &&\n parsed.kind !== \"system\" &&\n parsed.kind !== \"note\" &&\n parsed.kind !== \"artifact\" &&\n parsed.kind !== \"status\"\n ) {\n return null;\n }\n return {\n schemaVersion: 1,\n id: parsed.id,\n runId: parsed.runId,\n kind: parsed.kind,\n message: parsed.message,\n createdAt: parsed.createdAt,\n metadata: isObject(parsed.metadata) ? parsed.metadata : undefined,\n };\n } catch {\n return null;\n }\n}\n\nfunction resolveCodeAgentCliInvocation(): { command: string; args: string[] } {\n const currentEntry = process.argv[1];\n if (\n currentEntry &&\n fs.existsSync(currentEntry) &&\n currentEntry.endsWith(\".js\")\n ) {\n return { command: process.execPath, args: [path.resolve(currentEntry)] };\n }\n const localDist = path.resolve(\"packages/core/dist/cli/index.js\");\n if (fs.existsSync(localDist)) {\n return { command: process.execPath, args: [localDist] };\n }\n return {\n command: \"pnpm\",\n args: [\n \"--filter\",\n \"@agent-native/core\",\n \"exec\",\n \"node\",\n \"dist/cli/index.js\",\n ],\n };\n}\n\nfunction appendRunnerOutput(\n runId: string,\n chunk: Buffer,\n source = \"runner-stdout\",\n) {\n const text = chunk.toString().trim();\n if (!text) return;\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: text,\n metadata: { source },\n });\n}\n\nfunction runnerStatus(runId: string) {\n const runner = activeRunners.get(runId);\n return runner\n ? {\n active: true,\n pid: runner.child.pid,\n command: runner.command,\n cwd: runner.cwd,\n startedAt: runner.startedAt,\n }\n : { active: false };\n}\n\nfunction isRemoteStartedRun(\n run: CodeAgentRunRecord,\n relayUrl: string,\n): boolean {\n const metadata = run.metadata ?? {};\n const remote = isObject(metadata.remote) ? metadata.remote : {};\n return (\n metadata.source === \"remote-connector\" ||\n firstStringValue(remote.relayUrl) === relayUrl\n );\n}\n\nfunction resolveCommandCwd(value: unknown): string {\n const cwd = firstStringValue(value);\n return cwd ? path.resolve(cwd) : process.cwd();\n}\n\nfunction normalizeRelayUrl(value: string | undefined): string | null {\n if (!value) return null;\n try {\n const url = new URL(value);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return null;\n return `${url.origin}${url.pathname.replace(/\\/+$/, \"\") || \"/\"}`;\n } catch {\n return null;\n }\n}\n\nfunction firstStringValue(...values: unknown[]): string | undefined {\n for (const value of values) {\n if (typeof value !== \"string\") continue;\n const trimmed = value.trim();\n if (trimmed) return trimmed;\n }\n return undefined;\n}\n\nfunction firstTextValue(...values: unknown[]): string | undefined {\n for (const value of values) {\n if (typeof value === \"string\" && value.trim()) return value.trim();\n if (!Array.isArray(value)) continue;\n const parts = value\n .map((item) =>\n typeof item === \"string\"\n ? item\n : isObject(item)\n ? (firstStringValue(item.text, item.content, item.message) ?? \"\")\n : \"\",\n )\n .map((part) => part.trim())\n .filter(Boolean);\n if (parts.length > 0) return parts.join(\"\\n\");\n }\n return undefined;\n}\n\nfunction titleFromPrompt(prompt: string): string {\n return truncateForDisplay(prompt.replace(/\\s+/g, \" \").trim(), 80);\n}\n\nfunction truncateForDisplay(value: string, max: number): string {\n return value.length <= max\n ? value\n : `${value.slice(0, Math.max(0, max - 3))}...`;\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) return Promise.resolve();\n return new Promise((resolve) => {\n const timeout = setTimeout(resolve, ms);\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timeout);\n resolve();\n },\n { once: true },\n );\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"code-agent-connector.js","sourceRoot":"","sources":["../../src/cli/code-agent-connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kCAAkC,EAAE,MAAM,yCAAyC,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAKnF,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,gCAAgC,EAChC,sBAAsB,EACtB,wBAAwB,GAIzB,MAAM,s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ACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,eAAe,CAAC,MAAc;IACrC,OAAO,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,GAAW;IACpD,OAAO,KAAK,CAAC,MAAM,IAAI,GAAG;QACxB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AACnD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,KAAK,CAAC,EAAU,EAAE,MAAoB;IAC7C,IAAI,MAAM,EAAE,OAAO;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,GAAG,EAAE;YACH,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,OAAO,EAAE,CAAC;QACZ,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { spawn, type ChildProcess } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\nimport { assertValidComputerCommandEnvelope } from \"../integrations/computer-supervision.js\";\nimport { serializeBoundedRemoteJson } from \"../integrations/remote-json-safety.js\";\nimport type {\n ComputerCommandEnvelope,\n RemoteComputerCapabilities,\n} from \"../integrations/remote-types.js\";\nimport {\n executeDenyCodeAgentApproval,\n executePendingCodeAgentApproval,\n} from \"./code-agent-executor.js\";\nimport {\n appendCodeAgentTranscriptEvent,\n codeAgentRunTranscriptPath,\n codeAgentStoreRoot,\n createCodeAgentRunRecord,\n getCodeAgentRunRecord,\n listCodeAgentRunRecords,\n normalizeCodeAgentPermissionMode,\n queueCodeAgentFollowUp,\n updateCodeAgentRunRecord,\n type CodeAgentPermissionMode,\n type CodeAgentRunRecord,\n type CodeAgentTranscriptEvent,\n} from \"./code-agent-runs.js\";\n\nexport interface RemoteCodeAgentDeviceConfig {\n token: string;\n relayUrl?: string;\n deviceId?: string;\n deviceName?: string;\n pollIntervalMs?: number;\n}\n\nexport interface RunCodeAgentConnectorOptions {\n relayUrl?: string;\n output?: NodeJS.WritableStream;\n signal?: AbortSignal;\n once?: boolean;\n}\n\nexport interface LocalComputerBridgeConfig {\n url: string;\n token: string;\n capabilities: RemoteComputerCapabilities;\n}\n\ninterface RemoteCommand {\n id: string;\n kind: string;\n params: Record<string, unknown>;\n raw: Record<string, unknown>;\n}\n\ninterface TranscriptCursor {\n offset: number;\n seq: number;\n}\n\ninterface RunnerProcess {\n child: ChildProcess;\n runId: string;\n cwd: string;\n command: string;\n startedAt: string;\n}\n\nconst DEVICE_PATH_ENV = \"AGENT_NATIVE_REMOTE_DEVICE_PATH\";\nconst COMPUTER_BRIDGE_URL_ENV = \"AGENT_NATIVE_COMPUTER_BRIDGE_URL\";\nconst COMPUTER_BRIDGE_TOKEN_ENV = \"AGENT_NATIVE_COMPUTER_BRIDGE_TOKEN\";\nconst COMPUTER_CAPABILITIES_ENV = \"AGENT_NATIVE_COMPUTER_CAPABILITIES\";\nconst DEFAULT_POLL_INTERVAL_MS = 2_000;\nconst MAX_POLL_INTERVAL_MS = 30_000;\nconst MAX_TRANSCRIPT_EVENTS_PER_BATCH = 50;\n\nconst activeRunners = new Map<string, RunnerProcess>();\n\nexport function remoteDeviceConfigPath(): string {\n return path.resolve(\n process.env[DEVICE_PATH_ENV] ??\n path.join(os.homedir(), \".agent-native\", \"remote-device.json\"),\n );\n}\n\nexport function loadRemoteCodeAgentDeviceConfig(\n configPath = remoteDeviceConfigPath(),\n): RemoteCodeAgentDeviceConfig | null {\n try {\n const raw = JSON.parse(fs.readFileSync(configPath, \"utf-8\")) as unknown;\n if (!isObject(raw)) return null;\n const token = firstStringValue(\n raw.token,\n raw.deviceToken,\n raw.relayToken,\n raw.accessToken,\n raw.bearerToken,\n );\n if (!token) return null;\n const pollIntervalMs = Number(raw.pollIntervalMs);\n return {\n token,\n relayUrl: firstStringValue(raw.relayUrl, raw.url, raw.baseUrl),\n deviceId: firstStringValue(raw.deviceId, raw.id),\n deviceName: firstStringValue(raw.deviceName, raw.name),\n pollIntervalMs:\n Number.isFinite(pollIntervalMs) && pollIntervalMs > 0\n ? Math.min(Math.max(pollIntervalMs, 500), MAX_POLL_INTERVAL_MS)\n : undefined,\n };\n } catch {\n return null;\n }\n}\n\nexport async function runCodeAgentConnector(\n options: RunCodeAgentConnectorOptions = {},\n): Promise<number> {\n const output = options.output ?? process.stdout;\n const configPath = remoteDeviceConfigPath();\n const config = loadRemoteCodeAgentDeviceConfig(configPath);\n if (!config) {\n output.write(\n [\n \"Agent-Native Code remote connector is not paired.\",\n \"\",\n `Expected device config: ${configPath}`,\n \"Pair this device from Agent Native, or set AGENT_NATIVE_REMOTE_DEVICE_PATH to a JSON file containing a device token.\",\n \"Then run: agent-native code serve --relay-url <relay-url>\",\n \"\",\n ].join(\"\\n\"),\n );\n return 1;\n }\n\n const relayUrl = normalizeRelayUrl(options.relayUrl ?? config.relayUrl);\n if (!relayUrl) {\n output.write(\n [\n \"Agent-Native Code remote connector needs a relay URL.\",\n \"\",\n \"Run: agent-native code serve --relay-url https://your-agent-native-app.example\",\n `Or add \"relayUrl\" to ${configPath}.`,\n \"\",\n ].join(\"\\n\"),\n );\n return 1;\n }\n\n const connector = new RemoteCodeAgentConnector(config, relayUrl, output);\n await connector.run({ signal: options.signal, once: options.once });\n return 0;\n}\n\nclass RemoteCodeAgentConnector {\n private readonly transcriptCursors = new Map<string, TranscriptCursor>();\n private readonly remoteRunIds = new Set<string>();\n private stopped = false;\n private readonly computerBridge = loadLocalComputerBridgeConfig();\n\n constructor(\n private readonly config: RemoteCodeAgentDeviceConfig,\n private readonly relayUrl: string,\n private readonly output: NodeJS.WritableStream,\n ) {\n for (const run of listCodeAgentRunRecords()) {\n if (isRemoteStartedRun(run, relayUrl)) {\n this.remoteRunIds.add(run.id);\n this.transcriptCursors.set(run.id, { offset: 0, seq: 0 });\n }\n }\n }\n\n async run(options: { signal?: AbortSignal; once?: boolean } = {}) {\n const onAbort = () => {\n this.stopped = true;\n };\n if (options.signal) {\n if (options.signal.aborted) this.stopped = true;\n else options.signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n\n this.output.write(\n `Agent-Native Code remote connector serving ${this.relayUrl}\\n`,\n );\n\n let backoffMs = this.pollIntervalMs();\n try {\n while (!this.stopped) {\n try {\n await this.pollOnce();\n await this.flushRemoteRunEvents();\n backoffMs = this.pollIntervalMs();\n if (options.once) break;\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n this.output.write(`Remote connector poll failed: ${message}\\n`);\n backoffMs = Math.min(backoffMs * 2, MAX_POLL_INTERVAL_MS);\n }\n await sleep(backoffMs, options.signal);\n }\n } finally {\n options.signal?.removeEventListener(\"abort\", onAbort);\n if (this.computerBridge) {\n await callLocalComputerBridgeTool(\n this.computerBridge,\n \"computer_revoke_control\",\n { reason: \"connector-stopped\" },\n ).catch(() => undefined);\n }\n }\n }\n\n private async pollOnce() {\n const response = await this.postJson(\n \"/_agent-native/integrations/remote/poll\",\n {\n deviceId: this.config.deviceId,\n deviceName: this.config.deviceName ?? os.hostname(),\n capabilities: [\n \"create-run\",\n \"append-followup\",\n \"approve\",\n \"deny\",\n \"stop\",\n \"status\",\n \"run-events\",\n ],\n computerCapabilities: this.computerBridge?.capabilities ?? {},\n activeRunIds: Array.from(this.remoteRunIds),\n },\n );\n const commands = normalizeCommands(response);\n for (const command of commands) {\n const result = await this.dispatchCommand(command).catch((err) => ({\n ok: false,\n error: err instanceof Error ? err.message : String(err),\n }));\n await this.postCommandResult(command, result);\n }\n }\n\n private async dispatchCommand(command: RemoteCommand) {\n switch (normalizeKind(command.kind)) {\n case \"create-run\":\n return this.createRun(command);\n case \"append-followup\":\n case \"append-follow-up\":\n case \"followup\":\n case \"follow-up\":\n return this.appendFollowUp(command);\n case \"approve\":\n return this.approve(command);\n case \"deny\":\n return this.deny(command);\n case \"stop\":\n return this.stop(command);\n case \"computer-operation\":\n return this.computerOperation(command);\n case \"status\":\n return this.status(command);\n default:\n return {\n ok: false,\n error: `Unsupported remote command kind: ${command.kind}`,\n };\n }\n }\n\n private async computerOperation(command: RemoteCommand) {\n return dispatchComputerOperationToLocalBridge(\n this.computerBridge,\n command.params.envelope,\n );\n }\n\n private createRun(command: RemoteCommand) {\n const prompt = firstTextValue(\n command.params.prompt,\n command.params.message,\n command.params.input,\n );\n if (!prompt) {\n return { ok: false, error: \"Missing prompt.\" };\n }\n const goalId = firstStringValue(command.params.goalId) ?? \"task\";\n const cwd = resolveCommandCwd(command.params.cwd);\n const permissionMode =\n normalizeCodeAgentPermissionMode(command.params.permissionMode) ??\n \"full-auto\";\n const engine = firstStringValue(command.params.engine);\n const model = firstStringValue(command.params.model);\n const effort = firstStringValue(\n command.params.effort,\n command.params.reasoningEffort,\n );\n const metadata = isObject(command.params.metadata)\n ? command.params.metadata\n : {};\n const run = createCodeAgentRunRecord({\n goalId,\n title: firstStringValue(command.params.title) ?? titleFromPrompt(prompt),\n subtitle: \"Remote coding task\",\n status: \"queued\",\n phase: \"queued\",\n permissionMode,\n cwd,\n progress: {\n label: \"Queued\",\n completed: 0,\n total: 1,\n percent: 0,\n },\n details: [\n { label: \"Prompt\", value: truncateForDisplay(prompt, 160) },\n { label: \"Agent\", value: \"Remote connector\" },\n { label: \"Mode\", value: permissionMode },\n ],\n metadata: {\n ...metadata,\n prompt,\n source: \"remote-connector\",\n engine,\n model,\n effort,\n remote: {\n commandId: command.id,\n deviceId: this.config.deviceId,\n relayUrl: this.relayUrl,\n },\n },\n });\n\n appendCodeAgentTranscriptEvent({\n runId: run.id,\n kind: \"user\",\n message: prompt,\n metadata: { source: \"remote-initial-prompt\", commandId: command.id },\n });\n appendCodeAgentTranscriptEvent({\n runId: run.id,\n kind: \"status\",\n message: \"Remote Agent-Native Code run queued.\",\n metadata: { status: \"queued\", phase: \"queued\", commandId: command.id },\n });\n this.remoteRunIds.add(run.id);\n this.transcriptCursors.set(run.id, { offset: 0, seq: 0 });\n this.spawnRunner(run.id, cwd, permissionMode);\n return { ok: true, runId: run.id, run };\n }\n\n private appendFollowUp(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n const prompt = firstTextValue(\n command.params.prompt,\n command.params.message,\n );\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n if (!prompt) return { ok: false, error: \"Missing prompt.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n\n const permissionMode =\n normalizeCodeAgentPermissionMode(command.params.permissionMode) ??\n undefined;\n const activeRun = permissionMode\n ? (updateCodeAgentRunRecord(runId, { permissionMode }) ?? run)\n : run;\n const followUpMode =\n firstStringValue(command.params.followUpMode) === \"queued\"\n ? \"queued\"\n : \"immediate\";\n const runnerActive = activeRunners.has(activeRun.id);\n const shouldQueue = activeRun.status === \"needs-approval\" || runnerActive;\n const event = appendCodeAgentTranscriptEvent({\n runId: activeRun.id,\n kind: \"user\",\n message: prompt,\n metadata: {\n source: \"remote-follow-up\",\n commandId: command.id,\n followUpMode,\n delivery: shouldQueue ? followUpMode : \"run-now\",\n },\n });\n\n if (shouldQueue) {\n queueCodeAgentFollowUp({\n runId: activeRun.id,\n prompt,\n mode: followUpMode,\n eventId: event.id,\n permissionMode,\n source: \"remote-follow-up\",\n createdAt: event.createdAt,\n });\n } else {\n this.spawnRunner(activeRun.id, activeRun.cwd, permissionMode);\n }\n this.remoteRunIds.add(activeRun.id);\n return { ok: true, runId: activeRun.id, event, queued: shouldQueue };\n }\n\n private async approve(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n // executePendingCodeAgentApproval now auto-resumes inline after running the\n // approved command, so no separate spawnRunner call is needed.\n const result = await executePendingCodeAgentApproval(runId);\n return { ok: true, runId, run: result ?? getCodeAgentRunRecord(runId) };\n }\n\n private async deny(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (!runId) return { ok: false, error: \"Missing runId.\" };\n const run = getCodeAgentRunRecord(runId);\n if (!run) return { ok: false, error: `Run not found: ${runId}` };\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: \"Remote approval denied.\",\n metadata: { source: \"remote-connector\", commandId: command.id },\n });\n // Auto-resume so the model can adapt its plan after the denial.\n const result = await executeDenyCodeAgentApproval(runId);\n return { ok: true, runId, run: result ?? getCodeAgentRunRecord(runId) };\n }\n\n private async stop(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n const taskId = firstStringValue(command.params.taskId);\n let revokeError: string | undefined;\n if (this.computerBridge) {\n try {\n await callLocalComputerBridgeTool(\n this.computerBridge,\n \"computer_revoke_control\",\n { taskId, runId, reason: \"remote-stop\" },\n );\n } catch (error) {\n revokeError = error instanceof Error ? error.message : String(error);\n }\n } else if (taskId || command.params.computer === true) {\n revokeError = \"Local authenticated computer bridge is unavailable.\";\n }\n if (!runId) {\n return taskId\n ? {\n ok: !revokeError,\n taskId,\n revoked: !revokeError,\n error: revokeError,\n }\n : { ok: false, error: \"Missing runId.\" };\n }\n const run = getCodeAgentRunRecord(runId);\n if (!run) {\n return {\n ok: !revokeError && Boolean(this.computerBridge),\n runId,\n revoked: !revokeError && Boolean(this.computerBridge),\n error: revokeError ?? `Run not found: ${runId}`,\n };\n }\n const active = activeRunners.get(runId);\n const pid = active?.child.pid ?? Number(run.metadata?.runnerPid);\n let killed = false;\n let killError: string | undefined;\n if (Number.isFinite(pid) && pid > 0) {\n try {\n process.kill(pid, \"SIGTERM\");\n killed = true;\n } catch (err) {\n killError = err instanceof Error ? err.message : String(err);\n }\n }\n activeRunners.delete(runId);\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: killed\n ? \"Remote stop requested for Agent-Native Code runner.\"\n : \"Remote stop requested; no active runner process was found.\",\n metadata: {\n source: \"remote-connector\",\n commandId: command.id,\n pid: Number.isFinite(pid) ? pid : undefined,\n killed,\n killError,\n },\n });\n const updated = updateCodeAgentRunRecord(runId, {\n status: \"paused\",\n phase: \"stopped\",\n progress: {\n label: \"Stopped\",\n completed: 0,\n total: 1,\n percent: 0,\n },\n metadata: {\n runnerState: \"stopped\",\n stoppedAt: new Date().toISOString(),\n stoppedBy: \"remote-connector\",\n stopSignalSent: killed,\n stopError: killError,\n },\n });\n return {\n ok: !killError && !revokeError,\n runId,\n run: updated,\n killed,\n controlRevoked: !revokeError && Boolean(this.computerBridge),\n error: revokeError ?? killError,\n };\n }\n\n private status(command: RemoteCommand) {\n const runId = firstStringValue(command.params.runId);\n if (runId) {\n const run = getCodeAgentRunRecord(runId);\n return run\n ? { ok: true, runId, run, runner: runnerStatus(runId) }\n : { ok: false, runId, error: `Run not found: ${runId}` };\n }\n return {\n ok: true,\n runs: listCodeAgentRunRecords().slice(0, 20),\n activeRunIds: Array.from(activeRunners.keys()),\n };\n }\n\n private spawnRunner(\n runId: string,\n cwd: string,\n permissionMode?: CodeAgentPermissionMode,\n ) {\n if (activeRunners.has(runId)) return;\n const invocation = resolveCodeAgentCliInvocation();\n const child = spawn(\n invocation.command,\n [...invocation.args, \"code\", \"run\", runId],\n {\n cwd,\n detached: true,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n env: {\n ...process.env,\n AGENT_NATIVE_CODE_AGENTS_HOME: codeAgentStoreRoot(),\n ...(permissionMode\n ? { AGENT_NATIVE_CODE_AGENT_PERMISSION_MODE: permissionMode }\n : {}),\n },\n },\n );\n const runnerCommand = `${invocation.command} ${[\n ...invocation.args,\n \"code\",\n \"run\",\n runId,\n ].join(\" \")}`;\n const startedAt = new Date().toISOString();\n activeRunners.set(runId, {\n child,\n runId,\n cwd,\n command: runnerCommand,\n startedAt,\n });\n updateCodeAgentRunRecord(runId, {\n status: \"running\",\n phase: \"executing\",\n metadata: {\n runnerState: \"running\",\n runnerPid: child.pid,\n runnerCommand,\n runnerCwd: cwd,\n runnerStartedAt: startedAt,\n },\n });\n child.stdout?.on(\"data\", (chunk) => appendRunnerOutput(runId, chunk));\n child.stderr?.on(\"data\", (chunk) =>\n appendRunnerOutput(runId, chunk, \"runner-stderr\"),\n );\n child.on(\"exit\", (code, signal) => {\n activeRunners.delete(runId);\n updateCodeAgentRunRecord(runId, {\n metadata: {\n runnerState: \"exited\",\n runnerExitedAt: new Date().toISOString(),\n runnerExitCode: code,\n runnerExitSignal: signal,\n },\n });\n });\n child.unref();\n }\n\n private async flushRemoteRunEvents() {\n for (const runId of this.remoteRunIds) {\n const cursor = this.transcriptCursors.get(runId) ?? { offset: 0, seq: 0 };\n const batch = readTranscriptBatch(runId, cursor.offset);\n if (batch.events.length === 0) {\n this.transcriptCursors.set(runId, {\n offset: batch.nextOffset,\n seq: cursor.seq,\n });\n continue;\n }\n await this.postJson(\"/_agent-native/integrations/remote/run-events\", {\n deviceId: this.config.deviceId,\n remoteRunId: runId,\n cursor: { offset: batch.nextOffset },\n events: batch.events.map((event, index) => ({\n seq: cursor.seq + index,\n event,\n })),\n });\n this.transcriptCursors.set(runId, {\n offset: batch.nextOffset,\n seq: cursor.seq + batch.events.length,\n });\n }\n }\n\n private async postCommandResult(\n command: RemoteCommand,\n result: Record<string, unknown>,\n ) {\n let safeResult: Record<string, unknown>;\n try {\n safeResult = boundedConnectorResult(result);\n } catch (error) {\n safeResult = {\n ok: false,\n error:\n error instanceof Error\n ? `Connector result rejected: ${error.message}`\n : \"Connector result rejected as unsafe.\",\n };\n }\n await this.postJson(\"/_agent-native/integrations/remote/result\", {\n deviceId: this.config.deviceId,\n commandId: command.id,\n kind: command.kind,\n ok: safeResult.ok !== false,\n status: safeResult.ok === false ? \"failed\" : \"completed\",\n result: safeResult,\n errorMessage:\n typeof safeResult.error === \"string\" ? safeResult.error : undefined,\n });\n }\n\n private async postJson(pathname: string, body: unknown): Promise<unknown> {\n const url = new URL(pathname, this.relayUrl);\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n authorization: `Bearer ${this.config.token}`,\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify(body),\n });\n if (!response.ok) {\n throw new Error(`${url.pathname} returned ${response.status}`);\n }\n const text = await response.text();\n return text ? JSON.parse(text) : null;\n }\n\n private pollIntervalMs() {\n return this.config.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;\n }\n}\n\nfunction normalizeCommands(value: unknown): RemoteCommand[] {\n const rawCommands = Array.isArray(value)\n ? value\n : isObject(value) && Array.isArray(value.commands)\n ? value.commands\n : isObject(value) && isObject(value.command)\n ? [value.command]\n : isObject(value) && firstStringValue(value.kind, value.type)\n ? [value]\n : [];\n return rawCommands\n .map((raw): RemoteCommand | null => {\n if (!isObject(raw)) return null;\n const kind = firstStringValue(\n raw.kind,\n raw.type,\n raw.command,\n raw.action,\n );\n if (!kind) return null;\n const params = isObject(raw.params)\n ? raw.params\n : isObject(raw.payload)\n ? raw.payload\n : isObject(raw.args)\n ? raw.args\n : raw;\n return {\n id:\n firstStringValue(raw.id, raw.commandId, raw.requestId) ??\n `${normalizeKind(kind)}-${Date.now()}`,\n kind,\n params,\n raw,\n };\n })\n .filter((command): command is RemoteCommand => Boolean(command));\n}\n\nfunction normalizeKind(value: string): string {\n return value.trim().toLowerCase().replaceAll(\"_\", \"-\");\n}\n\nfunction readTranscriptBatch(runId: string, offset: number) {\n const transcriptPath = codeAgentRunTranscriptPath(runId);\n if (!fs.existsSync(transcriptPath)) {\n return { events: [] as CodeAgentTranscriptEvent[], nextOffset: 0 };\n }\n const stat = fs.statSync(transcriptPath);\n const safeOffset = Math.max(0, Math.min(offset, stat.size));\n const fd = fs.openSync(transcriptPath, \"r\");\n try {\n const length = Math.min(stat.size - safeOffset, 256_000);\n if (length <= 0) {\n return {\n events: [] as CodeAgentTranscriptEvent[],\n nextOffset: safeOffset,\n };\n }\n const buffer = Buffer.alloc(length);\n fs.readSync(fd, buffer, 0, length, safeOffset);\n const text = buffer.toString(\"utf-8\");\n const lines = text.split(/\\r?\\n/);\n const hasTrailingNewline = /\\r?\\n$/.test(text);\n const completeLines = hasTrailingNewline ? lines : lines.slice(0, -1);\n const selected = completeLines\n .filter(Boolean)\n .slice(0, MAX_TRANSCRIPT_EVENTS_PER_BATCH);\n const consumedBytes = Buffer.byteLength(\n selected.map((line) => `${line}\\n`).join(\"\"),\n \"utf-8\",\n );\n return {\n events: selected\n .map((line) => parseTranscriptEvent(line))\n .filter((event): event is CodeAgentTranscriptEvent => Boolean(event)),\n nextOffset: safeOffset + consumedBytes,\n };\n } finally {\n fs.closeSync(fd);\n }\n}\n\nfunction parseTranscriptEvent(line: string): CodeAgentTranscriptEvent | null {\n try {\n const parsed = JSON.parse(line) as unknown;\n if (!isObject(parsed)) return null;\n if (\n parsed.schemaVersion !== 1 ||\n typeof parsed.id !== \"string\" ||\n typeof parsed.runId !== \"string\" ||\n typeof parsed.kind !== \"string\" ||\n typeof parsed.message !== \"string\" ||\n typeof parsed.createdAt !== \"string\"\n ) {\n return null;\n }\n if (\n parsed.kind !== \"user\" &&\n parsed.kind !== \"system\" &&\n parsed.kind !== \"note\" &&\n parsed.kind !== \"artifact\" &&\n parsed.kind !== \"status\"\n ) {\n return null;\n }\n return {\n schemaVersion: 1,\n id: parsed.id,\n runId: parsed.runId,\n kind: parsed.kind,\n message: parsed.message,\n createdAt: parsed.createdAt,\n metadata: isObject(parsed.metadata) ? parsed.metadata : undefined,\n };\n } catch {\n return null;\n }\n}\n\nfunction resolveCodeAgentCliInvocation(): { command: string; args: string[] } {\n const currentEntry = process.argv[1];\n if (\n currentEntry &&\n fs.existsSync(currentEntry) &&\n currentEntry.endsWith(\".js\")\n ) {\n return { command: process.execPath, args: [path.resolve(currentEntry)] };\n }\n const localDist = path.resolve(\"packages/core/dist/cli/index.js\");\n if (fs.existsSync(localDist)) {\n return { command: process.execPath, args: [localDist] };\n }\n return {\n command: \"pnpm\",\n args: [\n \"--filter\",\n \"@agent-native/core\",\n \"exec\",\n \"node\",\n \"dist/cli/index.js\",\n ],\n };\n}\n\nfunction appendRunnerOutput(\n runId: string,\n chunk: Buffer,\n source = \"runner-stdout\",\n) {\n const text = chunk.toString().trim();\n if (!text) return;\n appendCodeAgentTranscriptEvent({\n runId,\n kind: \"status\",\n message: text,\n metadata: { source },\n });\n}\n\nfunction runnerStatus(runId: string) {\n const runner = activeRunners.get(runId);\n return runner\n ? {\n active: true,\n pid: runner.child.pid,\n command: runner.command,\n cwd: runner.cwd,\n startedAt: runner.startedAt,\n }\n : { active: false };\n}\n\nfunction isRemoteStartedRun(\n run: CodeAgentRunRecord,\n relayUrl: string,\n): boolean {\n const metadata = run.metadata ?? {};\n const remote = isObject(metadata.remote) ? metadata.remote : {};\n return (\n metadata.source === \"remote-connector\" ||\n firstStringValue(remote.relayUrl) === relayUrl\n );\n}\n\nfunction resolveCommandCwd(value: unknown): string {\n const cwd = firstStringValue(value);\n return cwd ? path.resolve(cwd) : process.cwd();\n}\n\nfunction normalizeRelayUrl(value: string | undefined): string | null {\n if (!value) return null;\n try {\n const url = new URL(value);\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return null;\n return `${url.origin}${url.pathname.replace(/\\/+$/, \"\") || \"/\"}`;\n } catch {\n return null;\n }\n}\n\nexport function loadLocalComputerBridgeConfig(\n env: NodeJS.ProcessEnv = process.env,\n): LocalComputerBridgeConfig | null {\n const rawUrl = firstStringValue(env[COMPUTER_BRIDGE_URL_ENV]);\n const token = firstStringValue(env[COMPUTER_BRIDGE_TOKEN_ENV]);\n const rawCapabilities = firstStringValue(env[COMPUTER_CAPABILITIES_ENV]);\n if (!rawUrl || !token || !rawCapabilities) return null;\n let url: URL;\n try {\n url = new URL(rawUrl);\n } catch {\n return null;\n }\n const host = url.hostname.toLowerCase();\n if (\n (url.protocol !== \"http:\" && url.protocol !== \"https:\") ||\n (host !== \"localhost\" && host !== \"127.0.0.1\" && host !== \"[::1]\")\n ) {\n return null;\n }\n try {\n const value = JSON.parse(rawCapabilities) as unknown;\n const capabilities = normalizeComputerCapabilities(value);\n if (!hasComputerCapability(capabilities)) return null;\n return { url: url.toString(), token, capabilities };\n } catch {\n return null;\n }\n}\n\nexport async function callLocalComputerBridgeTool(\n config: LocalComputerBridgeConfig,\n toolName: \"computer_operation\" | \"computer_revoke_control\",\n args: Record<string, unknown>,\n fetchImpl: typeof fetch = fetch,\n): Promise<unknown> {\n const response = await fetchImpl(config.url, {\n method: \"POST\",\n headers: {\n accept: \"application/json, text/event-stream\",\n authorization: `Bearer ${config.token}`,\n \"content-type\": \"application/json\",\n },\n body: JSON.stringify({\n jsonrpc: \"2.0\",\n id: `computer-bridge-${Date.now()}`,\n method: \"tools/call\",\n params: { name: toolName, arguments: args },\n }),\n signal: AbortSignal.timeout(30_000),\n });\n if (!response.ok) {\n throw new Error(`Local computer bridge returned ${response.status}`);\n }\n const text = await response.text();\n const payload = parseMcpResponse(text);\n if (!isObject(payload)) {\n throw new Error(\"Local computer bridge returned an invalid response\");\n }\n if (payload.error) {\n const error = isObject(payload.error) ? payload.error : {};\n throw new Error(\n firstStringValue(error.message) ?? \"Local computer bridge rejected call\",\n );\n }\n return boundedJsonValue(payload.result, \"Local computer bridge result\");\n}\n\nexport async function dispatchComputerOperationToLocalBridge(\n config: LocalComputerBridgeConfig | null,\n rawEnvelope: unknown,\n fetchImpl: typeof fetch = fetch,\n): Promise<Record<string, unknown>> {\n if (!config) {\n throw new Error(\"Local authenticated computer bridge is unavailable.\");\n }\n const envelope = await assertValidComputerCommandEnvelope(rawEnvelope);\n const result = await callLocalComputerBridgeTool(\n config,\n \"computer_operation\",\n { envelope },\n fetchImpl,\n );\n return boundedConnectorResult({\n ok: true,\n taskId: envelope.taskId,\n runId: envelope.runId,\n sequence: envelope.sequence,\n idempotencyKey: envelope.idempotencyKey,\n actionHash: envelope.approval.actionHash,\n operationClass: envelope.operationClass,\n bridgeResult: result,\n });\n}\n\nfunction normalizeComputerCapabilities(\n value: unknown,\n): RemoteComputerCapabilities {\n if (!isObject(value)) return {};\n const browser = isObject(value.browser) ? value.browser : null;\n const desktop = isObject(value.desktop) ? value.desktop : null;\n return {\n ...(browser\n ? {\n browser: {\n observe: browser.observe === true,\n control: browser.control === true,\n provider: firstStringValue(browser.provider) ?? null,\n version: firstStringValue(browser.version) ?? null,\n },\n }\n : {}),\n ...(desktop\n ? {\n desktop: {\n observe: desktop.observe === true,\n control: desktop.control === true,\n accessibility: desktop.accessibility === true,\n screenCapture: desktop.screenCapture === true,\n provider: firstStringValue(desktop.provider) ?? null,\n version: firstStringValue(desktop.version) ?? null,\n },\n }\n : {}),\n };\n}\n\nfunction hasComputerCapability(\n capabilities: RemoteComputerCapabilities,\n): boolean {\n return Boolean(\n capabilities.browser?.observe ||\n capabilities.browser?.control ||\n capabilities.desktop?.observe ||\n capabilities.desktop?.control,\n );\n}\n\nfunction parseMcpResponse(text: string): unknown {\n const trimmed = text.trim();\n if (!trimmed) throw new Error(\"Local computer bridge returned no response\");\n if (!trimmed.startsWith(\"data:\")) return JSON.parse(trimmed);\n const data = trimmed\n .split(/\\r?\\n/)\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.slice(5).trim())\n .filter((line) => line && line !== \"[DONE]\")\n .at(-1);\n if (!data) throw new Error(\"Local computer bridge returned no MCP result\");\n return JSON.parse(data);\n}\n\nfunction boundedJsonValue(value: unknown, label: string): unknown {\n return JSON.parse(\n serializeBoundedRemoteJson(value ?? null, {\n label,\n maxBytes: 128_000,\n }),\n );\n}\n\nfunction boundedConnectorResult(\n value: Record<string, unknown>,\n): Record<string, unknown> {\n const parsed = boundedJsonValue(value, \"Remote connector result\");\n if (!isObject(parsed)) {\n throw new Error(\"Remote connector result must be an object\");\n }\n return parsed;\n}\n\nfunction firstStringValue(...values: unknown[]): string | undefined {\n for (const value of values) {\n if (typeof value !== \"string\") continue;\n const trimmed = value.trim();\n if (trimmed) return trimmed;\n }\n return undefined;\n}\n\nfunction firstTextValue(...values: unknown[]): string | undefined {\n for (const value of values) {\n if (typeof value === \"string\" && value.trim()) return value.trim();\n if (!Array.isArray(value)) continue;\n const parts = value\n .map((item) =>\n typeof item === \"string\"\n ? item\n : isObject(item)\n ? (firstStringValue(item.text, item.content, item.message) ?? \"\")\n : \"\",\n )\n .map((part) => part.trim())\n .filter(Boolean);\n if (parts.length > 0) return parts.join(\"\\n\");\n }\n return undefined;\n}\n\nfunction titleFromPrompt(prompt: string): string {\n return truncateForDisplay(prompt.replace(/\\s+/g, \" \").trim(), 80);\n}\n\nfunction truncateForDisplay(value: string, max: number): string {\n return value.length <= max\n ? value\n : `${value.slice(0, Math.max(0, max - 3))}...`;\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nfunction sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (signal?.aborted) return Promise.resolve();\n return new Promise((resolve) => {\n const timeout = setTimeout(resolve, ms);\n signal?.addEventListener(\n \"abort\",\n () => {\n clearTimeout(timeout);\n resolve();\n },\n { once: true },\n );\n });\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentEngine, EngineMessage } from "../agent/engine/types.js";
|
|
2
2
|
import { type AgentPromptAttachment } from "../code-agents/prompt-attachments.js";
|
|
3
|
+
import { type McpToolInvocationPolicy } from "../mcp-client/index.js";
|
|
3
4
|
import { type ReasoningEffort } from "../shared/reasoning-effort.js";
|
|
4
5
|
import { type CodeAgentPermissionMode, type CodeAgentRunRecord } from "./code-agent-runs.js";
|
|
5
6
|
export interface ExecuteCodeAgentRunOptions {
|
|
@@ -14,6 +15,7 @@ export interface ExecuteCodeAgentRunOptions {
|
|
|
14
15
|
signal?: AbortSignal;
|
|
15
16
|
}
|
|
16
17
|
export declare function executeCodeAgentRun(options: ExecuteCodeAgentRunOptions): Promise<CodeAgentRunRecord | null>;
|
|
18
|
+
export declare function codeAgentMcpInvocationPolicy(permissionMode: CodeAgentPermissionMode): McpToolInvocationPolicy;
|
|
17
19
|
export declare function executeExistingCodeAgentRun(runId: string, options?: Omit<ExecuteCodeAgentRunOptions, "runId">): Promise<CodeAgentRunRecord | null>;
|
|
18
20
|
/**
|
|
19
21
|
* Add the pending approval command to the per-project allowlist, then approve
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-agent-executor.d.ts","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EAEd,MAAM,0BAA0B,CAAC;AAalC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"code-agent-executor.d.ts","sourceRoot":"","sources":["../../src/cli/code-agent-executor.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,WAAW,EAEX,aAAa,EAEd,MAAM,0BAA0B,CAAC;AAalC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,sCAAsC,CAAC;AAS9C,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAQL,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AA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CA0CpC;AAyTD;;;;;;;;;;;;;;;;;GAiBG;AACH,wCAAwC;AACxC,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,SAAS,OAAO,sBAAsB,EAAE,wBAAwB,EAAE,GACzE,aAAa,EAAE,CAmHjB;AAmED;;;;;;;;;GASG;AACH,wCAAwC;AACxC,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,uBAAuB,GACtC,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAED,wCAAwC;AACxC,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAc1E;AAED,wCAAwC;AACxC,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,uBAAuB,EACvC,qBAAqB,SAAK,EAC1B,WAAW,SAAK,GACf,MAAM,CA4DR;AA2DD,MAAM,MAAM,0BAA0B,GAClC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,wBAAgB,kCAAkC,CAChD,OAAO,EAAE,MAAM,GACd,0BAA0B,CAuD5B"}
|
|
@@ -146,7 +146,9 @@ export async function executeCodeAgentRun(options) {
|
|
|
146
146
|
});
|
|
147
147
|
const mcpManager = await startCodeAgentMcpManager(existing.id);
|
|
148
148
|
if (mcpManager) {
|
|
149
|
-
Object.assign(actions, mcpToolsToActionEntries(mcpManager
|
|
149
|
+
Object.assign(actions, mcpToolsToActionEntries(mcpManager, {
|
|
150
|
+
invocationPolicy: codeAgentMcpInvocationPolicy(permissionMode),
|
|
151
|
+
}));
|
|
150
152
|
}
|
|
151
153
|
actions[TOOL_SEARCH_ACTION_NAME] = createToolSearchEntry(() => actions);
|
|
152
154
|
const tools = actionsToEngineTools(actions);
|
|
@@ -407,6 +409,11 @@ export async function executeCodeAgentRun(options) {
|
|
|
407
409
|
void running;
|
|
408
410
|
}
|
|
409
411
|
}
|
|
412
|
+
export function codeAgentMcpInvocationPolicy(permissionMode) {
|
|
413
|
+
return {
|
|
414
|
+
mode: permissionMode === "read-only" ? "read-only" : "allow-all",
|
|
415
|
+
};
|
|
416
|
+
}
|
|
410
417
|
async function executeCodexCliRun(options) {
|
|
411
418
|
const cwd = options.run.cwd || process.cwd();
|
|
412
419
|
const outputDir = fs.mkdtempSync(path.join(os.tmpdir(), "agent-native-code-codex-"));
|