@todoforai/cli 0.1.11 → 0.1.13
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/todoai.js +37 -14
- package/package.json +1 -1
package/dist/todoai.js
CHANGED
|
@@ -42744,7 +42744,7 @@ class ApiClient {
|
|
|
42744
42744
|
}
|
|
42745
42745
|
async request(method, endpoint, body) {
|
|
42746
42746
|
const url = `${this.apiUrl}${endpoint}`;
|
|
42747
|
-
const opts = { method, headers: this.headers };
|
|
42747
|
+
const opts = { method, headers: this.headers, signal: AbortSignal.timeout(30000) };
|
|
42748
42748
|
if (body)
|
|
42749
42749
|
opts.body = JSON.stringify(body);
|
|
42750
42750
|
const res = await fetch(url, opts);
|
|
@@ -43300,7 +43300,6 @@ var EDGE_TOOL_TYPES = new Set([
|
|
|
43300
43300
|
"edit" /* Edit */,
|
|
43301
43301
|
"modify_file" /* ModifyFile */,
|
|
43302
43302
|
"bash" /* Bash */,
|
|
43303
|
-
"search" /* Search */,
|
|
43304
43303
|
"grep" /* Grep */,
|
|
43305
43304
|
"list" /* List */
|
|
43306
43305
|
]);
|
|
@@ -43707,26 +43706,32 @@ function parsePattern(pattern) {
|
|
|
43707
43706
|
}
|
|
43708
43707
|
return { serverId, toolName: pattern.slice(colonIndex + 1) };
|
|
43709
43708
|
}
|
|
43710
|
-
|
|
43709
|
+
var SCOPE_BUILTIN = "builtin";
|
|
43710
|
+
var SCOPE_DEVICE = "device";
|
|
43711
|
+
var SCOPE_CLOUD = "cloud";
|
|
43712
|
+
var isDeviceId = (s) => s !== "*" && s !== SCOPE_BUILTIN && s !== SCOPE_DEVICE && s !== SCOPE_CLOUD && !s.includes("*");
|
|
43713
|
+
function serverIdMatches(ruleServerId, targetServerId, ctx) {
|
|
43711
43714
|
if (ruleServerId === targetServerId)
|
|
43712
43715
|
return true;
|
|
43713
43716
|
if (ruleServerId === "*")
|
|
43714
43717
|
return true;
|
|
43718
|
+
if (ruleServerId === SCOPE_DEVICE)
|
|
43719
|
+
return isDeviceId(targetServerId);
|
|
43720
|
+
if (ruleServerId === SCOPE_CLOUD)
|
|
43721
|
+
return !!ctx?.primaryCloudId && targetServerId === ctx.primaryCloudId;
|
|
43715
43722
|
if (ruleServerId.includes("*")) {
|
|
43716
43723
|
const escaped = ruleServerId.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
|
|
43717
43724
|
const regex = new RegExp("^" + escaped.replace(/\*/g, "[^:]*") + "$");
|
|
43718
43725
|
return regex.test(targetServerId);
|
|
43719
43726
|
}
|
|
43720
|
-
if (targetServerId.startsWith(ruleServerId + "_"))
|
|
43721
|
-
return true;
|
|
43722
43727
|
return false;
|
|
43723
43728
|
}
|
|
43724
|
-
function patternMatches(rulePattern, targetPattern) {
|
|
43729
|
+
function patternMatches(rulePattern, targetPattern, ctx) {
|
|
43725
43730
|
const rule = parsePattern(rulePattern);
|
|
43726
43731
|
const target = parsePattern(targetPattern);
|
|
43727
43732
|
if (!rule || !target)
|
|
43728
43733
|
return rulePattern === targetPattern;
|
|
43729
|
-
if (!serverIdMatches(rule.serverId, target.serverId))
|
|
43734
|
+
if (!serverIdMatches(rule.serverId, target.serverId, ctx))
|
|
43730
43735
|
return false;
|
|
43731
43736
|
if (rule.toolName === target.toolName)
|
|
43732
43737
|
return true;
|
|
@@ -43742,7 +43747,8 @@ function bashRuleMatchesCmd(rulePattern, serverId, cmd) {
|
|
|
43742
43747
|
const rule = parsePattern(rulePattern);
|
|
43743
43748
|
if (!rule)
|
|
43744
43749
|
return false;
|
|
43745
|
-
|
|
43750
|
+
const targetServer = parsePattern(`${serverId}:_`)?.serverId ?? serverId;
|
|
43751
|
+
if (!serverIdMatches(rule.serverId, targetServer))
|
|
43746
43752
|
return false;
|
|
43747
43753
|
if (rule.toolName === "*" || rule.toolName === "BASH")
|
|
43748
43754
|
return true;
|
|
@@ -43791,6 +43797,17 @@ function getBlockNewPatterns(block, permissions) {
|
|
|
43791
43797
|
}
|
|
43792
43798
|
return pairs.filter(({ raw, pattern }) => !isPatternAllowed(permissions, pattern) && !allow.some((rule) => bashRuleMatchesCmd(rule, serverId, raw))).map(({ pattern }) => pattern);
|
|
43793
43799
|
}
|
|
43800
|
+
// ../packages/shared-fbe/src/outputLimits.ts
|
|
43801
|
+
var MAX_LINE_LEN = 300;
|
|
43802
|
+
var STREAM_FIRST = 1e4;
|
|
43803
|
+
var STREAM_LAST = 1e4;
|
|
43804
|
+
var RUN_OUTPUT_CAP = 256 * 1024;
|
|
43805
|
+
var OUTPUT_POLICIES = {
|
|
43806
|
+
safe: { firstLimit: STREAM_FIRST, lastLimit: STREAM_LAST, hardCap: STREAM_FIRST + STREAM_LAST, lineLimit: MAX_LINE_LEN },
|
|
43807
|
+
wide: { firstLimit: STREAM_FIRST, lastLimit: STREAM_LAST, hardCap: STREAM_FIRST + STREAM_LAST, lineLimit: Infinity },
|
|
43808
|
+
full: { firstLimit: Infinity, lastLimit: 0, hardCap: RUN_OUTPUT_CAP, lineLimit: MAX_LINE_LEN },
|
|
43809
|
+
raw: { firstLimit: Infinity, lastLimit: 0, hardCap: Infinity, lineLimit: Infinity }
|
|
43810
|
+
};
|
|
43794
43811
|
// ../packages/shared-fbe/src/realtime/topics.ts
|
|
43795
43812
|
var TOPICS = {
|
|
43796
43813
|
["todo:new" /* NEW_TODO */]: {
|
|
@@ -43956,6 +43973,7 @@ Options:
|
|
|
43956
43973
|
--non-interactive, -n Run to completion and exit without interactive prompt
|
|
43957
43974
|
--dangerously-skip-permissions Auto-approve all blocks (for CI/benchmarks)
|
|
43958
43975
|
--allow-all Set permissions to allow all tools (no approval needed)
|
|
43976
|
+
--raw-sysmsg <file> Use file contents verbatim as system prompt (new TODO only)
|
|
43959
43977
|
--no-watch Create todo and exit
|
|
43960
43978
|
--no-edge Do not auto-spawn edge daemon
|
|
43961
43979
|
--json Output as JSON
|
|
@@ -44009,6 +44027,7 @@ function parseCliArgs() {
|
|
|
44009
44027
|
"non-interactive": { type: "boolean", short: "n", default: false },
|
|
44010
44028
|
"dangerously-skip-permissions": { type: "boolean", default: false },
|
|
44011
44029
|
"allow-all": { type: "boolean", default: false },
|
|
44030
|
+
"raw-sysmsg": { type: "string" },
|
|
44012
44031
|
"no-watch": { type: "boolean", default: false },
|
|
44013
44032
|
"no-edge": { type: "boolean", default: false },
|
|
44014
44033
|
json: { type: "boolean", default: false },
|
|
@@ -44598,11 +44617,11 @@ var LETTERS = {
|
|
|
44598
44617
|
var GAP = " ";
|
|
44599
44618
|
var WORD = "todo4ai";
|
|
44600
44619
|
function renderHalfBlock(top, bot) {
|
|
44601
|
-
const W = "\x1B[38;2;249;110;46m";
|
|
44602
|
-
const G = "\x1B[38;2;140;60;20m";
|
|
44603
|
-
const BW = "\x1B[48;2;249;110;46m";
|
|
44604
|
-
const BG = "\x1B[48;2;140;60;20m";
|
|
44605
|
-
const R = "\x1B[0m";
|
|
44620
|
+
const W = c("\x1B[38;2;249;110;46m");
|
|
44621
|
+
const G = c("\x1B[38;2;140;60;20m");
|
|
44622
|
+
const BW = c("\x1B[48;2;249;110;46m");
|
|
44623
|
+
const BG = c("\x1B[48;2;140;60;20m");
|
|
44624
|
+
const R = c("\x1B[0m");
|
|
44606
44625
|
if (top === " " && bot === " ")
|
|
44607
44626
|
return " ";
|
|
44608
44627
|
if (top === bot) {
|
|
@@ -46142,7 +46161,7 @@ Cancelled by user (Ctrl+C)
|
|
|
46142
46161
|
const cfgScope = cfg.scope(apiUrl);
|
|
46143
46162
|
async function deviceLogin() {
|
|
46144
46163
|
const loginApi = new ApiClient(apiUrl, "");
|
|
46145
|
-
const { code, url, expiresIn } = await loginApi.initDeviceLogin("
|
|
46164
|
+
const { code, url, expiresIn } = await loginApi.initDeviceLogin("edge");
|
|
46146
46165
|
const userCode = new URL(url).searchParams.get("user_code") || code.slice(-8).toUpperCase();
|
|
46147
46166
|
const formattedCode = userCode.length === 8 ? `${userCode.slice(0, 4)}-${userCode.slice(4)}` : userCode;
|
|
46148
46167
|
process.stderr.write(`
|
|
@@ -46508,6 +46527,10 @@ Resumed: ${CYAN}${getFrontendUrl(apiUrl, projectId2, todoId)}${RESET}
|
|
|
46508
46527
|
await ws.connect();
|
|
46509
46528
|
if (args.model)
|
|
46510
46529
|
agent = { ...agent, model: args.model };
|
|
46530
|
+
if (args["raw-sysmsg"]) {
|
|
46531
|
+
const sysmsg = readFileSync3(resolve3(args["raw-sysmsg"]), "utf-8");
|
|
46532
|
+
agent = { ...agent, systemMessage: sysmsg, systemMessageMode: "raw" };
|
|
46533
|
+
}
|
|
46511
46534
|
if (args["allow-all"]) {
|
|
46512
46535
|
const perms = agent.permissions || { allow: [], ask: [], deny: [] };
|
|
46513
46536
|
agent = { ...agent, permissions: { ...perms, allow: [...perms.allow || [], "*:*"] } };
|