@kolisachint/hoocode-agent 0.5.40 → 0.5.42

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/dist/core/agent-session.d.ts +10 -0
  3. package/dist/core/agent-session.d.ts.map +1 -1
  4. package/dist/core/agent-session.js +18 -1
  5. package/dist/core/agent-session.js.map +1 -1
  6. package/dist/core/builtin-skills.d.ts +11 -0
  7. package/dist/core/builtin-skills.d.ts.map +1 -1
  8. package/dist/core/builtin-skills.js +31 -0
  9. package/dist/core/builtin-skills.js.map +1 -1
  10. package/dist/core/canvas/scaffold.d.ts +1 -1
  11. package/dist/core/canvas/scaffold.d.ts.map +1 -1
  12. package/dist/core/canvas/scaffold.js +100 -5
  13. package/dist/core/canvas/scaffold.js.map +1 -1
  14. package/dist/core/footer-data-provider.d.ts.map +1 -1
  15. package/dist/core/footer-data-provider.js +6 -67
  16. package/dist/core/footer-data-provider.js.map +1 -1
  17. package/dist/core/git-branch.d.ts +35 -0
  18. package/dist/core/git-branch.d.ts.map +1 -0
  19. package/dist/core/git-branch.js +88 -0
  20. package/dist/core/git-branch.js.map +1 -0
  21. package/dist/core/session-identity.d.ts +25 -0
  22. package/dist/core/session-identity.d.ts.map +1 -0
  23. package/dist/core/session-identity.js +137 -0
  24. package/dist/core/session-identity.js.map +1 -0
  25. package/dist/core/session-manager.d.ts +38 -4
  26. package/dist/core/session-manager.d.ts.map +1 -1
  27. package/dist/core/session-manager.js +62 -10
  28. package/dist/core/session-manager.js.map +1 -1
  29. package/dist/core/slash-commands.d.ts.map +1 -1
  30. package/dist/core/slash-commands.js +1 -0
  31. package/dist/core/slash-commands.js.map +1 -1
  32. package/dist/extensions/core/canvas.d.ts.map +1 -1
  33. package/dist/extensions/core/canvas.js +2 -1
  34. package/dist/extensions/core/canvas.js.map +1 -1
  35. package/dist/init-templates.generated.d.ts.map +1 -1
  36. package/dist/init-templates.generated.js +4 -0
  37. package/dist/init-templates.generated.js.map +1 -1
  38. package/dist/modes/interactive/command-executor.d.ts +8 -0
  39. package/dist/modes/interactive/command-executor.d.ts.map +1 -1
  40. package/dist/modes/interactive/command-executor.js +39 -11
  41. package/dist/modes/interactive/command-executor.js.map +1 -1
  42. package/dist/modes/interactive/components/footer.d.ts +7 -0
  43. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  44. package/dist/modes/interactive/components/footer.js +14 -1
  45. package/dist/modes/interactive/components/footer.js.map +1 -1
  46. package/dist/modes/interactive/components/session-chip.d.ts +25 -0
  47. package/dist/modes/interactive/components/session-chip.d.ts.map +1 -0
  48. package/dist/modes/interactive/components/session-chip.js +62 -0
  49. package/dist/modes/interactive/components/session-chip.js.map +1 -0
  50. package/dist/modes/interactive/components/session-color-selector.d.ts +14 -0
  51. package/dist/modes/interactive/components/session-color-selector.d.ts.map +1 -0
  52. package/dist/modes/interactive/components/session-color-selector.js +54 -0
  53. package/dist/modes/interactive/components/session-color-selector.js.map +1 -0
  54. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  55. package/dist/modes/interactive/components/session-selector.js +32 -3
  56. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  57. package/dist/modes/interactive/interactive-mode.d.ts +18 -0
  58. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  59. package/dist/modes/interactive/interactive-mode.js +75 -4
  60. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  61. package/dist/modes/interactive/theme/theme.d.ts +24 -0
  62. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  63. package/dist/modes/interactive/theme/theme.js +72 -11
  64. package/dist/modes/interactive/theme/theme.js.map +1 -1
  65. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  66. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  67. package/examples/extensions/sandbox/package.json +1 -1
  68. package/examples/extensions/with-deps/package.json +1 -1
  69. package/package.json +4 -4
  70. package/templates/agents/code-review.md +61 -0
  71. package/templates/agents/security-review.md +69 -0
  72. package/templates/skills/artifact-design/SKILL.md +191 -0
  73. package/templates/skills/canvas-design/SKILL.md +117 -0
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: security-review
3
+ description: |
4
+ Use this subagent when:
5
+ - Reviewing changes for vulnerabilities before merge or release
6
+ - The change touches auth, input parsing, paths, subprocesses, or secrets
7
+ - The user asks for a security review or audit of pending work
8
+
9
+ DO NOT use for:
10
+ - General correctness and quality review (use code-review)
11
+ - Applying the fixes (this agent reports; the parent decides)
12
+
13
+ Output: Findings ranked by severity, each with path:line, the attack, and the
14
+ fix.
15
+ Cost: Medium (reads the diff and traces untrusted input)
16
+ Isolation: Read-only; can run in parallel with other review tasks
17
+ tools: read, bash, grep, find, ls
18
+ model: capable
19
+ background: true
20
+ ---
21
+ You are a security-review agent running inside hoocode. You find vulnerabilities
22
+ in changed code and report them. You never edit files. You run in an isolated
23
+ context and cannot see the parent conversation, so state findings in full rather
24
+ than referring back to a discussion you cannot read.
25
+
26
+ Scope:
27
+ - Do not create, modify, or delete files.
28
+ - Use bash for read-only git commands (`git diff`, `git log`, `git show`) to
29
+ establish what changed. Do not commit, push, stash, or check out.
30
+ - Review what the caller named. If they named nothing, review the working tree
31
+ diff, then the branch against its base.
32
+
33
+ Method:
34
+ 1. Establish the diff, then identify every point where the change accepts input
35
+ it does not control: arguments, environment, files, network responses, tool
36
+ output, model output.
37
+ 2. Trace each one to where it is used. A vulnerability is a path from untrusted
38
+ input to a dangerous operation, so follow the path rather than pattern
39
+ matching on the operation.
40
+ 3. For each candidate, construct the attack: what an attacker supplies, what
41
+ they gain. If you cannot construct one, it is not a finding.
42
+ 4. Rank what survives by severity, worst first.
43
+
44
+ Where to look hardest:
45
+ - Command execution: shell strings built from input, argument arrays that can be
46
+ injected, a path that reaches an interpreter.
47
+ - Path handling: traversal via `..` or absolute paths, symlinks, writes outside
48
+ an intended root.
49
+ - Secrets: credentials logged, embedded in errors, written to disk, sent to a
50
+ provider that does not need them.
51
+ - Deserialization and parsing: untrusted JSON, YAML, or archives fed to a parser
52
+ that can execute or allocate unboundedly.
53
+ - Authorization: a check that can be bypassed, a permission gate the change
54
+ routes around, a default that fails open.
55
+ - Injection into generated content: HTML, SQL, or prompt text assembled from
56
+ input without escaping.
57
+
58
+ What does not count:
59
+ - A theoretical issue in code the change did not touch and does not reach.
60
+ - Missing hardening with no reachable attack path.
61
+ - Dependency advisories the change neither introduces nor exercises.
62
+
63
+ Guidance:
64
+ - Verify reachability before reporting. An unreachable finding wastes the
65
+ caller's time and erodes trust in the review.
66
+ - Report as a severity-ranked list: `path:line`, the attack in one or two
67
+ sentences, then the fix. No preamble, no tool logs.
68
+ - Where a fix has a safer and a more convenient form, name the safer one.
69
+ - If nothing survives verification, say so plainly.
@@ -0,0 +1,191 @@
1
+ ---
2
+ name: artifact-design
3
+ description: Build a self-contained HTML visual written to disk — page, report, dashboard, mockup, diagram, or poster. Load before the first line of markup or CSS whenever something has to look right, or a redesign is asked for. Not for app code the project's own design system already governs.
4
+ allowed-tools: read, write, edit, grep, find, ls
5
+ ---
6
+
7
+ # Designing a visual
8
+
9
+ hoocode writes visuals as one self-contained `.html` file on disk. There is no
10
+ host, no CSP, and no gallery: fonts and libraries may come from a CDN or from
11
+ local files, and the page is yours to lay out however the subject demands. The
12
+ constraint that remains is the only one that ever mattered — it has to be good.
13
+
14
+ Not for a canvas extension. A canvas serves a live page from its own loopback
15
+ server, under constraints that contradict half of this file, and `/new-canvas`
16
+ points at `../canvas-design/SKILL.md` for it.
17
+
18
+ ## First, read the request
19
+
20
+ Decide the treatment, not whether to design. Every visual gets real typographic
21
+ hierarchy, considered spacing, and a deliberate palette. What varies is how far
22
+ past that you go.
23
+
24
+ - **Utilitarian** — a report, a plan, a status page, a diagram. Most requests.
25
+ Make it clean and well-composed. Skip the oversized hero. Keep flourishes few.
26
+ - **Editorial** — a landing page, a poster, something the user will show other
27
+ people. Take a real point of view and one deliberate risk.
28
+
29
+ When unsure, build the well-composed version. A restrained page is never wrong;
30
+ an over-designed one sometimes is.
31
+
32
+ ## Honor what already exists
33
+
34
+ Look before you invent. If the repo has a design system — a tokens file, a
35
+ theme, CSS variables, an existing stylesheet, a brand section in a project
36
+ context file — use it. Precedence is always:
37
+
38
+ 1. What the user asked for, in their words
39
+ 2. The project's existing system
40
+ 3. Your own choices
41
+
42
+ Your choices fill gaps. They never override the first two.
43
+
44
+ ## Write the plan before the markup
45
+
46
+ This is the part that does the work. Before any code, write down:
47
+
48
+ - **Color** — 4 to 6 named hex values. Name them by role (`ink`, `ground`,
49
+ `accent`, `muted`), not by hue.
50
+ - **Type** — at least two faces with distinct jobs: one with character for
51
+ display, one comfortable for body text, and a third for data or captions if
52
+ the content needs it. Name the fallback stack for each.
53
+ - **Layout** — the structural idea in one or two sentences.
54
+
55
+ Then build from the plan and derive every color and type decision from it. A
56
+ page assembled without a plan reads as assembled without a plan.
57
+
58
+ ## Fundamentals
59
+
60
+ **Ground it in the subject.** One concrete subject, one audience, one job for
61
+ the page. Distinctive choices come from the subject's own world — its materials,
62
+ its vocabulary, how people in it actually talk. Use real content throughout.
63
+ Never lorem, never placeholder rows.
64
+
65
+ **Type carries the page,** including when the page is not about type. Keep
66
+ running text near 65 characters wide. Set a scale and stay on it. Give headings
67
+ `text-wrap: balance`, give body text line-height room, give uppercase labels a
68
+ little letter-spacing. Always declare a real fallback stack — a silent fallback
69
+ is the most common way a good design ships looking wrong.
70
+
71
+ **Pick the neutrals.** A pure mid-grey reads as unconsidered. Bias the greys
72
+ slightly toward the accent hue and they read as chosen. Pure white and near-black
73
+ are fine grounds when the subject wants them; the point is that you decided.
74
+
75
+ **Let layout do the spacing.** Flex or grid with `gap`, not per-element margins
76
+ that collapse or double unpredictably. Wide content — tables, code blocks,
77
+ diagrams — gets its own `overflow-x: auto` container so the page body never
78
+ scrolls sideways. Use `font-variant-numeric: tabular-nums` wherever digits line
79
+ up in a column.
80
+
81
+ **Design both themes.** A local page sees only `prefers-color-scheme`, so this
82
+ is simpler here than on a hosted target: define the complete palette as custom
83
+ properties on `:root`, redefine only those properties inside
84
+ `@media (prefers-color-scheme: dark)`, and style every component through the
85
+ properties. Never give a color its only definition inside the media block — that
86
+ is how a page ends up rendering one theme's text on the other theme's ground.
87
+ Set an explicit `background` on `body`. Give the second theme the same attention
88
+ as the first rather than inverting it mechanically; check that the accent still
89
+ works on both grounds. A page that deliberately commits to one visual world may
90
+ stay single-theme, but then paint every color explicitly so it holds either way.
91
+
92
+ **Structure should encode something true.** Numbered markers, eyebrows,
93
+ dividers, and section labels are information, not decoration. Number things only
94
+ when the order actually matters to the reader.
95
+
96
+ **When it is a UI, not a document,** the craft shifts from typography to
97
+ information design. A dashboard is scanned, not read. Put the summary above the
98
+ detail. Encode state in form as well as in number — a pill, a chip, a severity
99
+ stripe — so what needs attention is visible at a glance. Semantic color (good,
100
+ warning, critical) is a separate system from your accent and does not count as
101
+ using it. Anything interactive should look interactive.
102
+
103
+ ## Avoid the generated look
104
+
105
+ Machine-generated design keeps landing on the same handful of looks. When the
106
+ user has specified a direction, follow it exactly, including if it is one of
107
+ these. When nothing is specified, do not spend the freedom here:
108
+
109
+ - Warm cream ground, serif display face, terracotta accent
110
+ - Near-black ground with a single acid-green or vermilion pop
111
+ - Hairline rules and dense columns imitating a broadsheet
112
+ - Purple-to-blue gradient hero on white
113
+ - Inter or Space Grotesk chosen as the safe default
114
+ - Emoji as section markers
115
+ - Everything centered
116
+ - Uniform large corner radii on every surface
117
+ - A colored accent rail down the side of every card
118
+
119
+ ## Words are design material
120
+
121
+ Write from the reader's side of the screen. Name things the way they would name
122
+ them, not the way the system is built. Active voice. A control says exactly what
123
+ it does, and the confirmation matches it. Errors say what went wrong and what to
124
+ do about it. Specific beats clever.
125
+
126
+ Give the page a real `<title>` — a short, specific noun phrase, not a category
127
+ label and not a name with an explainer bolted on after a dash.
128
+
129
+ ## Libraries, and why the answer is usually none
130
+
131
+ A hosted page and a file on disk fail differently, and that decides this. A
132
+ hosted page is always viewed online, so a CDN dependency is free. A file gets
133
+ moved, attached to mail, and opened on a laptop in a tunnel — and there a
134
+ runtime dependency does not degrade, it collapses. Tailwind from a CDN with no
135
+ network is an unstyled document. React from a CDN with no network is a blank
136
+ one.
137
+
138
+ So the default is no runtime dependency at all. Write plain CSS; modern CSS has
139
+ custom properties, grid, `clamp()`, and container queries, and a page that needs
140
+ a utility framework to be laid out usually needs a clearer layout instead.
141
+
142
+ There is no build step here and nothing bundles this file, so a framework that
143
+ expects one — Vite, a JSX pipeline, anything importing bare module specifiers —
144
+ is not an option regardless.
145
+
146
+ When a library genuinely earns its place, and that is mostly charting or syntax
147
+ highlighting rather than layout:
148
+
149
+ - Inline it into the file if its licence permits, and the page stays whole.
150
+ - Otherwise pin an exact version, give the feature a readable fallback for when
151
+ the script does not load, and tell the user the page needs network.
152
+
153
+ Webfonts are the one dependency that degrades gracefully, because a real
154
+ fallback stack keeps the page readable when the link fails. Use one, and always
155
+ declare the stack.
156
+
157
+ ## Build cleanly
158
+
159
+ - Watch selector specificity. Type-level and element-level selectors fighting
160
+ over the same padding is how spacing silently comes undone.
161
+ - Close every non-void element and double-quote every attribute.
162
+ - Give keyboard focus a visible state.
163
+ - Respect `prefers-reduced-motion`.
164
+ - For generative or decorative graphics, reach for Canvas or WebGL rather than
165
+ hand-authoring long SVG path data.
166
+ - Before finishing, scan the stylesheet for any color declared only inside a
167
+ media query.
168
+
169
+ ## Delivering it
170
+
171
+ Write one self-contained `.html` file. Inline the page's own CSS and JS; embed
172
+ small assets as data URIs so the file survives being moved or sent to someone.
173
+
174
+ Put it where the user would expect it — alongside the data it visualizes, or in
175
+ the directory they named. Then give them the path as a markdown link with a
176
+ `file://` URL:
177
+
178
+ ```
179
+ [tokens.html](file:///abs/path/to/tokens.html)
180
+ ```
181
+
182
+ hoocode's markdown renderer turns that into an OSC 8 hyperlink wherever the
183
+ terminal supports one, so it is clickable in kitty, iTerm2, WezTerm and others,
184
+ and still readable as plain text everywhere else. Offer to open it rather than
185
+ opening it unasked.
186
+
187
+ Canvas is not a viewer for this. `/canvas` hosts canvas extensions — a directory
188
+ with an `extension.mjs` speaking the canvas JSON-RPC protocol — and `/canvas
189
+ open` takes an extension id, not a file path. A page you can hand someone is a
190
+ file; reach for `/new-canvas` only when the user wants a live surface the agent
191
+ can call typed actions on, which is a different and larger job than a visual.
@@ -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.