aiden-runtime 4.1.2 → 4.1.4

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 (36) hide show
  1. package/dist/cli/v4/aidenCLI.js +10 -0
  2. package/dist/cli/v4/callbacks.js +85 -13
  3. package/dist/cli/v4/chatSession.js +250 -24
  4. package/dist/cli/v4/commands/doctor.js +23 -27
  5. package/dist/cli/v4/commands/model.js +30 -1
  6. package/dist/cli/v4/defaultSoul.js +69 -2
  7. package/dist/cli/v4/display/capabilityCard.js +135 -0
  8. package/dist/cli/v4/display/frame.js +234 -0
  9. package/dist/cli/v4/display/progressBar.js +137 -0
  10. package/dist/cli/v4/display/sessionEndCard.js +127 -0
  11. package/dist/cli/v4/display/toolTrail.js +172 -0
  12. package/dist/cli/v4/display.js +891 -153
  13. package/dist/cli/v4/doctor.js +377 -75
  14. package/dist/cli/v4/promotionPrompt.js +135 -5
  15. package/dist/cli/v4/replyRenderer.js +487 -26
  16. package/dist/cli/v4/skinEngine.js +26 -4
  17. package/dist/cli/v4/toolPreview.js +82 -19
  18. package/dist/core/tools/nowPlaying.js +7 -15
  19. package/dist/core/v4/aidenAgent.js +9 -0
  20. package/dist/core/v4/promptBuilder.js +2 -1
  21. package/dist/core/v4/sessionDistiller.js +48 -1
  22. package/dist/core/v4/toolRegistry.js +16 -1
  23. package/dist/core/version.js +1 -1
  24. package/dist/moat/plannerGuard.js +19 -0
  25. package/dist/providers/v4/anthropicAdapter.js +25 -2
  26. package/dist/providers/v4/errors.js +92 -0
  27. package/dist/tools/v4/index.js +24 -1
  28. package/dist/tools/v4/sessions/recallSession.js +14 -0
  29. package/dist/tools/v4/system/_psHelpers.js +70 -2
  30. package/dist/tools/v4/system/appInput.js +154 -0
  31. package/dist/tools/v4/system/appLaunch.js +136 -10
  32. package/dist/tools/v4/system/mediaKey.js +35 -4
  33. package/dist/tools/v4/system/mediaSessions.js +163 -0
  34. package/dist/tools/v4/system/mediaTransport.js +211 -0
  35. package/package.json +2 -1
  36. package/skills/system_control.md +56 -6
@@ -33,6 +33,39 @@
33
33
  * don't have to drive a prompt API. The prompt-loop function wires
34
34
  * the parser to the existing `ChatPromptApi.readLine`.
35
35
  */
36
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
37
+ if (k2 === undefined) k2 = k;
38
+ var desc = Object.getOwnPropertyDescriptor(m, k);
39
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
40
+ desc = { enumerable: true, get: function() { return m[k]; } };
41
+ }
42
+ Object.defineProperty(o, k2, desc);
43
+ }) : (function(o, m, k, k2) {
44
+ if (k2 === undefined) k2 = k;
45
+ o[k2] = m[k];
46
+ }));
47
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
48
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
49
+ }) : function(o, v) {
50
+ o["default"] = v;
51
+ });
52
+ var __importStar = (this && this.__importStar) || (function () {
53
+ var ownKeys = function(o) {
54
+ ownKeys = Object.getOwnPropertyNames || function (o) {
55
+ var ar = [];
56
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
57
+ return ar;
58
+ };
59
+ return ownKeys(o);
60
+ };
61
+ return function (mod) {
62
+ if (mod && mod.__esModule) return mod;
63
+ var result = {};
64
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
65
+ __setModuleDefault(result, mod);
66
+ return result;
67
+ };
68
+ })();
36
69
  Object.defineProperty(exports, "__esModule", { value: true });
37
70
  exports.parsePromotionInput = parsePromotionInput;
38
71
  exports.formatCandidateList = formatCandidateList;
@@ -116,16 +149,113 @@ function formatCandidateList(candidates) {
116
149
  return lines.join('\n');
117
150
  }
118
151
  /**
119
- * Drive the approval prompt. Renders the candidate list, reads ONE
120
- * line, parses, returns approved Candidate[]. On unparseable input
121
- * re-prompts ONCE; second failure defaults to skip with a dim line
122
- * explaining why nothing was promoted.
152
+ * Drive the approval prompt. Two paths:
153
+ *
154
+ * 1. Interactive checkbox (TTY): @inquirer/prompts.checkbox, space
155
+ * to toggle, enter to confirm, esc/ctrl+c to skip. Default
156
+ * selection is NONE — the user explicitly opts in. v4.1.3-essentials
157
+ * promotion-ux replaces what used to be a text-input chore.
158
+ *
159
+ * 2. Text-input fallback (non-TTY / piped / CI): renders the
160
+ * numbered list and reads a single line. Parser handles "1,3"
161
+ * / "1-3" / "all" / "skip" / "". Re-prompts ONCE on garbage,
162
+ * then defaults to skip. The original Phase v4.1.2-memory-D
163
+ * behavior, preserved verbatim.
164
+ *
165
+ * Auto-routes via `process.stdout.isTTY`; tests override via opts.
123
166
  *
124
167
  * No mid-session state leakage — purely a session-end interaction.
125
168
  */
