@sourcegraph/amp 0.0.1749547696-g09fbd0 → 0.0.1749571294-gef5aa3

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/amp.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./console-Cx8l59nN.js";
3
- import "./main-DXoQkxrD.js";
2
+ import "./console-DK0gDzNQ.js";
3
+ import "./main-BVP_XL7v.js";
4
4
  import "node:crypto";
5
5
  import "node:fs/promises";
6
6
  import "node:path";
7
7
  import "node:process";
8
- import "./client-BuGLbCu1.js";
8
+ import "./client-C1WG2nEf.js";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { f as n, E as i, aV as c, s as p, p as w } from "./console-Cx8l59nN.js";
2
+ import { f as n, E as i, aV as c, s as p, p as w } from "./console-DK0gDzNQ.js";
3
3
  const m = !0;
4
4
  function f() {
5
5
  return new Proxy(
@@ -6648,7 +6648,7 @@ Prefer this tool over \`edit_file\` when you want to ovewrite the entire content
6648
6648
  content: n.content + `
6649
6649
  `
6650
6650
  },
6651
- fn: import("./create_file.node-DlHzZW4R.js").then(
6651
+ fn: import("./create_file.node-DtVTaHj5.js").then(
6652
6652
  ({ nodeCreateFileTool: n }) => n
6653
6653
  )
6654
6654
  }, Rn = "Grep", Wk = 15, Kk = 250, Qk = `Search for exact text patterns in files using ripgrep, a fast keyword search tool.
@@ -6790,7 +6790,7 @@ COMPLEMENTARY USE WITH CODEBASE_SEARCH:
6790
6790
  },
6791
6791
  source: "builtin"
6792
6792
  },
6793
- fn: import("./node-BvoaWaZo.js").then(({ nodeGrepTool: n }) => n)
6793
+ fn: import("./node-CiFAW-F3.js").then(({ nodeGrepTool: n }) => n)
6794
6794
  }, tr = "read_file", Zk = 1e3, Ya = {
6795
6795
  spec: {
6796
6796
  name: tr,
@@ -6822,7 +6822,7 @@ Returns the contents of the file with each line prefixed by its line number. For
6822
6822
  switch ("node") {
6823
6823
  case "node":
6824
6824
  case "vscode":
6825
- return import("./read_file.node-CmzlH3Dv.js").then(({ nodeReadFileTool: n }) => n);
6825
+ return import("./read_file.node-CIdAFiJ6.js").then(({ nodeReadFileTool: n }) => n);
6826
6826
  }
6827
6827
  })()
6828
6828
  }, Xk = bk({
@@ -6851,7 +6851,7 @@ If you need to replace the entire contents of a file, use \`${Uo}\` instead, sin
6851
6851
  inputSchema: Bw(Xk),
6852
6852
  source: "builtin"
6853
6853
  },
6854
- fn: import("./edit_file.node-P5pJKnHg.js").then(({ nodeEditFileTool: n }) => n)
6854
+ fn: import("./edit_file.node-BH524GkF.js").then(({ nodeEditFileTool: n }) => n)
6855
6855
  };
6856
6856
  function Og(n) {
6857
6857
  return n.replace(/\\\\n/g, "\\n").replace(/\\\\t/g, "\\t").replace(/\\\\/g, "\\").replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\n/g, `
@@ -11112,7 +11112,7 @@ Note: Results are sorted by modification time with the most recently modified fi
11112
11112
  },
11113
11113
  source: "builtin"
11114
11114
  },
