driggsby 0.10.3 → 0.10.5
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.
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
import { CALL, LINES, OFFER_AT, STEPS } from "./att-story.js";
|
|
7
7
|
import { line, padTo, seg, width } from "./paint.js";
|
|
8
8
|
import { toPlay, toReal } from "./timeline.js";
|
|
9
|
+
// The replay starts at 1.2x; f switches between it and 2x.
|
|
10
|
+
export const SPEEDS = [1.2, 2];
|
|
11
|
+
export function nextSpeed(speed) {
|
|
12
|
+
const at = SPEEDS.findIndex((s) => s === speed);
|
|
13
|
+
return SPEEDS[(at + 1) % SPEEDS.length] ?? SPEEDS[0];
|
|
14
|
+
}
|
|
9
15
|
const C = {
|
|
10
16
|
text: "#EDEDED", soft: "#C9CDD3", mute: "#8B9099", faint: "#5A5F68", ghost: "#30343B", agent: "#7DB4FF",
|
|
11
17
|
music: "#A99BFB", money: "#4ADE80", live: "#F87171", liveDim: "#7A2E2E", keys: "#F5C451", ink: "#0B0C0E",
|
|
@@ -205,7 +211,7 @@ function bottomBar(real, pt, ended, w, narrow, timeline) {
|
|
|
205
211
|
function help(input, w, narrow) {
|
|
206
212
|
const keys = narrow
|
|
207
213
|
? [["space", input.paused ? "play" : "pause"], ["q", "quit"]]
|
|
208
|
-
: [["space", input.paused ? "play" : "pause"], ["f", input.
|
|
214
|
+
: [["space", input.paused ? "play" : "pause"], ["f", `${String(nextSpeed(input.speed))}×`], ["r", "replay"], ["q", "quit"]];
|
|
209
215
|
const left = keys.flatMap(([key, what], i) => [seg((i > 0 ? (narrow ? " " : " · ") : "") + key, C.mute), seg(` ${what}`, C.faint)]);
|
|
210
216
|
// j belongs to the ending: nothing about it shows while the call plays.
|
|
211
217
|
if (input.pt < input.timeline.endStart)
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
// driggsby replay att: a replay of an agent's call with AT&T about an
|
|
2
2
|
// internet bill, in the terminal. On a Mac it plays with sound (recreated
|
|
3
3
|
// voices, the call's real words), paced around them; elsewhere, or with
|
|
4
|
-
// --quiet, it plays silently and faster.
|
|
5
|
-
// starts over, the arrows move two
|
|
6
|
-
// each of them in place. Once the
|
|
7
|
-
//
|
|
8
|
-
// in first, votes, and the command
|
|
4
|
+
// --quiet, it plays silently and faster. It starts at 1.2x. Space pauses, f
|
|
5
|
+
// switches between 1.2x and 2x, r starts over, the arrows move two
|
|
6
|
+
// seconds, and q quits; the voice follows each of them in place. Once the
|
|
7
|
+
// call has played to the end, j votes to roll the feature out: signed in, the
|
|
8
|
+
// vote counts in place; signed out, it signs in first, votes, and the command
|
|
9
|
+
// ends.
|
|
9
10
|
import { CliError } from "../cli-error.js";
|
|
10
11
|
import { defaultCredentialEnvironment, readStoredToken } from "../credentials/store.js";
|
|
11
12
|
import { deployFailure, requireDeploySession } from "../deploy/api-session.js";
|
|
12
13
|
import { runLogin } from "../login/login.js";
|
|
13
14
|
import { CUES, SILENT, VOICED } from "./att-story.js";
|
|
14
|
-
import { MIN_COLS, MIN_ROWS, renderFrame } from "./feed-frame.js";
|
|
15
|
+
import { MIN_COLS, MIN_ROWS, nextSpeed, renderFrame, SPEEDS } from "./feed-frame.js";
|
|
15
16
|
import { lineAt, startVoice } from "./voice.js";
|
|
16
17
|
import { castVote } from "./vote.js";
|
|
17
18
|
const TICK_MS = 33;
|
|
@@ -50,7 +51,7 @@ function play(timeline, voice, environment) {
|
|
|
50
51
|
const stdout = process.stdout;
|
|
51
52
|
let pt = 0;
|
|
52
53
|
let paused = false;
|
|
53
|
-
let
|
|
54
|
+
let speed = SPEEDS[0];
|
|
54
55
|
let vote = "idle";
|
|
55
56
|
let last = Date.now();
|
|
56
57
|
// A full-screen app: the whole terminal, the header at the top and the
|
|
@@ -58,10 +59,9 @@ function play(timeline, voice, environment) {
|
|
|
58
59
|
const draw = () => {
|
|
59
60
|
const cols = Math.max(MIN_COLS, stdout.columns - 1);
|
|
60
61
|
const rows = Math.max(MIN_ROWS, stdout.rows);
|
|
61
|
-
const frame = renderFrame({ pt, nowMs: Date.now(), cols, rows, timeline, vote, paused,
|
|
62
|
+
const frame = renderFrame({ pt, nowMs: Date.now(), cols, rows, timeline, vote, paused, speed });
|
|
62
63
|
stdout.write(`\u001b[H${frame.join("\r\n")}`);
|
|
63
64
|
};
|
|
64
|
-
const rate = () => (fast ? 2 : 1);
|
|
65
65
|
// A jump picks up whatever line is being said at the new moment, mid-word.
|
|
66
66
|
const seek = (to) => {
|
|
67
67
|
pt = Math.max(0, Math.min(timeline.total, to));
|
|
@@ -71,7 +71,7 @@ function play(timeline, voice, environment) {
|
|
|
71
71
|
if (line === null)
|
|
72
72
|
voice.stop();
|
|
73
73
|
else
|
|
74
|
-
voice.play(line.file, line.offset,
|
|
74
|
+
voice.play(line.file, line.offset, speed, paused);
|
|
75
75
|
};
|
|
76
76
|
return new Promise((resolve) => {
|
|
77
77
|
stdout.write("\u001b[?1049h\u001b[?25l\u001b[2J");
|
|
@@ -131,8 +131,8 @@ function play(timeline, voice, environment) {
|
|
|
131
131
|
voice?.resume();
|
|
132
132
|
}
|
|
133
133
|
else if (key === "f") {
|
|
134
|
-
|
|
135
|
-
voice?.rate(
|
|
134
|
+
speed = nextSpeed(speed);
|
|
135
|
+
voice?.rate(speed);
|
|
136
136
|
}
|
|
137
137
|
else if (key === "r") {
|
|
138
138
|
paused = false;
|
|
@@ -149,11 +149,11 @@ function play(timeline, voice, environment) {
|
|
|
149
149
|
const dt = (now - last) / 1000;
|
|
150
150
|
last = now;
|
|
151
151
|
if (!paused && pt < timeline.total) {
|
|
152
|
-
const next = Math.min(timeline.total, pt + dt *
|
|
152
|
+
const next = Math.min(timeline.total, pt + dt * speed);
|
|
153
153
|
if (voice !== null)
|
|
154
154
|
for (const cue of CUES)
|
|
155
155
|
if (cue.at > pt && cue.at <= next)
|
|
156
|
-
voice.play(cue.file, 0,
|
|
156
|
+
voice.play(cue.file, 0, speed, false);
|
|
157
157
|
pt = next;
|
|
158
158
|
}
|
|
159
159
|
draw();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "driggsby",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "Set up and build on Driggsby, the MCP server for personal finance.",
|
|
5
5
|
"license": "Apache-2.0 AND OFL-1.1",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"node": ">=18"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@driggsby/deploy": "0.10.
|
|
35
|
-
"@driggsby/sdk": "0.10.
|
|
34
|
+
"@driggsby/deploy": "0.10.5",
|
|
35
|
+
"@driggsby/sdk": "0.10.5"
|
|
36
36
|
}
|
|
37
37
|
}
|