126
- async function promptForApproval(api, display, candidates) {
169
+ async function promptForApproval(api, display, candidates, opts = {}) {
127
170
  if (candidates.length === 0)
128
171
  return [];
172
+ const useInteractive = opts.forceInteractive === true
173
+ ? true
174
+ : opts.forceTextInput === true
175
+ ? false
176
+ : !!process.stdout.isTTY;
177
+ if (useInteractive) {
178
+ return promptForApprovalInteractive(display, candidates);
179
+ }
180
+ return promptForApprovalText(api, display, candidates);
181
+ }
182
+ /**
183
+ * v4.1.3-essentials promotion-ux: interactive multi-select checkbox.
184
+ * Uses @inquirer/prompts.checkbox (already a runtime dep — same
185
+ * library as the model picker, setup wizard, approval prompts).
186
+ *
187
+ * Choices render with the source-type tag inline so the user sees
188
+ * "[decision] X" / "[open item] Y" / "[user said] Z" — matches the
189
+ * tag set the text-input renderer uses.
190
+ *
191
+ * Exit paths:
192
+ * - User confirms with at least one box checked → return selected
193
+ * - User confirms with zero boxes checked → dim note, return []
194
+ * - User hits Esc / Ctrl+C (inquirer throws) → dim note, return []
195
+ *
196
+ * All three "nothing selected" paths produce the same outcome — empty
197
+ * array — matching the user's Q5 default ("empty/skip/esc all
198
+ * equivalent").
199
+ *
200
+ * Lazy-require inquirer so test harnesses without a TTY don't crash
201
+ * importing the module. Same pattern setupWizard / callbacks /
202
+ * modelPicker already use.
203
+ */
204
+ async function promptForApprovalInteractive(display, candidates) {
205
+ // Dynamic ES import (not CommonJS require) so vitest's vi.mock can
206
+ // intercept the call in tests. The runtime behavior is identical
207
+ // for our purpose — single one-shot lazy load on first call.
208
+ const inq = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
209
+ const heading = `${candidates.length} thing${candidates.length === 1 ? '' : 's'} ` +
210
+ `worth remembering this session.`;
211
+ display.write('\n' + heading + '\n');
212
+ try {
213
+ const selected = await inq.checkbox({
214
+ message: 'Promote which to durable memory? (space toggles · enter confirms)',
215
+ choices: candidates.map((c, i) => ({
216
+ name: `${typeTag(c)} ${c.text}`,
217
+ value: i,
218
+ checked: false,
219
+ })),
220
+ loop: false,
221
+ pageSize: Math.min(10, candidates.length),
222
+ });
223
+ if (selected.length === 0) {
224
+ display.dim('Nothing promoted to durable facts.');
225
+ return [];
226
+ }
227
+ return selected.map((i) => candidates[i]);
228
+ }
229
+ catch {
230
+ // Inquirer throws on Ctrl+C / Esc — treat as skip.
231
+ display.dim('Skipped: nothing promoted to durable facts.');
232
+ return [];
233
+ }
234
+ }
235
+ /**
236
+ * Source-type tag matching the text-input renderer's format. Kept as
237
+ * a helper so the interactive choice labels stay in sync with the
238
+ * text path if a new `Candidate.source` value lands.
239
+ */
240
+ function typeTag(c) {
241
+ if (c.source === 'explicit')
242
+ return '[user said]';
243
+ if (c.source === 'decision')
244
+ return '[decision]';
245
+ return '[open item]';
246
+ }
247
+ /**
248
+ * Phase v4.1.2-memory-D text-input loop. Renders the candidate list,
249
+ * reads ONE line, parses, returns approved Candidate[]. On unparseable
250
+ * input re-prompts ONCE; second failure defaults to skip with a dim
251
+ * line explaining why nothing was promoted.
252
+ *
253
+ * Kept as the non-TTY fallback (pipes, CI, test harness) so the
254
+ * promotion-flow contract continues to work without an interactive
255
+ * shell. v4.1.3-essentials promotion-ux renamed this from
256
+ * `promptForApproval` so the public entry point can dispatch.
257
+ */
258
+ async function promptForApprovalText(api, display, candidates) {
129
259
  display.write('\n' + formatCandidateList(candidates) + '\n');
130
260
  for (let attempt = 0; attempt < 2; attempt += 1) {
131
261
  const raw = await api.readLine('Promote > ');