@mgsoftwarebv/mcp-server-bridge 3.5.14 → 3.5.15

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.
package/dist/index.js CHANGED
@@ -94095,7 +94095,7 @@ var projects = pgTable(
94095
94095
  // Basic project management extensions
94096
94096
  color: text().default("#3B82F6").notNull(),
94097
94097
  projectCode: text("project_code"),
94098
- settings: jsonb().default({}),
94098
+ settings: jsonb().$type().default({}),
94099
94099
  // Customer portal fields
94100
94100
  ownedByCustomer: boolean3("owned_by_customer").default(false),
94101
94101
  internal: boolean3().default(false).notNull(),
@@ -101312,7 +101312,11 @@ var teams = pgTable(
101312
101312
  // classifier allow-list filter. Default 30 mirrors `DEFAULT_TOOL_BUDGET_MAX`
101313
101313
  // in apps/api/src/ai/floris/skills/budget.ts. Read-resolver lands in
101314
101314
  // A5-impl.b; per-team toggles in A5-impl.c.
101315
- florisConfig: jsonb("floris_config").$type().default({ tool_budget_max: 30 }).notNull()
101315
+ florisConfig: jsonb("floris_config").$type().default({ tool_budget_max: 30 }).notNull(),
101316
+ // Per-team time-tracking policy (ticket 2026-REFRO-140). Currently holds the
101317
+ // agent kill-switch `blockAgentDrafts`. Default `{}`; the resolver treats a
101318
+ // missing flag as "block" so new teams are safe by default.
101319
+ timeTrackingPolicy: jsonb("time_tracking_policy").$type().default({}).notNull()
101316
101320
  },
101317
101321
  (table) => [
101318
101322
  unique("teams_documents_email_id_key").on(table.documentsEmailId),
@@ -114381,6 +114385,43 @@ async function handleListGithubDirectory(input) {
114381
114385
  }
114382
114386
 
114383
114387
  // src/tools/hours.ts
114388
+ async function assertAgentMayLogHours(args2) {
114389
+ const [team] = await db.select({ policy: schema_exports.teams.timeTrackingPolicy }).from(schema_exports.teams).where(eq(schema_exports.teams.id, args2.teamId)).limit(1);
114390
+ let projectPolicy = {};
114391
+ if (args2.projectId) {
114392
+ const [project] = await db.select({ settings: schema_exports.projects.settings }).from(schema_exports.projects).where(eq(schema_exports.projects.id, args2.projectId)).limit(1);
114393
+ const settings = project?.settings;
114394
+ if (settings?.timeTracking && typeof settings.timeTracking === "object") {
114395
+ projectPolicy = settings.timeTracking;
114396
+ }
114397
+ }
114398
+ const teamBlocksAgents = team?.policy?.blockAgentDrafts ?? true;
114399
+ const projectAllowAgents = projectPolicy.allowAgents;
114400
+ const allowAgents = projectAllowAgents === void 0 || projectAllowAgents === null ? !teamBlocksAgents : Boolean(projectAllowAgents);
114401
+ const enabled = projectPolicy.enabled !== false;
114402
+ const requireTicket = projectPolicy.requireTicket === true;
114403
+ const allowedTicketStatuses = Array.isArray(projectPolicy.allowedTicketStatuses) && projectPolicy.allowedTicketStatuses.length > 0 ? projectPolicy.allowedTicketStatuses : null;
114404
+ if (!enabled) {
114405
+ throw new Error(
114406
+ "Blocked by time-tracking policy: time tracking is disabled for this project. No hours can be logged."
114407
+ );
114408
+ }
114409
+ if (!allowAgents) {
114410
+ throw new Error(
114411
+ "Blocked by time-tracking policy: agents/automation may not log draft hours here. Ask a human to enable 'allow agents' on the project (or the team's agent time-tracking setting) before logging time."
114412
+ );
114413
+ }
114414
+ if (requireTicket && !args2.hasTicket) {
114415
+ throw new Error(
114416
+ "Blocked by time-tracking policy: this project requires every time entry to be linked to a ticket. Pass a ticketId."
114417
+ );
114418
+ }
114419
+ if (allowedTicketStatuses && args2.hasTicket && args2.ticketStatus && !allowedTicketStatuses.includes(args2.ticketStatus)) {
114420
+ throw new Error(
114421
+ `Blocked by time-tracking policy: time can only be booked on tickets with status: ${allowedTicketStatuses.join(", ")}. This ticket is "${args2.ticketStatus}".`
114422
+ );
114423
+ }
114424
+ }
114384
114425
  async function handleLogHours(input) {
114385
114426
  const ctx = getAuthContext();
114386
114427
  const {
@@ -114441,6 +114482,12 @@ async function handleLogHours(input) {
114441
114482
  if (!resolved.ok) return resolved.response;
114442
114483
  insertTeamId = resolved.teamId;
114443
114484
  }
114485
+ await assertAgentMayLogHours({
114486
+ teamId: insertTeamId,
114487
+ projectId: project?.id ?? null,
114488
+ hasTicket: Boolean(ticket?.id),
114489
+ ticketStatus: ticket?.status ?? null
114490
+ });
114444
114491
  const durationSeconds = Math.round(estimatedHours * 3600);
114445
114492
  const now2 = /* @__PURE__ */ new Date();
114446
114493
  let agendaEntry = null;