agor-live 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  export { and, desc, eq, inArray, like, or, sql } from 'drizzle-orm';
2
2
  import bcryptjs from 'bcryptjs';
3
- import { b as Database, B as BaseRepository } from '../worktrees-DZ3DkdlA.cjs';
4
- export { A as AmbiguousIdError, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from '../worktrees-DZ3DkdlA.cjs';
3
+ import { b as Database, B as BaseRepository } from '../worktrees-BnZ6TnB3.cjs';
4
+ export { A as AmbiguousIdError, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from '../worktrees-BnZ6TnB3.cjs';
5
5
  import { B as BoardComment } from '../board-comment-CaUiaZB5.cjs';
6
6
  import { B as BoardID, W as WorktreeID } from '../id-DMqyogFB.cjs';
7
7
  import { a as BoardEntityObject, e as Board, d as BoardObject } from '../session-Dl5E0CV3.cjs';
@@ -10,8 +10,8 @@ import { e as Task } from '../task-BIEgT1DK.cjs';
10
10
  import { a as User } from '../user-eUuKj7yM.cjs';
11
11
  import '../message-BoxZISHg.cjs';
12
12
  import 'drizzle-orm/libsql';
13
- import 'drizzle-orm/sqlite-core';
14
13
  import '../agentic-tool-F4yIQb5n.cjs';
14
+ import 'drizzle-orm/sqlite-core';
15
15
 
16
16
  /**
17
17
  * ID Management Utilities
@@ -1,7 +1,7 @@
1
1
  export { and, desc, eq, inArray, like, or, sql } from 'drizzle-orm';
2
2
  import bcryptjs from 'bcryptjs';
3
- import { b as Database, B as BaseRepository } from '../worktrees-Bo5VOy-g.js';
4
- export { A as AmbiguousIdError, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from '../worktrees-Bo5VOy-g.js';
3
+ import { b as Database, B as BaseRepository } from '../worktrees-BGyg0_jA.js';
4
+ export { A as AmbiguousIdError, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from '../worktrees-BGyg0_jA.js';
5
5
  import { B as BoardComment } from '../board-comment-BCrDUioT.js';
6
6
  import { B as BoardID, W as WorktreeID } from '../id-DMqyogFB.js';
7
7
  import { a as BoardEntityObject, e as Board, d as BoardObject } from '../session-De4TwIM_.js';
@@ -10,8 +10,8 @@ import { e as Task } from '../task-DuIfiUbW.js';
10
10
  import { a as User } from '../user-BmL3kFol.js';
11
11
  import '../message-DvBzHu7V.js';
12
12
  import 'drizzle-orm/libsql';
13
- import 'drizzle-orm/sqlite-core';
14
13
  import '../agentic-tool-BKO8MCeP.js';
14
+ import 'drizzle-orm/sqlite-core';
15
15
 
16
16
  /**
17
17
  * ID Management Utilities
@@ -15,7 +15,7 @@ export { ActiveUser, CreateInput, CursorLeaveEvent, CursorMoveEvent, CursorMoved
15
15
  export { a as Repo, e as RepoEnvironmentConfig, R as RepoSlug, c as Worktree, b as WorktreeConfig, d as WorktreeEnvironmentInstance, W as WorktreeName } from './repo-Dr--T0wp.cjs';
16
16
  export { C as CreateUserInput, b as UpdateUserInput, a as User, U as UserRole } from './user-eUuKj7yM.cjs';
17
17
  export { and, desc, eq, inArray, like, or, sql } from 'drizzle-orm';
18
- export { A as AmbiguousIdError, B as BaseRepository, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, b as Database, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from './worktrees-DZ3DkdlA.cjs';
18
+ export { A as AmbiguousIdError, B as BaseRepository, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, b as Database, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from './worktrees-BnZ6TnB3.cjs';
19
19
  export { Id, NullableId, Paginated, Params, Service, ServiceMethods } from '@feathersjs/feathers';
20
20
  import 'socket.io-client';
21
21
  import 'bcryptjs';
@@ -15,7 +15,7 @@ export { ActiveUser, CreateInput, CursorLeaveEvent, CursorMoveEvent, CursorMoved
15
15
  export { a as Repo, e as RepoEnvironmentConfig, R as RepoSlug, c as Worktree, b as WorktreeConfig, d as WorktreeEnvironmentInstance, W as WorktreeName } from './repo-BoA8D6Uf.js';
16
16
  export { C as CreateUserInput, b as UpdateUserInput, a as User, U as UserRole } from './user-BmL3kFol.js';
17
17
  export { and, desc, eq, inArray, like, or, sql } from 'drizzle-orm';
18
- export { A as AmbiguousIdError, B as BaseRepository, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, b as Database, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from './worktrees-Bo5VOy-g.js';
18
+ export { A as AmbiguousIdError, B as BaseRepository, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, b as Database, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from './worktrees-BGyg0_jA.js';
19
19
  export { Id, NullableId, Paginated, Params, Service, ServiceMethods } from '@feathersjs/feathers';
20
20
  import 'socket.io-client';
21
21
  import 'bcryptjs';
@@ -1,7 +1,7 @@
1
1
  import { d as Message, M as MessageRole } from '../message-BoxZISHg.cjs';
2
2
  import { M as MessageID, a as SessionID, T as TaskID } from '../id-DMqyogFB.cjs';
3
3
  import { PermissionMode } from '@anthropic-ai/claude-agent-sdk';
4
- import { f as MessagesRepository, g as SessionRepository, S as SessionMCPServerRepository, M as MCPServerRepository, W as WorktreeRepository } from '../worktrees-DZ3DkdlA.cjs';
4
+ import { f as MessagesRepository, g as SessionRepository, S as SessionMCPServerRepository, M as MCPServerRepository, W as WorktreeRepository } from '../worktrees-BnZ6TnB3.cjs';
5
5
  import { PermissionService } from '../permissions/index.cjs';
6
6
  import { TokenUsage } from '../utils/pricing.cjs';
7
7
  import { T as TaskStatus, e as Task } from '../task-BIEgT1DK.cjs';
@@ -10,8 +10,8 @@ import { P as PermissionMode$1 } from '../session-Dl5E0CV3.cjs';
10
10
  export { CODEX_MINI_MODEL, CODEX_MODELS, DEFAULT_CODEX_MODEL, DEFAULT_GEMINI_MODEL, GEMINI_MODELS, GeminiModel } from './models.cjs';
11
11
  import '../repo-Dr--T0wp.cjs';
12
12
  import 'drizzle-orm/libsql';
13
- import 'drizzle-orm/sqlite-core';
14
13
  import '../agentic-tool-F4yIQb5n.cjs';
14
+ import 'drizzle-orm/sqlite-core';
15
15
 
16
16
  /**
17
17
  * Tool Types - Base types for agentic coding tools
@@ -1,7 +1,7 @@
1
1
  import { d as Message, M as MessageRole } from '../message-DvBzHu7V.js';
2
2
  import { M as MessageID, a as SessionID, T as TaskID } from '../id-DMqyogFB.js';
3
3
  import { PermissionMode } from '@anthropic-ai/claude-agent-sdk';
4
- import { f as MessagesRepository, g as SessionRepository, S as SessionMCPServerRepository, M as MCPServerRepository, W as WorktreeRepository } from '../worktrees-Bo5VOy-g.js';
4
+ import { f as MessagesRepository, g as SessionRepository, S as SessionMCPServerRepository, M as MCPServerRepository, W as WorktreeRepository } from '../worktrees-BGyg0_jA.js';
5
5
  import { PermissionService } from '../permissions/index.js';
6
6
  import { TokenUsage } from '../utils/pricing.js';
7
7
  import { T as TaskStatus, e as Task } from '../task-DuIfiUbW.js';
@@ -10,8 +10,8 @@ import { P as PermissionMode$1 } from '../session-De4TwIM_.js';
10
10
  export { CODEX_MINI_MODEL, CODEX_MODELS, DEFAULT_CODEX_MODEL, DEFAULT_GEMINI_MODEL, GEMINI_MODELS, GeminiModel } from './models.js';
11
11
  import '../repo-BoA8D6Uf.js';
12
12
  import 'drizzle-orm/libsql';
13
- import 'drizzle-orm/sqlite-core';
14
13
  import '../agentic-tool-BKO8MCeP.js';
14
+ import 'drizzle-orm/sqlite-core';
15
15
 
16
16
  /**
17
17
  * Tool Types - Base types for agentic coding tools
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/utils/url.ts
21
+ var url_exports = {};
22
+ __export(url_exports, {
23
+ normalizeOptionalHttpUrl: () => normalizeOptionalHttpUrl
24
+ });
25
+ module.exports = __toCommonJS(url_exports);
26
+ function normalizeOptionalHttpUrl(value, fieldName = "value") {
27
+ if (value === null || value === void 0) {
28
+ return void 0;
29
+ }
30
+ if (typeof value !== "string") {
31
+ throw new Error(`${fieldName} must be a string`);
32
+ }
33
+ const trimmed = value.trim();
34
+ if (trimmed.length === 0) {
35
+ return void 0;
36
+ }
37
+ try {
38
+ const parsed = new URL(trimmed);
39
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
40
+ throw new Error(`${fieldName} must use http or https`);
41
+ }
42
+ return parsed.toString();
43
+ } catch (error) {
44
+ if (error instanceof Error && error.message.startsWith(fieldName)) {
45
+ throw error;
46
+ }
47
+ throw new Error(`${fieldName} must be a valid http(s) URL`);
48
+ }
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ normalizeOptionalHttpUrl
53
+ });
@@ -0,0 +1,20 @@
1
+ /**
2
+ * URL normalization utilities
3
+ *
4
+ * Provides shared helpers for validating and normalizing user-provided URLs.
5
+ */
6
+ /**
7
+ * Normalize an optional HTTP(S) URL string.
8
+ *
9
+ * - Trims whitespace
10
+ * - Returns `undefined` for empty or missing values
11
+ * - Validates that protocol is http or https
12
+ * - Returns canonical `.toString()` representation
13
+ *
14
+ * @param value - Potential URL value from user input
15
+ * @param fieldName - Friendly field name for error messages
16
+ * @throws Error if the URL is present but invalid or not http(s)
17
+ */
18
+ declare function normalizeOptionalHttpUrl(value: unknown, fieldName?: string): string | undefined;
19
+
20
+ export { normalizeOptionalHttpUrl };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * URL normalization utilities
3
+ *
4
+ * Provides shared helpers for validating and normalizing user-provided URLs.
5
+ */
6
+ /**
7
+ * Normalize an optional HTTP(S) URL string.
8
+ *
9
+ * - Trims whitespace
10
+ * - Returns `undefined` for empty or missing values
11
+ * - Validates that protocol is http or https
12
+ * - Returns canonical `.toString()` representation
13
+ *
14
+ * @param value - Potential URL value from user input
15
+ * @param fieldName - Friendly field name for error messages
16
+ * @throws Error if the URL is present but invalid or not http(s)
17
+ */
18
+ declare function normalizeOptionalHttpUrl(value: unknown, fieldName?: string): string | undefined;
19
+
20
+ export { normalizeOptionalHttpUrl };
@@ -0,0 +1,28 @@
1
+ // src/utils/url.ts
2
+ function normalizeOptionalHttpUrl(value, fieldName = "value") {
3
+ if (value === null || value === void 0) {
4
+ return void 0;
5
+ }
6
+ if (typeof value !== "string") {
7
+ throw new Error(`${fieldName} must be a string`);
8
+ }
9
+ const trimmed = value.trim();
10
+ if (trimmed.length === 0) {
11
+ return void 0;
12
+ }
13
+ try {
14
+ const parsed = new URL(trimmed);
15
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
16
+ throw new Error(`${fieldName} must use http or https`);
17
+ }
18
+ return parsed.toString();
19
+ } catch (error) {
20
+ if (error instanceof Error && error.message.startsWith(fieldName)) {
21
+ throw error;
22
+ }
23
+ throw new Error(`${fieldName} must be a valid http(s) URL`);
24
+ }
25
+ }
26
+ export {
27
+ normalizeOptionalHttpUrl
28
+ };
@@ -3,6 +3,7 @@ import { d as Message } from './message-DvBzHu7V.js';
3
3
  import { M as MessageID, a as SessionID, T as TaskID, U as UUID } from './id-DMqyogFB.js';
4
4
  import { c as Worktree } from './repo-BoA8D6Uf.js';
5
5
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
6
+ import { c as CodexSandboxMode, d as CodexApprovalPolicy } from './agentic-tool-BKO8MCeP.js';
6
7
  import { e as Task } from './task-DuIfiUbW.js';
7
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
8
9
 
@@ -228,6 +229,10 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
228
229
  permission_config?: {
229
230
  allowedTools?: string[];
230
231
  mode?: PermissionMode;
232
+ codex?: {
233
+ sandboxMode: CodexSandboxMode;
234
+ approvalPolicy: CodexApprovalPolicy;
235
+ };
231
236
  };
232
237
  model_config?: {
233
238
  mode: "alias" | "exact";
@@ -268,6 +273,10 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
268
273
  permission_config?: {
269
274
  allowedTools?: string[];
270
275
  mode?: PermissionMode;
276
+ codex?: {
277
+ sandboxMode: CodexSandboxMode;
278
+ approvalPolicy: CodexApprovalPolicy;
279
+ };
271
280
  };
272
281
  model_config?: {
273
282
  mode: "alias" | "exact";
@@ -3,6 +3,7 @@ import { d as Message } from './message-BoxZISHg.cjs';
3
3
  import { M as MessageID, a as SessionID, T as TaskID, U as UUID } from './id-DMqyogFB.cjs';
4
4
  import { c as Worktree } from './repo-Dr--T0wp.cjs';
5
5
  import { LibSQLDatabase } from 'drizzle-orm/libsql';
6
+ import { c as CodexSandboxMode, d as CodexApprovalPolicy } from './agentic-tool-F4yIQb5n.cjs';
6
7
  import { e as Task } from './task-BIEgT1DK.cjs';
7
8
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
8
9
 
@@ -228,6 +229,10 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
228
229
  permission_config?: {
229
230
  allowedTools?: string[];
230
231
  mode?: PermissionMode;
232
+ codex?: {
233
+ sandboxMode: CodexSandboxMode;
234
+ approvalPolicy: CodexApprovalPolicy;
235
+ };
231
236
  };
232
237
  model_config?: {
233
238
  mode: "alias" | "exact";
@@ -268,6 +273,10 @@ declare const sessions: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
268
273
  permission_config?: {
269
274
  allowedTools?: string[];
270
275
  mode?: PermissionMode;
276
+ codex?: {
277
+ sandboxMode: CodexSandboxMode;
278
+ approvalPolicy: CodexApprovalPolicy;
279
+ };
271
280
  };
272
281
  model_config?: {
273
282
  mode: "alias" | "exact";
@@ -1,5 +1,5 @@
1
1
  import { ExpressApplication, Service } from '@agor/core/feathers';
2
- import { AuthenticatedUser as AuthenticatedUser$1, AuthenticatedParams as AuthenticatedParams$1, CreateHookContext as CreateHookContext$1, HookContext as HookContext$1, Session, Params, Task, Repo, Board, Message, Worktree, WorktreeID } from '@agor/core/types';
2
+ import { AuthenticatedUser as AuthenticatedUser$1, AuthenticatedParams as AuthenticatedParams$1, CreateHookContext as CreateHookContext$1, HookContext as HookContext$1, Session, Params, Task, Repo, Worktree, Board, Message, WorktreeID } from '@agor/core/types';
3
3
 
4
4
  /**
5
5
  * FeathersJS Type Declarations for Agor Daemon
@@ -65,7 +65,12 @@ interface ReposServiceImpl extends Service<Repo, Partial<Repo>, Params> {
65
65
  name: string;
66
66
  ref: string;
67
67
  createBranch?: boolean;
68
- }, params?: Params): Promise<Repo>;
68
+ pullLatest?: boolean;
69
+ sourceBranch?: string;
70
+ issue_url?: string;
71
+ pull_request_url?: string;
72
+ boardId?: string;
73
+ }, params?: Params): Promise<Worktree>;
69
74
  removeWorktree(id: string, name: string, params?: Params): Promise<Repo>;
70
75
  }
71
76
  /**
@@ -106,6 +106,12 @@ var routes_exports = {};
106
106
  __export(routes_exports, {
107
107
  setupMCPRoutes: () => setupMCPRoutes
108
108
  });
109
+ import { normalizeOptionalHttpUrl } from "@agor/core/utils/url";
110
+ function coerceString(value) {
111
+ if (typeof value !== "string") return void 0;
112
+ const trimmed = value.trim();
113
+ return trimmed.length > 0 ? trimmed : void 0;
114
+ }
109
115
  function setupMCPRoutes(app) {
110
116
  const handler = async (req, res) => {
111
117
  try {
@@ -269,6 +275,52 @@ function setupMCPRoutes(app) {
269
275
  }
270
276
  }
271
277
  },
278
+ {
279
+ name: "agor_worktrees_create",
280
+ description: "Create a worktree (and optional branch) for a repository, with optional board/issue/PR links",
281
+ inputSchema: {
282
+ type: "object",
283
+ properties: {
284
+ repoId: {
285
+ type: "string",
286
+ description: "Repository ID where the worktree will be created"
287
+ },
288
+ worktreeName: {
289
+ type: "string",
290
+ description: "Slug name for the worktree directory (lowercase letters, numbers, hyphens)"
291
+ },
292
+ ref: {
293
+ type: "string",
294
+ description: "Git ref to checkout. Defaults to the worktree name when creating a new branch."
295
+ },
296
+ createBranch: {
297
+ type: "boolean",
298
+ description: "Whether to create a new branch. Defaults to true unless ref is a commit SHA."
299
+ },
300
+ sourceBranch: {
301
+ type: "string",
302
+ description: "Base branch when creating a new branch (defaults to the repo default branch)."
303
+ },
304
+ pullLatest: {
305
+ type: "boolean",
306
+ description: "Pull latest from remote before creating the branch (defaults to true for new branches)."
307
+ },
308
+ boardId: {
309
+ type: "string",
310
+ description: "Board ID to immediately place the worktree on (positions to default coordinates)."
311
+ },
312
+ issueUrl: {
313
+ type: "string",
314
+ description: "Issue URL to associate with the worktree."
315
+ },
316
+ pullRequestUrl: {
317
+ type: "string",
318
+ description: "Pull request URL to associate with the worktree."
319
+ }
320
+ },
321
+ required: ["repoId", "worktreeName"]
322
+ }
323
+ },
272
324
  // Board tools
273
325
  {
274
326
  name: "agor_boards_get",
@@ -401,6 +453,10 @@ function setupMCPRoutes(app) {
401
453
  const { name, arguments: args } = mcpRequest.params || {};
402
454
  console.log(`\u{1F527} MCP tool call: ${name}`);
403
455
  console.log(` Arguments:`, JSON.stringify(args || {}).substring(0, 200));
456
+ const baseServiceParams = {
457
+ user: context.userId ? { user_id: context.userId } : void 0,
458
+ authenticated: true
459
+ };
404
460
  if (name === "agor_sessions_list") {
405
461
  const query = {};
406
462
  if (args?.limit) query.$limit = args.limit;
@@ -469,12 +525,8 @@ function setupMCPRoutes(app) {
469
525
  if (args.taskId) {
470
526
  spawnData.task_id = args.taskId;
471
527
  }
472
- const serviceParams = {
473
- user: context.userId ? { user_id: context.userId } : void 0,
474
- authenticated: true
475
- };
476
528
  console.log(`\u{1F331} MCP spawning subsession from ${context.sessionId.substring(0, 8)}`);
477
- const childSession = await app.service("sessions").spawn(context.sessionId, spawnData, serviceParams);
529
+ const childSession = await app.service("sessions").spawn(context.sessionId, spawnData, baseServiceParams);
478
530
  console.log(`\u2705 Subsession created: ${childSession.session_id.substring(0, 8)}`);
479
531
  console.log(
480
532
  `\u{1F680} Triggering prompt execution for subsession ${childSession.session_id.substring(0, 8)}`
@@ -486,7 +538,7 @@ function setupMCPRoutes(app) {
486
538
  stream: true
487
539
  },
488
540
  {
489
- ...serviceParams,
541
+ ...baseServiceParams,
490
542
  route: { id: childSession.session_id }
491
543
  }
492
544
  );
@@ -541,6 +593,127 @@ function setupMCPRoutes(app) {
541
593
  }
542
594
  ]
543
595
  };
596
+ } else if (name === "agor_worktrees_create") {
597
+ const repoId = coerceString(args?.repoId);
598
+ if (!repoId) {
599
+ return res.status(400).json({
600
+ jsonrpc: "2.0",
601
+ id: mcpRequest.id,
602
+ error: {
603
+ code: -32602,
604
+ message: "Invalid params: repoId is required"
605
+ }
606
+ });
607
+ }
608
+ const worktreeName = coerceString(args?.worktreeName);
609
+ if (!worktreeName) {
610
+ return res.status(400).json({
611
+ jsonrpc: "2.0",
612
+ id: mcpRequest.id,
613
+ error: {
614
+ code: -32602,
615
+ message: "Invalid params: worktreeName is required"
616
+ }
617
+ });
618
+ }
619
+ if (!WORKTREE_NAME_PATTERN.test(worktreeName)) {
620
+ return res.status(400).json({
621
+ jsonrpc: "2.0",
622
+ id: mcpRequest.id,
623
+ error: {
624
+ code: -32602,
625
+ message: "Invalid params: worktreeName must use lowercase letters, numbers, or hyphens"
626
+ }
627
+ });
628
+ }
629
+ const reposService = app.service("repos");
630
+ let repo;
631
+ try {
632
+ repo = await reposService.get(repoId);
633
+ } catch {
634
+ return res.status(404).json({
635
+ jsonrpc: "2.0",
636
+ id: mcpRequest.id,
637
+ error: {
638
+ code: -32602,
639
+ message: `Repository ${repoId} not found`
640
+ }
641
+ });
642
+ }
643
+ const defaultBranch = coerceString(repo.default_branch) ?? "main";
644
+ let createBranch = typeof args?.createBranch === "boolean" ? args.createBranch : true;
645
+ let ref = coerceString(args?.ref);
646
+ let sourceBranch = coerceString(args?.sourceBranch);
647
+ let pullLatest = typeof args?.pullLatest === "boolean" ? args.pullLatest : void 0;
648
+ if (ref && GIT_SHA_PATTERN.test(ref)) {
649
+ createBranch = false;
650
+ pullLatest = false;
651
+ sourceBranch = void 0;
652
+ }
653
+ if (createBranch) {
654
+ if (!ref) {
655
+ ref = worktreeName;
656
+ }
657
+ if (!sourceBranch) {
658
+ sourceBranch = defaultBranch;
659
+ }
660
+ if (pullLatest === void 0) {
661
+ pullLatest = true;
662
+ }
663
+ } else {
664
+ if (!ref) {
665
+ return res.status(400).json({
666
+ jsonrpc: "2.0",
667
+ id: mcpRequest.id,
668
+ error: {
669
+ code: -32602,
670
+ message: "Invalid params: ref is required when createBranch is false"
671
+ }
672
+ });
673
+ }
674
+ sourceBranch = void 0;
675
+ if (pullLatest === void 0) {
676
+ pullLatest = false;
677
+ }
678
+ }
679
+ const boardId = coerceString(args?.boardId);
680
+ let issueUrl;
681
+ let pullRequestUrl;
682
+ try {
683
+ issueUrl = normalizeOptionalHttpUrl(args?.issueUrl, "issueUrl");
684
+ pullRequestUrl = normalizeOptionalHttpUrl(args?.pullRequestUrl, "pullRequestUrl");
685
+ } catch (validationError) {
686
+ return res.status(400).json({
687
+ jsonrpc: "2.0",
688
+ id: mcpRequest.id,
689
+ error: {
690
+ code: -32602,
691
+ message: validationError instanceof Error ? validationError.message : "Invalid URL parameter"
692
+ }
693
+ });
694
+ }
695
+ const worktree = await reposService.createWorktree(
696
+ repoId,
697
+ {
698
+ name: worktreeName,
699
+ ref,
700
+ createBranch,
701
+ ...pullLatest !== void 0 ? { pullLatest } : {},
702
+ ...sourceBranch ? { sourceBranch } : {},
703
+ ...issueUrl ? { issue_url: issueUrl } : {},
704
+ ...pullRequestUrl ? { pull_request_url: pullRequestUrl } : {},
705
+ ...boardId ? { boardId } : {}
706
+ },
707
+ baseServiceParams
708
+ );
709
+ mcpResponse = {
710
+ content: [
711
+ {
712
+ type: "text",
713
+ text: JSON.stringify(worktree, null, 2)
714
+ }
715
+ ]
716
+ };
544
717
  } else if (name === "agor_boards_get") {
545
718
  if (!args?.boardId) {
546
719
  return res.status(400).json({
@@ -695,10 +868,13 @@ function setupMCPRoutes(app) {
695
868
  app.post("/mcp", handler);
696
869
  console.log("\u2705 MCP routes registered at POST /mcp");
697
870
  }
871
+ var WORKTREE_NAME_PATTERN, GIT_SHA_PATTERN;
698
872
  var init_routes = __esm({
699
873
  "src/mcp/routes.ts"() {
700
874
  "use strict";
701
875
  init_tokens();
876
+ WORKTREE_NAME_PATTERN = /^[a-z0-9-]+$/;
877
+ GIT_SHA_PATTERN = /^[0-9a-f]{40}$/i;
702
878
  }
703
879
  });
704
880
 
@@ -2443,8 +2619,12 @@ var WorktreesService = class extends DrizzleService {
2443
2619
  async patch(id, data, params) {
2444
2620
  const currentWorktree = await this.get(id, params);
2445
2621
  const oldBoardId = currentWorktree.board_id;
2622
+ const boardIdProvided = Object.hasOwn(data, "board_id");
2446
2623
  const newBoardId = data.board_id;
2447
2624
  const updatedWorktree = await super.patch(id, data, params);
2625
+ if (!boardIdProvided) {
2626
+ return updatedWorktree;
2627
+ }
2448
2628
  if (oldBoardId !== newBoardId) {
2449
2629
  const boardObjectsService = this.app.service("board-objects");
2450
2630
  try {