@useavalon/caelence-agent 0.1.0 → 0.1.1-canary.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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +129 -137
  3. package/brand/logo/favicon-agent-bg-16.svg +7 -0
  4. package/brand/logo/favicon-agent-bg-32.svg +7 -0
  5. package/brand/previews/desktop-chat.png +0 -0
  6. package/brand/previews/desktop-commands.png +0 -0
  7. package/brand/previews/desktop-integrations.png +0 -0
  8. package/brand/previews/desktop-skills.png +0 -0
  9. package/package.json +5 -3
  10. package/skills/impeccable/LICENSE +13 -0
  11. package/skills/impeccable/NOTICE +14 -0
  12. package/skills/impeccable/SKILL.md +2 -1
  13. package/src/agent-cwd.ts +51 -0
  14. package/src/cli/agent-cwd.test.ts +65 -0
  15. package/src/cli/main.test.ts +5 -0
  16. package/src/cli/main.ts +282 -201
  17. package/src/cli/picker.test.ts +59 -1
  18. package/src/cli/picker.ts +46 -0
  19. package/src/cli/slash-dispatch.test.ts +116 -7
  20. package/src/cli/slash-dispatch.ts +343 -174
  21. package/src/cli/slash.test.ts +25 -2
  22. package/src/cli/slash.ts +37 -8
  23. package/src/cli/theme.test.ts +7 -0
  24. package/src/cli/theme.ts +6 -6
  25. package/src/cli/tui.tsx +385 -217
  26. package/src/config.ts +1 -1
  27. package/src/core/strands.ts +10 -1
  28. package/src/desktop/bridge.test.ts +56 -1
  29. package/src/desktop/bridge.ts +527 -390
  30. package/src/desktop/uploads.test.ts +57 -0
  31. package/src/desktop/uploads.ts +92 -0
  32. package/src/index.ts +26 -2
  33. package/src/init.test.ts +19 -2
  34. package/src/init.ts +25 -17
  35. package/src/integrations/loopback.test.ts +17 -0
  36. package/src/integrations/loopback.ts +91 -0
  37. package/src/observability/prompts.ts +1 -1
  38. package/src/product.ts +3 -1
  39. package/src/runtime.test.ts +24 -0
  40. package/src/runtime.ts +48 -5
  41. package/src/skills/catalog.test.ts +188 -0
  42. package/src/skills/catalog.ts +279 -0
  43. package/src/skills/disabled.test.ts +27 -0
  44. package/src/skills/disabled.ts +59 -0
  45. package/src/skills/loader.test.ts +31 -0
  46. package/src/skills/loader.ts +31 -4
  47. package/src/skills/registry.test.ts +64 -3
  48. package/src/skills/registry.ts +248 -93
  49. package/src/skills/skill-command.ts +2 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 useAvalon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,201 +1,193 @@
1
- # @useavalon/caelence-agent
1
+ <p align="center">
2
+ <img src="brand/logo/favicon-agent-bg-32.svg" alt="Caelence agent" width="96" height="96" />
3
+ </p>
2
4
 
