@causyne/agent 1.20.65 → 1.20.68

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 (42) hide show
  1. package/package.json +1 -1
  2. package/src/agentLoop.js +23 -15
  3. package/src/agentLoop.ts +23 -15
  4. package/src/browser/causyneBrowser.js +1 -1
  5. package/src/browser/causyneBrowser.ts +1 -1
  6. package/src/cliMode.js +62 -8
  7. package/src/commands.js +46 -19
  8. package/src/contextManager.js +1 -1
  9. package/src/continuum/ui/continuumPicker.js +1 -1
  10. package/src/continuum/ui/continuumPicker.ts +1 -1
  11. package/src/embodimentSession.js +1 -1
  12. package/src/planCache.js +1 -1
  13. package/src/planCache.ts +1 -1
  14. package/src/promptMentions.js +7 -7
  15. package/src/promptMentions.ts +7 -7
  16. package/src/providers/dashscope-byok.js +1 -1
  17. package/src/providers/qwen-byok.js +1 -1
  18. package/src/skillsManager.d.ts +4 -1
  19. package/src/tokenTracker.js +1 -1
  20. package/src/tokenTracker.ts +1 -1
  21. package/src/tool-scripts/ax_snapshot.ps1 +10 -10
  22. package/src/tools/fsList.js +1 -1
  23. package/src/tools/memoryWrite.js +1 -1
  24. package/src/tools/memoryWrite.ts +1 -1
  25. package/src/tui/chatRenderer.js +3 -2
  26. package/src/tui/codeStreamRenderer.js +8 -5
  27. package/src/tui/codeStreamRenderer.ts +10 -5
  28. package/src/tui/lineEditor.js +14 -21
  29. package/src/tui/modelPicker.js +1 -1
  30. package/src/tui/modelPicker.ts +1 -1
  31. package/src/tui/prompt.js +38 -13
  32. package/src/tui/sessionPicker.js +1 -1
  33. package/src/tui/sessionPicker.ts +1 -1
  34. package/src/tui/sessionSidebar.js +13 -0
  35. package/src/tui/sessionSidebar.ts +15 -0
  36. package/src/tui/skillAuthoring.js +147 -0
  37. package/src/tui/skillAuthoring.ts +172 -0
  38. package/src/tui/stage.js +1 -1
  39. package/src/tui/stageSurface.js +8 -10
  40. package/src/tui/theme.js +3 -0
  41. package/src/vfeTracker.js +1 -1
  42. package/src/vfeTracker.ts +1 -1
