Skip to content
Merged
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
1 change: 1 addition & 0 deletions apps/control-plane/src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const daemons = sqliteTable('daemons', {
status: text('status').notNull().default('active'),
snapshot: text('snapshot').notNull(),
trigger: text('trigger', { mode: 'json' }).notNull(),
workspace: text('workspace'),
workload: text('workload', { mode: 'json' }),
agent: text('agent', { mode: 'json' }),
resources: text('resources', { mode: 'json' }),
Expand Down
5 changes: 5 additions & 0 deletions apps/control-plane/src/store/daemons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface StoredDaemon {
status: DaemonStatus;
snapshot: string;
trigger: Trigger;
workspace?: string | undefined;
workload?: Workload | undefined;
agent?: AgentConfig | undefined;
resources?: Resources | undefined;
Expand Down Expand Up @@ -51,6 +52,7 @@ export function createDaemonStore(): DaemonStore {
status: 'active',
snapshot: request.snapshot,
trigger: request.trigger,
workspace: request.workspace,
workload: request.workload,
agent: request.agent,
resources: request.resources,
Expand Down Expand Up @@ -126,6 +128,7 @@ function rowToStoredDaemon(row: DaemonRow): StoredDaemon {
status: row.status as DaemonStatus,
snapshot: row.snapshot,
trigger: row.trigger as Trigger,
workspace: (row as { workspace?: string | null }).workspace ?? undefined,
workload: (row.workload as Workload) ?? undefined,
agent: (row.agent as AgentConfig) ?? undefined,
resources: (row.resources as Resources) ?? undefined,
Expand Down Expand Up @@ -154,6 +157,7 @@ export function createSqliteDaemonStore(db: PawsDatabase): DaemonStore {
status: 'active',
snapshot: request.snapshot,
trigger: request.trigger,
workspace: request.workspace ?? null,
workload: request.workload ?? null,
agent: request.agent ?? null,
resources: request.resources ?? null,
Expand Down Expand Up @@ -183,6 +187,7 @@ export function createSqliteDaemonStore(db: PawsDatabase): DaemonStore {
if (patch.status !== undefined) values['status'] = patch.status;
if (patch.snapshot !== undefined) values['snapshot'] = patch.snapshot;
if (patch.trigger !== undefined) values['trigger'] = patch.trigger;
if (patch.workspace !== undefined) values['workspace'] = patch.workspace;
if (patch.workload !== undefined) values['workload'] = patch.workload;
if (patch.agent !== undefined) values['agent'] = patch.agent;
if (patch.resources !== undefined) values['resources'] = patch.resources;
Expand Down
2 changes: 1 addition & 1 deletion packages/domains/workspace/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const UpdateWorkspaceRequestSchema = z
repos: z.array(WorkspaceRepoSchema).min(1).optional(),
settings: WorkspaceSettingsSchema.optional(),
})
.refine((data) => Object.keys(data).length > 0, {
.refine((data) => Object.values(data).some((v) => v !== undefined), {
message: 'At least one field must be provided',
});

Expand Down
3 changes: 1 addition & 2 deletions packages/domains/workspace/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"compilerOptions": {
"composite": true,
"outDir": "dist",
"rootDir": "src",
"types": []
"rootDir": "src"
},
"include": ["src"]
}
8 changes: 7 additions & 1 deletion packages/proxy/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ export function createProxy(config: ProxyConfig): ProxyInstance {
const hostname = url.hostname;

if (!matchesDomain(hostname, allowlist)) {
const durationMs = Math.round(performance.now() - startTime);
log.warn('domain blocked', {
domain: hostname,
method: req.method,
path: url.pathname,
statusCode: 403,
durationMs,
credentialsInjected: false,
protocol,
});
return new Response('Blocked by network policy', { status: 403 });
}
Expand Down Expand Up @@ -108,6 +113,7 @@ export function createProxy(config: ProxyConfig): ProxyInstance {
domain: hostname,
method: req.method,
path: url.pathname,
statusCode: 502,
durationMs,
credentialsInjected,
protocol,
Expand Down Expand Up @@ -153,7 +159,7 @@ export function createProxy(config: ProxyConfig): ProxyInstance {
log.info('proxy started', {
host: config.listen.host,
httpPort: actualHttpPort,
httpsPort: caCert ? config.listen.port + 1 : null,
httpsPort: caCert && caKey ? config.listen.port + 1 : null,
allowlistedDomains: allowlist.length,
});
},
Expand Down
Loading