Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,38 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
```

## GitHub Octicons

- Component: `gitBranch` (upstream `git-branch-16`) icon path data in
`opensquilla-webui/src/utils/icons.ts` and the generated Web UI assets.
- Upstream project: https://github.com/primer/octicons
- License: MIT
- Copyright notice: Copyright (c) 2026 GitHub Inc.

```
MIT License

Copyright (c) 2026 GitHub Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

## Feather Icons

- Component: `music`, `pause`, and `volume` icon path data in
Expand Down
20 changes: 16 additions & 4 deletions contracts/gateway/v4/compatibility-manifest.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,18 @@
"schema": "approvals/approval-status.schema.json",
"schemaSha256": "951d02cc9cb10329793513cdb100163dcd33b75e2c9053be2042899aff4fba8f"
},
{
"lifecycle": "stable",
"name": "git.diff",
"schema": "git/git-diff.schema.json",
"schemaSha256": "22b89de2e1c98887b2995f7627645448a700d1e0ceb2545a322a3b8368660898"
},
{
"lifecycle": "stable",
"name": "git.status",
"schema": "git/git-status.schema.json",
"schemaSha256": "f60ac943857bde95a57764346a1d926045fa8116aa651acee2e6d5ea8461b2a8"
},
{
"lifecycle": "stable",
"name": "goals.capabilities",
Expand Down Expand Up @@ -1452,10 +1464,10 @@
"protocol": "opensquilla-websocket-json",
"source": {
"eventFamilyCount": 10,
"generatorSha256": "829c5afc1ad4481e06e232cd30f7746db621efafcc9c29f6dcb01e7eb3b79cad",
"methodCount": 213,
"schemaCount": 223,
"schemaTreeSha256": "80c689d229c795f27e43c797468cd96a83eba981383b7e5e4bf4d7a4c9d0689c",
"generatorSha256": "39ff9a0e523eba24c4e87b457ff16caf3832e21db8bfb37b808d805bb8e6d25b",
"methodCount": 215,
"schemaCount": 225,
"schemaTreeSha256": "171a781c2707c1e50b974bcffcd826fadf9f5bf6705619ffe80f2f52082fda25",
"toolchains": {
"legacyTypes": {
"python": {
Expand Down
19 changes: 19 additions & 0 deletions contracts/gateway/v4/git/git-diff.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://opensquilla.dev/contracts/gateway/v4/git/git-diff.schema.json",
"title": "OpenSquilla git.diff Contract",
"type": "object",
"additionalProperties": false,
"properties": {"request": {"$ref": "#/$defs/RequestFrame"}, "response": {"$ref": "#/$defs/ResponseFrame"}},
"x-opensquilla-wire": {"protocol": "opensquilla-websocket-json", "version": 4, "compatibility": "exact-json-tree"},
"x-opensquilla-codegen": {"python": {"tool": "datamodel-code-generator", "version": "0.81.0", "target": "pydantic_v2.BaseModel"}, "typescript": {"tool": "json-schema-to-typescript", "version": "16.0.0"}, "runtimeValidation": {"tool": "ajv", "version": "8.20.0", "mode": "standalone-adapter-only"}},
"x-opensquilla-method": {"name": "git.diff", "kind": "query", "scope": "operator.read", "guestAllowed": false, "idempotency": "read-only", "timeout": {"policy": "transport"}, "capability": {"kind": "method-availability", "name": "git.diff"}, "request": "#/$defs/RequestFrame", "params": "#/$defs/Params", "response": "#/$defs/ResponseFrame", "result": "#/$defs/Result", "errors": [{"code": "OWNER_REQUIRED"}, {"code": "INVALID_PARAMS"}, {"code": "GIT_UNAVAILABLE"}, {"code": "INTERNAL_ERROR"}]},
"$defs": {
"Params": {"type": "object", "additionalProperties": false, "required": ["path"], "properties": {"path": {"description": "Path relative to the repository root.", "type": "string"}, "workspaceId": {"description": "Project workspace id; null or omitted means the current session default working directory.", "type": ["string", "null"]}, "staged": {"type": "boolean"}}},
"Diff": {"type": "object", "additionalProperties": false, "required": ["path", "diff", "binary", "truncated", "additions", "deletions"], "properties": {"path": {"type": "string"}, "diff": {"description": "Unified diff text.", "type": "string"}, "binary": {"type": "boolean"}, "truncated": {"description": "Whether an over-long diff was truncated.", "type": "boolean"}, "additions": {"type": "integer", "minimum": 0}, "deletions": {"type": "integer", "minimum": 0}}},
"Result": {"type": "object", "additionalProperties": false, "required": ["diff"], "properties": {"diff": {"$ref": "#/$defs/Diff"}}},
"RpcError": {"type": "object", "additionalProperties": true},
"RequestFrame": {"type": "object", "additionalProperties": true, "required": ["type", "id", "method"], "properties": {"type": {"const": "req"}, "id": {"type": "string"}, "method": {"const": "git.diff"}, "params": {"$ref": "#/$defs/Params"}}},
"ResponseFrame": {"type": "object", "additionalProperties": true, "required": ["type", "id", "ok"], "properties": {"type": {"const": "res"}, "id": {"type": "string"}, "ok": {"type": "boolean"}, "payload": {"$ref": "#/$defs/Result"}, "error": {"$ref": "#/$defs/RpcError"}}}
}
}
20 changes: 20 additions & 0 deletions contracts/gateway/v4/git/git-status.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://opensquilla.dev/contracts/gateway/v4/git/git-status.schema.json",
"title": "OpenSquilla git.status Contract",
"type": "object",
"additionalProperties": false,
"properties": {"request": {"$ref": "#/$defs/RequestFrame"}, "response": {"$ref": "#/$defs/ResponseFrame"}},
"x-opensquilla-wire": {"protocol": "opensquilla-websocket-json", "version": 4, "compatibility": "exact-json-tree"},
"x-opensquilla-codegen": {"python": {"tool": "datamodel-code-generator", "version": "0.81.0", "target": "pydantic_v2.BaseModel"}, "typescript": {"tool": "json-schema-to-typescript", "version": "16.0.0"}, "runtimeValidation": {"tool": "ajv", "version": "8.20.0", "mode": "standalone-adapter-only"}},
"x-opensquilla-method": {"name": "git.status", "kind": "query", "scope": "operator.read", "guestAllowed": false, "idempotency": "read-only", "timeout": {"policy": "transport"}, "capability": {"kind": "method-availability", "name": "git.status"}, "request": "#/$defs/RequestFrame", "params": "#/$defs/Params", "response": "#/$defs/ResponseFrame", "result": "#/$defs/Result", "errors": [{"code": "OWNER_REQUIRED"}, {"code": "INVALID_PARAMS"}, {"code": "GIT_UNAVAILABLE"}, {"code": "INTERNAL_ERROR"}]},
"$defs": {
"Params": {"type": "object", "additionalProperties": false, "properties": {"workspaceId": {"description": "Project workspace id; null or omitted means the current session default working directory.", "type": ["string", "null"]}}},
"ChangedFile": {"type": "object", "additionalProperties": false, "required": ["path", "status", "staged"], "properties": {"path": {"type": "string"}, "status": {"enum": ["modified", "added", "deleted", "renamed", "untracked", "conflicted"]}, "staged": {"type": "boolean"}, "previousPath": {"type": ["string", "null"]}}},
"Status": {"type": "object", "additionalProperties": false, "required": ["available", "workspacePath", "branch", "detached", "unborn", "headOid", "ahead", "behind", "clean", "files", "reason"], "properties": {"available": {"description": "Whether the directory is a usable git repository.", "type": "boolean"}, "workspacePath": {"description": "Resolved absolute path of the repository.", "type": ["string", "null"]}, "branch": {"description": "Branch name; null while detached.", "type": ["string", "null"]}, "detached": {"type": "boolean"}, "unborn": {"description": "Branch without any commit yet.", "type": "boolean"}, "headOid": {"description": "Full HEAD commit id.", "type": ["string", "null"]}, "ahead": {"type": "integer", "minimum": 0}, "behind": {"type": "integer", "minimum": 0}, "clean": {"type": "boolean"}, "files": {"type": "array", "items": {"$ref": "#/$defs/ChangedFile"}}, "reason": {"description": "Why the repository is unavailable, such as not_repository or git_unavailable.", "type": ["string", "null"]}}},
"Result": {"type": "object", "additionalProperties": false, "required": ["status"], "properties": {"status": {"$ref": "#/$defs/Status"}}},
"RpcError": {"type": "object", "additionalProperties": true},
"RequestFrame": {"type": "object", "additionalProperties": true, "required": ["type", "id", "method"], "properties": {"type": {"const": "req"}, "id": {"type": "string"}, "method": {"const": "git.status"}, "params": {"$ref": "#/$defs/Params"}}},
"ResponseFrame": {"type": "object", "additionalProperties": true, "required": ["type", "id", "ok"], "properties": {"type": {"const": "res"}, "id": {"type": "string"}, "ok": {"type": "boolean"}, "payload": {"$ref": "#/$defs/Result"}, "error": {"$ref": "#/$defs/RpcError"}}}
}
}
16 changes: 16 additions & 0 deletions contracts/gateway/v4/production-targets.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
{
"format": 1,
"targets": [
{
"kind": "method",
"wireName": "git.status",
"roles": [
"params",
"result"
]
},
{
"kind": "method",
"wireName": "git.diff",
"roles": [
"params",
"result"
]
},
{
"kind": "method",
"wireName": "sessions.messages.search",
Expand Down
103 changes: 103 additions & 0 deletions opensquilla-webui/src/App.git-branch.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// @vitest-environment happy-dom
import { afterEach, describe, expect, it, vi } from 'vitest'
import { createApp, defineComponent, h, nextTick, reactive, type App } from 'vue'

import appSource from './App.vue?raw'
import GitBranchChip from './components/chat/GitBranchChip.vue'

vi.mock('vue-i18n', () => ({
useI18n: () => ({
t: (key: string, params?: Record<string, unknown>) => (
params?.branch ? `${key}|${String(params.branch)}` : key
),
}),
}))

const apps: App[] = []

afterEach(() => {
apps.splice(0).forEach(app => app.unmount())
document.body.innerHTML = ''
})

async function mountChip(initial: { label: string; dirtyCount: number; loading?: boolean }) {
const props = reactive({ ...initial })
let opened = 0
const root = document.createElement('div')
document.body.appendChild(root)
const app = createApp(defineComponent(() => () => h(GitBranchChip, {
...props,
onOpen: () => { opened += 1 },
})))
apps.push(app)
app.mount(root)
await nextTick()
return { root, props, opened: () => opened, button: () => root.querySelector('button')! }
}

describe('App git branch chip contract', () => {
it('mounts the branch chip as the first topbar-right control on chat routes', () => {
const rightStart = appSource.indexOf('<div class="topbar-right">')
const rightEnd = appSource.indexOf('<WorkbenchToggle', rightStart)
const right = appSource.slice(rightStart, rightEnd)

expect(right).toContain('<GitBranchChip')
expect(right.trimStart().startsWith('<div class="topbar-right">\n <GitBranchChip')).toBe(true)
expect(right).toContain('v-if="isChatRoute && gitStatus.branchLabel.value"')
expect(right).toContain(':dirty-count="gitStatus.dirtyCount.value"')
expect(right).toContain(':loading="gitStatus.loading.value"')
expect(right).toContain('@open="openGitChanges"')
})

it('reads git status for the active chat session and opens a stable workbench tab', () => {
expect(appSource).toContain("import GitBranchChip from './components/chat/GitBranchChip.vue'")
expect(appSource).toContain('const gitAccess = useGitAccess()')
expect(appSource).toContain('chatRouteHeader.model.workspaceId.value ?? null')
expect(appSource).toContain('active: computed(() => isChatRoute.value)')

const handlerStart = appSource.indexOf('function openGitChanges()')
const handlerEnd = appSource.indexOf('\n}', handlerStart)
const handler = appSource.slice(handlerStart, handlerEnd)
expect(handler).toContain("id: 'git-changes'")
expect(handler).toContain("kind: 'git-changes'")
expect(handler).toContain("title: t('workbench.gitChanges.title')")
expect(handler).toContain('workbenchStore.openItem(item, { activate: true })')
expect(handler).toContain('workbenchStore.setExpanded(true)')
})
})

describe('GitBranchChip', () => {
it('renders the branch name and opens the workbench on click', async () => {
const { button, opened } = await mountChip({ label: 'main', dirtyCount: 0 })

expect(button().getAttribute('type')).toBe('button')
expect(button().textContent).toContain('main')
expect(button().getAttribute('title')).toBe('workbench.gitChanges.openHint|main')
expect(button().getAttribute('aria-label')).toBe('workbench.gitChanges.openHint|main')
expect(button().querySelector('.git-branch-chip__dirty')).toBeNull()

button().click()
await nextTick()
expect(opened()).toBe(1)
})

it('marks a dirty working tree with a star after the branch name', async () => {
const { button } = await mountChip({ label: 'main', dirtyCount: 3 })

expect(button().querySelector('.git-branch-chip__dirty')?.textContent).toBe('*')
expect(button().textContent?.trim()).toBe('main*')
})

it('stays quiet while a read is in flight instead of flashing', async () => {
const { button, props, root } = await mountChip({ label: 'main', dirtyCount: 0, loading: true })

expect(button().getAttribute('aria-busy')).toBe('true')
expect(button().classList.contains('git-branch-chip--loading')).toBe(true)
expect(root.querySelector('.git-branch-chip__label')?.textContent).toBe('main')

props.loading = false
await nextTick()
expect(button().getAttribute('aria-busy')).toBeNull()
expect(button().classList.contains('git-branch-chip--loading')).toBe(false)
})
})
42 changes: 42 additions & 0 deletions opensquilla-webui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@
/>
</div>
<div class="topbar-right">
<GitBranchChip
v-if="isChatRoute && gitStatus.branchLabel.value"
:label="gitStatus.branchLabel.value"
:dirty-count="gitStatus.dirtyCount.value"
:loading="gitStatus.loading.value"
@open="openGitChanges"
/>
<ChatSystemStatus
:layout="systemHeaderLayout"
:connection-state="effectiveConnectionState"
Expand Down Expand Up @@ -487,6 +494,7 @@ import ProjectWorkspacePickerDialog from './components/ProjectWorkspacePickerDia
import UpdateBanner from './components/UpdateBanner.vue'
import SidebarDesktopUpdate from './components/SidebarDesktopUpdate.vue'
import ChatSystemStatus from './components/chat/ChatSystemStatus.vue'
import GitBranchChip from './components/chat/GitBranchChip.vue'
import ChatHeaderActions from './components/chat/ChatHeaderActions.vue'
import SidebarConversations from './components/SidebarConversations.vue'
import SidebarResizer from './components/SidebarResizer.vue'
Expand All @@ -495,6 +503,9 @@ import ArtifactImageLightbox from './components/chat/ArtifactImageLightbox.vue'
import AppWorkbench from './components/workbench/AppWorkbench.vue'
import WorkbenchToggle from './components/workbench/WorkbenchToggle.vue'
import { useWorkbenchStore } from './workbench/store'
import type { WorkbenchItem, WorkbenchScope } from './workbench/types'
import { useGitAccess } from './modules/git'
import { useGitStatus } from './composables/useGitStatus'
import { WORKBENCH_SPLIT_MIN_WIDTH, workbenchLayoutMode, workbenchShouldYieldSidebar } from './workbench/layout'
import { useDesktopUpdate } from './composables/useDesktopUpdate'
import { useDesktopUpdatePresentation } from './composables/useDesktopUpdatePresentation'
Expand Down Expand Up @@ -935,6 +946,37 @@ const currentSessionKey = computed(() => {
const workbenchSessionKey = computed(() =>
currentSessionKey.value || chatRouteHeader.model.sessionKey.value,
)
// The branch chip reads the current session's working directory. A null
// workspaceId means "session default", so nothing has to be resolved here.
const gitAccess = useGitAccess()
const gitWorkspaceId = computed(() => chatRouteHeader.model.workspaceId.value ?? null)
const gitStatus = useGitStatus({
access: computed(() => gitAccess),
workspaceId: gitWorkspaceId,
active: computed(() => isChatRoute.value),
})

// One stable id per session scope: clicking the chip again re-activates the
// same tab instead of stacking duplicates.
function openGitChanges() {
const sessionKey = workbenchSessionKey.value
const scope: WorkbenchScope = sessionKey
? { type: 'session', id: sessionKey }
: { type: 'app' }
const item: WorkbenchItem = {
id: 'git-changes',
kind: 'git-changes',
title: t('workbench.gitChanges.title'),
scope,
hostKind: 'dom',
retention: 'keep-alive',
// The panel renders outside this route, so the repository it reads travels
// with the item; null keeps the session-default working directory.
payload: { workspaceId: gitWorkspaceId.value },
}
workbenchStore.openItem(item, { activate: true })
workbenchStore.setExpanded(true)
}
const sessionTaskAttention = useSessionTaskAttention()

function currentSessionIsVisible(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ describe('Gateway Adapter composition', () => {
'workspaceReferences',
'workspaceFiles',
'terminal',
'git',
'sandboxRuntime',
'usageReporting',
'commandCatalog',
Expand Down
4 changes: 4 additions & 0 deletions opensquilla-webui/src/adapters/gateway/gatewayAdapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import type { WorkspaceFiles } from '@/modules/workspaceFiles'
import { createV4WorkspaceFiles } from './workspaceFilesV4'
import type { TerminalAccess } from '@/modules/terminal'
import { createV4TerminalAccess } from './terminalV4'
import type { GitAccess } from '@/modules/git'
import { createGitAccess } from './gitV4'
import type { SandboxRuntime } from '@/modules/sandboxRuntime'
import { createV4SandboxRuntime } from './sandboxRuntimeV4'
import type { UsageReporting } from '@/modules/usageReporting'
Expand Down Expand Up @@ -111,6 +113,7 @@ export interface GatewayAdapters {
readonly workspaceReferences: WorkspaceReferences
readonly workspaceFiles: WorkspaceFiles
readonly terminal: TerminalAccess
readonly git: GitAccess
readonly sandboxRuntime: SandboxRuntime
readonly usageReporting: UsageReporting
readonly commandCatalog: CommandCatalog
Expand Down Expand Up @@ -194,6 +197,7 @@ export function createGatewayAdapters(
workspaceReferences: createV4WorkspaceReferences(transports.rpc),
workspaceFiles: createV4WorkspaceFiles(http),
terminal: createV4TerminalAccess(transports.rpc, transports.events),
git: createGitAccess(transports.rpc),
sandboxRuntime: createV4SandboxRuntime(transports.rpc, transports.events),
usageReporting: createV4UsageReporting(transports.rpc),
commandCatalog: createV4CommandCatalog(transports.rpc),
Expand Down
Loading
Loading