toolroll 0.9.115 → 0.9.116

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.
@@ -38,6 +38,10 @@ function outputSchema(tools) {
38
38
  };
39
39
  }
40
40
  export function composeSubscriptionLeadPrompt(request) {
41
+ if (request.outputSchema !== undefined)
42
+ return [request.system,
43
+ "STRUCTURED RESPONSE PROTOCOL: Return only the JSON object required by the supplied output schema. Do not use any harness tools or inspect the computer. DATA and CONVERSATION below are the only context.",
44
+ `DATA:\n${request.dataDocument}`, `CONVERSATION:\n${JSON.stringify(request.history)}`].join("\n\n");
41
45
  return [
42
46
  request.system,
43
47
  "SUBSCRIPTION HARNESS PROTOCOL:",
@@ -0,0 +1,114 @@
1
+ import { StringDecoder } from "node:string_decoder";
2
+ export class TerminalSafetyFilter {
3
+ decoder = new StringDecoder("utf8");
4
+ state = "text";
5
+ sequence = "";
6
+ osc = false;
7
+ ended = false;
8
+ write(bytes) {
9
+ if (this.ended)
10
+ throw new Error("Terminal safety filter already finished");
11
+ return this.parse(this.decoder.write(Buffer.from(bytes)));
12
+ }
13
+ finish() {
14
+ if (this.ended)
15
+ return "";
16
+ const out = this.parse(this.decoder.end());
17
+ this.ended = true;
18
+ this.sequence = "";
19
+ this.state = "text";
20
+ return out;
21
+ }
22
+ parse(text) {
23
+ const out = [];
24
+ for (const char of text) {
25
+ const code = char.codePointAt(0);
26
+ if (this.state === "string" || this.state === "string-escape") {
27
+ if (code === 0x9c || (this.osc && code === 7) || (this.state === "string-escape" && char === "\\")) {
28
+ this.state = "text";
29
+ }
30
+ else
31
+ this.state = char === "\x1b" ? "string-escape" : "string";
32
+ continue;
33
+ }
34
+ if (char === "\x1b") {
35
+ this.state = "escape";
36
+ this.sequence = "";
37
+ continue;
38
+ }
39
+ if ([0x90, 0x98, 0x9d, 0x9e, 0x9f].includes(code)) {
40
+ this.osc = code === 0x9d;
41
+ this.state = "string";
42
+ this.sequence = "";
43
+ continue;
44
+ }
45
+ if (code === 0x9b) {
46
+ this.state = "csi";
47
+ this.sequence = "";
48
+ continue;
49
+ }
50
+ if (code === 0x18 || code === 0x1a) {
51
+ this.state = "text";
52
+ this.sequence = "";
53
+ continue;
54
+ }
55
+ if (this.state === "escape") {
56
+ if (char === "[") {
57
+ this.state = "csi";
58
+ continue;
59
+ }
60
+ if ("]PX^_".includes(char)) {
61
+ this.osc = char === "]";
62
+ this.state = "string";
63
+ continue;
64
+ }
65
+ if (code >= 0x20 && code <= 0x2f) {
66
+ this.state = "escape-intermediate";
67
+ continue;
68
+ }
69
+ if ("78DEM=>".includes(char))
70
+ out.push(`\x1b${char}`);
71
+ this.state = "text";
72
+ continue;
73
+ }
74
+ if (this.state === "escape-intermediate") {
75
+ if (code >= 0x30 && code <= 0x7e)
76
+ this.state = "text";
77
+ continue;
78
+ }
79
+ if (this.state === "csi") {
80
+ if (code >= 0x40 && code <= 0x7e) {
81
+ if (allowedCsi(this.sequence, char))
82
+ out.push(`\x1b[${this.sequence}${char}`);
83
+ this.sequence = "";
84
+ this.state = "text";
85
+ }
86
+ else if (this.sequence.length < 256 && code >= 0x20 && code <= 0x3f) {
87
+ this.sequence += char;
88
+ }
89
+ else {
90
+ this.sequence = "!";
91
+ }
92
+ continue;
93
+ }
94
+ if ((code >= 0x20 && !(code >= 0x7f && code <= 0x9f)) || "\b\t\n\r".includes(char))
95
+ out.push(char);
96
+ }
97
+ return out.join("");
98
+ }
99
+ }
100
+ function allowedCsi(params, final) {
101
+ if (params.length > 256 || params.includes("!"))
102
+ return false;
103
+ if (final === "h" || final === "l") {
104
+ const privateMode = params.startsWith("?");
105
+ const body = privateMode ? params.slice(1) : params;
106
+ const modes = privateMode ? [1, 6, 7, 25, 47, 1000, 1002, 1003, 1004, 1005, 1006, 1047, 1048, 1049, 2004] : [4, 20];
107
+ return /^\d+(;\d+)*$/.test(body) && body.split(";").every(n => modes.includes(Number(n)));
108
+ }
109
+ if (final === "m")
110
+ return /^[\d;:]*$/.test(params);
111
+ if ("ABCDEFGHIZ`adefJKLMPSTXrsu".includes(final))
112
+ return /^[\d;]*$/.test(params);
113
+ return final === "q" && /^[0-6]? $/.test(params);
114
+ }
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "toolroll",
3
- "version": "0.9.115",
4
- "description": "Your agents build. You decide. A control plane for coding agents — Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
3
+ "version": "0.9.116",
4
+ "description": "Your agents build. You decide. A control plane for coding agents \u2014 Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
5
5
  "directories": {
6
6
  "doc": "docs"
7
7
  },