- Have `countTokens` only take a string for now, since that's all that
tool elements in tsx should currently omit (not chat messages with
roles.) String counting is a much easier interface to satisfy.
- Joyce pointed out that it's "invocation" not "invokation", for reasons
unfathomable to me. I will open an issue with the English language.
* lm: a second rendition of returning data from LM tools
This is an alternative to #225454. It allows the tool caller to pass
through token budget and counting information to the tool, and the
tool can then 'do its thing.'
Most of the actual implementation is in prompt-tsx with a new method to
render elements into a JSON-serializable form, and then splice them back
into the tree by the consumer. The implementation can be found here:
https://github.com/microsoft/vscode-prompt-tsx/tree/connor4312/tools-api-v2
On the tool side, this looks like:
```ts
vscode.lm.registerTool('myTestTool', {
async invoke(context, token): Promise<vscode.LanguageModelToolResult> {
return {
// context includes the token info:
'mytype': await renderElementJSON(MyCustomPrompt, {}, context, token),
toString() {
return 'hello world!'
}
};
},
});
```
I didn't make any nice wrappers yet, but the MVP consumer side looks like:
```
export class TestPrompt extends PromptElement {
async render(_state: void, sizing: PromptSizing) {
const result = await vscode.lm.invokeTool('myTestTool', {
parameters: {},
tokenBudget: sizing.tokenBudget,
countTokens: (v, token) => tokenizer.countTokens(v, token),
}, new vscode.CancellationTokenSource().token);
return (
<>
<elementJSON data={result.mytype} />
</>
);
}
}
```
I like this approach better. It avoids bleeding knowledge of TSX into
the extension host and comparatively simple.
* address comments
* address comments
* Added the new view
* Add support for getting N number of commits
* Added view title actions
* More work to enable view/repository actions
* Expand the view by default, and always show the last N commits
* Add context menu actions
* Improve actions
* Basic infinite scrolling implemented
* Better implementation using --skip instead of a cursor
* Do not refresh graph when pressing Refresh
* Refactor load more/caching
* Rename the view
* Add support for the find widget