orion-super-agent-dev 0.1.13 → 0.1.14

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/out/worker.js CHANGED
@@ -1581,6 +1581,164 @@ var JAVA_QUERY = `
1581
1581
 
1582
1582
  (method_invocation name: (identifier) @edge.call.target)
1583
1583
  `;
1584
+ var C_QUERY = `
1585
+ (function_definition
1586
+ declarator: (function_declarator
1587
+ declarator: (identifier) @symbol.function.name)) @symbol.function.def
1588
+
1589
+ (struct_specifier
1590
+ name: (type_identifier) @symbol.class.name
1591
+ body: (field_declaration_list)) @symbol.class.def
1592
+
1593
+ (enum_specifier
1594
+ name: (type_identifier) @symbol.enum.name
1595
+ body: (enumerator_list)) @symbol.enum.def
1596
+
1597
+ (type_definition
1598
+ declarator: (type_identifier) @symbol.type.name) @symbol.type.def
1599
+
1600
+ (preproc_include path: (string_literal) @edge.import.source)
1601
+
1602
+ (call_expression
1603
+ function: (identifier) @edge.call.target)
1604
+ `;
1605
+ var CPP_QUERY = `
1606
+ (function_definition
1607
+ declarator: (function_declarator
1608
+ declarator: (identifier) @symbol.function.name)) @symbol.function.def
1609
+
1610
+ (function_definition
1611
+ declarator: (function_declarator
1612
+ declarator: (field_identifier) @symbol.method.name)) @symbol.method.def
1613
+
1614
+ (class_specifier
1615
+ name: (type_identifier) @symbol.class.name
1616
+ body: (field_declaration_list)) @symbol.class.def
1617
+
1618
+ (struct_specifier
1619
+ name: (type_identifier) @symbol.class.name
1620
+ body: (field_declaration_list)) @symbol.class.def
1621
+
1622
+ (enum_specifier
1623
+ name: (type_identifier) @symbol.enum.name
1624
+ body: (enumerator_list)) @symbol.enum.def
1625
+
1626
+ (type_definition
1627
+ declarator: (type_identifier) @symbol.type.name) @symbol.type.def
1628
+
1629
+ (preproc_include path: (string_literal) @edge.import.source)
1630
+
1631
+ (base_class_clause (type_identifier) @edge.extends.parent)
1632
+
1633
+ (call_expression
1634
+ function: (identifier) @edge.call.target)
1635
+
1636
+ (call_expression
1637
+ function: (field_expression field: (field_identifier) @edge.call.target))
1638
+ `;
1639
+ var CSHARP_QUERY = `
1640
+ (class_declaration
1641
+ name: (identifier) @symbol.class.name) @symbol.class.def
1642
+
1643
+ (struct_declaration
1644
+ name: (identifier) @symbol.class.name) @symbol.class.def
1645
+
1646
+ (interface_declaration
1647
+ name: (identifier) @symbol.interface.name) @symbol.interface.def
1648
+
1649
+ (enum_declaration
1650
+ name: (identifier) @symbol.enum.name) @symbol.enum.def
1651
+
1652
+ (method_declaration
1653
+ name: (identifier) @symbol.method.name) @symbol.method.def
1654
+
1655
+ (base_list (identifier) @edge.extends.parent)
1656
+
1657
+ (using_directive (identifier) @edge.import.target)
1658
+
1659
+ (using_directive (qualified_name) @edge.import.target)
1660
+
1661
+ (invocation_expression
1662
+ function: (identifier) @edge.call.target)
1663
+
1664
+ (invocation_expression
1665
+ function: (member_access_expression name: (identifier) @edge.call.target))
1666
+ `;
1667
+ var PHP_QUERY = `
1668
+ (function_definition
1669
+ name: (name) @symbol.function.name) @symbol.function.def
1670
+
1671
+ (method_declaration
1672
+ name: (name) @symbol.method.name) @symbol.method.def
1673
+
1674
+ (class_declaration
1675
+ name: (name) @symbol.class.name) @symbol.class.def
1676
+
1677
+ (trait_declaration
1678
+ name: (name) @symbol.class.name) @symbol.class.def
1679
+
1680
+ (interface_declaration
1681
+ name: (name) @symbol.interface.name) @symbol.interface.def
1682
+
1683
+ (base_clause (name) @edge.extends.parent)
1684
+
1685
+ (class_interface_clause (name) @edge.implements.parent)
1686
+
1687
+ (namespace_use_clause (qualified_name (name) @edge.import.target))
1688
+
1689
+ (function_call_expression
1690
+ function: (name) @edge.call.target)
1691
+
1692
+ (member_call_expression
1693
+ name: (name) @edge.call.target)
1694
+ `;
1695
+ var KOTLIN_QUERY = `
1696
+ (function_declaration
1697
+ (simple_identifier) @symbol.function.name) @symbol.function.def
1698
+
1699
+ (class_declaration
1700
+ (type_identifier) @symbol.class.name) @symbol.class.def
1701
+
1702
+ (object_declaration
1703
+ (type_identifier) @symbol.class.name) @symbol.class.def
1704
+
1705
+ (delegation_specifier
1706
+ (constructor_invocation (user_type (type_identifier) @edge.extends.parent)))
1707
+
1708
+ (delegation_specifier
1709
+ (user_type (type_identifier) @edge.implements.parent))
1710
+
1711
+ (import_header (identifier) @edge.import.target)
1712
+
1713
+ (call_expression (simple_identifier) @edge.call.target)
1714
+ `;
1715
+ var SCALA_QUERY = `
1716
+ (function_definition
1717
+ name: (identifier) @symbol.function.name) @symbol.function.def
1718
+
1719
+ (function_declaration
1720
+ name: (identifier) @symbol.function.name) @symbol.function.def
1721
+
1722
+ (class_definition
1723
+ name: (identifier) @symbol.class.name) @symbol.class.def
1724
+
1725
+ (object_definition
1726
+ name: (identifier) @symbol.class.name) @symbol.class.def
1727
+
1728
+ (trait_definition
1729
+ name: (identifier) @symbol.interface.name) @symbol.interface.def
1730
+
1731
+ (extends_clause type: (type_identifier) @edge.extends.parent)
1732
+
1733
+ (extends_clause type: (compound_type base: (type_identifier) @edge.extends.parent))
1734
+
1735
+ (extends_clause type: (compound_type extra: (type_identifier) @edge.implements.parent))
1736
+
1737
+ (import_declaration path: (stable_identifier) @edge.import.target)
1738
+
1739
+ (call_expression
1740
+ function: (identifier) @edge.call.target)
1741
+ `;
1584
1742
 
