@project-ava-supernova/core 0.2.187 → 0.2.189

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 (209) hide show
  1. package/dist/agent/agent.d.ts +1 -1
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/agent.js +23 -5
  4. package/dist/agent/agent.js.map +1 -1
  5. package/dist/agent/mode-tags.d.ts.map +1 -1
  6. package/dist/agent/mode-tags.js +3 -1
  7. package/dist/agent/mode-tags.js.map +1 -1
  8. package/dist/agent/social-craft.d.ts +1 -1
  9. package/dist/agent/social-craft.d.ts.map +1 -1
  10. package/dist/agent/social-craft.js +1 -1
  11. package/dist/agent/system-prompt.d.ts +13 -18
  12. package/dist/agent/system-prompt.d.ts.map +1 -1
  13. package/dist/agent/system-prompt.js +86 -37
  14. package/dist/agent/system-prompt.js.map +1 -1
  15. package/dist/brainstorm/brainstorm-store.d.ts +47 -25
  16. package/dist/brainstorm/brainstorm-store.d.ts.map +1 -1
  17. package/dist/brainstorm/brainstorm-store.js +221 -104
  18. package/dist/brainstorm/brainstorm-store.js.map +1 -1
  19. package/dist/brainstorm/page.d.ts +41 -0
  20. package/dist/brainstorm/page.d.ts.map +1 -0
  21. package/dist/brainstorm/page.js +109 -0
  22. package/dist/brainstorm/page.js.map +1 -0
  23. package/dist/brainstorm/types.d.ts +75 -19
  24. package/dist/brainstorm/types.d.ts.map +1 -1
  25. package/dist/brainstorm/types.js +19 -14
  26. package/dist/brainstorm/types.js.map +1 -1
  27. package/dist/brainstorm/work-plans.d.ts +23 -0
  28. package/dist/brainstorm/work-plans.d.ts.map +1 -0
  29. package/dist/brainstorm/work-plans.js +56 -0
  30. package/dist/brainstorm/work-plans.js.map +1 -0
  31. package/dist/brand/brand-kits.d.ts +17 -0
  32. package/dist/brand/brand-kits.d.ts.map +1 -1
  33. package/dist/brand/brand-kits.js +10 -0
  34. package/dist/brand/brand-kits.js.map +1 -1
  35. package/dist/config/personality.js +1 -1
  36. package/dist/docs/content/concepts.js +1 -1
  37. package/dist/docs/content/concepts.js.map +1 -1
  38. package/dist/docs/content/reference.js +1 -1
  39. package/dist/docs/content/reference.js.map +1 -1
  40. package/dist/docs/content/start.js +2 -2
  41. package/dist/docs/content/start.js.map +1 -1
  42. package/dist/docs/data/modes.d.ts.map +1 -1
  43. package/dist/docs/data/modes.js +3 -9
  44. package/dist/docs/data/modes.js.map +1 -1
  45. package/dist/docs/data/personas.js +4 -4
  46. package/dist/docs/data/personas.js.map +1 -1
  47. package/dist/docs/data/shortcuts.d.ts.map +1 -1
  48. package/dist/docs/data/shortcuts.js +8 -7
  49. package/dist/docs/data/shortcuts.js.map +1 -1
  50. package/dist/docs/i18n/translations.d.ts.map +1 -1
  51. package/dist/docs/i18n/translations.js +1 -1
  52. package/dist/docs/i18n/translations.js.map +1 -1
  53. package/dist/history/conversation-title.d.ts +1 -1
  54. package/dist/history/conversation-title.d.ts.map +1 -1
  55. package/dist/history/conversation-title.js +1 -0
  56. package/dist/history/conversation-title.js.map +1 -1
  57. package/dist/i18n/keep-english.d.ts.map +1 -1
  58. package/dist/i18n/keep-english.js +0 -4
  59. package/dist/i18n/keep-english.js.map +1 -1
  60. package/dist/i18n/locales/ar.d.ts.map +1 -1
  61. package/dist/i18n/locales/ar.js +242 -36
  62. package/dist/i18n/locales/ar.js.map +1 -1
  63. package/dist/i18n/locales/de.d.ts.map +1 -1
  64. package/dist/i18n/locales/de.js +242 -36
  65. package/dist/i18n/locales/de.js.map +1 -1
  66. package/dist/i18n/locales/en.d.ts +236 -32
  67. package/dist/i18n/locales/en.d.ts.map +1 -1
  68. package/dist/i18n/locales/en.js +242 -36
  69. package/dist/i18n/locales/en.js.map +1 -1
  70. package/dist/i18n/locales/es.d.ts.map +1 -1
  71. package/dist/i18n/locales/es.js +242 -36
  72. package/dist/i18n/locales/es.js.map +1 -1
  73. package/dist/i18n/locales/fr.d.ts.map +1 -1
  74. package/dist/i18n/locales/fr.js +242 -36
  75. package/dist/i18n/locales/fr.js.map +1 -1
  76. package/dist/i18n/locales/hi.d.ts.map +1 -1
  77. package/dist/i18n/locales/hi.js +242 -36
  78. package/dist/i18n/locales/hi.js.map +1 -1
  79. package/dist/i18n/locales/id.d.ts.map +1 -1
  80. package/dist/i18n/locales/id.js +242 -36
  81. package/dist/i18n/locales/id.js.map +1 -1
  82. package/dist/i18n/locales/it.d.ts.map +1 -1
  83. package/dist/i18n/locales/it.js +242 -36
  84. package/dist/i18n/locales/it.js.map +1 -1
  85. package/dist/i18n/locales/ja.d.ts.map +1 -1
  86. package/dist/i18n/locales/ja.js +242 -36
  87. package/dist/i18n/locales/ja.js.map +1 -1
  88. package/dist/i18n/locales/ko.d.ts.map +1 -1
  89. package/dist/i18n/locales/ko.js +242 -36
  90. package/dist/i18n/locales/ko.js.map +1 -1
  91. package/dist/i18n/locales/nl.d.ts.map +1 -1
  92. package/dist/i18n/locales/nl.js +242 -36
  93. package/dist/i18n/locales/nl.js.map +1 -1
  94. package/dist/i18n/locales/pl.d.ts.map +1 -1
  95. package/dist/i18n/locales/pl.js +242 -36
  96. package/dist/i18n/locales/pl.js.map +1 -1
  97. package/dist/i18n/locales/pt.d.ts.map +1 -1
  98. package/dist/i18n/locales/pt.js +242 -36
  99. package/dist/i18n/locales/pt.js.map +1 -1
  100. package/dist/i18n/locales/ru.d.ts.map +1 -1
  101. package/dist/i18n/locales/ru.js +242 -36
  102. package/dist/i18n/locales/ru.js.map +1 -1
  103. package/dist/i18n/locales/th.d.ts.map +1 -1
  104. package/dist/i18n/locales/th.js +242 -36
  105. package/dist/i18n/locales/th.js.map +1 -1
  106. package/dist/i18n/locales/tr.d.ts.map +1 -1
  107. package/dist/i18n/locales/tr.js +242 -36
  108. package/dist/i18n/locales/tr.js.map +1 -1
  109. package/dist/i18n/locales/uk.d.ts.map +1 -1
  110. package/dist/i18n/locales/uk.js +242 -36
  111. package/dist/i18n/locales/uk.js.map +1 -1
  112. package/dist/i18n/locales/vi.d.ts.map +1 -1
  113. package/dist/i18n/locales/vi.js +242 -36
  114. package/dist/i18n/locales/vi.js.map +1 -1
  115. package/dist/i18n/locales/zh-CN.d.ts.map +1 -1
  116. package/dist/i18n/locales/zh-CN.js +242 -36
  117. package/dist/i18n/locales/zh-CN.js.map +1 -1
  118. package/dist/i18n/locales/zh-TW.d.ts.map +1 -1
  119. package/dist/i18n/locales/zh-TW.js +242 -36
  120. package/dist/i18n/locales/zh-TW.js.map +1 -1
  121. package/dist/index.d.ts +9 -2
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +5 -1
  124. package/dist/index.js.map +1 -1
  125. package/dist/mcp/connection.d.ts +30 -3
  126. package/dist/mcp/connection.d.ts.map +1 -1
  127. package/dist/mcp/connection.js +70 -3
  128. package/dist/mcp/connection.js.map +1 -1
  129. package/dist/mcp/import.d.ts +47 -0
  130. package/dist/mcp/import.d.ts.map +1 -0
  131. package/dist/mcp/import.js +157 -0
  132. package/dist/mcp/import.js.map +1 -0
  133. package/dist/mcp/index.d.ts +25 -0
  134. package/dist/mcp/index.d.ts.map +1 -1
  135. package/dist/mcp/index.js +14 -0
  136. package/dist/mcp/index.js.map +1 -1
  137. package/dist/mcp/manager.d.ts +144 -0
  138. package/dist/mcp/manager.d.ts.map +1 -0
  139. package/dist/mcp/manager.js +550 -0
  140. package/dist/mcp/manager.js.map +1 -0
  141. package/dist/mcp/oauth.d.ts +117 -0
  142. package/dist/mcp/oauth.d.ts.map +1 -0
  143. package/dist/mcp/oauth.js +382 -0
  144. package/dist/mcp/oauth.js.map +1 -0
  145. package/dist/mcp/page.d.ts +99 -0
  146. package/dist/mcp/page.d.ts.map +1 -0
  147. package/dist/mcp/page.js +287 -0
  148. package/dist/mcp/page.js.map +1 -0
  149. package/dist/mcp/permissions.d.ts +22 -0
  150. package/dist/mcp/permissions.d.ts.map +1 -0
  151. package/dist/mcp/permissions.js +35 -0
  152. package/dist/mcp/permissions.js.map +1 -0
  153. package/dist/mcp/registry.d.ts +63 -0
  154. package/dist/mcp/registry.d.ts.map +1 -0
  155. package/dist/mcp/registry.js +106 -0
  156. package/dist/mcp/registry.js.map +1 -0
  157. package/dist/mcp/risk.d.ts +23 -0
  158. package/dist/mcp/risk.d.ts.map +1 -0
  159. package/dist/mcp/risk.js +98 -0
  160. package/dist/mcp/risk.js.map +1 -0
  161. package/dist/mcp/secrets.d.ts +38 -0
  162. package/dist/mcp/secrets.d.ts.map +1 -0
  163. package/dist/mcp/secrets.js +82 -0
  164. package/dist/mcp/secrets.js.map +1 -0
  165. package/dist/mcp/servers-config.d.ts +107 -0
  166. package/dist/mcp/servers-config.d.ts.map +1 -0
  167. package/dist/mcp/servers-config.js +243 -0
  168. package/dist/mcp/servers-config.js.map +1 -0
  169. package/dist/mcp/setup.d.ts +75 -0
  170. package/dist/mcp/setup.d.ts.map +1 -0
  171. package/dist/mcp/setup.js +150 -0
  172. package/dist/mcp/setup.js.map +1 -0
  173. package/dist/mcp/suggested.d.ts +47 -0
  174. package/dist/mcp/suggested.d.ts.map +1 -0
  175. package/dist/mcp/suggested.js +91 -0
  176. package/dist/mcp/suggested.js.map +1 -0
  177. package/dist/memory/ambient-capture.js +1 -1
  178. package/dist/memory/ambient-capture.js.map +1 -1
  179. package/dist/personas/definitions.d.ts.map +1 -1
  180. package/dist/personas/definitions.js +55 -42
  181. package/dist/personas/definitions.js.map +1 -1
  182. package/dist/tools/brainstorm-plan.d.ts +25 -0
  183. package/dist/tools/brainstorm-plan.d.ts.map +1 -0
  184. package/dist/tools/brainstorm-plan.js +179 -0
  185. package/dist/tools/brainstorm-plan.js.map +1 -0
  186. package/dist/tools/brainstorm-session.d.ts +14 -12
  187. package/dist/tools/brainstorm-session.d.ts.map +1 -1
  188. package/dist/tools/brainstorm-session.js +220 -113
  189. package/dist/tools/brainstorm-session.js.map +1 -1
  190. package/dist/tools/connection-tools.d.ts +61 -0
  191. package/dist/tools/connection-tools.d.ts.map +1 -0
  192. package/dist/tools/connection-tools.js +271 -0
  193. package/dist/tools/connection-tools.js.map +1 -0
  194. package/dist/tools/create-project.js +1 -1
  195. package/dist/tools/create-project.js.map +1 -1
  196. package/dist/tools/open-brainstorm-room.d.ts +22 -0
  197. package/dist/tools/open-brainstorm-room.d.ts.map +1 -0
  198. package/dist/tools/open-brainstorm-room.js +40 -0
  199. package/dist/tools/open-brainstorm-room.js.map +1 -0
  200. package/dist/tools/switch-mode.d.ts.map +1 -1
  201. package/dist/tools/switch-mode.js +4 -3
  202. package/dist/tools/switch-mode.js.map +1 -1
  203. package/dist/tools/tool-registry.d.ts.map +1 -1
  204. package/dist/tools/tool-registry.js +28 -1
  205. package/dist/tools/tool-registry.js.map +1 -1
  206. package/dist/tools/tool-request-words.d.ts.map +1 -1
  207. package/dist/tools/tool-request-words.js +38 -0
  208. package/dist/tools/tool-request-words.js.map +1 -1
  209. package/package.json +1 -1
