@voyant-travel/finance 0.138.9 → 0.139.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.
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Finance agent tools on the framework tool contract. Thin, read-only wrappers
3
+ * over the existing finance service; the service is injected on the tool context
4
+ * by intersection so this module stays deployment-agnostic.
5
+ */
6
+ import { type ToolContext } from "@voyant-travel/tools";
7
+ import { z } from "zod";
8
+ import { invoiceListQuerySchema } from "./validation.js";
9
+ export interface FinanceToolServices {
10
+ listInvoices(query: z.infer<typeof invoiceListQuerySchema>): Promise<unknown>;
11
+ getInvoiceById(id: string): Promise<unknown>;
12
+ voidInvoice(id: string, input: {
13
+ reason?: string;
14
+ }): Promise<unknown>;
15
+ }
16
+ export type FinanceToolContext = ToolContext & {
17
+ finance?: FinanceToolServices;
18
+ };
19
+ export declare const listInvoicesTool: import("@voyant-travel/tools").ToolDefinition<{
20
+ sortBy: "status" | "createdAt" | "invoiceNumber" | "totalCents" | "paidCents" | "balanceDueCents" | "issueDate" | "dueDate";
21
+ sortDir: "asc" | "desc";
22
+ limit: number;
23
+ offset: number;
24
+ status?: "draft" | "pending_external_allocation" | "issued" | "partially_paid" | "paid" | "overdue" | "void" | undefined;
25
+ bookingId?: string | undefined;
26
+ personId?: string | undefined;
27
+ organizationId?: string | undefined;
28
+ currency?: string | undefined;
29
+ dueDateFrom?: string | undefined;
30
+ dueDateTo?: string | undefined;
31
+ search?: string | undefined;
32
+ }, unknown, FinanceToolContext>;
33
+ export declare const getInvoiceTool: import("@voyant-travel/tools").ToolDefinition<{
34
+ id: string;
35
+ }, unknown, FinanceToolContext>;
36
+ export declare const voidInvoiceTool: import("@voyant-travel/tools").ToolDefinition<{
37
+ id: string;
38
+ reason?: string | undefined;
39
+ }, unknown, FinanceToolContext>;
40
+ export declare const financeTools: readonly [import("@voyant-travel/tools").ToolDefinition<{
41
+ sortBy: "status" | "createdAt" | "invoiceNumber" | "totalCents" | "paidCents" | "balanceDueCents" | "issueDate" | "dueDate";
42
+ sortDir: "asc" | "desc";
43
+ limit: number;
44
+ offset: number;
45
+ status?: "draft" | "pending_external_allocation" | "issued" | "partially_paid" | "paid" | "overdue" | "void" | undefined;
46
+ bookingId?: string | undefined;
47
+ personId?: string | undefined;
48
+ organizationId?: string | undefined;
49
+ currency?: string | undefined;
50
+ dueDateFrom?: string | undefined;
51
+ dueDateTo?: string | undefined;
52
+ search?: string | undefined;
53
+ }, unknown, FinanceToolContext>, import("@voyant-travel/tools").ToolDefinition<{
54
+ id: string;
55
+ }, unknown, FinanceToolContext>, import("@voyant-travel/tools").ToolDefinition<{
56
+ id: string;
57
+ reason?: string | undefined;
58
+ }, unknown, FinanceToolContext>];
59
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAA8C,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAA;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7E,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5C,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACtE;AAED,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAAE,CAAA;AAMhF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;+BAe3B,CAAA;AAIF,eAAO,MAAM,cAAc;;+BAezB,CAAA;AAOF,eAAO,MAAM,eAAe;;;+BAqB1B,CAAA;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;gCAA+D,CAAA"}
package/dist/tools.js ADDED
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Finance agent tools on the framework tool contract. Thin, read-only wrappers
3
+ * over the existing finance service; the service is injected on the tool context
4
+ * by intersection so this module stays deployment-agnostic.
5
+ */
6
+ import { defineTool, READ_ONLY_RISK, requireService } from "@voyant-travel/tools";
7
+ import { z } from "zod";
8
+ import { invoiceListQuerySchema } from "./validation.js";
9
+ function finance(ctx) {
10
+ return requireService(ctx.finance, "finance");
11
+ }
12
+ export const listInvoicesTool = defineTool({
13
+ name: "list_invoices",
14
+ description: "List invoices with filters and pagination. Read-only.",
15
+ inputSchema: invoiceListQuerySchema,
16
+ outputSchema: z.custom(),
17
+ requiredScopes: ["finance:read"],
18
+ tier: "read",
19
+ riskPolicy: READ_ONLY_RISK,
20
+ async handler(query, ctx) {
21
+ return finance(ctx).listInvoices(query);
22
+ },
23
+ });
24
+ const getInvoiceArgs = z.object({ id: z.string().min(1).describe("The invoice id.") });
25
+ export const getInvoiceTool = defineTool({
26
+ name: "get_invoice",
27
+ description: "Read a single invoice by id. Read-only.",
28
+ inputSchema: getInvoiceArgs,
29
+ outputSchema: z.custom(),
30
+ requiredScopes: ["finance:read"],
31
+ tier: "read",
32
+ riskPolicy: READ_ONLY_RISK,
33
+ async handler({ id }, ctx) {
34
+ return finance(ctx).getInvoiceById(id);
35
+ },
36
+ });
37
+ const voidInvoiceArgs = z.object({
38
+ id: z.string().min(1).describe("The invoice id to void."),
39
+ reason: z.string().optional().describe("Optional reason recorded on the void."),
40
+ });
41
+ export const voidInvoiceTool = defineTool({
42
+ name: "void_invoice",
43
+ description: "Void an invoice (irreversible). Returns a not-found status when the invoice does not exist.",
44
+ inputSchema: voidInvoiceArgs,
45
+ outputSchema: z.custom(),
46
+ requiredScopes: ["finance:void"],
47
+ tier: "destructive",
48
+ riskPolicy: {
49
+ destructive: true,
50
+ reversible: false,
51
+ dryRunSupported: false,
52
+ confirmationRequired: true,
53
+ },
54
+ async handler({ id, reason }, ctx) {
55
+ return finance(ctx).voidInvoice(id, { reason });
56
+ },
57
+ });
58
+ export const financeTools = [listInvoicesTool, getInvoiceTool, voidInvoiceTool];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyant-travel/finance",
3
- "version": "0.138.9",
3
+ "version": "0.139.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -93,6 +93,11 @@
93
93
  "types": "./dist/validation-public.d.ts",
