rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { SystemRole } from "@capakraken/shared";
|
||||
import { SystemRole } from "@nexus/shared";
|
||||
import type { TRPCContext } from "../../trpc.js";
|
||||
import { withToolAccess, type ToolContext, type ToolDef, type ToolExecutor } from "./shared.js";
|
||||
|
||||
@@ -17,24 +17,25 @@ type ResolvedResource = {
|
||||
|
||||
type BlueprintsRateCardsDeps = {
|
||||
createBlueprintCaller: (ctx: TRPCContext) => {
|
||||
listSummaries: () => Promise<Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
_count: { projects: number };
|
||||
}>>;
|
||||
listSummaries: () => Promise<
|
||||
Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
_count: { projects: number };
|
||||
}>
|
||||
>;
|
||||
getByIdentifier: (params: { identifier: string }) => Promise<BlueprintRecord>;
|
||||
};
|
||||
createRateCardCaller: (ctx: TRPCContext) => {
|
||||
list: (params: {
|
||||
isActive: boolean;
|
||||
search?: string;
|
||||
}) => Promise<Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
effectiveFrom: Date | null;
|
||||
effectiveTo: Date | null;
|
||||
_count: { lines: number };
|
||||
}>>;
|
||||
list: (params: { isActive: boolean; search?: string }) => Promise<
|
||||
Array<{
|
||||
id: string;
|
||||
name: string;
|
||||
effectiveFrom: Date | null;
|
||||
effectiveTo: Date | null;
|
||||
_count: { lines: number };
|
||||
}>
|
||||
>;
|
||||
resolveBestRate: (params: {
|
||||
resourceId?: string;
|
||||
roleName?: string;
|
||||
@@ -50,81 +51,85 @@ type BlueprintsRateCardsDeps = {
|
||||
resolve: () => Promise<T>,
|
||||
notFoundMessage: string,
|
||||
) => Promise<T | AssistantToolErrorResult>;
|
||||
parseOptionalIsoDate: (
|
||||
value: string | undefined,
|
||||
fieldName: string,
|
||||
) => Date | undefined;
|
||||
parseOptionalIsoDate: (value: string | undefined, fieldName: string) => Date | undefined;
|
||||
fmtDate: (value: Date | null | undefined) => string | null;
|
||||
};
|
||||
|
||||
export const blueprintsRateCardsToolDefinitions: ToolDef[] = withToolAccess([
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "list_blueprints",
|
||||
description: "List available project blueprints with their field definitions.",
|
||||
parameters: { type: "object", properties: {} },
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "get_blueprint",
|
||||
description: "Get detailed blueprint with all field definitions and role presets.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
identifier: { type: "string", description: "Blueprint ID or name (partial match)" },
|
||||
},
|
||||
required: ["identifier"],
|
||||
export const blueprintsRateCardsToolDefinitions: ToolDef[] = withToolAccess(
|
||||
[
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "list_blueprints",
|
||||
description: "List available project blueprints with their field definitions.",
|
||||
parameters: { type: "object", properties: {} },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "list_rate_cards",
|
||||
description: "List rate cards with their effective dates and line items.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
query: { type: "string", description: "Search by name" },
|
||||
limit: { type: "integer", description: "Max results. Default: 20" },
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "get_blueprint",
|
||||
description: "Get detailed blueprint with all field definitions and role presets.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
identifier: { type: "string", description: "Blueprint ID or name (partial match)" },
|
||||
},
|
||||
required: ["identifier"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "resolve_rate",
|
||||
description: "Look up the applicable rate for a resource, role, or management level from rate cards.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
resourceId: { type: "string", description: "Resource ID or name" },
|
||||
roleName: { type: "string", description: "Role name" },
|
||||
date: { type: "string", description: "Date to check rate for (YYYY-MM-DD). Default: today" },
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "list_rate_cards",
|
||||
description: "List rate cards with their effective dates and line items.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
query: { type: "string", description: "Search by name" },
|
||||
limit: { type: "integer", description: "Max results. Default: 20" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "function",
|
||||
function: {
|
||||
name: "resolve_rate",
|
||||
description:
|
||||
"Look up the applicable rate for a resource, role, or management level from rate cards.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
properties: {
|
||||
resourceId: { type: "string", description: "Resource ID or name" },
|
||||
roleName: { type: "string", description: "Role name" },
|
||||
date: {
|
||||
type: "string",
|
||||
description: "Date to check rate for (YYYY-MM-DD). Default: today",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
{
|
||||
list_blueprints: {
|
||||
requiresPlanningRead: true,
|
||||
},
|
||||
get_blueprint: {
|
||||
requiresPlanningRead: true,
|
||||
},
|
||||
list_rate_cards: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN, SystemRole.MANAGER, SystemRole.CONTROLLER],
|
||||
requiresCostView: true,
|
||||
},
|
||||
resolve_rate: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN, SystemRole.MANAGER, SystemRole.CONTROLLER],
|
||||
requiresCostView: true,
|
||||
},
|
||||
},
|
||||
], {
|
||||
list_blueprints: {
|
||||
requiresPlanningRead: true,
|
||||
},
|
||||
get_blueprint: {
|
||||
requiresPlanningRead: true,
|
||||
},
|
||||
list_rate_cards: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN, SystemRole.MANAGER, SystemRole.CONTROLLER],
|
||||
requiresCostView: true,
|
||||
},
|
||||
resolve_rate: {
|
||||
allowedSystemRoles: [SystemRole.ADMIN, SystemRole.MANAGER, SystemRole.CONTROLLER],
|
||||
requiresCostView: true,
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
export function createBlueprintsRateCardsExecutors(
|
||||
deps: BlueprintsRateCardsDeps,
|
||||
@@ -158,10 +163,7 @@ export function createBlueprintsRateCardsExecutors(
|
||||
};
|
||||
},
|
||||
|
||||
async list_rate_cards(
|
||||
params: { query?: string; limit?: number },
|
||||
ctx: ToolContext,
|
||||
) {
|
||||
async list_rate_cards(params: { query?: string; limit?: number }, ctx: ToolContext) {
|
||||
const caller = deps.createRateCardCaller(deps.createScopedCallerContext(ctx));
|
||||
const cards = await caller.list({
|
||||
isActive: true,
|
||||
|
||||
Reference in New Issue
Block a user