@isaacthoman/pulpo 0.44.0 → 0.46.0

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/index.js +78 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14853,14 +14853,50 @@ var agentSettingsSchema = external_exports.object({
14853
14853
  commandTimeoutSeconds: external_exports.number().int().min(1).max(3600).default(600),
14854
14854
  maxToolOutputBytes: external_exports.number().int().min(1024).max(1e7).default(1e5)
14855
14855
  });
14856
- var webToolsSettingsSchema = external_exports.object({
14857
- searchEnabled: external_exports.boolean().default(false),
14858
- extractEnabled: external_exports.boolean().default(false),
14856
+ var webToolProviderSchema = external_exports.enum(["kagi", "firecrawl"]);
14857
+ var webToolProviderOrderSchema = external_exports.array(webToolProviderSchema).length(2).refine((value) => new Set(value).size === 2, "Provider order must contain Kagi and Firecrawl exactly once");
14858
+ var kagiWebProviderSettingsSchema = external_exports.object({
14859
+ searchEnabled: external_exports.boolean().default(true),
14859
14860
  billSearches: external_exports.boolean().default(false),
14860
- billExtracts: external_exports.boolean().default(false),
14861
14861
  searchPriceMicros: external_exports.number().int().min(0).max(1e9).default(12e3),
14862
+ extractEnabled: external_exports.boolean().default(true),
14863
+ billExtracts: external_exports.boolean().default(false),
14862
14864
  extractPriceMicros: external_exports.number().int().min(0).max(1e9).default(4e3)
14863
14865
  });
14866
+ var firecrawlWebProviderSettingsSchema = external_exports.object({
14867
+ searchEnabled: external_exports.boolean().default(false),
14868
+ billSearches: external_exports.boolean().default(false),
14869
+ searchPriceMicros: external_exports.number().int().min(0).max(1e9).default(12e3),
14870
+ extractEnabled: external_exports.boolean().default(false),
14871
+ billExtracts: external_exports.boolean().default(false),
14872
+ extractPriceMicros: external_exports.number().int().min(0).max(1e9).default(4e3),
14873
+ baseUrl: external_exports.url().default("https://api.firecrawl.dev/v2"),
14874
+ maxAgeSeconds: external_exports.number().int().min(0).max(31536e3).default(0)
14875
+ });
14876
+ var webToolsSettingsSchema = external_exports.object({
14877
+ searchEnabled: external_exports.boolean().default(false),
14878
+ extractEnabled: external_exports.boolean().default(false),
14879
+ searchProviderOrder: webToolProviderOrderSchema.default(["kagi", "firecrawl"]),
14880
+ extractProviderOrder: webToolProviderOrderSchema.default(["kagi", "firecrawl"]),
14881
+ kagi: kagiWebProviderSettingsSchema.default({
14882
+ searchEnabled: true,
14883
+ billSearches: false,
14884
+ searchPriceMicros: 12e3,
14885
+ extractEnabled: true,
14886
+ billExtracts: false,
14887
+ extractPriceMicros: 4e3
14888
+ }),
14889
+ firecrawl: firecrawlWebProviderSettingsSchema.default({
14890
+ searchEnabled: false,
14891
+ billSearches: false,
14892
+ searchPriceMicros: 12e3,
14893
+ extractEnabled: false,
14894
+ billExtracts: false,
14895
+ extractPriceMicros: 4e3,
14896
+ baseUrl: "https://api.firecrawl.dev/v2",
14897
+ maxAgeSeconds: 0
14898
+ })
14899
+ });
14864
14900
  var managementScopeSchema = external_exports.enum([
14865
14901
  "account:read",
14866
14902
  "account:write",
@@ -15298,6 +15334,30 @@ import { dirname, join } from "node:path";
15298
15334
  import { promisify } from "node:util";
15299
15335
  var execFileAsync = promisify(execFile);
15300
15336
  var KEYCHAIN_SERVICE = "Pulpo CLI";
15337
+ var MACOS_KEYCHAIN_WRITE_SCRIPT = String.raw`
15338
+ log_user 0
15339
+ set timeout 15
15340
+ set secret [gets stdin]
15341
+ set context $env(PULPO_CLI_KEYCHAIN_CONTEXT)
15342
+ spawn /usr/bin/security add-generic-password -U -s "Pulpo CLI" -a $context -w
15343
+ expect {
15344
+ -re {password data for .*item:} { send -- "$secret\r" }
15345
+ timeout { exit 124 }
15346
+ eof { set result [wait]; exit [lindex $result 3] }
15347
+ }
15348
+ expect {
15349
+ -re {retype password for .*item:} { send -- "$secret\r"; exp_continue }
15350
+ timeout { exit 124 }
15351
+ eof { set result [wait]; exit [lindex $result 3] }
15352
+ }
15353
+ `;
15354
+ function macosKeychainWriteCommand(context) {
15355
+ return {
15356
+ command: "/usr/bin/expect",
15357
+ args: ["-c", MACOS_KEYCHAIN_WRITE_SCRIPT],
15358
+ env: { ...process.env, PULPO_CLI_KEYCHAIN_CONTEXT: context }
15359
+ };
15360
+ }
15301
15361
  function configRoot() {
15302
15362
  if (process.platform === "win32") return join(process.env.APPDATA ?? join(homedir(), "AppData", "Roaming"), "pulpo");
15303
15363
  return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "pulpo");
@@ -15373,11 +15433,17 @@ async function keychainGet(context) {
15373
15433
  async function keychainSet(context, token) {
15374
15434
  try {
15375
15435
  if (process.platform === "darwin") {
15436
+ if (!await commandExists("expect") || token.includes("\n")) return false;
15437
+ const invocation = macosKeychainWriteCommand(context);
15376
15438
  await new Promise((resolve, reject) => {
15377
- const child = spawn("security", ["add-generic-password", "-U", "-s", KEYCHAIN_SERVICE, "-a", context, "-w"], { stdio: ["pipe", "ignore", "ignore"] });
15439
+ const child = spawn(invocation.command, invocation.args, {
15440
+ env: invocation.env,
15441
+ stdio: ["pipe", "ignore", "ignore"]
15442
+ });
15378
15443
  child.once("error", reject);
15379
- child.once("exit", (code) => code === 0 ? resolve() : reject(new Error(`security exited ${code}`)));
15380
- child.stdin.end(token);
15444
+ child.once("exit", (code) => code === 0 ? resolve() : reject(new Error(`expect exited ${code}`)));
15445
+ child.stdin.end(`${token}
15446
+ `);
15381
15447
  });
15382
15448
  return true;
15383
15449
  }
@@ -15524,7 +15590,7 @@ async function confirmExact(io, expected, yes, json2) {
15524
15590
  }
15525
15591
 
15526
15592
  // src/index.ts
15527
- var CLI_VERSION = true ? "0.44.0" : "0.1.0";
15593
+ var CLI_VERSION = true ? "0.46.0" : "0.1.0";
15528
15594
  var CLI_BUNDLED = true;
15529
15595
  var commandIo = /* @__PURE__ */ new WeakMap();
15530
15596
  var commandClientFactory = /* @__PURE__ */ new WeakMap();
@@ -15695,8 +15761,10 @@ function createProgram(io = processIo, dependencies = {}) {
15695
15761
  commandIo.set(program, io);
15696
15762
  commandClientFactory.set(program, dependencies.createClient);
15697
15763
  const contexts = program.command("context").description("Manage Pulpo instance contexts");
15698
- contexts.command("add <name>").requiredOption("--url <url>").action(async (name, options, command) => {
15699
- const config2 = await addContext(name, options.url);
15764
+ contexts.command("add <name>").action(async (name, _options, command) => {
15765
+ const url2 = globalOptions(command).url;
15766
+ if (!url2) throw new Error("Context URL is required; pass --url <url>");
15767
+ const config2 = await addContext(name, url2);
15700
15768
  emit(io, command, { name, ...config2.contexts[name], current: config2.currentContext === name });
15701
15769
  });
15702
15770
  contexts.command("list").action(async (_options, command) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isaacthoman/pulpo",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "Operator-first command-line client for Pulpo",
5
5
  "type": "module",
6
6
  "bin": {