@acryldev/plugin-context 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +12 -2
- 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 +58 -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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Example: tool.basic
|
|
2
|
+
// Type: tool
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: a tool is a plugin that injects `tools` and registers a defineTool() definition the model can call.
|
|
5
|
+
// Expect: ACTIVE; the model sees the `example_echo` tool.
|
|
6
|
+
// Docs: extending.tool
|
|
7
|
+
// Pattern: deepseek-harness docs/cookbook/adding-a-tool.md
|
|
8
|
+
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
9
|
+
|
|
10
|
+
export const name = 'acryl-example-tool'
|
|
11
|
+
export const inject = ['tools']
|
|
12
|
+
|
|
13
|
+
export function apply(ctx) {
|
|
14
|
+
ctx.tools.register(defineTool({
|
|
15
|
+
name: 'example_echo',
|
|
16
|
+
description: 'Echo a message back, uppercased.',
|
|
17
|
+
parameters: {
|
|
18
|
+
message: { type: 'string', required: true, description: 'Text to echo' },
|
|
19
|
+
},
|
|
20
|
+
output: { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: value }] },
|
|
21
|
+
async execute(args) {
|
|
22
|
+
return args.message.toUpperCase()
|
|
23
|
+
},
|
|
24
|
+
}))
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-tool",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Registers a model-callable tool",
|
|
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/dsh-tools": "0.2.0-rc.2"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Example: tool-policy-hook.deny
|
|
2
|
+
// Type: event-hook (lifecycle interception: tool execution)
|
|
3
|
+
// Surfaces: tui web desktop
|
|
4
|
+
// Teaches: a TOOL POLICY, the harness's equivalent of pi.dev's `tool_call` interception. The `tools/pre-execute` waterfall runs before every tool
|
|
5
|
+
// call with the pending execution `{ callId, name, arguments, agent, ... }` and must return a decision: `{ kind: 'allow' }`,
|
|
6
|
+
// `{ kind: 'deny', reason }` (the model gets an error result carrying your reason and can change course) or `{ kind: 'ask', reason? }`
|
|
7
|
+
// (routes to the approval flow; without approval support it becomes a denial). `await next()` yields the decision the rest of the chain
|
|
8
|
+
// would make (allow by default): return it unchanged for calls you do not care about, so other policies and the approval preset still
|
|
9
|
+
// apply. Related: `tools/post-execute` (accept, replace or block a result), `tools/execute` (wrap the call: timeout, retry, metrics),
|
|
10
|
+
// `tools/result` (observe the final outcome). Policies are security relevant: keep them small, fail closed, say what they block.
|
|
11
|
+
// Expect: row ACTIVE; calls to a tool named in `blocked` are denied with the reason; every other call is untouched.
|
|
12
|
+
// Docs: extending.event-hook
|
|
13
|
+
// Pattern: deepseek-harness/docs/reference (harness/tool-execution-pipeline.md), maps/events.md ("tools/pre-execute")
|
|
14
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
15
|
+
|
|
16
|
+
export const name = 'acryl-example-tool-policy'
|
|
17
|
+
|
|
18
|
+
export const Config = Schema.object({
|
|
19
|
+
blocked: Schema.array(Schema.string()).default(['example_forbidden']).description('Tool names to deny.'),
|
|
20
|
+
reason: Schema.string().default('This tool is blocked by the ACRYL example tool policy.').description('What the model is told.'),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export function apply(ctx, config) {
|
|
24
|
+
ctx.effect(() => ctx.on('tools/pre-execute', async (exec, next) => {
|
|
25
|
+
if (config.blocked.includes(exec.name)) return { kind: 'deny', reason: `${config.reason} (tool: ${exec.name})` }
|
|
26
|
+
return next()
|
|
27
|
+
}), 'acryl-example-tool-policy: pre-execute')
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-tool-policy",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "A tool policy: deny chosen tools before they run, with a reason the model sees (tools/pre-execute)",
|
|
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,24 @@
|
|
|
1
|
+
// Example: tui-command.basic
|
|
2
|
+
// Type: tui-contribution
|
|
3
|
+
// Surfaces: tui
|
|
4
|
+
// Teaches: ctx.get('tuiCommands') exists only in the CLI host: read it OPTIONALLY, never inject it. Register returns a disposer; wrap it in ctx.effect.
|
|
5
|
+
// Expect: ACTIVE everywhere; the /hello command exists only on tui.
|
|
6
|
+
// Docs: extending.tui-command
|
|
7
|
+
// Pattern: apps/acryl-cli/src/tui/tui-commands-service.ts
|
|
8
|
+
export const name = 'acryl-example-tui-command'
|
|
9
|
+
|
|
10
|
+
export function apply(ctx) {
|
|
11
|
+
const commands = ctx.get('tuiCommands') // undefined on web and desktop: that is fine
|
|
12
|
+
if (!commands) return
|
|
13
|
+
ctx.effect(() => commands.register({
|
|
14
|
+
command: '/hello',
|
|
15
|
+
description: 'Say hello (example plugin)',
|
|
16
|
+
packageName: 'acryl-example-tui-command',
|
|
17
|
+
// A pi-tui Component: render(width) returns lines, handleInput gets keys.
|
|
18
|
+
open: ({ close }) => ({
|
|
19
|
+
render: () => ['', ' Hello from an installed plugin. Press any key to close.', ''],
|
|
20
|
+
handleInput: () => close(),
|
|
21
|
+
invalidate: () => {},
|
|
22
|
+
}),
|
|
23
|
+
}))
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-tui-command",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Adds a slash command with an overlay to the terminal UI",
|
|
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,65 @@
|
|
|
1
|
+
// Example: tui-overlay.themed
|
|
2
|
+
// Type: tui-contribution (pi-tui components and a palette)
|
|
3
|
+
// Surfaces: tui (a no-op elsewhere)
|
|
4
|
+
// Teaches: build terminal UI from pi-tui components with your OWN semantic palette. A pi-tui Component is an object with
|
|
5
|
+
// `render(width): string[]` (one string per line, NEVER wider than `width`: pad or `truncateToWidth`),
|
|
6
|
+
// optional `handleInput(keyData)`, and `invalidate()`. Compose the built-ins (`Container`, `Text`, `SelectList`,
|
|
7
|
+
// `Box`, `Markdown`, `Input`, `Editor`, `ScrollView`...). Colors are ANSI functions (`fg(hex)` below); keep them in
|
|
8
|
+
// one PALETTE object so the look changes in one place. The terminal owns its background: color foregrounds only.
|
|
9
|
+
// The CLI's own palette is compiled into the app and NOT readable by a plugin, so a plugin carries its own.
|
|
10
|
+
// Expect: `/themed` opens a small centered popup with a colored title and a list; Enter or Esc closes it.
|
|
11
|
+
// Docs: extending.tui-components
|
|
12
|
+
// Pattern: apps/acryl-cli/src/tui/piTheme.ts and tui/theme.ts (the same shape), tui-commands-service.ts (open/close)
|
|
13
|
+
import { Container, SelectList, Text, truncateToWidth } from '@earendil-works/pi-tui'
|
|
14
|
+
|
|
15
|
+
export const name = 'acryl-example-tui-themed'
|
|
16
|
+
|
|
17
|
+
/** Semantic palette: change the look here, nowhere else. */
|
|
18
|
+
export const PALETTE = { primary: '#ff922b', muted: '#94a3b8', success: '#34d399' }
|
|
19
|
+
|
|
20
|
+
export const fg = hex => {
|
|
21
|
+
const n = Number.parseInt(hex.slice(1), 16)
|
|
22
|
+
return text => `\x1b[38;2;${(n >> 16) & 255};${(n >> 8) & 255};${n & 255}m${text}\x1b[0m`
|
|
23
|
+
}
|
|
24
|
+
const bold = text => `\x1b[1m${text}\x1b[0m`
|
|
25
|
+
|
|
26
|
+
const selectTheme = {
|
|
27
|
+
selectedPrefix: fg(PALETTE.primary),
|
|
28
|
+
selectedText: text => bold(fg(PALETTE.primary)(text)),
|
|
29
|
+
description: fg(PALETTE.muted),
|
|
30
|
+
scrollInfo: fg(PALETTE.muted),
|
|
31
|
+
noMatch: fg(PALETTE.muted),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Build the popup component. Exported so it can be rendered and width-checked without a terminal. */
|
|
35
|
+
export function buildOverlay(close) {
|
|
36
|
+
const list = new SelectList([
|
|
37
|
+
{ value: 'a', label: 'First item', description: 'the first thing' },
|
|
38
|
+
{ value: 'b', label: 'Second item', description: 'the second thing' },
|
|
39
|
+
{ value: 'c', label: 'A third item with a rather long label that must never overflow', description: 'long' },
|
|
40
|
+
], 5, selectTheme)
|
|
41
|
+
list.onSelect = () => close()
|
|
42
|
+
list.onCancel = () => close()
|
|
43
|
+
const root = new Container()
|
|
44
|
+
root.addChild(new Text(bold(fg(PALETTE.primary)('Themed overlay')), 1, 0))
|
|
45
|
+
root.addChild(list)
|
|
46
|
+
root.addChild(new Text(fg(PALETTE.muted)('up/down choose, enter select, esc close'), 1, 0))
|
|
47
|
+
return {
|
|
48
|
+
// Defensive: no line may exceed the terminal width, whatever a child does.
|
|
49
|
+
render: width => root.render(width).map(line => truncateToWidth(line, width)),
|
|
50
|
+
handleInput: data => list.handleInput(data),
|
|
51
|
+
invalidate: () => root.invalidate(),
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function apply(ctx) {
|
|
56
|
+
const commands = ctx.get('tuiCommands') // undefined outside the CLI: fine
|
|
57
|
+
if (!commands) return
|
|
58
|
+
ctx.effect(() => commands.register({
|
|
59
|
+
command: '/themed',
|
|
60
|
+
description: 'Themed pi-tui overlay (example plugin)',
|
|
61
|
+
packageName: 'acryl-example-tui-themed',
|
|
62
|
+
overlay: { width: '60%', anchor: 'center', margin: 2 },
|
|
63
|
+
open: ({ close }) => buildOverlay(close),
|
|
64
|
+
}), 'acryl-example-tui-themed: /themed')
|
|
65
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-tui-themed",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "A themed pi-tui overlay for the terminal: title, SelectList and hint with its own semantic palette",
|
|
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
|
+
"@earendil-works/pi-tui": "1.1.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Example: ui-library.tui-gallery
|
|
2
|
+
// Type: tui-contribution
|
|
3
|
+
// Surfaces: tui (a no-op elsewhere)
|
|
4
|
+
// Teaches: build a terminal screen from `@acryldev/ui-tui` instead of raw pi-tui and hand-picked colors: `createTuiUi(ctx.get('tuiTheme'))` gives Card, Field, SettingsRow,
|
|
5
|
+
// SelectField, Segmented, Tabs, SwitchField, Dialog, EmptyState and Stack, all width-safe and keyboard-driven, painted with the shared semantic roles. Passing the
|
|
6
|
+
// `tuiTheme` service makes the colors follow the terminal's light/dark scheme; without it the components use the static dark palette.
|
|
7
|
+
// Expect: `/gallery` opens a popup with three tabs (Components, Settings form, Colors); Tab switches tabs, arrows and space use the controls, Esc closes.
|
|
8
|
+
// Docs: extending.ui-library
|
|
9
|
+
import { createTuiUi, defaultTheme } from '@acryldev/ui-tui'
|
|
10
|
+
|
|
11
|
+
export const name = 'acryl-example-tui-ui-library'
|
|
12
|
+
|
|
13
|
+
const ROLES = ['primary', 'secondary', 'accent', 'reasoning', 'success', 'warning', 'error', 'info', 'muted']
|
|
14
|
+
const ESC = '\x1b'
|
|
15
|
+
|
|
16
|
+
/** Build the gallery component. Exported so it can be rendered and width-checked without a terminal. */
|
|
17
|
+
export function buildGallery(theme, close) {
|
|
18
|
+
const ui = createTuiUi(theme)
|
|
19
|
+
let tab = 'components'
|
|
20
|
+
let confirming = false
|
|
21
|
+
let row = 0
|
|
22
|
+
const state = { permission: 'write', appearance: 'system', queue: true }
|
|
23
|
+
|
|
24
|
+
const settingsRows = () => [
|
|
25
|
+
ui.SettingsRow({ label: 'Permission', description: 'Default permission mode for new sessions', focused: row === 0,
|
|
26
|
+
control: ui.SelectField({ value: state.permission, onChange: v => { state.permission = v }, options: [{ id: 'read', label: 'Read Only' }, { id: 'write', label: 'Workspace Write' }, { id: 'full', label: 'Full access' }] }) }),
|
|
27
|
+
ui.SettingsRow({ label: 'Appearance', focused: row === 1,
|
|
28
|
+
control: ui.Segmented({ value: state.appearance, onChange: v => { state.appearance = v }, options: [{ id: 'light', label: 'Light' }, { id: 'dark', label: 'Dark' }, { id: 'system', label: 'System' }] }) }),
|
|
29
|
+
ui.SettingsRow({ label: 'Queue while busy', focused: row === 2, control: ui.SwitchField({ label: '', checked: state.queue, onChange: v => { state.queue = v } }) }),
|
|
30
|
+
]
|
|
31
|
+
const settings = {
|
|
32
|
+
render: width => [...settingsRows().flatMap(r => r.render(width)), '', 'up/down: row left/right or space: change r: reset'].map(line => line.slice(0, width * 4)),
|
|
33
|
+
handleInput(data) {
|
|
34
|
+
if (data === `${ESC}[A`) { row = Math.max(0, row - 1); return true }
|
|
35
|
+
if (data === `${ESC}[B`) { row = Math.min(2, row + 1); return true }
|
|
36
|
+
if (data === 'r') { confirming = true; return true }
|
|
37
|
+
return settingsRows()[row].handleInput(data)
|
|
38
|
+
},
|
|
39
|
+
invalidate() {},
|
|
40
|
+
}
|
|
41
|
+
const components = ui.Stack({ gap: 1, children: [
|
|
42
|
+
ui.Card({ title: 'Card with a form', body: [ui.Field({ label: 'Name', hint: 'shown in the header' }), ui.SwitchField({ label: 'Loud mode', checked: true, hint: 'uppercase everything' })], footer: 'Save' }),
|
|
43
|
+
ui.EmptyState({ title: 'Nothing yet', description: 'Saved items appear here' }),
|
|
44
|
+
] })
|
|
45
|
+
const colors = { render: width => ROLES.map(role => `${theme.color(role)('██')} ${role}`.slice(0, width * 4)), invalidate() {} }
|
|
46
|
+
const panels = { components, settings, colors }
|
|
47
|
+
const tabs = ui.Tabs({ value: tab, onChange: id => { tab = id }, panel: id => panels[id],
|
|
48
|
+
tabs: [{ id: 'components', label: 'Components' }, { id: 'settings', label: 'Settings form' }, { id: 'colors', label: 'Colors' }] })
|
|
49
|
+
const dialog = ui.Dialog({ title: 'Reset settings?', message: 'This restores every setting to its default.', confirmLabel: 'Reset', danger: true,
|
|
50
|
+
onConfirm: () => { state.permission = 'write'; state.appearance = 'system'; state.queue = true; confirming = false }, onCancel: () => { confirming = false } })
|
|
51
|
+
return {
|
|
52
|
+
render: width => [...(confirming ? dialog : ui.Card({ title: 'ACRYL UI library (terminal)', body: [tabs] })).render(width)],
|
|
53
|
+
handleInput(data) {
|
|
54
|
+
if (confirming) return dialog.handleInput(data)
|
|
55
|
+
if (data === ESC) { close(); return true }
|
|
56
|
+
return tabs.handleInput(data)
|
|
57
|
+
},
|
|
58
|
+
invalidate() {},
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function apply(ctx) {
|
|
63
|
+
const commands = ctx.get('tuiCommands') // undefined outside the CLI: fine
|
|
64
|
+
if (!commands) return
|
|
65
|
+
const theme = ctx.get('tuiTheme') ?? defaultTheme
|
|
66
|
+
ctx.effect(() => commands.register({
|
|
67
|
+
command: '/gallery',
|
|
68
|
+
description: 'ACRYL terminal UI library gallery (example plugin)',
|
|
69
|
+
packageName: 'acryl-example-tui-ui-library',
|
|
70
|
+
overlay: { width: '70%', anchor: 'center', margin: 2 },
|
|
71
|
+
open: ({ close }) => buildGallery(theme, close),
|
|
72
|
+
}), 'acryl-example-tui-ui-library: /gallery')
|
|
73
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-tui-ui-library",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Terminal gallery of the ACRYL UI library (@acryldev/ui-tui): components, a Settings-style form and the color roles, opened with /gallery",
|
|
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
|
+
"dependencies": {
|
|
23
|
+
"@acryldev/ui-tui": "*"
|
|
24
|
+
},
|
|
25
|
+
"acryl": {
|
|
26
|
+
"apiVersion": 1,
|
|
27
|
+
"permissions": []
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Example: web-page-branding.basic
|
|
2
|
+
// Type: host-route (web server index transform)
|
|
3
|
+
// Surfaces: web desktop (the CLI has no web server: the row stays ACTIVE and does nothing)
|
|
4
|
+
// Teaches: change what the browser shows around the app: the tab TITLE, the FAVICON, and page-level CSS, from the HOST,
|
|
5
|
+
// with the web server's two index seams. (1) `ctx.on('webserver/index-inject', table => table.push(row))` adds
|
|
6
|
+
// STRUCTURED rows: { kind: 'style', text } (a <style> in <head>), { kind: 'html', placement: 'head', html }
|
|
7
|
+
// (raw markup such as a <link rel="icon">), { kind: 'global', name, value }, { kind: 'script'|'script-src' }.
|
|
8
|
+
// (2) `webServer.tapIndex(html => html)` is the raw-HTML escape hatch (used here for the <title>); it runs
|
|
9
|
+
// after the rows. Register both inside effects so they leave with the plugin. Reload the page to see them.
|
|
10
|
+
// The favicon here is an inline SVG data URL (no file to serve). Everything is optional: read `webServer`
|
|
11
|
+
// at call time, never assume it exists.
|
|
12
|
+
// Expect: the served index.html gets <title>My Studio</title>, a favicon link and a style row.
|
|
13
|
+
// Docs: extending.ui-branding
|
|
14
|
+
// Pattern: apps/acryl-web (tapIndex sets <title>ACRYL</title>), deepseek-harness/packages/host/webserver/src/injections.ts
|
|
15
|
+
export const name = 'acryl-example-page-branding'
|
|
16
|
+
|
|
17
|
+
const TITLE = 'My Studio'
|
|
18
|
+
const FAVICON = 'data:image/svg+xml,' + encodeURIComponent(
|
|
19
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="7" fill="#e8590c"/><text x="16" y="22" font-size="18" text-anchor="middle" fill="#fff" font-family="sans-serif">S</text></svg>')
|
|
20
|
+
|
|
21
|
+
export function apply(ctx) {
|
|
22
|
+
ctx.effect(() => ctx.on('webserver/index-inject', (table) => {
|
|
23
|
+
table.push({ kind: 'html', placement: 'head', html: `<link rel="icon" type="image/svg+xml" href="${FAVICON}">` })
|
|
24
|
+
// Page-level CSS that exists before the app boots (avoids a flash of the default background).
|
|
25
|
+
table.push({ kind: 'style', text: 'html,body{background:#1a1410}' })
|
|
26
|
+
}), 'acryl-example-page-branding: index rows')
|
|
27
|
+
const server = ctx.get('webServer')
|
|
28
|
+
if (server) {
|
|
29
|
+
ctx.effect(() => server.tapIndex(html => html.replace(/<title>[^<]*<\/title>/iu, `<title>${TITLE}</title>`)), 'acryl-example-page-branding: title')
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "acryl-example-page-branding",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Brands the served web page: title, favicon and a global CSS variable (Web and Desktop 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
|
+
"dsh": {
|
|
18
|
+
"bundle": {
|
|
19
|
+
"patch": "./cordis.patch.yml"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "lifecycle-function-basic",
|
|
4
|
+
"surfaces": ["tui", "web", "desktop"],
|
|
5
|
+
"steps": [
|
|
6
|
+
{ "mount": "packages/lifecycle-function-basic", "expect": "ACTIVE" },
|
|
7
|
+
{ "remount": "packages/lifecycle-function-basic", "expect": "ACTIVE" },
|
|
8
|
+
{ "expectNoLeak": true }
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
]
|