poe-code 2.0.8 → 2.0.10
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 +10 -10
- package/dist/cli/commands/query.d.ts +6 -0
- package/dist/cli/commands/query.js +73 -0
- package/dist/cli/commands/query.js.map +1 -0
- package/dist/cli/constants.d.ts +2 -0
- package/dist/cli/constants.js +9 -0
- package/dist/cli/constants.js.map +1 -1
- package/dist/cli/program.js +2 -0
- package/dist/cli/program.js.map +1 -1
- package/dist/providers/index.js +2 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/kimi.d.ts +13 -0
- package/dist/providers/kimi.js +105 -0
- package/dist/providers/kimi.js.map +1 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# poe-code
|
|
2
2
|
|
|
3
|
-
> Configure
|
|
3
|
+
> Configure coding agents to use the Poe API.
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
@@ -16,31 +16,31 @@ npx poe-code@latest configure claude-code
|
|
|
16
16
|
npx poe-code@latest login
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
###
|
|
19
|
+
### Configure Coding CLIs
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
# Claude Code
|
|
23
|
-
npx poe-code@latest
|
|
23
|
+
npx poe-code@latest configure claude-code
|
|
24
24
|
|
|
25
25
|
# Codex
|
|
26
|
-
npx poe-code@latest
|
|
26
|
+
npx poe-code@latest configure codex
|
|
27
27
|
|
|
28
28
|
# OpenCode
|
|
29
|
-
npx poe-code@latest
|
|
29
|
+
npx poe-code@latest configure opencode
|
|
30
|
+
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
###
|
|
33
|
+
### Install Coding CLIs
|
|
33
34
|
|
|
34
35
|
```bash
|
|
35
36
|
# Claude Code
|
|
36
|
-
npx poe-code@latest
|
|
37
|
+
npx poe-code@latest install claude-code
|
|
37
38
|
|
|
38
39
|
# Codex
|
|
39
|
-
npx poe-code@latest
|
|
40
|
+
npx poe-code@latest install codex
|
|
40
41
|
|
|
41
42
|
# OpenCode
|
|
42
|
-
npx poe-code@latest
|
|
43
|
-
|
|
43
|
+
npx poe-code@latest install opencode
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
### Uninstall Configuration
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import type { CliContainer } from "../container.js";
|
|
3
|
+
export interface RegisterQueryCommandOptions {
|
|
4
|
+
defaultModel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function registerQueryCommand(program: Command, container: CliContainer, options?: RegisterQueryCommandOptions): void;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DEFAULT_FRONTIER_MODEL } from "../constants.js";
|
|
2
|
+
import { createExecutionResources, resolveCommandFlags } from "./shared.js";
|
|
3
|
+
import { loadCredentials } from "../../services/credentials.js";
|
|
4
|
+
export function registerQueryCommand(program, container, options = {}) {
|
|
5
|
+
program
|
|
6
|
+
.command("query")
|
|
7
|
+
.description("Query an LLM via Poe API directly")
|
|
8
|
+
.option("--model <model>", "Model identifier", options.defaultModel ?? DEFAULT_FRONTIER_MODEL)
|
|
9
|
+
.option("--system <prompt>", "System prompt")
|
|
10
|
+
.argument("[prompt]", "User prompt (if not provided, reads from stdin)")
|
|
11
|
+
.action(async function (promptArg) {
|
|
12
|
+
const flags = resolveCommandFlags(program);
|
|
13
|
+
const resources = createExecutionResources(container, flags, "query");
|
|
14
|
+
const commandOptions = this.opts();
|
|
15
|
+
const model = commandOptions.model ?? options.defaultModel ?? DEFAULT_FRONTIER_MODEL;
|
|
16
|
+
const systemPrompt = commandOptions.system;
|
|
17
|
+
// Get prompt from argument or stdin
|
|
18
|
+
let prompt = promptArg;
|
|
19
|
+
if (!prompt) {
|
|
20
|
+
// Check if stdin is being piped (not a TTY)
|
|
21
|
+
if (!process.stdin.isTTY) {
|
|
22
|
+
// Read from stdin
|
|
23
|
+
const chunks = [];
|
|
24
|
+
for await (const chunk of process.stdin) {
|
|
25
|
+
chunks.push(chunk);
|
|
26
|
+
}
|
|
27
|
+
prompt = Buffer.concat(chunks).toString("utf8").trim();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!prompt) {
|
|
31
|
+
throw new Error("No prompt provided via argument or stdin");
|
|
32
|
+
}
|
|
33
|
+
if (flags.dryRun) {
|
|
34
|
+
resources.logger.dryRun(`Dry run: would query model ${model} with prompt (${prompt.length} chars)`);
|
|
35
|
+
if (systemPrompt) {
|
|
36
|
+
resources.logger.dryRun(`System prompt: ${systemPrompt}`);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const apiKey = await loadCredentials({
|
|
41
|
+
fs: container.fs,
|
|
42
|
+
filePath: container.env.credentialsPath
|
|
43
|
+
});
|
|
44
|
+
if (!apiKey) {
|
|
45
|
+
throw new Error("Poe API key not found. Run 'poe-code login' first.");
|
|
46
|
+
}
|
|
47
|
+
// Dynamic import of openai to avoid top-level import issues
|
|
48
|
+
const { default: OpenAI } = await import("openai");
|
|
49
|
+
const client = new OpenAI({
|
|
50
|
+
apiKey,
|
|
51
|
+
baseURL: "https://api.poe.com/v1"
|
|
52
|
+
});
|
|
53
|
+
const messages = [];
|
|
54
|
+
if (systemPrompt) {
|
|
55
|
+
messages.push({ role: "system", content: systemPrompt });
|
|
56
|
+
}
|
|
57
|
+
messages.push({ role: "user", content: prompt });
|
|
58
|
+
const chat = await client.chat.completions.create({
|
|
59
|
+
model,
|
|
60
|
+
messages
|
|
61
|
+
});
|
|
62
|
+
const response = chat.choices[0]?.message?.content;
|
|
63
|
+
if (!response) {
|
|
64
|
+
throw new Error("No response from LLM");
|
|
65
|
+
}
|
|
66
|
+
// Output to stdout (no logger prefix)
|
|
67
|
+
process.stdout.write(response);
|
|
68
|
+
if (!response.endsWith("\n")) {
|
|
69
|
+
process.stdout.write("\n");
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../src/cli/commands/query.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EAGpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAMhE,MAAM,UAAU,oBAAoB,CAClC,OAAgB,EAChB,SAAuB,EACvB,UAAuC,EAAE;IAEzC,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,mCAAmC,CAAC;SAChD,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,OAAO,CAAC,YAAY,IAAI,sBAAsB,CAAC;SAC7F,MAAM,CAAC,mBAAmB,EAAE,eAAe,CAAC;SAC5C,QAAQ,CAAC,UAAU,EAAE,iDAAiD,CAAC;SACvE,MAAM,CAAC,KAAK,WAEX,SAAkB;QAElB,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,wBAAwB,CACxC,SAAS,EACT,KAAK,EACL,OAAO,CACR,CAAC;QACF,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,EAAuC,CAAC;QACxE,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,IAAI,OAAO,CAAC,YAAY,IAAI,sBAAsB,CAAC;QACrF,MAAM,YAAY,GAAG,cAAc,CAAC,MAAM,CAAC;QAE3C,oCAAoC;QACpC,IAAI,MAAM,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,4CAA4C;YAC5C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBACzB,kBAAkB;gBAClB,MAAM,MAAM,GAA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AAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QAEjD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YAChD,KAAK;YACL,QAAQ;SACT,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;QACnD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC1C,CAAC;QAED,sCAAsC;QACtC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/cli/constants.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare const CLAUDE_CODE_VARIANTS: {
|
|
|
8
8
|
export declare const DEFAULT_CLAUDE_CODE_MODEL: "Claude-Sonnet-4.5";
|
|
9
9
|
export declare const CODEX_MODELS: readonly ["GPT-5.1-Codex", "GPT-5.1", "GPT-5.1-Codex-Mini"];
|
|
10
10
|
export declare const DEFAULT_CODEX_MODEL: "GPT-5.1-Codex";
|
|
11
|
+
export declare const KIMI_MODELS: readonly ["Kimi-K2", "Kimi-K2-Thinking", "Kimi-K2-T", "Kimi-K2-Instruct", "Kimi-K2-0905-T", "Kimi-K2-Think-T"];
|
|
12
|
+
export declare const DEFAULT_KIMI_MODEL: "Kimi-K2";
|
|
11
13
|
export declare const DEFAULT_REASONING = "medium";
|
|
12
14
|
export declare const DEFAULT_QUERY_MODEL: "Claude-Sonnet-4.5";
|
|
13
15
|
export declare const PROVIDER_NAME = "poe";
|
package/dist/cli/constants.js
CHANGED
|
@@ -11,6 +11,15 @@ export const CLAUDE_CODE_VARIANTS = {
|
|
|
11
11
|
export const DEFAULT_CLAUDE_CODE_MODEL = CLAUDE_CODE_VARIANTS.sonnet;
|
|
12
12
|
export const CODEX_MODELS = ["GPT-5.1-Codex", "GPT-5.1", "GPT-5.1-Codex-Mini"];
|
|
13
13
|
export const DEFAULT_CODEX_MODEL = CODEX_MODELS[0];
|
|
14
|
+
export const KIMI_MODELS = [
|
|
15
|
+
"Kimi-K2",
|
|
16
|
+
"Kimi-K2-Thinking",
|
|
17
|
+
"Kimi-K2-T",
|
|
18
|
+
"Kimi-K2-Instruct",
|
|
19
|
+
"Kimi-K2-0905-T",
|
|
20
|
+
"Kimi-K2-Think-T"
|
|
21
|
+
];
|
|
22
|
+
export const DEFAULT_KIMI_MODEL = KIMI_MODELS[0];
|
|
14
23
|
export const DEFAULT_REASONING = "medium";
|
|
15
24
|
export const DEFAULT_QUERY_MODEL = FRONTIER_MODELS[0];
|
|
16
25
|
export const PROVIDER_NAME = "poe";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/cli/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mBAAmB;IACnB,eAAe;CACP,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,mBAAmB;IAC3B,IAAI,EAAE,iBAAiB;CACf,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC,MAAM,CAAC;AAErE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,SAAS,EAAE,oBAAoB,CAAU,CAAC;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/cli/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,mBAAmB;IACnB,eAAe;CACP,CAAC;AAEX,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,KAAK,EAAE,kBAAkB;IACzB,MAAM,EAAE,mBAAmB;IAC3B,IAAI,EAAE,iBAAiB;CACf,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,CAAC,MAAM,CAAC;AAErE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,eAAe,EAAE,SAAS,EAAE,oBAAoB,CAAU,CAAC;AACxF,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,kBAAkB;IAClB,WAAW;IACX,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;CACT,CAAC;AACX,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAC1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC"}
|
package/dist/cli/program.js
CHANGED
|
@@ -7,6 +7,7 @@ import { registerInstallCommand } from "./commands/install.js";
|
|
|
7
7
|
import { registerRemoveCommand } from "./commands/remove.js";
|
|
8
8
|
import { registerDoctorCommand } from "./commands/doctor.js";
|
|
9
9
|
import { registerTestCommand } from "./commands/test.js";
|
|
10
|
+
import { registerQueryCommand } from "./commands/query.js";
|
|
10
11
|
export function createProgram(dependencies) {
|
|
11
12
|
const container = createCliContainer(dependencies);
|
|
12
13
|
const program = bootstrapProgram(container);
|
|
@@ -28,6 +29,7 @@ function bootstrapProgram(container) {
|
|
|
28
29
|
registerInstallCommand(program, container);
|
|
29
30
|
registerConfigureCommand(program, container);
|
|
30
31
|
registerSpawnCommand(program, container);
|
|
32
|
+
registerQueryCommand(program, container);
|
|
31
33
|
registerTestCommand(program, container);
|
|
32
34
|
registerRemoveCommand(program, container);
|
|
33
35
|
registerDoctorCommand(program, container);
|
package/dist/cli/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,kBAAkB,EAGnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/cli/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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
3
|
import { openCodeService } from "./opencode.js";
|
|
4
|
+
import { kimiService } from "./kimi.js";
|
|
4
5
|
export function getDefaultProviders() {
|
|
5
|
-
return [claudeCodeService, codexService, openCodeService];
|
|
6
|
+
return [claudeCodeService, codexService, openCodeService, kimiService];
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,MAAM,UAAU,mBAAmB;IACjC,OAAO,CAAC,iBAAiB,EAAE,YAAY,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ServiceInstallDefinition } from "../services/service-install.js";
|
|
2
|
+
type KimiConfigureOptions = {
|
|
3
|
+
defaultModel: string;
|
|
4
|
+
};
|
|
5
|
+
type KimiRemoveOptions = Record<string, never>;
|
|
6
|
+
type KimiSpawnOptions = {
|
|
7
|
+
prompt: string;
|
|
8
|
+
args?: string[];
|
|
9
|
+
model?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const KIMI_INSTALL_DEFINITION: ServiceInstallDefinition;
|
|
12
|
+
export declare const kimiService: import("../cli/service-registry.js").ProviderService<Record<string, any>, KimiConfigureOptions, KimiRemoveOptions, KimiSpawnOptions>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createBinaryExistsCheck, createCommandExpectationCheck } from "../utils/command-checks.js";
|
|
2
|
+
import { ensureDirectory, jsonMergeMutation, jsonPruneMutation } from "../services/service-manifest.js";
|
|
3
|
+
import { KIMI_MODELS, DEFAULT_KIMI_MODEL, PROVIDER_NAME } from "../cli/constants.js";
|
|
4
|
+
import { createProvider } from "./create-provider.js";
|
|
5
|
+
import { createBinaryVersionResolver } from "./versioned-provider.js";
|
|
6
|
+
export const KIMI_INSTALL_DEFINITION = {
|
|
7
|
+
id: "kimi",
|
|
8
|
+
summary: "Kimi CLI",
|
|
9
|
+
check: createBinaryExistsCheck("kimi", "kimi-cli-binary", "Kimi CLI binary must exist"),
|
|
10
|
+
steps: [
|
|
11
|
+
{
|
|
12
|
+
id: "install-kimi-cli-uv",
|
|
13
|
+
command: "uv",
|
|
14
|
+
args: ["tool", "install", "--python", "3.13", "kimi-cli"]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
successMessage: "Installed Kimi CLI via uv."
|
|
18
|
+
};
|
|
19
|
+
function providerModel(model) {
|
|
20
|
+
const prefix = `${PROVIDER_NAME}/`;
|
|
21
|
+
return model.startsWith(prefix) ? model : `${prefix}${model}`;
|
|
22
|
+
}
|
|
23
|
+
function buildKimiArgs(prompt, extraArgs) {
|
|
24
|
+
return [prompt, ...(extraArgs ?? [])];
|
|
25
|
+
}
|
|
26
|
+
export const kimiService = createProvider({
|
|
27
|
+
name: "kimi",
|
|
28
|
+
label: "Kimi",
|
|
29
|
+
id: "kimi",
|
|
30
|
+
summary: "Configure Kimi CLI to use Poe API",
|
|
31
|
+
branding: {
|
|
32
|
+
colors: {
|
|
33
|
+
dark: "#7B68EE",
|
|
34
|
+
light: "#6A5ACD"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
configurePrompts: {
|
|
38
|
+
model: {
|
|
39
|
+
label: "Kimi default model",
|
|
40
|
+
defaultValue: DEFAULT_KIMI_MODEL,
|
|
41
|
+
choices: KIMI_MODELS.map((id) => ({
|
|
42
|
+
title: id,
|
|
43
|
+
value: id
|
|
44
|
+
}))
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
test(context) {
|
|
48
|
+
return context.runCheck(createCommandExpectationCheck({
|
|
49
|
+
id: "kimi-cli-health",
|
|
50
|
+
command: "kimi",
|
|
51
|
+
args: buildKimiArgs("Output exactly: KIMI_OK"),
|
|
52
|
+
expectedOutput: "KIMI_OK"
|
|
53
|
+
}));
|
|
54
|
+
},
|
|
55
|
+
manifest: {
|
|
56
|
+
"*": {
|
|
57
|
+
configure: [
|
|
58
|
+
ensureDirectory({
|
|
59
|
+
path: "~/.kimi"
|
|
60
|
+
}),
|
|
61
|
+
jsonMergeMutation({
|
|
62
|
+
target: "~/.kimi/config.json",
|
|
63
|
+
value: ({ options }) => {
|
|
64
|
+
const { defaultModel, apiKey } = (options ?? {});
|
|
65
|
+
const selectedModel = defaultModel ?? DEFAULT_KIMI_MODEL;
|
|
66
|
+
return {
|
|
67
|
+
default_model: providerModel(selectedModel),
|
|
68
|
+
models: {
|
|
69
|
+
[providerModel(selectedModel)]: {
|
|
70
|
+
provider: PROVIDER_NAME,
|
|
71
|
+
model: selectedModel,
|
|
72
|
+
max_context_size: 256000
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
providers: {
|
|
76
|
+
[PROVIDER_NAME]: {
|
|
77
|
+
type: "openai",
|
|
78
|
+
base_url: "https://api.poe.com/v1",
|
|
79
|
+
api_key: apiKey ?? ""
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
],
|
|
86
|
+
remove: [
|
|
87
|
+
jsonPruneMutation({
|
|
88
|
+
target: "~/.kimi/config.json",
|
|
89
|
+
shape: () => ({
|
|
90
|
+
providers: {
|
|
91
|
+
[PROVIDER_NAME]: true
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
versionResolver: createBinaryVersionResolver("kimi"),
|
|
99
|
+
install: KIMI_INSTALL_DEFINITION,
|
|
100
|
+
spawn(context, options) {
|
|
101
|
+
const args = buildKimiArgs(options.prompt, options.args);
|
|
102
|
+
return context.command.runCommand("kimi", args);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=kimi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kimi.js","sourceRoot":"","sources":["../../src/providers/kimi.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC9B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAetE,MAAM,CAAC,MAAM,uBAAuB,GAA6B;IAC/D,EAAE,EAAE,MAAM;IACV,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,uBAAuB,CAC5B,MAAM,EACN,iBAAiB,EACjB,4BAA4B,CAC7B;IACD,KAAK,EAAE;QACL;YACE,EAAE,EAAE,qBAAqB;YACzB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC;SAC1D;KACF;IACD,cAAc,EAAE,4BAA4B;CAC7C,CAAC;AAEF,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,GAAG,aAAa,GAAG,CAAC;IACnC,OAAO,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CAAC,OAAO,IAAI,EAAE,CAG9C,CAAC;wBACF,MAAM,aAAa,GAAG,YAAY,IAAI,kBAAkB,CAAC;wBACzD,OAAO;4BACL,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC;4BAC3C,MAAM,EAAE;gCACN,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,EAAE;oCAC9B,QAAQ,EAAE,aAAa;oCACvB,KAAK,EAAE,aAAa;oCACpB,gBAAgB,EAAE,MAAM;iCACzB;6BACF;4BACD,SAAS,EAAE;gCACT,CAAC,aAAa,CAAC,EAAE;oCACf,IAAI,EAAE,QAAQ;oCACd,QAAQ,EAAE,wBAAwB;oCAClC,OAAO,EAAE,MAAM,IAAI,EAAE;iCACtB;6BACF;yBACF,CAAC;oBACJ,CAAC;iBACF,CAAC;aACH;YACD,MAAM,EAAE;gBACN,iBAAiB,CAAC;oBAChB,MAAM,EAAE,qBAAqB;oBAC7B,KAAK,EAAE,GAAe,EAAE,CAAC,CAAC;wBACxB,SAAS,EAAE;4BACT,CAAC,aAAa,CAAC,EAAE,IAAI;yBACtB;qBACF,CAAC;iBACH,CAAC;aACH;SACF;KACF;IACD,eAAe,EAAE,2BAA2B,CAAC,MAAM,CAAC;IACpD,OAAO,EAAE,uBAAuB;IAChC,KAAK,CAAC,OAAO,EAAE,OAAO;QACpB,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACzD,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAClD,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-code",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
4
4
|
"description": "CLI tool to configure Poe API for developer workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"commander": "^11.1.0",
|
|
34
34
|
"diff": "^5.2.0",
|
|
35
35
|
"handlebars": "^4.7.8",
|
|
36
|
+
"openai": "^6.9.1",
|
|
36
37
|
"prompts": "^2.4.2",
|
|
37
38
|
"semver": "^7.7.3"
|
|
38
39
|
},
|