mirror of
https://github.com/runebookai/tome.git
synced 2025-07-21 00:27:30 +03:00
- Goes back to a max line length of 100
- Makes whitespace insignificant in Svelte files (see below)
- Avoids parens around single argument closures, in TS, when unncessary
*Whitespace Significance*
In HTML, `<p><b> 1 </b></p>` and `<p><b>1</b></p>` are not the same
thing. In the former, the "1" has spaces around it. If you were to try
to split this into multiple lines...
```html
<p>
<b>
1
</b>
</p>
```
...you would lose that whitespace. The newlines reset any significance
around individual tokens. This meant prettier would format that code
as...
```html
<p>
<b
> 1 </b>
</p>
```
...which is insane and hideous.
We're saying all whitespace is insignificant from now on. Meaning
prettier no longer needs to retain it and can format that code as a sane
person.
This means you need to explicitly use ` ` characters if you
explicitly need whitespace around things. OR put it in a `span` and use
css.
TL;DR: do not rely on whitespace significance in HTML.
28 lines
884 B
TypeScript
28 lines
884 B
TypeScript
import { invoke } from '@tauri-apps/api/core';
|
|
|
|
import type { Tool } from '$lib/engines/types';
|
|
import type { McpTool } from '$lib/mcp.d';
|
|
import type { ISession } from '$lib/models/session';
|
|
|
|
export * from '$lib/mcp.d';
|
|
|
|
// Retrieve, and transform, tools from the MCP server, into `tools` object we
|
|
// can send to the LLM.
|
|
//
|
|
export async function getMCPTools(session: ISession): Promise<Tool[]> {
|
|
return (await invoke<McpTool[]>('get_mcp_tools', { sessionId: session.id })).map(tool => {
|
|
return {
|
|
type: 'function',
|
|
function: {
|
|
name: tool.name,
|
|
description: tool.description,
|
|
parameters: {
|
|
type: 'object',
|
|
required: tool.inputSchema.required,
|
|
properties: tool.inputSchema.properties,
|
|
},
|
|
},
|
|
};
|
|
});
|
|
}
|