@boole-digital/cli 0.3.0 → 0.3.1
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.
- package/dist/index.js +28 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -743,6 +743,20 @@ here.
|
|
|
743
743
|
\`\`\`
|
|
744
744
|
3. Operate the box exactly as that guide says.
|
|
745
745
|
|
|
746
|
+
## Building anything non-trivial? PLAN FIRST.
|
|
747
|
+
Before you hand-write a strategy, spawn a template, or spelunk the box for *how* to
|
|
748
|
+
do something, ask the harness how to build it:
|
|
749
|
+
\`\`\`
|
|
750
|
+
boole plan "<the user's request, in plain English>"
|
|
751
|
+
\`\`\`
|
|
752
|
+
The harness holds the full picture \u2014 system prompt, tools, the real trading surface \u2014
|
|
753
|
+
that you CANNOT see from the outside. \`boole plan\` returns a concrete implementation
|
|
754
|
+
plan: the exact \`ti.*\` calls + signatures, file paths, and which template/gate to use,
|
|
755
|
+
grounded in what THIS box actually exposes. Follow it, then implement over \`boole ssh\`.
|
|
756
|
+
Do NOT guess API shapes, web-search, or hunt through template files \u2014 planning replaces
|
|
757
|
+
that. (If the box's gateway is older and doesn't support planning, \`boole plan\` will
|
|
758
|
+
say so \u2014 fall back to \`OPERATOR.md\`.)
|
|
759
|
+
|
|
746
760
|
## The model
|
|
747
761
|
- The box IS the gateway. You SSH into it with \`boole ssh\` and drive its **harness**.
|
|
748
762
|
- You take the user's request **in plain English** ("buy $100 of BTC") and carry
|
|
@@ -794,14 +808,24 @@ async function plan({ request }) {
|
|
|
794
808
|
if (req.length > 4e3) die("Request too long (max 4000 chars). Trim it down.");
|
|
795
809
|
info("Asking your box how to build this \u2014 the harness has the full picture (this can take up to a minute)\u2026");
|
|
796
810
|
const payload = Buffer.from(JSON.stringify({ request: req })).toString("base64");
|
|
797
|
-
const
|
|
811
|
+
const MARK = "__BOOLE_HTTP__";
|
|
812
|
+
const cmd = `printf %s '${payload}' | base64 -d | curl -s --max-time 175 -w '\\n${MARK}%{http_code}' -X POST http://localhost:3000/api/plan -H 'content-type: application/json' -d @-`;
|
|
798
813
|
const { code, stdout, stderr } = await runRemote(cmd);
|
|
799
814
|
if (!stdout) die(`Could not reach the planner on your box${code ? ` (exit ${code})` : ""}. ${stderr || ""}`.trim());
|
|
815
|
+
let body = stdout, http = 0;
|
|
816
|
+
const mi = stdout.lastIndexOf(MARK);
|
|
817
|
+
if (mi >= 0) {
|
|
818
|
+
body = stdout.slice(0, mi).trimEnd();
|
|
819
|
+
http = parseInt(stdout.slice(mi + MARK.length), 10) || 0;
|
|
820
|
+
}
|
|
821
|
+
if (http === 404) {
|
|
822
|
+
die("This box's gateway doesn't support planning yet (no /api/plan). Update the gateway to a build that includes it, or build directly with `boole ssh`.");
|
|
823
|
+
}
|
|
800
824
|
let res;
|
|
801
825
|
try {
|
|
802
|
-
res = JSON.parse(
|
|
826
|
+
res = JSON.parse(body);
|
|
803
827
|
} catch {
|
|
804
|
-
die(`Planner returned an unexpected response: ${
|
|
828
|
+
die(`Planner returned an unexpected response${http ? ` (HTTP ${http})` : ""}: ${body.slice(0, 300) || stderr || "empty"}`);
|
|
805
829
|
}
|
|
806
830
|
if (res?.error) die(`Planner error: ${res.error}`);
|
|
807
831
|
const planText = String(res?.plan || "").trim();
|
|
@@ -823,7 +847,7 @@ async function plan({ request }) {
|
|
|
823
847
|
}
|
|
824
848
|
|
|
825
849
|
// src/index.ts
|
|
826
|
-
var VERSION = "0.3.
|
|
850
|
+
var VERSION = "0.3.1";
|
|
827
851
|
function parse(argv) {
|
|
828
852
|
const _ = [];
|
|
829
853
|
const flags = {};
|
package/package.json
CHANGED