@@ -0,0 +1,147 @@
1
+ // @ts-expect-error userSkills.js is awaiting TypeScript migration.
2
+ import { writeUserSkill, validateSegment, skillTemplate } from '../userSkills.js';
3
+ import { invalidateUserSkills } from '../skillsManager.js';
4
+ // @ts-expect-error theme.js has no TypeScript declaration yet.
5
+ import { paint, bold, dim } from './theme.js';
6
+ // @ts-expect-error dialogs.js is awaiting TypeScript migration.
7
+ import { InputLayer, SelectLayer } from './dialogs.js';
8
+ const COMMON_DOMAINS = [
9
+ { value: 'custom', label: 'custom', description: 'General project & personal workflow skills' },
10
+ { value: 'engineering', label: 'engineering', description: 'Software architecture, refactoring & review' },
11
+ { value: 'frontend', label: 'frontend', description: 'Web UI, CSS, React, components & layout' },
12
+ { value: 'backend', label: 'backend', description: 'APIs, databases, server infrastructure' },
13
+ { value: 'devops', label: 'devops', description: 'CI/CD, Docker, deployment & releases' },
14
+ { value: 'testing', label: 'testing', description: 'Unit, integration & regression tests' },
15
+ { value: 'mobile', label: 'mobile', description: 'Android, iOS, Flutter, React Native' },
16
+ { value: '__other__', label: '+ Enter custom category...', description: 'Specify any category name' }
17
+ ];
18
+ /**
19
+ * Interactive wizard hosted on ChatPrompt to scaffold and create a new skill.
20
+ */
21
+ export async function runInteractiveSkillWizard(prompt) {
22
+ // Step 1: Select or enter domain/category
23
+ const chosenDomain = await new Promise((resolve) => {
24
+ let resolved = false;
25
+ const finish = (val) => {
26
+ if (!resolved) {
27
+ resolved = true;
28
+ resolve(val);
29
+ }
30
+ };
31
+ const layer = new SelectLayer({
32
+ title: 'create skill · category',
33
+ placeholder: 'choose or type category',
34
+ items: COMMON_DOMAINS,
35
+ width: 72,
36
+ height: 14,
37
+ onPick: (item) => {
38
+ finish(item?.value || null);
39
+ }
40
+ });
41
+ prompt.openLayer(layer);
42
+ });
43
+ if (!chosenDomain)
44
+ return null;
45
+ let domain = chosenDomain;
46
+ if (domain === '__other__') {
47
+ const customDomain = await new Promise((resolve) => {
48
+ let resolved = false;
49
+ const finish = (val) => {
50
+ if (!resolved) {
51
+ resolved = true;
52
+ resolve(val);
53
+ }
54
+ };
55
+ const layer = new InputLayer({
56
+ title: 'create skill · category name',
57
+ lines: ['Category / domain name (e.g. data, analytics, cloud, tools):'],
58
+ placeholder: 'category-name',
59
+ onSubmit: (val) => finish(val.trim().toLowerCase()),
60
+ onCancel: () => finish(null)
61
+ });
62
+ prompt.openLayer(layer);
63
+ });
64
+ if (!customDomain)
65
+ return null;
66
+ const err = validateSegment(customDomain, 'category');
67
+ if (err) {
68
+ if (typeof prompt.showText === 'function') {
69
+ prompt.showText('Invalid Category', err, { danger: true });
70
+ }
71
+ return null;
72
+ }
73
+ domain = customDomain;
74
+ }
75
+ // Step 2: Skill name
76
+ const skillName = await new Promise((resolve) => {
77
+ let resolved = false;
78
+ const finish = (val) => {
79
+ if (!resolved) {
80
+ resolved = true;
81
+ resolve(val);
82
+ }
83
+ };
84
+ const layer = new InputLayer({
85
+ title: 'create skill · name',
86
+ lines: [
87
+ `Category: ${paint('accent', domain)}`,
88
+ 'Skill name (lowercase letters, numbers, hyphens — e.g. play-store-release, pr-review):'
89
+ ],
90
+ placeholder: 'my-new-skill',
91
+ onSubmit: (val) => finish(val.trim().toLowerCase()),
92
+ onCancel: () => finish(null)
93
+ });
94
+ prompt.openLayer(layer);
95
+ });
96
+ if (!skillName)
97
+ return null;
98
+ const nameErr = validateSegment(skillName, 'skill name');
99
+ if (nameErr) {
100
+ if (typeof prompt.showText === 'function') {
101
+ prompt.showText('Invalid Skill Name', nameErr, { danger: true });
102
+ }
103
+ return null;
104
+ }
105
+ // Step 3: Skill description
106
+ const skillDesc = await new Promise((resolve) => {
107
+ let resolved = false;
108
+ const finish = (val) => {
109
+ if (!resolved) {
110
+ resolved = true;
111
+ resolve(val);
112
+ }
113
+ };
114
+ const layer = new InputLayer({
115
+ title: 'create skill · description',
116
+ lines: [
117
+ `Skill: ${paint('accent', `${domain}/${skillName}`)}`,
118
+ 'Short description: what this skill does and when the agent should use it:'
119
+ ],
120
+ placeholder: 'e.g. Prepares and validates Android app bundles for Google Play Store release.',
121
+ onSubmit: (val) => finish(val.trim()),
122
+ onCancel: () => finish(null)
123
+ });
124
+ prompt.openLayer(layer);
125
+ });
126
+ if (!skillDesc)
127
+ return null;
128
+ // Step 4: Write skill file
129
+ const content = skillTemplate(domain, skillName, skillDesc);
130
+ const written = writeUserSkill({ domain, name: skillName, content, overwrite: false });
131
+ if (!written.ok) {
132
+ if (typeof prompt.showText === 'function') {
133
+ prompt.showText('Skill Creation Failed', written.error || 'Failed to write skill file', { danger: true });
134
+ }
135
+ return null;
136
+ }
137
+ invalidateUserSkills();
138
+ return {
139
+ domain,
140
+ id: skillName,
141
+ name: skillName,
142
+ description: skillDesc,
143
+ content,
144
+ path: written.path,
145
+ source: 'user'
146
+ };
147
+ }
@@ -0,0 +1,172 @@
1
+ // @ts-expect-error userSkills.js is awaiting TypeScript migration.
2
+ import { writeUserSkill, validateSegment, skillTemplate } from '../userSkills.js';
3
+ import { invalidateUserSkills } from '../skillsManager.js';
4
+ // @ts-expect-error theme.js has no TypeScript declaration yet.
5
+ import { paint, bold, dim } from './theme.js';
6
+ // @ts-expect-error dialogs.js is awaiting TypeScript migration.
7
+ import { InputLayer, SelectLayer } from './dialogs.js';
8
+ // @ts-expect-error prompt.js is awaiting TypeScript migration.
9
+ import type { ChatPrompt } from './prompt.js';
10
+
11
+ export interface CreatedUserSkill {
12
+ domain: string;
13
+ id: string;
14
+ name: string;
15
+ description: string;
16
+ content: string;
17
+ path?: string;
18
+ source: 'user';
19
+ }
20
+
21
+ interface CommonDomainChoice {
22
+ value: string;
23
+ label: string;
24
+ description: string;
25
+ }
26
+
27
+ const COMMON_DOMAINS: CommonDomainChoice[] = [
28
+ { value: 'custom', label: 'custom', description: 'General project & personal workflow skills' },
29
+ { value: 'engineering', label: 'engineering', description: 'Software architecture, refactoring & review' },
30
+ { value: 'frontend', label: 'frontend', description: 'Web UI, CSS, React, components & layout' },
31
+ { value: 'backend', label: 'backend', description: 'APIs, databases, server infrastructure' },
32
+ { value: 'devops', label: 'devops', description: 'CI/CD, Docker, deployment & releases' },
33
+ { value: 'testing', label: 'testing', description: 'Unit, integration & regression tests' },
34
+ { value: 'mobile', label: 'mobile', description: 'Android, iOS, Flutter, React Native' },
35
+ { value: '__other__', label: '+ Enter custom category...', description: 'Specify any category name' }
36
+ ];
37
+
38
+ /**
39
+ * Interactive wizard hosted on ChatPrompt to scaffold and create a new skill.
40
+ */
41
+ export async function runInteractiveSkillWizard(prompt: ChatPrompt): Promise<CreatedUserSkill | null> {
42
+ // Step 1: Select or enter domain/category
43
+ const chosenDomain = await new Promise<string | null>((resolve) => {
44
+ let resolved = false;
45
+ const finish = (val: string | null): void => {
46
+ if (!resolved) {
47
+ resolved = true;
48
+ resolve(val);
49
+ }
50
+ };
51
+ const layer = new SelectLayer({
52
+ title: 'create skill · category',
53
+ placeholder: 'choose or type category',
54
+ items: COMMON_DOMAINS,
55
+ width: 72,
56
+ height: 14,
57
+ onPick: (item: { value?: string } | null) => {
58
+ finish(item?.value || null);
59
+ }
60
+ });
61
+ prompt.openLayer(layer);
62
+ });
63
+
64
+ if (!chosenDomain) return null;
65
+
66
+ let domain = chosenDomain;
67
+ if (domain === '__other__') {
68
+ const customDomain = await new Promise<string | null>((resolve) => {
69
+ let resolved = false;
70
+ const finish = (val: string | null): void => {
71
+ if (!resolved) {
72
+ resolved = true;
73
+ resolve(val);
74
+ }
75
+ };
76
+ const layer = new InputLayer({
77
+ title: 'create skill · category name',
78
+ lines: ['Category / domain name (e.g. data, analytics, cloud, tools):'],
79
+ placeholder: 'category-name',
80
+ onSubmit: (val: string) => finish(val.trim().toLowerCase()),
81
+ onCancel: () => finish(null)
82
+ });
83
+ prompt.openLayer(layer);
84
+ });
85
+ if (!customDomain) return null;
86
+ const err = validateSegment(customDomain, 'category');
87
+ if (err) {
88
+ if (typeof prompt.showText === 'function') {
89
+ prompt.showText('Invalid Category', err, { danger: true });
90
+ }
91
+ return null;
92
+ }
93
+ domain = customDomain;
94
+ }
95
+
96
+ // Step 2: Skill name
97
+ const skillName = await new Promise<string | null>((resolve) => {
98
+ let resolved = false;
99
+ const finish = (val: string | null): void => {
100
+ if (!resolved) {
101
+ resolved = true;
102
+ resolve(val);
103
+ }
104
+ };
105
+ const layer = new InputLayer({
106
+ title: 'create skill · name',
107
+ lines: [
108
+ `Category: ${paint('accent', domain)}`,
109
+ 'Skill name (lowercase letters, numbers, hyphens — e.g. play-store-release, pr-review):'
110
+ ],
111
+ placeholder: 'my-new-skill',
112
+ onSubmit: (val: string) => finish(val.trim().toLowerCase()),
113
+ onCancel: () => finish(null)
114
+ });
115
+ prompt.openLayer(layer);
116
+ });
117
+
118
+ if (!skillName) return null;
119
+ const nameErr = validateSegment(skillName, 'skill name');
120
+ if (nameErr) {
121
+ if (typeof prompt.showText === 'function') {
122
+ prompt.showText('Invalid Skill Name', nameErr, { danger: true });
123
+ }
124
+ return null;
125
+ }
126
+
127
+ // Step 3: Skill description
128
+ const skillDesc = await new Promise<string | null>((resolve) => {
129
+ let resolved = false;
130
+ const finish = (val: string | null): void => {
131
+ if (!resolved) {
132
+ resolved = true;
133
+ resolve(val);
134
+ }
135
+ };
136
+ const layer = new InputLayer({
137
+ title: 'create skill · description',
138
+ lines: [
139
+ `Skill: ${paint('accent', `${domain}/${skillName}`)}`,
140
+ 'Short description: what this skill does and when the agent should use it:'
141
+ ],
142
+ placeholder: 'e.g. Prepares and validates Android app bundles for Google Play Store release.',
143
+ onSubmit: (val: string) => finish(val.trim()),
144
+ onCancel: () => finish(null)
145
+ });
146
+ prompt.openLayer(layer);
147
+ });
148
+
149
+ if (!skillDesc) return null;
150
+
151
+ // Step 4: Write skill file
152
+ const content = skillTemplate(domain, skillName, skillDesc);
153
+ const written = writeUserSkill({ domain, name: skillName, content, overwrite: false });
154
+ if (!written.ok) {
155
+ if (typeof prompt.showText === 'function') {
156
+ prompt.showText('Skill Creation Failed', written.error || 'Failed to write skill file', { danger: true });
157
+ }
158
+ return null;
159
+ }
160
+
161
+ invalidateUserSkills();
162
+
163
+ return {
164
+ domain,
165
+ id: skillName,
166
+ name: skillName,
167
+ description: skillDesc,
168
+ content,
169
+ path: written.path,
170
+ source: 'user'
171
+ };
172
+ }
package/src/tui/stage.js CHANGED
@@ -246,7 +246,7 @@ export class Stage {
246
246
  this.moveTo(target.row);
247
247
  this.write('\r');
248
248
  if (target.col > 0) this.write(`\x1b[${target.col}C`);
249
- this.write((target.hideCursor ? HIDE_CURSOR : SHOW_CURSOR) + '\x1b[6 q' + SYNC_OFF);
249
+ this.write((target.hideCursor ? HIDE_CURSOR : SHOW_CURSOR + '\x1b[6 q') + SYNC_OFF);
250
250
 
251
251
  this.prev = next;
252
252
  this.caret = target;
@@ -417,15 +417,12 @@ export class StageSurface {
417
417
 
418
418
  const height = this.stage.height;
419
419
 
420
- // The prompt may not eat the whole band — but only once there is a
421
- // transcript for it to eat. Trim from the TOP when it would: the status
422
- // footer and the caret row are the last rows and the ones worth keeping,
423
- // and an input box that has scrolled its own oldest row off is a smaller lie
424
- // than a transcript that has vanished.
425
- const floor = contentRows > 0
426
- ? Math.max(MIN_VIEWPORT_ROWS, this.messageActionOverlay?.panel.length || 0)
427
- : 0;
428
- const maxBlock = Math.max(1, height - floor);
420
+ // An active prompt block or modal dialog is the focal point of user interaction.
421
+ // Never slice the top border, title, or input area when the block fits within the stage height.
422
+ // The transcript viewport receives the remaining vertical budget (height - block.length).
423
+ const maxBlock = this.messageActionOverlay?.panel.length
424
+ ? Math.max(1, height - this.messageActionOverlay.panel.length)
425
+ : height;
429
426
  if (block.length > maxBlock) {
430
427
  const cut = block.length - maxBlock;
431
428
  block = block.slice(cut);
@@ -496,7 +493,8 @@ export class StageSurface {
496
493
  model: this.sidebarStatus?.model || this.sessionInfo?.model,
497
494
  contextChars: this.sidebarStatus?.contextChars,
498
495
  contextLimit: this.sidebarStatus?.contextLimit,
499
- plan: this.sidebarPlan
496
+ plan: this.sidebarPlan,
497
+ activeSkill: this.sessionInfo?.activeSkill
500
498
  }, mainRows.length) : [];
501
499
  const painted = sidebar ? joinSessionSidebar(mainRows, panelRows, mainWidth) : mainRows;
502
500
  return this.stage.paint(painted, {
package/src/tui/theme.js CHANGED
@@ -254,6 +254,8 @@ export const GLYPHS = HAS_UNICODE
254
254
  // The left accent bar of a block. Uses box-drawing heavy vertical ('┃')
255
255
  // so it joins seamlessly from row to row without font line-height leading gaps.
256
256
  bar: '┃', step: '▪',
257
+ // Clean icon glyphs for skills and status indicators (no color emoticons).
258
+ skill: '✦', sparkle: '✦', diamond: '◆',
257
259
  // The permission marker. opencode shows a warning triangle and NO risk
258
260
  // word — the level is internal plumbing, and printing 'DANGEROUS' at
259
261
  // someone just makes them numb to it. Colour still carries the tier.
@@ -272,6 +274,7 @@ export const GLYPHS = HAS_UNICODE
272
274
  spinner: getEngineFrames({ unicode: false }),
273
275
  hLine: '-', vLine: '|', corner: '`', tee: '+', ellipsis: '...',
274
276
  bar: '|', step: '*',
277
+ skill: '*', sparkle: '*', diamond: '*',
275
278
  warnMark: '!',
276
279
  barHeavy: '|',
277
280
  topLeft: '+', topRight: '+', bottomLeft: '+', bottomRight: '+'
package/src/vfeTracker.js CHANGED
@@ -150,7 +150,7 @@ export class VFETracker {
150
150
  * Format the high-priority paradigm shift prompt directive.
151
151
  */
152
152
  getParadigmShiftDirective() {
153
- return (`\n\n🚨 [PARADIGM SHIFT REQUIRED — ACTIVE INFERENCE DEADLOCK DETECTED]\n` +
153
+ return (`\n\n△ [PARADIGM SHIFT REQUIRED — ACTIVE INFERENCE DEADLOCK DETECTED]\n` +
154
154
  `Variational Free Energy tracking detected a persistent error plateau with zero convergence.\n` +
155
155
  `Your current mental model and execution route are trapped in a local minimum.\n` +
156
156
  `DO NOT retry previous variations, tweak parameters, or repeat failed commands.\n` +
package/src/vfeTracker.ts CHANGED
@@ -230,7 +230,7 @@ export class VFETracker {
230
230
  */
231
231
  getParadigmShiftDirective(): string {
232
232
  return (
233
- `\n\n🚨 [PARADIGM SHIFT REQUIRED — ACTIVE INFERENCE DEADLOCK DETECTED]\n` +
233
+ `\n\n△ [PARADIGM SHIFT REQUIRED — ACTIVE INFERENCE DEADLOCK DETECTED]\n` +
234
234
  `Variational Free Energy tracking detected a persistent error plateau with zero convergence.\n` +
235
235
  `Your current mental model and execution route are trapped in a local minimum.\n` +
236
236
  `DO NOT retry previous variations, tweak parameters, or repeat failed commands.\n` +