pi-neutrasearch 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/index.js +18 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -50,11 +50,27 @@ async function search(pi, params, signal, ctx) {
50
50
  const { scope } = resolveScope(params.scope, ctx.cwd);
51
51
  const { args, limit } = queryArguments(params, scope);
52
52
  const timeout = Math.max(1000, Math.min(30000, Math.trunc(Number(params.timeout_ms) || 10000)));
53
- const execution = await pi.exec(binary.command, [...binary.prefix, ...args], {
53
+ let transport = params.metadata ? "metadata-json" : "paths-only-json";
54
+ let execution = await pi.exec(binary.command, [...binary.prefix, ...args], {
54
55
  cwd: ctx.cwd,
55
56
  signal,
56
57
  timeout,
57
58
  });
59
+ if (
60
+ execution.code !== 0
61
+ && !params.metadata
62
+ && args.includes("--json-paths")
63
+ && /(?:unknown|unrecognized|unexpected).*(?:--json-paths)|--json-paths.*(?:unknown|unrecognized|unexpected)/i
64
+ .test(`${execution.stderr}\n${execution.stdout}`)
65
+ ) {
66
+ const compatibleArgs = args.map((argument) => argument === "--json-paths" ? "--json" : argument);
67
+ execution = await pi.exec(binary.command, [...binary.prefix, ...compatibleArgs], {
68
+ cwd: ctx.cwd,
69
+ signal,
70
+ timeout,
71
+ });
72
+ transport = "metadata-json-compat";
73
+ }
58
74
  if (execution.code !== 0) {
59
75
  throw new Error(`Neutrasearch exited ${execution.code}: ${shortError(execution.stderr || execution.stdout)}`);
60
76
  }
@@ -75,6 +91,7 @@ async function search(pi, params, signal, ctx) {
75
91
  query: params.query,
76
92
  limit,
77
93
  executable_kind: binary.kind,
94
+ transport,
78
95
  token_efficient: true,
79
96
  });
80
97
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-neutrasearch",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Token-efficient native indexed filename and path search for Pi agents",
5
5
  "type": "module",
6
6
  "license": "MIT",