@frihet/mcp-server 1.16.6 → 2.0.0
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/README.md +168 -82
- package/dist/agent-onboarding.d.ts +98 -0
- package/dist/agent-onboarding.js +275 -0
- package/dist/api-origin.d.ts +9 -0
- package/dist/api-origin.js +41 -0
- package/dist/canary/mcp-harness.d.ts +77 -0
- package/dist/canary/mcp-harness.js +552 -0
- package/dist/capability-truth.d.ts +29 -0
- package/dist/capability-truth.js +262 -0
- package/dist/claude-candidate-contract.d.ts +482 -0
- package/dist/claude-candidate-contract.js +87 -0
- package/dist/claude-output-privacy.d.ts +17 -0
- package/dist/claude-output-privacy.js +240 -0
- package/dist/claude-profile.d.ts +18 -0
- package/dist/claude-profile.js +260 -0
- package/dist/client-interface.d.ts +47 -33
- package/dist/client.d.ts +172 -40
- package/dist/client.js +708 -165
- package/dist/demo-client.d.ts +41 -32
- package/dist/demo-client.js +202 -31
- package/dist/demo-fixtures.d.ts +3 -3
- package/dist/demo-fixtures.js +7 -7
- package/dist/deposit-contract.d.ts +29 -0
- package/dist/deposit-contract.js +76 -0
- package/dist/fetch-no-redirect.d.ts +3 -0
- package/dist/fetch-no-redirect.js +16 -0
- package/dist/fiscal-aliases.d.ts +44 -0
- package/dist/fiscal-aliases.js +62 -0
- package/dist/fiscal-period.d.ts +26 -0
- package/dist/fiscal-period.js +31 -0
- package/dist/google-profile.d.ts +19 -0
- package/dist/google-profile.js +122 -0
- package/dist/index.js +68 -59
- package/dist/logger.d.ts +2 -2
- package/dist/logger.js +140 -8
- package/dist/muse-profile.d.ts +19 -0
- package/dist/muse-profile.js +122 -0
- package/dist/observability.d.ts +18 -29
- package/dist/observability.js +194 -106
- package/dist/openai-profile.d.ts +26 -22
- package/dist/openai-profile.js +1193 -157
- package/dist/openai-review-contract.d.ts +15 -6
- package/dist/openai-review-contract.js +714 -41
- package/dist/openai-review-oauth.d.ts +149 -2
- package/dist/openai-review-oauth.js +220 -6
- package/dist/prompts/register-all.d.ts +2 -0
- package/dist/prompts/register-all.js +34 -78
- package/dist/public-capability-contract.d.ts +39 -0
- package/dist/public-capability-contract.js +186 -0
- package/dist/redaction.d.ts +15 -0
- package/dist/redaction.js +83 -0
- package/dist/resources/register-all.js +154 -64
- package/dist/retry-after.d.ts +19 -0
- package/dist/retry-after.js +84 -0
- package/dist/server-composition.d.ts +19 -0
- package/dist/server-composition.js +74 -0
- package/dist/tool-exposure.d.ts +31 -27
- package/dist/tool-exposure.js +211 -87
- package/dist/tools/accountingClose.d.ts +14 -5
- package/dist/tools/accountingClose.js +41 -23
- package/dist/tools/audit_gl.js +8 -8
- package/dist/tools/backend-availability.d.ts +8 -29
- package/dist/tools/backend-availability.js +31 -30
- package/dist/tools/bank_rules.js +66 -15
- package/dist/tools/banking.js +5 -13
- package/dist/tools/clients.js +261 -15
- package/dist/tools/crm.js +22 -21
- package/dist/tools/deposits.js +114 -85
- package/dist/tools/einvoice.d.ts +16 -2
- package/dist/tools/einvoice.js +59 -12
- package/dist/tools/expenses.d.ts +16 -0
- package/dist/tools/expenses.js +47 -27
- package/dist/tools/fiscal.d.ts +3 -4
- package/dist/tools/fiscal.js +93 -60
- package/dist/tools/gestoria.js +15 -7
- package/dist/tools/hr.d.ts +2 -3
- package/dist/tools/hr.js +49 -20
- package/dist/tools/igic.d.ts +9 -8
- package/dist/tools/igic.js +34 -64
- package/dist/tools/impuesto_sociedades.d.ts +4 -5
- package/dist/tools/impuesto_sociedades.js +16 -37
- package/dist/tools/intelligence.js +166 -12
- package/dist/tools/invoices.js +224 -54
- package/dist/tools/kitchen.js +19 -9
- package/dist/tools/payroll.d.ts +5 -8
- package/dist/tools/payroll.js +19 -32
- package/dist/tools/permissions.d.ts +4 -7
- package/dist/tools/permissions.js +11 -14
- package/dist/tools/products.js +6 -6
- package/dist/tools/quotes.js +172 -26
- package/dist/tools/recurring.js +26 -25
- package/dist/tools/register-all.d.ts +2 -2
- package/dist/tools/register-all.js +9 -6
- package/dist/tools/search.d.ts +19 -0
- package/dist/tools/search.js +84 -0
- package/dist/tools/shared.d.ts +1445 -109
- package/dist/tools/shared.js +478 -102
- package/dist/tools/team.js +24 -28
- package/dist/tools/time.js +4 -12
- package/dist/tools/vendors.js +249 -15
- package/dist/tools/webhooks.js +35 -30
- package/dist/types.d.ts +31 -5
- package/dist/workflows/daily-operational-brief.d.ts +163 -0
- package/dist/workflows/daily-operational-brief.js +881 -0
- package/docs/agent-onboarding.json +391 -0
- package/package.json +49 -12
- package/dist/tools/onboarding.d.ts +0 -19
- package/dist/tools/onboarding.js +0 -64
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Daily Operational Brief workflow ("¿Qué debería revisar hoy en mi negocio y por qué?").
|
|
3
|
+
*
|
|
4
|
+
* Grounded strictly in read-only Frihet workspace tools:
|
|
5
|
+
* - get_business_context
|
|
6
|
+
* - list_invoices
|
|
7
|
+
* - list_quotes
|
|
8
|
+
* - list_expenses
|
|
9
|
+
* - list_clients
|
|
10
|
+
* - list_client_activities
|
|
11
|
+
*
|
|
12
|
+
* Enforces:
|
|
13
|
+
* 1. Explicit temporal scope (`unfiltered_operational_sample_as_of_date` vs `currentMonthActivity`)
|
|
14
|
+
* and per-resource coverage (inspected vs total records).
|
|
15
|
+
* 2. Strict separation between draft documents (non-issued) and real/issued activity.
|
|
16
|
+
* 3. Explicit amount provenance (`stored_field`, `derived_from_items`, `business_context_summary`,
|
|
17
|
+
* `unavailable`, or `mixed_currency_unconverted`).
|
|
18
|
+
* - Absent/corrupt amounts NEVER coerce to 0 (`amount: null`, `provenance: "unavailable"`).
|
|
19
|
+
* - Multi-currency totals NEVER sum across currencies without conversion (`totalsByCurrency`, `currency: "MIXED"`).
|
|
20
|
+
* - Derived line-item totals apply canonical per-line `discount`, document `discountRate`,
|
|
21
|
+
* `taxRate`, `equivalenceSurchargeRate`, and `irpfRate` over the discounted tax-exclusive base.
|
|
22
|
+
* 4. Honest unpaid invoice semantics: full nominal totals of unpaid invoices are labeled
|
|
23
|
+
* "importe nominal de facturas no marcadas como pagadas; saldo pendiente real no determinable
|
|
24
|
+
* sin desglose de cobros parciales ni conciliación bancaria" (`realOutstandingBalanceDeterminable: false`).
|
|
25
|
+
* 5. Record-backed prioritized review items and suggested next actions without auto-executing writes.
|
|
26
|
+
* 6. Explicit declaration of what cannot be determined ("knownUnknowns").
|
|
27
|
+
*/
|
|
28
|
+
import type { IFrihetClient } from "../client-interface.js";
|
|
29
|
+
export type AmountProvenanceKind = "stored_field" | "derived_from_items" | "business_context_summary" | "unavailable" | "mixed_currency_unconverted";
|
|
30
|
+
export interface CurrencyBucketAmount {
|
|
31
|
+
amount: number;
|
|
32
|
+
currency: string;
|
|
33
|
+
provenance: "stored_field" | "derived_from_items";
|
|
34
|
+
documentCount: number;
|
|
35
|
+
}
|
|
36
|
+
export interface ProvenancedAmount {
|
|
37
|
+
amount: number | null;
|
|
38
|
+
currency: string;
|
|
39
|
+
provenance: AmountProvenanceKind;
|
|
40
|
+
fieldOrFormula: string;
|
|
41
|
+
totalsByCurrency?: Record<string, CurrencyBucketAmount>;
|
|
42
|
+
unavailableCount?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface ResourceCoverage {
|
|
45
|
+
collection: "invoices" | "quotes" | "expenses" | "clients" | "client_activities";
|
|
46
|
+
sourceTool: string;
|
|
47
|
+
inspected: number;
|
|
48
|
+
total: number;
|
|
49
|
+
complete: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface BriefCoverageSummary {
|
|
52
|
+
asOfDate: string;
|
|
53
|
+
periodMonth: string;
|
|
54
|
+
referenceMonth: string;
|
|
55
|
+
temporalScope: "unfiltered_operational_sample_as_of_date";
|
|
56
|
+
temporalScopeNote: string;
|
|
57
|
+
isPartial: boolean;
|
|
58
|
+
resources: Record<"invoices" | "quotes" | "expenses" | "clients" | "client_activities", ResourceCoverage>;
|
|
59
|
+
}
|
|
60
|
+
export interface BriefDocumentSummary {
|
|
61
|
+
id: string;
|
|
62
|
+
documentNumber: string | null;
|
|
63
|
+
status: string;
|
|
64
|
+
counterpartyName: string;
|
|
65
|
+
issueDate: string | null;
|
|
66
|
+
dueDate: string | null;
|
|
67
|
+
amount: ProvenancedAmount;
|
|
68
|
+
}
|
|
69
|
+
export interface BriefPriorityItem {
|
|
70
|
+
priority: "high" | "medium" | "low";
|
|
71
|
+
category: "overdue_invoice" | "draft_invoice" | "draft_or_expiring_quote" | "expense_review" | "client_followup" | "plan_quota";
|
|
72
|
+
title: string;
|
|
73
|
+
why: string;
|
|
74
|
+
recordRefs: Array<{
|
|
75
|
+
type: "invoice" | "quote" | "expense" | "client" | "client_activity" | "plan_quota";
|
|
76
|
+
id: string;
|
|
77
|
+
label: string;
|
|
78
|
+
}>;
|
|
79
|
+
amount?: ProvenancedAmount;
|
|
80
|
+
suggestedNextAction: {
|
|
81
|
+
description: string;
|
|
82
|
+
recommendedTool: string;
|
|
83
|
+
requiresConfirmation: boolean;
|
|
84
|
+
autoExecuted: false;
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface DailyOperationalBrief {
|
|
88
|
+
question: string;
|
|
89
|
+
coverage: BriefCoverageSummary;
|
|
90
|
+
activitySeparation: {
|
|
91
|
+
draftActivity: {
|
|
92
|
+
note: string;
|
|
93
|
+
invoiceDraftsCount: number;
|
|
94
|
+
invoiceDraftsTotal: ProvenancedAmount;
|
|
95
|
+
invoiceDrafts: BriefDocumentSummary[];
|
|
96
|
+
quoteDraftsCount: number;
|
|
97
|
+
quoteDraftsTotal: ProvenancedAmount;
|
|
98
|
+
quoteDrafts: BriefDocumentSummary[];
|
|
99
|
+
};
|
|
100
|
+
issuedActivity: {
|
|
101
|
+
note: string;
|
|
102
|
+
realOutstandingBalanceDeterminable: false;
|
|
103
|
+
unpaidNominalSemantics: "nominal_unpaid_invoice_totals_without_partial_payments";
|
|
104
|
+
issuedInvoicesCount: number;
|
|
105
|
+
issuedInvoicesByStatus: Record<string, number>;
|
|
106
|
+
issuedInvoicesTotal: ProvenancedAmount;
|
|
107
|
+
issuedInvoices: BriefDocumentSummary[];
|
|
108
|
+
paidInvoicesCount: number;
|
|
109
|
+
paidInvoicesTotal: ProvenancedAmount;
|
|
110
|
+
paidInvoices: BriefDocumentSummary[];
|
|
111
|
+
unpaidNominalInvoicesCount: number;
|
|
112
|
+
unpaidNominalTotal: ProvenancedAmount;
|
|
113
|
+
unpaidNominalTotalsByCurrency: Record<string, CurrencyBucketAmount>;
|
|
114
|
+
overdueNominalInvoicesCount: number;
|
|
115
|
+
overdueNominalTotal: ProvenancedAmount;
|
|
116
|
+
onTimeNominalPendingCount: number;
|
|
117
|
+
onTimeNominalPendingTotal: ProvenancedAmount;
|
|
118
|
+
outstandingInvoicesCount: number;
|
|
119
|
+
outstandingInvoicesTotal: ProvenancedAmount;
|
|
120
|
+
overdueInvoicesCount: number;
|
|
121
|
+
overdueInvoicesTotal: ProvenancedAmount;
|
|
122
|
+
onTimePendingCount: number;
|
|
123
|
+
onTimePendingTotal: ProvenancedAmount;
|
|
124
|
+
outstandingInvoices: BriefDocumentSummary[];
|
|
125
|
+
};
|
|
126
|
+
recordedExpenses: {
|
|
127
|
+
note: string;
|
|
128
|
+
expensesCount: number;
|
|
129
|
+
expensesTotal: ProvenancedAmount;
|
|
130
|
+
deductibleCount: number;
|
|
131
|
+
deductibleTotal: ProvenancedAmount;
|
|
132
|
+
nonDeductibleCount: number;
|
|
133
|
+
nonDeductibleTotal: ProvenancedAmount;
|
|
134
|
+
pendingReviewCount: number;
|
|
135
|
+
};
|
|
136
|
+
currentMonthActivity: {
|
|
137
|
+
referenceMonth: string;
|
|
138
|
+
note: string;
|
|
139
|
+
issuedInvoicesInMonthCount: number;
|
|
140
|
+
issuedInvoicesInMonthTotal: ProvenancedAmount;
|
|
141
|
+
invoiceDraftsInMonthCount: number;
|
|
142
|
+
invoiceDraftsInMonthTotal: ProvenancedAmount;
|
|
143
|
+
expensesInMonthCount: number;
|
|
144
|
+
expensesInMonthTotal: ProvenancedAmount;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
priorities: BriefPriorityItem[];
|
|
148
|
+
knownUnknowns: string[];
|
|
149
|
+
mutationsExecuted: 0;
|
|
150
|
+
markdown: string;
|
|
151
|
+
}
|
|
152
|
+
export interface GenerateDailyBriefOptions {
|
|
153
|
+
asOfDate?: string;
|
|
154
|
+
pageLimit?: number;
|
|
155
|
+
maxActivityClients?: number;
|
|
156
|
+
}
|
|
157
|
+
export declare function formatProvenancedAmount(p: ProvenancedAmount): string;
|
|
158
|
+
export declare function resolveDocumentAmount(doc: Record<string, unknown>, defaultCurrency?: string): ProvenancedAmount;
|
|
159
|
+
export declare function sumProvenancedAmounts(amounts: ProvenancedAmount[], defaultCurrency?: string): ProvenancedAmount;
|
|
160
|
+
export declare function generateDailyOperationalBrief(client: Pick<IFrihetClient, "getBusinessContext" | "listInvoices" | "listQuotes" | "listExpenses" | "listClients" | "listClientActivities">, options?: GenerateDailyBriefOptions): Promise<DailyOperationalBrief>;
|
|
161
|
+
export declare function buildScenario1CompleteWorkspaceClient(callLog: string[]): Pick<IFrihetClient, "getBusinessContext" | "listInvoices" | "listQuotes" | "listExpenses" | "listClients" | "listClientActivities">;
|
|
162
|
+
export declare function buildScenario2PartialCoverageClient(callLog: string[]): Pick<IFrihetClient, "getBusinessContext" | "listInvoices" | "listQuotes" | "listExpenses" | "listClients" | "listClientActivities">;
|
|
163
|
+
//# sourceMappingURL=daily-operational-brief.d.ts.map
|