@causyne/agent 1.20.116 → 1.20.118
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/package.json +7 -2
- package/src/agentLoop.js +81 -31
- package/src/agentLoop.ts +82 -33
- package/src/browser/causyneBrowser.js +30 -7
- package/src/browser/causyneBrowser.ts +29 -7
- package/src/cliMode.js +24 -4
- package/src/commands.js +7 -1
- package/src/memory/scopedFacts.js +171 -0
- package/src/memory/scopedFacts.ts +214 -0
- package/src/memory.d.ts +13 -1
- package/src/memory.js +9 -12
- package/src/perception.js +124 -3
- package/src/perception.ts +128 -4
- package/src/planCache.js +17 -3
- package/src/planCache.ts +17 -3
- package/src/plugins/pluginManager.js +74 -0
- package/src/reporting.js +12 -4
- package/src/skillsManager.js +3 -2
- package/src/skillsManager.ts +3 -2
- package/src/smartToolsUse.js +4 -5
- package/src/smartToolsUse.ts +4 -6
- package/src/taskShape.js +49 -7
- package/src/taskShape.ts +55 -7
- package/src/toolPacks.js +27 -5
- package/src/toolPacks.ts +32 -5
- package/src/tools/memoryWrite.js +8 -10
- package/src/tools/memoryWrite.ts +13 -11
- package/src/tools/pluginManager.js +17 -2
- package/src/tui/chatRenderer.js +4 -1
- package/src/tui/codeProgress.js +3 -2
- package/src/tui/codeProgress.ts +3 -2
- package/src/tui/codeStreamRenderer.js +41 -15
- package/src/tui/codeStreamRenderer.ts +40 -15
- package/src/tui/composerControls.js +16 -3
- package/src/tui/composerControls.ts +14 -3
- package/src/tui/keys.js +3 -1
- package/src/tui/prompt.js +146 -16
- package/src/tui/scrollInteraction.js +2 -2
- package/src/tui/scrollInteraction.ts +2 -2
- package/src/tui/stageSurface.js +114 -4
- package/src/tui/turnRail.js +21 -14
- package/src/tui/turnRail.ts +19 -14
- package/src/tui/usageCard.js +164 -71
- package/src/tui/usageCard.ts +187 -96
- package/src/tui/workspaceSwitch.js +2 -0
- package/src/tui/workspaceSwitch.ts +1 -0
- package/src/types/contracts.ts +3 -0
- package/src/verification/boundedExplorer.js +119 -0
- package/src/verification/cliProbe.js +116 -0
- package/src/verification/featureMap.js +78 -0
- package/src/verification/interactivePty.js +188 -0
- package/src/verification/propertyProbe.js +121 -0
- package/src/verification/ptyProbe.js +125 -0
- package/src/verification/skillCatalog.d.ts +1 -0
- package/src/verification/skillCatalog.js +60 -0
- package/src/verification/statechart.js +143 -0
- package/src/verification/uiRuntime.js +57 -0
- package/src/verificationPlan.js +1 -1
- package/src/verificationPlan.ts +1 -1
package/src/smartToolsUse.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Authorship: Strict TypeScript (Causyne Agent).
|
|
9
9
|
*/
|
|
10
|
-
import { PACK_PLAYBOOKS, isWebIntent } from './toolPacks.js';
|
|
10
|
+
import { PACK_PLAYBOOKS, isReverseEngineeringIntent, isWebIntent } from './toolPacks.js';
|
|
11
11
|
import { isMutatingToolCall, isPureSkillOrCapabilityLookup, redactSkillAndQueryLiterals } from './decisionPolicy.js';
|
|
12
12
|
const INSPECTION_TOOLS = new Set([
|
|
13
13
|
'fs_read', 'fs_list', 'fs_find', 'fs_search', 'grep_search', 'code_searcher',
|
|
@@ -134,10 +134,9 @@ const EXPLICIT_MEDIA_GENERATION_PATTERN = /\b(blender|3d model|render 3d|render
|
|
|
134
134
|
const EXPLICIT_WEB_ENGINEERING_PATTERN = /\b(build|create|make|design|develop|implement|redesign|buat\w*)\b[\s\S]*(?:\b(web|website|webpage|webapp|landing page|dashboard|ui|frontend|webgl|canvas|cad view|cad viewer|cad style view|3d view|3d viewer|3d configurator|3d visualizer)\b|(?:threejs|three\.js|thre\.?js|3js|babylon\.?js|pixi\.js|d3\.js|p5\.js|chart\.js)\b)/i;
|
|
135
135
|
// Explicit game development intent
|
|
136
136
|
const EXPLICIT_GAME_DEV_PATTERN = /(?:\b(?:build|create|make|design|develop|scaffold|render|animate|code|program|buat\w*|bikin\w*)[\s\S]*(?:game|simulation|simulator|simulasi|interactive|3d|three\.?js|threejs|webgl|canvas3d|babylonjs|godot|unity|unreal|platformer|rpg|arcade)\b|\b(?:game|gamedev|godot|unity|unreal|platformer|rpg|arcade|simulator|simulation|simulasi|interactive)\b|\b3d\s*(?:game|app|simulator|simulation|scene|city|world|view|body|human|anatomy|model|mesh|character|rendering|visualization|experience|space|environment)\b|\bin 3d\b|[-_]3d\b|\b3d[-_]|\b(?:threejs|three\.js|webgl|canvas3d|babylonjs)\b)/i;
|
|
137
|
-
// Explicit reverse engineering and binary analysis intent
|
|
138
|
-
const EXPLICIT_REVERSE_ENGINEERING_PATTERN = /\b(reverse[-_ ]?engineering|decompile|disassemble|disasm|apk|aab|dex|radare|rizin|ghidra|jadx|apktool|mach-o|elf binary|portable executable|\.apk\b|\.aab\b|\.dex\b|\.so\b|\.dylib\b|\.wasm\b|\.asar\b)\b/i;
|
|
137
|
+
// Explicit reverse engineering and binary analysis intent is defined in toolPacks.ts (isReverseEngineeringIntent).
|
|
139
138
|
// Explicit software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools, Android/mobile)
|
|
140
|
-
const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN = /(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|architecture|engineer|benchmark|profile|audit|scaffold)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream|app|application|compose|jetpack|android|gradle|package)\b|\b(?:python|rust|golang|c\+\+|cpp|java|kotlin|swift|csharp|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes|gradle|compose|android)\b)/i;
|
|
139
|
+
const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN = /(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|architecture|engineer|benchmark|profile|audit|scaffold|bump|export)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream|app|application|compose|jetpack|android|gradle|package|apk|aab|bundle|version)\b|\b(?:python|rust|golang|c\+\+|cpp|java|kotlin|swift|csharp|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes|gradle|compose|android|apk|aab)\b)/i;
|
|
141
140
|
/**
|
|
142
141
|
* Select tools to preload based on prompt intent. This is never an allowlist:
|
|
143
142
|
* tool_search can add capabilities as the task develops.
|
|
@@ -165,7 +164,7 @@ export function determineToolScope(prompt, _taskShape) {
|
|
|
165
164
|
}
|
|
166
165
|
const effectiveText = redactSkillAndQueryLiterals(text);
|
|
167
166
|
// 1. Reverse engineering & binary analysis intent
|
|
168
|
-
if (
|
|
167
|
+
if (isReverseEngineeringIntent(effectiveText)) {
|
|
169
168
|
const tools = new Set([
|
|
170
169
|
'reverse_engineering',
|
|
171
170
|
'fs_read',
|
package/src/smartToolsUse.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Authorship: Strict TypeScript (Causyne Agent).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { PACK_PLAYBOOKS, isWebIntent } from './toolPacks.js';
|
|
11
|
+
import { PACK_PLAYBOOKS, isReverseEngineeringIntent, isWebIntent } from './toolPacks.js';
|
|
12
12
|
import {
|
|
13
13
|
isMutatingToolCall,
|
|
14
14
|
isPureSkillOrCapabilityLookup,
|
|
@@ -185,13 +185,11 @@ const EXPLICIT_WEB_ENGINEERING_PATTERN =
|
|
|
185
185
|
const EXPLICIT_GAME_DEV_PATTERN =
|
|
186
186
|
/(?:\b(?:build|create|make|design|develop|scaffold|render|animate|code|program|buat\w*|bikin\w*)[\s\S]*(?:game|simulation|simulator|simulasi|interactive|3d|three\.?js|threejs|webgl|canvas3d|babylonjs|godot|unity|unreal|platformer|rpg|arcade)\b|\b(?:game|gamedev|godot|unity|unreal|platformer|rpg|arcade|simulator|simulation|simulasi|interactive)\b|\b3d\s*(?:game|app|simulator|simulation|scene|city|world|view|body|human|anatomy|model|mesh|character|rendering|visualization|experience|space|environment)\b|\bin 3d\b|[-_]3d\b|\b3d[-_]|\b(?:threejs|three\.js|webgl|canvas3d|babylonjs)\b)/i;
|
|
187
187
|
|
|
188
|
-
// Explicit reverse engineering and binary analysis intent
|
|
189
|
-
const EXPLICIT_REVERSE_ENGINEERING_PATTERN =
|
|
190
|
-
/\b(reverse[-_ ]?engineering|decompile|disassemble|disasm|apk|aab|dex|radare|rizin|ghidra|jadx|apktool|mach-o|elf binary|portable executable|\.apk\b|\.aab\b|\.dex\b|\.so\b|\.dylib\b|\.wasm\b|\.asar\b)\b/i;
|
|
188
|
+
// Explicit reverse engineering and binary analysis intent is defined in toolPacks.ts (isReverseEngineeringIntent).
|
|
191
189
|
|
|
192
190
|
// Explicit software and systems engineering intent (backend, APIs, refactoring, algorithms, testing, architecture, CLI tools, Android/mobile)
|
|
193
191
|
const EXPLICIT_SOFTWARE_ENGINEERING_PATTERN =
|
|
194
|
-
/(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|architecture|engineer|benchmark|profile|audit|scaffold)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream|app|application|compose|jetpack|android|gradle|package)\b|\b(?:python|rust|golang|c\+\+|cpp|java|kotlin|swift|csharp|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes|gradle|compose|android)\b)/i;
|
|
192
|
+
/(?:\b(?:build|create|code|program|develop|refactor|debug|fix|implement|test|optimize|write|add|modify|migrate|architect|architecture|engineer|benchmark|profile|audit|scaffold|bump|export)\b[\s\S]*\b(?:api|backend|service|microservice|server|database|schema|endpoint|controller|auth|test|spec|algorithm|function|module|class|feature|script|pipeline|codebase|repo|repository|bug|issue|engine|tool|cli|library|sdk|migration|handler|worker|queue|stream|app|application|compose|jetpack|android|gradle|package|apk|aab|bundle|version)\b|\b(?:python|rust|golang|c\+\+|cpp|java|kotlin|swift|csharp|typescript|javascript|ruby|php|sql|bash|shell|docker|k8s|kubernetes|gradle|compose|android|apk|aab)\b)/i;
|
|
195
193
|
|
|
196
194
|
/**
|
|
197
195
|
* Select tools to preload based on prompt intent. This is never an allowlist:
|
|
@@ -226,7 +224,7 @@ export function determineToolScope(
|
|
|
226
224
|
const effectiveText = redactSkillAndQueryLiterals(text);
|
|
227
225
|
|
|
228
226
|
// 1. Reverse engineering & binary analysis intent
|
|
229
|
-
if (
|
|
227
|
+
if (isReverseEngineeringIntent(effectiveText)) {
|
|
230
228
|
const tools = new Set([
|
|
231
229
|
'reverse_engineering',
|
|
232
230
|
'fs_read',
|
package/src/taskShape.js
CHANGED
|
@@ -85,6 +85,19 @@ const ARCHETYPES = {
|
|
|
85
85
|
{ name: 'Report', tools: [], note: 'Answer concisely and cite exact file paths or URLs. Do not modify anything unless asked.' }
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
|
+
modify_repo: {
|
|
89
|
+
label: 'Inspect and update an existing project or build release artifact',
|
|
90
|
+
match: {
|
|
91
|
+
strong: ['bump', 'version code', 'version name', 'aab', 'apk', 'release', 'export', 'synchronize', 'sync', 'upgrade', 'migrate', 'rebuild'],
|
|
92
|
+
weak: ['version', 'bundle', 'existing', 'repo', 'repository', 'docs']
|
|
93
|
+
},
|
|
94
|
+
phases: [
|
|
95
|
+
{ name: 'Orient in docs and structure', tools: ['fs_read', 'fs_list'], note: 'Read the workspace README, docs/ guides (e.g. ANDROID_RELEASE.md, ENGINEERING.md), and build scripts/manifests FIRST to follow the repository conventions.' },
|
|
96
|
+
{ name: 'Apply targeted updates', tools: ['fs_read', 'fs_edit', 'MultiEdit'], note: 'Modify only the exact configuration, version fields, or source files required by the user request.' },
|
|
97
|
+
{ name: 'Run documented build', tools: ['sysRun'], note: 'Execute the project’s documented build/export command for the requested deliverable only. Do not build unrelated web or side targets.' },
|
|
98
|
+
{ name: 'Verify artifact', tools: ['sysRun', 'fs_read'], note: 'Verify the exact produced output (version, signature, alignment, tests) before reporting.' }
|
|
99
|
+
]
|
|
100
|
+
},
|
|
88
101
|
maintain: {
|
|
89
102
|
label: 'Operate on files, processes or the machine itself',
|
|
90
103
|
match: {
|
|
@@ -123,6 +136,12 @@ function scoreSignals(text, signals) {
|
|
|
123
136
|
}
|
|
124
137
|
return { score, hits };
|
|
125
138
|
}
|
|
139
|
+
function isPureGreeting(prompt) {
|
|
140
|
+
const cleaned = String(prompt || '').trim().toLowerCase().replace(/[!?.]+$/g, '');
|
|
141
|
+
if (!cleaned)
|
|
142
|
+
return false;
|
|
143
|
+
return /^(?:hi+|hello+|hey+|yo+|sup|greetings|good\s+(?:morning|afternoon|evening)|thanks|thank\s+you|ok(?:ay)?)$/.test(cleaned);
|
|
144
|
+
}
|
|
126
145
|
/**
|
|
127
146
|
* Analyse a request into the shape of the work it implies.
|
|
128
147
|
*
|
|
@@ -130,10 +149,12 @@ function scoreSignals(text, signals) {
|
|
|
130
149
|
export function analyzeTask(prompt, workspaceContext = null) {
|
|
131
150
|
const rawPrompt = String(prompt || '');
|
|
132
151
|
const pureSkillLookup = isPureSkillOrCapabilityLookup(rawPrompt);
|
|
152
|
+
const pureGreeting = !pureSkillLookup && isPureGreeting(rawPrompt);
|
|
153
|
+
const lightweightLookup = pureSkillLookup || pureGreeting;
|
|
133
154
|
const text = (pureSkillLookup ? redactSkillAndQueryLiterals(rawPrompt) : rawPrompt).toLowerCase();
|
|
134
155
|
// Which capability packs are worth their token cost for this request.
|
|
135
156
|
const packScores = [];
|
|
136
|
-
if (!
|
|
157
|
+
if (!lightweightLookup) {
|
|
137
158
|
for (const packName of Object.keys(PACK_SIGNALS)) {
|
|
138
159
|
const signals = PACK_SIGNALS[packName];
|
|
139
160
|
if (!signals)
|
|
@@ -147,12 +168,14 @@ export function analyzeTask(prompt, workspaceContext = null) {
|
|
|
147
168
|
// Workspace evidence outranks keywords: a Godot project on disk is far more
|
|
148
169
|
// reliable than any phrasing in the prompt. Pure skill/capability lookups
|
|
149
170
|
// stay lightweight and never preload workspace app packs.
|
|
150
|
-
if (workspaceContext && !
|
|
171
|
+
if (workspaceContext && !lightweightLookup) {
|
|
151
172
|
const signals = [
|
|
152
173
|
workspaceContext.framework,
|
|
153
174
|
workspaceContext.projectType,
|
|
154
175
|
workspaceContext.designSystem,
|
|
155
|
-
Array.isArray(workspaceContext.keyFiles) ? workspaceContext.keyFiles.join(' ') : ''
|
|
176
|
+
Array.isArray(workspaceContext.keyFiles) ? workspaceContext.keyFiles.join(' ') : '',
|
|
177
|
+
Array.isArray(workspaceContext.subprojectStacks) ? workspaceContext.subprojectStacks.join(' ') : '',
|
|
178
|
+
Array.isArray(workspaceContext.buildFiles) ? workspaceContext.buildFiles.join(' ') : ''
|
|
156
179
|
].filter(Boolean).join(' ').toLowerCase();
|
|
157
180
|
const bump = (name, amount) => {
|
|
158
181
|
const existing = packScores.find(p => p.name === name);
|
|
@@ -161,10 +184,15 @@ export function analyzeTask(prompt, workspaceContext = null) {
|
|
|
161
184
|
else
|
|
162
185
|
packScores.push({ name, score: amount });
|
|
163
186
|
};
|
|
164
|
-
|
|
187
|
+
const hasGameProject = /godot|project\.godot|unity|\.tscn/.test(signals);
|
|
188
|
+
const hasExplicitWebFramework = /\b(react|vue|svelte|next|nuxt|astro|angular|tailwind|vite)\b/.test(signals);
|
|
189
|
+
const explicitNonWebTarget = /\b(aab|apk|gradle|android|godot|export_presets|tscn|gdscript|xcode|ipa|ios|rust|cargo)\b/.test(text);
|
|
190
|
+
const hasPromptWebSignal = /\b(web|website|html|css|browser|frontend|page|ui|dom|react|vue|svelte|vite|next|playwright|lighthouse|localhost)\b/.test(text);
|
|
191
|
+
if (hasGameProject)
|
|
165
192
|
bump('game', 5);
|
|
166
|
-
if (/
|
|
193
|
+
if (!explicitNonWebTarget && (hasExplicitWebFramework || (!hasGameProject && /index\.html/.test(signals)) || (hasGameProject && /index\.html/.test(signals) && hasPromptWebSignal))) {
|
|
167
194
|
bump('web', 4);
|
|
195
|
+
}
|
|
168
196
|
}
|
|
169
197
|
packScores.sort((a, b) => b.score - a.score);
|
|
170
198
|
// Which archetype the work follows.
|
|
@@ -191,11 +219,25 @@ export function analyzeTask(prompt, workspaceContext = null) {
|
|
|
191
219
|
bestArchetype = 'integrate';
|
|
192
220
|
bestScore = integrationScore;
|
|
193
221
|
}
|
|
194
|
-
|
|
222
|
+
const hasExistingRepo = Boolean(workspaceContext && ((Array.isArray(workspaceContext.keyFiles) && workspaceContext.keyFiles.length > 0)
|
|
223
|
+
|| (Array.isArray(workspaceContext.buildFiles) && workspaceContext.buildFiles.length > 0)
|
|
224
|
+
|| (Array.isArray(workspaceContext.docFiles) && workspaceContext.docFiles.length > 0)
|
|
225
|
+
|| (Array.isArray(workspaceContext.subprojectStacks) && workspaceContext.subprojectStacks.length > 0)
|
|
226
|
+
|| (workspaceContext.framework && !/^(?:none|unknown)$/i.test(String(workspaceContext.framework)))
|
|
227
|
+
|| (workspaceContext.projectType && !/^(?:none|unknown)$/i.test(String(workspaceContext.projectType)))));
|
|
228
|
+
const explicitGreenfield = /\b(?:from\s+scratch|new\s+app(?:lication)?|new\s+project|greenfield|scaffold)\b/.test(text);
|
|
229
|
+
const explicitRepoReleaseOrModify = /\b(?:aab|apk|gradle|android|release|bump|versioncode|version|export|rebuild|update|upgrade|modify|extend|add\s+feature|existing|script)\b/.test(text);
|
|
230
|
+
if (!lightweightLookup && hasExistingRepo && (bestArchetype === 'build_app' || !bestArchetype) && !explicitGreenfield) {
|
|
231
|
+
if (bestArchetype !== 'build_app' || explicitRepoReleaseOrModify) {
|
|
232
|
+
bestArchetype = 'modify_repo';
|
|
233
|
+
bestScore = Math.max(bestScore, STRONG_WEIGHT);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (lightweightLookup) {
|
|
195
237
|
bestArchetype = 'research';
|
|
196
238
|
bestScore = Math.max(bestScore, STRONG_WEIGHT);
|
|
197
239
|
}
|
|
198
|
-
const archetype = bestArchetype || 'build_app';
|
|
240
|
+
const archetype = bestArchetype || (hasExistingRepo ? 'modify_repo' : 'build_app');
|
|
199
241
|
const confidence = bestScore >= 6 ? 'high' : (bestScore >= 3 ? 'medium' : 'low');
|
|
200
242
|
const definition = ARCHETYPES[archetype];
|
|
201
243
|
if (!definition)
|
package/src/taskShape.ts
CHANGED
|
@@ -109,6 +109,19 @@ const ARCHETYPES: Record<string, ArchetypeDefinition> = {
|
|
|
109
109
|
{ name: 'Report', tools: [], note: 'Answer concisely and cite exact file paths or URLs. Do not modify anything unless asked.' }
|
|
110
110
|
]
|
|
111
111
|
},
|
|
112
|
+
modify_repo: {
|
|
113
|
+
label: 'Inspect and update an existing project or build release artifact',
|
|
114
|
+
match: {
|
|
115
|
+
strong: ['bump', 'version code', 'version name', 'aab', 'apk', 'release', 'export', 'synchronize', 'sync', 'upgrade', 'migrate', 'rebuild'],
|
|
116
|
+
weak: ['version', 'bundle', 'existing', 'repo', 'repository', 'docs']
|
|
117
|
+
},
|
|
118
|
+
phases: [
|
|
119
|
+
{ name: 'Orient in docs and structure', tools: ['fs_read', 'fs_list'], note: 'Read the workspace README, docs/ guides (e.g. ANDROID_RELEASE.md, ENGINEERING.md), and build scripts/manifests FIRST to follow the repository conventions.' },
|
|
120
|
+
{ name: 'Apply targeted updates', tools: ['fs_read', 'fs_edit', 'MultiEdit'], note: 'Modify only the exact configuration, version fields, or source files required by the user request.' },
|
|
121
|
+
{ name: 'Run documented build', tools: ['sysRun'], note: 'Execute the project’s documented build/export command for the requested deliverable only. Do not build unrelated web or side targets.' },
|
|
122
|
+
{ name: 'Verify artifact', tools: ['sysRun', 'fs_read'], note: 'Verify the exact produced output (version, signature, alignment, tests) before reporting.' }
|
|
123
|
+
]
|
|
124
|
+
},
|
|
112
125
|
maintain: {
|
|
113
126
|
label: 'Operate on files, processes or the machine itself',
|
|
114
127
|
match: {
|
|
@@ -153,6 +166,12 @@ function scoreSignals(text: string, signals: SignalSet): { score: number; hits:
|
|
|
153
166
|
return { score, hits };
|
|
154
167
|
}
|
|
155
168
|
|
|
169
|
+
function isPureGreeting(prompt: string): boolean {
|
|
170
|
+
const cleaned = String(prompt || '').trim().toLowerCase().replace(/[!?.]+$/g, '');
|
|
171
|
+
if (!cleaned) return false;
|
|
172
|
+
return /^(?:hi+|hello+|hey+|yo+|sup|greetings|good\s+(?:morning|afternoon|evening)|thanks|thank\s+you|ok(?:ay)?)$/.test(cleaned);
|
|
173
|
+
}
|
|
174
|
+
|
|
156
175
|
/**
|
|
157
176
|
* Analyse a request into the shape of the work it implies.
|
|
158
177
|
*
|
|
@@ -160,11 +179,13 @@ function scoreSignals(text: string, signals: SignalSet): { score: number; hits:
|
|
|
160
179
|
export function analyzeTask(prompt: string, workspaceContext: WorkspaceContext | null = null): TaskShape {
|
|
161
180
|
const rawPrompt = String(prompt || '');
|
|
162
181
|
const pureSkillLookup = isPureSkillOrCapabilityLookup(rawPrompt);
|
|
182
|
+
const pureGreeting = !pureSkillLookup && isPureGreeting(rawPrompt);
|
|
183
|
+
const lightweightLookup = pureSkillLookup || pureGreeting;
|
|
163
184
|
const text = (pureSkillLookup ? redactSkillAndQueryLiterals(rawPrompt) : rawPrompt).toLowerCase();
|
|
164
185
|
|
|
165
186
|
// Which capability packs are worth their token cost for this request.
|
|
166
187
|
const packScores: TaskPackScore[] = [];
|
|
167
|
-
if (!
|
|
188
|
+
if (!lightweightLookup) {
|
|
168
189
|
for (const packName of Object.keys(PACK_SIGNALS)) {
|
|
169
190
|
const signals = PACK_SIGNALS[packName];
|
|
170
191
|
if (!signals) continue;
|
|
@@ -178,12 +199,14 @@ export function analyzeTask(prompt: string, workspaceContext: WorkspaceContext |
|
|
|
178
199
|
// Workspace evidence outranks keywords: a Godot project on disk is far more
|
|
179
200
|
// reliable than any phrasing in the prompt. Pure skill/capability lookups
|
|
180
201
|
// stay lightweight and never preload workspace app packs.
|
|
181
|
-
if (workspaceContext && !
|
|
202
|
+
if (workspaceContext && !lightweightLookup) {
|
|
182
203
|
const signals = [
|
|
183
204
|
workspaceContext.framework,
|
|
184
205
|
workspaceContext.projectType,
|
|
185
206
|
workspaceContext.designSystem,
|
|
186
|
-
Array.isArray(workspaceContext.keyFiles) ? workspaceContext.keyFiles.join(' ') : ''
|
|
207
|
+
Array.isArray(workspaceContext.keyFiles) ? workspaceContext.keyFiles.join(' ') : '',
|
|
208
|
+
Array.isArray(workspaceContext.subprojectStacks) ? workspaceContext.subprojectStacks.join(' ') : '',
|
|
209
|
+
Array.isArray(workspaceContext.buildFiles) ? workspaceContext.buildFiles.join(' ') : ''
|
|
187
210
|
].filter(Boolean).join(' ').toLowerCase();
|
|
188
211
|
|
|
189
212
|
const bump = (name: string, amount: number): void => {
|
|
@@ -192,8 +215,14 @@ export function analyzeTask(prompt: string, workspaceContext: WorkspaceContext |
|
|
|
192
215
|
else packScores.push({ name, score: amount });
|
|
193
216
|
};
|
|
194
217
|
|
|
195
|
-
|
|
196
|
-
|
|
218
|
+
const hasGameProject = /godot|project\.godot|unity|\.tscn/.test(signals);
|
|
219
|
+
const hasExplicitWebFramework = /\b(react|vue|svelte|next|nuxt|astro|angular|tailwind|vite)\b/.test(signals);
|
|
220
|
+
const explicitNonWebTarget = /\b(aab|apk|gradle|android|godot|export_presets|tscn|gdscript|xcode|ipa|ios|rust|cargo)\b/.test(text);
|
|
221
|
+
const hasPromptWebSignal = /\b(web|website|html|css|browser|frontend|page|ui|dom|react|vue|svelte|vite|next|playwright|lighthouse|localhost)\b/.test(text);
|
|
222
|
+
if (hasGameProject) bump('game', 5);
|
|
223
|
+
if (!explicitNonWebTarget && (hasExplicitWebFramework || (!hasGameProject && /index\.html/.test(signals)) || (hasGameProject && /index\.html/.test(signals) && hasPromptWebSignal))) {
|
|
224
|
+
bump('web', 4);
|
|
225
|
+
}
|
|
197
226
|
}
|
|
198
227
|
|
|
199
228
|
packScores.sort((a, b) => b.score - a.score);
|
|
@@ -222,12 +251,31 @@ export function analyzeTask(prompt: string, workspaceContext: WorkspaceContext |
|
|
|
222
251
|
bestScore = integrationScore;
|
|
223
252
|
}
|
|
224
253
|
|
|
225
|
-
|
|
254
|
+
const hasExistingRepo = Boolean(
|
|
255
|
+
workspaceContext && (
|
|
256
|
+
(Array.isArray(workspaceContext.keyFiles) && workspaceContext.keyFiles.length > 0)
|
|
257
|
+
|| (Array.isArray(workspaceContext.buildFiles) && workspaceContext.buildFiles.length > 0)
|
|
258
|
+
|| (Array.isArray(workspaceContext.docFiles) && workspaceContext.docFiles.length > 0)
|
|
259
|
+
|| (Array.isArray(workspaceContext.subprojectStacks) && workspaceContext.subprojectStacks.length > 0)
|
|
260
|
+
|| (workspaceContext.framework && !/^(?:none|unknown)$/i.test(String(workspaceContext.framework)))
|
|
261
|
+
|| (workspaceContext.projectType && !/^(?:none|unknown)$/i.test(String(workspaceContext.projectType)))
|
|
262
|
+
)
|
|
263
|
+
);
|
|
264
|
+
const explicitGreenfield = /\b(?:from\s+scratch|new\s+app(?:lication)?|new\s+project|greenfield|scaffold)\b/.test(text);
|
|
265
|
+
const explicitRepoReleaseOrModify = /\b(?:aab|apk|gradle|android|release|bump|versioncode|version|export|rebuild|update|upgrade|modify|extend|add\s+feature|existing|script)\b/.test(text);
|
|
266
|
+
if (!lightweightLookup && hasExistingRepo && (bestArchetype === 'build_app' || !bestArchetype) && !explicitGreenfield) {
|
|
267
|
+
if (bestArchetype !== 'build_app' || explicitRepoReleaseOrModify) {
|
|
268
|
+
bestArchetype = 'modify_repo';
|
|
269
|
+
bestScore = Math.max(bestScore, STRONG_WEIGHT);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (lightweightLookup) {
|
|
226
274
|
bestArchetype = 'research';
|
|
227
275
|
bestScore = Math.max(bestScore, STRONG_WEIGHT);
|
|
228
276
|
}
|
|
229
277
|
|
|
230
|
-
const archetype = bestArchetype || 'build_app';
|
|
278
|
+
const archetype = bestArchetype || (hasExistingRepo ? 'modify_repo' : 'build_app');
|
|
231
279
|
const confidence = bestScore >= 6 ? 'high' : (bestScore >= 3 ? 'medium' : 'low');
|
|
232
280
|
|
|
233
281
|
const definition = ARCHETYPES[archetype];
|
package/src/toolPacks.js
CHANGED
|
@@ -335,7 +335,9 @@ const WEB_INTENT = /\b(web|webpage|website|frontend|front-end|landing page|homep
|
|
|
335
335
|
const MEDIA_INTENT = /\b(image|images|picture|photo|photoshop|premiere|after\s*effects|illustrator|indesign|media\s*encoder|uxp|render|3d model|blender|animation|animate|video|movie|film|audio|sound|sfx|music|song|voice|tts|text.to.speech|narration|podcast|thumbnail|poster|illustration|logo)\b|\.(psd|prproj|aep|ai|indd|ccx)\b/i;
|
|
336
336
|
const SYSTEM_INTENT = /\b(process|processes|pid|kill|port|zip|unzip|tar|archive|compress|extract|clipboard|copy to clipboard|print|printer|open in browser|launch app|computer use|vision grounding|desktop vision|gui agent|coordinate click|desktop control)\b/i;
|
|
337
337
|
const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|plugins? factory|python bridge|mcp|mcp server|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
|
|
338
|
-
const REVERSE_ENGINEERING_INTENT = /\b(rea|rea-agents|decompile|decompiling|decompilation|disassemble|disassembly|disassembling|binary|binaries|
|
|
338
|
+
const REVERSE_ENGINEERING_INTENT = /\b(rea|rea-agents|decompile|decompiling|decompilation|disassemble|disassembly|disassembling|disasm|binary|binaries|elf binary|mach-o|portable executable|coff|reverse[\s_-]?engineer(ing)?|sourcemap|deobfuscate|ghidra|rizin|radare|jadx|apktool|hopper|frida|hook script|mitigations|clean[- ]?room)\b|\.(dylib|so|dll|exe|wasm|asar)\b/i;
|
|
339
|
+
const RE_BUNDLE_TARGET = /(?:\b(?:apk|aab|dex|asar)\b|\.(?:apk|aab|dex)\b)/i;
|
|
340
|
+
const RE_INSPECTION_VERB = /\b(?:inspect|analyze|analyse|examine|unpack|extract|dump|audit|reconstruct|decode|parse|strings)\b|what(?:'s| is) inside/i;
|
|
339
341
|
const INTENT_MATCHERS = {
|
|
340
342
|
game: GAME_INTENT,
|
|
341
343
|
web: WEB_INTENT,
|
|
@@ -344,6 +346,13 @@ const INTENT_MATCHERS = {
|
|
|
344
346
|
advanced: ADVANCED_INTENT,
|
|
345
347
|
reverse_engineering: REVERSE_ENGINEERING_INTENT
|
|
346
348
|
};
|
|
349
|
+
/** True when the prompt genuinely asks for reverse engineering or binary inspection rather than building/exporting our own APK/AAB. */
|
|
350
|
+
export function isReverseEngineeringIntent(prompt) {
|
|
351
|
+
const value = prompt || '';
|
|
352
|
+
if (REVERSE_ENGINEERING_INTENT.test(value))
|
|
353
|
+
return true;
|
|
354
|
+
return RE_BUNDLE_TARGET.test(value) && RE_INSPECTION_VERB.test(value);
|
|
355
|
+
}
|
|
347
356
|
/** True when the prompt genuinely describes game development work. */
|
|
348
357
|
export function isGameIntent(prompt) {
|
|
349
358
|
return GAME_INTENT.test(prompt || '');
|
|
@@ -366,27 +375,40 @@ export function routePacks(prompt, workspaceContext = null) {
|
|
|
366
375
|
const unlocked = new Set();
|
|
367
376
|
const text = prompt || '';
|
|
368
377
|
for (const packName of PACK_NAMES) {
|
|
369
|
-
|
|
378
|
+
const matched = packName === 'reverse_engineering'
|
|
379
|
+
? isReverseEngineeringIntent(text)
|
|
380
|
+
: INTENT_MATCHERS[packName].test(text);
|
|
381
|
+
if (matched) {
|
|
370
382
|
unlocked.add(packName);
|
|
371
383
|
}
|
|
372
384
|
}
|
|
385
|
+
// Greetings and pure non-actionable prompts must not preload heavy workspace packs.
|
|
386
|
+
const trimmed = text.trim();
|
|
387
|
+
const isGreeting = /^(?:hi|hello|hey|yo|halo|hai|p|good\s+(?:morning|afternoon|evening))[.!?, ]*$/i.test(trimmed);
|
|
388
|
+
const explicitNonWebTarget = /\b(?:aab|apk|gradle|bundleRelease|android|godot|\.gd\b|rust|cargo|xcode|ipa)\b/i.test(trimmed)
|
|
389
|
+
&& !isWebIntent(trimmed);
|
|
373
390
|
// Workspace signals. A Godot project on disk is far more reliable evidence of
|
|
374
391
|
// game work than any keyword, and a detected web framework means the agent
|
|
375
392
|
// will eventually need to look at what it built.
|
|
376
|
-
if (workspaceContext) {
|
|
393
|
+
if (workspaceContext && !isGreeting) {
|
|
377
394
|
const signals = [
|
|
378
395
|
workspaceContext.framework,
|
|
379
396
|
workspaceContext.projectType,
|
|
380
397
|
workspaceContext.designSystem,
|
|
398
|
+
Array.isArray(workspaceContext.subprojectStacks) ? workspaceContext.subprojectStacks.join(' ') : '',
|
|
381
399
|
Array.isArray(workspaceContext.keyFiles) ? workspaceContext.keyFiles.join(' ') : ''
|
|
382
400
|
]
|
|
383
401
|
.filter(Boolean)
|
|
384
402
|
.join(' ')
|
|
385
403
|
.toLowerCase();
|
|
386
|
-
|
|
404
|
+
const hasGameProject = /godot|project\.godot|unity|\.tscn/.test(signals);
|
|
405
|
+
const hasFrontendFramework = /react|vue|svelte|next|nuxt|astro|angular|tailwind|vite/.test(signals);
|
|
406
|
+
const hasHtmlEntry = /\bhtml\b/.test(signals);
|
|
407
|
+
if (hasGameProject)
|
|
387
408
|
unlocked.add('game');
|
|
388
|
-
if (
|
|
409
|
+
if (hasFrontendFramework || (hasHtmlEntry && !hasGameProject && !explicitNonWebTarget)) {
|
|
389
410
|
unlocked.add('web');
|
|
411
|
+
}
|
|
390
412
|
}
|
|
391
413
|
return [...unlocked];
|
|
392
414
|
}
|
package/src/toolPacks.ts
CHANGED
|
@@ -24,6 +24,7 @@ export interface WorkspaceRoutingContext {
|
|
|
24
24
|
projectType?: string | null | undefined;
|
|
25
25
|
designSystem?: string | null | undefined;
|
|
26
26
|
keyFiles?: string[] | null | undefined;
|
|
27
|
+
subprojectStacks?: string[] | null | undefined;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export interface ToolDefinitionLike {
|
|
@@ -380,7 +381,10 @@ const SYSTEM_INTENT = /\b(process|processes|pid|kill|port|zip|unzip|tar|archive|
|
|
|
380
381
|
|
|
381
382
|
const ADVANCED_INTENT = /\b(pdf|document|proposal|screenplay|shotlist|shot list|voiceover|dubbing|forge a tool|custom tool|new tool|plugin|plugins|custom plugin|plugins? factory|python bridge|mcp|mcp server|subagent|sub-agent|parallel agent|swarm|ast|symbols|refactor across)\b/i;
|
|
382
383
|
|
|
383
|
-
const REVERSE_ENGINEERING_INTENT = /\b(rea|rea-agents|decompile|decompiling|decompilation|disassemble|disassembly|disassembling|binary|binaries|
|
|
384
|
+
const REVERSE_ENGINEERING_INTENT = /\b(rea|rea-agents|decompile|decompiling|decompilation|disassemble|disassembly|disassembling|disasm|binary|binaries|elf binary|mach-o|portable executable|coff|reverse[\s_-]?engineer(ing)?|sourcemap|deobfuscate|ghidra|rizin|radare|jadx|apktool|hopper|frida|hook script|mitigations|clean[- ]?room)\b|\.(dylib|so|dll|exe|wasm|asar)\b/i;
|
|
385
|
+
|
|
386
|
+
const RE_BUNDLE_TARGET = /(?:\b(?:apk|aab|dex|asar)\b|\.(?:apk|aab|dex)\b)/i;
|
|
387
|
+
const RE_INSPECTION_VERB = /\b(?:inspect|analyze|analyse|examine|unpack|extract|dump|audit|reconstruct|decode|parse|strings)\b|what(?:'s| is) inside/i;
|
|
384
388
|
|
|
385
389
|
const INTENT_MATCHERS: Record<PackName, RegExp> = {
|
|
386
390
|
game: GAME_INTENT,
|
|
@@ -391,6 +395,13 @@ const INTENT_MATCHERS: Record<PackName, RegExp> = {
|
|
|
391
395
|
reverse_engineering: REVERSE_ENGINEERING_INTENT
|
|
392
396
|
};
|
|
393
397
|
|
|
398
|
+
/** True when the prompt genuinely asks for reverse engineering or binary inspection rather than building/exporting our own APK/AAB. */
|
|
399
|
+
export function isReverseEngineeringIntent(prompt?: string | null): boolean {
|
|
400
|
+
const value = prompt || '';
|
|
401
|
+
if (REVERSE_ENGINEERING_INTENT.test(value)) return true;
|
|
402
|
+
return RE_BUNDLE_TARGET.test(value) && RE_INSPECTION_VERB.test(value);
|
|
403
|
+
}
|
|
404
|
+
|
|
394
405
|
/** True when the prompt genuinely describes game development work. */
|
|
395
406
|
export function isGameIntent(prompt?: string | null): boolean {
|
|
396
407
|
return GAME_INTENT.test(prompt || '');
|
|
@@ -418,27 +429,43 @@ export function routePacks(
|
|
|
418
429
|
const text = prompt || '';
|
|
419
430
|
|
|
420
431
|
for (const packName of PACK_NAMES) {
|
|
421
|
-
|
|
432
|
+
const matched = packName === 'reverse_engineering'
|
|
433
|
+
? isReverseEngineeringIntent(text)
|
|
434
|
+
: INTENT_MATCHERS[packName].test(text);
|
|
435
|
+
if (matched) {
|
|
422
436
|
unlocked.add(packName);
|
|
423
437
|
}
|
|
424
438
|
}
|
|
425
439
|
|
|
440
|
+
// Greetings and pure non-actionable prompts must not preload heavy workspace packs.
|
|
441
|
+
const trimmed = text.trim();
|
|
442
|
+
const isGreeting = /^(?:hi|hello|hey|yo|halo|hai|p|good\s+(?:morning|afternoon|evening))[.!?, ]*$/i.test(trimmed);
|
|
443
|
+
const explicitNonWebTarget = /\b(?:aab|apk|gradle|bundleRelease|android|godot|\.gd\b|rust|cargo|xcode|ipa)\b/i.test(trimmed)
|
|
444
|
+
&& !isWebIntent(trimmed);
|
|
445
|
+
|
|
426
446
|
// Workspace signals. A Godot project on disk is far more reliable evidence of
|
|
427
447
|
// game work than any keyword, and a detected web framework means the agent
|
|
428
448
|
// will eventually need to look at what it built.
|
|
429
|
-
if (workspaceContext) {
|
|
449
|
+
if (workspaceContext && !isGreeting) {
|
|
430
450
|
const signals = [
|
|
431
451
|
workspaceContext.framework,
|
|
432
452
|
workspaceContext.projectType,
|
|
433
453
|
workspaceContext.designSystem,
|
|
454
|
+
Array.isArray(workspaceContext.subprojectStacks) ? workspaceContext.subprojectStacks.join(' ') : '',
|
|
434
455
|
Array.isArray(workspaceContext.keyFiles) ? workspaceContext.keyFiles.join(' ') : ''
|
|
435
456
|
]
|
|
436
457
|
.filter(Boolean)
|
|
437
458
|
.join(' ')
|
|
438
459
|
.toLowerCase();
|
|
439
460
|
|
|
440
|
-
|
|
441
|
-
|
|
461
|
+
const hasGameProject = /godot|project\.godot|unity|\.tscn/.test(signals);
|
|
462
|
+
const hasFrontendFramework = /react|vue|svelte|next|nuxt|astro|angular|tailwind|vite/.test(signals);
|
|
463
|
+
const hasHtmlEntry = /\bhtml\b/.test(signals);
|
|
464
|
+
|
|
465
|
+
if (hasGameProject) unlocked.add('game');
|
|
466
|
+
if (hasFrontendFramework || (hasHtmlEntry && !hasGameProject && !explicitNonWebTarget)) {
|
|
467
|
+
unlocked.add('web');
|
|
468
|
+
}
|
|
442
469
|
}
|
|
443
470
|
|
|
444
471
|
return [...unlocked];
|
package/src/tools/memoryWrite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @ts-expect-error Legacy memory module has no TypeScript declarations yet.
|
|
2
1
|
import { getMemory, saveMemory } from '../memory.js';
|
|
2
|
+
import { recordScopedFact } from '../memory/scopedFacts.js';
|
|
3
3
|
import { cortexDb } from '../cortex/vectorDb.js';
|
|
4
4
|
const MAX_FACTS = 100;
|
|
5
5
|
export const memoryWrite = {
|
|
@@ -41,16 +41,14 @@ export const memoryWrite = {
|
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
43
|
const memory = getMemory();
|
|
44
|
-
if (!Array.isArray(memory.facts))
|
|
45
|
-
memory.facts = [];
|
|
46
44
|
const fact = String(args.fact).trim();
|
|
47
|
-
const
|
|
45
|
+
const workspace = dependencies?.parentLoop?.workspaceRoot || dependencies?.workspaceRoot;
|
|
46
|
+
const { memory: updated, alreadyKnown } = recordScopedFact(memory, fact, {
|
|
47
|
+
workspace,
|
|
48
|
+
maxFacts: MAX_FACTS
|
|
49
|
+
});
|
|
48
50
|
if (!alreadyKnown) {
|
|
49
|
-
|
|
50
|
-
while (memory.facts.length > MAX_FACTS) {
|
|
51
|
-
memory.facts.shift();
|
|
52
|
-
}
|
|
53
|
-
saveMemory(memory);
|
|
51
|
+
saveMemory(updated);
|
|
54
52
|
}
|
|
55
53
|
let creativeSaved = false;
|
|
56
54
|
if (args.creativePattern && args.creativePattern.designApproach) {
|
|
@@ -76,7 +74,7 @@ export const memoryWrite = {
|
|
|
76
74
|
}
|
|
77
75
|
const notes = [
|
|
78
76
|
alreadyKnown ? 'Fact already known, not duplicated.' : 'Fact saved.',
|
|
79
|
-
`Total persistent facts: ${
|
|
77
|
+
`Total persistent facts: ${updated.facts.length}.`,
|
|
80
78
|
creativeSaved ? 'Creative pattern recorded in the V5 Cortex.' : ''
|
|
81
79
|
].filter(Boolean);
|
|
82
80
|
return { success: true, output: notes.join(' ') };
|
package/src/tools/memoryWrite.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// @ts-expect-error Legacy memory module has no TypeScript declarations yet.
|
|
2
1
|
import { getMemory, saveMemory } from '../memory.js';
|
|
2
|
+
import { recordScopedFact } from '../memory/scopedFacts.js';
|
|
3
3
|
import { cortexDb } from '../cortex/vectorDb.js';
|
|
4
4
|
|
|
5
5
|
const MAX_FACTS = 100;
|
|
@@ -17,6 +17,10 @@ export interface MemoryWriteArgs {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface MemoryWriteDependencies {
|
|
20
|
+
workspaceRoot?: string | undefined;
|
|
21
|
+
parentLoop?: {
|
|
22
|
+
workspaceRoot?: string | undefined;
|
|
23
|
+
} | undefined;
|
|
20
24
|
broadcast?: (event: { type: string; content: string }) => void;
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -65,18 +69,16 @@ export const memoryWrite = {
|
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
try {
|
|
68
|
-
const memory = getMemory()
|
|
69
|
-
if (!Array.isArray(memory.facts)) memory.facts = [];
|
|
70
|
-
|
|
72
|
+
const memory = getMemory();
|
|
71
73
|
const fact = String(args.fact).trim();
|
|
72
|
-
const
|
|
74
|
+
const workspace = dependencies?.parentLoop?.workspaceRoot || dependencies?.workspaceRoot;
|
|
75
|
+
const { memory: updated, alreadyKnown } = recordScopedFact(memory, fact, {
|
|
76
|
+
workspace,
|
|
77
|
+
maxFacts: MAX_FACTS
|
|
78
|
+
});
|
|
73
79
|
|
|
74
80
|
if (!alreadyKnown) {
|
|
75
|
-
|
|
76
|
-
while (memory.facts.length > MAX_FACTS) {
|
|
77
|
-
memory.facts.shift();
|
|
78
|
-
}
|
|
79
|
-
saveMemory(memory);
|
|
81
|
+
saveMemory(updated);
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
let creativeSaved = false;
|
|
@@ -104,7 +106,7 @@ export const memoryWrite = {
|
|
|
104
106
|
|
|
105
107
|
const notes = [
|
|
106
108
|
alreadyKnown ? 'Fact already known, not duplicated.' : 'Fact saved.',
|
|
107
|
-
`Total persistent facts: ${
|
|
109
|
+
`Total persistent facts: ${updated.facts.length}.`,
|
|
108
110
|
creativeSaved ? 'Creative pattern recorded in the V5 Cortex.' : ''
|
|
109
111
|
].filter(Boolean);
|
|
110
112
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugin,
|
|
3
|
+
createSkillPlugin,
|
|
3
4
|
disablePlugin,
|
|
4
5
|
enablePlugin,
|
|
5
6
|
listPlugins
|
|
@@ -8,17 +9,22 @@ import {
|
|
|
8
9
|
export const pluginManagerTool = {
|
|
9
10
|
schema: {
|
|
10
11
|
name: 'plugin.manager',
|
|
11
|
-
description: 'Create and manage local Causyne plugins.
|
|
12
|
+
description: 'Create and manage local Causyne plugins. create-skill-plugin packages reviewed MIT/Apache skill text as a disabled, non-executable plugin and retains its license; enable trusts the current directory digest.',
|
|
12
13
|
parameters: {
|
|
13
14
|
type: 'object',
|
|
14
15
|
properties: {
|
|
15
|
-
action: { type: 'string', enum: ['list', 'create', 'enable', 'disable'] },
|
|
16
|
+
action: { type: 'string', enum: ['list', 'create', 'create-skill-plugin', 'enable', 'disable'] },
|
|
16
17
|
name: { type: 'string', description: 'Lowercase plugin name using letters, digits, and hyphens.' },
|
|
17
18
|
description: { type: 'string' },
|
|
18
19
|
toolName: { type: 'string' },
|
|
19
20
|
toolDescription: { type: 'string' },
|
|
20
21
|
parametersSchema: { type: 'string', description: 'JSON object schema for the custom tool arguments.' },
|
|
21
22
|
javascriptCode: { type: 'string', description: 'Body of async execute(args, context), or a complete module exporting execute.' },
|
|
23
|
+
skillId: { type: 'string' },
|
|
24
|
+
skillName: { type: 'string' },
|
|
25
|
+
skillDescription: { type: 'string' },
|
|
26
|
+
skillContent: { type: 'string', description: 'Reviewed SKILL.md source, not executed as code.' },
|
|
27
|
+
licenseText: { type: 'string', description: 'Complete original MIT or Apache-2.0 license notice.' },
|
|
22
28
|
capabilities: {
|
|
23
29
|
type: 'array',
|
|
24
30
|
items: { type: 'string', enum: ['workspace:read', 'workspace:write', 'network', 'subprocess'] }
|
|
@@ -38,6 +44,15 @@ export const pluginManagerTool = {
|
|
|
38
44
|
const result = disablePlugin(args.name);
|
|
39
45
|
return result.ok ? { success: true, ...result } : { success: false, error: result.error };
|
|
40
46
|
}
|
|
47
|
+
if (args.action === 'create-skill-plugin') {
|
|
48
|
+
const result = createSkillPlugin({
|
|
49
|
+
name: args.name, description: args.description,
|
|
50
|
+
skillId: args.skillId, skillName: args.skillName,
|
|
51
|
+
skillDescription: args.skillDescription,
|
|
52
|
+
skillContent: args.skillContent, licenseText: args.licenseText
|
|
53
|
+
});
|
|
54
|
+
return result.ok ? { success: true, ...result } : { success: false, error: result.error };
|
|
55
|
+
}
|
|
41
56
|
if (args.action === 'create') {
|
|
42
57
|
let parameters;
|
|
43
58
|
try {
|
package/src/tui/chatRenderer.js
CHANGED
|
@@ -822,7 +822,10 @@ export class ChatRenderer {
|
|
|
822
822
|
this.status.contextChars = finalMeasured;
|
|
823
823
|
}
|
|
824
824
|
if (!this.status.contextLimit) {
|
|
825
|
-
this.status.contextLimit = resolveCharPool(this.status.tier
|
|
825
|
+
this.status.contextLimit = resolveCharPool(this.status.tier, undefined, {
|
|
826
|
+
provider: sessionInfo?.provider || this.status.provider,
|
|
827
|
+
model: sessionInfo?.model || this.status.model
|
|
828
|
+
});
|
|
826
829
|
}
|
|
827
830
|
if (sessionInfo) {
|
|
828
831
|
this.status.setSession({
|
package/src/tui/codeProgress.js
CHANGED
|
@@ -10,14 +10,15 @@ export const CODE_PANEL_LINES = 10;
|
|
|
10
10
|
const MAX_STREAM_PREVIEW_CHARS = 256_000;
|
|
11
11
|
const FILE_TOOLS = {
|
|
12
12
|
fs_write: 'Creating', fs_edit: 'Editing', MultiEdit: 'Editing',
|
|
13
|
+
write: 'Creating', edit: 'Editing', multiedit: 'Editing', multi_edit: 'Editing',
|
|
13
14
|
'fs.write': 'Creating', 'fs.edit': 'Editing',
|
|
14
15
|
fs_delete: 'Removing', fs_move: 'Moving',
|
|
15
|
-
write_file: 'Creating', edit_file: 'Editing', delete_file: 'Removing',
|
|
16
|
+
write_file: 'Creating', write_to_file: 'Creating', edit_file: 'Editing', delete_file: 'Removing',
|
|
16
17
|
create_file: 'Creating', new_file: 'Creating',
|
|
17
18
|
remove_file: 'Removing', unlink: 'Removing', move_file: 'Moving',
|
|
18
19
|
replace_file_content: 'Editing', multi_replace_file_content: 'Editing',
|
|
19
20
|
apply_patch: 'Editing', patch: 'Editing', str_replace_editor: 'Editing',
|
|
20
|
-
WriteFile: 'Creating', EditFile: 'Editing', DeleteFile: 'Removing',
|
|
21
|
+
WriteFile: 'Creating', WriteToFile: 'Creating', EditFile: 'Editing', DeleteFile: 'Removing',
|
|
21
22
|
CreateFile: 'Creating', RemoveFile: 'Removing', MoveFile: 'Moving',
|
|
22
23
|
ReplaceFileContent: 'Editing', MultiReplaceFileContent: 'Editing'
|
|
23
24
|
};
|