acrylblends 0.4.0 → 0.4.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/dist/index.js +56 -2
- package/dist/index.js.map +1 -1
- package/docs/framework/LICENSE +23 -0
- package/docs/framework/README.md +63 -0
- package/docs/framework/UPSTREAM.md +3 -0
- package/docs/framework/api-summary.md +138 -0
- package/docs/framework/concepts.md +105 -0
- package/docs/framework/context.md +129 -0
- package/docs/framework/getting-started.md +146 -0
- package/docs/framework/helpers.md +118 -0
- package/docs/framework/middleware.md +154 -0
- package/docs/framework/migration-from-0-3.md +108 -0
- package/docs/framework/migration-from-dsh-webserver.md +103 -0
- package/docs/framework/node-server.md +75 -0
- package/docs/framework/plugin-lifecycle.md +111 -0
- package/docs/framework/request.md +106 -0
- package/docs/framework/routing.md +188 -0
- package/docs/framework/surfaces.md +71 -0
- package/docs/framework/upstream.json +9 -0
- package/docs/framework/validation.md +135 -0
- package/package.json +4 -2
- package/plugins/acryl-inspect/src/report.ts +15 -10
- package/plugins/acryl-inspect/tests/report.spec.ts +9 -3
- package/plugins/acryl-inspect/upstream.json +2 -2
- package/plugins/acryl-node-server/upstream.json +1 -1
- package/plugins/acryl-router/src/middleware/index.ts +1 -1
- package/plugins/acryl-router/src/middleware/loopback-only.ts +34 -1
- package/plugins/acryl-router/src/service.ts +9 -3
- package/plugins/acryl-router/tests/loopback-only.spec.ts +80 -0
- package/plugins/acryl-router/tests/service.spec.ts +17 -0
- package/plugins/acryl-router/upstream.json +2 -2
- package/plugins/acryl-router-http/upstream.json +1 -1
- package/plugins/acryl-state/upstream.json +1 -1
- package/plugins/builder/script.ts +1 -1
- package/plugins/extensions/index.ts +4 -3
- package/plugins/openai/prompt.ts +2 -2
- package/shared/AGENTS.core.md +54 -0
- package/templates/agent/AGENTS.md +6 -0
- package/templates/agent/README.md +2 -2
- package/templates/agent/blend.yaml +1 -1
- package/templates/blank/AGENTS.md +5 -0
- package/templates/blank/README.md +1 -1
- package/templates/todo/AGENTS.md +5 -0
- package/templates/todo/src/todo.ts +4 -2
- package/templates/todo/upstream.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The app as data, in ACRYL's Blend format (blends.acryl.dev/v1alpha1): which plugins it mounts, in what order, with what config.
|
|
2
2
|
# Edit this, not app.ts, to switch a plugin off (disabled: true) or change its config. `npm run lock` records what the app is built from.
|
|
3
|
-
# Order matters:
|
|
3
|
+
# Order matters: acryl-router comes before extensions, because installed extensions start again at boot and may add routes.
|
|
4
4
|
apiVersion: blends.acryl.dev/v1alpha1
|
|
5
5
|
kind: Blueprint
|
|
6
6
|
metadata:
|
|
@@ -15,7 +15,7 @@ npm run check # type-check
|
|
|
15
15
|
one off with `disabled: true`. `npm run lock` writes `blend.lock.json`: the manifest's digest and a digest of
|
|
16
16
|
every plugin folder, so a diff of the lock shows what changed.
|
|
17
17
|
- `src/app.ts` holds the registry of plugins the code provides, and mounts the manifest's rows.
|
|
18
|
-
- `src/routes.ts` is your own plugin:
|
|
18
|
+
- `src/routes.ts` is your own plugin: it builds an `App` (`import { App } from './plugins/acryl-router/src/index.ts'`) and mounts it with `ctx.router.route(prefix, app)`. Routes added to the app after it is mounted are not served. A page mounted at `/x` answers `/x`, not `/x/` (trailing slashes are strict). The router API is documented at https://acrylblends.github.io/docs/framework/the-acryl-framework and in `docs/framework` of the acrylblends repository.
|
|
19
19
|
- `src/plugins/` holds the plugins copied from the ACRYLBLENDS library. They are yours now; edit them freely.
|
|
20
20
|
Add more with `acrylblends add <plugin>`.
|
|
21
21
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
## This app (todo)
|
|
3
|
+
|
|
4
|
+
`src/todo.ts` is the whole feature: a plugin that mounts an `App` (CRUD, a page, a server-sent stream) and keeps the list in a state cell that it
|
|
5
|
+
also writes to a file in the app's home. Use it as the reference for a new plugin, and keep its tests passing when you change it.
|
|
@@ -7,7 +7,7 @@ import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs'
|
|
|
7
7
|
import { dirname } from 'node:path'
|
|
8
8
|
import type { Context } from '@deepseek-ai/cordis'
|
|
9
9
|
import { App, HTTPException } from './plugins/acryl-router/src/index.ts'
|
|
10
|
-
import { bodyLimit, loopbackOnly } from './plugins/acryl-router/src/middleware/index.ts'
|
|
10
|
+
import { bodyLimit, loopbackOnly, trimTrailingSlash } from './plugins/acryl-router/src/middleware/index.ts'
|
|
11
11
|
import { schemaValidator, streamSSE, type StandardSchema } from './plugins/acryl-router/src/helpers/index.ts'
|
|
12
12
|
import type {} from './plugins/acryl-state/src/index.ts'
|
|
13
13
|
import { PAGE } from './page.ts'
|
|
@@ -84,8 +84,10 @@ export function apply(ctx: Context, config: Config = {}): void {
|
|
|
84
84
|
return todo
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
// `/todo/` is what people type: trimTrailingSlash answers a GET for an unknown path ending in `/` with a 301 to the path without it,
|
|
88
|
+
// so the page is found either way while each route keeps one canonical path (the router itself treats `/a` and `/a/` as different).
|
|
87
89
|
const api = new App()
|
|
88
|
-
.use(loopbackOnly({ inProcess: 'allow' }), bodyLimit({ maxSize: MAX_BODY_BYTES }))
|
|
90
|
+
.use(loopbackOnly({ inProcess: 'allow' }), bodyLimit({ maxSize: MAX_BODY_BYTES }), trimTrailingSlash())
|
|
89
91
|
.get('/', c => c.html(PAGE))
|
|
90
92
|
.get('/api', c => c.json(todos.get()))
|
|
91
93
|
.post('/api', schemaValidator('json', NewTodo), c => {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"examples/acryl-todo/src/index.ts": "src/todo.ts",
|
|
6
6
|
"examples/acryl-todo/src/page.ts": "src/page.ts"
|
|
7
7
|
},
|
|
8
|
-
"commit": "
|
|
8
|
+
"commit": "64e7c9d2e787f74b2da82492644fbbb46a601074"
|
|
9
9
|
},
|
|
10
10
|
"rewrittenSpecifiers": 4,
|
|
11
|
-
"digest": "sha256:
|
|
11
|
+
"digest": "sha256:b62b5167344084f7ac03c8286923f92419a4ab41c5d8235adb3247d983807aca"
|
|
12
12
|
}
|