@stacksjs/defaults 0.75.541 → 0.75.543
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.
|
@@ -357,7 +357,7 @@ import { complete, completeStream } from '@stacksjs/ai'
|
|
|
357
357
|
const { completion } = await complete({
|
|
358
358
|
before: 'Remember to buy milk, eggs and ', // the last 2000 chars are sent
|
|
359
359
|
after: '', // the first 500 chars are sent
|
|
360
|
-
kind: 'todo', // 'note' | 'prompt' | 'todo' | 'text'
|
|
360
|
+
kind: 'todo', // 'note' | 'prompt' | 'todo' | 'text' | 'code'
|
|
361
361
|
context: 'Groceries', // note title, library description
|
|
362
362
|
maxTokens: 48, // default 48
|
|
363
363
|
signal: controller.signal, // abort: rejects with an AbortError
|
|
@@ -376,6 +376,12 @@ for await (const { completion } of completeStream({ before })) paint(completion)
|
|
|
376
376
|
OpenAI and Ollama it is the driver's configured model. Bedrock Claude needs the
|
|
377
377
|
account's Anthropic use-case form submitted, otherwise list a Nova model in
|
|
378
378
|
`ai.models` (or set `ai.completion.model`) and completions use that.
|
|
379
|
+
- `kind: 'code'` is its own mode, not a wording change. The instruction is for
|
|
380
|
+
code (continue the statement, close only what the code after the cursor does
|
|
381
|
+
not, use no name that is not in the code or the context), the budget is 128
|
|
382
|
+
tokens, and the cleanup keeps what prose cleanup removes: quotes, full stops,
|
|
383
|
+
a leading newline with its indentation, and up to twelve lines. Pass what the
|
|
384
|
+
model cannot see as `context`, such as model and column names.
|
|
379
385
|
- A small LRU keyed on the tail of `before` (plus kind, model and the head of
|
|
380
386
|
`after`) makes retyping free; `completionCache.clear()` empties it.
|
|
381
387
|
- Requests carry `maxRetries: 0` and the abort `signal` reaches the HTTP drivers
|
|
@@ -90,7 +90,7 @@ Browser runtime bindings are documented separately in `stacks-auto-imports`.
|
|
|
90
90
|
| `@stacksjs/storage` | [`stacks-storage`](../stacks-storage/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/storage/src/index.ts) | 50 |
|
|
91
91
|
| `@stacksjs/strings` | [`stacks-strings`](../stacks-strings/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/strings/src/index.ts) | 12 |
|
|
92
92
|
| `@stacksjs/testing` | [`stacks-testing`](../stacks-testing/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/testing/src/index.ts) | 24 |
|
|
93
|
-
| `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) |
|
|
93
|
+
| `@stacksjs/tinker` | [`stacks-repl`](../stacks-repl/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/index.ts) | 3 |
|
|
94
94
|
| `@stacksjs/tunnel` | [`stacks-tunnel`](../stacks-tunnel/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tunnel/src/index.ts) | 1 |
|
|
95
95
|
| `@stacksjs/types` | [`stacks-types`](../stacks-types/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/types/src/index.ts) | 2 |
|
|
96
96
|
| `@stacksjs/ui` | [`stacks-ui`](../stacks-ui/SKILL.md) | [entrypoint](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/ui/src/index.ts) | 6 |
|
|
@@ -882,9 +882,9 @@ Guidance: [`stacks-repl`](../stacks-repl/SKILL.md). Source: [storage/framework/c
|
|
|
882
882
|
|
|
883
883
|
Declared runtime exports: `appendHistory`, `clearHistory`, `getHistoryPath`, `isIncompleteSnippet`, `readHistory`, `renderValue`, `startTinker`, `tinkerEval`, `tinkerPrint`.
|
|
884
884
|
|
|
885
|
-
Local source modules: [src/protocol.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/protocol.ts), [src/serialize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/serialize.ts), [src/session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/session.ts).
|
|
885
|
+
Local source modules: [src/magic.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/magic.ts), [src/protocol.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/protocol.ts), [src/serialize.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/serialize.ts), [src/session.ts](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/src/session.ts).
|
|
886
886
|
|
|
887
|
-
Evidence directory: [
|
|
887
|
+
Evidence directory: [3 retained tests](https://github.com/stacksjs/stacks/blob/main/storage/framework/core/tinker/tests). These files are evidence pointers, not a claim that all tests were run for this catalog.
|
|
888
888
|
|
|
889
889
|
### @stacksjs/tunnel
|
|
890
890
|
|
|
@@ -101,11 +101,51 @@ not a frame. Use `createFrameReader()` to split a stream. `--serve` with
|
|
|
101
101
|
`--eval` or `--print` evaluates once and exits, which suits `ssh -T`,
|
|
102
102
|
`docker exec -i` and `kubectl exec -i`.
|
|
103
103
|
|
|
104
|
+
## Magic comments
|
|
105
|
+
|
|
106
|
+
A comment that starts with a question mark shows a value where it is computed.
|
|
107
|
+
The run's result is unchanged, and no line moves.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
const users = await User.all() //? the value of users
|
|
111
|
+
users.filter(u => u.active)/*?.length*/.map(u => u.name) //?
|
|
112
|
+
await rebuildIndex() //?. ms since the run began
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- `//?` at the end of a line: the statement that ends there. A declaration
|
|
116
|
+
shows the names it binds; anything else shows the expression.
|
|
117
|
+
- A block form written hard against an expression (no space before it) shows
|
|
118
|
+
that expression mid-chain. Text after the question mark is read off the
|
|
119
|
+
value first: `.length`, `.count()`, `[0]`.
|
|
120
|
+
- `//?.` shows elapsed milliseconds.
|
|
121
|
+
|
|
122
|
+
Each one arrives as a `probe` frame carrying its zero-based line.
|
|
123
|
+
`instrumentMagicComments(code)` is the transform, exported for a tool that
|
|
124
|
+
wants to mark which lines have a probe. It works from tokens, not a syntax
|
|
125
|
+
tree: a comment it cannot place with certainty (after an `if` block, a loop, a
|
|
126
|
+
`throw`) stays an ordinary comment. `createTinkerSession({ magic: false })`
|
|
127
|
+
turns the feature off.
|
|
128
|
+
|
|
129
|
+
## Previews and the model list
|
|
130
|
+
|
|
131
|
+
`preview.mail('welcome', { name: 'Ada' })` renders a template from
|
|
132
|
+
`resources/emails` and returns a value the result is shown as a page for
|
|
133
|
+
(`{ t: 'html', kind: 'mail', html, text }`). `preview.html(markup, title)` does
|
|
134
|
+
the same for any markup. Rendering one stx view to a string is not offered
|
|
135
|
+
yet: stx does not export it.
|
|
136
|
+
|
|
137
|
+
`session.models()`, or the request `{ "op": "models" }`, lists every model the
|
|
138
|
+
booted app loaded with its table, attribute names and declared relations. It is
|
|
139
|
+
what a relation graph and a completion list are built from.
|
|
140
|
+
|
|
104
141
|
## Gotchas
|
|
105
142
|
|
|
106
143
|
- **The database is real.** Mutations are not isolated or rolled back.
|
|
107
|
-
- **A
|
|
108
|
-
|
|
144
|
+
- **A model is described as a model.** A result that is a model instance is a
|
|
145
|
+
`model` node: its name, table, key, the attributes its `toJSON()` exposes, the
|
|
146
|
+
relations it declares and the ones already loaded. Hidden attributes (a
|
|
147
|
+
password hash) are named under `hidden` and their values never leave the
|
|
148
|
+
process, in frames and in `--print` alike.
|
|
109
149
|
- **Error positions refer to the compiled snippet**, not the typed source.
|
|
110
150
|
- **One evaluation at a time.** Calls queue; they share globals.
|
|
111
151
|
- **A session captures `console` and `process.stdout`/`stderr`** for its whole
|
|
@@ -12,7 +12,7 @@ import { COMPLETE_RATE_PER_MINUTE, handleCompleteRequest } from './complete-requ
|
|
|
12
12
|
/**
|
|
13
13
|
* `POST /ai/complete`: the ghost text behind an editor's Tab-to-accept.
|
|
14
14
|
*
|
|
15
|
-
* Body `{ before, after?, kind?: 'note' | 'prompt' | 'todo' | 'text', context? }`,
|
|
15
|
+
* Body `{ before, after?, kind?: 'note' | 'prompt' | 'todo' | 'text' | 'code', context? }`,
|
|
16
16
|
* answer `{ completion }`. `''` means "no suggestion", including when the app
|
|
17
17
|
* has no AI driver configured; a provider failure is a 502.
|
|
18
18
|
*
|
|
@@ -17,7 +17,7 @@ export const COMPLETE_MAX_CONTEXT = 2_000
|
|
|
17
17
|
/** Suggestions per user per minute. The client debounces; this is the backstop. */
|
|
18
18
|
export const COMPLETE_RATE_PER_MINUTE = 90
|
|
19
19
|
|
|
20
|
-
const KINDS: readonly CompletionKind[] = ['note', 'prompt', 'todo', 'text']
|
|
20
|
+
const KINDS: readonly CompletionKind[] = ['note', 'prompt', 'todo', 'text', 'code']
|
|
21
21
|
|
|
22
22
|
export interface CompleteRequestBody {
|
|
23
23
|
before?: unknown
|
package/ide/vscode/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"publisher": "Stacks",
|
|
3
3
|
"name": "vscode-stacks",
|
|
4
4
|
"displayName": "Stacks",
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.543",
|
|
6
6
|
"description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/defaults",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.543",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@iconify-json/f7": "^1.2.2",
|
|
47
47
|
"@iconify-json/hugeicons": "^1.2.35",
|
|
48
|
-
"@stacksjs/mobile": "0.75.
|
|
48
|
+
"@stacksjs/mobile": "0.75.543",
|
|
49
49
|
"@stacksjs/sanitizer": "^0.2.842",
|
|
50
50
|
"@stacksjs/stx": "^0.2.842",
|
|
51
|
-
"@stacksjs/strings": "0.75.
|
|
51
|
+
"@stacksjs/strings": "0.75.543",
|
|
52
52
|
"@xterm/addon-fit": "^0.11.0",
|
|
53
53
|
"@xterm/xterm": "^6.0.0",
|
|
54
54
|
"ts-qr-codes": "^0.1.8"
|