Here is a summary of how the sandbox behaves on your macOS system: ### ⚙️ How it Works When `--sandbox` is enabled (either via the launch flag or the `enableTerminalSandbox` setting in your `settings.json`), terminal commands run inside a lightweight containment boundary: - **macOS Native Isolation**: It utilizes macOS's native `sandbox-exec` utility to restrict system calls, network sockets, and directory access. - **Secure File Boundaries**: File system writes are locked down to designated safe zones (such as your designated workspace or scratch directory). Access to critical system paths, private user data, and external network resources is restricted. --- ### 🛡️ Active Permissions for this Session In this current session, the permission model is configured as follows: | Action / Resource | Permission Status | Details / Paths | | :--- | :--- | :--- | | **Command Execution** | ✅ **Allowed** | Terminal command execution is enabled. | | **File Reads (Allowed)** | ✅ **Allowed** | `/scratch`, `/browser_recordings`, `/html_artifacts`, `/knowledge`, `/worktrees`, `/skills`, `/builtin` | | **File Writes (Allowed)**| ✅ **Allowed** | `/scratch`, `/browser_recordings`, `/html_artifacts`, `/knowledge`, `/worktrees` | | **Sensitive Files** | ⚠️ **Ask** | `.env`, `.npmrc`, `.vscode`, `.git-credentials`, etc. | | **Root/App Settings** | 🚫 **Denied** | Direct modifications to `/config` and main `.gemini` configurations | --- ### 🔧 Configuration and Management * **Persistent Settings**: To enable sandboxing by default for all future sessions, configure the `enableTerminalSandbox` setting in your `~/.gemini/antigravity-cli/settings.json`: ```json { "enableTerminalSandbox": true } ``` * **Dynamic Adjustments**: Within an active CLI (`agy`) session, you can run the `/permissions` slash command to view or modify your autonomy and sandboxing levels on the fly. > [!NOTE] > Running in sandbox mode provides an excellent balance of autonomy and security, allowing me to execute build commands, run test scripts, and manage project files safely without risk to your primary host environment. Please let me know if you would like me to set up a new project workspace or run any specific tasks within this session!
227 lines
6.5 KiB
TypeScript
227 lines
6.5 KiB
TypeScript
import type { MobileGitUpstreamStatus } from './mobile-git-status'
|
|
|
|
// Icon identifier resolved to a lucide component by the screen. Kept as a string
|
|
// here so this module stays free of the native lucide import and unit-testable.
|
|
export type MobileSourceControlActionIcon =
|
|
| 'commit'
|
|
| 'push'
|
|
| 'pull'
|
|
| 'sync'
|
|
| 'fetch'
|
|
| 'publish'
|
|
| 'rebase'
|
|
| 'pr'
|
|
| 'branch'
|
|
| 'history'
|
|
|
|
export type MobileSourceControlAction = {
|
|
label: string
|
|
iconKey: MobileSourceControlActionIcon
|
|
disabled?: boolean
|
|
hint?: string
|
|
loading?: boolean
|
|
skipAutoClose?: boolean
|
|
onPress: () => void
|
|
}
|
|
|
|
export type MobileSourceControlActionArgs = {
|
|
commitMessage: string
|
|
stagedCount: number
|
|
upstream: MobileGitUpstreamStatus | null
|
|
upstreamKnown: boolean
|
|
busyAction: string | null
|
|
openingPath: string | null
|
|
openingBranchPath: string | null
|
|
prAvailable: boolean
|
|
handlers: {
|
|
commit: () => void
|
|
commitPush: () => void
|
|
commitSync: () => void
|
|
push: () => void
|
|
pull: () => void
|
|
sync: () => void
|
|
fetch: () => void
|
|
publish: () => void
|
|
fastForward: () => void
|
|
rebase: () => void
|
|
createPr: () => void
|
|
pushAndCreatePr: () => void
|
|
checkout: () => void
|
|
history: () => void
|
|
}
|
|
}
|
|
|
|
// Builds the source-control bottom-sheet action list. Pure (no hooks) so it can
|
|
// be unit-tested and keeps the screen file lean. Enable/disable rules mirror the
|
|
// desktop primary-action gating.
|
|
export function buildMobileSourceControlActions(
|
|
args: MobileSourceControlActionArgs
|
|
): MobileSourceControlAction[] {
|
|
const { commitMessage, stagedCount, upstream, upstreamKnown, handlers } = args
|
|
const hasMessage = commitMessage.trim().length > 0
|
|
const hasStaged = stagedCount > 0
|
|
const hasUpstream = upstream?.hasUpstream === true
|
|
const ahead = upstream?.ahead ?? 0
|
|
const behind = upstream?.behind ?? 0
|
|
const busy =
|
|
args.busyAction !== null || args.openingPath !== null || args.openingBranchPath !== null
|
|
const commitHint = !hasStaged
|
|
? 'Stage at least one file'
|
|
: !hasMessage
|
|
? 'Enter a commit message'
|
|
: undefined
|
|
const remoteHint = !upstreamKnown
|
|
? 'Checking branch status...'
|
|
: hasUpstream
|
|
? undefined
|
|
: 'Publish Branch first'
|
|
const prHint = !upstreamKnown
|
|
? 'Checking branch status...'
|
|
: !args.prAvailable
|
|
? 'Pull requests are not available for this repo'
|
|
: undefined
|
|
|
|
return [
|
|
{
|
|
label: 'Commit',
|
|
iconKey: 'commit',
|
|
disabled: busy || !!commitHint,
|
|
hint: commitHint,
|
|
loading: args.busyAction === 'commit',
|
|
skipAutoClose: true,
|
|
onPress: handlers.commit
|
|
},
|
|
{
|
|
label: 'Commit & Push',
|
|
iconKey: 'push',
|
|
disabled: busy || !!commitHint || !upstreamKnown || !hasUpstream,
|
|
hint: commitHint ?? remoteHint,
|
|
loading: args.busyAction === 'commit-push',
|
|
skipAutoClose: true,
|
|
onPress: handlers.commitPush
|
|
},
|
|
{
|
|
label: 'Commit & Sync',
|
|
iconKey: 'sync',
|
|
disabled: busy || !!commitHint || !upstreamKnown || !hasUpstream || behind === 0,
|
|
hint:
|
|
commitHint ??
|
|
(!upstreamKnown || !hasUpstream
|
|
? remoteHint
|
|
: behind === 0
|
|
? 'Nothing to pull'
|
|
: undefined),
|
|
loading: args.busyAction === 'commit-sync',
|
|
skipAutoClose: true,
|
|
onPress: handlers.commitSync
|
|
},
|
|
{
|
|
label: ahead > 0 ? `Push (${ahead})` : 'Push',
|
|
iconKey: 'push',
|
|
disabled: busy || !upstreamKnown || !hasUpstream || ahead === 0,
|
|
hint: !hasUpstream ? remoteHint : ahead === 0 ? 'Nothing to push' : undefined,
|
|
loading: args.busyAction === 'push',
|
|
skipAutoClose: true,
|
|
onPress: handlers.push
|
|
},
|
|
{
|
|
label: 'Create PR',
|
|
iconKey: 'pr',
|
|
disabled: busy || !args.prAvailable,
|
|
hint: prHint,
|
|
loading: args.busyAction === 'create-pr',
|
|
skipAutoClose: true,
|
|
onPress: handlers.createPr
|
|
},
|
|
{
|
|
label: 'Push & Create PR',
|
|
iconKey: 'pr',
|
|
disabled: busy || !upstreamKnown || !hasUpstream || ahead === 0 || !args.prAvailable,
|
|
hint: prHint ?? (!hasUpstream ? remoteHint : undefined),
|
|
loading: args.busyAction === 'push-create-pr',
|
|
skipAutoClose: true,
|
|
onPress: handlers.pushAndCreatePr
|
|
},
|
|
{
|
|
label: behind > 0 ? `Pull (${behind})` : 'Pull',
|
|
iconKey: 'pull',
|
|
disabled: busy || !upstreamKnown || !hasUpstream || behind === 0,
|
|
hint: !hasUpstream ? remoteHint : behind === 0 ? 'Nothing to pull' : undefined,
|
|
loading: args.busyAction === 'pull',
|
|
skipAutoClose: true,
|
|
onPress: handlers.pull
|
|
},
|
|
{
|
|
label: ahead > 0 || behind > 0 ? `Sync (↓${behind} ↑${ahead})` : 'Sync',
|
|
iconKey: 'sync',
|
|
disabled: busy || !upstreamKnown || !hasUpstream || (ahead === 0 && behind === 0),
|
|
hint:
|
|
!upstreamKnown || !hasUpstream
|
|
? remoteHint
|
|
: ahead === 0 && behind === 0
|
|
? 'Branch is up to date'
|
|
: undefined,
|
|
loading: args.busyAction === 'sync',
|
|
skipAutoClose: true,
|
|
onPress: handlers.sync
|
|
},
|
|
{
|
|
label: 'Fetch',
|
|
iconKey: 'fetch',
|
|
disabled: busy,
|
|
loading: args.busyAction === 'fetch',
|
|
skipAutoClose: true,
|
|
onPress: handlers.fetch
|
|
},
|
|
{
|
|
label: 'Publish Branch',
|
|
iconKey: 'publish',
|
|
disabled: busy || !upstreamKnown || hasUpstream,
|
|
hint: !upstreamKnown
|
|
? 'Checking branch status...'
|
|
: hasUpstream
|
|
? 'Branch is already published'
|
|
: undefined,
|
|
loading: args.busyAction === 'publish',
|
|
skipAutoClose: true,
|
|
onPress: handlers.publish
|
|
},
|
|
{
|
|
label: behind > 0 ? `Fast-forward (${behind})` : 'Fast-forward',
|
|
iconKey: 'pull',
|
|
disabled: busy || !upstreamKnown || !hasUpstream || behind === 0 || ahead > 0,
|
|
hint: !hasUpstream
|
|
? remoteHint
|
|
: behind === 0
|
|
? 'Nothing to fast-forward'
|
|
: ahead > 0
|
|
? 'Local commits would be lost; pull instead'
|
|
: undefined,
|
|
loading: args.busyAction === 'fast-forward',
|
|
skipAutoClose: true,
|
|
onPress: handlers.fastForward
|
|
},
|
|
{
|
|
label: 'Rebase onto base',
|
|
iconKey: 'branch',
|
|
disabled: busy,
|
|
loading: args.busyAction === 'rebase',
|
|
skipAutoClose: true,
|
|
onPress: handlers.rebase
|
|
},
|
|
{
|
|
label: 'Switch branch',
|
|
iconKey: 'branch',
|
|
disabled: busy,
|
|
skipAutoClose: true,
|
|
onPress: handlers.checkout
|
|
},
|
|
{
|
|
label: 'Commits',
|
|
iconKey: 'history',
|
|
disabled: busy,
|
|
onPress: handlers.history
|
|
}
|
|
]
|
|
}
|