@hraness/dawg 0.2.0 → 0.4.0

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 (140) hide show
  1. package/CHANGELOG.md +201 -0
  2. package/DAWG.md +762 -11
  3. package/README.md +79 -30
  4. package/core/chords.ts +1724 -0
  5. package/core/diff.ts +261 -0
  6. package/core/euclid.ts +670 -0
  7. package/core/fx.ts +1065 -0
  8. package/core/key.ts +43 -0
  9. package/core/kits.ts +320 -0
  10. package/core/params.ts +111 -0
  11. package/core/pitch.ts +60 -0
  12. package/core/rhythm.ts +287 -0
  13. package/core/score.ts +1054 -14
  14. package/core/sdk/eval-child.ts +125 -0
  15. package/core/sdk/eval.ts +260 -0
  16. package/core/sdk/print.ts +675 -0
  17. package/core/sdk/sync-chords.ts +54 -0
  18. package/core/sdk/v1.ts +4159 -0
  19. package/core/slug.ts +19 -0
  20. package/core/synth.ts +1001 -0
  21. package/package.json +8 -5
  22. package/src/agent/agent.ts +317 -16
  23. package/src/agent/brief.ts +50 -5
  24. package/src/agent/chord-tools.ts +357 -0
  25. package/src/agent/drum-tools.ts +135 -0
  26. package/src/agent/gateway.ts +215 -41
  27. package/src/agent/models.ts +633 -0
  28. package/src/agent/ops.ts +3 -18
  29. package/src/agent/pack-tools.ts +369 -0
  30. package/src/agent/planner.ts +55 -2
  31. package/src/agent/preview-tool.ts +270 -0
  32. package/src/agent/provider.ts +234 -106
  33. package/src/agent/rhythm-tools.ts +145 -0
  34. package/src/agent/sse.ts +31 -7
  35. package/src/agent/tools.ts +705 -14
  36. package/src/agent/usage.ts +296 -0
  37. package/src/agent/workspace.ts +683 -0
  38. package/src/agent/xcb-agent.ts +35 -14
  39. package/src/agent/xcb.ts +233 -21
  40. package/src/audio/audition.ts +93 -0
  41. package/src/audio/cache.ts +160 -0
  42. package/src/audio/click.ts +125 -0
  43. package/src/audio/effects/bus.ts +147 -0
  44. package/src/audio/effects/chain.ts +99 -0
  45. package/src/audio/effects/common.ts +251 -0
  46. package/src/audio/effects/convolution.ts +301 -0
  47. package/src/audio/effects/drive.ts +142 -0
  48. package/src/audio/effects/duck.ts +122 -0
  49. package/src/audio/effects/dynamics.ts +121 -0
  50. package/src/audio/effects/filter.ts +319 -0
  51. package/src/audio/effects/modulation.ts +174 -0
  52. package/src/audio/effects/space.ts +337 -0
  53. package/src/audio/engine.ts +430 -33
  54. package/src/audio/kits.ts +200 -0
  55. package/src/audio/live.ts +152 -0
  56. package/src/audio/packs.ts +1787 -0
  57. package/src/audio/player.ts +19 -4
  58. package/src/audio/preview.ts +470 -0
  59. package/src/audio/random.ts +15 -0
  60. package/src/audio/render-worker.ts +68 -0
  61. package/src/audio/renderer.ts +174 -0
  62. package/src/audio/sampler.ts +420 -0
  63. package/src/audio/samples.ts +1025 -0
  64. package/src/audio/synth/oscillators.ts +268 -0
  65. package/src/audio/synth/voice.ts +555 -0
  66. package/src/audio/synth/zzfx.ts +137 -0
  67. package/src/audio/wav.ts +550 -334
  68. package/src/audio/wavetable-maker.ts +717 -0
  69. package/src/audio/wavetable.ts +624 -0
  70. package/src/auth/cli.ts +146 -27
  71. package/src/auth/credentials.ts +167 -41
  72. package/src/auth/discover.ts +481 -0
  73. package/src/auth/login.ts +885 -128
  74. package/src/auth/openrouter.ts +206 -0
  75. package/src/auth/picker.ts +282 -0
  76. package/src/auth/runner.ts +25 -2
  77. package/src/auth/tui.ts +60 -43
  78. package/src/commands/drums.ts +299 -0
  79. package/src/commands/edit.ts +192 -0
  80. package/src/commands/fx.ts +360 -0
  81. package/src/commands/help.ts +535 -0
  82. package/src/commands/history.ts +32 -19
  83. package/src/commands/music.ts +34 -15
  84. package/src/commands/pack.ts +423 -0
  85. package/src/commands/rhythm.ts +230 -0
  86. package/src/commands/sample.ts +462 -0
  87. package/src/commands/synth.ts +229 -0
  88. package/src/commands/wavetable.ts +370 -0
  89. package/src/main.ts +2136 -170
  90. package/src/media/analyze.ts +364 -0
  91. package/src/media/backend.ts +253 -0
  92. package/src/media/cli.ts +186 -0
  93. package/src/media/download.ts +281 -0
  94. package/src/media/dsp.ts +281 -0
  95. package/src/media/import.ts +130 -0
  96. package/src/media/lyrics.ts +201 -0
  97. package/src/media/notes.ts +363 -0
  98. package/src/media/paths.ts +168 -0
  99. package/src/media/process.ts +226 -0
  100. package/src/media/registry.ts +9 -0
  101. package/src/media/sidecar.ts +72 -0
  102. package/src/media/stemdeck.ts +254 -0
  103. package/src/media/stems.ts +173 -0
  104. package/src/media/tools.ts +397 -0
  105. package/src/media/types.ts +92 -0
  106. package/src/media/vendor/basic-pitch.ts +261 -0
  107. package/src/media/vendor/drums.ts +817 -0
  108. package/src/media/vendor/grid.ts +203 -0
  109. package/src/media/vendor/util.ts +139 -0
  110. package/src/media/vendor/wav.ts +233 -0
  111. package/src/media/wavetable.ts +202 -0
  112. package/src/project/check.ts +80 -0
  113. package/src/project/init.ts +253 -0
  114. package/src/project/sync.ts +432 -0
  115. package/src/project/typecheck.ts +149 -0
  116. package/src/render.ts +49 -6
  117. package/src/session/attach.ts +3 -4
  118. package/src/session/daemon.ts +25 -8
  119. package/src/session/delta.ts +249 -0
  120. package/src/session/naming.ts +6 -38
  121. package/src/session/port.ts +26 -6
  122. package/src/session/rebase.ts +38 -8
  123. package/src/session/store.ts +116 -21
  124. package/src/tui/audition.ts +501 -0
  125. package/src/tui/euclid.ts +472 -0
  126. package/src/tui/menu.ts +2125 -0
  127. package/src/tui/play-chords.ts +538 -0
  128. package/src/tui/play-mode.ts +442 -0
  129. package/src/tui/play-session.ts +984 -0
  130. package/src/tui/sketch.ts +108 -0
  131. package/src/web/fetch.ts +340 -0
  132. package/src/web/http.ts +137 -0
  133. package/src/web/search.ts +684 -0
  134. package/tui/activity.ts +42 -3
  135. package/tui/app.ts +398 -33
  136. package/tui/drums.ts +44 -0
  137. package/tui/grammar.ts +281 -0
  138. package/tui/highway.ts +24 -2
  139. package/tui/layers.ts +14 -2
  140. package/tui/play-strip.ts +188 -0