@@ -1,176 +1,264 @@
1
- import { BrainstormStore } from '../brainstorm/brainstorm-store.js';
1
+ import { BrainstormStore, addChange, normaliseKind, setExperience, setPlan, tickSteps } from '../brainstorm/brainstorm-store.js';
2
+ import { BRAINSTORM_KINDS } from '../brainstorm/types.js';
3
+ import { kitForProject, proposeBrandKit, readBrandKit, updateBrandKit } from '../brand/brand-kits.js';
2
4
  /**
3
- * The brainstorm session store, as a tool.
5
+ * Brainstorms, as a tool (plan Decisions/plans/2026-11-17-brainstorm.md).
4
6
  *
5
7
  * Brainstorm mode is for someone who is not ready to commit yet. If nothing is
6
- * written down until they commit, the sessions most worth keeping are the ones
7
- * lost — explore five ideas over an evening, pick none, close the app, and
8
- * Thursday starts from nothing. Which is the exact feeling the mode exists to
9
- * relieve.
8
+ * written down until they commit, the brainstorms most worth keeping are the
9
+ * ones lost — explore five ideas over an evening, pick none, close the app, and
10
+ * Thursday starts from nothing. So it's saved as it happens, locally.
10
11
  *
11
- * So the session is saved as it happens, locally, and `attach` binds it to a
12
- * project the moment one is created.
12
+ * A brainstorm holds: what KIND of fragment it was (project, feature,
13
+ * experience, direction, not sure), the ideas — including the ones turned down
14
+ * and why — a living plan (steps that get ticked, and what changed while
15
+ * building), the experience their users should have, and the project it's
16
+ * assigned to (a link; the file stays in ~/.ava/brainstorm).
13
17
  *
14
- * NOT memory. Memory holds durable facts about the PERSON — "prefers small
15
- * finishable projects", "learning Rust" — which are useful in every mode
16
- * forever. This holds the session: the ideas, the ones turned down, and why.
17
- * Saving every musing to memory degrades recall and leaves Ava quoting
18
- * half-thoughts back as settled fact.
18
+ * NOT memory. Memory holds durable facts about the PERSON. This holds the
19
+ * thinking. The experience goes on to a brand kit — only with his yes.
19
20
  */
