feat(artifacts): allow artifact publishing by default for new profiles (#40948)

New profiles default artifactSharingEnabled to true. Existing users are
unchanged: stored settings win over defaults on load, and a stored profile
saved before the key existed loads as false instead of inheriting the new
default. The gate still requires an explicit true, sign-in is still
required, and web clients still mirror the host (their local fallback no
longer inherits the desktop default). showArtifactsButton is unchanged.
This commit is contained in:
Jinjing
2026-11-10 17:28:29 -08:00
committed by GitHub
parent c603a3617f
commit 5f3b2fa4bf
12 changed files with 91 additions and 11 deletions
+1 -1
View File
@@ -427,7 +427,7 @@ A selection applies to every agent of that provider launched on the host after i
## Artifacts
Publish HTML or Markdown through the signed-in Orca account. Viewing a public link does not require sign-in; create/list/update/delete do. **Publishing is off by default** — a human must enable **Settings → Artifacts → Allow publishing public artifact links** on the device. There is no CLI flag that grants the gate. `list`, `unshare`, and `delete` stay available so you can audit or revoke links after turning publishing off.
Publish HTML or Markdown through the signed-in Orca account. Viewing a public link does not require sign-in; create/list/update/delete do. Publishing follows **Settings → Artifacts → Allow publishing public artifact links** on the device: on by default for new profiles, while profiles created before this default keep their previous setting. Only a human can change it; there is no CLI flag that grants the gate. `list`, `unshare`, and `delete` stay available so you can audit or revoke links after turning publishing off.
```bash
orca artifacts share ./report.html --json
+1 -1
View File
@@ -51,4 +51,4 @@ For long documents, click the **Table of Contents** button (tree icon) in the ed
## Share as artifact
From the editor header, **Share as artifact** publishes the open Markdown file as a public view link through your signed-in Orca account. Requires **Settings → Artifacts → Allow publishing public artifact links** (off by default). Republish updates the same link when Orca still has the mapping; manage or delete links from the sidebar **Artifacts** page. Agents and scripts can use `orca artifacts share|update|list|delete` — see [CLI reference → Artifacts](/docs/cli/reference#artifacts).
From the editor header, **Share as artifact** publishes the open Markdown file as a public view link through your signed-in Orca account. Requires **Settings → Artifacts → Allow publishing public artifact links** (on by default for new profiles). Republish updates the same link when Orca still has the mapping; manage or delete links from the sidebar **Artifacts** page. Agents and scripts can use `orca artifacts share|update|list|delete` — see [CLI reference → Artifacts](/docs/cli/reference#artifacts).
+1 -1
View File
@@ -91,7 +91,7 @@ Settings are grouped into panes. Everything here is searchable with `Cmd-,` then
## Artifacts
- **Orca account** — sign in (same account family as Orca Relay) to publish and manage shared files.
- **Allow publishing public artifact links** — **off by default**. Device-wide gate: when on, you, agents, and the `orca` CLI on this machine can upload HTML/Markdown and mint public view links. Turning it off does not delete existing links.
- **Allow publishing public artifact links** — **on by default for new profiles**; profiles created before this default keep their previous setting. Device-wide gate: when on, you, agents, and the `orca` CLI on this machine can upload HTML/Markdown and mint public view links. Turning it off does not delete existing links.
- **Show Artifacts** / sidebar shortcut — open the Artifacts list to search, preview, copy, or delete account-owned links.
- **Ask Before Deleting Artifacts** — optional confirmation before breaking a public link.
- Share from an open local HTML page or Markdown editor with **Share as artifact**, or via `orca artifacts …`. See [CLI reference → Artifacts](/docs/cli/reference#artifacts).
+2 -2
View File
@@ -308,8 +308,8 @@ Use them only when the user explicitly asks to publish through Orca. A generic r
public link, page, or URL does not select Orca, and a provider the user names always wins.
**Only a human can turn publishing on or off.** `share` and `update` need the device-wide
setting under Settings → Artifacts ("Allow publishing public artifact links"); there is no
CLI or RPC way to grant it. `list`, `unshare`, and `delete` are never gated, so old links
setting under Settings → Artifacts ("Allow publishing public artifact links"), which is on
for new profiles; there is no CLI or RPC way to grant it. `list`, `unshare`, and `delete` are never gated, so old links
stay auditable and revocable.
A denied share fails with `artifact_sharing_disabled` before any upload. Do not retry. Tell
+2 -2
View File
@@ -536,8 +536,8 @@ const ORCA_CLI_MARKDOWN = [
"public link, page, or URL does not select Orca, and a provider the user names always wins.",
"",
"**Only a human can turn publishing on or off.** `share` and `update` need the device-wide",
"setting under Settings → Artifacts (\"Allow publishing public artifact links\"); there is no",
"CLI or RPC way to grant it. `list`, `unshare`, and `delete` are never gated, so old links",
"setting under Settings → Artifacts (\"Allow publishing public artifact links\"), which is on",
"for new profiles; there is no CLI or RPC way to grant it. `list`, `unshare`, and `delete` are never gated, so old links",
"stay auditable and revocable.",
"",
"A denied share fails with `artifact_sharing_disabled` before any upload. Do not retry. Tell",
@@ -0,0 +1,59 @@
import { closeTestStores, testState, createStore, writeDataFile } from '../persistence-test-harness'
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { rmSync, mkdtempSync } from 'node:fs'
import { join } from 'node:path'
import { tmpdir } from 'node:os'
vi.mock('electron', () => ({
app: { getPath: () => testState.dir },
safeStorage: {
isEncryptionAvailable: () => true,
encryptString: (plaintext: string) => Buffer.from(`encrypted:${plaintext}`, 'utf-8'),
decryptString: (ciphertext: Buffer) => ciphertext.toString('utf-8').slice('encrypted:'.length)
}
}))
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
vi.mock('../../telemetry/cohort-classifier', () => ({
getCohortAtEmit: () => ({ nth_repo_added: 2 })
}))
function writeSettings(settings: Record<string, unknown>): void {
writeDataFile({
schemaVersion: 1,
repos: [],
worktreeMeta: {},
settings,
ui: {},
githubCache: { pr: {}, issue: {} },
workspaceSession: {}
})
}
describe('artifact sharing default', () => {
beforeEach(() => {
testState.dir = mkdtempSync(join(tmpdir(), 'orca-test-'))
})
afterEach(async () => {
await closeTestStores()
rmSync(testState.dir, { recursive: true, force: true })
})
it('allows publishing on a new profile and keeps it after a reload', async () => {
const store = await createStore()
expect(store.getSettings().artifactSharingEnabled).toBe(true)
store.flush()
await closeTestStores()
expect((await createStore()).getSettings().artifactSharingEnabled).toBe(true)
})
it('keeps a stored opt-out', async () => {
writeSettings({ artifactSharingEnabled: false })
expect((await createStore()).getSettings().artifactSharingEnabled).toBe(false)
})
it('keeps publishing off for a stored profile saved before the setting existed', async () => {
writeSettings({ showArtifactsButton: false })
expect((await createStore()).getSettings().artifactSharingEnabled).toBe(false)
})
})
@@ -98,6 +98,8 @@ export function normalizeLoadedGlobalSettings(
),
worktreeVisibilityDefaults: migratedExternalVisibility.defaults,
prBotAuthorOverrides: normalizePRBotAuthorOverrides(parsed.settings?.prBotAuthorOverrides),
// Only fresh profiles take the on default; a stored profile saved before the key existed was off.
artifactSharingEnabled: parsed.settings?.artifactSharingEnabled === true,
// Carry the retired sidekick flag into pet settings.
experimentalPet: parsed.settings?.experimentalPet ?? readLegacySidekickFlag(parsed) ?? false,
// Migrate old platform defaults once; retain later opt-outs.
@@ -0,0 +1,18 @@
// @vitest-environment happy-dom
import { beforeEach, expect, it, vi } from 'vitest'
import { getStoredSettings } from './web-preferences-store'
import { SETTINGS_STORAGE_KEY } from './web-storage'
vi.mock('./web-runtime-session', () => ({
webRuntimeState: { activeEnvironment: null },
requireActiveEnvironmentOrNull: () => null
}))
beforeEach(() => localStorage.clear())
it('reports publishing off until the host grant has been mirrored', () => {
expect(getStoredSettings().artifactSharingEnabled).toBe(false)
localStorage.setItem(SETTINGS_STORAGE_KEY, JSON.stringify({ artifactSharingEnabled: true }))
expect(getStoredSettings().artifactSharingEnabled).toBe(true)
})
@@ -33,7 +33,7 @@ type SettingsResult = { settings: Partial<GlobalSettings> }
export function getStoredSettings(): GlobalSettings {
webRuntimeState.activeEnvironment ??= readStoredWebRuntimeEnvironment()
const defaults = getDefaultSettings('~')
const defaults = { ...getDefaultSettings('~'), artifactSharingEnabled: false } // Host grants it.
const rawStoredSettings = window.localStorage.getItem(SETTINGS_STORAGE_KEY)
const stored = readJson<Partial<GlobalSettings>>(SETTINGS_STORAGE_KEY, {})
const migratedStored = migrateStoredWebSettings(stored)
@@ -23,7 +23,7 @@ export class ArtifactSharingDisabledError extends Error {
}
}
/** Absent or non-`true` denies: an unmigrated profile must not inherit the capability. */
/** Only explicit `true` grants: new profiles store it from defaults; absent or `false` denies. */
export function isArtifactSharingEnabled(
settings: Pick<GlobalSettings, 'artifactSharingEnabled'> | null | undefined
): boolean {
+2 -1
View File
@@ -174,7 +174,8 @@ export function buildDefaultSettings(args: {
showTasksButton: true,
showAutomationsButton: true,
artifactsEnabled: true,
artifactSharingEnabled: false,
// New profiles only; stored profiles without the key load as false (normalizeLoadedGlobalSettings).
artifactSharingEnabled: true,
agentSkillSharingEnabled: false,
nestedWorkerMaxDepth: NESTED_WORKER_MAX_DEPTH_DEFAULT,
nestedWorkerMaxDepthDefaultedToFour: true,
+1 -1
View File
@@ -251,7 +251,7 @@ export type GlobalSettings = GlobalSettingsBase & {
showAutomationsButton?: boolean
/** Deprecated: Artifacts are always available. Use showArtifactsButton for sidebar visibility. */
artifactsEnabled?: boolean
/** Capability gate for agent-driven publishing; off until granted, enforced in main, not just the UI. */
/** Capability gate for public artifact publishing; on for new profiles, enforced in main, not just the UI. */
artifactSharingEnabled?: boolean
/** Capability gate for agent/CLI skill publishing; manual reviewed publishing remains available. */
agentSkillSharingEnabled?: boolean