@acryldev/plugin-context 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/docs/README.md +160 -0
- package/docs/delivery/local-live.md +113 -0
- package/docs/delivery/marketplace.md +16 -0
- package/docs/docs.json +2836 -0
- package/docs/extending/agent-preset.md +37 -0
- package/docs/extending/chat-command.md +28 -0
- package/docs/extending/client-slot.md +135 -0
- package/docs/extending/config-schema.md +7 -0
- package/docs/extending/cordis-core.md +63 -0
- package/docs/extending/desktop-app.md +53 -0
- package/docs/extending/desktop-main.md +25 -0
- package/docs/extending/event-hook.md +14 -0
- package/docs/extending/host-route.md +33 -0
- package/docs/extending/llm-adapter.md +38 -0
- package/docs/extending/packaging.md +53 -0
- package/docs/extending/prompt-contribution.md +9 -0
- package/docs/extending/service.md +13 -0
- package/docs/extending/skill-provider.md +9 -0
- package/docs/extending/state-and-persistence.md +71 -0
- package/docs/extending/three-role-capability.md +33 -0
- package/docs/extending/tool-plugin.md +24 -0
- package/docs/extending/tui-command.md +8 -0
- package/docs/extending/tui-components.md +61 -0
- package/docs/extending/ui-branding.md +43 -0
- package/docs/extending/ui-components.md +56 -0
- package/docs/extending/ui-customization.md +41 -0
- package/docs/extending/ui-library.md +66 -0
- package/docs/extending/ui-theme.md +55 -0
- package/docs/extending/workspace-tab.md +50 -0
- package/docs/maps/events.md +108 -0
- package/docs/maps/mount-points.md +154 -0
- package/docs/maps/slot-contracts.md +3376 -0
- package/docs/maps/taxonomy.md +306 -0
- package/docs/maps/theme-tokens.md +115 -0
- package/docs/maps/ui-components.md +26 -0
- package/docs/reference/cookbook/adding-a-package.md +174 -0
- package/docs/reference/cookbook/adding-a-remote-api.md +199 -0
- package/docs/reference/cookbook/adding-a-settings-card.md +74 -0
- package/docs/reference/cookbook/adding-a-tool.md +103 -0
- package/docs/reference/cookbook/adding-an-llm-adapter.md +45 -0
- package/docs/reference/cookbook/extension-cookbook.md +134 -0
- package/docs/reference/cordis-api/context.md +366 -0
- package/docs/reference/cordis-api/events.md +209 -0
- package/docs/reference/cordis-api/fiber.md +377 -0
- package/docs/reference/cordis-api/inherited.md +40 -0
- package/docs/reference/cordis-api/registry.md +154 -0
- package/docs/reference/cordis-api/service.md +104 -0
- package/docs/reference/cordis-guides/cordis-usage-cheatsheet.md +167 -0
- package/docs/reference/cordis-guides/cordis_system_guide_for_coding_agents.md +4666 -0
- package/docs/reference/cordis-guides/development-canvas-plugin.md +109 -0
- package/docs/reference/cordis-guides/hello-world-plugin-guide.md +517 -0
- package/docs/reference/harness/agent-lifecycle.md +93 -0
- package/docs/reference/harness/architecture.md +168 -0
- package/docs/reference/harness/capability-seams.md +675 -0
- package/docs/reference/harness/config-catalog.md +4523 -0
- package/docs/reference/harness/cordis-primer.md +47 -0
- package/docs/reference/harness/defensive-patterns.md +35 -0
- package/docs/reference/harness/event-producer-consumer.md +111 -0
- package/docs/reference/harness/glossary.md +47 -0
- package/docs/reference/harness/tool-catalog.md +2721 -0
- package/docs/reference/harness/tool-execution-pipeline.md +67 -0
- package/docs/reference/subsystems/README.md +75 -0
- package/docs/reference/subsystems/agent-team.md +233 -0
- package/docs/reference/subsystems/approval.md +172 -0
- package/docs/reference/subsystems/attachment.md +363 -0
- package/docs/reference/subsystems/boot.md +324 -0
- package/docs/reference/subsystems/browser-use.md +69 -0
- package/docs/reference/subsystems/client-modules.md +186 -0
- package/docs/reference/subsystems/client-resources.md +94 -0
- package/docs/reference/subsystems/commands.md +225 -0
- package/docs/reference/subsystems/compaction.md +286 -0
- package/docs/reference/subsystems/computer-use.md +58 -0
- package/docs/reference/subsystems/conversation.md +287 -0
- package/docs/reference/subsystems/core.md +1107 -0
- package/docs/reference/subsystems/credentials.md +497 -0
- package/docs/reference/subsystems/deliverables.md +180 -0
- package/docs/reference/subsystems/extensions.md +386 -0
- package/docs/reference/subsystems/feedback.md +402 -0
- package/docs/reference/subsystems/filesystem.md +532 -0
- package/docs/reference/subsystems/goal.md +315 -0
- package/docs/reference/subsystems/invariants.md +90 -0
- package/docs/reference/subsystems/jobs.md +501 -0
- package/docs/reference/subsystems/llm-streaming.md +1131 -0
- package/docs/reference/subsystems/lsp.md +204 -0
- package/docs/reference/subsystems/mcp.md +141 -0
- package/docs/reference/subsystems/office-to-pdf.md +89 -0
- package/docs/reference/subsystems/otel.md +46 -0
- package/docs/reference/subsystems/permission-presets.md +169 -0
- package/docs/reference/subsystems/persistence.md +418 -0
- package/docs/reference/subsystems/plan.md +89 -0
- package/docs/reference/subsystems/product-telemetry.md +81 -0
- package/docs/reference/subsystems/ptc-runtime.md +234 -0
- package/docs/reference/subsystems/sandbox.md +223 -0
- package/docs/reference/subsystems/schedule.md +545 -0
- package/docs/reference/subsystems/scope.md +61 -0
- package/docs/reference/subsystems/session-projection.md +358 -0
- package/docs/reference/subsystems/session-query.md +511 -0
- package/docs/reference/subsystems/session-reference.md +226 -0
- package/docs/reference/subsystems/session-telemetry.md +214 -0
- package/docs/reference/subsystems/session-title.md +206 -0
- package/docs/reference/subsystems/session.md +1300 -0
- package/docs/reference/subsystems/settings.md +157 -0
- package/docs/reference/subsystems/shell.md +316 -0
- package/docs/reference/subsystems/sidebar-right.md +160 -0
- package/docs/reference/subsystems/skills.md +354 -0
- package/docs/reference/subsystems/slots.md +201 -0
- package/docs/reference/subsystems/spill.md +126 -0
- package/docs/reference/subsystems/ssh.md +137 -0
- package/docs/reference/subsystems/storage.md +262 -0
- package/docs/reference/subsystems/subagent.md +762 -0
- package/docs/reference/subsystems/subprocess.md +323 -0
- package/docs/reference/subsystems/system-prompt.md +226 -0
- package/docs/reference/subsystems/terminal.md +186 -0
- package/docs/reference/subsystems/todo.md +34 -0
- package/docs/reference/subsystems/token-meter.md +108 -0
- package/docs/reference/subsystems/tools.md +749 -0
- package/docs/reference/subsystems/typert.md +489 -0
- package/docs/reference/subsystems/user-questions.md +309 -0
- package/docs/reference/subsystems/voice-input.md +166 -0
- package/docs/reference/subsystems/web-client.md +102 -0
- package/docs/reference/subsystems/web-server.md +228 -0
- package/docs/reference/subsystems/web.md +208 -0
- package/docs/reference/subsystems/webhook.md +72 -0
- package/docs/reference/subsystems/workflow.md +280 -0
- package/docs/reference/subsystems/workspace.md +661 -0
- package/docs/start-here/blueprints.md +33 -0
- package/docs/start-here/this-runtime.md +84 -0
- package/docs/start-here/troubleshooting.md +29 -0
- package/docs/start-here/trust-and-safety.md +39 -0
- package/docs/start-here/verify-before-done.md +46 -0
- package/example-plugins/README.md +45 -0
- package/example-plugins/packages/agent-preset-reviewer/agent.cordis.yml +18 -0
- package/example-plugins/packages/agent-preset-reviewer/preset.yml +3 -0
- package/example-plugins/packages/capability-swap-consumer/cordis.patch.yml +3 -0
- package/example-plugins/packages/capability-swap-consumer/index.js +14 -0
- package/example-plugins/packages/capability-swap-consumer/package.json +25 -0
- package/example-plugins/packages/capability-swap-provider-loud/cordis.patch.yml +3 -0
- package/example-plugins/packages/capability-swap-provider-loud/index.js +20 -0
- package/example-plugins/packages/capability-swap-provider-loud/package.json +25 -0
- package/example-plugins/packages/capability-swap-provider-quiet/cordis.patch.yml +3 -0
- package/example-plugins/packages/capability-swap-provider-quiet/index.js +20 -0
- package/example-plugins/packages/capability-swap-provider-quiet/package.json +25 -0
- package/example-plugins/packages/chat-command-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/chat-command-basic/index.js +26 -0
- package/example-plugins/packages/chat-command-basic/package.json +25 -0
- package/example-plugins/packages/client-chat-message-action/client.js +46 -0
- package/example-plugins/packages/client-chat-message-action/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-chat-message-action/index.js +9 -0
- package/example-plugins/packages/client-chat-message-action/package.json +31 -0
- package/example-plugins/packages/client-slot-header-action/client.js +57 -0
- package/example-plugins/packages/client-slot-header-action/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-slot-header-action/index.js +13 -0
- package/example-plugins/packages/client-slot-header-action/package.json +31 -0
- package/example-plugins/packages/client-slot-sidebar-tab/client.js +57 -0
- package/example-plugins/packages/client-slot-sidebar-tab/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-slot-sidebar-tab/index.js +9 -0
- package/example-plugins/packages/client-slot-sidebar-tab/package.json +32 -0
- package/example-plugins/packages/client-theme-override/client.js +52 -0
- package/example-plugins/packages/client-theme-override/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-theme-override/index.js +9 -0
- package/example-plugins/packages/client-theme-override/package.json +30 -0
- package/example-plugins/packages/client-tool-view/client.js +47 -0
- package/example-plugins/packages/client-tool-view/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-tool-view/index.js +24 -0
- package/example-plugins/packages/client-tool-view/package.json +34 -0
- package/example-plugins/packages/client-ui-components/client.js +77 -0
- package/example-plugins/packages/client-ui-components/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-ui-components/index.js +9 -0
- package/example-plugins/packages/client-ui-components/package.json +31 -0
- package/example-plugins/packages/client-ui-library/client.js +715 -0
- package/example-plugins/packages/client-ui-library/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-ui-library/index.js +9 -0
- package/example-plugins/packages/client-ui-library/package.json +37 -0
- package/example-plugins/packages/client-workspace-tab/client.js +72 -0
- package/example-plugins/packages/client-workspace-tab/cordis.patch.yml +3 -0
- package/example-plugins/packages/client-workspace-tab/index.js +9 -0
- package/example-plugins/packages/client-workspace-tab/package.json +30 -0
- package/example-plugins/packages/config-schema-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/config-schema-basic/index.js +19 -0
- package/example-plugins/packages/config-schema-basic/package.json +25 -0
- package/example-plugins/packages/desktop-main-profile-info/cordis.patch.yml +3 -0
- package/example-plugins/packages/desktop-main-profile-info/index.js +22 -0
- package/example-plugins/packages/desktop-main-profile-info/package.json +25 -0
- package/example-plugins/packages/event-hook-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/event-hook-basic/index.js +17 -0
- package/example-plugins/packages/event-hook-basic/package.json +22 -0
- package/example-plugins/packages/generated-capability-template/cordis.patch.yml +3 -0
- package/example-plugins/packages/generated-capability-template/index.js +16 -0
- package/example-plugins/packages/generated-capability-template/package.json +42 -0
- package/example-plugins/packages/host-route-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/host-route-basic/index.js +20 -0
- package/example-plugins/packages/host-route-basic/package.json +29 -0
- package/example-plugins/packages/lifecycle-function-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/lifecycle-function-basic/index.js +12 -0
- package/example-plugins/packages/lifecycle-function-basic/package.json +15 -0
- package/example-plugins/packages/lifecycle-function-hot-shim/cordis.patch.yml +3 -0
- package/example-plugins/packages/lifecycle-function-hot-shim/impl.js +5 -0
- package/example-plugins/packages/lifecycle-function-hot-shim/index.js +18 -0
- package/example-plugins/packages/lifecycle-function-hot-shim/package.json +23 -0
- package/example-plugins/packages/lifecycle-hooks-observer/cordis.patch.yml +3 -0
- package/example-plugins/packages/lifecycle-hooks-observer/index.js +23 -0
- package/example-plugins/packages/lifecycle-hooks-observer/package.json +22 -0
- package/example-plugins/packages/llm-adapter-echo/cordis.patch.yml +3 -0
- package/example-plugins/packages/llm-adapter-echo/index.js +42 -0
- package/example-plugins/packages/llm-adapter-echo/package.json +25 -0
- package/example-plugins/packages/prompt-assemble-hook/cordis.patch.yml +3 -0
- package/example-plugins/packages/prompt-assemble-hook/index.js +22 -0
- package/example-plugins/packages/prompt-assemble-hook/package.json +22 -0
- package/example-plugins/packages/prompt-contribution-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/prompt-contribution-basic/index.js +18 -0
- package/example-plugins/packages/prompt-contribution-basic/package.json +22 -0
- package/example-plugins/packages/service-consumer-greeter/cordis.patch.yml +3 -0
- package/example-plugins/packages/service-consumer-greeter/index.js +14 -0
- package/example-plugins/packages/service-consumer-greeter/package.json +22 -0
- package/example-plugins/packages/service-provider-greeter/cordis.patch.yml +3 -0
- package/example-plugins/packages/service-provider-greeter/index.js +22 -0
- package/example-plugins/packages/service-provider-greeter/package.json +25 -0
- package/example-plugins/packages/settings-section-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/settings-section-basic/index.js +34 -0
- package/example-plugins/packages/settings-section-basic/package.json +26 -0
- package/example-plugins/packages/skill-provider-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/skill-provider-basic/index.js +31 -0
- package/example-plugins/packages/skill-provider-basic/package.json +22 -0
- package/example-plugins/packages/state-host-store/client.js +57 -0
- package/example-plugins/packages/state-host-store/cordis.patch.yml +3 -0
- package/example-plugins/packages/state-host-store/index.js +90 -0
- package/example-plugins/packages/state-host-store/package.json +31 -0
- package/example-plugins/packages/state-workspace-file/cordis.patch.yml +3 -0
- package/example-plugins/packages/state-workspace-file/index.js +52 -0
- package/example-plugins/packages/state-workspace-file/package.json +25 -0
- package/example-plugins/packages/tool-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/tool-basic/index.js +25 -0
- package/example-plugins/packages/tool-basic/package.json +25 -0
- package/example-plugins/packages/tool-policy-hook/cordis.patch.yml +3 -0
- package/example-plugins/packages/tool-policy-hook/index.js +28 -0
- package/example-plugins/packages/tool-policy-hook/package.json +25 -0
- package/example-plugins/packages/tui-command-basic/cordis.patch.yml +3 -0
- package/example-plugins/packages/tui-command-basic/index.js +24 -0
- package/example-plugins/packages/tui-command-basic/package.json +22 -0
- package/example-plugins/packages/tui-overlay-themed/cordis.patch.yml +3 -0
- package/example-plugins/packages/tui-overlay-themed/index.js +65 -0
- package/example-plugins/packages/tui-overlay-themed/package.json +25 -0
- package/example-plugins/packages/tui-ui-library/cordis.patch.yml +3 -0
- package/example-plugins/packages/tui-ui-library/index.js +73 -0
- package/example-plugins/packages/tui-ui-library/package.json +29 -0
- package/example-plugins/packages/web-page-branding/cordis.patch.yml +3 -0
- package/example-plugins/packages/web-page-branding/index.js +31 -0
- package/example-plugins/packages/web-page-branding/package.json +22 -0
- package/example-plugins/scenarios.json +11 -0
- package/index.js +384 -0
- package/lib/blend-apply.js +107 -0
- package/lib/blend-capture.js +249 -0
- package/lib/blend-ledger.js +76 -0
- package/lib/contract.js +5 -0
- package/lib/install.js +516 -0
- package/lib/lookup.js +67 -0
- package/lib/manifest.js +56 -0
- package/lib/pack-root.js +22 -0
- package/lib/provenance.js +110 -0
- package/lib/publish.js +64 -0
- package/lib/reconcile.js +83 -0
- package/lib/router.js +55 -0
- package/lib/scopes.js +82 -0
- package/lib/skills.js +54 -0
- package/lib/stage.js +157 -0
- package/lib/verify.js +77 -0
- package/package.json +56 -3
- package/scripts/lib/indexes.mjs +45 -0
- package/scripts/lib/manifest.mjs +127 -0
- package/scripts/lib/maps.mjs +482 -0
- package/skills/acryl-add-provider-or-capability/SKILL.md +12 -0
- package/skills/acryl-add-ui/SKILL.md +18 -0
- package/skills/acryl-build-plugin/SKILL.md +21 -0
- package/skills/acryl-change-plugin/SKILL.md +16 -0
- package/skills/acryl-desktop-shell/SKILL.md +12 -0
- package/skills/acryl-diagnose-plugin/SKILL.md +10 -0
- package/skills/acryl-fix-plugin/SKILL.md +12 -0
- package/skills/acryl-improve-ui/SKILL.md +10 -0
- package/skills/acryl-remove-plugin/SKILL.md +11 -0
- package/skills/acryl-restyle-ui/SKILL.md +14 -0
- package/skills/acryl-share-plugin/SKILL.md +23 -0
- package/skills/acryl-tui-ui/SKILL.md +12 -0
- package/README.md +0 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Example: ui-library.gallery (host half)
|
|
2
|
+
// Type: client-slot
|
|
3
|
+
// Surfaces: web desktop
|
|
4
|
+
// Teaches: a UI-only plugin has an empty host `apply`; the UI is in ./client.js and is built from the ACRYL UI library.
|
|
5
|
+
// Expect: row ACTIVE; a "UI library" page in Settings after a reload.
|
|
6
|
+
// Docs: extending.ui-library
|
|
7
|
+
export const name = 'acryl-example-ui-library'
|
|
8
|
+
|
|
9
|
+
export function apply() {}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-ui-library",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Gallery of the ACRYL UI library (@acryldev/ui) as a page in Settings: every component, the color roles, and a Settings-style form",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
"./client": "./client.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"cordis.patch.yml",
|
|
17
|
+
"client.js"
|
|
18
|
+
],
|
|
19
|
+
"dsh": {
|
|
20
|
+
"bundle": {
|
|
21
|
+
"patch": "./cordis.patch.yml"
|
|
22
|
+
},
|
|
23
|
+
"client": {
|
|
24
|
+
"inject": [
|
|
25
|
+
"@acryldev/ui",
|
|
26
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
27
|
+
],
|
|
28
|
+
"platform": "web"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"acryl": {
|
|
32
|
+
"apiVersion": 1,
|
|
33
|
+
"permissions": [
|
|
34
|
+
"ui"
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Example: client-workspace-tab.whiteboard (browser half)
|
|
2
|
+
// Type: client-slot
|
|
3
|
+
// Surfaces: web desktop
|
|
4
|
+
// Teaches: a tab TYPE of your own: register it in `ctx.workspaceTabs` with a namespaced kind, a label, a one-line
|
|
5
|
+
// description, a glyph and a React component. The workspace owns the tab; the component gets its saved
|
|
6
|
+
// `state` (text) and `setState`, so a drawing survives closing the app. No build step, no JSX.
|
|
7
|
+
// Expect: "Whiteboard" in the + menu, the command palette and Settings > Tabs; opening it gives a canvas you draw on
|
|
8
|
+
// with the pointer; the drawing is still there after a reload.
|
|
9
|
+
// Docs: extending.workspace-tab
|
|
10
|
+
// Pattern: docs/extending/workspace-tab.md
|
|
11
|
+
// Status: written against the real registry contract; verify in the real UI after installing (reload the page).
|
|
12
|
+
window.__ModuleLoader__.load({ id: 'acryl-example-workspace-tab', factory: (require) => {
|
|
13
|
+
var module = { exports: {} }; var exports = module.exports;
|
|
14
|
+
|
|
15
|
+
const React = require('react')
|
|
16
|
+
const h = React.createElement
|
|
17
|
+
const WIDTH = 1200
|
|
18
|
+
const HEIGHT = 800
|
|
19
|
+
|
|
20
|
+
// The tab's state is JSON text: a list of strokes, each a list of [x, y] points.
|
|
21
|
+
function parse(state) {
|
|
22
|
+
try { const value = JSON.parse(state || '[]'); return Array.isArray(value) ? value : [] } catch { return [] }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function draw(canvas, strokes) {
|
|
26
|
+
const c = canvas.getContext('2d')
|
|
27
|
+
c.clearRect(0, 0, WIDTH, HEIGHT)
|
|
28
|
+
c.lineWidth = 3; c.lineCap = 'round'; c.lineJoin = 'round'; c.strokeStyle = '#4d6bfe'
|
|
29
|
+
for (const stroke of strokes) {
|
|
30
|
+
c.beginPath()
|
|
31
|
+
stroke.forEach(([x, y], i) => { if (i === 0) c.moveTo(x, y); else c.lineTo(x, y) })
|
|
32
|
+
c.stroke()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function Whiteboard({ state, setState }) {
|
|
37
|
+
const ref = React.useRef(null)
|
|
38
|
+
const strokes = React.useRef(parse(state))
|
|
39
|
+
const drawing = React.useRef(false)
|
|
40
|
+
React.useEffect(() => { if (ref.current) draw(ref.current, strokes.current) }, [])
|
|
41
|
+
const point = event => {
|
|
42
|
+
const box = ref.current.getBoundingClientRect()
|
|
43
|
+
return [Math.round((event.clientX - box.left) * WIDTH / box.width), Math.round((event.clientY - box.top) * HEIGHT / box.height)]
|
|
44
|
+
}
|
|
45
|
+
const save = () => setState(JSON.stringify(strokes.current))
|
|
46
|
+
return h('div', { style: { display: 'flex', flexDirection: 'column', flex: 1, minHeight: 0, padding: 8, gap: 8 } },
|
|
47
|
+
h('div', null, h('button', { type: 'button', onClick: () => { strokes.current = []; draw(ref.current, strokes.current); save() } }, 'Clear')),
|
|
48
|
+
h('canvas', {
|
|
49
|
+
ref, width: WIDTH, height: HEIGHT, 'aria-label': 'Whiteboard',
|
|
50
|
+
style: { flex: 1, minHeight: 0, width: '100%', border: '1px solid var(--dsw-alias-border-l1)', borderRadius: 8, touchAction: 'none', cursor: 'crosshair' },
|
|
51
|
+
onPointerDown: event => { drawing.current = true; ref.current.setPointerCapture(event.pointerId); strokes.current.push([point(event)]); draw(ref.current, strokes.current) },
|
|
52
|
+
onPointerMove: event => { if (!drawing.current) return; strokes.current[strokes.current.length - 1].push(point(event)); draw(ref.current, strokes.current) },
|
|
53
|
+
onPointerUp: () => { if (drawing.current) { drawing.current = false; save() } },
|
|
54
|
+
}))
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Required service: the workspace's tab registry (this plugin is PENDING until the workspace is there).
|
|
58
|
+
exports.inject = ['workspaceTabs']
|
|
59
|
+
|
|
60
|
+
exports.apply = function apply(ctx) {
|
|
61
|
+
// `ctx.effect` owns the registration: it is removed when this plugin is disabled or unloaded, and the tabs
|
|
62
|
+
// already open keep their state and show a "plugin is off" note until it returns.
|
|
63
|
+
ctx.effect(() => ctx.workspaceTabs.register({
|
|
64
|
+
kind: 'acryl-example.whiteboard',
|
|
65
|
+
label: 'Whiteboard',
|
|
66
|
+
description: 'A quick whiteboard to sketch on with the pointer.',
|
|
67
|
+
glyph: '✎',
|
|
68
|
+
component: Whiteboard,
|
|
69
|
+
}), 'acryl-example-workspace-tab: tab type')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return module.exports; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Example: client-workspace-tab.whiteboard (host half)
|
|
2
|
+
// Type: client-slot
|
|
3
|
+
// Surfaces: web desktop
|
|
4
|
+
// Teaches: a UI-only plugin has an empty host `apply`; all behavior is in ./client.js.
|
|
5
|
+
// Expect: row ACTIVE, nothing else on the host.
|
|
6
|
+
// Docs: extending.workspace-tab
|
|
7
|
+
export const name = 'acryl-example-workspace-tab'
|
|
8
|
+
|
|
9
|
+
export function apply() {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-workspace-tab",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Adds a Whiteboard tab type to the workspace (web client plugin, no build step)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
"./client": "./client.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.js",
|
|
16
|
+
"cordis.patch.yml",
|
|
17
|
+
"client.js"
|
|
18
|
+
],
|
|
19
|
+
"dsh": {
|
|
20
|
+
"bundle": {
|
|
21
|
+
"patch": "./cordis.patch.yml"
|
|
22
|
+
},
|
|
23
|
+
"client": {
|
|
24
|
+
"inject": [
|
|
25
|
+
"@deepseek-ai/dsh-client-ui-renderer"
|
|
26
|
+
],
|
|
27
|
+
"platform": "web"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Example: config-schema.basic
|
|
2
|
+
// Type: config-schema
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: export a Schemastery `Config`; the Loader validates it BEFORE apply runs, so a bad config fails the whole mount.
|
|
5
|
+
// Expect: valid config ACTIVE; {intervalMs: 10} FAILED with a real validation error.
|
|
6
|
+
// Docs: extending.config-schema
|
|
7
|
+
// Pattern: handbook part 8
|
|
8
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
9
|
+
|
|
10
|
+
export const name = 'acryl-example-config'
|
|
11
|
+
|
|
12
|
+
export const Config = Schema.object({
|
|
13
|
+
greeting: Schema.string().default('Hello'),
|
|
14
|
+
intervalMs: Schema.number().min(100).max(60_000).step(1).default(5_000),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export function apply(ctx, config) {
|
|
18
|
+
ctx.logger.info(`[config] greeting="${config.greeting}" intervalMs=${config.intervalMs}`)
|
|
19
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-config",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Typed, validated plugin config (Schemastery)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"cordis.patch.yml"
|
|
16
|
+
],
|
|
17
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@deepseek-ai/schemastery": "~3.18.4"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Example: desktop-main.profile-info
|
|
2
|
+
// Type: desktop-main
|
|
3
|
+
// Surfaces: tui web desktop (Desktop has the full service; Web and CLI provide a subset)
|
|
4
|
+
// Teaches: using the profile Host services. `desktopProfiles.current` ({ name, dir }) exists on EVERY surface
|
|
5
|
+
// (Web's profile is always named `web`). Only Desktop also has `list()`, `create()`, `select()` and
|
|
6
|
+
// `delete()`, so feature-test a member before calling it: this example does. `desktopPnpm` runs
|
|
7
|
+
// pnpm/dsh plugin operations in the active profile; `livePluginActivation` activates and deactivates
|
|
8
|
+
// a plugin without a restart. Declare what you need in `inject` (a surface without it leaves the row
|
|
9
|
+
// PENDING, healthy and waiting), or read it with `ctx.get(...)` at CALL time when it is optional.
|
|
10
|
+
// Expect: ACTIVE on all three surfaces; logs the active profile (and the profile list on Desktop).
|
|
11
|
+
// Docs: extending.desktop-main
|
|
12
|
+
// Pattern: apps/acryl-desktop/src/profile-service.ts, docs/reference/cordis-guides (hello-world-plugin-guide)
|
|
13
|
+
export const name = 'acryl-example-profile-info'
|
|
14
|
+
export const inject = ['desktopProfiles']
|
|
15
|
+
|
|
16
|
+
export function apply(ctx) {
|
|
17
|
+
const profiles = ctx.desktopProfiles
|
|
18
|
+
const { current } = profiles
|
|
19
|
+
// `list` exists on Desktop only; never assume a member the surface may not provide.
|
|
20
|
+
const names = typeof profiles.list === 'function' ? profiles.list().map(profile => profile.name) : [current.name]
|
|
21
|
+
ctx.logger.info(`[profile-info] active profile "${current.name}" at ${current.dir}; available: ${names.join(', ')}`)
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-profile-info",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Reads the desktopProfiles Host service (full on Desktop, a subset on Web and CLI)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"cordis.patch.yml"
|
|
16
|
+
],
|
|
17
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@deepseek-ai/cordis": "4.0.4"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Example: event-hook.basic
|
|
2
|
+
// Type: event-hook
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: ctx.on registers a listener that Cordis removes when the fiber unloads; ctx.emit broadcasts; a waterfall listener MUST call next().
|
|
5
|
+
// Expect: ACTIVE; logs "heard example/hello: world".
|
|
6
|
+
// Docs: extending.event-hook
|
|
7
|
+
// Pattern: handbook part 7
|
|
8
|
+
export const name = 'acryl-example-event-hook'
|
|
9
|
+
|
|
10
|
+
export function apply(ctx) {
|
|
11
|
+
ctx.on('example/hello', who => {
|
|
12
|
+
ctx.logger.info(`[event-hook] heard example/hello: ${who}`)
|
|
13
|
+
})
|
|
14
|
+
// A waterfall observer must call next(), otherwise it swallows the downstream default:
|
|
15
|
+
// ctx.on('example/transform', async (input, next) => { const out = await next(); return out.trim() })
|
|
16
|
+
ctx.emit('example/hello', 'world')
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-event-hook",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Listens to and emits a Cordis event",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"cordis.patch.yml"
|
|
16
|
+
],
|
|
17
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Example: generated-capability.template
|
|
2
|
+
// Type: generated-capability
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: the shape of a publishable, reviewable capability: bundle patch, exports incl ./package.json, `acryl` manifest, acryl-package keyword, a header naming what it does.
|
|
5
|
+
// Expect: ACRYL row ACTIVE; lists correctly in the marketplace once published (a human publishes).
|
|
6
|
+
// Docs: extending.packaging
|
|
7
|
+
// Pattern: acryldev.github.io scripts/lib/acryl-catalog.mjs
|
|
8
|
+
// Capability: example-capability
|
|
9
|
+
// Permissions: none (no network, no filesystem, no shell, no secrets)
|
|
10
|
+
// Generated by: <agent/session id> Created: <date> Based on: <examples used>
|
|
11
|
+
// Mutation class: HOT (a plugin remount is enough; no restart)
|
|
12
|
+
export const name = 'acryl-example-capability'
|
|
13
|
+
|
|
14
|
+
export function apply(ctx) {
|
|
15
|
+
ctx.logger.info('[acryl-example-capability] active')
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-capability",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Template for an agent-generated capability package (constitution V)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"cordis.patch.yml"
|
|
16
|
+
],
|
|
17
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"acryl-package"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/example/acryl-example-capability.git"
|
|
28
|
+
},
|
|
29
|
+
"acryl": {
|
|
30
|
+
"schemaVersion": 1,
|
|
31
|
+
"artifacts": {
|
|
32
|
+
"plugins": [
|
|
33
|
+
"./index.js"
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"capabilities": [
|
|
37
|
+
"example-capability"
|
|
38
|
+
],
|
|
39
|
+
"apiVersion": 1,
|
|
40
|
+
"permissions": []
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Example: host-route.basic
|
|
2
|
+
// Type: host-route
|
|
3
|
+
// Surfaces: web desktop
|
|
4
|
+
// Teaches: a Host plugin serves HTTP routes as one app on the framework's router, under a prefix it mounts; a client bundle can fetch them. Not on tui.
|
|
5
|
+
// Expect: ACTIVE on web/desktop (PENDING without the router); GET /api/example/hello returns "ok".
|
|
6
|
+
// Docs: extending.host-route
|
|
7
|
+
// Pattern: @acryldev/support src/route.ts, @acryldev/plugin-admin src/index.ts
|
|
8
|
+
import { Acryl } from '@acryldev/blends'
|
|
9
|
+
|
|
10
|
+
export const name = 'acryl-example-route'
|
|
11
|
+
// Both come from the app's framework-kit row. Until they exist this plugin is PENDING, not failed.
|
|
12
|
+
export const inject = ['router', 'routerHttp']
|
|
13
|
+
|
|
14
|
+
export function apply(ctx) {
|
|
15
|
+
const app = new Acryl()
|
|
16
|
+
app.get('/api/example/hello', c => c.text('ok'))
|
|
17
|
+
// The routes and the mount belong to this plugin: they go away when it unloads, no effect or disposer to write.
|
|
18
|
+
ctx.router.route('/', app)
|
|
19
|
+
ctx.routerHttp.mount('/api/example')
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-route",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Adds an HTTP route to the web host",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"cordis.patch.yml"
|
|
16
|
+
],
|
|
17
|
+
"peerDependencies": {
|
|
18
|
+
"@acryldev/blends": "^1.0.0"
|
|
19
|
+
},
|
|
20
|
+
"dsh": {
|
|
21
|
+
"bundle": {
|
|
22
|
+
"patch": "./cordis.patch.yml"
|
|
23
|
+
},
|
|
24
|
+
"requiresAcrylPackages": [
|
|
25
|
+
"@acryldev/blends/cordis/router",
|
|
26
|
+
"@acryldev/blends/cordis/router-http"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Example: lifecycle-function.basic
|
|
2
|
+
// Type: lifecycle-function
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: the smallest plugin: named exports `name` and `apply`. It has no
|
|
5
|
+
// dependencies, provides nothing, and owns no resources.
|
|
6
|
+
// Expect: its row is ACTIVE as soon as the profile loads; logs once.
|
|
7
|
+
// Docs: start.this-runtime
|
|
8
|
+
export const name = 'acryl-example-lifecycle-function'
|
|
9
|
+
|
|
10
|
+
export function apply(ctx) {
|
|
11
|
+
ctx.logger.info('[acryl-example-lifecycle-function] mounted')
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-lifecycle-function",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Smallest ACRYL plugin: a lifecycle function that logs once when it mounts",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": ["index.js", "cordis.patch.yml"],
|
|
14
|
+
"dsh": { "bundle": { "patch": "./cordis.patch.yml" } }
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Example: lifecycle-function.hot-shim
|
|
2
|
+
// Type: lifecycle-function
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// LEGACY: acryl_install_plugin now reloads host code automatically (docs/delivery/local-live.md); write this shim only if you bypass the installer.
|
|
5
|
+
// Teaches: make HOST code hot-updatable. Node caches module resolution, so re-installing a changed plugin
|
|
6
|
+
// keeps running the OLD host code (measured). This shim never changes: each time the plugin mounts
|
|
7
|
+
// it re-imports impl.js with a unique query string, which bypasses the cache. Put ALL real logic
|
|
8
|
+
// in impl.js and keep this file exactly as it is. (Browser client.js needs no shim: it is re-read
|
|
9
|
+
// from disk on page reload.)
|
|
10
|
+
// Expect: v1 -> edit impl.js -> acryl_install_plugin again -> the NEW behaviour is live with no restart.
|
|
11
|
+
// Docs: delivery.local-live
|
|
12
|
+
// Pattern: measured on the real engine, spec 037 research
|
|
13
|
+
export const name = 'acryl-example-hot-shim'
|
|
14
|
+
|
|
15
|
+
export async function apply(ctx, config) {
|
|
16
|
+
const impl = await import(new URL('./impl.js', import.meta.url).href + '?t=' + Date.now() + Math.random())
|
|
17
|
+
return impl.apply(ctx, config)
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-hot-shim",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Host plugin that reloads its own code on every update (hot shim)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"impl.js",
|
|
16
|
+
"cordis.patch.yml"
|
|
17
|
+
],
|
|
18
|
+
"dsh": {
|
|
19
|
+
"bundle": {
|
|
20
|
+
"patch": "./cordis.patch.yml"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Example: lifecycle-hooks.observer
|
|
2
|
+
// Type: event-hook (lifecycle interception: before step, before request, model stream)
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: the three agent-loop waterfalls pi.dev exposes as `before_agent_start`, `context` and provider-request hooks:
|
|
5
|
+
// `agent/pre-step` (payload { agent, messages, turn, step, signal }): runs before each step; `await next()` returns the decision
|
|
6
|
+
// { kind: 'enter', messages } or { kind: 'reject' }; return it unchanged to observe, or change `messages` to alter what enters.
|
|
7
|
+
// `agent/request` (payload { agent, turn, step, signal }): runs before each model request; `await next()` returns the call config
|
|
8
|
+
// (provider, model, ...); return a replacement to switch model. It cannot mutate messages.
|
|
9
|
+
// `llm/stream` (options, next): wraps the model call itself; call `next()` (optionally with changed options) and return its stream.
|
|
10
|
+
// EVERY waterfall listener must call `next()` and return its result, or it cuts the rest of the chain out. These are observers: they
|
|
11
|
+
// count and pass everything through. Register inside `ctx.effect`; provide the counters as a service so other code can read them.
|
|
12
|
+
// Expect: row ACTIVE; `acrylLifecycleProbe.counts()` grows as the agent takes steps and makes requests.
|
|
13
|
+
// Docs: extending.event-hook
|
|
14
|
+
// Pattern: plugins/system-prompt/src/index.ts (system-prompt/assemble), maps/events.md for every other event
|
|
15
|
+
export const name = 'acryl-example-lifecycle-hooks'
|
|
16
|
+
|
|
17
|
+
export function apply(ctx) {
|
|
18
|
+
const counts = { preStep: 0, request: 0, stream: 0 }
|
|
19
|
+
ctx.provide('acrylLifecycleProbe', { counts: () => ({ ...counts }) })
|
|
20
|
+
ctx.effect(() => ctx.on('agent/pre-step', async (payload, next) => { counts.preStep += 1; return next() }), 'lifecycle-hooks: pre-step')
|
|
21
|
+
ctx.effect(() => ctx.on('agent/request', async (payload, next) => { counts.request += 1; return next() }), 'lifecycle-hooks: request')
|
|
22
|
+
ctx.effect(() => ctx.on('llm/stream', (options, next) => { counts.stream += 1; return next() }), 'lifecycle-hooks: stream')
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-lifecycle-hooks",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Observes the agent lifecycle: before each step, before each model request, and each model stream (observers that pass everything through)",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.js",
|
|
15
|
+
"cordis.patch.yml"
|
|
16
|
+
],
|
|
17
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Example: llm-adapter.echo
|
|
2
|
+
// Type: llm-adapter
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: the LlmAdapter contract: a class with `async * stream(options)` yielding StreamChunks, registered on
|
|
5
|
+
// `ctx.llm.registerAdapter(['route'], adapter)`. Order: block-start, text-delta, block-end, then `usage`
|
|
6
|
+
// BEFORE `finish`, and nothing after `finish`. Honor options.signal. A real provider would call its HTTP
|
|
7
|
+
// API here; this one echoes the last user message so the contract can be seen without a network.
|
|
8
|
+
// Expect: row ACTIVE once the `llm` service exists; provider route "acryl-echo" is registered.
|
|
9
|
+
// Docs: extending.llm-adapter
|
|
10
|
+
// Pattern: docs/reference/cookbook/adding-an-llm-adapter.md
|
|
11
|
+
import { LlmAdapter } from '@deepseek-ai/dsh-llm'
|
|
12
|
+
|
|
13
|
+
export const name = 'acryl-example-llm-echo'
|
|
14
|
+
export const inject = ['llm']
|
|
15
|
+
|
|
16
|
+
const lastUserText = messages => {
|
|
17
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
18
|
+
const message = messages[i]
|
|
19
|
+
if (message.role !== 'user') continue
|
|
20
|
+
const blocks = Array.isArray(message.content) ? message.content : [{ type: 'text', text: String(message.content) }]
|
|
21
|
+
return blocks.filter(block => block.type === 'text').map(block => block.text).join('')
|
|
22
|
+
}
|
|
23
|
+
return ''
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
class EchoAdapter extends LlmAdapter {
|
|
27
|
+
async * stream(options) {
|
|
28
|
+
if (options.signal?.aborted) return
|
|
29
|
+
const text = `echo: ${lastUserText(options.messages)}`
|
|
30
|
+
yield { type: 'block-start', index: 0, blockType: 'text' }
|
|
31
|
+
yield { type: 'text-delta', index: 0, text }
|
|
32
|
+
yield { type: 'block-end', index: 0, block: { type: 'text', text } }
|
|
33
|
+
// usage BEFORE finish; nothing after finish.
|
|
34
|
+
yield { type: 'usage', usage: { inputTokens: 1, outputTokens: 1 } }
|
|
35
|
+
yield { type: 'finish', reason: { kind: 'stop' } }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function apply(ctx) {
|
|
40
|
+
// Effect-based registration: the route is released when this plugin is disposed or reloaded.
|
|
41
|
+
ctx.llm.registerAdapter(['acryl-echo'], new EchoAdapter())
|
|
42
|
+
}
|