@fortrip/agent-contract 2.0.0 → 3.0.0-rc.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.
- package/README.md +18 -13
- package/dist/index.d.ts +2625 -268
- package/dist/index.js +2272 -532
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,34 +1,39 @@
|
|
|
1
1
|
# @fortrip/agent-contract
|
|
2
2
|
|
|
3
|
-
The contract of Fortrip
|
|
4
|
-
|
|
3
|
+
The contract of Fortrip API v1 (`https://api.fortrip.ai/v1`) and its MCP
|
|
4
|
+
server (`https://mcp.fortrip.ai/`): the limits, paths, request and response
|
|
5
|
+
schemas, error codes and field rules that the Fortrip CLI (`fortrip`), the
|
|
5
6
|
hosted MCP server and the store listings all share, so they cannot drift
|
|
6
7
|
apart.
|
|
7
8
|
|
|
8
9
|
It has one peer dependency, `zod` (`^4.4.0`), and runs anywhere
|
|
9
10
|
ES2023 does. Its major version changes when the contract breaks, not with
|
|
10
|
-
the API: `
|
|
11
|
+
the API: `3.x` serves Fortrip API v1.
|
|
11
12
|
|
|
12
13
|
```ts
|
|
13
|
-
import { API, LIMITS, containsCardNumber } from "@fortrip/agent-contract";
|
|
14
|
+
import { API, LIMITS, PUBLIC_ORIGINS, containsCardNumber } from "@fortrip/agent-contract";
|
|
14
15
|
|
|
15
|
-
API.
|
|
16
|
+
PUBLIC_ORIGINS.api + API.hotelSearch; // "https://api.fortrip.ai/v1/hotels/search"
|
|
16
17
|
LIMITS.rooms; // 8
|
|
17
18
|
```
|
|
18
19
|
|
|
19
20
|
It exports:
|
|
20
21
|
|
|
21
|
-
- `API`, `
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`
|
|
22
|
+
- `API`, `PUBLIC_ORIGINS`, `MCP_PATH`, `LIMITS`, `ERROR_CODES`,
|
|
23
|
+
`SEARCH_SORTS` and `FILTERABLE_AMENITIES`: paths, hosts, limits, error codes
|
|
24
|
+
and vocabularies;
|
|
25
|
+
- `searchHotelsInput`, `getHotelInput`, `hotelOffersInput`,
|
|
26
|
+
`createOrderInput`, `getOrderInput` and `listOrdersInput`, the zod schemas
|
|
27
|
+
of the requests, and `searchResult`, `hotel`, `hotelOffersResult`, `order`,
|
|
28
|
+
`orderList` and `errorEnvelope`, the open schemas of the responses, with
|
|
29
|
+
`parseOpen`, a parser that keeps unknown fields and values;
|
|
26
30
|
- `COMMANDS`, `COMMAND_GROUPS` and `GLOBAL_FLAGS`, the CLI's commands, the
|
|
27
31
|
groups they are typed after and its flags, `commandInvocation(spec)`, a
|
|
28
32
|
command as it is typed (`fortrip hotels search`), and `TOOLS`, the MCP
|
|
29
|
-
tools
|
|
30
|
-
- `
|
|
31
|
-
|
|
33
|
+
tools, with `MCP_OUTPUT` and `ORDER_NEXT_STEP`;
|
|
34
|
+
- `renderToolResult(tool, data)` and `renderError(envelope)`, the compact
|
|
35
|
+
text of a result or an error, and `renderGuide(surface, topic)`, the agent
|
|
36
|
+
guide as Markdown for `"mcp"`, `"claude-skill"` or `"cli"`;
|
|
32
37
|
- field rules such as `containsCardNumber`, the guest-name rule and the date
|
|
33
38
|
helpers, and `CONTRACT_VERSION`.
|
|
34
39
|
|