poe-code 3.0.38 → 3.0.40
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/cli/commands/generate.js +1 -40
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/models.js +17 -11
- package/dist/cli/commands/models.js.map +1 -1
- package/dist/cli/commands/test.js +49 -40
- package/dist/cli/commands/test.js.map +1 -1
- package/dist/cli/commands/usage.js +3 -16
- package/dist/cli/commands/usage.js.map +1 -1
- package/dist/cli/prompts.js +1 -1
- package/dist/cli/prompts.js.map +1 -1
- package/dist/index.js +129 -118
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15090,7 +15090,7 @@ function createPromptLibrary() {
|
|
|
15090
15090
|
return {
|
|
15091
15091
|
loginApiKey: () => describe3({
|
|
15092
15092
|
name: "apiKey",
|
|
15093
|
-
message: "Enter your Poe API key
|
|
15093
|
+
message: "Enter your Poe API key - get one at https://poe.com/api/keys",
|
|
15094
15094
|
type: "password"
|
|
15095
15095
|
}),
|
|
15096
15096
|
model: ({ label, defaultValue, choices }) => {
|
|
@@ -15721,6 +15721,61 @@ async function password2(opts) {
|
|
|
15721
15721
|
function spinner2() {
|
|
15722
15722
|
return clack.spinner();
|
|
15723
15723
|
}
|
|
15724
|
+
function formatElapsed(ms) {
|
|
15725
|
+
const totalSeconds = Math.floor(ms / 1e3);
|
|
15726
|
+
if (totalSeconds < 60) {
|
|
15727
|
+
return `${totalSeconds}s`;
|
|
15728
|
+
}
|
|
15729
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
15730
|
+
const seconds = totalSeconds % 60;
|
|
15731
|
+
return `${minutes}m ${seconds}s`;
|
|
15732
|
+
}
|
|
15733
|
+
async function withSpinner(options) {
|
|
15734
|
+
const { message, fn, stopMessage, subtext } = options;
|
|
15735
|
+
const noSpinner = process.env.POE_NO_SPINNER === "1";
|
|
15736
|
+
const isTTY = process.stdout.isTTY;
|
|
15737
|
+
if (noSpinner || !isTTY) {
|
|
15738
|
+
const result = await fn();
|
|
15739
|
+
const msg = stopMessage ? stopMessage(result) : void 0;
|
|
15740
|
+
if (msg) {
|
|
15741
|
+
process.stdout.write(`\x1B[32m\u25C6\x1B[0m ${msg}
|
|
15742
|
+
`);
|
|
15743
|
+
}
|
|
15744
|
+
const sub = subtext ? subtext(result) : void 0;
|
|
15745
|
+
if (sub) {
|
|
15746
|
+
for (const line of sub.split("\n")) {
|
|
15747
|
+
process.stdout.write(`\x1B[90m\u2502\x1B[0m ${line}
|
|
15748
|
+
`);
|
|
15749
|
+
}
|
|
15750
|
+
}
|
|
15751
|
+
return result;
|
|
15752
|
+
}
|
|
15753
|
+
const s = spinner2();
|
|
15754
|
+
const start = Date.now();
|
|
15755
|
+
s.start(message);
|
|
15756
|
+
const timer = setInterval(() => {
|
|
15757
|
+
s.message(`${message} [${formatElapsed(Date.now() - start)}]`);
|
|
15758
|
+
}, 1e3);
|
|
15759
|
+
try {
|
|
15760
|
+
const result = await fn();
|
|
15761
|
+
clearInterval(timer);
|
|
15762
|
+
const elapsed = formatElapsed(Date.now() - start);
|
|
15763
|
+
const msg = stopMessage ? stopMessage(result) : void 0;
|
|
15764
|
+
s.stop(msg ? `${msg} [${elapsed}]` : `Done [${elapsed}]`);
|
|
15765
|
+
const sub = subtext ? subtext(result) : void 0;
|
|
15766
|
+
if (sub) {
|
|
15767
|
+
for (const line of sub.split("\n")) {
|
|
15768
|
+
process.stdout.write(`\x1B[90m\u2502\x1B[0m ${line}
|
|
15769
|
+
`);
|
|
15770
|
+
}
|
|
15771
|
+
}
|
|
15772
|
+
return result;
|
|
15773
|
+
} catch (error2) {
|
|
15774
|
+
clearInterval(timer);
|
|
15775
|
+
s.stop("", 1);
|
|
15776
|
+
throw error2;
|
|
15777
|
+
}
|
|
15778
|
+
}
|
|
15724
15779
|
|
|
15725
15780
|
// packages/design-system/src/static/spinner.ts
|
|
15726
15781
|
import chalk8 from "chalk";
|
|
@@ -19214,31 +19269,35 @@ async function executeTest(program, container, service, options = {}) {
|
|
|
19214
19269
|
}
|
|
19215
19270
|
const expectedOutput = "STDIN_OK";
|
|
19216
19271
|
const prompt = `Output exactly: ${expectedOutput}`;
|
|
19217
|
-
const result = await (
|
|
19218
|
-
|
|
19219
|
-
|
|
19220
|
-
|
|
19221
|
-
|
|
19222
|
-
|
|
19223
|
-
model: options.model
|
|
19224
|
-
});
|
|
19225
|
-
}
|
|
19226
|
-
return container.registry.invoke(
|
|
19227
|
-
canonicalService,
|
|
19228
|
-
"spawn",
|
|
19229
|
-
async (entry) => {
|
|
19230
|
-
if (!entry.spawn) {
|
|
19231
|
-
throw new Error(`Agent "${canonicalService}" does not support spawn.`);
|
|
19232
|
-
}
|
|
19233
|
-
const output = await entry.spawn(providerContext, {
|
|
19272
|
+
const result = await withSpinner({
|
|
19273
|
+
message: `Testing ${adapter.label} via stdin...`,
|
|
19274
|
+
fn: async () => {
|
|
19275
|
+
const spawnConfig = getSpawnConfig(canonicalService);
|
|
19276
|
+
if (spawnConfig) {
|
|
19277
|
+
return spawn2(canonicalService, {
|
|
19234
19278
|
prompt,
|
|
19235
19279
|
useStdin: true,
|
|
19236
19280
|
model: options.model
|
|
19237
19281
|
});
|
|
19238
|
-
return output;
|
|
19239
19282
|
}
|
|
19240
|
-
|
|
19241
|
-
|
|
19283
|
+
return container.registry.invoke(
|
|
19284
|
+
canonicalService,
|
|
19285
|
+
"spawn",
|
|
19286
|
+
async (entry) => {
|
|
19287
|
+
if (!entry.spawn) {
|
|
19288
|
+
throw new Error(`Agent "${canonicalService}" does not support spawn.`);
|
|
19289
|
+
}
|
|
19290
|
+
const output = await entry.spawn(providerContext, {
|
|
19291
|
+
prompt,
|
|
19292
|
+
useStdin: true,
|
|
19293
|
+
model: options.model
|
|
19294
|
+
});
|
|
19295
|
+
return output;
|
|
19296
|
+
}
|
|
19297
|
+
);
|
|
19298
|
+
},
|
|
19299
|
+
stopMessage: () => `${adapter.label} stdin test`
|
|
19300
|
+
});
|
|
19242
19301
|
if (!result) {
|
|
19243
19302
|
throw new Error(
|
|
19244
19303
|
`Stdin spawn test for ${adapter.label} did not return command output.`
|
|
@@ -19261,26 +19320,30 @@ async function executeTest(program, container, service, options = {}) {
|
|
|
19261
19320
|
);
|
|
19262
19321
|
}
|
|
19263
19322
|
} else {
|
|
19264
|
-
await
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19323
|
+
await withSpinner({
|
|
19324
|
+
message: `Testing ${adapter.label}...`,
|
|
19325
|
+
fn: () => container.registry.invoke(canonicalService, "test", async (entry) => {
|
|
19326
|
+
if (!entry.test) {
|
|
19327
|
+
throw new Error(`Agent "${canonicalService}" does not support test.`);
|
|
19328
|
+
}
|
|
19329
|
+
const activeContext = isolatedDetails ? {
|
|
19330
|
+
...providerContext,
|
|
19331
|
+
runCheck: async (check2) => {
|
|
19332
|
+
await check2.run({
|
|
19333
|
+
isDryRun: providerContext.logger.context.dryRun,
|
|
19334
|
+
runCommand: (command, args) => resources.context.runCommand("poe-code", [
|
|
19335
|
+
"wrap",
|
|
19336
|
+
canonicalService,
|
|
19337
|
+
"--",
|
|
19338
|
+
...args
|
|
19339
|
+
]),
|
|
19340
|
+
logDryRun: (message) => providerContext.logger.dryRun(message)
|
|
19341
|
+
});
|
|
19342
|
+
}
|
|
19343
|
+
} : providerContext;
|
|
19344
|
+
await entry.test(activeContext);
|
|
19345
|
+
}),
|
|
19346
|
+
stopMessage: () => `${adapter.label} health check`
|
|
19284
19347
|
});
|
|
19285
19348
|
}
|
|
19286
19349
|
const dryMessage = canonicalService === "claude-code" ? `${adapter.label} test (dry run)` : `Dry run: would test ${adapter.label}.`;
|
|
@@ -19683,47 +19746,6 @@ function collectParam(value, previous) {
|
|
|
19683
19746
|
list.push(value);
|
|
19684
19747
|
return list;
|
|
19685
19748
|
}
|
|
19686
|
-
async function withSpinner(options) {
|
|
19687
|
-
const { message, fn, stopMessage, subtext } = options;
|
|
19688
|
-
const noSpinner = process.env.POE_NO_SPINNER === "1";
|
|
19689
|
-
const isTTY = process.stdout.isTTY;
|
|
19690
|
-
if (noSpinner || !isTTY) {
|
|
19691
|
-
const result = await fn();
|
|
19692
|
-
const msg = stopMessage ? stopMessage(result) : void 0;
|
|
19693
|
-
if (msg) {
|
|
19694
|
-
process.stdout.write(`\x1B[32m\u25C6\x1B[0m ${msg}
|
|
19695
|
-
`);
|
|
19696
|
-
}
|
|
19697
|
-
const sub = subtext ? subtext(result) : void 0;
|
|
19698
|
-
if (sub) {
|
|
19699
|
-
const lines = sub.split("\n");
|
|
19700
|
-
for (const line of lines) {
|
|
19701
|
-
process.stdout.write(`\x1B[90m\u2502\x1B[0m ${line}
|
|
19702
|
-
`);
|
|
19703
|
-
}
|
|
19704
|
-
}
|
|
19705
|
-
return result;
|
|
19706
|
-
}
|
|
19707
|
-
const s = spinner2();
|
|
19708
|
-
s.start(message);
|
|
19709
|
-
try {
|
|
19710
|
-
const result = await fn();
|
|
19711
|
-
const msg = stopMessage ? stopMessage(result) : void 0;
|
|
19712
|
-
s.stop(msg);
|
|
19713
|
-
const sub = subtext ? subtext(result) : void 0;
|
|
19714
|
-
if (sub) {
|
|
19715
|
-
const lines = sub.split("\n");
|
|
19716
|
-
for (const line of lines) {
|
|
19717
|
-
process.stdout.write(`\x1B[90m\u2502\x1B[0m ${line}
|
|
19718
|
-
`);
|
|
19719
|
-
}
|
|
19720
|
-
}
|
|
19721
|
-
return result;
|
|
19722
|
-
} catch (error2) {
|
|
19723
|
-
s.stop("", 1);
|
|
19724
|
-
throw error2;
|
|
19725
|
-
}
|
|
19726
|
-
}
|
|
19727
19749
|
async function resolveClient(container) {
|
|
19728
19750
|
try {
|
|
19729
19751
|
return getGlobalClient();
|
|
@@ -35945,7 +35967,6 @@ function registerRalphCommand(program, container) {
|
|
|
35945
35967
|
|
|
35946
35968
|
// src/cli/commands/usage.ts
|
|
35947
35969
|
init_shared();
|
|
35948
|
-
init_credentials();
|
|
35949
35970
|
async function executeBalance(program, container) {
|
|
35950
35971
|
const flags = resolveCommandFlags(program);
|
|
35951
35972
|
const resources = createExecutionResources(
|
|
@@ -35955,15 +35976,7 @@ async function executeBalance(program, container) {
|
|
|
35955
35976
|
);
|
|
35956
35977
|
resources.logger.intro("usage balance");
|
|
35957
35978
|
try {
|
|
35958
|
-
const apiKey = await
|
|
35959
|
-
fs: container.fs,
|
|
35960
|
-
filePath: container.env.credentialsPath
|
|
35961
|
-
});
|
|
35962
|
-
if (!apiKey) {
|
|
35963
|
-
throw new AuthenticationError(
|
|
35964
|
-
"Poe API key not found. Run 'poe-code login' first."
|
|
35965
|
-
);
|
|
35966
|
-
}
|
|
35979
|
+
const apiKey = await container.options.resolveApiKey({ dryRun: flags.dryRun });
|
|
35967
35980
|
if (flags.dryRun) {
|
|
35968
35981
|
resources.logger.dryRun(
|
|
35969
35982
|
"Dry run: would fetch usage balance from Poe API."
|
|
@@ -36023,15 +36036,7 @@ function registerUsageCommand(program, container) {
|
|
|
36023
36036
|
const commandOptions = this.opts();
|
|
36024
36037
|
resources.logger.intro("usage list");
|
|
36025
36038
|
try {
|
|
36026
|
-
const apiKey = await
|
|
36027
|
-
fs: container.fs,
|
|
36028
|
-
filePath: container.env.credentialsPath
|
|
36029
|
-
});
|
|
36030
|
-
if (!apiKey) {
|
|
36031
|
-
throw new AuthenticationError(
|
|
36032
|
-
"Poe API key not found. Run 'poe-code login' first."
|
|
36033
|
-
);
|
|
36034
|
-
}
|
|
36039
|
+
const apiKey = await container.options.resolveApiKey({ dryRun: flags.dryRun });
|
|
36035
36040
|
if (flags.dryRun) {
|
|
36036
36041
|
resources.logger.dryRun(
|
|
36037
36042
|
"Dry run: would fetch usage history from Poe API."
|
|
@@ -36196,23 +36201,29 @@ function registerModelsCommand(program, container) {
|
|
|
36196
36201
|
if (apiKey) {
|
|
36197
36202
|
headers.Authorization = `Bearer ${apiKey}`;
|
|
36198
36203
|
}
|
|
36199
|
-
const
|
|
36200
|
-
|
|
36201
|
-
{
|
|
36202
|
-
|
|
36203
|
-
|
|
36204
|
-
|
|
36205
|
-
|
|
36206
|
-
|
|
36207
|
-
|
|
36208
|
-
|
|
36209
|
-
{
|
|
36210
|
-
|
|
36211
|
-
|
|
36204
|
+
const result = await withSpinner({
|
|
36205
|
+
message: "Fetching models...",
|
|
36206
|
+
fn: async () => {
|
|
36207
|
+
const response = await container.httpClient(
|
|
36208
|
+
`${container.env.poeBaseUrl}/v1/models`,
|
|
36209
|
+
{
|
|
36210
|
+
method: "GET",
|
|
36211
|
+
headers
|
|
36212
|
+
}
|
|
36213
|
+
);
|
|
36214
|
+
if (!response.ok) {
|
|
36215
|
+
throw new ApiError(
|
|
36216
|
+
`Failed to fetch models (HTTP ${response.status})`,
|
|
36217
|
+
{
|
|
36218
|
+
httpStatus: response.status,
|
|
36219
|
+
endpoint: "/v1/models"
|
|
36220
|
+
}
|
|
36221
|
+
);
|
|
36212
36222
|
}
|
|
36213
|
-
|
|
36214
|
-
|
|
36215
|
-
|
|
36223
|
+
return await response.json();
|
|
36224
|
+
},
|
|
36225
|
+
stopMessage: (r) => `${r.data.length} models`
|
|
36226
|
+
});
|
|
36216
36227
|
const allModels = result.data;
|
|
36217
36228
|
if (allModels.length === 0) {
|
|
36218
36229
|
resources.logger.info("No models found.");
|
|
@@ -36325,7 +36336,7 @@ function registerModelsCommand(program, container) {
|
|
|
36325
36336
|
// package.json
|
|
36326
36337
|
var package_default = {
|
|
36327
36338
|
name: "poe-code",
|
|
36328
|
-
version: "3.0.
|
|
36339
|
+
version: "3.0.40",
|
|
36329
36340
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
36330
36341
|
type: "module",
|
|
36331
36342
|
workspaces: [
|