free-pi-cli 0.2.8 → 0.2.9
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/index.js +1 -1
- package/dist/{main-wd2zxa5n.js → main-2gestngs.js} +26 -47
- package/dist/main-hd0rapve.js +19684 -0
- package/dist/main-swfaagjj.js +19850 -0
- package/dist/main-wdjtzs85.js +19996 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14453,8 +14453,7 @@ var ClientVersionResponseSchema = exports_external.object({
|
|
|
14453
14453
|
min: exports_external.string(),
|
|
14454
14454
|
latest: exports_external.string(),
|
|
14455
14455
|
model: exports_external.string().optional(),
|
|
14456
|
-
notice: exports_external.string().optional()
|
|
14457
|
-
models: exports_external.array(exports_external.object({ id: exports_external.string(), name: exports_external.string() })).optional()
|
|
14456
|
+
notice: exports_external.string().optional()
|
|
14458
14457
|
});
|
|
14459
14458
|
var SessionResetResponseSchema = exports_external.object({
|
|
14460
14459
|
released: exports_external.boolean()
|
|
@@ -14505,8 +14504,7 @@ var ConfigSchema = exports_external.object({
|
|
|
14505
14504
|
abuseFlipAlertThreshold: exports_external.number().int().default(10),
|
|
14506
14505
|
abuseAdBypassMinRequests: exports_external.number().int().default(20),
|
|
14507
14506
|
abuseAdBypassRatio: exports_external.number().int().default(10),
|
|
14508
|
-
traceMaxInflightWrites: exports_external.number().int().default(32)
|
|
14509
|
-
catalogCacheTtlSeconds: exports_external.number().int().default(60)
|
|
14507
|
+
traceMaxInflightWrites: exports_external.number().int().default(32)
|
|
14510
14508
|
});
|
|
14511
14509
|
function envNumber(value) {
|
|
14512
14510
|
if (value === undefined || value === "")
|
|
@@ -14567,8 +14565,7 @@ function loadConfig(env = process.env) {
|
|
|
14567
14565
|
abuseFlipAlertThreshold: envNumber(env.ABUSE_FLIP_ALERT_THRESHOLD),
|
|
14568
14566
|
abuseAdBypassMinRequests: envNumber(env.ABUSE_AD_BYPASS_MIN_REQUESTS),
|
|
14569
14567
|
abuseAdBypassRatio: envNumber(env.ABUSE_AD_BYPASS_RATIO),
|
|
14570
|
-
traceMaxInflightWrites: envNumber(env.TRACE_MAX_INFLIGHT_WRITES)
|
|
14571
|
-
catalogCacheTtlSeconds: envNumber(env.CATALOG_CACHE_TTL_SECONDS)
|
|
14568
|
+
traceMaxInflightWrites: envNumber(env.TRACE_MAX_INFLIGHT_WRITES)
|
|
14572
14569
|
});
|
|
14573
14570
|
}
|
|
14574
14571
|
// ../shared/src/version.ts
|
|
@@ -14846,7 +14843,7 @@ import { join as join2, resolve } from "node:path";
|
|
|
14846
14843
|
// package.json
|
|
14847
14844
|
var package_default = {
|
|
14848
14845
|
name: "free-pi-cli",
|
|
14849
|
-
version: "0.2.
|
|
14846
|
+
version: "0.2.7",
|
|
14850
14847
|
description: "Free, ad-supported distribution of the pi coding agent. Inference paid for by ads.",
|
|
14851
14848
|
license: "MIT",
|
|
14852
14849
|
type: "module",
|
|
@@ -14885,22 +14882,24 @@ function completionsBaseUrl(baseUrl) {
|
|
|
14885
14882
|
const trimmed = baseUrl.replace(/\/+$/, "");
|
|
14886
14883
|
return trimmed.endsWith("/v1") ? trimmed : `${trimmed}/v1`;
|
|
14887
14884
|
}
|
|
14888
|
-
function buildProviderConfig(baseUrl, jwt2, sessionId,
|
|
14885
|
+
function buildProviderConfig(baseUrl, jwt2, sessionId, modelId = MODEL_ID) {
|
|
14889
14886
|
return {
|
|
14890
14887
|
name: "free-pi",
|
|
14891
14888
|
baseUrl: completionsBaseUrl(baseUrl),
|
|
14892
14889
|
apiKey: jwt2,
|
|
14893
14890
|
api: "openai-completions",
|
|
14894
14891
|
headers: { "x-session-id": sessionId, "x-client-version": CLI_VERSION },
|
|
14895
|
-
models:
|
|
14896
|
-
|
|
14897
|
-
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14892
|
+
models: [
|
|
14893
|
+
{
|
|
14894
|
+
id: modelId,
|
|
14895
|
+
name: modelId === MODEL_ID ? "DeepSeek V4 Flash (free-pi)" : modelId,
|
|
14896
|
+
reasoning: false,
|
|
14897
|
+
input: ["text"],
|
|
14898
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
14899
|
+
contextWindow: 1048576,
|
|
14900
|
+
maxTokens: 8192
|
|
14901
|
+
}
|
|
14902
|
+
]
|
|
14904
14903
|
};
|
|
14905
14904
|
}
|
|
14906
14905
|
|
|
@@ -19245,12 +19244,6 @@ function createToolGuardExtension(opts) {
|
|
|
19245
19244
|
|
|
19246
19245
|
// src/changelog.ts
|
|
19247
19246
|
var CHANGELOG_HIGHLIGHTS = [
|
|
19248
|
-
{
|
|
19249
|
-
version: "0.2.8",
|
|
19250
|
-
highlights: [
|
|
19251
|
-
"You can now pick between models — run /model to see the list and switch (when the server offers more than one)."
|
|
19252
|
-
]
|
|
19253
|
-
},
|
|
19254
19247
|
{
|
|
19255
19248
|
version: "0.2.7",
|
|
19256
19249
|
highlights: [
|
|
@@ -19360,32 +19353,21 @@ function createFreePiCommandsExtension(opts) {
|
|
|
19360
19353
|
}
|
|
19361
19354
|
|
|
19362
19355
|
// src/provider-lock.ts
|
|
19363
|
-
function resolveFreePiScope(modelRuntime, providerName,
|
|
19356
|
+
function resolveFreePiScope(modelRuntime, providerName, modelId, env = process.env) {
|
|
19364
19357
|
if (env.FREEPI_KEEP_ENV_PROVIDERS)
|
|
19365
19358
|
return [];
|
|
19366
|
-
const
|
|
19367
|
-
|
|
19368
|
-
const model = modelRuntime.getModel(providerName, id);
|
|
19369
|
-
if (model)
|
|
19370
|
-
scoped.push({ model });
|
|
19371
|
-
}
|
|
19372
|
-
return scoped;
|
|
19359
|
+
const model = modelRuntime.getModel(providerName, modelId);
|
|
19360
|
+
return model ? [{ model }] : [];
|
|
19373
19361
|
}
|
|
19374
19362
|
|
|
19375
19363
|
// src/pi-launch.ts
|
|
19376
|
-
function catalogModelsFor(opts) {
|
|
19377
|
-
if (opts.models && opts.models.length > 0)
|
|
19378
|
-
return opts.models;
|
|
19379
|
-
const id = opts.model || MODEL_ID;
|
|
19380
|
-
return [{ id, name: id }];
|
|
19381
|
-
}
|
|
19382
19364
|
var ALLOWED_TOOL_NAMES = [...SAFE_TOOLS, USAGE_TOOL_NAME];
|
|
19383
19365
|
function buildRuntimeOptions(opts, sessionId) {
|
|
19384
|
-
const
|
|
19366
|
+
const modelId = opts.model || MODEL_ID;
|
|
19385
19367
|
const providerExtension = {
|
|
19386
19368
|
name: "free-pi-provider",
|
|
19387
19369
|
factory: (pi) => {
|
|
19388
|
-
pi.registerProvider(PROVIDER_NAME, buildProviderConfig(opts.baseUrl, opts.jwt, sessionId,
|
|
19370
|
+
pi.registerProvider(PROVIDER_NAME, buildProviderConfig(opts.baseUrl, opts.jwt, sessionId, modelId));
|
|
19389
19371
|
}
|
|
19390
19372
|
};
|
|
19391
19373
|
const adsExtension = createAdsExtension({
|
|
@@ -19415,7 +19397,7 @@ function buildRuntimeOptions(opts, sessionId) {
|
|
|
19415
19397
|
];
|
|
19416
19398
|
const settingsManager = SettingsManager.inMemory({
|
|
19417
19399
|
defaultProvider: PROVIDER_NAME,
|
|
19418
|
-
defaultModel:
|
|
19400
|
+
defaultModel: modelId,
|
|
19419
19401
|
defaultTools: [...SAFE_TOOLS],
|
|
19420
19402
|
packages: []
|
|
19421
19403
|
});
|
|
@@ -19447,7 +19429,7 @@ async function launchPi(opts) {
|
|
|
19447
19429
|
const sessionDir = getSessionDir(cwd, opts.agentDir);
|
|
19448
19430
|
const sm = await createSessionManager(cwd, sessionDir, opts.session);
|
|
19449
19431
|
const sessionId = sm.getSessionId();
|
|
19450
|
-
const
|
|
19432
|
+
const modelId = opts.model || MODEL_ID;
|
|
19451
19433
|
const { settingsManager, resourceLoaderOptions, tools } = buildRuntimeOptions(opts, sessionId);
|
|
19452
19434
|
const createRuntime = async ({
|
|
19453
19435
|
cwd: rtCwd,
|
|
@@ -19460,7 +19442,7 @@ async function launchPi(opts) {
|
|
|
19460
19442
|
settingsManager,
|
|
19461
19443
|
resourceLoaderOptions
|
|
19462
19444
|
});
|
|
19463
|
-
const scopedModels = resolveFreePiScope(services.modelRuntime, PROVIDER_NAME,
|
|
19445
|
+
const scopedModels = resolveFreePiScope(services.modelRuntime, PROVIDER_NAME, modelId);
|
|
19464
19446
|
return {
|
|
19465
19447
|
...await createAgentSessionFromServices({
|
|
19466
19448
|
services,
|
|
@@ -19758,8 +19740,7 @@ async function run(deps, argv = process.argv) {
|
|
|
19758
19740
|
jwt: jwt2,
|
|
19759
19741
|
agentDir: deps.agentDir,
|
|
19760
19742
|
session: sessionArg.session,
|
|
19761
|
-
model: versionCheck.model
|
|
19762
|
-
models: versionCheck.models
|
|
19743
|
+
model: versionCheck.model
|
|
19763
19744
|
});
|
|
19764
19745
|
deps.log(finalSessionId ? `
|
|
19765
19746
|
free-pi session ended. Start it again anytime: npx free-pi-cli --session ${finalSessionId}` : `
|
|
@@ -19814,12 +19795,10 @@ async function checkClientVersion(baseUrl, cliVersion, fetchImpl = fetch) {
|
|
|
19814
19795
|
const parsed = ClientVersionResponseSchema.safeParse(await res.json());
|
|
19815
19796
|
if (!parsed.success)
|
|
19816
19797
|
return { action: "ok" };
|
|
19817
|
-
const { min, latest, model,
|
|
19798
|
+
const { min, latest, model, notice } = parsed.data;
|
|
19818
19799
|
const extra = {};
|
|
19819
19800
|
if (model !== undefined)
|
|
19820
19801
|
extra.model = model;
|
|
19821
|
-
if (models !== undefined)
|
|
19822
|
-
extra.models = models;
|
|
19823
19802
|
if (notice !== undefined)
|
|
19824
19803
|
extra.notice = notice;
|
|
19825
19804
|
if (compareVersions(cliVersion, min) === -1)
|