@causyne/agent 1.20.30 → 1.20.32

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 (41) hide show
  1. package/package.json +1 -1
  2. package/src/agentLoop.js +8 -0
  3. package/src/agentLoop.ts +7 -0
  4. package/src/appChannel.js +52 -74
  5. package/src/appChannel.ts +106 -0
  6. package/src/creative/apps.js +206 -11
  7. package/src/creative/apps.ts +198 -6
  8. package/src/creative/liveBridge.js +1481 -0
  9. package/src/creative/liveBridge.ts +1829 -0
  10. package/src/creative/pipeline.js +31 -3
  11. package/src/creative/pipeline.ts +36 -7
  12. package/src/decideTools.js +3 -1
  13. package/src/decideTools.ts +3 -1
  14. package/src/decisionPolicy.js +5 -2
  15. package/src/decisionPolicy.ts +7 -1
  16. package/src/mcp/mcpRegistry.js +3 -1
  17. package/src/mcp/mcpRegistry.ts +3 -1
  18. package/src/sandbox.js +5 -1
  19. package/src/smartToolsUse.js +2 -1
  20. package/src/smartToolsUse.ts +2 -1
  21. package/src/tool-scripts/resolve_automator.py +167 -34
  22. package/src/toolPacks.js +5 -3
  23. package/src/toolPacks.ts +5 -3
  24. package/src/tools/creativeApps.js +226 -7
  25. package/src/tools/creativeApps.ts +233 -7
  26. package/src/tools/memoryWrite.js +71 -89
  27. package/src/tools/memoryWrite.ts +108 -0
  28. package/src/tools/resolveAutomator.js +356 -89
  29. package/src/tools/resolveAutomator.ts +403 -0
  30. package/src/toolsList.js +1 -1
  31. package/src/toolsList.ts +1 -1
  32. package/src/tui/consoleGuard.js +85 -0
  33. package/src/tui/consoleGuard.ts +102 -0
  34. package/src/tui/messageActionPlacement.js +8 -3
  35. package/src/tui/messageActionPlacement.ts +8 -3
  36. package/src/tui/messageInteraction.js +184 -27
  37. package/src/tui/messageInteraction.ts +221 -45
  38. package/src/tui/mouseHover.js +4 -0
  39. package/src/tui/mouseHover.ts +5 -0
  40. package/src/tui/smartLinkClick.js +353 -0
  41. package/src/tui/smartLinkClick.ts +413 -0
@@ -1,99 +1,81 @@
1
+ // @ts-expect-error Legacy memory module has no TypeScript declarations yet.
1
2
  import { getMemory, saveMemory } from '../memory.js';
2
3
  import { cortexDb } from '../cortex/vectorDb.js';
3
-
4
- // Persistent memory write.
5
- //
6
- // This tool used to append facts to `{cwd}/.causyne_memory_store.json` — a file
7
- // that nothing in the codebase ever reads. The facts the agent is actually shown
8
- // come from `getMemoryContextString()`, which reads `~/.causyne/memory.json`, and
9
-
10
- // never connected, so every fact the agent chose to remember was written into a
11
- // per-project dead end and silently lost. It now writes where the agent reads.
12
-
13
4
  const MAX_FACTS = 100;
