compact-agent 1.1.0
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/README.md +394 -0
- package/bin/anycode.js +2 -0
- package/bin/crowcoder.js +19 -0
- package/bin/ecc-hooks.cjs +138 -0
- package/dist/agents.d.ts +17 -0
- package/dist/agents.js +1603 -0
- package/dist/agents.js.map +1 -0
- package/dist/api.d.ts +16 -0
- package/dist/api.js +115 -0
- package/dist/api.js.map +1 -0
- package/dist/autonomous-loops.d.ts +108 -0
- package/dist/autonomous-loops.js +526 -0
- package/dist/autonomous-loops.js.map +1 -0
- package/dist/codemaps.d.ts +53 -0
- package/dist/codemaps.js +325 -0
- package/dist/codemaps.js.map +1 -0
- package/dist/compaction.d.ts +30 -0
- package/dist/compaction.js +125 -0
- package/dist/compaction.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/content-engine.d.ts +97 -0
- package/dist/content-engine.js +721 -0
- package/dist/content-engine.js.map +1 -0
- package/dist/cost-tracker.d.ts +49 -0
- package/dist/cost-tracker.js +150 -0
- package/dist/cost-tracker.js.map +1 -0
- package/dist/counter-button.d.ts +35 -0
- package/dist/counter-button.js +48 -0
- package/dist/counter-button.js.map +1 -0
- package/dist/counter.d.ts +21 -0
- package/dist/counter.js +31 -0
- package/dist/counter.js.map +1 -0
- package/dist/coverage.d.ts +23 -0
- package/dist/coverage.js +215 -0
- package/dist/coverage.js.map +1 -0
- package/dist/docs-sync.d.ts +23 -0
- package/dist/docs-sync.js +266 -0
- package/dist/docs-sync.js.map +1 -0
- package/dist/ecc.d.ts +41 -0
- package/dist/ecc.js +644 -0
- package/dist/ecc.js.map +1 -0
- package/dist/evaluation.d.ts +24 -0
- package/dist/evaluation.js +412 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/export.d.ts +22 -0
- package/dist/export.js +109 -0
- package/dist/export.js.map +1 -0
- package/dist/git-workflow.d.ts +22 -0
- package/dist/git-workflow.js +197 -0
- package/dist/git-workflow.js.map +1 -0
- package/dist/hook-controls.d.ts +34 -0
- package/dist/hook-controls.js +90 -0
- package/dist/hook-controls.js.map +1 -0
- package/dist/hooks.d.ts +30 -0
- package/dist/hooks.js +130 -0
- package/dist/hooks.js.map +1 -0
- package/dist/html-parser.d.ts +18 -0
- package/dist/html-parser.js +101 -0
- package/dist/html-parser.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1230 -0
- package/dist/index.js.map +1 -0
- package/dist/learning.d.ts +35 -0
- package/dist/learning.js +238 -0
- package/dist/learning.js.map +1 -0
- package/dist/login.d.ts +37 -0
- package/dist/login.js +191 -0
- package/dist/login.js.map +1 -0
- package/dist/memory.d.ts +39 -0
- package/dist/memory.js +183 -0
- package/dist/memory.js.map +1 -0
- package/dist/model-router.d.ts +23 -0
- package/dist/model-router.js +145 -0
- package/dist/model-router.js.map +1 -0
- package/dist/modes.d.ts +17 -0
- package/dist/modes.js +217 -0
- package/dist/modes.js.map +1 -0
- package/dist/orchestration.d.ts +37 -0
- package/dist/orchestration.js +139 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/package-detect.d.ts +36 -0
- package/dist/package-detect.js +529 -0
- package/dist/package-detect.js.map +1 -0
- package/dist/permissions.d.ts +25 -0
- package/dist/permissions.js +50 -0
- package/dist/permissions.js.map +1 -0
- package/dist/pm2-manager.d.ts +40 -0
- package/dist/pm2-manager.js +127 -0
- package/dist/pm2-manager.js.map +1 -0
- package/dist/query.d.ts +15 -0
- package/dist/query.js +278 -0
- package/dist/query.js.map +1 -0
- package/dist/refactor.d.ts +22 -0
- package/dist/refactor.js +226 -0
- package/dist/refactor.js.map +1 -0
- package/dist/retry.d.ts +20 -0
- package/dist/retry.js +88 -0
- package/dist/retry.js.map +1 -0
- package/dist/rules.d.ts +34 -0
- package/dist/rules.js +942 -0
- package/dist/rules.js.map +1 -0
- package/dist/schema.d.ts +23 -0
- package/dist/schema.js +12 -0
- package/dist/schema.js.map +1 -0
- package/dist/search-first.d.ts +17 -0
- package/dist/search-first.js +301 -0
- package/dist/search-first.js.map +1 -0
- package/dist/security.d.ts +10 -0
- package/dist/security.js +145 -0
- package/dist/security.js.map +1 -0
- package/dist/sessions.d.ts +21 -0
- package/dist/sessions.js +112 -0
- package/dist/sessions.js.map +1 -0
- package/dist/skill-create.d.ts +38 -0
- package/dist/skill-create.js +389 -0
- package/dist/skill-create.js.map +1 -0
- package/dist/skills.d.ts +34 -0
- package/dist/skills.js +161 -0
- package/dist/skills.js.map +1 -0
- package/dist/strategic-compaction.d.ts +24 -0
- package/dist/strategic-compaction.js +144 -0
- package/dist/strategic-compaction.js.map +1 -0
- package/dist/system-prompt.d.ts +3 -0
- package/dist/system-prompt.js +101 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/theme.d.ts +60 -0
- package/dist/theme.js +220 -0
- package/dist/theme.js.map +1 -0
- package/dist/tools/bash.d.ts +2 -0
- package/dist/tools/bash.js +49 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.js +76 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/glob.d.ts +2 -0
- package/dist/tools/glob.js +54 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +2 -0
- package/dist/tools/grep.js +64 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-dir.d.ts +2 -0
- package/dist/tools/list-dir.js +51 -0
- package/dist/tools/list-dir.js.map +1 -0
- package/dist/tools/read.d.ts +2 -0
- package/dist/tools/read.js +56 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/types.d.ts +45 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +2 -0
- package/dist/tools/web-fetch.js +41 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +27 -0
- package/dist/tools/web-search.js +139 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/write.d.ts +2 -0
- package/dist/tools/write.js +36 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.js +57 -0
- package/dist/types.js.map +1 -0
- package/dist/users.d.ts +51 -0
- package/dist/users.js +193 -0
- package/dist/users.js.map +1 -0
- package/dist/verification.d.ts +73 -0
- package/dist/verification.js +269 -0
- package/dist/verification.js.map +1 -0
- package/dist/walkthrough.d.ts +10 -0
- package/dist/walkthrough.js +121 -0
- package/dist/walkthrough.js.map +1 -0
- package/package.json +58 -0
- package/resources/ecc/agents/architect.json +16 -0
- package/resources/ecc/agents/architect.md +212 -0
- package/resources/ecc/agents/build-error-resolver.json +17 -0
- package/resources/ecc/agents/build-error-resolver.md +116 -0
- package/resources/ecc/agents/chief-of-staff.json +17 -0
- package/resources/ecc/agents/chief-of-staff.md +153 -0
- package/resources/ecc/agents/code-reviewer.json +16 -0
- package/resources/ecc/agents/code-reviewer.md +238 -0
- package/resources/ecc/agents/database-reviewer.json +16 -0
- package/resources/ecc/agents/database-reviewer.md +92 -0
- package/resources/ecc/agents/doc-updater.json +16 -0
- package/resources/ecc/agents/doc-updater.md +108 -0
- package/resources/ecc/agents/e2e-runner.json +17 -0
- package/resources/ecc/agents/e2e-runner.md +109 -0
- package/resources/ecc/agents/go-build-resolver.json +17 -0
- package/resources/ecc/agents/go-build-resolver.md +96 -0
- package/resources/ecc/agents/go-reviewer.json +16 -0
- package/resources/ecc/agents/go-reviewer.md +77 -0
- package/resources/ecc/agents/harness-optimizer.json +15 -0
- package/resources/ecc/agents/harness-optimizer.md +34 -0
- package/resources/ecc/agents/loop-operator.json +16 -0
- package/resources/ecc/agents/loop-operator.md +36 -0
- package/resources/ecc/agents/planner.json +15 -0
- package/resources/ecc/agents/planner.md +212 -0
- package/resources/ecc/agents/python-reviewer.json +16 -0
- package/resources/ecc/agents/python-reviewer.md +99 -0
- package/resources/ecc/agents/refactor-cleaner.json +17 -0
- package/resources/ecc/agents/refactor-cleaner.md +87 -0
- package/resources/ecc/agents/security-reviewer.json +16 -0
- package/resources/ecc/agents/security-reviewer.md +109 -0
- package/resources/ecc/agents/tdd-guide.json +17 -0
- package/resources/ecc/agents/tdd-guide.md +93 -0
- package/resources/ecc/commands/add-language-rules.md +39 -0
- package/resources/ecc/commands/database-migration.md +36 -0
- package/resources/ecc/commands/feature-development.md +38 -0
- package/resources/ecc/prompts/build-fix.prompt.md +47 -0
- package/resources/ecc/prompts/code-review.prompt.md +56 -0
- package/resources/ecc/prompts/plan.prompt.md +52 -0
- package/resources/ecc/prompts/refactor.prompt.md +50 -0
- package/resources/ecc/prompts/security-review.prompt.md +70 -0
- package/resources/ecc/prompts/tdd.prompt.md +47 -0
- package/resources/ecc/rules/common-agents.md +53 -0
- package/resources/ecc/rules/common-coding-style.md +52 -0
- package/resources/ecc/rules/common-development-workflow.md +33 -0
- package/resources/ecc/rules/common-git-workflow.md +28 -0
- package/resources/ecc/rules/common-hooks.md +34 -0
- package/resources/ecc/rules/common-patterns.md +35 -0
- package/resources/ecc/rules/common-performance.md +59 -0
- package/resources/ecc/rules/common-security.md +33 -0
- package/resources/ecc/rules/common-testing.md +33 -0
- package/resources/ecc/rules/golang-coding-style.md +31 -0
- package/resources/ecc/rules/golang-hooks.md +16 -0
- package/resources/ecc/rules/golang-patterns.md +44 -0
- package/resources/ecc/rules/golang-security.md +33 -0
- package/resources/ecc/rules/golang-testing.md +30 -0
- package/resources/ecc/rules/kotlin-coding-style.md +39 -0
- package/resources/ecc/rules/kotlin-hooks.md +16 -0
- package/resources/ecc/rules/kotlin-patterns.md +50 -0
- package/resources/ecc/rules/kotlin-security.md +58 -0
- package/resources/ecc/rules/kotlin-testing.md +38 -0
- package/resources/ecc/rules/php-coding-style.md +25 -0
- package/resources/ecc/rules/php-hooks.md +21 -0
- package/resources/ecc/rules/php-patterns.md +23 -0
- package/resources/ecc/rules/php-security.md +24 -0
- package/resources/ecc/rules/php-testing.md +26 -0
- package/resources/ecc/rules/python-coding-style.md +42 -0
- package/resources/ecc/rules/python-hooks.md +19 -0
- package/resources/ecc/rules/python-patterns.md +39 -0
- package/resources/ecc/rules/python-security.md +30 -0
- package/resources/ecc/rules/python-testing.md +38 -0
- package/resources/ecc/rules/swift-coding-style.md +47 -0
- package/resources/ecc/rules/swift-hooks.md +20 -0
- package/resources/ecc/rules/swift-patterns.md +66 -0
- package/resources/ecc/rules/swift-security.md +33 -0
- package/resources/ecc/rules/swift-testing.md +45 -0
- package/resources/ecc/rules/typescript-coding-style.md +63 -0
- package/resources/ecc/rules/typescript-hooks.md +20 -0
- package/resources/ecc/rules/typescript-patterns.md +50 -0
- package/resources/ecc/rules/typescript-security.md +26 -0
- package/resources/ecc/rules/typescript-testing.md +16 -0
- package/resources/ecc/skills/agent-introspection-debugging/SKILL.md +152 -0
- package/resources/ecc/skills/agent-introspection-debugging/agents/openai.yaml +7 -0
- package/resources/ecc/skills/agent-sort/SKILL.md +214 -0
- package/resources/ecc/skills/agent-sort/agents/openai.yaml +7 -0
- package/resources/ecc/skills/api-design/SKILL.md +522 -0
- package/resources/ecc/skills/api-design/agents/openai.yaml +7 -0
- package/resources/ecc/skills/article-writing/SKILL.md +78 -0
- package/resources/ecc/skills/article-writing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/backend-patterns/SKILL.md +597 -0
- package/resources/ecc/skills/backend-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/brand-voice/SKILL.md +96 -0
- package/resources/ecc/skills/brand-voice/agents/openai.yaml +7 -0
- package/resources/ecc/skills/brand-voice/references/voice-profile-schema.md +55 -0
- package/resources/ecc/skills/bun-runtime/SKILL.md +83 -0
- package/resources/ecc/skills/bun-runtime/agents/openai.yaml +7 -0
- package/resources/ecc/skills/coding-standards/SKILL.md +548 -0
- package/resources/ecc/skills/coding-standards/agents/openai.yaml +7 -0
- package/resources/ecc/skills/content-engine/SKILL.md +130 -0
- package/resources/ecc/skills/content-engine/agents/openai.yaml +7 -0
- package/resources/ecc/skills/crosspost/SKILL.md +110 -0
- package/resources/ecc/skills/crosspost/agents/openai.yaml +7 -0
- package/resources/ecc/skills/deep-research/SKILL.md +154 -0
- package/resources/ecc/skills/deep-research/agents/openai.yaml +7 -0
- package/resources/ecc/skills/dmux-workflows/SKILL.md +143 -0
- package/resources/ecc/skills/dmux-workflows/agents/openai.yaml +7 -0
- package/resources/ecc/skills/documentation-lookup/SKILL.md +89 -0
- package/resources/ecc/skills/documentation-lookup/agents/openai.yaml +7 -0
- package/resources/ecc/skills/e2e-testing/SKILL.md +325 -0
- package/resources/ecc/skills/e2e-testing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/eval-harness/SKILL.md +235 -0
- package/resources/ecc/skills/eval-harness/agents/openai.yaml +7 -0
- package/resources/ecc/skills/everything-claude-code/SKILL.md +442 -0
- package/resources/ecc/skills/everything-claude-code/agents/openai.yaml +7 -0
- package/resources/ecc/skills/exa-search/SKILL.md +169 -0
- package/resources/ecc/skills/exa-search/agents/openai.yaml +7 -0
- package/resources/ecc/skills/fal-ai-media/SKILL.md +276 -0
- package/resources/ecc/skills/fal-ai-media/agents/openai.yaml +7 -0
- package/resources/ecc/skills/frontend-patterns/SKILL.md +647 -0
- package/resources/ecc/skills/frontend-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/frontend-slides/SKILL.md +183 -0
- package/resources/ecc/skills/frontend-slides/STYLE_PRESETS.md +330 -0
- package/resources/ecc/skills/frontend-slides/agents/openai.yaml +7 -0
- package/resources/ecc/skills/investor-materials/SKILL.md +95 -0
- package/resources/ecc/skills/investor-materials/agents/openai.yaml +7 -0
- package/resources/ecc/skills/investor-outreach/SKILL.md +90 -0
- package/resources/ecc/skills/investor-outreach/agents/openai.yaml +7 -0
- package/resources/ecc/skills/market-research/SKILL.md +74 -0
- package/resources/ecc/skills/market-research/agents/openai.yaml +7 -0
- package/resources/ecc/skills/mcp-server-patterns/SKILL.md +66 -0
- package/resources/ecc/skills/mcp-server-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/mle-workflow/SKILL.md +346 -0
- package/resources/ecc/skills/mle-workflow/agents/openai.yaml +7 -0
- package/resources/ecc/skills/nextjs-turbopack/SKILL.md +43 -0
- package/resources/ecc/skills/nextjs-turbopack/agents/openai.yaml +7 -0
- package/resources/ecc/skills/product-capability/SKILL.md +140 -0
- package/resources/ecc/skills/product-capability/agents/openai.yaml +7 -0
- package/resources/ecc/skills/security-review/SKILL.md +494 -0
- package/resources/ecc/skills/security-review/agents/openai.yaml +7 -0
- package/resources/ecc/skills/strategic-compact/SKILL.md +102 -0
- package/resources/ecc/skills/strategic-compact/agents/openai.yaml +7 -0
- package/resources/ecc/skills/tdd-workflow/SKILL.md +409 -0
- package/resources/ecc/skills/tdd-workflow/agents/openai.yaml +7 -0
- package/resources/ecc/skills/verification-loop/SKILL.md +125 -0
- package/resources/ecc/skills/verification-loop/agents/openai.yaml +7 -0
- package/resources/ecc/skills/video-editing/SKILL.md +307 -0
- package/resources/ecc/skills/video-editing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/x-api/SKILL.md +229 -0
- package/resources/ecc/skills/x-api/agents/openai.yaml +7 -0
package/dist/skills.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skills system — reusable prompt templates extracted from instincts or git history.
|
|
3
|
+
* Data stored in ~/.crowcoder/skills/
|
|
4
|
+
*/
|
|
5
|
+
import { readFileSync, writeFileSync, readdirSync, mkdirSync, existsSync, unlinkSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { getConfigDir } from './config.js';
|
|
9
|
+
const SKILLS_DIR = join(getConfigDir(), 'skills');
|
|
10
|
+
function ensureDir() {
|
|
11
|
+
mkdirSync(SKILLS_DIR, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
function skillPath(id) {
|
|
14
|
+
return join(SKILLS_DIR, `${id}.json`);
|
|
15
|
+
}
|
|
16
|
+
function genId() {
|
|
17
|
+
return `skill-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
18
|
+
}
|
|
19
|
+
export function createSkill(name, description, prompt, triggers, category = 'general') {
|
|
20
|
+
ensureDir();
|
|
21
|
+
const skill = {
|
|
22
|
+
id: genId(),
|
|
23
|
+
name,
|
|
24
|
+
description,
|
|
25
|
+
prompt,
|
|
26
|
+
triggers,
|
|
27
|
+
category,
|
|
28
|
+
createdAt: new Date().toISOString(),
|
|
29
|
+
useCount: 0,
|
|
30
|
+
};
|
|
31
|
+
saveSkill(skill);
|
|
32
|
+
return skill;
|
|
33
|
+
}
|
|
34
|
+
export function saveSkill(skill) {
|
|
35
|
+
ensureDir();
|
|
36
|
+
writeFileSync(skillPath(skill.id), JSON.stringify(skill, null, 2), 'utf-8');
|
|
37
|
+
}
|
|
38
|
+
export function loadSkill(id) {
|
|
39
|
+
const p = skillPath(id);
|
|
40
|
+
if (!existsSync(p))
|
|
41
|
+
return null;
|
|
42
|
+
try {
|
|
43
|
+
return JSON.parse(readFileSync(p, 'utf-8'));
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function listSkills() {
|
|
50
|
+
ensureDir();
|
|
51
|
+
const files = readdirSync(SKILLS_DIR).filter((f) => f.endsWith('.json'));
|
|
52
|
+
const skills = [];
|
|
53
|
+
for (const file of files) {
|
|
54
|
+
try {
|
|
55
|
+
skills.push(JSON.parse(readFileSync(join(SKILLS_DIR, file), 'utf-8')));
|
|
56
|
+
}
|
|
57
|
+
catch { /* skip */ }
|
|
58
|
+
}
|
|
59
|
+
return skills.sort((a, b) => b.useCount - a.useCount);
|
|
60
|
+
}
|
|
61
|
+
export function deleteSkill(id) {
|
|
62
|
+
const p = skillPath(id);
|
|
63
|
+
if (!existsSync(p))
|
|
64
|
+
return false;
|
|
65
|
+
unlinkSync(p);
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Fuzzy match by trigger keywords. Returns the first matching skill.
|
|
70
|
+
*/
|
|
71
|
+
export function findSkill(query) {
|
|
72
|
+
const all = listSkills();
|
|
73
|
+
const queryLower = query.toLowerCase();
|
|
74
|
+
// Exact match on trigger
|
|
75
|
+
for (const skill of all) {
|
|
76
|
+
if (skill.triggers.some((t) => t.toLowerCase() === queryLower)) {
|
|
77
|
+
return skill;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Partial match on trigger or name
|
|
81
|
+
for (const skill of all) {
|
|
82
|
+
const allText = `${skill.name} ${skill.triggers.join(' ')}`.toLowerCase();
|
|
83
|
+
if (allText.includes(queryLower)) {
|
|
84
|
+
return skill;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Apply skill by replacing {{placeholders}} with variables.
|
|
91
|
+
*/
|
|
92
|
+
export function applySkill(skill, variables) {
|
|
93
|
+
let result = skill.prompt;
|
|
94
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
95
|
+
const placeholder = `{{${key}}}`;
|
|
96
|
+
result = result.replace(new RegExp(placeholder, 'g'), value);
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Cluster high-confidence instincts into reusable skills.
|
|
102
|
+
* Groups by category, merges similar patterns.
|
|
103
|
+
*/
|
|
104
|
+
export function evolveInstinctsToSkills(instincts) {
|
|
105
|
+
const created = [];
|
|
106
|
+
// Group by category
|
|
107
|
+
const byCategory = new Map();
|
|
108
|
+
for (const inst of instincts) {
|
|
109
|
+
if (inst.confidence < 0.6)
|
|
110
|
+
continue; // Only use high-confidence instincts
|
|
111
|
+
const cat = inst.category;
|
|
112
|
+
if (!byCategory.has(cat))
|
|
113
|
+
byCategory.set(cat, []);
|
|
114
|
+
byCategory.get(cat).push(inst);
|
|
115
|
+
}
|
|
116
|
+
// Convert each instinct group to a skill
|
|
117
|
+
for (const [category, instList] of byCategory) {
|
|
118
|
+
for (const inst of instList) {
|
|
119
|
+
// Create a skill from this instinct
|
|
120
|
+
const skillName = `${category}-${inst.id.slice(0, 8)}`;
|
|
121
|
+
const triggers = [category, ...inst.pattern.split(/\s+/).slice(0, 3)];
|
|
122
|
+
const skill = createSkill(skillName, inst.context, inst.pattern, // use pattern as prompt template
|
|
123
|
+
triggers, category);
|
|
124
|
+
created.push(skill);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return created;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Increment useCount when a skill is applied.
|
|
131
|
+
*/
|
|
132
|
+
export function recordSkillUsage(id) {
|
|
133
|
+
const skill = loadSkill(id);
|
|
134
|
+
if (skill) {
|
|
135
|
+
skill.useCount++;
|
|
136
|
+
saveSkill(skill);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export function printSkillList() {
|
|
140
|
+
const skills = listSkills();
|
|
141
|
+
console.log(chalk.cyan(`\n Skills: ${skills.length} total`));
|
|
142
|
+
if (skills.length === 0) {
|
|
143
|
+
console.log(chalk.dim(' (no skills yet)'));
|
|
144
|
+
console.log();
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const byCat = new Map();
|
|
148
|
+
for (const s of skills) {
|
|
149
|
+
byCat.set(s.category, (byCat.get(s.category) || 0) + 1);
|
|
150
|
+
}
|
|
151
|
+
for (const [cat, count] of Array.from(byCat.entries()).sort((a, b) => b[1] - a[1])) {
|
|
152
|
+
console.log(chalk.dim(` ${cat}: ${count}`));
|
|
153
|
+
}
|
|
154
|
+
console.log(chalk.dim(`\n Most used:`));
|
|
155
|
+
for (const skill of skills.slice(0, 5)) {
|
|
156
|
+
const triggers = skill.triggers.slice(0, 2).join(', ');
|
|
157
|
+
console.log(chalk.dim(` [${skill.useCount}x] ${skill.name} (${triggers})`));
|
|
158
|
+
}
|
|
159
|
+
console.log();
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACtG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;AAalD,SAAS,SAAS;IAChB,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,SAAS,CAAC,EAAU;IAC3B,OAAO,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,KAAK;IACZ,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,WAAmB,EACnB,MAAc,EACd,QAAkB,EAClB,QAAQ,GAAG,SAAS;IAEpB,SAAS,EAAE,CAAC;IAEZ,MAAM,KAAK,GAAU;QACnB,EAAE,EAAE,KAAK,EAAE;QACX,IAAI;QACJ,WAAW;QACX,MAAM;QACN,QAAQ;QACR,QAAQ;QACR,SAAS,EAAE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AAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACzC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,QAAQ,MAAM,KAAK,CAAC,IAAI,KAAK,QAAQ,GAAG,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smart compaction suggestions — monitors conversation and suggests compaction at optimal points.
|
|
3
|
+
*/
|
|
4
|
+
import type { Message } from './types.js';
|
|
5
|
+
export interface CompactionSuggestion {
|
|
6
|
+
reason: string;
|
|
7
|
+
strategy: 'full' | 'quick' | 'selective';
|
|
8
|
+
estimatedTokens: number;
|
|
9
|
+
estimatedSavings: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Suggest compaction at optimal points.
|
|
13
|
+
* Returns null if no compaction needed, or a suggestion with reason.
|
|
14
|
+
*/
|
|
15
|
+
export declare function shouldSuggestCompaction(messages: Message[], lastCompactionAt: number): CompactionSuggestion | null;
|
|
16
|
+
/**
|
|
17
|
+
* Pre-build a summary of what would be compacted.
|
|
18
|
+
* Shows which messages/ranges would be affected.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildCompactionSummary(messages: Message[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Determine optimal compaction strategy based on token count and message characteristics.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCompactionStrategy(messages: Message[]): 'full' | 'quick' | 'selective';
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { estimateTokens } from './compaction.js';
|
|
2
|
+
/**
|
|
3
|
+
* Detect natural break points in conversation (e.g., task completion, mode switch).
|
|
4
|
+
*/
|
|
5
|
+
function findBreakPoints(messages) {
|
|
6
|
+
const breaks = [];
|
|
7
|
+
for (let i = 0; i < messages.length; i++) {
|
|
8
|
+
const msg = messages[i];
|
|
9
|
+
if (msg.role === 'assistant' && typeof msg.content === 'string') {
|
|
10
|
+
const text = msg.content.toLowerCase();
|
|
11
|
+
// Patterns that indicate task completion or natural break
|
|
12
|
+
if (text.includes('done') ||
|
|
13
|
+
text.includes('complete') ||
|
|
14
|
+
text.includes('all set') ||
|
|
15
|
+
text.includes('next') ||
|
|
16
|
+
text.includes('ready for') ||
|
|
17
|
+
text.match(/^(great|nice|alright|perfect)\b/i)) {
|
|
18
|
+
breaks.push(i);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return breaks;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if there's been a task mode switch (e.g., from "code review" to "refactoring").
|
|
26
|
+
*/
|
|
27
|
+
function detectModeSwitch(messages) {
|
|
28
|
+
const modes = ['code review', 'refactoring', 'debugging', 'design', 'optimization', 'testing'];
|
|
29
|
+
let lastModeIdx = -1;
|
|
30
|
+
for (const msg of messages) {
|
|
31
|
+
if (msg.role === 'user' && typeof msg.content === 'string') {
|
|
32
|
+
const text = msg.content.toLowerCase();
|
|
33
|
+
for (const mode of modes) {
|
|
34
|
+
if (text.includes(mode)) {
|
|
35
|
+
if (lastModeIdx >= 0 && lastModeIdx !== modes.indexOf(mode)) {
|
|
36
|
+
return true; // Mode switched
|
|
37
|
+
}
|
|
38
|
+
lastModeIdx = modes.indexOf(mode);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Suggest compaction at optimal points.
|
|
47
|
+
* Returns null if no compaction needed, or a suggestion with reason.
|
|
48
|
+
*/
|
|
49
|
+
export function shouldSuggestCompaction(messages, lastCompactionAt) {
|
|
50
|
+
const tokens = estimateTokens(messages);
|
|
51
|
+
const timeSinceLastCompaction = Date.now() - lastCompactionAt;
|
|
52
|
+
const minutesSinceCompaction = timeSinceLastCompaction / (1000 * 60);
|
|
53
|
+
// Warn level: 60k tokens
|
|
54
|
+
const warnThreshold = 60_000;
|
|
55
|
+
// Suggest level: 80k tokens
|
|
56
|
+
const suggestThreshold = 80_000;
|
|
57
|
+
// Strategy thresholds
|
|
58
|
+
const quickThreshold = 100_000;
|
|
59
|
+
const selectiveThreshold = 150_000;
|
|
60
|
+
// Never suggest if recently compacted (within 30 min)
|
|
61
|
+
if (minutesSinceCompaction < 30)
|
|
62
|
+
return null;
|
|
63
|
+
// Reason 1: High token count with natural break point
|
|
64
|
+
if (tokens > suggestThreshold) {
|
|
65
|
+
const breaks = findBreakPoints(messages);
|
|
66
|
+
if (breaks.length > 0) {
|
|
67
|
+
const strategy = tokens > selectiveThreshold ? 'full' : tokens > quickThreshold ? 'selective' : 'quick';
|
|
68
|
+
return {
|
|
69
|
+
reason: `Token count (${tokens.toLocaleString()}) exceeds threshold at natural break point`,
|
|
70
|
+
strategy,
|
|
71
|
+
estimatedTokens: tokens,
|
|
72
|
+
estimatedSavings: Math.round(tokens * 0.4), // Estimate 40% reduction
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Reason 2: Mode switch (task type changed)
|
|
77
|
+
if (tokens > warnThreshold && detectModeSwitch(messages)) {
|
|
78
|
+
const strategy = tokens > selectiveThreshold ? 'full' : 'selective';
|
|
79
|
+
return {
|
|
80
|
+
reason: 'Task mode switched (good time to compact before new context)',
|
|
81
|
+
strategy,
|
|
82
|
+
estimatedTokens: tokens,
|
|
83
|
+
estimatedSavings: Math.round(tokens * 0.35),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
// Reason 3: Just hit warning threshold
|
|
87
|
+
if (tokens > suggestThreshold && tokens < suggestThreshold + 5_000) {
|
|
88
|
+
const strategy = tokens > selectiveThreshold ? 'full' : tokens > quickThreshold ? 'selective' : 'quick';
|
|
89
|
+
return {
|
|
90
|
+
reason: `Token count (${tokens.toLocaleString()}) reached compaction threshold`,
|
|
91
|
+
strategy,
|
|
92
|
+
estimatedTokens: tokens,
|
|
93
|
+
estimatedSavings: Math.round(tokens * 0.35),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// Reason 4: Long time since last compaction + substantial message count
|
|
97
|
+
if (minutesSinceCompaction > 90 && messages.length > 50 && tokens > warnThreshold) {
|
|
98
|
+
return {
|
|
99
|
+
reason: 'Periodic compaction recommended (90+ minutes since last compaction)',
|
|
100
|
+
strategy: 'selective',
|
|
101
|
+
estimatedTokens: tokens,
|
|
102
|
+
estimatedSavings: Math.round(tokens * 0.3),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Pre-build a summary of what would be compacted.
|
|
109
|
+
* Shows which messages/ranges would be affected.
|
|
110
|
+
*/
|
|
111
|
+
export function buildCompactionSummary(messages) {
|
|
112
|
+
const recentCount = 10;
|
|
113
|
+
const oldMessages = messages.slice(0, -recentCount);
|
|
114
|
+
const recentMessages = messages.slice(-recentCount);
|
|
115
|
+
const toolCalls = oldMessages.filter((m) => m.role === 'assistant' && m.tool_calls).length;
|
|
116
|
+
const userMsgs = oldMessages.filter((m) => m.role === 'user').length;
|
|
117
|
+
const toolResults = oldMessages.filter((m) => m.role === 'tool').length;
|
|
118
|
+
const lines = [
|
|
119
|
+
`Summary of compaction:`,
|
|
120
|
+
` Old messages to summarize: ${oldMessages.length}`,
|
|
121
|
+
` - User messages: ${userMsgs}`,
|
|
122
|
+
` - Assistant messages with tool calls: ${toolCalls}`,
|
|
123
|
+
` - Tool results: ${toolResults}`,
|
|
124
|
+
` Recent messages to keep: ${recentMessages.length}`,
|
|
125
|
+
];
|
|
126
|
+
return lines.join('\n');
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Determine optimal compaction strategy based on token count and message characteristics.
|
|
130
|
+
*/
|
|
131
|
+
export function getCompactionStrategy(messages) {
|
|
132
|
+
const tokens = estimateTokens(messages);
|
|
133
|
+
// 'quick': just truncate tool outputs (under 100k tokens)
|
|
134
|
+
if (tokens < 100_000) {
|
|
135
|
+
return 'quick';
|
|
136
|
+
}
|
|
137
|
+
// 'selective': summarize old messages but keep important ones (100-150k)
|
|
138
|
+
if (tokens < 150_000) {
|
|
139
|
+
return 'selective';
|
|
140
|
+
}
|
|
141
|
+
// 'full': full AI-powered summarization (over 150k)
|
|
142
|
+
return 'full';
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=strategic-compaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategic-compaction.js","sourceRoot":"","sources":["../src/strategic-compaction.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AASjD;;GAEG;AACH,SAAS,eAAe,CAAC,QAAmB;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChE,MA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:os';
|
|
3
|
+
import { getModePromptAddition } from './modes.js';
|
|
4
|
+
import { buildRulesPrompt } from './rules.js';
|
|
5
|
+
import { getRelevantInstincts } from './learning.js';
|
|
6
|
+
import { findEccSkillForQuery } from './ecc.js';
|
|
7
|
+
import { ALL_TOOLS } from './tools/index.js';
|
|
8
|
+
import { buildUserContext } from './users.js';
|
|
9
|
+
function buildToolList() {
|
|
10
|
+
const lines = ALL_TOOLS.map((t) => {
|
|
11
|
+
const oneLine = t.description.split('\n')[0];
|
|
12
|
+
return ` - ${t.name}: ${oneLine}`;
|
|
13
|
+
});
|
|
14
|
+
return lines.join('\n');
|
|
15
|
+
}
|
|
16
|
+
export function buildSystemPrompt(config, cwd, mode = 'dev', userQuery) {
|
|
17
|
+
const os = `${platform()} ${release()}`;
|
|
18
|
+
const shell = process.platform === 'win32' ? 'bash (Git Bash / WSL)' : '/bin/bash';
|
|
19
|
+
// Detect if cwd is a git repo
|
|
20
|
+
let isGit = false;
|
|
21
|
+
try {
|
|
22
|
+
isGit = existsSync(`${cwd}/.git`);
|
|
23
|
+
}
|
|
24
|
+
catch { }
|
|
25
|
+
// Try to list top-level files for context
|
|
26
|
+
let fileList = '';
|
|
27
|
+
try {
|
|
28
|
+
const entries = readdirSync(cwd, { withFileTypes: true });
|
|
29
|
+
fileList = entries
|
|
30
|
+
.slice(0, 30)
|
|
31
|
+
.map((e) => (e.isDirectory() ? `${e.name}/` : e.name))
|
|
32
|
+
.join(', ');
|
|
33
|
+
}
|
|
34
|
+
catch { }
|
|
35
|
+
// Mode-specific prompt addition
|
|
36
|
+
const modeAddition = getModePromptAddition(mode);
|
|
37
|
+
// Language-specific rules
|
|
38
|
+
const rulesAddition = buildRulesPrompt(cwd);
|
|
39
|
+
// Relevant instincts from learning system
|
|
40
|
+
let instinctAddition = '';
|
|
41
|
+
if (userQuery) {
|
|
42
|
+
const instincts = getRelevantInstincts(userQuery, 3);
|
|
43
|
+
if (instincts.length > 0) {
|
|
44
|
+
instinctAddition = '\n# Learned Patterns\n' +
|
|
45
|
+
instincts.map((i) => `- [${(i.confidence * 100).toFixed(0)}%] ${i.pattern}`).join('\n');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Auto-inject the highest-scoring ECC skill for this query, if any
|
|
49
|
+
let eccSkillAddition = '';
|
|
50
|
+
if (userQuery) {
|
|
51
|
+
try {
|
|
52
|
+
const skill = findEccSkillForQuery(userQuery);
|
|
53
|
+
if (skill) {
|
|
54
|
+
// Truncate large skills so we don't blow the context budget
|
|
55
|
+
const body = skill.prompt.length > 4000 ? skill.prompt.slice(0, 4000) + '\n...[truncated]' : skill.prompt;
|
|
56
|
+
eccSkillAddition = `\n# ECC Skill: ${skill.name}\n${body}\n`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch { /* skill matching is best-effort */ }
|
|
60
|
+
}
|
|
61
|
+
// User context
|
|
62
|
+
const userAddition = buildUserContext();
|
|
63
|
+
return `You are Crowcoder, a powerful AI coding assistant running in the user's terminal.
|
|
64
|
+
You help with software engineering tasks: writing code, fixing bugs, refactoring, explaining code, running commands, and more.
|
|
65
|
+
|
|
66
|
+
# Environment
|
|
67
|
+
- Working directory: ${cwd}
|
|
68
|
+
- OS: ${os}
|
|
69
|
+
- Shell: ${shell}
|
|
70
|
+
- Git repo: ${isGit ? 'yes' : 'no'}
|
|
71
|
+
- Model: ${config.model} via ${config.provider}
|
|
72
|
+
- Home: ${homedir()}
|
|
73
|
+
- Mode: ${mode}
|
|
74
|
+
${fileList ? `- Files in cwd: ${fileList}` : ''}
|
|
75
|
+
|
|
76
|
+
# Available Tools (these and ONLY these — do not invent tool names)
|
|
77
|
+
${buildToolList()}
|
|
78
|
+
|
|
79
|
+
IMPORTANT — tool-call rules:
|
|
80
|
+
- The exact, allowed tool names are the bullet keys above. Calling any other name (e.g. \`web_search_exa\`, \`google_search\`, \`shell_exec\`) is an error and the call will fail.
|
|
81
|
+
- For web discovery: use \`web_search\` (returns title/URL/snippet for a keyword query).
|
|
82
|
+
- For reading a known URL: use \`web_fetch\`.
|
|
83
|
+
- For shell-only operations: use \`bash\`. Do not use bash for tasks any other tool already covers.
|
|
84
|
+
- If a capability you want isn't in the list, work around it with the tools that exist. Don't pretend a tool exists.
|
|
85
|
+
|
|
86
|
+
# Guidelines
|
|
87
|
+
- Read files before editing them. Understand existing code before suggesting changes.
|
|
88
|
+
- Use the appropriate tool for the task. Don't use bash when read_file or edit_file is better.
|
|
89
|
+
- Be concise. Lead with the answer, not the reasoning.
|
|
90
|
+
- When editing, use edit_file with exact string matching. Provide enough context to be unique.
|
|
91
|
+
- For bash commands, prefer non-destructive operations. Ask before deleting things.
|
|
92
|
+
- Don't add unnecessary features, comments, or abstractions beyond what was asked.
|
|
93
|
+
- When writing code, prioritize correctness and security. Avoid OWASP top 10 vulnerabilities.
|
|
94
|
+
- If an approach fails, diagnose the root cause before trying something else.
|
|
95
|
+
- Use markdown formatting in your responses.
|
|
96
|
+
- For git operations: prefer new commits over amending, never force-push without asking.
|
|
97
|
+
- Respond in the same language the user writes in.
|
|
98
|
+
${modeAddition}${rulesAddition}${instinctAddition}${eccSkillAddition}${userAddition}
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=system-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAa,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAChD,O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H,CAAC;QAAC,MAAM,CAAC,CAAC,mCAAmC,CAAC,CAAC;IACjD,CAAC;IAED,eAAe;IACf,MAAM,YAAY,GAAG,gBAAgB,EAAE,CAAC;IAExC,OAAO;;;;uBAIc,GAAG;QAClB,EAAE;WACC,KAAK;cACF,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;WACvB,MAAM,CAAC,KAAK,QAAQ,MAAM,CAAC,QAAQ;UACpC,OAAO,EAAE;UACT,IAAI;EACZ,QAAQ,CAAC,CAAC,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;;;EAG7C,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;EAqBf,YAAY,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,YAAY;CAClF,CAAC;AACF,CAAC"}
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export declare const sym: {
|
|
2
|
+
crow: string;
|
|
3
|
+
prompt: string;
|
|
4
|
+
assistant: string;
|
|
5
|
+
success: string;
|
|
6
|
+
error: string;
|
|
7
|
+
pending: string;
|
|
8
|
+
running: string;
|
|
9
|
+
thinking: string;
|
|
10
|
+
warn: string;
|
|
11
|
+
arrow: string;
|
|
12
|
+
bullet: string;
|
|
13
|
+
divider: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const theme: {
|
|
16
|
+
brand: import("chalk").ChalkInstance;
|
|
17
|
+
brandBold: import("chalk").ChalkInstance;
|
|
18
|
+
brandDim: import("chalk").ChalkInstance;
|
|
19
|
+
success: import("chalk").ChalkInstance;
|
|
20
|
+
warning: import("chalk").ChalkInstance;
|
|
21
|
+
error: import("chalk").ChalkInstance;
|
|
22
|
+
info: import("chalk").ChalkInstance;
|
|
23
|
+
primary: import("chalk").ChalkInstance;
|
|
24
|
+
secondary: import("chalk").ChalkInstance;
|
|
25
|
+
dim: import("chalk").ChalkInstance;
|
|
26
|
+
muted: import("chalk").ChalkInstance;
|
|
27
|
+
bright: import("chalk").ChalkInstance;
|
|
28
|
+
italic: import("chalk").ChalkInstance;
|
|
29
|
+
header: import("chalk").ChalkInstance;
|
|
30
|
+
subheader: import("chalk").ChalkInstance;
|
|
31
|
+
command: import("chalk").ChalkInstance;
|
|
32
|
+
cost: import("chalk").ChalkInstance;
|
|
33
|
+
link: import("chalk").ChalkInstance;
|
|
34
|
+
prompt: import("chalk").ChalkInstance;
|
|
35
|
+
assistant: import("chalk").ChalkInstance;
|
|
36
|
+
user: import("chalk").ChalkInstance;
|
|
37
|
+
toolName: import("chalk").ChalkInstance;
|
|
38
|
+
toolArgs: import("chalk").ChalkInstance;
|
|
39
|
+
toolStatus: import("chalk").ChalkInstance;
|
|
40
|
+
toolError: import("chalk").ChalkInstance;
|
|
41
|
+
toolTime: import("chalk").ChalkInstance;
|
|
42
|
+
thinkBorder: import("chalk").ChalkInstance;
|
|
43
|
+
thinkText: import("chalk").ChalkInstance;
|
|
44
|
+
thinkLabel: import("chalk").ChalkInstance;
|
|
45
|
+
modeBadge: (mode: string) => string;
|
|
46
|
+
secBadge: (level: string) => string;
|
|
47
|
+
};
|
|
48
|
+
export declare function printBanner(provider: string, model: string, mode: string, permissionMode: string, sessionId: string, toolNames: string[]): void;
|
|
49
|
+
export declare function printSplash(): void;
|
|
50
|
+
export declare function printSection(title: string): void;
|
|
51
|
+
export declare function printKV(key: string, value: string, indent?: number): void;
|
|
52
|
+
export declare function printToolRun(name: string, args: string): void;
|
|
53
|
+
export declare function printToolResult(success: boolean, elapsed: number, output: string): void;
|
|
54
|
+
export declare function printThinkingOpen(): void;
|
|
55
|
+
export declare function printThinkingText(text: string): void;
|
|
56
|
+
export declare function printThinkingClose(): void;
|
|
57
|
+
export declare function printCost(prompt: number, completion: number, cost: number, warning?: string): void;
|
|
58
|
+
export declare function printSecurityBadge(level: string, threats: string[], blocked: boolean): void;
|
|
59
|
+
export declare function printDivider(): void;
|
|
60
|
+
export declare function spinner(text: string): string;
|