@kolisachint/hoocode-agent 0.5.41 → 0.5.43
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/CHANGELOG.md +111 -0
- package/dist/core/builtin-skills.d.ts +11 -0
- package/dist/core/builtin-skills.d.ts.map +1 -1
- package/dist/core/builtin-skills.js +31 -0
- package/dist/core/builtin-skills.js.map +1 -1
- package/dist/core/canvas/scaffold.d.ts +1 -1
- package/dist/core/canvas/scaffold.d.ts.map +1 -1
- package/dist/core/canvas/scaffold.js +100 -5
- package/dist/core/canvas/scaffold.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +1 -0
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +1 -0
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +14 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +15 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +3 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/tools/webtools-shared.d.ts +53 -2
- package/dist/core/tools/webtools-shared.d.ts.map +1 -1
- package/dist/core/tools/webtools-shared.js +43 -2
- package/dist/core/tools/webtools-shared.js.map +1 -1
- package/dist/extensions/core/canvas.d.ts.map +1 -1
- package/dist/extensions/core/canvas.js +2 -1
- package/dist/extensions/core/canvas.js.map +1 -1
- package/dist/init-templates.generated.d.ts.map +1 -1
- package/dist/init-templates.generated.js +4 -0
- package/dist/init-templates.generated.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +11 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +6 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +16 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/websearch-warning.d.ts +35 -0
- package/dist/modes/interactive/websearch-warning.d.ts.map +1 -0
- package/dist/modes/interactive/websearch-warning.js +40 -0
- package/dist/modes/interactive/websearch-warning.js.map +1 -0
- package/docs/settings.md +52 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
- package/templates/agents/code-review.md +61 -0
- package/templates/agents/security-review.md +69 -0
- package/templates/skills/artifact-design/SKILL.md +191 -0
- package/templates/skills/canvas-design/SKILL.md +117 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: canvas-design
|
|
3
|
+
description: How to make a canvas extension's page good — layout, styling, live state, and the dependency and token constraints the surface imposes. Read when building or editing a canvas; the /new-canvas brief points here.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
allowed-tools: read, write, edit, grep, find, ls
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Designing a canvas
|
|
9
|
+
|
|
10
|
+
A canvas is not a document. It is a small application: a page served over
|
|
11
|
+
loopback that a person operates while you drive the same state through typed
|
|
12
|
+
actions. Both of you are live on it at once, and that is the whole design
|
|
13
|
+
problem.
|
|
14
|
+
|
|
15
|
+
Read `../artifact-design/SKILL.md` for the fundamentals — treatment, the
|
|
16
|
+
color/type/layout plan you write before any markup, neutrals, spacing, the
|
|
17
|
+
generated-look list. All of it applies. This file covers only what is different
|
|
18
|
+
because the surface is a canvas, and where the two disagree, this file wins.
|
|
19
|
+
|
|
20
|
+
## What the catalog already tells you
|
|
21
|
+
|
|
22
|
+
Of the 23 extensions in GitHub's canvas catalog, 22 import nothing but
|
|
23
|
+
`@github/copilot-sdk` and `node:` builtins. The single exception ships a README
|
|
24
|
+
telling the user to `npm install` by hand. Zero dependencies is not a
|
|
25
|
+
restriction someone imposed on you; it is what working canvases actually do.
|
|
26
|
+
|
|
27
|
+
The flagship, `pr-artifact-explorer`, is a rich **read** surface the agent
|
|
28
|
+
navigates — its shared state is a cache and a route, and neither party co-edits
|
|
29
|
+
content. It sidesteps concurrent editing entirely. Treat that as evidence about
|
|
30
|
+
what is easy and what is not: a canvas that shows state well is worth far more
|
|
31
|
+
than one that lets both parties type into the same field.
|
|
32
|
+
|
|
33
|
+
## The page lives inside a template string
|
|
34
|
+
|
|
35
|
+
The HTML is a JavaScript template literal in `extension.mjs`, not a file. Two
|
|
36
|
+
consequences worth planning around rather than discovering:
|
|
37
|
+
|
|
38
|
+
- Every backtick and `${` in your CSS or markup needs escaping. A `grid-template`
|
|
39
|
+
value or a JS snippet with a template literal inside it will break the outer
|
|
40
|
+
string. Prefer plain quotes and avoid nesting template literals.
|
|
41
|
+
- There is no stylesheet to open in an editor. Keep the CSS in one clearly
|
|
42
|
+
delimited chunk near the top of the served string so it stays findable, rather
|
|
43
|
+
than scattering inline `style=` attributes.
|
|
44
|
+
|
|
45
|
+
If the page grows past a screenful of markup, serve it from a separate file in
|
|
46
|
+
the extension directory and read it at request time. The extension is already an
|
|
47
|
+
HTTP server; it can serve its own assets. That is the escape hatch from string
|
|
48
|
+
escaping, and it does not violate the no-dependency rule.
|
|
49
|
+
|
|
50
|
+
## No dependencies, and no build
|
|
51
|
+
|
|
52
|
+
`package.json` and `node_modules` are forbidden in the extension directory, so
|
|
53
|
+
there is nothing to install and nothing to bundle. Write plain CSS and plain
|
|
54
|
+
DOM. Modern CSS has custom properties, grid, and `clamp()`; a canvas that needs
|
|
55
|
+
a utility framework needs a clearer layout instead.
|
|
56
|
+
|
|
57
|
+
Do not reach for a CDN either. The page is served from `127.0.0.1`, so it works
|
|
58
|
+
with no network — a CDN script throws that away and turns an offline-capable
|
|
59
|
+
local tool into a broken one.
|
|
60
|
+
|
|
61
|
+
## You own the theme completely
|
|
62
|
+
|
|
63
|
+
The canvas protocol carries no theme, no palette, and no styling hook. Nothing
|
|
64
|
+
is inherited. A page that sets no colors gets browser defaults, which is why the
|
|
65
|
+
scaffold's placeholder looks like nothing.
|
|
66
|
+
|
|
67
|
+
So define the full palette as custom properties on `:root`, redefine them under
|
|
68
|
+
`@media (prefers-color-scheme: dark)`, and style everything through them. Set an
|
|
69
|
+
explicit `background` on `body`. This is the same discipline as any page, with
|
|
70
|
+
one simplification: there is no host stamping `data-theme`, so two states is the
|
|
71
|
+
whole problem.
|
|
72
|
+
|
|
73
|
+
## Design for two operators
|
|
74
|
+
|
|
75
|
+
The person changes state through the page. You change the same state through
|
|
76
|
+
`invoke_canvas_action`. The page has to be honest about that:
|
|
77
|
+
|
|
78
|
+
- **Render from server state, not from what the user just clicked.** After an
|
|
79
|
+
action mutates state, the page must be able to show the new truth. Poll on a
|
|
80
|
+
short interval, or push with SSE — both are a few lines with no dependency.
|
|
81
|
+
- **Make agent-reachable state visible.** If an action can add a note, the notes
|
|
82
|
+
should be on screen. State only you can see is state the person cannot trust.
|
|
83
|
+
- **Do not build co-editing.** Concurrent edits to one field is the hard problem
|
|
84
|
+
the reference canvas declined to solve. Prefer append, toggle, and select over
|
|
85
|
+
a shared text buffer.
|
|
86
|
+
- **Show that something changed.** When state moves underneath the person, a
|
|
87
|
+
brief highlight on the changed row beats a silent re-render.
|
|
88
|
+
|
|
89
|
+
## Actions are tool schemas, so they cost
|
|
90
|
+
|
|
91
|
+
Every action becomes an agent-callable tool while the instance is open, and its
|
|
92
|
+
name, description, and `inputSchema` are re-sent on every request for as long as
|
|
93
|
+
it stays open. Declare the actions the canvas actually needs and give each a
|
|
94
|
+
tight schema — not one per button.
|
|
95
|
+
|
|
96
|
+
Action results land in the model's context too. Return a summary and a count,
|
|
97
|
+
not the whole collection; where a list is genuinely useful, slice it and set a
|
|
98
|
+
flag saying you did. Measure with `hoocode --print-token-surface` while a canvas
|
|
99
|
+
is open.
|
|
100
|
+
|
|
101
|
+
## Reload replaces the URL
|
|
102
|
+
|
|
103
|
+
Reloading forks a new process and hands back a **new** URL; the tab the person
|
|
104
|
+
had open dies with the old one. Two design consequences:
|
|
105
|
+
|
|
106
|
+
- Keep meaningful state on the server side of the canvas, not in the page. A
|
|
107
|
+
scroll position is fine to lose; a half-filled form is not.
|
|
108
|
+
- Give the person the new URL every time you reload, and say the old tab is
|
|
109
|
+
dead. A page that silently stopped updating looks like a bug you caused.
|
|
110
|
+
|
|
111
|
+
## Before you call it done
|
|
112
|
+
|
|
113
|
+
- Open it and look, rather than reasoning about the markup.
|
|
114
|
+
- Check both color schemes.
|
|
115
|
+
- Resize narrow — a canvas is often a side window, not a full screen.
|
|
116
|
+
- Invoke each action and confirm the page reflects it without a manual refresh.
|
|
117
|
+
- Confirm the page still renders with the network off.
|