94
94
  "import": "./dist/validation-public.js",
95
95
  "default": "./dist/validation-public.js"
96
+ },
97
+ "./tools": {
98
+ "types": "./dist/tools.d.ts",
99
+ "import": "./dist/tools.js",
100
+ "default": "./dist/tools.js"
96
101
  }
97
102
  },
98
103
  "dependencies": {
@@ -100,17 +105,18 @@
100
105
  "@voyant-travel/data-sdk": "^0.7.1",
101
106
  "drizzle-orm": "^0.45.2",
102
107
  "fflate": "^0.8.2",
103
- "hono": "^4.12.25",
108
+ "hono": "^4.12.27",
104
109
  "zod": "^4.4.3",
105
- "@voyant-travel/action-ledger": "^0.105.11",
106
- "@voyant-travel/core": "^0.111.1",
107
- "@voyant-travel/bookings": "^0.138.8",
108
- "@voyant-travel/db": "^0.109.4",
109
- "@voyant-travel/types": "^0.106.1",
110
- "@voyant-travel/storage": "^0.106.0",
111
- "@voyant-travel/utils": "^0.105.5",
110
+ "@voyant-travel/bookings": "^0.139.0",
111
+ "@voyant-travel/core": "^0.112.0",
112
+ "@voyant-travel/action-ledger": "^0.105.12",
113
+ "@voyant-travel/db": "^0.109.5",
114
+ "@voyant-travel/types": "^0.107.0",
112
115
  "@voyant-travel/finance-contracts": "^0.105.9",
113
- "@voyant-travel/hono": "^0.120.1"
116
+ "@voyant-travel/hono": "^0.121.0",
117
+ "@voyant-travel/storage": "^0.106.0",
118
+ "@voyant-travel/utils": "^0.105.6",
119
+ "@voyant-travel/tools": "^0.1.0"
114
120
  },
115
121
  "devDependencies": {
116
122
  "drizzle-kit": "^0.31.10",