1585
1743
  // ../packages/orion-client-core/src/treesitter/extractor.ts
1586
1744
  function queryFor(lang) {
@@ -1598,6 +1756,18 @@ function queryFor(lang) {
1598
1756
  return RUST_QUERY;
1599
1757
  case "java":
1600
1758
  return JAVA_QUERY;
1759
+ case "c":
1760
+ return C_QUERY;
1761
+ case "cpp":
1762
+ return CPP_QUERY;
1763
+ case "csharp":
1764
+ return CSHARP_QUERY;
1765
+ case "php":
1766
+ return PHP_QUERY;
1767
+ case "kotlin":
1768
+ return KOTLIN_QUERY;
1769
+ case "scala":
1770
+ return SCALA_QUERY;
1601
1771
  // Ruby intentionally falls back to regex: tree-sitter `(call method: …)`
1602
1772
  // can't distinguish `require "x"` (an import) from any other method
1603
1773
  // call without a `#match?` predicate, and a tree-sitter pass that
@@ -1616,21 +1786,64 @@ function signatureOf(node, allLines) {
1616
1786
  const line = (allLines[row] ?? "").trim();
1617
1787
  return line.length > 160 ? line.slice(0, 160) + "\u2026" : line;
1618
1788
  }
1789
+ var DEFINITION_NODE_TYPES = /* @__PURE__ */ new Set([
1790
+ // Python
1791
+ "function_definition",
1792
+ "class_definition",
1793
+ // JS/TS
1794
+ "method_definition",
1795
+ "function_declaration",
1796
+ "class_declaration",
1797
+ // Go / Java / C#
1798
+ "method_declaration",
1799
+ "interface_declaration",
1800
+ "enum_declaration",
1801
+ "struct_declaration",
1802
+ // Rust
1803
+ "function_item",
1804
+ // C / C++
1805
+ "class_specifier",
1806
+ "struct_specifier",
1807
+ "enum_specifier",
1808
+ "type_definition",
1809
+ // PHP
1810
+ "trait_declaration",
1811
+ // Kotlin
1812
+ "object_declaration",
1813
+ // Scala
1814
+ "class_definition",
1815
+ "object_definition",
1816
+ "trait_definition"
1817
+ ]);
1818
+ var NAME_NODE_TYPES = /* @__PURE__ */ new Set([
1819
+ "identifier",
1820
+ "type_identifier",
1821
+ "simple_identifier",
1822
+ "field_identifier",
1823
+ "name"
1824
+ ]);
1825
+ function definitionName(node) {
1826
+ const named = node.childForFieldName("name");
1827
+ if (named) return named.text;
1828
+ let decl = node.childForFieldName("declarator");
1829
+ for (let depth = 0; decl && depth < 8; depth += 1) {
1830
+ if (NAME_NODE_TYPES.has(decl.type)) return decl.text;
1831
+ decl = decl.childForFieldName("declarator");
1832
+ }
1833
+ for (const child of node.namedChildren) {
1834
+ if (NAME_NODE_TYPES.has(child.type)) return child.text;
1835
+ }
1836
+ return "";
1837
+ }
1619
1838
  function enclosingSymbolName(node) {
1620
1839
  let cur = node.parent;
1621
1840
  while (cur) {
1622
1841
  if (cur.type === "impl_item") {
1623
1842
  const t = cur.childForFieldName("type");
1624
1843
  if (t) return t.text;
1625
- } else if (
1626
- // Python
1627
- cur.type === "function_definition" || cur.type === "class_definition" || // JS/TS
1628
- cur.type === "method_definition" || cur.type === "function_declaration" || cur.type === "class_declaration" || // Go / Java
1629
- cur.type === "method_declaration" || cur.type === "interface_declaration" || cur.type === "enum_declaration" || // Rust
1630
- cur.type === "function_item"
1631
- ) {
1632
- const nameNode = cur.childForFieldName("name");
1633
- if (nameNode) return nameNode.text;
1844
+ } else if (DEFINITION_NODE_TYPES.has(cur.type)) {
1845
+ const name2 = definitionName(cur);
1846
+ if (name2) return name2;
1634
1847
  }
1635
1848
  cur = cur.parent;
1636
1849
  }
@@ -1823,6 +2036,7 @@ function extractWithTreeSitter(handle4, lang, path, content) {
1823
2036
 
1824
2037
  // ../packages/orion-client-core/src/treesitter/loader.ts
1825
2038
  import * as fs2 from "fs";
2039
+ import * as zlib from "zlib";
1826
2040
  var GRAMMAR_FILE = {
1827
2041
  python: "tree-sitter-python.wasm",
1828
2042
  typescript: "tree-sitter-typescript.wasm",
@@ -1831,7 +2045,13 @@ var GRAMMAR_FILE = {
1831
2045
  go: "tree-sitter-go.wasm",
1832
2046
  rust: "tree-sitter-rust.wasm",
1833
2047
  java: "tree-sitter-java.wasm",
1834
- ruby: "tree-sitter-ruby.wasm"
2048
+ ruby: "tree-sitter-ruby.wasm",
2049
+ c: "tree-sitter-c.wasm",
2050
+ cpp: "tree-sitter-cpp.wasm",
2051
+ csharp: "tree-sitter-csharp.wasm",
2052
+ php: "tree-sitter-php.wasm",
2053
+ kotlin: "tree-sitter-kotlin.wasm",
2054
+ scala: "tree-sitter-scala.wasm"
1835
2055
  };
1836
2056
  var handle2 = null;
1837
2057
  var initAttempted = false;
@@ -1866,12 +2086,16 @@ async function tryLoad(grammarDir) {
1866
2086
  const next = grammarQueue.then(async () => {
1867
2087
  if (grammarCache.has(lang)) return grammarCache.get(lang) ?? null;
1868
2088
  const wasmPath = `${grammarDir}/${GRAMMAR_FILE[lang]}`;
1869
- if (!fs2.existsSync(wasmPath)) {
2089
+ const gzPath = `${wasmPath}.gz`;
2090
+ const plainExists = fs2.existsSync(wasmPath);
2091
+ if (!plainExists && !fs2.existsSync(gzPath)) {
1870
2092
  grammarCache.set(lang, null);
1871
2093
  return null;
1872
2094
  }
1873
2095
  try {
1874
- const langObj = await Parser2.Language.load(wasmPath);
2096
+ const langObj = plainExists ? await Parser2.Language.load(wasmPath) : await Parser2.Language.load(
2097
+ new Uint8Array(zlib.gunzipSync(fs2.readFileSync(gzPath)))
2098
+ );
1875
2099
  grammarCache.set(lang, langObj);
1876
2100
  return langObj;
1877
2101
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orion-super-agent-dev",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "[dev] Orion \u2014 a terminal AI super-agent, strongest at coding. Local brain, local disk: the agent loop runs on your machine; only the metered model call leaves it.",
5
5
  "license": "MIT",
6
6
  "type": "module",