3
- Caelence agent: a Strands turn loop, local filesystem tools, Cursor-style skills, eval suites, and a themable terminal UI. Hosts add their own skills, sandboxes, and product rules. This package does not import them.
5
+ # Caelence agent
6
+
7
+ A coding agent on this machine
8
+
9
+ Desktop app, or the terminal.
10
+
11
+ [`@useavalon/caelence-agent`](https://www.npmjs.com/package/@useavalon/caelence-agent) on npm. Needs [Bun](https://bun.sh) 1.2 or later.
4
12
 
5
13
  ## Install
6
14
 
7
15
  ```bash
8
- bun add github:useAvalon/caelence-agent
9
- # or, once published to npm
10
- bun add @useavalon/caelence-agent
16
+ bun add -g @useavalon/caelence-agent
17
+ caelence desktop
11
18
  ```
12
19
 
13
- Global CLI:
20
+ `caelence desktop` opens the OS window. Paste an OpenRouter key in **Settings** after it opens. You do not need to export `OPENROUTER_API_KEY` in the terminal. The window needs [Rust](https://rustup.rs).
14
21
 
15
- ```bash
16
- bun add -g github:useAvalon/caelence-agent
17
- harness
18
- ```
22
+ <p align="center">
23
+ <img src="brand/previews/desktop-chat.png" alt="Desktop chat" width="720" />
24
+ </p>
19
25
 
20
- ## Host project
26
+ Or the terminal:
21
27
 
22
28
  ```bash
23
- bunx harness init
29
+ caelence
24
30
  ```
25
31
 
26
- Writes `harness.config.ts`, `AGENTS.md`, a sample skill, and a smoke eval. Then:
32
+ `caelence` opens the terminal UI. Paste an OpenRouter key with `/settings key <token>`. In a git repo, that repo is the workspace. `--cwd` picks a folder. `caelence-agent` and `harness` are the same CLI.
27
33
 
28
- ```bash
29
- export OPENROUTER_API_KEY=…
30
- harness
31
- ```
34
+ ## Config
32
35
 
33
- | File | Role |
34
- |------|------|
35
- | `harness.config.ts` | Name, model, mode, skill/eval dirs, theme, exec approval, hooks |
36
- | `skills/**/SKILL.md` | Cursor-style skills (YAML `name` / `description`) |
37
- | `evals/<suite>/eval.ts` | Eval suites (`export default { name, steps }`) |
38
- | `AGENTS.md` | Project instructions (stacked under user instructions) |
39
- | `~/.harness/AGENTS.md` | User instructions for every host (`HARNESS_USER_INSTRUCTIONS` overrides the path) |
40
- | `.harness/sessions/` | JSON session logs (gitignored) |
36
+ Optional. Without `harness.config.ts`, these defaults apply.
41
37
 
42
38
  ```ts
43
39
  import type { HarnessConfig } from "@useavalon/caelence-agent";
44
40
 
45
41
  export default {
46
- name: "my-agent",
47
- model: "~x-ai/grok-latest",
48
- instructionsFile: "AGENTS.md",
49
- skillsDir: "skills",
50
- evalsDir: "evals",
51
- theme: "caelence",
52
- mode: "agent",
53
- tools: { exec: { approval: "prompt" } },
54
- mcp: [],
55
- // hooks: [{ event: "pre_tool", command: "jq -e .toolName" }],
42
+ name: "my-agent",
43
+ model: "openrouter/auto",
44
+ instructionsFile: "AGENTS.md",
45
+ skillsDir: "skills",
46
+ evalsDir: "evals",
47
+ theme: "caelence",
48
+ mode: "agent",
49
+ tools: { exec: { approval: "prompt" } },
50
+ mcp: [],
56
51
  } satisfies HarnessConfig;
57
52
  ```
58
53
 
59
- Env: `OPENROUTER_API_KEY`, optional `OPENROUTER_MODEL`, `OPENROUTER_BASE_URL`.
54
+ | File | Role |
55
+ |------|------|
56
+ | `harness.config.ts` | Name, model, mode, skills, evals, theme, approvals |
57
+ | `skills/**/SKILL.md` | Skills the agent can load |
58
+ | `evals/<suite>/eval.ts` | Eval suites |
59
+ | `AGENTS.md` | Project instructions |
60
+ | `~/.harness/AGENTS.md` | User instructions for every project |
61
+ | `.harness/sessions/` | Session logs |
62
+ | `~/.harness/integrations.json` | Connected hosted MCP servers |
63
+
64
+ Desktop Settings stores a key in `~/.harness`. Optional env: `OPENROUTER_API_KEY`, `OPENROUTER_MODEL`, `OPENROUTER_BASE_URL`. In the TUI, `/settings key <token>` does the same.
60
65
 
61
- Optional Langfuse tracing (server/CLI only — never set these in a browser):
66
+ ## Commands
62
67
 
63
68
  ```
64
- LANGFUSE_SECRET_KEY=
65
- LANGFUSE_PUBLIC_KEY=
66
- LANGFUSE_BASE_URL=
67
- CAELENCE_AGENT_VERSION= # optional; defaults to the package version
69
+ caelence desktop Desktop window (needs Rust)
70
+ caelence Terminal UI
71
+ caelence chat -m "…" One turn, then exit (no TUI)
72
+ caelence --mode plan Start the TUI in plan mode
73
+ caelence eval [name] Run an eval suite, or list suites
74
+ caelence experiment Local website-generation regression (no Langfuse)
75
+ caelence init Add .harness/ to .gitignore
76
+ caelence skill find [query] Bundled skills and popular skills.sh
77
+ caelence skill add <src> Install into ~/.harness/skills
78
+ caelence skill remove <name> Uninstall a user skill, or disable a project skill
79
+ caelence help This list
68
80
  ```
69
81
 
70
- When both Langfuse keys are set, each chat turn, tool call, subagent, and eval run is traced. With keys unset the observer is a no-op. Set `observability: { enabled: false }` in `harness.config.ts` to force it off.
71
-
72
- Set `LANGFUSE_QUALITY_EVAL=1` to run the optional LLM-as-judge after a turn (OpenRouter spend). Leave it unset otherwise.
82
+ Flags: `--mode ask|plan|agent`, `--cwd <path>`, `-m` / `--message <text>`. `caelence init --examples` writes a host scaffold (`--name` sets the config name).
73
83
 
74
- ```
75
- harness experiment Run the local website-generation-regression dataset
76
- ```
84
+ `caelence chat -m "…"` runs one turn, prints the reply (and tool lines), then exits. For a script or CI: no desktop, no TUI. `--mode` still applies. Without a TTY, tool approval is deny.
77
85
 
78
- Documented quality gates live in `DEFAULT_GATES` (`build_success >= 0.98`, and later instruction/visual thresholds). They are config, not CI fail rules, until baselines exist. Full Agent_Layer + Daytona runs stay opt-in / nightly.
86
+ Type `/` for slash commands. Tab completes in the terminal UI.
79
87
 
80
- ## Commands
88
+ <p align="center">
89
+ <img src="brand/previews/desktop-commands.png" alt="Desktop slash commands" width="720" />
90
+ </p>
81
91
 
82
92
  ```
83
- harness Fullscreen terminal UI
84
- harness --mode plan Start in plan mode
85
- harness chat -m "…" One-shot turn (non-TTY denies exec)
86
- harness eval [name] Run or list eval suites
87
- harness experiment Run the local regression dataset
88
- harness init Scaffold host files
89
- harness desktop Open the Tauri app window
93
+ /help this list
94
+ /skills loaded skills
95
+ /skill find [q] browse bundled and skills.sh
96
+ /skill add install a bundled or skills.sh skill
97
+ /skill new author a project skill
98
+ /skill remove remove a user skill
99
+ /integrations connect MCP servers
100
+ /eval [name] run an eval suite
101
+ /clear new session
102
+ /resume pick a session by title
103
+ /model pick a model
104
+ /mode ask, plan, or agent
105
+ /compact summarize earlier turns
106
+ /image [prompt] generate an image
107
+ /video [prompt] generate a clip
108
+ /transcribe speech to text model
109
+ /settings OpenRouter API key
110
+ /exit quit
90
111
  ```
91
112
 
92
- Type `/` in the terminal for a command list (tab completes, arrows move). `--help` as a chat line is treated as `/help` so it does not go to the model.
113
+ `/skill add --project <name>` writes into the project `skillsDir`. `/skill new <name> <what it should do>` authors a project skill from a brief.
93
114
 
94
- `/resume` and `/model` open a list. Tab or arrows move, enter chooses. Sessions show their title, not the file id. `/resume billing` also matches a title; `/resume 2` is the second row.
115
+ ## Skills
95
116
 
96
- `/skills` prints names only.
117
+ A skill is a `SKILL.md` with YAML `name` and `description`. Skills in `~/.harness/skills` and in the project load; the project wins on name clash. Bundled skills and skills.sh are a catalog: add one and it starts working. The agent also reads `skills/`, `.cursor/skills`, and `.claude/skills` when those folders exist. Disable a project skill from `/skill find` to keep the file and drop it from the prompt.
97
118
 
98
- Install from [skills.sh](https://skills.sh) into the harness user store (`~/.harness/skills`, or `HARNESS_USER_SKILLS`). That does not write into the repo:
119
+ <p align="center">
120
+ <img src="brand/previews/desktop-skills.png" alt="Desktop skills" width="720" />
121
+ </p>
99
122
 
100
- ```
101
- /skill find
102
- /skill add copywriting
103
- /skill add impeccable
104
- /skill add anthropics/skills@frontend-design
105
- /skill remove copywriting
106
- ```
123
+ | Add | What you get |
124
+ |------|------|
125
+ | `copywriting` | One writing pipeline: RMBC, Harry Dry, then copy-editor. No invented metrics or testimonials. |
126
+ | `impeccable` | Visual QA against the host `design.md` (Apache 2.0 adaptation) |
107
127
 
108
- `/skill add --project <name>` writes into the host `skillsDir` instead. `/skill new <name> <what it should do>` still authors a project skill from a brief.
128
+ ## Integrations
109
129
 
110
- Skills are portable Agent Skill files (`SKILL.md` + YAML `name` / `description`). Load order: user (`~/.harness/skills`), then host (host wins). The package catalog is not loaded until you add a skill. The harness also reads `skills/`, `.cursor/skills`, and `.claude/skills` when those folders exist.
130
+ Hosted MCP servers the agent can call. Connect from the desktop sidebar or `/integrations`. Sign-in is in the browser; those tools show up on the next turn.
111
131
 
112
- `harness` (no args) is a fullscreen terminal UI: alternate screen, sticky composer, session rail when the terminal is wide. Same idea as Claude Code. It is not a browser tab.
132
+ <p align="center">
133
+ <img src="brand/previews/desktop-integrations.png" alt="Desktop integrations" width="720" />
134
+ </p>
113
135
 
114
- `/settings` shows whether an OpenRouter key is stored. `/settings key <token>` writes it to `~/.harness`. `/resume` picks a session by title.
136
+ | Connect | Needs |
137
+ |------|------|
138
+ | Hosted server | Browser sign-in |
139
+ | Google or Microsoft | Desktop OAuth client in Settings |
140
+ | Figma | Dev Mode MCP in Figma desktop |
115
141
 
116
- `harness desktop` is the optional OS window. Same runtime. Rust (`rustup`) and bun are required.
142
+ Connections are stored in `~/.harness/integrations.json`. Disconnect removes that row.
117
143
 
118
- ```
119
- harness
120
- harness desktop
121
- ```
144
+ `mcp` in `harness.config.ts` adds local stdio servers (`command`, `args`, `env`) for this project.
122
145
 
123
146
  ## Modes
124
147
 
125
148
  | Mode | Tools |
126
- |------|--------|
127
- | `ask` | `read_file`, `glob`, `grep`, `read_skill`, `git_status`, `git_diff`, `git_log` |
128
- | `plan` | ask plus `todo_write` |
129
- | `agent` | all tools, including writes, `exec`, `git_commit`, and `task` |
130
-
131
- Switch in the TUI with `/mode ask`, `/mode plan`, or `/mode agent`. The header shows the current mode. Token counts (and USD only when the provider reports a cost) appear there after a turn.
132
-
133
- ## Git
134
-
135
- Prefer `git_status`, `git_diff`, and `git_log` over `exec`. `git_commit` needs approval, commits listed paths or already-staged files, and does not push. Paths stay under the project root.
149
+ |------|------|
150
+ | `ask` | Read, search, git status / diff / log |
151
+ | `plan` | Ask plus `todo_write` |
152
+ | `agent` | Writes, `exec`, `git_commit`, and `task` |
136
153
 
137
- `exec` and `git_commit` are gated. Default policy is `prompt` (y / n / always this session). `auto` still denies destructive commands. Local exec is the host, not a sandbox.
154
+ `/mode ask`, `/mode plan`, or `/mode agent`. `exec` and `git_commit` ask for approval by default (`prompt`). `auto` still denies destructive commands. Local exec is the host machine, not a sandbox.
138
155
 
139
- ## Hooks
156
+ ## Library
140
157
 
141
- Optional `hooks` in `harness.config.ts`. Each hook is a shell command. JSON on stdin. `pre_tool` with a nonzero exit denies the call (stderr is the reason). Spawn failure fails open.
158
+ The desktop, TUI, and `caelence chat -m` all call `createHarness`. Call it from your own UI, bot, or script.
142
159
 
160
+ ```bash
161
+ bun add @useavalon/caelence-agent
143
162
  ```
144
- session_start After the runtime starts
145
- pre_tool Before a tool runs. Nonzero exit denies
146
- post_tool After a tool finishes
147
- ```
148
-
149
- User and project instruction files stack. Project `AGENTS.md` does not replace `~/.harness/AGENTS.md`.
150
-
151
- ## Subagents
152
-
153
- The parent agent has a `task` tool. It runs a nested turn with the same local tools except `task` (no recursive spawn). Optional `skills` injects those skill bodies into the subagent. Nested sessions stay in memory and do not appear in `/resume`.
154
-
155
- Use it for one copy-pipeline step, isolated research, or a bounded edit. Not for a one-line question.
156
-
157
- ## Optional catalog skills
158
-
159
- The package ships a generic writing pipeline and a visual-QA skill. They are not loaded until you add them:
160
-
161
- - `/skill add copywriting` — router plus `copy-rmbc`, `copy-harry-dry`, `copy-editor`
162
- - `/skill add copy-editor` — that step only, including `references/anti-slop.md`
163
- - `/skill add impeccable` — visual QA (critique / polish / audit). Honor the host `design.md`. Not copy.
164
-
165
- `/skill remove copywriting` drops the writing pack. Host `skills/` of the same name still win. Read loaded skills with `read_skill`. Invented metrics and testimonials stay illegal.
166
-
167
- A host can add its own skills in `skills/`, `.cursor/skills`, or `.claude/skills`. Those are not shipped here.
168
-
169
- ## Library
170
163
 
171
164
  ```ts
172
- import { createHarness, loadSkills, runEvalSuite } from "@useavalon/caelence-agent";
173
- ```
165
+ import { createHarness } from "@useavalon/caelence-agent";
174
166
 
175
- Agent events use these kinds: `text_delta`, `tool_call_*`, `approval_request`, `session_meta`, `usage`, `todos`, `error`, `completion`.
167
+ const harness = await createHarness({ cwd: process.cwd() });
168
+ await harness.runTurn("fix the failing test", (event) => {
169
+ if (event.kind === "text_delta") process.stdout.write(event.text);
170
+ if (event.kind === "tool_call_start") process.stderr.write(`› ${event.toolName}\n`);
171
+ });
172
+ harness.close();
173
+ ```
176
174
 
177
- ## Publish
175
+ `runTurn` streams `AgentEvent`s (text, tools, usage, errors) and writes the session under `.harness/sessions`. Optional: `config`, `mode`, `provider`, `extraTools`, `approvalPolicy`, `observability`.
178
176
 
179
- The package ships TypeScript source for Bun. CI on `main` and pull requests runs Biome, `tsc --noEmit`, and `bun run test`.
177
+ You can pass a custom model provider in tests. `extraTools` adds MCP tools of your own. `approvalAsk` on `runTurn` is how a host UI prompts for `exec` and `git_commit`.
180
178
 
181
- Publishing uses [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/), not a GitHub `NPM_TOKEN` secret. Classic npm tokens are revoked. After the first local publish (`npm login`, then `npm publish --access public`):
179
+ Other exports from the same package:
182
180
 
183
- 1. Open the package on npmjs.com → Settings → Trusted publishing
184
- 2. Add GitHub Actions for `useAvalon` / `caelence-agent` with workflow `release.yml` (allow `npm publish`)
185
- 3. Add a second publisher for `canary.yml`
186
- 4. Optionally set publishing access to require 2FA and disallow tokens
181
+ | Import | Use |
182
+ |------|------|
183
+ | `HarnessConfig`, `loadConfig` | Typed `harness.config.ts` |
184
+ | `createOpenRouterChat` | OpenRouter chat without the full agent |
185
+ | `EvalSuite`, `runNamedEval` | Eval suites under `evals/` |
186
+ | `initHost` | Add `.harness/` to `.gitignore`. `examples: true` writes a host scaffold |
187
+ | `@useavalon/caelence-agent/observability` | Langfuse, gates, `runLocalExperiment` |
187
188
 
188
- Until the package exists on the registry, canary is a no-op. Release still dry-runs without a publisher.
189
+ Config types and observability do not require `createHarness`.
189
190
 
190
- | Workflow | When |
191
- |------|--------|
192
- | `CI` | Push or PR to `main` |
193
- | `Canary Release` | Push to `main` that touches `src/`, `bin/`, or `skills/` |
194
- | `Release` | Manual. Channel: stable, beta, or rc. Default is dry-run |
191
+ ## License
195
192
 
196
- ```bash
197
- bun run lint
198
- bun run typecheck
199
- bun run test
200
- bun run check:exports
201
- ```
193
+ [MIT](LICENSE)
@@ -0,0 +1,7 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="16" height="16" rx="3" fill="#212227"/>
3
+ <path d="M3.25098 7.43878C3.23691 7.64059 3.40228 7.80519 3.60458 7.80519H8.00032V3C5.39648 3 3.42625 4.92544 3.25098 7.43878Z" fill="#FDFCF8"/>
4
+ <path d="M12.7474 3.36627C12.7637 3.16463 12.5982 2.99999 12.3959 2.99999H8.00017V7.80518C10.2723 7.80518 12.5439 5.87967 12.7474 3.36627Z" fill="#FDFCF8"/>
5
+ <path d="M3.25098 9.06122C3.23691 8.85941 3.40228 8.69481 3.60458 8.69481H8.00032V13.5C5.39648 13.5 3.42625 11.5746 3.25098 9.06122Z" fill="#FDFCF8"/>
6
+ <path d="M12.7474 13.1337C12.7637 13.3354 12.5982 13.5 12.3959 13.5H8.00017V8.69482C10.2723 8.69482 12.5439 10.6203 12.7474 13.1337Z" fill="#FDFCF8"/>
7
+ </svg>
@@ -0,0 +1,7 @@
1
+ <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="32" height="32" rx="5" fill="#212227"/>
3
+ <path d="M6.50197 14.8776C6.47382 15.2812 6.80456 15.6104 7.20916 15.6104H16.0006V6C10.793 6 6.85251 9.85089 6.50197 14.8776Z" fill="#FDFCF8"/>
4
+ <path d="M25.4948 6.73255C25.5275 6.32926 25.1964 5.99998 24.7918 5.99998H16.0003V15.6104C20.5445 15.6104 25.0877 11.7593 25.4948 6.73255Z" fill="#FDFCF8"/>
5
+ <path d="M6.50197 18.1224C6.47382 17.7188 6.80456 17.3896 7.20916 17.3896H16.0006V27C10.793 27 6.85251 23.1491 6.50197 18.1224Z" fill="#FDFCF8"/>
6
+ <path d="M25.4948 26.2675C25.5275 26.6707 25.1964 27 24.7918 27H16.0003V17.3896C20.5445 17.3896 25.0877 21.2407 25.4948 26.2675Z" fill="#FDFCF8"/>
7
+ </svg>
Binary file
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@useavalon/caelence-agent",
3
- "version": "0.1.0",
3
+ "version": "0.1.1-canary.1",
4
4
  "description": "Caelence agent: Strands turn loop, local tools, skills, evals, and a themable terminal UI.",
5
5
  "type": "module",
6
- "license": "UNLICENSED",
6
+ "license": "MIT",
7
7
  "author": "useAvalon",
8
8
  "repository": {
9
9
  "type": "git",
@@ -21,6 +21,7 @@
21
21
  },
22
22
  "bin": {
23
23
  "harness": "./bin/harness.ts",
24
+ "caelence": "./bin/harness.ts",
24
25
  "caelence-agent": "./bin/harness.ts"
25
26
  },
26
27
  "exports": {
@@ -32,11 +33,12 @@
32
33
  "bin",
33
34
  "src",
34
35
  "skills",
36
+ "brand",
35
37
  "README.md"
36
38
  ],
37
39
  "scripts": {
38
40
  "start": "bun bin/harness.ts",
39
- "test": "bun test src/core src/tools src/skills src/evals src/cli src/observability src/desktop src/integrations src/media src/init.test.ts src/runtime.test.ts desktop/src/rich-text.test.ts desktop/src/stream.test.ts desktop/src/dictation.test.ts desktop/src/thought.test.ts",
41
+ "test": "bun test src/core src/tools src/skills src/evals src/cli src/observability src/desktop src/integrations src/media src/init.test.ts src/runtime.test.ts desktop/src/rich-text.test.ts desktop/src/stream.test.ts desktop/src/dictation.test.ts desktop/src/thought.test.ts desktop/src/queue.test.ts desktop/src/composer-files.test.ts",
40
42
  "typecheck": "bunx tsc --noEmit -p tsconfig.json",
41
43
  "lint": "biome ci .",
42
44
  "format": "biome format --write .",
@@ -0,0 +1,13 @@
1
+ Copyright 2025 Paul Bakaus
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,14 @@
1
+ Impeccable
2
+ Copyright 2025 Paul Bakaus
3
+
4
+ This folder is a derivative of https://github.com/pbakaus/impeccable
5
+ licensed under the Apache License, Version 2.0. See LICENSE.
6
+
7
+ Trademark: the name Impeccable is used only to describe the origin of
8
+ the work. This is not an official Impeccable distribution.
9
+
10
+ Modifications for Caelence agent:
11
+ - Rewritten as SKILL.md for this agent (no npm installer, no /impeccable binary)
12
+ - Host design.md is visual authority
13
+ - Copy pipeline (copywriting) is out of scope here
14
+ - Visual-slop list kept as references/visual-slop.md
@@ -12,7 +12,8 @@ description: >-
12
12
  # Impeccable checks
13
13
 
14
14
  Adapted from [Impeccable](https://github.com/pbakaus/impeccable) (Apache 2.0,
15
- Copyright 2025 Paul Bakaus). This skill is **not** a vendor of that repository.
15
+ Copyright 2025 Paul Bakaus). Modified for this agent. See `NOTICE` and
16
+ `LICENSE` in this folder. This skill is **not** a vendor of that repository.
16
17
 
17
18
  **Visual authority:** the host project's `docs/design.md` or `design.md` if
18
19
  either exists. Read it before changing UI. Do not dump a whole tokens file
@@ -0,0 +1,51 @@
1
+ import { existsSync, mkdirSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { dirname, resolve } from "node:path";
4
+ import { resolveConfigPath } from "./config.ts";
5
+ import { harnessHome } from "./desktop/secrets.ts";
6
+
7
+ export function standaloneWorkspaceDir(
8
+ env: Record<string, string | undefined> = process.env,
9
+ ): string {
10
+ return resolve(harnessHome(env), "workspace");
11
+ }
12
+
13
+ export function ensureStandaloneWorkspace(
14
+ env: Record<string, string | undefined> = process.env,
15
+ ): string {
16
+ const dir = standaloneWorkspaceDir(env);
17
+ mkdirSync(dir, { recursive: true });
18
+ return dir;
19
+ }
20
+
21
+ function isProjectRoot(dir: string): boolean {
22
+ if (resolveConfigPath(dir)) return true;
23
+ return existsSync(resolve(dir, ".git"));
24
+ }
25
+
26
+ /** Nearest git repo or harness.config, not the home directory. */
27
+ export function findProjectRoot(
28
+ start: string,
29
+ env: Record<string, string | undefined> = process.env,
30
+ ): string | undefined {
31
+ const home = resolve(env.HOME?.trim() || homedir());
32
+ let dir = resolve(start);
33
+ while (true) {
34
+ if (dir !== home && isProjectRoot(dir)) return dir;
35
+ const parent = dirname(dir);
36
+ if (parent === dir) return undefined;
37
+ dir = parent;
38
+ }
39
+ }
40
+
41
+ /** `--cwd` wins. Else a project root from `start`. Else `~/.harness/workspace`. */
42
+ export function resolveAgentCwd(input: {
43
+ start: string;
44
+ explicit?: string;
45
+ env?: Record<string, string | undefined>;
46
+ }): string {
47
+ const env = input.env ?? process.env;
48
+ const explicit = input.explicit?.trim();
49
+ if (explicit) return resolve(explicit);
50
+ return findProjectRoot(input.start, env) ?? ensureStandaloneWorkspace(env);
51
+ }
@@ -0,0 +1,65 @@
1
+ import { describe, expect, test } from "bun:test";
2
+ import { mkdir, rm, writeFile } from "node:fs/promises";
3
+ import { tmpdir } from "node:os";
4
+ import { join } from "node:path";
5
+ import {
6
+ ensureStandaloneWorkspace,
7
+ findProjectRoot,
8
+ resolveAgentCwd,
9
+ standaloneWorkspaceDir,
10
+ } from "../agent-cwd.ts";
11
+
12
+ async function tempDir(prefix: string): Promise<string> {
13
+ const dir = join(tmpdir(), `${prefix}${Date.now()}-${Math.random().toString(16).slice(2)}`);
14
+ await mkdir(dir, { recursive: true });
15
+ return dir;
16
+ }
17
+
18
+ describe("resolveAgentCwd", () => {
19
+ test("explicit --cwd wins", async () => {
20
+ const cwd = await tempDir("agent-cwd-explicit-");
21
+ try {
22
+ expect(resolveAgentCwd({ start: tmpdir(), explicit: cwd })).toBe(cwd);
23
+ } finally {
24
+ await rm(cwd, { recursive: true, force: true });
25
+ }
26
+ });
27
+
28
+ test("walks up to a git root", async () => {
29
+ const root = await tempDir("agent-cwd-git-");
30
+ const nested = join(root, "src", "cli");
31
+ try {
32
+ await mkdir(join(root, ".git"));
33
+ await mkdir(nested, { recursive: true });
34
+ expect(findProjectRoot(nested)).toBe(root);
35
+ expect(resolveAgentCwd({ start: nested })).toBe(root);
36
+ } finally {
37
+ await rm(root, { recursive: true, force: true });
38
+ }
39
+ });
40
+
41
+ test("uses harness.config.ts as a project root", async () => {
42
+ const root = await tempDir("agent-cwd-config-");
43
+ try {
44
+ await writeFile(join(root, "harness.config.ts"), "export default {}\n");
45
+ expect(findProjectRoot(root)).toBe(root);
46
+ } finally {
47
+ await rm(root, { recursive: true, force: true });
48
+ }
49
+ });
50
+
51
+ test("home is not a project even with .git", async () => {
52
+ const home = await tempDir("agent-cwd-home-");
53
+ const harnessHome = await tempDir("agent-cwd-home-harness-");
54
+ try {
55
+ await mkdir(join(home, ".git"));
56
+ const env = { HOME: home, HARNESS_HOME: harnessHome };
57
+ expect(findProjectRoot(home, env)).toBeUndefined();
58
+ expect(resolveAgentCwd({ start: home, env })).toBe(standaloneWorkspaceDir(env));
59
+ expect(ensureStandaloneWorkspace(env)).toBe(join(harnessHome, "workspace"));
60
+ } finally {
61
+ await rm(home, { recursive: true, force: true });
62
+ await rm(harnessHome, { recursive: true, force: true });
63
+ }
64
+ });
65
+ });
@@ -33,4 +33,9 @@ describe("parseCliArgs", () => {
33
33
  expect(parsed.mode).toBe("ask");
34
34
  expect(parsed.message).toBe("hello");
35
35
  });
36
+
37
+ test("marks --cwd as explicit", () => {
38
+ expect(parseCliArgs(["eval"]).cwdExplicit).toBe(false);
39
+ expect(parseCliArgs(["--cwd", "/tmp/proj", "eval"]).cwdExplicit).toBe(true);
40
+ });
36
41
  });