@isaacthoman/pulpo 0.45.0 → 0.47.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.
- package/README.md +4 -0
- package/dist/index.js +66 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,3 +39,7 @@ Management token scopes are `account:read`, `account:write`, `instance:read`,
|
|
|
39
39
|
Administrator scopes continue to require the token owner's current administrator
|
|
40
40
|
role. Tokens are shown only once when created and only work below
|
|
41
41
|
`/api/management/v1`.
|
|
42
|
+
|
|
43
|
+
Deleting a model permanently reassigns its historical chats and usage to the
|
|
44
|
+
hidden `unknown model` placeholder while retaining recorded token and cost
|
|
45
|
+
totals. Active or queued model work must finish before deletion can proceed.
|
package/dist/index.js
CHANGED
|
@@ -14857,31 +14857,44 @@ var webToolProviderSchema = external_exports.enum(["kagi", "firecrawl"]);
|
|
|
14857
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
14858
|
var kagiWebProviderSettingsSchema = external_exports.object({
|
|
14859
14859
|
searchEnabled: external_exports.boolean().default(true),
|
|
14860
|
-
|
|
14860
|
+
billSearches: external_exports.boolean().default(false),
|
|
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),
|
|
14864
|
+
extractPriceMicros: external_exports.number().int().min(0).max(1e9).default(4e3)
|
|
14861
14865
|
});
|
|
14862
14866
|
var firecrawlWebProviderSettingsSchema = external_exports.object({
|
|
14863
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),
|
|
14864
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),
|
|
14865
14873
|
baseUrl: external_exports.url().default("https://api.firecrawl.dev/v2"),
|
|
14866
|
-
maxAgeSeconds: external_exports.number().int().min(0).max(31536e3).default(0)
|
|
14867
|
-
costPerCreditMicros: external_exports.number().int().min(0).max(1e9).default(0)
|
|
14874
|
+
maxAgeSeconds: external_exports.number().int().min(0).max(31536e3).default(0)
|
|
14868
14875
|
});
|
|
14869
14876
|
var webToolsSettingsSchema = external_exports.object({
|
|
14870
14877
|
searchEnabled: external_exports.boolean().default(false),
|
|
14871
14878
|
extractEnabled: external_exports.boolean().default(false),
|
|
14872
|
-
billSearches: external_exports.boolean().default(false),
|
|
14873
|
-
billExtracts: external_exports.boolean().default(false),
|
|
14874
|
-
searchPriceMicros: external_exports.number().int().min(0).max(1e9).default(12e3),
|
|
14875
|
-
extractPriceMicros: external_exports.number().int().min(0).max(1e9).default(4e3),
|
|
14876
14879
|
searchProviderOrder: webToolProviderOrderSchema.default(["kagi", "firecrawl"]),
|
|
14877
14880
|
extractProviderOrder: webToolProviderOrderSchema.default(["kagi", "firecrawl"]),
|
|
14878
|
-
kagi: kagiWebProviderSettingsSchema.default({
|
|
14881
|
+
kagi: kagiWebProviderSettingsSchema.default({
|
|
14882
|
+
searchEnabled: true,
|
|
14883
|
+
billSearches: false,
|
|
14884
|
+
searchPriceMicros: 12e3,
|
|
14885
|
+
extractEnabled: true,
|
|
14886
|
+
billExtracts: false,
|
|
14887
|
+
extractPriceMicros: 4e3
|
|
14888
|
+
}),
|
|
14879
14889
|
firecrawl: firecrawlWebProviderSettingsSchema.default({
|
|
14880
14890
|
searchEnabled: false,
|
|
14891
|
+
billSearches: false,
|
|
14892
|
+
searchPriceMicros: 12e3,
|
|
14881
14893
|
extractEnabled: false,
|
|
14894
|
+
billExtracts: false,
|
|
14895
|
+
extractPriceMicros: 4e3,
|
|
14882
14896
|
baseUrl: "https://api.firecrawl.dev/v2",
|
|
14883
|
-
maxAgeSeconds: 0
|
|
14884
|
-
costPerCreditMicros: 0
|
|
14897
|
+
maxAgeSeconds: 0
|
|
14885
14898
|
})
|
|
14886
14899
|
});
|
|
14887
14900
|
var managementScopeSchema = external_exports.enum([
|
|
@@ -15321,6 +15334,30 @@ import { dirname, join } from "node:path";
|
|
|
15321
15334
|
import { promisify } from "node:util";
|
|
15322
15335
|
var execFileAsync = promisify(execFile);
|
|
15323
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
|
+
}
|
|
15324
15361
|
function configRoot() {
|
|
15325
15362
|
if (process.platform === "win32") return join(process.env.APPDATA ?? join(homedir(), "AppData", "Roaming"), "pulpo");
|
|
15326
15363
|
return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "pulpo");
|
|
@@ -15396,11 +15433,17 @@ async function keychainGet(context) {
|
|
|
15396
15433
|
async function keychainSet(context, token) {
|
|
15397
15434
|
try {
|
|
15398
15435
|
if (process.platform === "darwin") {
|
|
15436
|
+
if (!await commandExists("expect") || token.includes("\n")) return false;
|
|
15437
|
+
const invocation = macosKeychainWriteCommand(context);
|
|
15399
15438
|
await new Promise((resolve, reject) => {
|
|
15400
|
-
const child = spawn(
|
|
15439
|
+
const child = spawn(invocation.command, invocation.args, {
|
|
15440
|
+
env: invocation.env,
|
|
15441
|
+
stdio: ["pipe", "ignore", "ignore"]
|
|
15442
|
+
});
|
|
15401
15443
|
child.once("error", reject);
|
|
15402
|
-
child.once("exit", (code) => code === 0 ? resolve() : reject(new Error(`
|
|
15403
|
-
child.stdin.end(token
|
|
15444
|
+
child.once("exit", (code) => code === 0 ? resolve() : reject(new Error(`expect exited ${code}`)));
|
|
15445
|
+
child.stdin.end(`${token}
|
|
15446
|
+
`);
|
|
15404
15447
|
});
|
|
15405
15448
|
return true;
|
|
15406
15449
|
}
|
|
@@ -15547,7 +15590,7 @@ async function confirmExact(io, expected, yes, json2) {
|
|
|
15547
15590
|
}
|
|
15548
15591
|
|
|
15549
15592
|
// src/index.ts
|
|
15550
|
-
var CLI_VERSION = true ? "0.
|
|
15593
|
+
var CLI_VERSION = true ? "0.47.0" : "0.1.0";
|
|
15551
15594
|
var CLI_BUNDLED = true;
|
|
15552
15595
|
var commandIo = /* @__PURE__ */ new WeakMap();
|
|
15553
15596
|
var commandClientFactory = /* @__PURE__ */ new WeakMap();
|
|
@@ -15703,7 +15746,10 @@ function registerFileCrud(program, io, input) {
|
|
|
15703
15746
|
emit(io, command, await client.request(`${input.pluralPath}/${encodeURIComponent(id)}`, { method: "PATCH", body }));
|
|
15704
15747
|
});
|
|
15705
15748
|
if (input.remove !== false) group.command("delete <id>").action(async (id, _options, command) => {
|
|
15706
|
-
|
|
15749
|
+
const options = globalOptions(command);
|
|
15750
|
+
if (input.deleteWarning && !options.yes && !options.json) io.stderr.write(`${input.deleteWarning}
|
|
15751
|
+
`);
|
|
15752
|
+
await confirmExact(io, id, Boolean(options.yes), Boolean(options.json));
|
|
15707
15753
|
const { client } = await clientFor(command);
|
|
15708
15754
|
await client.request(`${input.pluralPath}/${encodeURIComponent(id)}`, { method: "DELETE" });
|
|
15709
15755
|
emit(io, command, { id, deleted: true });
|
|
@@ -15912,7 +15958,11 @@ function createProgram(io = processIo, dependencies = {}) {
|
|
|
15912
15958
|
const { client } = await clientFor(command);
|
|
15913
15959
|
emit(io, command, await client.request(`/api/management/v1/labs/${encodeURIComponent(id)}/models/order`, { method: "PUT", body: await jsonFile(options.file) }));
|
|
15914
15960
|
});
|
|
15915
|
-
registerFileCrud(program, io, {
|
|
15961
|
+
registerFileCrud(program, io, {
|
|
15962
|
+
name: "model",
|
|
15963
|
+
pluralPath: "/api/management/v1/models",
|
|
15964
|
+
deleteWarning: "Historical references will be permanently reassigned to \u201Cunknown model\u201D."
|
|
15965
|
+
});
|
|
15916
15966
|
const user = registerFileCrud(program, io, { name: "user", pluralPath: "/api/management/v1/users" });
|
|
15917
15967
|
for (const [action, patch] of [["approve", { role: "user" }], ["block", { blocked: true }], ["unblock", { blocked: false }]]) {
|
|
15918
15968
|
user.command(`${action} <id>`).action(async (id, _options, command) => {
|