14
-
15
5
  export const memoryWrite = {
16
- schema: {
17
- name: 'memory_write',
18
- description: "Save a durable fact about the user, their machine, or their project into persistent memory. Facts saved here are injected into your system context on every future task, so record only things worth remembering across sessions (preferences, conventions, paths, stack choices). After completing a web or UI design, also pass creativePattern so you do not repeat the same aesthetic next time.",
19
- parameters: {
20
- type: 'object',
21
- properties: {
22
- fact: {
23
- type: 'string',
24
- description: 'The concise, durable fact to remember. One fact per call.'
25
- },
26
- creativePattern: {
27
- type: 'object',
28
- description: 'Optional. Record a completed design so future projects deliberately differ from it.',
29
- properties: {
30
- project: { type: 'string', description: 'What was built, e.g. "coffee roaster landing page".' },
31
- designApproach: { type: 'string', description: 'The design movement committed to, e.g. "Swiss International", "Brutalism".' },
32
- colorPalette: { type: 'string', description: 'The palette used, e.g. "warm neutrals + oxblood accent".' },
33
- fonts: { type: 'string', description: 'Typefaces used, e.g. "Space Grotesk / Inter".' }
34
- }
6
+ schema: {
7
+ name: 'memory_write',
8
+ description: 'Save a durable fact about the user, their machine, or their project into persistent memory. Facts saved here are injected into your system context on every future task, so record only things worth remembering across sessions (preferences, conventions, paths, stack choices). After completing a web or UI design, also pass creativePattern so you do not repeat the same aesthetic next time.',
9
+ parameters: {
10
+ type: 'object',
11
+ properties: {
12
+ fact: {
13
+ type: 'string',
14
+ description: 'The concise, durable fact to remember. One fact per call.'
15
+ },
16
+ creativePattern: {
17
+ type: 'object',
18
+ description: 'Optional. Record a completed design so future projects deliberately differ from it.',
19
+ properties: {
20
+ project: { type: 'string', description: 'What was built, e.g. "coffee roaster landing page".' },
21
+ designApproach: { type: 'string', description: 'The design movement committed to, e.g. "Swiss International", "Brutalism".' },
22
+ colorPalette: { type: 'string', description: 'The palette used, e.g. "warm neutrals + oxblood accent".' },
23
+ fonts: { type: 'string', description: 'Typefaces used, e.g. "Space Grotesk / Inter".' }
24
+ }
25
+ }
26
+ },
27
+ required: ['fact']
35
28
  }
36
- },
37
- required: ['fact']
38
- }
39
- },
40
-
41
- execute: async (args, dependencies) => {
42
- if (!args || !args.fact) {
43
- return { success: false, error: "Missing 'fact' parameter." };
44
- }
45
-
46
- try {
47
- const memory = getMemory();
48
- if (!Array.isArray(memory.facts)) memory.facts = [];
49
-
50
- const fact = String(args.fact).trim();
51
- const alreadyKnown = memory.facts.includes(fact);
52
-
53
- if (!alreadyKnown) {
54
- memory.facts.push(fact);
55
- // Self-culling: keep the store bounded so it cannot grow into the
56
- // system prompt without limit.
57
- while (memory.facts.length > MAX_FACTS) {
58
- memory.facts.shift();
29
+ },
30
+ execute: async (args, dependencies) => {
31
+ if (!args || !args.fact) {
32
+ return { success: false, error: "Missing 'fact' parameter." };
59
33
  }
60
- saveMemory(memory);
61
- }
62
-
63
- // Anti-slop creative memory. saveCreativePattern() existed but had no
64
- // caller anywhere, so getRecentCreativePatterns() always returned empty
65
- // and the "DO NOT REPEAT RECENT PATTERNS" directive never once fired.
66
- let creativeSaved = false;
67
- if (args.creativePattern && args.creativePattern.designApproach) {
68
34
  try {
69
- await cortexDb.saveCreativePattern({
70
- project: args.creativePattern.project || 'untitled project',
71
- designApproach: args.creativePattern.designApproach,
72
- colorPalette: args.creativePattern.colorPalette || 'unspecified',
73
- fonts: args.creativePattern.fonts || 'unspecified'
74
- });
75
- creativeSaved = true;
76
- } catch (e) {
77
- console.error('[CORTEX] Creative pattern save failed:', e.message);
35
+ const memory = getMemory();
36
+ if (!Array.isArray(memory.facts))
37
+ memory.facts = [];
38
+ const fact = String(args.fact).trim();
39
+ const alreadyKnown = memory.facts.includes(fact);
40
+ if (!alreadyKnown) {
41
+ memory.facts.push(fact);
42
+ while (memory.facts.length > MAX_FACTS) {
43
+ memory.facts.shift();
44
+ }
45
+ saveMemory(memory);
46
+ }
47
+ let creativeSaved = false;
48
+ if (args.creativePattern && args.creativePattern.designApproach) {
49
+ try {
50
+ await cortexDb.saveCreativePattern({
51
+ project: args.creativePattern.project || 'untitled project',
52
+ designApproach: args.creativePattern.designApproach,
53
+ colorPalette: args.creativePattern.colorPalette || 'unspecified',
54
+ fonts: args.creativePattern.fonts || 'unspecified'
55
+ });
56
+ creativeSaved = true;
57
+ }
58
+ catch {
59
+ // Optional Cortex dependencies may not be installed; standard local session memory remains active.
60
+ // Never write raw errors to console.error during a TUI session as that corrupts the composer viewport.
61
+ }
62
+ }
63
+ if (dependencies && typeof dependencies.broadcast === 'function') {
64
+ dependencies.broadcast({
65
+ type: 'agent_message',
66
+ content: `🧠 Persistent memory updated: "${fact}"`
67
+ });
68
+ }
69
+ const notes = [
70
+ alreadyKnown ? 'Fact already known, not duplicated.' : 'Fact saved.',
71
+ `Total persistent facts: ${memory.facts.length}.`,
72
+ creativeSaved ? 'Creative pattern recorded in the V5 Cortex.' : ''
73
+ ].filter(Boolean);
74
+ return { success: true, output: notes.join(' ') };
75
+ }
76
+ catch (e) {
77
+ const msg = e instanceof Error ? e.message : String(e);
78
+ return { success: false, error: `Failed to save memory: ${msg}` };
78
79
  }
79
- }
80
-
81
- if (dependencies && dependencies.broadcast) {
82
- dependencies.broadcast({
83
- type: 'agent_message',
84
- content: `🧠 Persistent memory updated: "${fact}"`
85
- });
86
- }
87
-
88
- const notes = [
89
- alreadyKnown ? 'Fact already known, not duplicated.' : 'Fact saved.',
90
- `Total persistent facts: ${memory.facts.length}.`,
91
- creativeSaved ? 'Creative pattern recorded in the V5 Cortex.' : ''
92
- ].filter(Boolean);
93
-
94
- return { success: true, output: notes.join(' ') };
95
- } catch (e) {
96
- return { success: false, error: `Failed to save memory: ${e.message}` };
97
80
  }
98
- }
99
81
  };
@@ -0,0 +1,108 @@
1
+ // @ts-expect-error Legacy memory module has no TypeScript declarations yet.
2
+ import { getMemory, saveMemory } from '../memory.js';
3
+ import { cortexDb } from '../cortex/vectorDb.js';
4
+
5
+ const MAX_FACTS = 100;
6
+
7
+ export interface CreativePatternInput {
8
+ project?: string;
9
+ designApproach?: string;
10
+ colorPalette?: string;
11
+ fonts?: string;
12
+ }
13
+
14
+ export interface MemoryWriteArgs {
15
+ fact?: string;
16
+ creativePattern?: CreativePatternInput;
17
+ }
18
+
19
+ export interface MemoryWriteDependencies {
20
+ broadcast?: (event: { type: string; content: string }) => void;
21
+ }
22
+
23
+ export const memoryWrite = {
24
+ schema: {
25
+ name: 'memory_write',
26
+ description:
27
+ 'Save a durable fact about the user, their machine, or their project into persistent memory. Facts saved here are injected into your system context on every future task, so record only things worth remembering across sessions (preferences, conventions, paths, stack choices). After completing a web or UI design, also pass creativePattern so you do not repeat the same aesthetic next time.',
28
+ parameters: {
29
+ type: 'object',
30
+ properties: {
31
+ fact: {
32
+ type: 'string',
33
+ description: 'The concise, durable fact to remember. One fact per call.'
34
+ },
35
+ creativePattern: {
36
+ type: 'object',
37
+ description: 'Optional. Record a completed design so future projects deliberately differ from it.',
38
+ properties: {
39
+ project: { type: 'string', description: 'What was built, e.g. "coffee roaster landing page".' },
40
+ designApproach: { type: 'string', description: 'The design movement committed to, e.g. "Swiss International", "Brutalism".' },
41
+ colorPalette: { type: 'string', description: 'The palette used, e.g. "warm neutrals + oxblood accent".' },
42
+ fonts: { type: 'string', description: 'Typefaces used, e.g. "Space Grotesk / Inter".' }
43
+ }
44
+ }
45
+ },
46
+ required: ['fact']
47
+ }
48
+ },
49
+
50
+ execute: async (
51
+ args: MemoryWriteArgs | null | undefined,
52
+ dependencies?: MemoryWriteDependencies
53
+ ): Promise<{ success: boolean; output?: string; error?: string }> => {
54
+ if (!args || !args.fact) {
55
+ return { success: false, error: "Missing 'fact' parameter." };
56
+ }
57
+
58
+ try {
59
+ const memory = getMemory() as { facts?: string[] };
60
+ if (!Array.isArray(memory.facts)) memory.facts = [];
61
+
62
+ const fact = String(args.fact).trim();
63
+ const alreadyKnown = memory.facts.includes(fact);
64
+
65
+ if (!alreadyKnown) {
66
+ memory.facts.push(fact);
67
+ while (memory.facts.length > MAX_FACTS) {
68
+ memory.facts.shift();
69
+ }
70
+ saveMemory(memory);
71
+ }
72
+
73
+ let creativeSaved = false;
74
+ if (args.creativePattern && args.creativePattern.designApproach) {
75
+ try {
76
+ await cortexDb.saveCreativePattern({
77
+ project: args.creativePattern.project || 'untitled project',
78
+ designApproach: args.creativePattern.designApproach,
79
+ colorPalette: args.creativePattern.colorPalette || 'unspecified',
80
+ fonts: args.creativePattern.fonts || 'unspecified'
81
+ });
82
+ creativeSaved = true;
83
+ } catch {
84
+ // Optional Cortex dependencies may not be installed; standard local session memory remains active.
85
+ // Never write raw errors to console.error during a TUI session as that corrupts the composer viewport.
86
+ }
87
+ }
88
+
89
+ if (dependencies && typeof dependencies.broadcast === 'function') {
90
+ dependencies.broadcast({
91
+ type: 'agent_message',
92
+ content: `🧠 Persistent memory updated: "${fact}"`
93
+ });
94
+ }
95
+
96
+ const notes = [
97
+ alreadyKnown ? 'Fact already known, not duplicated.' : 'Fact saved.',
98
+ `Total persistent facts: ${memory.facts.length}.`,
99
+ creativeSaved ? 'Creative pattern recorded in the V5 Cortex.' : ''
100
+ ].filter(Boolean);
101
+
102
+ return { success: true, output: notes.join(' ') };
103
+ } catch (e) {
104
+ const msg = e instanceof Error ? e.message : String(e);
105
+ return { success: false, error: `Failed to save memory: ${msg}` };
106
+ }
107
+ }
108
+ };