@todoforai/cli 0.1.11 → 0.1.12

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.
Files changed (2) hide show
  1. package/dist/todoai.js +28 -9
  2. package/package.json +1 -1
package/dist/todoai.js CHANGED
@@ -43707,11 +43707,19 @@ function parsePattern(pattern) {
43707
43707
  }
43708
43708
  return { serverId, toolName: pattern.slice(colonIndex + 1) };
43709
43709
  }
43710
- function serverIdMatches(ruleServerId, targetServerId) {
43710
+ var SCOPE_BUILTIN = "builtin";
43711
+ var SCOPE_DEVICE = "device";
43712
+ var SCOPE_CLOUD = "cloud";
43713
+ var isDeviceId = (s) => s !== "*" && s !== SCOPE_BUILTIN && s !== SCOPE_DEVICE && s !== SCOPE_CLOUD && !s.includes("*");
43714
+ function serverIdMatches(ruleServerId, targetServerId, ctx) {
43711
43715
  if (ruleServerId === targetServerId)
43712
43716
  return true;
43713
43717
  if (ruleServerId === "*")
43714
43718
  return true;
43719
+ if (ruleServerId === SCOPE_DEVICE)
43720
+ return isDeviceId(targetServerId);
43721
+ if (ruleServerId === SCOPE_CLOUD)
43722
+ return !!ctx?.primaryCloudId && targetServerId === ctx.primaryCloudId;
43715
43723
  if (ruleServerId.includes("*")) {
43716
43724
  const escaped = ruleServerId.replace(/[.+?^${}()|[\]\\]/g, "\\$&");
43717
43725
  const regex = new RegExp("^" + escaped.replace(/\*/g, "[^:]*") + "$");
@@ -43721,12 +43729,12 @@ function serverIdMatches(ruleServerId, targetServerId) {
43721
43729
  return true;
43722
43730
  return false;
43723
43731
  }
43724
- function patternMatches(rulePattern, targetPattern) {
43732
+ function patternMatches(rulePattern, targetPattern, ctx) {
43725
43733
  const rule = parsePattern(rulePattern);
43726
43734
  const target = parsePattern(targetPattern);
43727
43735
  if (!rule || !target)
43728
43736
  return rulePattern === targetPattern;
43729
- if (!serverIdMatches(rule.serverId, target.serverId))
43737
+ if (!serverIdMatches(rule.serverId, target.serverId, ctx))
43730
43738
  return false;
43731
43739
  if (rule.toolName === target.toolName)
43732
43740
  return true;
@@ -43791,6 +43799,17 @@ function getBlockNewPatterns(block, permissions) {
43791
43799
  }
43792
43800
  return pairs.filter(({ raw, pattern }) => !isPatternAllowed(permissions, pattern) && !allow.some((rule) => bashRuleMatchesCmd(rule, serverId, raw))).map(({ pattern }) => pattern);
43793
43801
  }
43802
+ // ../packages/shared-fbe/src/outputLimits.ts
43803
+ var MAX_LINE_LEN = 300;
43804
+ var STREAM_FIRST = 1e4;
43805
+ var STREAM_LAST = 1e4;
43806
+ var RUN_OUTPUT_CAP = 256 * 1024;
43807
+ var OUTPUT_POLICIES = {
43808
+ safe: { firstLimit: STREAM_FIRST, lastLimit: STREAM_LAST, hardCap: STREAM_FIRST + STREAM_LAST, lineLimit: MAX_LINE_LEN },
43809
+ wide: { firstLimit: STREAM_FIRST, lastLimit: STREAM_LAST, hardCap: STREAM_FIRST + STREAM_LAST, lineLimit: Infinity },
43810
+ full: { firstLimit: Infinity, lastLimit: 0, hardCap: RUN_OUTPUT_CAP, lineLimit: MAX_LINE_LEN },
43811
+ raw: { firstLimit: Infinity, lastLimit: 0, hardCap: Infinity, lineLimit: Infinity }
43812
+ };
43794
43813
  // ../packages/shared-fbe/src/realtime/topics.ts
43795
43814
  var TOPICS = {
43796
43815
  ["todo:new" /* NEW_TODO */]: {
@@ -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("cli");
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(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoforai/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "todoai": "dist/todoai.js"