package/tui/activity.ts CHANGED
@@ -45,7 +45,9 @@ export type AgentActivityEvent =
45
45
  | { type: "start"; prompt?: string | undefined; model?: string | undefined }
46
46
  | { type: "step"; step: number }
47
47
  | { type: "text-delta"; delta?: string; text?: string }
48
+ | { type: "activity"; message: string }
48
49
  | { type: "tool-start"; name: string; callId?: string; step?: number }
50
+ | { type: "tool-progress"; line: string; name?: string; callId?: string }
49
51
  | {
50
52
  type: "tool-applied";
51
53
  summary: string;
@@ -238,6 +240,9 @@ export class ActivityFeed {
238
240
  event.step <= 1 ? "thinking" : `thinking · step ${event.step}`,
239
241
  );
240
242
  return;
243
+ case "activity":
244
+ this.setSpinner(event.message);
245
+ return;
241
246
  case "text-delta": {
242
247
  const chunk = event.delta ?? event.text ?? "";
243
248
  const joined = `${this.streamText}${chunk}`.replace(/\s+/g, " ");
@@ -249,15 +254,27 @@ export class ActivityFeed {
249
254
  case "tool-start":
250
255
  this.setSpinner(`${event.name.replace(/_/g, " ")}…`);
251
256
  return;
252
- case "tool-applied":
257
+ case "tool-progress":
258
+ this.setSpinner(
259
+ event.name
260
+ ? `${event.name.replace(/_/g, " ")} · ${event.line}`
261
+ : event.line,
262
+ );
263
+ return;
264
+ case "tool-applied": {
265
+ // A media or explain result leaves the revision alone: nothing to undo.
266
+ const unchanged =
267
+ event.baseRevision !== undefined &&
268
+ event.baseRevision === event.resultRevision;
253
269
  this.pushCard(event.summary, {
254
270
  tone: "success",
255
271
  baseRevision: event.baseRevision,
256
272
  resultRevision: event.resultRevision,
257
273
  trackId: event.trackId,
258
- hint: "^z undo",
274
+ hint: unchanged ? undefined : "^z undo",
259
275
  });
260
276
  return;
277
+ }
261
278
  case "tool-rejected": {
262
279
  const what = event.summary ?? event.name?.replace(/_/g, " ");
263
280
  const why = event.reason ?? event.diagnostic;
@@ -309,9 +326,31 @@ export class ActivityFeed {
309
326
  }
310
327
  }
311
328
 
329
+ /**
330
+ * A command receipt with its outcome carried structurally: `ok: true` is a
331
+ * success, `false` a failure, `"warn"` a no-op or conflict. Handlers return
332
+ * these so the strip never infers failure from prose.
333
+ */
334
+ export type Receipt = Readonly<{ ok: boolean | "warn"; text: string }>;
335
+
336
+ export const ok = (text: string): Receipt => ({ ok: true, text });
337
+ export const fail = (text: string): Receipt => ({ ok: false, text });
338
+ export const warn = (text: string): Receipt => ({ ok: "warn", text });
339
+
340
+ /** Tone of a structured receipt; strings fall back to `receiptTone`. */
341
+ export function toneOf(receipt: string | Receipt): CardTone {
342
+ if (typeof receipt === "string") return receiptTone(receipt);
343
+ return receipt.ok === true
344
+ ? "success"
345
+ : receipt.ok === "warn"
346
+ ? "warning"
347
+ : "error";
348
+ }
349
+
312
350
  /**
313
351
  * Classify a legacy command receipt string (e.g. "undid · rev 41",
314
- * "tempo error · …") into a card tone so existing handlers need no rewrite.
352
+ * "tempo error · …") into a card tone. Fallback for handlers that still
353
+ * return plain strings; new handlers return a `Receipt`.
315
354
  */
316
355
  export function receiptTone(message: string): CardTone {
317
356
  const lower = message.toLowerCase();