11115
- fn: import("./glob.node-BSoohY0b.js").then(({ nodeGlobTool: n }) => n)
11115
+ fn: import("./glob.node-C6HbLuPt.js").then(({ nodeGlobTool: n }) => n)
11116
11116
  }, Vo = "list_directory", sm = {
11117
11117
  spec: {
11118
11118
  name: Vo,
@@ -11133,7 +11133,7 @@ Note: Results are sorted by modification time with the most recently modified fi
11133
11133
  switch ("node") {
11134
11134
  case "node":
11135
11135
  case "vscode":
11136
- return import("./list_directory.node-B5epLeSX.js").then(
11136
+ return import("./list_directory.node-ZQscizpi.js").then(
11137
11137
  ({ nodeListDirectoryTool: n }) => n
11138
11138
  );
11139
11139
  }
@@ -12055,7 +12055,7 @@ It's VERY IMPORTANT to use specific tools when searching for files, instead of i
12055
12055
  },
12056
12056
  source: "builtin"
12057
12057
  },
12058
- fn: import("./node-ChO0NLsP.js").then(({ nodeBashTool: n }) => n),
12058
+ fn: import("./node-Cpbjmhrj.js").then(({ nodeBashTool: n }) => n),
12059
12059
  preprocessArgs: (n) => {
12060
12060
  if (!n.cwd)
12061
12061
  try {
@@ -12148,7 +12148,7 @@ This tool converts web content to markdown format for better readability.`,
12148
12148
  requiresNetwork: !0
12149
12149
  }
12150
12150
  },
12151
- fn: import("./node--f-b5mrX.js").then(({ nodeReadWebPageTool: n }) => n)
12151
+ fn: import("./node-CgVq0JJ9.js").then(({ nodeReadWebPageTool: n }) => n)
12152
12152
  }, eM = "web_search", tM = `Search the web for information.
12153
12153
 
12154
12154
  Returns search result titles, associated URLs, and a small summary of the
@@ -12196,7 +12196,7 @@ the \`${hf}\` with the url.
12196
12196
  requiresNetwork: !0
12197
12197
  }
12198
12198
  },
12199
- fn: import("./node-C1lMLG-T.js").then(({ nodeWebSearchTool: n }) => n)
12199
+ fn: import("./node-DvmQAW7h.js").then(({ nodeWebSearchTool: n }) => n)
12200
12200
  };
12201
12201
  function rM(n) {
12202
12202
  if (n === 59999) return "59.99s";
@@ -25951,7 +25951,7 @@ async function P8(n, e) {
25951
25951
  }
25952
25952
  }
25953
25953
  async function F8(n, e) {
25954
- return (await import("./list_directory.node-B5epLeSX.js")).resolveArgumentDirectoryNode(n, e);
25954
+ return (await import("./list_directory.node-ZQscizpi.js")).resolveArgumentDirectoryNode(n, e);
25955
25955
  }
25956
25956
  function B8(n) {
25957
25957
  if (!n._regex)
@@ -27163,7 +27163,7 @@ async function V8({
27163
27163
  fileMentions: void 0,
27164
27164
  userState: void 0
27165
27165
  };
27166
- const i = (await import("./files-CsZ0HVHo.js").then(
27166
+ const i = (await import("./files-CybxYgbE.js").then(
27167
27167
  ({ getFileMentions: o }) => o(
27168
27168
  tm(t.content),
27169
27169
  a,
@@ -27609,10 +27609,8 @@ class Zi {
27609
27609
  break;
27610
27610
  }
27611
27611
  case "user:tool-input": {
27612
- if (e.value.accepted) {
27613
- const t = Pa(this.thread, e.toolUse);
27614
- t && this.invokeTool(t, e.value);
27615
- }
27612
+ const t = Pa(this.thread, e.toolUse);
27613
+ t && this.invokeTool(t, e.value);
27616
27614
  break;
27617
27615
  }
27618
27616
  case "tool:data": {
@@ -28503,7 +28501,7 @@ Here is an example URL for linking to a file, specifically at line 32:
28503
28501
  Here is an example URL for linking to a file, specifically between lines 32 and 42:
28504
28502
  <example-file-url>file:///home/chandler/script.shy#L32-L42</example-file-url>
28505
28503
 
28506
- Prefer "fluent" linking style. That is, don't show the user the actual URL, but instead use it to add links to relevant pieces of your response. When referring to a file name that exists. Whenever you mention a file by name, you MUST link to it in this way.
28504
+ Prefer "fluent" linking style. That is, don't show the user the actual URL, but instead use it to add links to relevant pieces of your response. Whenever you mention a file by name, you MUST link to it in this way.
28507
28505
 
28508
28506
  <example>
28509
28507
  <response>
@@ -28883,7 +28881,7 @@ Returns a git-style diff showing the changes that were undone as formatted markd
28883
28881
  switch ("node") {
28884
28882
  case "node":
28885
28883
  case "vscode":
28886
- return import("./undo_edit.node-7LgjTILd.js").then(({ nodeUndoEditTool: n }) => n);
28884
+ return import("./undo_edit.node-VYuTxRwd.js").then(({ nodeUndoEditTool: n }) => n);
28887
28885
  }
28888
28886
  })()
28889
28887
  }, Rm = globalThis.window?.document !== void 0;
@@ -72714,96 +72712,105 @@ class age {
72714
72712
  }
72715
72713
  const ghe = new rge(), hhe = new age();
72716
72714
  function Ehe(n, e, t, r) {
72717
- const a = [], i = [];
72718
- for (const [s, o] of n.messages.entries())
72719
- switch (o.role) {
72715
+ const a = [];
72716
+ for (const [i, s] of n.messages.entries())
72717
+ switch (s.role) {
72720
72718
  case "assistant":
72721
72719
  case "info":
72722
- if (e?.has(s) || o.role === "assistant" && o.state.type === "streaming")
72720
+ if (e?.has(i) || s.role === "assistant" && s.state.type === "streaming")
72723
72721
  continue;
72724
- e?.add(s), a.push([s, o]);
72722
+ e?.add(i), a.push({ type: "message", data: [i, s] });
72725
72723
  break;
72726
72724
  case "user":
72727
- r && !e?.has(s) && (e?.add(s), a.push([s, o]));
72728
- for (const l of o.content)
72729
- if (l.type === "tool_result") {
72730
- if (t?.has(l.toolUseID) || !ps(l.run))
72725
+ r && !e?.has(i) && (e?.add(i), a.push({ type: "message", data: [i, s] }));
72726
+ for (const o of s.content)
72727
+ if (o.type === "tool_result") {
72728
+ if (t?.has(o.toolUseID) || !ps(o.run))
72731
72729
  continue;
72732
- t?.add(l.toolUseID);
72733
- const c = Pa(n, l.toolUseID);
72734
- if (!c)
72735
- throw new Error(`(bug) tool use ${l.toolUseID} not found`);
72736
- c.name !== Nn && i.push([c, l]);
72730
+ t?.add(o.toolUseID);
72731
+ const l = Pa(n, o.toolUseID);
72732
+ if (!l)
72733
+ throw new Error(`(bug) tool use ${o.toolUseID} not found`);
72734
+ l.name !== Nn && a.push({ type: "toolResult", data: [l, o] });
72737
72735
  }
72738
72736
  break;
72739
72737
  }
72740
- return { messages: a, toolResults: i };
72741
- }
72742
- function yhe({ messages: n, toolResults: e }, t = (c) => VA.write(c + `
72743
- `), r, a, i, s, o, l) {
72744
- for (const [, c] of n)
72745
- if (c.role === "user") {
72746
- if (s !== void 0) {
72747
- for (const u of c.content)
72748
- if (u.type === "text") {
72749
- const m = u.text.split(`
72738
+ return { blocks: a };
72739
+ }
72740
+ function yhe({ blocks: n }, e = (l) => VA.write(l + `
72741
+ `), t, r, a, i, s, o) {
72742
+ for (const l of n)
72743
+ if (l.type === "message") {
72744
+ const [, c] = l.data;
72745
+ if (c.role === "user") {
72746
+ if (i !== void 0) {
72747
+ for (const u of c.content)
72748
+ if (u.type === "text") {
72749
+ const m = u.text.split(`
72750
72750
  `);
72751
- for (const p of m)
72752
- t(
72753
- a.print(`${s}${p}`, {
72754
- foreground: "green",
72755
- style: "italic"
72751
+ for (const p of m)
72752
+ e(
72753
+ r.print(`${i}${p}`, {
72754
+ foreground: "green",
72755
+ style: "italic"
72756
+ })
72757
+ );
72758
+ e("");
72759
+ }
72760
+ }
72761
+ } else if (c.role === "assistant") {
72762
+ if (c.state.type === "error") {
72763
+ e(r.print(`Error: ${c.state.error.message}`, { foreground: "red" }));
72764
+ continue;
72765
+ }
72766
+ for (const u of c.content)
72767
+ switch (u.type) {
72768
+ case "text":
72769
+ e(
72770
+ `${s ? r.print("Subagent " + s.slice(0, 8) + `:
72771
+ `, { foreground: o }) : ""}` + r.printMarkdown(u.text.trim(), {
72772
+ width: t
72756
72773
  })
72757
- );
72758
- t("");
72774
+ ), e("");
72775
+ break;
72759
72776
  }
72760
- }
72761
- } else if (c.role === "assistant") {
72762
- if (c.state.type === "error") {
72763
- t(a.print(`Error: ${c.state.error.message}`, { foreground: "red" }));
72764
- continue;
72765
- }
72766
- for (const u of c.content)
72767
- switch (u.type) {
72768
- case "text":
72769
- t(
72770
- `${o ? a.print("Subagent " + o.slice(0, 8) + `:
72771
- `, { foreground: l }) : ""}` + a.printMarkdown(u.text.trim(), {
72772
- width: r
72773
- })
72774
- ), t("");
72775
- break;
72776
- }
72777
- } else if (c.role === "info")
72778
- for (const u of c.content)
72779
- u.type === "summary" && (u.summary.type === "message" ? (t(
72780
- qa(
72781
- a,
72782
- "default",
72783
- r,
72784
- "Compaction Summary",
72785
- u.summary.summary,
72786
- void 0,
72787
- void 0
72788
- )
72789
- ), t("")) : u.summary.type === "thread" && (t(
72790
- qa(
72791
- a,
72792
- "default",
72793
- r,
72794
- "Compaction Summary",
72795
- `Based on thread: ${u.summary.thread}`,
72796
- void 0,
72797
- void 0
72798
- )
72799
- ), t("")));
72800
- for (const [c, u] of e) {
72801
- const m = ige(c, u, r, a, i, l);
72802
- m && (t(
72803
- `${o ? a.print("Subagent " + o.slice(0, 8) + `:
72804
- `, { foreground: l }) : ""}` + m
72805
- ), t(""));
72806
- }
72777
+ } else if (c.role === "info")
72778
+ for (const u of c.content)
72779
+ u.type === "summary" && (u.summary.type === "message" ? (e(
72780
+ qa(
72781
+ r,
72782
+ "default",
72783
+ t,
72784
+ "Compaction Summary",
72785
+ u.summary.summary,
72786
+ void 0,
72787
+ void 0
72788
+ )
72789
+ ), e("")) : u.summary.type === "thread" && (e(
72790
+ qa(
72791
+ r,
72792
+ "default",
72793
+ t,
72794
+ "Compaction Summary",
72795
+ `Based on thread: ${u.summary.thread}`,
72796
+ void 0,
72797
+ void 0
72798
+ )
72799
+ ), e("")));
72800
+ } else if (l.type === "toolResult") {
72801
+ const [c, u] = l.data, m = ige(
72802
+ c,
72803
+ u,
72804
+ t,
72805
+ r,
72806
+ a,
72807
+ o
72808
+ );
72809
+ m && (e(
72810
+ `${s ? r.print("Subagent " + s.slice(0, 8) + `:
72811
+ `, { foreground: o }) : ""}` + m
72812
+ ), e(""));
72813
+ }
72807
72814
  }
72808
72815
  function ige(n, e, t, r, a, i = "blue") {
72809
72816
  const s = n.name === "edit_file" ? void 0 : a;
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import u from "node:path";
3
- import { p as d, aF as f, aG as l } from "./console-Cx8l59nN.js";
3
+ import { p as d, aF as f, aG as l } from "./console-DK0gDzNQ.js";
4
4
  const w = ({ args: t }, { dir: a, dirs: n, trackFileChange: c, filesystem: o }) => d(async (e) => {
5
5
  if (f(a), typeof t.content != "string")
6
6
  throw new Error("create_file: content must be specified");
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { p, aF as m, aG as F, aH as v, aI as _, aJ as b } from "./console-Cx8l59nN.js";
3
- import { recordEdit as x } from "./undo_edit.node-7LgjTILd.js";
2
+ import { p, aF as m, aG as F, aH as v, aI as _, aJ as b } from "./console-DK0gDzNQ.js";
3
+ import { recordEdit as x } from "./undo_edit.node-VYuTxRwd.js";
4
4
  class y {
5
5
  #e = !1;
6
6
  #t = [];
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync as o } from "node:fs";
3
3
  import { createRequire as t } from "node:module";
4
- import { C as i } from "./console-Cx8l59nN.js";
4
+ import { C as i } from "./console-DK0gDzNQ.js";
5
5
  function u() {
6
6
  {
7
7
  if (process.env.AMP_RIPGREP_PATH)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import T from "node:path";
3
- import { b9 as B, ba as I, C as v, bb as z, bc as C } from "./console-Cx8l59nN.js";
3
+ import { b9 as B, ba as I, C as v, bb as z, bc as C } from "./console-DK0gDzNQ.js";
4
4
  async function A(r, h, a) {
5
5
  const x = await a.listFiles(h), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = [], M = /\b([\w/_-]+(?:\\.|[\w/_-])*(?:\.[\w-]+)+)\b/g, F = /(\/(?:[\w-]+\/|[\w-]+\\[.\s\S])+[\w.-]+(?:\\.|[\w.-])*(?:\.[\w-]+)+)\b/g, y = /\b([A-Za-z]:[\\\\][^\s"'<>|]*(?:\.[\w-]+)+)\b/g;
6
6
  await l(M, !1), await l(F, !0), await l(y, !0);
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn as w } from "node:child_process";
3
- import { p as I } from "./index-BlPqgTTf.js";
4
- import { O as v, g as N, m as E, C as P, aF as R } from "./console-Cx8l59nN.js";
5
- import { r as D } from "./executable-om4Ksp8H.js";
3
+ import { p as I } from "./index-C2wo7rRZ.js";
4
+ import { O as v, g as N, m as E, C as P, aF as R } from "./console-DK0gDzNQ.js";
5
+ import { r as D } from "./executable-5cBRGrsC.js";
6
6
  const y = ({ args: i }, { dirs: r }) => {
7
7
  if (r.length === 0)
8
8
  return new v((s) => {
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { z as xt } from "./console-Cx8l59nN.js";
2
+ import { z as xt } from "./console-DK0gDzNQ.js";
3
3
  var pt = {}, ft, Et;
4
4
  function ct() {
5
5
  if (Et) return ft;
@@ -2,7 +2,7 @@
2
2
  import c from "node:fs/promises";
3
3
  import u from "node:os";
4
4
  import s from "node:path";
5
- import { O as f, aK as i, aL as l, m, aM as p } from "./console-Cx8l59nN.js";
5
+ import { O as f, aK as i, aL as l, m, aM as p } from "./console-DK0gDzNQ.js";
6
6
  const D = ({ args: r }, { dirs: t }) => {
7
7
  if (t.length === 0)
8
8
  return new f((e) => {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import n from "node:os";
3
- import { O as r } from "./console-Cx8l59nN.js";
3
+ import { O as r } from "./console-DK0gDzNQ.js";
4
4
  const e = process.env;
5
5
  function i(t, o = "always") {
6
6
  return o === "never" ? r.of(e) : r.of(e);