The brain: a long-running Claude Code session, confined with bwrap to its workspace, that hears the box through a channel and works the TV with the box's ir and look capabilities. - brain/channel.js: MCP on stdio to the brain (reply, say, ir_listen, ir_send, look, report_problem), and the ask capability, behind a gate, to the box - brain/ask.js: the conversations between them; report.js: an issue on one repository, by a token that can do nothing else - brain/brain.service: the session in tmux, in bwrap: a read-only system, an empty home but for its workspace, keys, and claude - brain/instructions.md: how to work the TV; it imports household.md, who's who (an example, with no real people) - brain/Makefile: make install, attach, status - checks: brain-js (unit tests), brain (the package, put together) Generated-by: Claude Opus 5.5
35 lines
1.3 KiB
Nix
35 lines
1.3 KiB
Nix
# pdtv26-brain: the brain's channel: MCP to the brain, and the ask capability to the box.
|
|
# npm runs here, in Nix's build sandbox, from package-lock.json; so do the tests.
|
|
# gate.js is speech's, copied in: one copy in git, and no package to share it.
|
|
# The output is plain JavaScript, the same on every architecture (allowedReferences keeps it so):
|
|
# each user supplies its own node, at lib/node_modules/pdtv26-brain/*.js.
|
|
{ lib, buildNpmPackage }:
|
|
buildNpmPackage {
|
|
pname = "pdtv26-brain";
|
|
version = "0.1.0";
|
|
src = lib.fileset.toSource {
|
|
root = ./.;
|
|
fileset = lib.fileset.unions [
|
|
./package.json ./package-lock.json
|
|
./ask.js ./ask.test.js ./report.js ./report.test.js ./channel.js
|
|
];
|
|
};
|
|
postPatch = ''
|
|
cp ${../speech/gate.js} gate.js
|
|
'';
|
|
npmDepsHash = "sha256-S2EuPu4u2sy43Tkf4SLMWIRw98w/QcljuQEkHXFgV3k=";
|
|
dontNpmBuild = true;
|
|
# The scripts' #!/usr/bin/env node stays as is: patched, it would tie the package to one node.
|
|
dontPatchShebangs = true;
|
|
npmInstallFlags = [ "--ignore-scripts" ];
|
|
doCheck = true;
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
# Every file parses, the channel included: no test imports them.
|
|
for f in *.js; do node --check "$f"; done
|
|
node --test
|
|
runHook postCheck
|
|
'';
|
|
allowedReferences = [ ];
|
|
}
|