20
21
  export class BrainstormSessionTool {
22
+ store;
21
23
  name = 'brainstorm_session';
22
- description = 'Keep and recall brainstorming sessions — ideas, the ones that were parked or rejected, and why. ' +
23
- 'Stored locally under ~/.ava, never in the project and never committed. ' +
24
- 'Use recall at the START of a brainstorm to see what they were circling before; save as ideas emerge; ' +
25
- 'attach when a project folder gets created so the thinking follows the project.';
24
+ description = 'Keep and recall brainstorms — the ideas (including parked and rejected ones, and why), a living plan, the experience ' +
25
+ 'their users should have, and the project it is assigned to. Stored locally in ~/.ava/brainstorm, never in a project.';
26
26
  riskLevel = 'safe';
27
+ // experience_to_kit changes a brand kit: that one always asks (ToolRegistry.needsConfirmation).
27
28
  requiresConfirmation = false;
28
29
  schema = {
29
30
  name: 'brainstorm_session',
30
- description: 'Local brainstorm memory. recall — list past sessions (call this early; "you were circling this three weeks ago" ' +
31
- 'is the most useful thing you can say to someone stuck). save — create or update a session with its ideas. ' +
32
- 'attach — bind a session to a project path once the folder exists. read — load one session in full.',
31
+ description: 'Brainstorms, kept locally. recall — list them (call early; "you were circling this three weeks ago" is the most useful thing '
32
+ + 'you can say to someone stuck). read — one in full. save — create or update one: its kind, headline, ideas, notes, plan '
33
+ + '(summary + steps, small first then ambitious), ticks, changes, experience. assign — link it to a project folder (it stays '
34
+ + 'here; Ava sees it while working in that project); project_path "" unassigns. experience_to_kit — save its experience to a '
35
+ + 'brand kit (he always sees a card): the project\'s linked kit, a kit by id, or a new PROPOSED kit he agrees in Brand Kits, in the Creative Studio.',
33
36
  parameters: {
34
37
  type: 'object',
35
38
  properties: {
36
- action: {
37
- type: 'string',
38
- enum: ['recall', 'save', 'attach', 'read'],
39
- description: 'What to do',
40
- },
41
- session_id: {
42
- type: 'string',
43
- description: 'Session to update, read, or attach. Omit on save to start a new one.',
44
- },
39
+ action: { type: 'string', enum: ['recall', 'read', 'save', 'assign', 'attach', 'experience_to_kit'], description: 'What to do' },
40
+ session_id: { type: 'string', description: 'The brainstorm. Omit on save to start a new one.' },
45
41
  kind: {
46
42
  type: 'string',
47
- enum: ['blank', 'evolve'],
48
- description: 'save: which conversation this is — no project yet ("blank"), or an existing one ("evolve").',
49
- },
50
- headline: {
51
- type: 'string',
52
- description: 'save: what the session is about, in the user\'s own terms.',
43
+ enum: BRAINSTORM_KINDS,
44
+ description: 'save: what kind of fragment it is — project (something new), feature (an addition to an existing project), '
45
+ + 'experience (what their users should feel), direction (where an existing project goes next), unsure (working it out).',
53
46
  },
47
+ headline: { type: 'string', description: 'save: what it is about, in their own words.' },
54
48
  ideas: {
55
49
  type: 'array',
56
- description: 'save: the ideas so far. Include rejected ones WITH a reason — an idea turned down and not recorded ' +
57
- 'gets proposed again next time, and the reason is the useful half.',
50
+ description: 'save: the ideas so far. Include rejected and parked ones WITH a reason — an idea turned down and not recorded gets proposed again next time.',
58
51
  items: {
59
52
  type: 'object',
60
53
  properties: {
61
54
  title: { type: 'string', description: 'Short name' },
62
55
  summary: { type: 'string', description: 'A sentence or two — enough to recognise it months later' },
63
- status: {
64
- type: 'string',
65
- enum: ['candidate', 'chosen', 'parked', 'rejected'],
66
- description: 'Where it got to',
67
- },
68
- reason: { type: 'string', description: 'Why parked or rejected' },
56
+ status: { type: 'string', enum: ['candidate', 'chosen', 'parked', 'rejected'] },
57
+ reason: { type: 'string', description: 'Why parked or rejected, in their words where possible' },
69
58
  },
70
59
  required: ['title', 'summary', 'status'],
71
60
  },
72
61
  },
73
- notes: {
62
+ notes: { type: 'array', items: { type: 'string' }, description: 'save: threads worth keeping that are not ideas — constraints, tangents, context.' },
63
+ plan: {
64
+ type: 'object',
65
+ description: 'save: the plan for the chosen idea. Steps replace the list (ticks are kept for steps with the same text).',
66
+ properties: {
67
+ summary: { type: 'string', description: 'What it is, in a sentence or two.' },
68
+ steps: {
69
+ type: 'array',
70
+ items: {
71
+ type: 'object',
72
+ properties: {
73
+ text: { type: 'string' },
74
+ tier: { type: 'string', enum: ['small', 'ambitious'], description: 'small — the finishable first version; ambitious — after it.' },
75
+ done: { type: 'boolean' },
76
+ },
77
+ required: ['text'],
78
+ },
79
+ },
80
+ },
81
+ },
82
+ tick: { type: 'array', items: { type: 'string' }, description: 'save: steps done (by id or text).' },
83
+ untick: { type: 'array', items: { type: 'string' }, description: 'save: steps no longer done.' },
84
+ changes: {
74
85
  type: 'array',
75
- items: { type: 'string' },
76
- description: 'save: threads worth keeping that are not ideas — constraints, tangents, context.',
86
+ description: 'save: what happened to the plan — changed (and WHY), a new idea the work turned up, or a note.',
87
+ items: {
88
+ type: 'object',
89
+ properties: {
90
+ type: { type: 'string', enum: ['changed', 'new-idea', 'note'] },
91
+ text: { type: 'string' },
92
+ },
93
+ required: ['type', 'text'],
94
+ },
77
95
  },
78
- project_path: {
79
- type: 'string',
80
- description: 'attach: absolute path of the project folder this session produced.',
96
+ experience: {
97
+ type: 'object',
98
+ description: 'save: what their users should feel. Fields given replace those fields.',
99
+ properties: {
100
+ words: { type: 'array', items: { type: 'string' }, description: 'The words for it: calm, in control…' },
101
+ not_words: { type: 'array', items: { type: 'string' }, description: 'What it must never be: guilty, rushed…' },
102
+ principles: {
103
+ type: 'array',
104
+ description: '3–5 principles, each with what it means in practice.',
105
+ items: {
106
+ type: 'object',
107
+ properties: { title: { type: 'string' }, do: { type: 'string' }, dont: { type: 'string' } },
108
+ required: ['title', 'do', 'dont'],
109
+ },
110
+ },
111
+ },
81
112
  },
113
+ project_path: { type: 'string', description: 'assign: the project folder\'s absolute path; "" to unassign.' },
114
+ kit_id: { type: 'string', description: 'experience_to_kit: a particular kit. Omit to use the project\'s linked kit, or propose a new one.' },
115
+ kit_name: { type: 'string', description: 'experience_to_kit: the name for a new proposed kit.' },
82
116
  },
83
117
  required: ['action'],
84
118
  },
85
119
  };
120
+ constructor(store = new BrainstormStore()) {
121
+ this.store = store;
122
+ }
86
123
  async execute(args, context) {
87
- const store = new BrainstormStore();
124
+ const store = this.store;
88
125
  const action = String(args.action ?? '');
89
126
  const projectRoot = context.cwd;
127
+ const id = args.session_id ? String(args.session_id) : '';
90
128
  try {
91
129
  switch (action) {
92
130
  case 'recall': {
93
- const sessions = await store.list(projectRoot);
94
- if (sessions.length === 0) {
95
- return { success: true, output: 'No previous brainstorm sessions. This is a first conversation.' };
96
- }
97
- const lines = sessions.slice(0, 12).map((s) => {
98
- const when = s.updatedAt.slice(0, 10);
99
- const open = s.openCount > 0 ? `, ${s.openCount} still open` : '';
100
- return `- [${s.id}] ${when} · ${s.kind} · ${s.headline} (${s.ideaCount} ideas${open})`;
131
+ const all = await store.list(projectRoot);
132
+ if (all.length === 0)
133
+ return { success: true, output: 'No previous brainstorms. This is a first conversation.' };
134
+ const lines = all.slice(0, 15).map((s) => {
135
+ const bits = [
136
+ s.updatedAt.slice(0, 10), s.kind, s.headline,
137
+ `${s.ideaCount} ideas${s.openCount ? `, ${s.openCount} still open` : ''}`,
138
+ s.stepsTotal ? `plan ${s.stepsDone}/${s.stepsTotal} done` : '',
139
+ s.hasExperience ? 'has an experience' : '',
140
+ s.projectPath ? `assigned to ${s.projectPath}` : 'not assigned',
141
+ ].filter(Boolean);
142
+ return `- [${s.id}] ${bits.join(' · ')}`;
101
143
  });
102
- return {
103
- success: true,
104
- output: `${sessions.length} previous session(s):\n${lines.join('\n')}\n\nRead one with action="read" before assuming what was covered.`,
105
- };
144
+ return { success: true, output: `${all.length} brainstorm(s):\n${lines.join('\n')}\n\nRead one with action="read" before assuming what it covered.` };
106
145
  }
107
146
  case 'read': {
108
- const id = String(args.session_id ?? '');
109
147
  if (!id)
110
- return { success: false, output: 'session_id is required to read a session.' };
111
- const session = await store.get(id, projectRoot);
112
- if (!session)
113
- return { success: false, output: `No session ${id}.` };
114
- return { success: true, output: JSON.stringify(session, null, 2) };
148
+ return { success: false, output: 'session_id is required to read a brainstorm.' };
149
+ const s = await store.get(id);
150
+ return s ? { success: true, output: JSON.stringify(s, null, 2) } : { success: false, output: `No brainstorm ${id}.` };
115
151
  }
116
152
  case 'save': {
117
- const id = args.session_id ? String(args.session_id) : null;
118
- let session = id ? await store.get(id, projectRoot) : null;
119
- if (!session) {
120
- const kind = (args.kind === 'evolve' ? 'evolve' : 'blank');
121
- const headline = String(args.headline ?? 'Untitled session');
122
- // A brand-new session in an existing project is already attached —
123
- // there is no point putting it in the loose pile only to move it.
124
- session = store.create(kind, headline, kind === 'evolve' ? projectRoot : undefined);
125
- }
126
- else if (args.headline) {
127
- session.headline = String(args.headline);
128
- }
129
- const incoming = Array.isArray(args.ideas) ? args.ideas : [];
130
- for (const raw of incoming) {
131
- if (!raw?.title)
132
- continue;
133
- const title = String(raw.title);
134
- const existing = session.ideas.find((i) => i.title === title);
135
- if (existing) {
136
- existing.summary = String(raw.summary ?? existing.summary);
137
- existing.status = raw.status ?? existing.status;
138
- if (raw.reason)
139
- existing.reason = String(raw.reason);
140
- existing.updatedAt = new Date().toISOString();
141
- }
142
- else {
143
- store.addIdea(session, {
144
- title,
145
- summary: String(raw.summary ?? ''),
146
- status: raw.status ?? 'candidate',
147
- ...(raw.reason ? { reason: String(raw.reason) } : {}),
148
- });
149
- }
153
+ let s = id ? await store.get(id) : null;
154
+ if (id && !s)
155
+ return { success: false, output: `No brainstorm ${id}. Omit session_id to start a new one.` };
156
+ if (!s)
157
+ s = store.create(normaliseKind(args.kind ?? 'unsure'), String(args.headline ?? 'Untitled brainstorm'));
158
+ else {
159
+ if (args.kind)
160
+ s.kind = normaliseKind(args.kind);
161
+ if (args.headline)
162
+ s.headline = String(args.headline);
150
163
  }
164
+ mergeIdeas(store, s, args.ideas);
151
165
  if (Array.isArray(args.notes)) {
152
166
  for (const n of args.notes) {
153
167
  const note = String(n).trim();
154
- if (note && !session.notes.includes(note))
155
- session.notes.push(note);
168
+ if (note && !s.notes.includes(note))
169
+ s.notes.push(note);
156
170
  }
157
171
  }
158
- await store.save(session);
172
+ if (args.plan && typeof args.plan === 'object')
173
+ setPlan(s, args.plan);
174
+ const ticked = Array.isArray(args.tick) ? tickSteps(s, args.tick.map(String), true) : 0;
175
+ if (Array.isArray(args.untick))
176
+ tickSteps(s, args.untick.map(String), false);
177
+ for (const c of (Array.isArray(args.changes) ? args.changes : [])) {
178
+ const type = ['changed', 'new-idea', 'note'].find((t) => t === c?.type) ?? 'note';
179
+ // Work in a project writes through its own tool (Phase 4), marked 'work'.
180
+ addChange(s, { type, text: String(c?.text ?? ''), from: 'brainstorm' });
181
+ }
182
+ if (args.experience && typeof args.experience === 'object') {
183
+ const e = args.experience;
184
+ setExperience(s, {
185
+ words: e.words,
186
+ notWords: (e.not_words ?? e.notWords),
187
+ principles: e.principles,
188
+ });
189
+ }
190
+ await store.save(s);
191
+ const steps = s.plan?.steps ?? [];
159
192
  return {
160
193
  success: true,
161
- output: `Saved session ${session.id} (${session.ideas.length} ideas). Kept locally — not in the project.`,
194
+ output: `Saved brainstorm ${s.id} (${s.kind}: ${s.ideas.length} ideas${steps.length ? `, plan ${steps.filter((x) => x.done).length}/${steps.length} done` : ''}${ticked ? `, ${ticked} ticked` : ''}${s.experience ? ', experience kept' : ''}). Kept locally — not in any project.`,
162
195
  };
163
196
  }
197
+ case 'assign':
164
198
  case 'attach': {
165
- const id = String(args.session_id ?? '');
166
- const path = String(args.project_path ?? '');
167
- if (!id || !path) {
168
- return { success: false, output: 'attach needs both session_id and project_path.' };
199
+ if (!id)
200
+ return { success: false, output: 'assign needs session_id.' };
201
+ const path = String(args.project_path ?? '').trim();
202
+ const s = await store.assign(id, path || null);
203
+ if (!s)
204
+ return { success: false, output: `No brainstorm ${id}.` };
205
+ return {
206
+ success: true,
207
+ output: path
208
+ ? `Brainstorm ${id} is assigned to ${path}. It stays in Brainstorm; whenever work happens in that project, Ava sees it and keeps its plan up to date.`
209
+ : `Brainstorm ${id} is no longer assigned to a project.`,
210
+ };
211
+ }
212
+ case 'experience_to_kit': {
213
+ if (!id)
214
+ return { success: false, output: 'experience_to_kit needs session_id.' };
215
+ const s = await store.get(id);
216
+ if (!s)
217
+ return { success: false, output: `No brainstorm ${id}.` };
218
+ const e = s.experience;
219
+ if (!e || (!e.words.length && !e.principles.length))
220
+ return { success: false, output: 'This brainstorm has no experience yet: pin it down first (save with experience).' };
221
+ const experience = { words: e.words, notWords: e.notWords, principles: e.principles };
222
+ const reasoning = `From the brainstorm "${s.headline}": what the people using it should feel.`;
223
+ let kitId = args.kit_id ? String(args.kit_id) : '';
224
+ if (!kitId && s.projectPath) {
225
+ const found = await kitForProject(s.projectPath);
226
+ if (found.status === 'linked')
227
+ kitId = found.kit.id;
169
228
  }
170
- const session = await store.attach(id, path);
171
- if (!session)
172
- return { success: false, output: `No loose session ${id} to attach.` };
173
- return { success: true, output: `Session ${id} now belongs to ${path}.` };
229
+ let saved;
230
+ if (kitId) {
231
+ const kit = await readBrandKit(kitId);
232
+ if (!kit)
233
+ return { success: false, output: `There is no kit ${kitId}.` };
234
+ if (kit.status === 'proposed') {
235
+ const r = await proposeBrandKit(kitId, { experience }, kit.reasoning ?? reasoning, kit.proposedFor ?? s.projectPath);
236
+ if ('refused' in r)
237
+ return { success: false, output: r.refused };
238
+ saved = { id: r.id, name: r.name, proposed: true };
239
+ }
240
+ else {
241
+ const r = await updateBrandKit(kitId, { experience });
242
+ if (!r)
243
+ return { success: false, output: `There is no kit ${kitId}.` };
244
+ saved = { id: r.id, name: r.name, proposed: false };
245
+ }
246
+ }
247
+ else {
248
+ const name = String(args.kit_name ?? '').trim() || s.headline;
249
+ const r = await proposeBrandKit(undefined, { name, experience }, reasoning, s.projectPath ?? null);
250
+ if ('refused' in r)
251
+ return { success: false, output: r.refused };
252
+ saved = { id: r.id, name: r.name, proposed: true };
253
+ }
254
+ s.experience = { ...e, kitId: saved.id };
255
+ await store.save(s);
256
+ return {
257
+ success: true,
258
+ output: saved.proposed
259
+ ? `The experience is in the proposed kit "${saved.name}" [${saved.id}]. It is not in use until he agrees the kit in Brand Kits, in the Creative Studio — tell him that's where to look.`
260
+ : `The experience is saved in the brand kit "${saved.name}" [${saved.id}]; every mode working with that kit now designs and writes for it.`,
261
+ };
174
262
  }
175
263
  default:
176
264
  return { success: false, output: `Unknown action "${action}".` };
@@ -181,4 +269,23 @@ export class BrainstormSessionTool {
181
269
  }
182
270
  }
183
271
  }
272
+ function mergeIdeas(store, s, incoming) {
273
+ for (const raw of (Array.isArray(incoming) ? incoming : [])) {
274
+ if (!raw?.title)
275
+ continue;
276
+ const title = String(raw.title);
277
+ const existing = s.ideas.find((i) => i.title === title);
278
+ const status = ['candidate', 'chosen', 'parked', 'rejected'].find((x) => x === raw.status);
279
+ if (existing) {
280
+ existing.summary = String(raw.summary ?? existing.summary);
281
+ existing.status = status ?? existing.status;
282
+ if (raw.reason)
283
+ existing.reason = String(raw.reason);
284
+ existing.updatedAt = new Date().toISOString();
285
+ }
286
+ else {
287
+ store.addIdea(s, { title, summary: String(raw.summary ?? ''), status: status ?? 'candidate', ...(raw.reason ? { reason: String(raw.reason) } : {}) });
288
+ }
289
+ }
290
+ }
184
291
  //# sourceMappingURL=brainstorm-session.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"brainstorm-session.js","sourceRoot":"","sources":["../../src/tools/brainstorm-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGpE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,qBAAqB;IACvB,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAClB,kGAAkG;QAClG,yEAAyE;QACzE,uGA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4
+ * connection_search the official MCP Registry: who publishes a server (verified
5
+ * namespace), its repository, the exact package and version,
6
+ * which keys it needs — the core of her research
7
+ * connection_list his servers and where each one is
8
+ * connection_add add one, with her view — ALWAYS shows him the card first
9
+ * connection_import what Claude Desktop, Cursor and VS Code have (scan), and
10
+ * bringing in the ones he picks (always asks)
11
+ *
12
+ * Not named mcp_*: that prefix is the servers' OWN tools (permissions.ts).
13
+ * Keys are never taken in the chat (mcp/setup.ts): she names them, he types
14
+ * them on the Connections page.
15
+ */
16
+ import type { FunctionSchema } from '../providers/types.js';
17
+ import type { Tool, ToolExecutionContext, ToolResult, ToolRiskLevel } from './types.js';
18
+ import { type McpRiskNote } from '../mcp/risk.js';
19
+ /** The risk notes in words (the page says them in his language; the card and Ava read these). */
20
+ export declare function riskNoteInWords(n: McpRiskNote): string;
21
+ export declare class ConnectionSearchTool implements Tool {
22
+ readonly name = "connection_search";
23
+ readonly description = "Look a server up in the official MCP Registry";
24
+ readonly riskLevel: ToolRiskLevel;
25
+ readonly outputTrust: "untrusted";
26
+ readonly requiresConfirmation = false;
27
+ readonly schema: FunctionSchema;
28
+ execute(args: Record<string, unknown>): Promise<ToolResult>;
29
+ }
30
+ export declare class ConnectionListTool implements Tool {
31
+ readonly name = "connection_list";
32
+ readonly description = "List his MCP servers and how each is doing";
33
+ readonly riskLevel: ToolRiskLevel;
34
+ readonly requiresConfirmation = false;
35
+ readonly schema: FunctionSchema;
36
+ execute(): Promise<ToolResult>;
37
+ }
38
+ export declare class ConnectionAddTool implements Tool {
39
+ readonly name = "connection_add";
40
+ readonly description = "Add an MCP server to his list (he sees it first)";
41
+ readonly riskLevel: ToolRiskLevel;
42
+ readonly requiresConfirmation = true;
43
+ readonly schema: FunctionSchema;
44
+ precheck(args: Record<string, unknown>): Promise<{
45
+ ok: true;
46
+ } | {
47
+ ok: false;
48
+ output: string;
49
+ }>;
50
+ deniedMessage(reason: string | null): string;
51
+ execute(args: Record<string, unknown>): Promise<ToolResult>;
52
+ }
53
+ export declare class ConnectionImportTool implements Tool {
54
+ readonly name = "connection_import";
55
+ readonly description = "Bring in his servers from Claude Desktop, Cursor or VS Code";
56
+ readonly riskLevel: ToolRiskLevel;
57
+ readonly requiresConfirmation = false;
58
+ readonly schema: FunctionSchema;
59
+ execute(args: Record<string, unknown>, _context: ToolExecutionContext): Promise<ToolResult>;
60
+ }
61
+ //# sourceMappingURL=connection-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-tools.d.ts","sourceRoot":"","sources":["../../src/tools/connection-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQxF,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAajE,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CActD;AAsBD,qBAAa,oBAAqB,YAAW,IAAI;IAC/C,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,WAAW,mDAAmD;IACvE,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAU;IAC3C,QAAQ,CAAC,WAAW,EAAG,WAAW,CAAU;IAC5C,QAAQ,CAAC,oBAAoB,SAAS;IACtC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAe7B;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;CAyBlE;AAID,qBAAa,kBAAmB,YAAW,IAAI;IAC7C,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,WAAW,gDAAgD;IACpE,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAU;IAC3C,QAAQ,CAAC,oBAAoB,SAAS;IACtC,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