sync: update from private repo (a360d15)
CI / build-and-test (push) Has been cancelled

This commit is contained in:
oss-sync
2026-06-09 09:19:09 +00:00
parent 44df3a7da1
commit 483464597a
11 changed files with 328 additions and 16 deletions
+14 -1
View File
@@ -36,10 +36,23 @@ export interface LocalTasksApiOptions {
* without a server restart. Clamped to [1, 1000] MB. Default: 50.
*/
getMaxUploadMb?: () => number;
/**
* Whether the auth subsystem is wired. When `false` (no-auth single-user
* deployment) requests carry no `req.user`, so new tasks/jobs are registered
* under the stable `local` owner instead of NULL — keeping per-task
* reflection / visibility lookups (which key on owner_id) consistent with the
* rest of the no-auth path. Defaults to `true` (owner stays req.user.id).
*/
authActive?: boolean;
}
export function mountLocalTasksApi(app: Application, opts: LocalTasksApiOptions): void {
const { repo, worktreeDir, sessRepo } = opts;
// No-auth single-user mode: register new tasks/jobs under the 'local' owner
// (the same namespace pieces/memory/reflection use) rather than letting the
// missing req.user fall through to a NULL owner. In auth mode this is
// undefined, so `req.user.id ?? noAuthOwner` keeps the real owner.
const noAuthOwner: string | undefined = (opts.authActive ?? true) ? undefined : 'local';
const resolveUploadLimit = (): string => {
const raw = opts.getMaxUploadMb?.() ?? 50;
@@ -161,7 +174,7 @@ export function mountLocalTasksApi(app: Application, opts: LocalTasksApiOptions)
outputFormat,
askPolicy,
priority,
ownerId: req.user?.id,
ownerId: req.user?.id ?? noAuthOwner,
visibility,
visibilityScopeOrgId: visibility === 'org' ? visibilityScopeOrgId : null,
browserSessionProfileId,