@agent-native/core 0.93.0 → 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 +25 -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 +82 -39
- 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 +22 -9
- 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/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/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 +3 -3
- package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +3 -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/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/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 +3 -3
- package/corpus/core/docs/content/locales/de-DE/template-design.mdx +3 -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/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/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 +3 -3
- package/corpus/core/docs/content/locales/es-ES/template-design.mdx +3 -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/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/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 +3 -3
- package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +3 -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/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/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 +3 -3
- package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +3 -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/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/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 +3 -4
- package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +3 -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/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/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 +3 -4
- package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +3 -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/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/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 +3 -3
- package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +3 -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/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/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 +3 -4
- package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +3 -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/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/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 +3 -4
- package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +3 -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 +19 -11
- 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 +3 -3
- package/corpus/core/docs/content/template-content.mdx +23 -18
- package/corpus/core/docs/content/template-design.mdx +3 -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 +1 -1
- package/corpus/core/src/agent/context-xray/tokenize.ts +6 -1
- 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 +190 -6
- package/corpus/core/src/agent/run-manager.ts +5 -1
- package/corpus/core/src/application-state/index.ts +1 -0
- package/corpus/core/src/application-state/store.ts +32 -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/client/AgentPanel.tsx +41 -38
- package/corpus/core/src/client/AssistantChat.tsx +53 -5
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +33 -40
- package/corpus/core/src/client/appearance.ts +8 -5
- 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/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 +21 -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 +18 -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/use-chat-models.ts +17 -17
- package/corpus/core/src/client/use-db-sync.ts +108 -7
- 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/integrations/adapters/slack.ts +41 -2
- package/corpus/core/src/integrations/awaiting-input-store.ts +130 -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/index.ts +29 -1
- package/corpus/core/src/integrations/plugin.ts +231 -2
- 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/webhook-handler.ts +161 -2
- 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/secrets/register-framework-secrets.ts +27 -4
- package/corpus/core/src/server/agent-chat-plugin.ts +62 -8
- package/corpus/core/src/server/index.ts +16 -0
- package/corpus/core/src/server/realtime-voice.ts +590 -0
- package/corpus/core/src/shared/reasoning-effort.ts +61 -19
- package/corpus/core/src/styles/agent-conversation.css +17 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
- 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/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/CreateEventDialog.tsx +100 -13
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +12 -4
- 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/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/clips/.agents/skills/ai-video-tools/SKILL.md +12 -3
- package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +1 -1
- package/corpus/templates/clips/AGENTS.md +4 -2
- package/corpus/templates/clips/actions/regenerate-title.ts +53 -7
- package/corpus/templates/clips/actions/request-transcript.ts +152 -41
- package/corpus/templates/clips/actions/save-browser-transcript.ts +11 -9
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +101 -53
- package/corpus/templates/clips/app/components/player/playback-comment-overlay.tsx +102 -0
- 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/routes/embed.$shareId.tsx +2 -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-recording-pause-and-resume-controls-now-respond-reliably-on-.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/src/app.tsx +70 -42
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +8 -14
- 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/pill-interaction.ts +19 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +90 -39
- package/corpus/templates/clips/desktop/src/lib/transcription-engine.ts +3 -2
- 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/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/whisper_speech.rs +80 -5
- package/corpus/templates/clips/desktop/src-tauri/tauri.conf.json +1 -1
- package/corpus/templates/clips/vitest.config.ts +23 -0
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +28 -9
- package/corpus/templates/content/changelog/2026-07-10-open-documents-no-longer-make-constant-background-requests-w.md +6 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +21 -4
- package/corpus/templates/design/AGENTS.md +7 -0
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +132 -7
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +73 -18
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +6 -1
- package/corpus/templates/design/app/components/design/multi-screen/frame-geometry.ts +135 -5
- 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 +60 -3
- package/corpus/templates/design/app/lib/design-import.ts +31 -3
- package/corpus/templates/design/app/pages/design-editor/latest-write-queue.ts +56 -0
- package/corpus/templates/design/app/pages/design-editor/performance-buffer-guard.ts +80 -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-designs-with-html-examples-inside-alpine-attributes-or-comme.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-long-overview-editing-sessions-lots-of-pan-zoom-screen-switc.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-rich-design-clipboard-markers-are-now-accepted-only-from-the.md +6 -0
- package/corpus/templates/design/e2e/helpers.ts +16 -5
- package/corpus/templates/design/server/source-workspace.ts +28 -2
- package/corpus/templates/design/shared/html-integrity.ts +119 -24
- 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 +3 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +37 -1
- package/corpus/templates/dispatch/app/routes/operations.tsx +1 -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-operations-console-brings-agent-monitoring-and-database-inspection-tog.md +6 -0
- 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/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-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/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/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 +38 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +135 -4
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.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/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/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +6 -5
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +6 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +34 -4
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +16 -37
- package/dist/client/MultiTabAssistantChat.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/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/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 +17 -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 +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/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/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/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/struct-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/integrations/adapters/slack.d.ts +2 -0
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +38 -2
- package/dist/integrations/adapters/slack.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/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/index.d.ts +6 -3
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +5 -2
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +205 -3
- 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/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +133 -4
- package/dist/integrations/webhook-handler.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 +5 -5
- package/dist/resources/handlers.d.ts +3 -3
- 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.map +1 -1
- package/dist/server/agent-chat-plugin.js +53 -6
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- 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/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/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
- 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 +82 -39
- 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 +22 -9
- 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/external-agents.mdx +2 -7
- package/docs/content/locales/ar-SA/key-concepts.mdx +13 -20
- 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 +3 -3
- package/docs/content/locales/ar-SA/template-design.mdx +3 -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/external-agents.mdx +3 -7
- package/docs/content/locales/de-DE/key-concepts.mdx +13 -20
- 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 +3 -3
- package/docs/content/locales/de-DE/template-design.mdx +3 -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/external-agents.mdx +3 -7
- package/docs/content/locales/es-ES/key-concepts.mdx +13 -20
- 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 +3 -3
- package/docs/content/locales/es-ES/template-design.mdx +3 -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/external-agents.mdx +3 -7
- package/docs/content/locales/fr-FR/key-concepts.mdx +13 -20
- 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 +3 -3
- package/docs/content/locales/fr-FR/template-design.mdx +3 -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/external-agents.mdx +2 -7
- package/docs/content/locales/hi-IN/key-concepts.mdx +13 -20
- 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 +3 -3
- package/docs/content/locales/hi-IN/template-design.mdx +3 -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/external-agents.mdx +2 -7
- package/docs/content/locales/ja-JP/key-concepts.mdx +13 -20
- 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 +3 -4
- package/docs/content/locales/ja-JP/template-design.mdx +3 -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/external-agents.mdx +2 -7
- package/docs/content/locales/ko-KR/key-concepts.mdx +13 -20
- 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 +3 -4
- package/docs/content/locales/ko-KR/template-design.mdx +3 -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/external-agents.mdx +3 -7
- package/docs/content/locales/pt-BR/key-concepts.mdx +13 -20
- 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 +3 -3
- package/docs/content/locales/pt-BR/template-design.mdx +3 -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/external-agents.mdx +2 -7
- package/docs/content/locales/zh-CN/key-concepts.mdx +13 -20
- 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 +3 -4
- package/docs/content/locales/zh-CN/template-design.mdx +3 -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/external-agents.mdx +2 -7
- package/docs/content/locales/zh-TW/key-concepts.mdx +13 -20
- 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 +3 -4
- package/docs/content/locales/zh-TW/template-design.mdx +3 -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 +19 -11
- 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 +3 -3
- package/docs/content/template-content.mdx +23 -18
- package/docs/content/template-design.mdx +3 -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 +1 -1
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +39 -5
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"awaiting-input-store.js","sourceRoot":"","sources":["../../src/integrations/awaiting-input-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,IAAI,W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"../db/ddl-guard.js\";\n\nlet initPromise: Promise<void> | undefined;\n\n/** Channel-thread clarification windows are deliberately short-lived. */\nexport const INTEGRATION_AWAITING_INPUT_TTL_MS = 24 * 60 * 60 * 1000;\n\nasync function ensureTable(): Promise<void> {\n if (!initPromise) {\n initPromise = (async () => {\n const client = getDbExec();\n const createSql = `\n CREATE TABLE IF NOT EXISTS integration_awaiting_inputs (\n platform TEXT NOT NULL,\n external_thread_id TEXT NOT NULL,\n requester_id TEXT NOT NULL,\n expires_at ${intType()} NOT NULL,\n created_at ${intType()} NOT NULL,\n updated_at ${intType()} NOT NULL,\n PRIMARY KEY (platform, external_thread_id)\n )\n `;\n if (isPostgres()) {\n await ensureTableExists(\"integration_awaiting_inputs\", createSql);\n return;\n }\n await client.execute(createSql);\n })().catch((error) => {\n initPromise = undefined;\n throw error;\n });\n }\n return initPromise;\n}\n\n/**\n * Open (or refresh) the bounded reply window after an integration explicitly\n * asks the originating Slack user a question. The workspace-qualified external\n * thread id and requester id prevent unrelated channel messages from opting in.\n */\nexport async function setIntegrationAwaitingInput(input: {\n platform: string;\n externalThreadId: string;\n requesterId: string;\n expiresAt?: number;\n}): Promise<void> {\n await ensureTable();\n const requesterId = input.requesterId.trim();\n if (!requesterId) throw new Error(\"requesterId is required\");\n const now = Date.now();\n const expiresAt = input.expiresAt ?? now + INTEGRATION_AWAITING_INPUT_TTL_MS;\n const client = getDbExec();\n await client.execute({\n sql: isPostgres()\n ? `INSERT INTO integration_awaiting_inputs (platform, external_thread_id, requester_id, expires_at, created_at, updated_at)\n VALUES (?, ?, ?, ?, ?, ?)\n ON CONFLICT (platform, external_thread_id) DO UPDATE SET\n requester_id = EXCLUDED.requester_id,\n expires_at = EXCLUDED.expires_at,\n updated_at = EXCLUDED.updated_at`\n : `INSERT OR REPLACE INTO integration_awaiting_inputs (platform, external_thread_id, requester_id, expires_at, created_at, updated_at)\n VALUES (?, ?, ?, ?, ?, ?)`,\n args: [\n input.platform,\n input.externalThreadId,\n requesterId,\n expiresAt,\n now,\n now,\n ],\n });\n}\n\n/**\n * Atomically consume the one reply window for this exact requester. Competing\n * Slack deliveries cannot both claim it, and expired rows never authorize a\n * later unmentioned reply.\n */\nexport async function consumeIntegrationAwaitingInput(input: {\n platform: string;\n externalThreadId: string;\n requesterId: string;\n}): Promise<boolean> {\n await ensureTable();\n const client = getDbExec();\n const result = await client.execute({\n sql: isPostgres()\n ? `DELETE FROM integration_awaiting_inputs\n WHERE platform = ?\n AND external_thread_id = ?\n AND requester_id = ?\n AND expires_at > ?\n RETURNING platform`\n : `DELETE FROM integration_awaiting_inputs\n WHERE platform = ?\n AND external_thread_id = ?\n AND requester_id = ?\n AND expires_at > ?`,\n args: [\n input.platform,\n input.externalThreadId,\n input.requesterId,\n Date.now(),\n ],\n });\n\n if (isPostgres()) return (result.rows ?? []).length > 0;\n const affected =\n (result as { rowsAffected?: number; rowCount?: number }).rowsAffected ??\n (result as { rowsAffected?: number; rowCount?: number }).rowCount ??\n 0;\n return affected > 0;\n}\n\n/** Clear any outstanding clarification window once the thread resolves. */\nexport async function clearIntegrationAwaitingInput(\n platform: string,\n externalThreadId: string,\n): Promise<void> {\n await ensureTable();\n await getDbExec().execute({\n sql: `DELETE FROM integration_awaiting_inputs WHERE platform = ? AND external_thread_id = ?`,\n args: [platform, externalThreadId],\n });\n}\n\nexport function _resetIntegrationAwaitingInputStoreForTests(): void {\n initPromise = undefined;\n}\n"]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { DbExec } from "../db/client.js";
|
|
2
|
+
import type { ComputerApprovalScope, ComputerCommandEnvelope, ComputerOperationClass } from "./remote-types.js";
|
|
3
|
+
export type ComputerApprovalStatus = "pending" | "approved" | "denied" | "consumed" | "expired";
|
|
4
|
+
export interface ComputerApprovalRecord {
|
|
5
|
+
id: string;
|
|
6
|
+
ownerEmail: string;
|
|
7
|
+
orgId: string | null;
|
|
8
|
+
deviceId: string;
|
|
9
|
+
taskId: string;
|
|
10
|
+
runId: string;
|
|
11
|
+
operationClass: ComputerOperationClass;
|
|
12
|
+
scope: ComputerApprovalScope;
|
|
13
|
+
actionHash: string;
|
|
14
|
+
status: ComputerApprovalStatus;
|
|
15
|
+
decisionResult: Record<string, unknown> | null;
|
|
16
|
+
decidedBy: string | null;
|
|
17
|
+
decidedAt: number | null;
|
|
18
|
+
expiresAt: number;
|
|
19
|
+
consumedAt: number | null;
|
|
20
|
+
createdAt: number;
|
|
21
|
+
updatedAt: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function ensureComputerApprovalStore(): Promise<void>;
|
|
24
|
+
export declare function createComputerApprovalRequest(input: {
|
|
25
|
+
ownerEmail: string;
|
|
26
|
+
orgId?: string | null;
|
|
27
|
+
deviceId: string;
|
|
28
|
+
envelope: ComputerCommandEnvelope;
|
|
29
|
+
}): Promise<ComputerApprovalRecord>;
|
|
30
|
+
export declare function decideComputerApproval(input: {
|
|
31
|
+
id: string;
|
|
32
|
+
ownerEmail: string;
|
|
33
|
+
orgId?: string | null;
|
|
34
|
+
actionHash: string;
|
|
35
|
+
decision: "approved" | "denied";
|
|
36
|
+
decidedBy: string;
|
|
37
|
+
result?: Record<string, unknown> | null;
|
|
38
|
+
}): Promise<ComputerApprovalRecord | null>;
|
|
39
|
+
export declare function getComputerApprovalForOwner(input: {
|
|
40
|
+
id: string;
|
|
41
|
+
ownerEmail: string;
|
|
42
|
+
orgId?: string | null;
|
|
43
|
+
}): Promise<ComputerApprovalRecord | null>;
|
|
44
|
+
export declare function listComputerApprovalsForOwner(input: {
|
|
45
|
+
ownerEmail: string;
|
|
46
|
+
orgId?: string | null;
|
|
47
|
+
deviceId?: string;
|
|
48
|
+
taskId?: string;
|
|
49
|
+
runId?: string;
|
|
50
|
+
status?: ComputerApprovalStatus;
|
|
51
|
+
limit?: number;
|
|
52
|
+
}): Promise<ComputerApprovalRecord[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Authorizes an operation immediately before it is enqueued. Callers should
|
|
55
|
+
* pass their transaction handle so one-shot approval consumption and command
|
|
56
|
+
* insertion commit atomically.
|
|
57
|
+
*/
|
|
58
|
+
export declare function authorizeComputerOperation(input: {
|
|
59
|
+
ownerEmail: string;
|
|
60
|
+
orgId?: string | null;
|
|
61
|
+
deviceId: string;
|
|
62
|
+
envelope: ComputerCommandEnvelope;
|
|
63
|
+
now?: number;
|
|
64
|
+
}, client?: DbExec): Promise<void>;
|
|
65
|
+
//# sourceMappingURL=computer-supervision-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer-supervision-store.d.ts","sourceRoot":"","sources":["../../src/integrations/computer-supervision-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAe9C,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,sBAAsB,GAC9B,SAAS,GACT,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,sBAAsB,CAAC;IACvC,KAAK,EAAE,qBAAqB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,S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AM,CAAC;CAChB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAoCpC;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE;IACL,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,uBAAuB,CAAC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,EACD,MAAM,GAAE,MAAoB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAkFf"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { getDbExec, intType, isPostgres, retryOnDdlRace, } from "../db/client.js";
|
|
2
|
+
import { ensureIndexExists, ensureTableExists } from "../db/ddl-guard.js";
|
|
3
|
+
import { assertValidComputerCommandEnvelope, ComputerSupervisionError, computerOperationRequiresApproval, } from "./computer-supervision.js";
|
|
4
|
+
import { getRemoteDeviceForOwner } from "./remote-devices-store.js";
|
|
5
|
+
import { serializeBoundedRemoteJson } from "./remote-json-safety.js";
|
|
6
|
+
let _initPromise;
|
|
7
|
+
export async function ensureComputerApprovalStore() {
|
|
8
|
+
if (!_initPromise) {
|
|
9
|
+
_initPromise = (async () => {
|
|
10
|
+
const createSql = `CREATE TABLE IF NOT EXISTS integration_computer_approvals (
|
|
11
|
+
id TEXT PRIMARY KEY,
|
|
12
|
+
owner_email TEXT NOT NULL,
|
|
13
|
+
org_id TEXT,
|
|
14
|
+
device_id TEXT NOT NULL,
|
|
15
|
+
task_id TEXT NOT NULL,
|
|
16
|
+
run_id TEXT NOT NULL,
|
|
17
|
+
operation_class TEXT NOT NULL,
|
|
18
|
+
approval_scope TEXT NOT NULL,
|
|
19
|
+
action_hash TEXT NOT NULL,
|
|
20
|
+
status TEXT NOT NULL,
|
|
21
|
+
decision_result_json TEXT,
|
|
22
|
+
decided_by TEXT,
|
|
23
|
+
decided_at ${intType()},
|
|
24
|
+
expires_at ${intType()} NOT NULL,
|
|
25
|
+
consumed_at ${intType()},
|
|
26
|
+
created_at ${intType()} NOT NULL,
|
|
27
|
+
updated_at ${intType()} NOT NULL
|
|
28
|
+
)`;
|
|
29
|
+
if (isPostgres()) {
|
|
30
|
+
await ensureTableExists("integration_computer_approvals", createSql);
|
|
31
|
+
await ensureIndexExists("idx_computer_approvals_owner", `CREATE INDEX IF NOT EXISTS idx_computer_approvals_owner ON integration_computer_approvals(owner_email, org_id, updated_at)`);
|
|
32
|
+
await ensureIndexExists("idx_computer_approvals_binding", `CREATE INDEX IF NOT EXISTS idx_computer_approvals_binding ON integration_computer_approvals(device_id, task_id, run_id, action_hash)`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const client = getDbExec();
|
|
36
|
+
await retryOnDdlRace(() => client.execute(createSql));
|
|
37
|
+
await retryOnDdlRace(() => client.execute(`CREATE INDEX IF NOT EXISTS idx_computer_approvals_owner ON integration_computer_approvals(owner_email, org_id, updated_at)`));
|
|
38
|
+
await retryOnDdlRace(() => client.execute(`CREATE INDEX IF NOT EXISTS idx_computer_approvals_binding ON integration_computer_approvals(device_id, task_id, run_id, action_hash)`));
|
|
39
|
+
})().catch((error) => {
|
|
40
|
+
_initPromise = undefined;
|
|
41
|
+
throw error;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return _initPromise;
|
|
45
|
+
}
|
|
46
|
+
export async function createComputerApprovalRequest(input) {
|
|
47
|
+
const device = await getRemoteDeviceForOwner({
|
|
48
|
+
id: input.deviceId,
|
|
49
|
+
ownerEmail: input.ownerEmail,
|
|
50
|
+
orgId: input.orgId,
|
|
51
|
+
});
|
|
52
|
+
if (!device || device.status !== "active") {
|
|
53
|
+
throw new ComputerSupervisionError("approval-mismatch", "Computer device does not belong to this owner and organization");
|
|
54
|
+
}
|
|
55
|
+
await ensureComputerApprovalStore();
|
|
56
|
+
const envelope = await assertValidComputerCommandEnvelope(input.envelope);
|
|
57
|
+
const now = Date.now();
|
|
58
|
+
const id = `computer-approval-${now}-${randomHex(8)}`;
|
|
59
|
+
await getDbExec().execute({
|
|
60
|
+
sql: `INSERT INTO integration_computer_approvals
|
|
61
|
+
(id, owner_email, org_id, device_id, task_id, run_id, operation_class,
|
|
62
|
+
approval_scope, action_hash, status, decision_result_json, decided_by,
|
|
63
|
+
decided_at, expires_at, consumed_at, created_at, updated_at)
|
|
64
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
65
|
+
args: [
|
|
66
|
+
id,
|
|
67
|
+
input.ownerEmail,
|
|
68
|
+
input.orgId ?? null,
|
|
69
|
+
input.deviceId,
|
|
70
|
+
envelope.taskId,
|
|
71
|
+
envelope.runId,
|
|
72
|
+
envelope.operationClass,
|
|
73
|
+
envelope.approval.scope,
|
|
74
|
+
envelope.approval.actionHash,
|
|
75
|
+
"pending",
|
|
76
|
+
null,
|
|
77
|
+
null,
|
|
78
|
+
null,
|
|
79
|
+
envelope.leaseExpiresAt,
|
|
80
|
+
null,
|
|
81
|
+
now,
|
|
82
|
+
now,
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
const approval = await getComputerApprovalForOwner({
|
|
86
|
+
id,
|
|
87
|
+
ownerEmail: input.ownerEmail,
|
|
88
|
+
orgId: input.orgId,
|
|
89
|
+
});
|
|
90
|
+
if (!approval)
|
|
91
|
+
throw new Error("computer approval insert failed");
|
|
92
|
+
return approval;
|
|
93
|
+
}
|
|
94
|
+
export async function decideComputerApproval(input) {
|
|
95
|
+
await ensureComputerApprovalStore();
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
const resultJson = serializeDecisionResult(input.result);
|
|
98
|
+
const result = await getDbExec().execute({
|
|
99
|
+
sql: `UPDATE integration_computer_approvals
|
|
100
|
+
SET status = ?, decision_result_json = ?, decided_by = ?,
|
|
101
|
+
decided_at = ?, updated_at = ?
|
|
102
|
+
WHERE id = ? AND owner_email = ?
|
|
103
|
+
AND ((org_id IS NULL AND ? IS NULL) OR org_id = ?)
|
|
104
|
+
AND action_hash = ? AND status = 'pending' AND expires_at > ?`,
|
|
105
|
+
args: [
|
|
106
|
+
input.decision,
|
|
107
|
+
resultJson,
|
|
108
|
+
input.decidedBy.slice(0, 240),
|
|
109
|
+
now,
|
|
110
|
+
now,
|
|
111
|
+
input.id,
|
|
112
|
+
input.ownerEmail,
|
|
113
|
+
input.orgId ?? null,
|
|
114
|
+
input.orgId ?? null,
|
|
115
|
+
input.actionHash,
|
|
116
|
+
now,
|
|
117
|
+
],
|
|
118
|
+
});
|
|
119
|
+
if (affectedRows(result) === 0)
|
|
120
|
+
return null;
|
|
121
|
+
return getComputerApprovalForOwner(input);
|
|
122
|
+
}
|
|
123
|
+
export async function getComputerApprovalForOwner(input) {
|
|
124
|
+
await ensureComputerApprovalStore();
|
|
125
|
+
const { rows } = await getDbExec().execute({
|
|
126
|
+
sql: `SELECT * FROM integration_computer_approvals
|
|
127
|
+
WHERE id = ? AND owner_email = ?
|
|
128
|
+
AND ((org_id IS NULL AND ? IS NULL) OR org_id = ?)
|
|
129
|
+
LIMIT 1`,
|
|
130
|
+
args: [
|
|
131
|
+
input.id,
|
|
132
|
+
input.ownerEmail,
|
|
133
|
+
input.orgId ?? null,
|
|
134
|
+
input.orgId ?? null,
|
|
135
|
+
],
|
|
136
|
+
});
|
|
137
|
+
return rows[0] ? rowToApproval(rows[0]) : null;
|
|
138
|
+
}
|
|
139
|
+
export async function listComputerApprovalsForOwner(input) {
|
|
140
|
+
await ensureComputerApprovalStore();
|
|
141
|
+
const clauses = [
|
|
142
|
+
"owner_email = ?",
|
|
143
|
+
"((org_id IS NULL AND ? IS NULL) OR org_id = ?)",
|
|
144
|
+
];
|
|
145
|
+
const args = [
|
|
146
|
+
input.ownerEmail,
|
|
147
|
+
input.orgId ?? null,
|
|
148
|
+
input.orgId ?? null,
|
|
149
|
+
];
|
|
150
|
+
if (input.deviceId) {
|
|
151
|
+
clauses.push("device_id = ?");
|
|
152
|
+
args.push(input.deviceId);
|
|
153
|
+
}
|
|
154
|
+
if (input.taskId) {
|
|
155
|
+
clauses.push("task_id = ?");
|
|
156
|
+
args.push(input.taskId);
|
|
157
|
+
}
|
|
158
|
+
if (input.runId) {
|
|
159
|
+
clauses.push("run_id = ?");
|
|
160
|
+
args.push(input.runId);
|
|
161
|
+
}
|
|
162
|
+
if (input.status) {
|
|
163
|
+
clauses.push("status = ?");
|
|
164
|
+
args.push(input.status);
|
|
165
|
+
}
|
|
166
|
+
args.push(Math.max(1, Math.min(input.limit ?? 100, 250)));
|
|
167
|
+
const { rows } = await getDbExec().execute({
|
|
168
|
+
sql: `SELECT * FROM integration_computer_approvals
|
|
169
|
+
WHERE ${clauses.join(" AND ")}
|
|
170
|
+
ORDER BY updated_at DESC
|
|
171
|
+
LIMIT ?`,
|
|
172
|
+
args,
|
|
173
|
+
});
|
|
174
|
+
return rows.map((row) => rowToApproval(row));
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Authorizes an operation immediately before it is enqueued. Callers should
|
|
178
|
+
* pass their transaction handle so one-shot approval consumption and command
|
|
179
|
+
* insertion commit atomically.
|
|
180
|
+
*/
|
|
181
|
+
export async function authorizeComputerOperation(input, client = getDbExec()) {
|
|
182
|
+
const now = input.now ?? Date.now();
|
|
183
|
+
if (input.envelope.leaseExpiresAt <= now) {
|
|
184
|
+
throw new ComputerSupervisionError("expired-lease", "Computer operation lease has expired");
|
|
185
|
+
}
|
|
186
|
+
if (!computerOperationRequiresApproval(input.envelope.operationClass))
|
|
187
|
+
return;
|
|
188
|
+
const approvalId = input.envelope.approval.id;
|
|
189
|
+
if (!approvalId) {
|
|
190
|
+
throw new ComputerSupervisionError("approval-required", "Computer control requires an approved action binding");
|
|
191
|
+
}
|
|
192
|
+
const { rows } = await client.execute({
|
|
193
|
+
sql: `SELECT * FROM integration_computer_approvals
|
|
194
|
+
WHERE id = ? AND owner_email = ?
|
|
195
|
+
AND ((org_id IS NULL AND ? IS NULL) OR org_id = ?)
|
|
196
|
+
AND device_id = ? AND task_id = ? AND run_id = ?
|
|
197
|
+
LIMIT 1`,
|
|
198
|
+
args: [
|
|
199
|
+
approvalId,
|
|
200
|
+
input.ownerEmail,
|
|
201
|
+
input.orgId ?? null,
|
|
202
|
+
input.orgId ?? null,
|
|
203
|
+
input.deviceId,
|
|
204
|
+
input.envelope.taskId,
|
|
205
|
+
input.envelope.runId,
|
|
206
|
+
],
|
|
207
|
+
});
|
|
208
|
+
if (!rows[0]) {
|
|
209
|
+
throw new ComputerSupervisionError("approval-mismatch", "Computer approval does not belong to this owner, device, task, and run");
|
|
210
|
+
}
|
|
211
|
+
const approval = rowToApproval(rows[0]);
|
|
212
|
+
if (approval.actionHash !== input.envelope.approval.actionHash ||
|
|
213
|
+
approval.operationClass !== input.envelope.operationClass ||
|
|
214
|
+
approval.scope !== input.envelope.approval.scope) {
|
|
215
|
+
throw new ComputerSupervisionError("approval-mismatch", "Computer approval does not match the requested action");
|
|
216
|
+
}
|
|
217
|
+
if (approval.expiresAt <= now) {
|
|
218
|
+
await client.execute({
|
|
219
|
+
sql: `UPDATE integration_computer_approvals
|
|
220
|
+
SET status = 'expired', updated_at = ?
|
|
221
|
+
WHERE id = ? AND status IN ('pending', 'approved')`,
|
|
222
|
+
args: [now, approval.id],
|
|
223
|
+
});
|
|
224
|
+
throw new ComputerSupervisionError("approval-denied", "Computer approval has expired");
|
|
225
|
+
}
|
|
226
|
+
if (approval.status !== "approved") {
|
|
227
|
+
throw new ComputerSupervisionError(approval.status === "consumed" ? "replay" : "approval-denied", approval.status === "consumed"
|
|
228
|
+
? "One-shot computer approval has already been consumed"
|
|
229
|
+
: "Computer action is not approved");
|
|
230
|
+
}
|
|
231
|
+
if (approval.scope !== "once")
|
|
232
|
+
return;
|
|
233
|
+
const result = await client.execute({
|
|
234
|
+
sql: `UPDATE integration_computer_approvals
|
|
235
|
+
SET status = 'consumed', consumed_at = ?, updated_at = ?
|
|
236
|
+
WHERE id = ? AND status = 'approved'`,
|
|
237
|
+
args: [now, now, approval.id],
|
|
238
|
+
});
|
|
239
|
+
if (affectedRows(result) === 0) {
|
|
240
|
+
throw new ComputerSupervisionError("replay", "One-shot computer approval has already been consumed");
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function rowToApproval(row) {
|
|
244
|
+
return {
|
|
245
|
+
id: String(row.id),
|
|
246
|
+
ownerEmail: String(row.owner_email),
|
|
247
|
+
orgId: row.org_id == null ? null : String(row.org_id),
|
|
248
|
+
deviceId: String(row.device_id),
|
|
249
|
+
taskId: String(row.task_id),
|
|
250
|
+
runId: String(row.run_id),
|
|
251
|
+
operationClass: row.operation_class,
|
|
252
|
+
scope: row.approval_scope,
|
|
253
|
+
actionHash: String(row.action_hash),
|
|
254
|
+
status: row.status,
|
|
255
|
+
decisionResult: parseRecord(row.decision_result_json),
|
|
256
|
+
decidedBy: row.decided_by == null ? null : String(row.decided_by),
|
|
257
|
+
decidedAt: row.decided_at == null ? null : Number(row.decided_at),
|
|
258
|
+
expiresAt: Number(row.expires_at),
|
|
259
|
+
consumedAt: row.consumed_at == null ? null : Number(row.consumed_at),
|
|
260
|
+
createdAt: Number(row.created_at),
|
|
261
|
+
updatedAt: Number(row.updated_at),
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function serializeDecisionResult(result) {
|
|
265
|
+
if (!result)
|
|
266
|
+
return null;
|
|
267
|
+
return serializeBoundedRemoteJson(result, {
|
|
268
|
+
label: "Computer approval result",
|
|
269
|
+
maxBytes: 8_192,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
function parseRecord(value) {
|
|
273
|
+
if (value == null)
|
|
274
|
+
return null;
|
|
275
|
+
try {
|
|
276
|
+
const parsed = JSON.parse(String(value));
|
|
277
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
278
|
+
? parsed
|
|
279
|
+
: null;
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function affectedRows(result) {
|
|
286
|
+
return (result.rowsAffected ??
|
|
287
|
+
Number(result.rowCount ?? 0));
|
|
288
|
+
}
|
|
289
|
+
function randomHex(byteLength) {
|
|
290
|
+
const bytes = new Uint8Array(byteLength);
|
|
291
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
292
|
+
return Array.from(bytes)
|
|
293
|
+
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
294
|
+
.join("");
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=computer-supervision-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer-supervision-store.js","sourceRoot":"","sources":["../../src/integrations/computer-supervision-store.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,OAAO,EACP,UAAU,EACV,cAAc,GACf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAkCrE,IAAI,YAAuC,CAAC;AAE5C,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAC/C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,CAAC,KAAK,IAAI,EAAE;YACzB,MAAM,SAAS,GAAG;;;;;;;;;;;;;eAaT,OAAO,EAAE;eACT,OAAO,EAAE;gBACR,OAAO,EAAE;eACV,OAAO,EAAE;eACT,OAAO,EAAE;EACtB,CAAC;YACG,IAAI,UAAU,EAAE,EAAE,CAAC;gBACjB,MAAM,iBAAiB,CAAC,gCAAgC,EAAE,SAAS,CAAC,CAAC;gBACrE,MAAM,iBAAiB,CACrB,8BAA8B,EAC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AC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YACnE,CAAC,CAAE,MAAkC;YACrC,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAGrB;IACC,OAAO,CACL,MAAM,CAAC,YAAY;QACnB,MAAM,CAAE,MAAiC,CAAC,QAAQ,IAAI,CAAC,CAAC,CACzD,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,UAAkB;IACnC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IACzC,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;SACrB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SACjD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC","sourcesContent":["import type { DbExec } from \"../db/client.js\";\nimport {\n getDbExec,\n intType,\n isPostgres,\n retryOnDdlRace,\n} from \"../db/client.js\";\nimport { ensureIndexExists, ensureTableExists } from \"../db/ddl-guard.js\";\nimport {\n assertValidComputerCommandEnvelope,\n ComputerSupervisionError,\n computerOperationRequiresApproval,\n} from \"./computer-supervision.js\";\nimport { getRemoteDeviceForOwner } from \"./remote-devices-store.js\";\nimport { serializeBoundedRemoteJson } from \"./remote-json-safety.js\";\nimport type {\n ComputerApprovalScope,\n ComputerCommandEnvelope,\n ComputerOperationClass,\n} from \"./remote-types.js\";\n\nexport type ComputerApprovalStatus =\n | \"pending\"\n | \"approved\"\n | \"denied\"\n | \"consumed\"\n | \"expired\";\n\nexport interface ComputerApprovalRecord {\n id: string;\n ownerEmail: string;\n orgId: string | null;\n deviceId: string;\n taskId: string;\n runId: string;\n operationClass: ComputerOperationClass;\n scope: ComputerApprovalScope;\n actionHash: string;\n status: ComputerApprovalStatus;\n decisionResult: Record<string, unknown> | null;\n decidedBy: string | null;\n decidedAt: number | null;\n expiresAt: number;\n consumedAt: number | null;\n createdAt: number;\n updatedAt: number;\n}\n\nlet _initPromise: Promise<void> | undefined;\n\nexport async function ensureComputerApprovalStore(): Promise<void> {\n if (!_initPromise) {\n _initPromise = (async () => {\n const createSql = `CREATE TABLE IF NOT EXISTS integration_computer_approvals (\n id TEXT PRIMARY KEY,\n owner_email TEXT NOT NULL,\n org_id TEXT,\n device_id TEXT NOT NULL,\n task_id TEXT NOT NULL,\n run_id TEXT NOT NULL,\n operation_class TEXT NOT NULL,\n approval_scope TEXT NOT NULL,\n action_hash TEXT NOT NULL,\n status TEXT NOT NULL,\n decision_result_json TEXT,\n decided_by TEXT,\n decided_at ${intType()},\n expires_at ${intType()} NOT NULL,\n consumed_at ${intType()},\n created_at ${intType()} NOT NULL,\n updated_at ${intType()} NOT NULL\n)`;\n if (isPostgres()) {\n await ensureTableExists(\"integration_computer_approvals\", createSql);\n await ensureIndexExists(\n \"idx_computer_approvals_owner\",\n `CREATE INDEX IF NOT EXISTS idx_computer_approvals_owner ON integration_computer_approvals(owner_email, org_id, updated_at)`,\n );\n await ensureIndexExists(\n \"idx_computer_approvals_binding\",\n `CREATE INDEX IF NOT EXISTS idx_computer_approvals_binding ON integration_computer_approvals(device_id, task_id, run_id, action_hash)`,\n );\n return;\n }\n const client = getDbExec();\n await retryOnDdlRace(() => client.execute(createSql));\n await retryOnDdlRace(() =>\n client.execute(\n `CREATE INDEX IF NOT EXISTS idx_computer_approvals_owner ON integration_computer_approvals(owner_email, org_id, updated_at)`,\n ),\n );\n await retryOnDdlRace(() =>\n client.execute(\n `CREATE INDEX IF NOT EXISTS idx_computer_approvals_binding ON integration_computer_approvals(device_id, task_id, run_id, action_hash)`,\n ),\n );\n })().catch((error) => {\n _initPromise = undefined;\n throw error;\n });\n }\n return _initPromise;\n}\n\nexport async function createComputerApprovalRequest(input: {\n ownerEmail: string;\n orgId?: string | null;\n deviceId: string;\n envelope: ComputerCommandEnvelope;\n}): Promise<ComputerApprovalRecord> {\n const device = await getRemoteDeviceForOwner({\n id: input.deviceId,\n ownerEmail: input.ownerEmail,\n orgId: input.orgId,\n });\n if (!device || device.status !== \"active\") {\n throw new ComputerSupervisionError(\n \"approval-mismatch\",\n \"Computer device does not belong to this owner and organization\",\n );\n }\n await ensureComputerApprovalStore();\n const envelope = await assertValidComputerCommandEnvelope(input.envelope);\n const now = Date.now();\n const id = `computer-approval-${now}-${randomHex(8)}`;\n await getDbExec().execute({\n sql: `INSERT INTO integration_computer_approvals\n (id, owner_email, org_id, device_id, task_id, run_id, operation_class,\n approval_scope, action_hash, status, decision_result_json, decided_by,\n decided_at, expires_at, consumed_at, created_at, updated_at)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n args: [\n id,\n input.ownerEmail,\n input.orgId ?? null,\n input.deviceId,\n envelope.taskId,\n envelope.runId,\n envelope.operationClass,\n envelope.approval.scope,\n envelope.approval.actionHash,\n \"pending\",\n null,\n null,\n null,\n envelope.leaseExpiresAt,\n null,\n now,\n now,\n ],\n });\n const approval = await getComputerApprovalForOwner({\n id,\n ownerEmail: input.ownerEmail,\n orgId: input.orgId,\n });\n if (!approval) throw new Error(\"computer approval insert failed\");\n return approval;\n}\n\nexport async function decideComputerApproval(input: {\n id: string;\n ownerEmail: string;\n orgId?: string | null;\n actionHash: string;\n decision: \"approved\" | \"denied\";\n decidedBy: string;\n result?: Record<string, unknown> | null;\n}): Promise<ComputerApprovalRecord | null> {\n await ensureComputerApprovalStore();\n const now = Date.now();\n const resultJson = serializeDecisionResult(input.result);\n const result = await getDbExec().execute({\n sql: `UPDATE integration_computer_approvals\n SET status = ?, decision_result_json = ?, decided_by = ?,\n decided_at = ?, updated_at = ?\n WHERE id = ? AND owner_email = ?\n AND ((org_id IS NULL AND ? IS NULL) OR org_id = ?)\n AND action_hash = ? AND status = 'pending' AND expires_at > ?`,\n args: [\n input.decision,\n resultJson,\n input.decidedBy.slice(0, 240),\n now,\n now,\n input.id,\n input.ownerEmail,\n input.orgId ?? null,\n input.orgId ?? null,\n input.actionHash,\n now,\n ],\n });\n if (affectedRows(result) === 0) return null;\n return getComputerApprovalForOwner(input);\n}\n\nexport async function getComputerApprovalForOwner(input: {\n id: string;\n ownerEmail: string;\n orgId?: string | null;\n}): Promise<ComputerApprovalRecord | null> {\n await ensureComputerApprovalStore();\n const { rows } = await getDbExec().execute({\n sql: `SELECT * FROM integration_computer_approvals\n WHERE id = ? AND owner_email = ?\n AND ((org_id IS NULL AND ? IS NULL) OR org_id = ?)\n LIMIT 1`,\n args: [\n input.id,\n input.ownerEmail,\n input.orgId ?? null,\n input.orgId ?? null,\n ],\n });\n return rows[0] ? rowToApproval(rows[0] as Record<string, unknown>) : null;\n}\n\nexport async function listComputerApprovalsForOwner(input: {\n ownerEmail: string;\n orgId?: string | null;\n deviceId?: string;\n taskId?: string;\n runId?: string;\n status?: ComputerApprovalStatus;\n limit?: number;\n}): Promise<ComputerApprovalRecord[]> {\n await ensureComputerApprovalStore();\n const clauses = [\n \"owner_email = ?\",\n \"((org_id IS NULL AND ? IS NULL) OR org_id = ?)\",\n ];\n const args: Array<string | number | null> = [\n input.ownerEmail,\n input.orgId ?? null,\n input.orgId ?? null,\n ];\n if (input.deviceId) {\n clauses.push(\"device_id = ?\");\n args.push(input.deviceId);\n }\n if (input.taskId) {\n clauses.push(\"task_id = ?\");\n args.push(input.taskId);\n }\n if (input.runId) {\n clauses.push(\"run_id = ?\");\n args.push(input.runId);\n }\n if (input.status) {\n clauses.push(\"status = ?\");\n args.push(input.status);\n }\n args.push(Math.max(1, Math.min(input.limit ?? 100, 250)));\n const { rows } = await getDbExec().execute({\n sql: `SELECT * FROM integration_computer_approvals\n WHERE ${clauses.join(\" AND \")}\n ORDER BY updated_at DESC\n LIMIT ?`,\n args,\n });\n return rows.map((row) => rowToApproval(row as Record<string, unknown>));\n}\n\n/**\n * Authorizes an operation immediately before it is enqueued. Callers should\n * pass their transaction handle so one-shot approval consumption and command\n * insertion commit atomically.\n */\nexport async function authorizeComputerOperation(\n input: {\n ownerEmail: string;\n orgId?: string | null;\n deviceId: string;\n envelope: ComputerCommandEnvelope;\n now?: number;\n },\n client: DbExec = getDbExec(),\n): Promise<void> {\n const now = input.now ?? Date.now();\n if (input.envelope.leaseExpiresAt <= now) {\n throw new ComputerSupervisionError(\n \"expired-lease\",\n \"Computer operation lease has expired\",\n );\n }\n if (!computerOperationRequiresApproval(input.envelope.operationClass)) return;\n const approvalId = input.envelope.approval.id;\n if (!approvalId) {\n throw new ComputerSupervisionError(\n \"approval-required\",\n \"Computer control requires an approved action binding\",\n );\n }\n const { rows } = await client.execute({\n sql: `SELECT * FROM integration_computer_approvals\n WHERE id = ? AND owner_email = ?\n AND ((org_id IS NULL AND ? IS NULL) OR org_id = ?)\n AND device_id = ? AND task_id = ? AND run_id = ?\n LIMIT 1`,\n args: [\n approvalId,\n input.ownerEmail,\n input.orgId ?? null,\n input.orgId ?? null,\n input.deviceId,\n input.envelope.taskId,\n input.envelope.runId,\n ],\n });\n if (!rows[0]) {\n throw new ComputerSupervisionError(\n \"approval-mismatch\",\n \"Computer approval does not belong to this owner, device, task, and run\",\n );\n }\n const approval = rowToApproval(rows[0] as Record<string, unknown>);\n if (\n approval.actionHash !== input.envelope.approval.actionHash ||\n approval.operationClass !== input.envelope.operationClass ||\n approval.scope !== input.envelope.approval.scope\n ) {\n throw new ComputerSupervisionError(\n \"approval-mismatch\",\n \"Computer approval does not match the requested action\",\n );\n }\n if (approval.expiresAt <= now) {\n await client.execute({\n sql: `UPDATE integration_computer_approvals\n SET status = 'expired', updated_at = ?\n WHERE id = ? AND status IN ('pending', 'approved')`,\n args: [now, approval.id],\n });\n throw new ComputerSupervisionError(\n \"approval-denied\",\n \"Computer approval has expired\",\n );\n }\n if (approval.status !== \"approved\") {\n throw new ComputerSupervisionError(\n approval.status === \"consumed\" ? \"replay\" : \"approval-denied\",\n approval.status === \"consumed\"\n ? \"One-shot computer approval has already been consumed\"\n : \"Computer action is not approved\",\n );\n }\n if (approval.scope !== \"once\") return;\n const result = await client.execute({\n sql: `UPDATE integration_computer_approvals\n SET status = 'consumed', consumed_at = ?, updated_at = ?\n WHERE id = ? AND status = 'approved'`,\n args: [now, now, approval.id],\n });\n if (affectedRows(result) === 0) {\n throw new ComputerSupervisionError(\n \"replay\",\n \"One-shot computer approval has already been consumed\",\n );\n }\n}\n\nfunction rowToApproval(row: Record<string, unknown>): ComputerApprovalRecord {\n return {\n id: String(row.id),\n ownerEmail: String(row.owner_email),\n orgId: row.org_id == null ? null : String(row.org_id),\n deviceId: String(row.device_id),\n taskId: String(row.task_id),\n runId: String(row.run_id),\n operationClass: row.operation_class as ComputerOperationClass,\n scope: row.approval_scope as ComputerApprovalScope,\n actionHash: String(row.action_hash),\n status: row.status as ComputerApprovalStatus,\n decisionResult: parseRecord(row.decision_result_json),\n decidedBy: row.decided_by == null ? null : String(row.decided_by),\n decidedAt: row.decided_at == null ? null : Number(row.decided_at),\n expiresAt: Number(row.expires_at),\n consumedAt: row.consumed_at == null ? null : Number(row.consumed_at),\n createdAt: Number(row.created_at),\n updatedAt: Number(row.updated_at),\n };\n}\n\nfunction serializeDecisionResult(\n result: Record<string, unknown> | null | undefined,\n): string | null {\n if (!result) return null;\n return serializeBoundedRemoteJson(result, {\n label: \"Computer approval result\",\n maxBytes: 8_192,\n });\n}\n\nfunction parseRecord(value: unknown): Record<string, unknown> | null {\n if (value == null) return null;\n try {\n const parsed = JSON.parse(String(value));\n return parsed && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : null;\n } catch {\n return null;\n }\n}\n\nfunction affectedRows(result: {\n rowsAffected?: number;\n rows?: unknown[];\n}): number {\n return (\n result.rowsAffected ??\n Number((result as { rowCount?: unknown }).rowCount ?? 0)\n );\n}\n\nfunction randomHex(byteLength: number): string {\n const bytes = new Uint8Array(byteLength);\n globalThis.crypto.getRandomValues(bytes);\n return Array.from(bytes)\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComputerCommandEnvelope, ComputerOperationClass } from "./remote-types.js";
|
|
2
|
+
export declare class ComputerSupervisionError extends Error {
|
|
3
|
+
readonly code: "invalid-envelope" | "expired-lease" | "action-hash-mismatch" | "approval-required" | "approval-denied" | "approval-mismatch" | "replay";
|
|
4
|
+
constructor(code: "invalid-envelope" | "expired-lease" | "action-hash-mismatch" | "approval-required" | "approval-denied" | "approval-mismatch" | "replay", message: string);
|
|
5
|
+
}
|
|
6
|
+
export declare function computerOperationRequiresApproval(operationClass: ComputerOperationClass): boolean;
|
|
7
|
+
export declare function computeComputerActionHash(envelope: Pick<ComputerCommandEnvelope, "version" | "taskId" | "runId" | "sequence" | "operationClass" | "action">): Promise<string>;
|
|
8
|
+
export declare function assertValidComputerCommandEnvelope(value: unknown, options?: {
|
|
9
|
+
now?: number;
|
|
10
|
+
}): Promise<ComputerCommandEnvelope>;
|
|
11
|
+
//# sourceMappingURL=computer-supervision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer-supervision.d.ts","sourceRoot":"","sources":["../../src/integrations/computer-supervision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAY3B,qBAAa,wBAAyB,SAAQ,KAAK;aAE/B,IAAI,EAChB,kBAAkB,GAClB,eAAe,GACf,sBAAsB,GACtB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,GACnB,QAAQ;IARd,YACkB,IAAI,EAChB,kBAAkB,GAClB,eAAe,GACf,sBAAsB,GACtB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,GACnB,QAAQ,EACZ,OAAO,EAAE,MAAM,EAIhB;CACF;AAED,wBAAgB,iCAAiC,CAC/C,cAAc,EAAE,sBAAsB,GACrC,OAAO,CAET;AAED,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,IAAI,CACZ,uBAAuB,EACvB,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,gBAAgB,GAAG,QAAQ,CAC1E,GACA,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACzB,OAAO,CAAC,uBAAuB,CAAC,CA6FlC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const OPERATION_CLASSES = new Set([
|
|
2
|
+
"browser.observe",
|
|
3
|
+
"browser.control",
|
|
4
|
+
"desktop.observe",
|
|
5
|
+
"desktop.control",
|
|
6
|
+
]);
|
|
7
|
+
const APPROVAL_SCOPES = new Set(["once", "run", "task"]);
|
|
8
|
+
const MAX_ACTION_BYTES = 32_768;
|
|
9
|
+
const MAX_LEASE_MS = 24 * 60 * 60_000;
|
|
10
|
+
export class ComputerSupervisionError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
constructor(code, message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.name = "ComputerSupervisionError";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function computerOperationRequiresApproval(operationClass) {
|
|
19
|
+
return operationClass.endsWith(".control");
|
|
20
|
+
}
|
|
21
|
+
export async function computeComputerActionHash(envelope) {
|
|
22
|
+
const canonical = stableJson({
|
|
23
|
+
version: envelope.version,
|
|
24
|
+
taskId: envelope.taskId,
|
|
25
|
+
runId: envelope.runId,
|
|
26
|
+
sequence: envelope.sequence,
|
|
27
|
+
operationClass: envelope.operationClass,
|
|
28
|
+
action: envelope.action,
|
|
29
|
+
});
|
|
30
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(canonical));
|
|
31
|
+
return Array.from(new Uint8Array(digest))
|
|
32
|
+
.map((byte) => byte.toString(16).padStart(2, "0"))
|
|
33
|
+
.join("");
|
|
34
|
+
}
|
|
35
|
+
export async function assertValidComputerCommandEnvelope(value, options) {
|
|
36
|
+
if (!isRecord(value)) {
|
|
37
|
+
throw invalid("Computer command envelope must be an object");
|
|
38
|
+
}
|
|
39
|
+
if (value.version !== 1) {
|
|
40
|
+
throw invalid("Unsupported computer command envelope version");
|
|
41
|
+
}
|
|
42
|
+
const taskId = boundedString(value.taskId, "taskId", 200);
|
|
43
|
+
const runId = boundedString(value.runId, "runId", 200);
|
|
44
|
+
const idempotencyKey = boundedString(value.idempotencyKey, "idempotencyKey", 200);
|
|
45
|
+
if (!Number.isSafeInteger(value.sequence) || Number(value.sequence) < 0) {
|
|
46
|
+
throw invalid("sequence must be a non-negative safe integer");
|
|
47
|
+
}
|
|
48
|
+
if (!OPERATION_CLASSES.has(value.operationClass)) {
|
|
49
|
+
throw invalid("Unknown computer operation class");
|
|
50
|
+
}
|
|
51
|
+
if (!isRecord(value.action)) {
|
|
52
|
+
throw invalid("action must be an object");
|
|
53
|
+
}
|
|
54
|
+
boundedString(value.action.type, "action.type", 120);
|
|
55
|
+
const actionJson = stableJson(value.action);
|
|
56
|
+
if (new TextEncoder().encode(actionJson).byteLength > MAX_ACTION_BYTES) {
|
|
57
|
+
throw invalid("Computer action exceeds the 32 KiB metadata limit");
|
|
58
|
+
}
|
|
59
|
+
if (!isRecord(value.approval)) {
|
|
60
|
+
throw invalid("approval binding is required");
|
|
61
|
+
}
|
|
62
|
+
if (!APPROVAL_SCOPES.has(value.approval.scope)) {
|
|
63
|
+
throw invalid("Unknown computer approval scope");
|
|
64
|
+
}
|
|
65
|
+
const actionHash = boundedString(value.approval.actionHash, "approval.actionHash", 64).toLowerCase();
|
|
66
|
+
if (!/^[a-f0-9]{64}$/.test(actionHash)) {
|
|
67
|
+
throw invalid("approval.actionHash must be a SHA-256 hex digest");
|
|
68
|
+
}
|
|
69
|
+
const approvalId = value.approval.id == null
|
|
70
|
+
? null
|
|
71
|
+
: boundedString(value.approval.id, "approval.id", 240);
|
|
72
|
+
if (!Number.isSafeInteger(value.issuedAt) || Number(value.issuedAt) < 0) {
|
|
73
|
+
throw invalid("issuedAt must be a valid epoch timestamp");
|
|
74
|
+
}
|
|
75
|
+
if (!Number.isSafeInteger(value.leaseExpiresAt) ||
|
|
76
|
+
Number(value.leaseExpiresAt) < 0) {
|
|
77
|
+
throw invalid("leaseExpiresAt must be a valid epoch timestamp");
|
|
78
|
+
}
|
|
79
|
+
const now = options?.now ?? Date.now();
|
|
80
|
+
const issuedAt = Number(value.issuedAt);
|
|
81
|
+
const leaseExpiresAt = Number(value.leaseExpiresAt);
|
|
82
|
+
if (leaseExpiresAt <= now || leaseExpiresAt <= issuedAt) {
|
|
83
|
+
throw new ComputerSupervisionError("expired-lease", "Computer operation lease has expired");
|
|
84
|
+
}
|
|
85
|
+
if (leaseExpiresAt - issuedAt > MAX_LEASE_MS) {
|
|
86
|
+
throw invalid("Computer operation lease cannot exceed 24 hours");
|
|
87
|
+
}
|
|
88
|
+
const envelope = {
|
|
89
|
+
version: 1,
|
|
90
|
+
taskId,
|
|
91
|
+
runId,
|
|
92
|
+
sequence: Number(value.sequence),
|
|
93
|
+
idempotencyKey,
|
|
94
|
+
operationClass: value.operationClass,
|
|
95
|
+
action: value.action,
|
|
96
|
+
approval: {
|
|
97
|
+
id: approvalId,
|
|
98
|
+
scope: value.approval
|
|
99
|
+
.scope,
|
|
100
|
+
actionHash,
|
|
101
|
+
},
|
|
102
|
+
issuedAt,
|
|
103
|
+
leaseExpiresAt,
|
|
104
|
+
};
|
|
105
|
+
const expectedHash = await computeComputerActionHash(envelope);
|
|
106
|
+
if (expectedHash !== actionHash) {
|
|
107
|
+
throw new ComputerSupervisionError("action-hash-mismatch", "Computer operation does not match its approved action hash");
|
|
108
|
+
}
|
|
109
|
+
return envelope;
|
|
110
|
+
}
|
|
111
|
+
function stableJson(value) {
|
|
112
|
+
const seen = new Set();
|
|
113
|
+
const normalize = (entry, depth) => {
|
|
114
|
+
if (depth > 12)
|
|
115
|
+
throw invalid("Computer action is nested too deeply");
|
|
116
|
+
if (entry === null ||
|
|
117
|
+
typeof entry === "string" ||
|
|
118
|
+
typeof entry === "boolean") {
|
|
119
|
+
if (typeof entry === "string" &&
|
|
120
|
+
(/^data:/i.test(entry) || looksLikeLargeBase64(entry))) {
|
|
121
|
+
throw invalid("Binary or data URL payloads are not allowed");
|
|
122
|
+
}
|
|
123
|
+
return entry;
|
|
124
|
+
}
|
|
125
|
+
if (typeof entry === "number" && Number.isFinite(entry))
|
|
126
|
+
return entry;
|
|
127
|
+
if (Array.isArray(entry)) {
|
|
128
|
+
return entry.map((item) => normalize(item, depth + 1));
|
|
129
|
+
}
|
|
130
|
+
if (!isRecord(entry)) {
|
|
131
|
+
throw invalid("Computer actions must contain only JSON values");
|
|
132
|
+
}
|
|
133
|
+
if (seen.has(entry))
|
|
134
|
+
throw invalid("Computer action contains a cycle");
|
|
135
|
+
seen.add(entry);
|
|
136
|
+
const result = {};
|
|
137
|
+
for (const key of Object.keys(entry).sort()) {
|
|
138
|
+
result[key] = normalize(entry[key], depth + 1);
|
|
139
|
+
}
|
|
140
|
+
seen.delete(entry);
|
|
141
|
+
return result;
|
|
142
|
+
};
|
|
143
|
+
return JSON.stringify(normalize(value, 0));
|
|
144
|
+
}
|
|
145
|
+
function looksLikeLargeBase64(value) {
|
|
146
|
+
return value.length > 512 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
|
|
147
|
+
}
|
|
148
|
+
function isRecord(value) {
|
|
149
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
150
|
+
}
|
|
151
|
+
function boundedString(value, name, max) {
|
|
152
|
+
if (typeof value !== "string" || !value.trim() || value.length > max) {
|
|
153
|
+
throw invalid(`${name} must be a non-empty string of at most ${max} chars`);
|
|
154
|
+
}
|
|
155
|
+
return value.trim();
|
|
156
|
+
}
|
|
157
|
+
function invalid(message) {
|
|
158
|
+
return new ComputerSupervisionError("invalid-envelope", message);
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=computer-supervision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computer-supervision.js","sourceRoot":"","sources":["../../src/integrations/computer-supervision.ts"],"names":[],"mappings":"AAKA,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAyB;IACxD,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;IACjB,iBAAiB;CAClB,CAAC,CAAC;AACH,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAU,CAAC,CAAC;AAClE,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;AAEtC,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAE/B,IAAI;IADtB,YACkB,IAOJ,EACZ,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;oBAVC,IAAI;QAWpB,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACzC,CAAC;CACF;AAED,MAAM,UAAU,iCAAiC,CAC/C,cAAsC;IAEtC,OAAO,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,QAGC;IAED,MAAM,SAAS,GAAG,UAAU,CAAC;QAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,MAAM,EAAE,QAAQ,CAAC,MAAM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ComputerOperationClass,\n} from \"./remote-types.js\";\n\nconst OPERATION_CLASSES = new Set<ComputerOperationClass>([\n \"browser.observe\",\n \"browser.control\",\n \"desktop.observe\",\n \"desktop.control\",\n]);\nconst APPROVAL_SCOPES = new Set([\"once\", \"run\", \"task\"] as const);\nconst MAX_ACTION_BYTES = 32_768;\nconst MAX_LEASE_MS = 24 * 60 * 60_000;\n\nexport class ComputerSupervisionError extends Error {\n constructor(\n public readonly code:\n | \"invalid-envelope\"\n | \"expired-lease\"\n | \"action-hash-mismatch\"\n | \"approval-required\"\n | \"approval-denied\"\n | \"approval-mismatch\"\n | \"replay\",\n message: string,\n ) {\n super(message);\n this.name = \"ComputerSupervisionError\";\n }\n}\n\nexport function computerOperationRequiresApproval(\n operationClass: ComputerOperationClass,\n): boolean {\n return operationClass.endsWith(\".control\");\n}\n\nexport async function computeComputerActionHash(\n envelope: Pick<\n ComputerCommandEnvelope,\n \"version\" | \"taskId\" | \"runId\" | \"sequence\" | \"operationClass\" | \"action\"\n >,\n): Promise<string> {\n const canonical = stableJson({\n version: envelope.version,\n taskId: envelope.taskId,\n runId: envelope.runId,\n sequence: envelope.sequence,\n operationClass: envelope.operationClass,\n action: envelope.action,\n });\n const digest = await globalThis.crypto.subtle.digest(\n \"SHA-256\",\n new TextEncoder().encode(canonical),\n );\n return Array.from(new Uint8Array(digest))\n .map((byte) => byte.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n\nexport async function assertValidComputerCommandEnvelope(\n value: unknown,\n options?: { now?: number },\n): Promise<ComputerCommandEnvelope> {\n if (!isRecord(value)) {\n throw invalid(\"Computer command envelope must be an object\");\n }\n if (value.version !== 1) {\n throw invalid(\"Unsupported computer command envelope version\");\n }\n const taskId = boundedString(value.taskId, \"taskId\", 200);\n const runId = boundedString(value.runId, \"runId\", 200);\n const idempotencyKey = boundedString(\n value.idempotencyKey,\n \"idempotencyKey\",\n 200,\n );\n if (!Number.isSafeInteger(value.sequence) || Number(value.sequence) < 0) {\n throw invalid(\"sequence must be a non-negative safe integer\");\n }\n if (!OPERATION_CLASSES.has(value.operationClass as ComputerOperationClass)) {\n throw invalid(\"Unknown computer operation class\");\n }\n if (!isRecord(value.action)) {\n throw invalid(\"action must be an object\");\n }\n boundedString(value.action.type, \"action.type\", 120);\n const actionJson = stableJson(value.action);\n if (new TextEncoder().encode(actionJson).byteLength > MAX_ACTION_BYTES) {\n throw invalid(\"Computer action exceeds the 32 KiB metadata limit\");\n }\n if (!isRecord(value.approval)) {\n throw invalid(\"approval binding is required\");\n }\n if (!APPROVAL_SCOPES.has(value.approval.scope as any)) {\n throw invalid(\"Unknown computer approval scope\");\n }\n const actionHash = boundedString(\n value.approval.actionHash,\n \"approval.actionHash\",\n 64,\n ).toLowerCase();\n if (!/^[a-f0-9]{64}$/.test(actionHash)) {\n throw invalid(\"approval.actionHash must be a SHA-256 hex digest\");\n }\n const approvalId =\n value.approval.id == null\n ? null\n : boundedString(value.approval.id, \"approval.id\", 240);\n if (!Number.isSafeInteger(value.issuedAt) || Number(value.issuedAt) < 0) {\n throw invalid(\"issuedAt must be a valid epoch timestamp\");\n }\n if (\n !Number.isSafeInteger(value.leaseExpiresAt) ||\n Number(value.leaseExpiresAt) < 0\n ) {\n throw invalid(\"leaseExpiresAt must be a valid epoch timestamp\");\n }\n const now = options?.now ?? Date.now();\n const issuedAt = Number(value.issuedAt);\n const leaseExpiresAt = Number(value.leaseExpiresAt);\n if (leaseExpiresAt <= now || leaseExpiresAt <= issuedAt) {\n throw new ComputerSupervisionError(\n \"expired-lease\",\n \"Computer operation lease has expired\",\n );\n }\n if (leaseExpiresAt - issuedAt > MAX_LEASE_MS) {\n throw invalid(\"Computer operation lease cannot exceed 24 hours\");\n }\n\n const envelope: ComputerCommandEnvelope = {\n version: 1,\n taskId,\n runId,\n sequence: Number(value.sequence),\n idempotencyKey,\n operationClass: value.operationClass as ComputerOperationClass,\n action: value.action as ComputerCommandEnvelope[\"action\"],\n approval: {\n id: approvalId,\n scope: value.approval\n .scope as ComputerCommandEnvelope[\"approval\"][\"scope\"],\n actionHash,\n },\n issuedAt,\n leaseExpiresAt,\n };\n const expectedHash = await computeComputerActionHash(envelope);\n if (expectedHash !== actionHash) {\n throw new ComputerSupervisionError(\n \"action-hash-mismatch\",\n \"Computer operation does not match its approved action hash\",\n );\n }\n return envelope;\n}\n\nfunction stableJson(value: unknown): string {\n const seen = new Set<object>();\n const normalize = (entry: unknown, depth: number): unknown => {\n if (depth > 12) throw invalid(\"Computer action is nested too deeply\");\n if (\n entry === null ||\n typeof entry === \"string\" ||\n typeof entry === \"boolean\"\n ) {\n if (\n typeof entry === \"string\" &&\n (/^data:/i.test(entry) || looksLikeLargeBase64(entry))\n ) {\n throw invalid(\"Binary or data URL payloads are not allowed\");\n }\n return entry;\n }\n if (typeof entry === \"number\" && Number.isFinite(entry)) return entry;\n if (Array.isArray(entry)) {\n return entry.map((item) => normalize(item, depth + 1));\n }\n if (!isRecord(entry)) {\n throw invalid(\"Computer actions must contain only JSON values\");\n }\n if (seen.has(entry)) throw invalid(\"Computer action contains a cycle\");\n seen.add(entry);\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(entry).sort()) {\n result[key] = normalize(entry[key], depth + 1);\n }\n seen.delete(entry);\n return result;\n };\n return JSON.stringify(normalize(value, 0));\n}\n\nfunction looksLikeLargeBase64(value: string): boolean {\n return value.length > 512 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return Boolean(value) && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction boundedString(value: unknown, name: string, max: number): string {\n if (typeof value !== \"string\" || !value.trim() || value.length > max) {\n throw invalid(`${name} must be a non-empty string of at most ${max} chars`);\n }\n return value.trim();\n}\n\nfunction invalid(message: string): ComputerSupervisionError {\n return new ComputerSupervisionError(\"invalid-envelope\", message);\n}\n"]}
|