@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/src/config.ts CHANGED
@@ -29,7 +29,7 @@ export interface HarnessConfig {
29
29
  hooks?: HookConfig[];
30
30
  }
31
31
 
32
- export const DEFAULT_MODEL = "~x-ai/grok-latest";
32
+ export const DEFAULT_MODEL = "openrouter/auto";
33
33
  export const OPENROUTER_DEFAULT_BASE_URL = "https://openrouter.ai/api/v1";
34
34
 
35
35
  export const DEFAULT_CONFIG: HarnessConfig = {
@@ -154,6 +154,16 @@ export function constructOpenRouterProvider(options: {
154
154
  maxTokens?: number;
155
155
  sessionId?: () => string | undefined;
156
156
  }): MainModelProvider {
157
+ if (!options.apiKey.trim()) {
158
+ return {
159
+ kind: "openrouter",
160
+ modelId: options.model,
161
+ async *stream() {
162
+ yield { type: "error", message: "OPENROUTER_API_KEY is not set." };
163
+ yield { type: "done" };
164
+ },
165
+ };
166
+ }
157
167
  let lastUsage: TokenUsage | undefined;
158
168
  let reasoningSink: ((text: string) => void) | undefined;
159
169
  const model = new OpenAIModel({
@@ -163,7 +173,6 @@ export function constructOpenRouterProvider(options: {
163
173
  maxTokens: options.maxTokens ?? DEFAULT_MAIN_MODEL_MAX_TOKENS,
164
174
  params: {
165
175
  reasoning: { effort: "low", exclude: false },
166
- stream_options: { include_usage: true },
167
176
  },
168
177
  clientConfig: {
169
178
  baseURL: options.baseUrl.replace(/\/+$/, ""),
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "bun:test";
2
- import { mkdtemp, rm, writeFile } from "node:fs/promises";
2
+ import { mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises";
3
3
  import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { DEFAULT_CONFIG } from "../config.ts";
@@ -48,6 +48,7 @@ async function withBridge(
48
48
  const headers = { authorization: "Bearer test-token", "content-type": "application/json" };
49
49
  return {
50
50
  ready,
51
+ cwd,
51
52
  headers,
52
53
  async close() {
53
54
  await stop();
@@ -182,6 +183,30 @@ describe("desktop bridge", () => {
182
183
  }
183
184
  });
184
185
 
186
+ test("lists bundled skills without fetching skills.sh", async () => {
187
+ const ctx = await withBridge();
188
+ try {
189
+ const res = await fetch(`${ctx.ready.url}/skills`, { headers: ctx.headers });
190
+ expect(res.ok).toBe(true);
191
+ const body = (await res.json()) as {
192
+ bundled: Array<{ name: string; origin: string; status: string }>;
193
+ popular: Array<{ name: string; origin: string }>;
194
+ };
195
+ expect(
196
+ body.bundled.some((item) => item.name === "copywriting" && item.origin === "bundled"),
197
+ ).toBe(true);
198
+ expect(body.popular.some((item) => item.origin === "skills.sh")).toBe(true);
199
+ const missing = await fetch(`${ctx.ready.url}/skills/add`, {
200
+ method: "POST",
201
+ headers: ctx.headers,
202
+ body: JSON.stringify({}),
203
+ });
204
+ expect(missing.status).toBe(400);
205
+ } finally {
206
+ await ctx.close();
207
+ }
208
+ });
209
+
185
210
  test("lists MCP integrations without tokens", async () => {
186
211
  const ctx = await withBridge();
187
212
  try {
@@ -328,4 +353,34 @@ describe("desktop bridge", () => {
328
353
  await ctx.close();
329
354
  }
330
355
  });
356
+
357
+ test("saves turn attachments and allows an attachments-only message", async () => {
358
+ const ctx = await withBridge();
359
+ try {
360
+ const turn = await fetch(`${ctx.ready.url}/turn`, {
361
+ method: "POST",
362
+ headers: ctx.headers,
363
+ body: JSON.stringify({
364
+ message: "",
365
+ attachments: [
366
+ {
367
+ name: "note.txt",
368
+ mime: "text/plain",
369
+ data: Buffer.from("from the composer").toString("base64"),
370
+ },
371
+ ],
372
+ }),
373
+ });
374
+ expect(turn.ok).toBe(true);
375
+ await turn.text();
376
+ const names = await readdir(join(ctx.cwd, ".harness", "uploads"));
377
+ expect(names.some((name) => name.endsWith("-note.txt"))).toBe(true);
378
+ const file = names.find((name) => name.endsWith("-note.txt"));
379
+ expect(await readFile(join(ctx.cwd, ".harness", "uploads", file ?? ""), "utf8")).toBe(
380
+ "from the composer",
381
+ );
382
+ } finally {
383
+ await ctx.close();
384
+ }
385
+ });
331
386
  });