kimiflare 0.50.0 → 0.50.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 CHANGED
@@ -3349,8 +3349,8 @@ var init_write = __esm({
3349
3349
  },
3350
3350
  needsPermission: true,
3351
3351
  render: (args) => ({
3352
- title: `write ${collapsePath(args.path, process.cwd())} (${args.content.length} chars)`,
3353
- diff: { path: args.path, before: "", after: args.content }
3352
+ title: `write ${collapsePath(String(args.path ?? ""), process.cwd())} (${String(args.content ?? "").length} chars)`,
3353
+ diff: { path: String(args.path ?? ""), before: "", after: String(args.content ?? "") }
3354
3354
  }),
3355
3355
  async run(args, ctx) {
3356
3356
  const abs = resolvePath(ctx.cwd, args.path);
@@ -3402,8 +3402,8 @@ var init_edit = __esm({
3402
3402
  },
3403
3403
  needsPermission: true,
3404
3404
  render: (args) => ({
3405
- title: `edit ${collapsePath(args.path, process.cwd())}${args.replace_all ? " (replace_all)" : ""}`,
3406
- diff: { path: args.path, before: args.old_string, after: args.new_string }
3405
+ title: `edit ${collapsePath(String(args.path ?? ""), process.cwd())}${args.replace_all ? " (replace_all)" : ""}`,
3406
+ diff: { path: String(args.path ?? ""), before: String(args.old_string ?? ""), after: String(args.new_string ?? "") }
3407
3407
  }),
3408
3408
  async run(args, ctx) {
3409
3409
  const abs = resolvePath(ctx.cwd, args.path);
@@ -3551,7 +3551,7 @@ var init_bash = __esm({
3551
3551
  additionalProperties: false
3552
3552
  },
3553
3553
  needsPermission: true,
3554
- render: (args) => ({ title: formatBashTitle(args.command) }),
3554
+ render: (args) => ({ title: formatBashTitle(String(args.command ?? "")) }),
3555
3555
  run: (args, ctx) => runBash(args, ctx)
3556
3556
  };
3557
3557
  }
@@ -3577,7 +3577,7 @@ var init_glob = __esm({
3577
3577
  additionalProperties: false
3578
3578
  },
3579
3579
  needsPermission: false,
3580
- render: (args) => ({ title: `glob ${args.pattern}${args.path ? ` in ${collapsePath(args.path, process.cwd())}` : ""}` }),
3580
+ render: (args) => ({ title: `glob ${args.pattern ?? ""}${args.path ? ` in ${collapsePath(String(args.path), process.cwd())}` : ""}` }),
3581
3581
  async run(args, ctx) {
3582
3582
  const root = args.path ? resolvePath(ctx.cwd, args.path) : ctx.cwd;
3583
3583
  const entries = await fg(args.pattern, {
@@ -3695,7 +3695,7 @@ var init_grep = __esm({
3695
3695
  additionalProperties: false
3696
3696
  },
3697
3697
  needsPermission: false,
3698
- render: (args) => ({ title: `grep ${args.pattern}${args.glob ? ` (${args.glob})` : ""}` }),
3698
+ render: (args) => ({ title: `grep ${args.pattern ?? ""}${args.glob ? ` (${args.glob})` : ""}` }),
3699
3699
  async run(args, ctx) {
3700
3700
  const root = args.path ? resolvePath(ctx.cwd, args.path) : ctx.cwd;
3701
3701
  const mode = args.output_mode ?? "content";
@@ -3727,7 +3727,7 @@ var init_web_fetch = __esm({
3727
3727
  additionalProperties: false
3728
3728
  },
3729
3729
  needsPermission: false,
3730
- render: (args) => ({ title: `GET ${args.url}` }),
3730
+ render: (args) => ({ title: `GET ${args.url ?? ""}` }),
3731
3731
  async run(args) {
3732
3732
  const controller = new AbortController();
3733
3733
  const timer = setTimeout(() => controller.abort(), TIMEOUT_MS);
@@ -3862,7 +3862,7 @@ var init_web_search = __esm({
3862
3862
  additionalProperties: false
3863
3863
  },
3864
3864
  needsPermission: false,
3865
- render: (args) => ({ title: `search web: ${args.query}` }),
3865
+ render: (args) => ({ title: `search web: ${args.query ?? ""}` }),
3866
3866
  async run(args) {
3867
3867
  const count = Math.min(Math.max(args.count ?? DEFAULT_RESULTS, 1), MAX_RESULTS);
3868
3868
  try {
@@ -3948,7 +3948,7 @@ var init_github = __esm({
3948
3948
  additionalProperties: false
3949
3949
  },
3950
3950
  needsPermission: false,
3951
- render: (args) => ({ title: `GitHub PR ${args.owner}/${args.repo}#${args.number}` }),
3951
+ render: (args) => ({ title: `GitHub PR ${args.owner ?? ""}/${args.repo ?? ""}#${args.number ?? ""}` }),
3952
3952
  async run(args, ctx) {
3953
3953
  const token = getToken(ctx);
3954
3954
  const pr = await githubFetch(`/repos/${args.owner}/${args.repo}/pulls/${args.number}`, token);
@@ -3990,7 +3990,7 @@ var init_github = __esm({
3990
3990
  additionalProperties: false
3991
3991
  },
3992
3992
  needsPermission: false,
3993
- render: (args) => ({ title: `GitHub issue ${args.owner}/${args.repo}#${args.number}` }),
3993
+ render: (args) => ({ title: `GitHub issue ${args.owner ?? ""}/${args.repo ?? ""}#${args.number ?? ""}` }),
3994
3994
  async run(args, ctx) {
3995
3995
  const token = getToken(ctx);
3996
3996
  const issue = await githubFetch(`/repos/${args.owner}/${args.repo}/issues/${args.number}`, token);
@@ -4037,7 +4037,7 @@ var init_github = __esm({
4037
4037
  },
4038
4038
  needsPermission: false,
4039
4039
  render: (args) => ({
4040
- title: `GitHub code ${args.owner}/${args.repo}/${args.path}${args.ref ? `@${args.ref}` : ""}`
4040
+ title: `GitHub code ${args.owner ?? ""}/${args.repo ?? ""}/${args.path ?? ""}${args.ref ? `@${args.ref}` : ""}`
4041
4041
  }),
4042
4042
  async run(args, ctx) {
4043
4043
  const token = getToken(ctx);
@@ -4115,7 +4115,7 @@ var init_browser = __esm({
4115
4115
  },
4116
4116
  needsPermission: false,
4117
4117
  render: (args) => ({
4118
- title: `browser ${args.url}${args.screenshot ? " (screenshot)" : ""}`
4118
+ title: `browser ${args.url ?? ""}${args.screenshot ? " (screenshot)" : ""}`
4119
4119
  }),
4120
4120
  async run(args, ctx) {
4121
4121
  let playwright;
@@ -4241,10 +4241,13 @@ var init_tasks = __esm({
4241
4241
  required: ["tasks"]
4242
4242
  },
4243
4243
  needsPermission: false,
4244
- render: (args) => ({
4245
- title: `tasks (${args.tasks.length} items)`,
4246
- body: args.tasks.map((t) => `${t.status === "completed" ? "\u2713" : t.status === "in_progress" ? "\u25B8" : "\xB7"} ${t.title}`).join("\n")
4247
- }),
4244
+ render: (args) => {
4245
+ const tasks = Array.isArray(args.tasks) ? args.tasks : [];
4246
+ return {
4247
+ title: `tasks (${tasks.length} items)`,
4248
+ body: tasks.map((t) => `${t.status === "completed" ? "\u2713" : t.status === "in_progress" ? "\u25B8" : "\xB7"} ${t.title}`).join("\n")
4249
+ };
4250
+ },
4248
4251
  run: async (args, ctx) => {
4249
4252
  let tasks;
4250
4253
  try {
@@ -4295,7 +4298,7 @@ var init_memory = __esm({
4295
4298
  needsPermission: false,
4296
4299
  render: (args) => ({
4297
4300
  title: "memory_remember",
4298
- body: `[${args.category}] ${args.content} (importance: ${args.importance})`
4301
+ body: `[${args.category ?? "unknown"}] ${args.content ?? ""} (importance: ${args.importance ?? 1})`
4299
4302
  }),
4300
4303
  run: async (args, ctx) => {
4301
4304
  if (!isMemoryCtx(ctx) || !ctx.memoryManager) {
@@ -4350,7 +4353,7 @@ var init_memory = __esm({
4350
4353
  needsPermission: false,
4351
4354
  render: (args) => ({
4352
4355
  title: "memory_recall",
4353
- body: `Query: "${args.query}"`
4356
+ body: `Query: "${args.query ?? ""}"`
4354
4357
  }),
4355
4358
  run: async (args, ctx) => {
4356
4359
  if (!isMemoryCtx(ctx) || !ctx.memoryManager) {
@@ -4395,7 +4398,7 @@ var init_memory = __esm({
4395
4398
  needsPermission: false,
4396
4399
  render: (args) => ({
4397
4400
  title: "memory_forget",
4398
- body: `Forgetting memory ${args.memory_id}`
4401
+ body: `Forgetting memory ${args.memory_id ?? ""}`
4399
4402
  }),
4400
4403
  run: async (args, ctx) => {
4401
4404
  if (!isMemoryCtx(ctx) || !ctx.memoryManager) {
@@ -4955,7 +4958,7 @@ function makeExpandArtifactTool(store) {
4955
4958
  additionalProperties: false
4956
4959
  },
4957
4960
  needsPermission: false,
4958
- render: (args) => ({ title: `expand ${args.artifact_id}` }),
4961
+ render: (args) => ({ title: `expand ${args.artifact_id ?? ""}` }),
4959
4962
  run: async (args) => {
4960
4963
  const raw = store.retrieve(args.artifact_id);
4961
4964
  if (!raw) {
@@ -9730,7 +9733,9 @@ import { createTwoFilesPatch } from "diff";
9730
9733
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
9731
9734
  function DiffView({ path, before, after, maxLines = 40 }) {
9732
9735
  const theme = useTheme();
9733
- const patch = createTwoFilesPatch(path, path, before, after, "", "", { context: 2 });
9736
+ const safeBefore = before ?? "";
9737
+ const safeAfter = after ?? "";
9738
+ const patch = createTwoFilesPatch(path, path, safeBefore, safeAfter, "", "", { context: 2 });
9734
9739
  const raw = patch.split("\n").slice(4);
9735
9740
  const lines = raw.filter((l) => {
9736
9741
  if (l.startsWith("--- ") || l.startsWith("+++ ")) return false;
@@ -10745,7 +10750,11 @@ import SelectInput from "ink-select-input";
10745
10750
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
10746
10751
  function PermissionModal({ tool, args, onDecide }) {
10747
10752
  const theme = useTheme();
10748
- const render2 = tool.render?.(args);
10753
+ let render2;
10754
+ try {
10755
+ render2 = tool.render?.(args);
10756
+ } catch {
10757
+ }
10749
10758
  const items = [
10750
10759
  { label: "Allow once", value: "allow" },
10751
10760
  { label: "Allow for this session", value: "allow_session" },