@apholdings/jensen-ai 0.0.1 → 0.0.2
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 +29 -29
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -6
- package/dist/cli.js.map +1 -1
- package/dist/models.generated.d.ts +88 -105
- package/dist/models.generated.d.ts.map +1 -1
- package/dist/models.generated.js +104 -121
- package/dist/models.generated.js.map +1 -1
- package/dist/providers/google-gemini-cli.d.ts.map +1 -1
- package/dist/providers/google-gemini-cli.js +1 -1
- package/dist/providers/google-gemini-cli.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @apholdings/jensen-ai
|
|
2
2
|
|
|
3
3
|
Unified LLM API with automatic model discovery, provider configuration, token and cost tracking, and simple context persistence and hand-off to other models mid-session.
|
|
4
4
|
|
|
@@ -72,15 +72,15 @@ Unified LLM API with automatic model discovery, provider configuration, token an
|
|
|
72
72
|
## Installation
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
npm install @
|
|
75
|
+
npm install @apholdings/jensen-ai
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
TypeBox exports are re-exported from `@
|
|
78
|
+
TypeBox exports are re-exported from `@apholdings/jensen-ai`: `Type`, `Static`, and `TSchema`.
|
|
79
79
|
|
|
80
80
|
## Quick Start
|
|
81
81
|
|
|
82
82
|
```typescript
|
|
83
|
-
import { Type, getModel, stream, complete, Context, Tool, StringEnum } from '@
|
|
83
|
+
import { Type, getModel, stream, complete, Context, Tool, StringEnum } from '@apholdings/jensen-ai';
|
|
84
84
|
|
|
85
85
|
// Fully typed with auto-complete support for both providers and models
|
|
86
86
|
const model = getModel('openai', 'gpt-4o-mini');
|
|
@@ -206,7 +206,7 @@ Tools enable LLMs to interact with external systems. This library uses TypeBox s
|
|
|
206
206
|
### Defining Tools
|
|
207
207
|
|
|
208
208
|
```typescript
|
|
209
|
-
import { Type, Tool, StringEnum } from '@
|
|
209
|
+
import { Type, Tool, StringEnum } from '@apholdings/jensen-ai';
|
|
210
210
|
|
|
211
211
|
// Define tool parameters with TypeBox
|
|
212
212
|
const weatherTool: Tool = {
|
|
@@ -332,7 +332,7 @@ When using `agentLoop`, tool arguments are automatically validated against your
|
|
|
332
332
|
When implementing your own tool execution loop with `stream()` or `complete()`, use `validateToolCall` to validate arguments before passing them to your tools:
|
|
333
333
|
|
|
334
334
|
```typescript
|
|
335
|
-
import { stream, validateToolCall, Tool } from '@
|
|
335
|
+
import { stream, validateToolCall, Tool } from '@apholdings/jensen-ai';
|
|
336
336
|
|
|
337
337
|
const tools: Tool[] = [weatherTool, calculatorTool];
|
|
338
338
|
const s = stream(model, { messages, tools });
|
|
@@ -386,7 +386,7 @@ Models with vision capabilities can process images. You can check if a model sup
|
|
|
386
386
|
|
|
387
387
|
```typescript
|
|
388
388
|
import { readFileSync } from 'fs';
|
|
389
|
-
import { getModel, complete } from '@
|
|
389
|
+
import { getModel, complete } from '@apholdings/jensen-ai';
|
|
390
390
|
|
|
391
391
|
const model = getModel('openai', 'gpt-4o-mini');
|
|
392
392
|
|
|
@@ -423,7 +423,7 @@ Many models support thinking/reasoning capabilities where they can show their in
|
|
|
423
423
|
### Unified Interface (streamSimple/completeSimple)
|
|
424
424
|
|
|
425
425
|
```typescript
|
|
426
|
-
import { getModel, streamSimple, completeSimple } from '@
|
|
426
|
+
import { getModel, streamSimple, completeSimple } from '@apholdings/jensen-ai';
|
|
427
427
|
|
|
428
428
|
// Many models across providers support thinking/reasoning
|
|
429
429
|
const model = getModel('anthropic', 'claude-sonnet-4-20250514');
|
|
@@ -461,7 +461,7 @@ for (const block of response.content) {
|
|
|
461
461
|
For fine-grained control, use the provider-specific options:
|
|
462
462
|
|
|
463
463
|
```typescript
|
|
464
|
-
import { getModel, complete } from '@
|
|
464
|
+
import { getModel, complete } from '@apholdings/jensen-ai';
|
|
465
465
|
|
|
466
466
|
// OpenAI Reasoning (o1, o3, gpt-5)
|
|
467
467
|
const openaiModel = getModel('openai', 'gpt-5-mini');
|
|
@@ -548,7 +548,7 @@ if (message.stopReason === 'error' || message.stopReason === 'aborted') {
|
|
|
548
548
|
The abort signal allows you to cancel in-progress requests. Aborted requests have `stopReason === 'aborted'`:
|
|
549
549
|
|
|
550
550
|
```typescript
|
|
551
|
-
import { getModel, stream } from '@
|
|
551
|
+
import { getModel, stream } from '@apholdings/jensen-ai';
|
|
552
552
|
|
|
553
553
|
const model = getModel('openai', 'gpt-4o-mini');
|
|
554
554
|
const controller = new AbortController();
|
|
@@ -646,7 +646,7 @@ A **provider** offers models through a specific API. For example:
|
|
|
646
646
|
### Querying Providers and Models
|
|
647
647
|
|
|
648
648
|
```typescript
|
|
649
|
-
import { getProviders, getModels, getModel } from '@
|
|
649
|
+
import { getProviders, getModels, getModel } from '@apholdings/jensen-ai';
|
|
650
650
|
|
|
651
651
|
// Get all available providers
|
|
652
652
|
const providers = getProviders();
|
|
@@ -672,7 +672,7 @@ console.log(`Using ${model.name} via ${model.api} API`);
|
|
|
672
672
|
You can create custom models for local inference servers or custom endpoints:
|
|
673
673
|
|
|
674
674
|
```typescript
|
|
675
|
-
import { Model, stream } from '@
|
|
675
|
+
import { Model, stream } from '@apholdings/jensen-ai';
|
|
676
676
|
|
|
677
677
|
// Example: Ollama using OpenAI-compatible API
|
|
678
678
|
const ollamaModel: Model<'openai-completions'> = {
|
|
@@ -765,7 +765,7 @@ If `compat` is not set, the library falls back to URL-based detection. If `compa
|
|
|
765
765
|
Models are typed by their API, which keeps the model metadata accurate. Provider-specific option types are enforced when you call the provider functions directly. The generic `stream` and `complete` functions accept `StreamOptions` with additional provider fields.
|
|
766
766
|
|
|
767
767
|
```typescript
|
|
768
|
-
import { streamAnthropic, type AnthropicOptions } from '@
|
|
768
|
+
import { streamAnthropic, type AnthropicOptions } from '@apholdings/jensen-ai';
|
|
769
769
|
|
|
770
770
|
// TypeScript knows this is an Anthropic model
|
|
771
771
|
const claude = getModel('anthropic', 'claude-sonnet-4-20250514');
|
|
@@ -794,7 +794,7 @@ When messages from one provider are sent to a different provider, the library au
|
|
|
794
794
|
### Example: Multi-Provider Conversation
|
|
795
795
|
|
|
796
796
|
```typescript
|
|
797
|
-
import { getModel, complete, Context } from '@
|
|
797
|
+
import { getModel, complete, Context } from '@apholdings/jensen-ai';
|
|
798
798
|
|
|
799
799
|
// Start with Claude
|
|
800
800
|
const claude = getModel('anthropic', 'claude-sonnet-4-20250514');
|
|
@@ -839,7 +839,7 @@ This enables flexible workflows where you can:
|
|
|
839
839
|
The `Context` object can be easily serialized and deserialized using standard JSON methods, making it simple to persist conversations, implement chat history, or transfer contexts between services:
|
|
840
840
|
|
|
841
841
|
```typescript
|
|
842
|
-
import { Context, getModel, complete } from '@
|
|
842
|
+
import { Context, getModel, complete } from '@apholdings/jensen-ai';
|
|
843
843
|
|
|
844
844
|
// Create and use a context
|
|
845
845
|
const context: Context = {
|
|
@@ -876,7 +876,7 @@ const continuation = await complete(newModel, restored);
|
|
|
876
876
|
The library supports browser environments. You must pass the API key explicitly since environment variables are not available in browsers:
|
|
877
877
|
|
|
878
878
|
```typescript
|
|
879
|
-
import { getModel, complete } from '@
|
|
879
|
+
import { getModel, complete } from '@apholdings/jensen-ai';
|
|
880
880
|
|
|
881
881
|
// API key must be passed explicitly in browser
|
|
882
882
|
const model = getModel('anthropic', 'claude-3-5-haiku-20241022');
|
|
@@ -893,7 +893,7 @@ const response = await complete(model, {
|
|
|
893
893
|
### Browser Compatibility Notes
|
|
894
894
|
|
|
895
895
|
- Amazon Bedrock (`bedrock-converse-stream`) is not supported in browser environments.
|
|
896
|
-
- OAuth login flows are not supported in browser environments. Use the `@
|
|
896
|
+
- OAuth login flows are not supported in browser environments. Use the `@apholdings/jensen-ai/oauth` entry point in Node.js.
|
|
897
897
|
- In browser builds, Bedrock can still appear in model lists. Calls to Bedrock models fail at runtime.
|
|
898
898
|
- Use a server-side proxy or backend service if you need Bedrock or OAuth-based auth from a web app.
|
|
899
899
|
|
|
@@ -935,10 +935,10 @@ const response = await complete(model, context, {
|
|
|
935
935
|
|
|
936
936
|
#### Antigravity Version Override
|
|
937
937
|
|
|
938
|
-
Set `
|
|
938
|
+
Set `JENSEN_AI_ANTIGRAVITY_VERSION` to override the Antigravity User-Agent version when Google updates their requirements:
|
|
939
939
|
|
|
940
940
|
```bash
|
|
941
|
-
export
|
|
941
|
+
export JENSEN_AI_ANTIGRAVITY_VERSION="1.23.0"
|
|
942
942
|
```
|
|
943
943
|
|
|
944
944
|
#### Cache Retention
|
|
@@ -957,7 +957,7 @@ This only affects direct API calls to `api.anthropic.com` and `api.openai.com`.
|
|
|
957
957
|
### Checking Environment Variables
|
|
958
958
|
|
|
959
959
|
```typescript
|
|
960
|
-
import { getEnvApiKey } from '@
|
|
960
|
+
import { getEnvApiKey } from '@apholdings/jensen-ai';
|
|
961
961
|
|
|
962
962
|
// Check if an API key is set in environment variables
|
|
963
963
|
const key = getEnvApiKey('openai'); // checks OPENAI_API_KEY
|
|
@@ -998,7 +998,7 @@ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
|
|
|
998
998
|
```
|
|
999
999
|
|
|
1000
1000
|
```typescript
|
|
1001
|
-
import { getModel, complete } from '@
|
|
1001
|
+
import { getModel, complete } from '@apholdings/jensen-ai';
|
|
1002
1002
|
|
|
1003
1003
|
(async () => {
|
|
1004
1004
|
const model = getModel('google-vertex', 'gemini-2.5-flash');
|
|
@@ -1021,16 +1021,16 @@ Official docs: [Application Default Credentials](https://cloud.google.com/docs/a
|
|
|
1021
1021
|
The quickest way to authenticate:
|
|
1022
1022
|
|
|
1023
1023
|
```bash
|
|
1024
|
-
npx @
|
|
1025
|
-
npx @
|
|
1026
|
-
npx @
|
|
1024
|
+
npx @apholdings/jensen-ai login # interactive provider selection
|
|
1025
|
+
npx @apholdings/jensen-ai login anthropic # login to specific provider
|
|
1026
|
+
npx @apholdings/jensen-ai list # list available providers
|
|
1027
1027
|
```
|
|
1028
1028
|
|
|
1029
1029
|
Credentials are saved to `auth.json` in the current directory.
|
|
1030
1030
|
|
|
1031
1031
|
### Programmatic OAuth
|
|
1032
1032
|
|
|
1033
|
-
The library provides login and token refresh functions via the `@
|
|
1033
|
+
The library provides login and token refresh functions via the `@apholdings/jensen-ai/oauth` entry point. Credential storage is the caller's responsibility.
|
|
1034
1034
|
|
|
1035
1035
|
```typescript
|
|
1036
1036
|
import {
|
|
@@ -1048,13 +1048,13 @@ import {
|
|
|
1048
1048
|
// Types
|
|
1049
1049
|
type OAuthProvider, // 'anthropic' | 'openai-codex' | 'github-copilot' | 'google-gemini-cli' | 'google-antigravity'
|
|
1050
1050
|
type OAuthCredentials,
|
|
1051
|
-
} from '@
|
|
1051
|
+
} from '@apholdings/jensen-ai/oauth';
|
|
1052
1052
|
```
|
|
1053
1053
|
|
|
1054
1054
|
### Login Flow Example
|
|
1055
1055
|
|
|
1056
1056
|
```typescript
|
|
1057
|
-
import { loginGitHubCopilot } from '@
|
|
1057
|
+
import { loginGitHubCopilot } from '@apholdings/jensen-ai/oauth';
|
|
1058
1058
|
import { writeFileSync } from 'fs';
|
|
1059
1059
|
|
|
1060
1060
|
const credentials = await loginGitHubCopilot({
|
|
@@ -1078,8 +1078,8 @@ writeFileSync('auth.json', JSON.stringify(auth, null, 2));
|
|
|
1078
1078
|
Use `getOAuthApiKey()` to get an API key, automatically refreshing if expired:
|
|
1079
1079
|
|
|
1080
1080
|
```typescript
|
|
1081
|
-
import { getModel, complete } from '@
|
|
1082
|
-
import { getOAuthApiKey } from '@
|
|
1081
|
+
import { getModel, complete } from '@apholdings/jensen-ai';
|
|
1082
|
+
import { getOAuthApiKey } from '@apholdings/jensen-ai/oauth';
|
|
1083
1083
|
import { readFileSync, writeFileSync } from 'fs';
|
|
1084
1084
|
|
|
1085
1085
|
// Load your stored credentials
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { getOAuthProvider, getOAuthProviders } from \"./utils/oauth/index.js\";\nimport type { OAuthCredentials, OAuthProviderId } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(providerId: OAuthProviderId): Promise<void> {\n\tconst provider = getOAuthProvider(providerId);\n\tif (!provider) {\n\t\tconsole.error(`Unknown provider: ${providerId}`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tconst credentials = await provider.login({\n\t\t\tonAuth: (info) => {\n\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\tconsole.log();\n\t\t\t},\n\t\t\tonPrompt: async (p) => {\n\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t},\n\t\t\tonProgress: (msg) => console.log(msg),\n\t\t});\n\n\t\tconst auth = loadAuth();\n\t\tauth[providerId] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconst providerList = PROVIDERS.map((p) => ` ${p.id.padEnd(20)} ${p.name}`).join(\"\\n\");\n\t\tconsole.log(`Usage: npx @
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { getOAuthProvider, getOAuthProviders } from \"./utils/oauth/index.js\";\nimport type { OAuthCredentials, OAuthProviderId } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(providerId: OAuthProviderId): Promise<void> {\n\tconst provider = getOAuthProvider(providerId);\n\tif (!provider) {\n\t\tconsole.error(`Unknown provider: ${providerId}`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tconst credentials = await provider.login({\n\t\t\tonAuth: (info) => {\n\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\tconsole.log();\n\t\t\t},\n\t\t\tonPrompt: async (p) => {\n\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t},\n\t\t\tonProgress: (msg) => console.log(msg),\n\t\t});\n\n\t\tconst auth = loadAuth();\n\t\tauth[providerId] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconst providerList = PROVIDERS.map((p) => ` ${p.id.padEnd(20)} ${p.name}`).join(\"\\n\");\n\t\tconsole.log(`Usage: npx @apholdings/jensen-ai <command> [provider]\n\nCommands:\n login [provider] Login to an OAuth provider\n list List available providers\n\nProviders:\n${providerList}\n\nExamples:\n npx @apholdings/jensen-ai login # interactive provider selection\n npx @apholdings/jensen-ai login anthropic # login to specific provider\n npx @apholdings/jensen-ai list # list providers\n`);\n\t\treturn;\n\t}\n\n\tif (command === \"list\") {\n\t\tconsole.log(\"Available OAuth providers:\\n\");\n\t\tfor (const p of PROVIDERS) {\n\t\t\tconsole.log(` ${p.id.padEnd(20)} ${p.name}`);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (command === \"login\") {\n\t\tlet provider = args[1] as OAuthProviderId | undefined;\n\n\t\tif (!provider) {\n\t\t\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\t\t\tconsole.log(\"Select a provider:\\n\");\n\t\t\tfor (let i = 0; i < PROVIDERS.length; i++) {\n\t\t\t\tconsole.log(` ${i + 1}. ${PROVIDERS[i].name}`);\n\t\t\t}\n\t\t\tconsole.log();\n\n\t\t\tconst choice = await prompt(rl, `Enter number (1-${PROVIDERS.length}): `);\n\t\t\trl.close();\n\n\t\t\tconst index = parseInt(choice, 10) - 1;\n\t\t\tif (index < 0 || index >= PROVIDERS.length) {\n\t\t\t\tconsole.error(\"Invalid selection\");\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tprovider = PROVIDERS[index].id;\n\t\t}\n\n\t\tif (!PROVIDERS.some((p) => p.id === provider)) {\n\t\t\tconsole.error(`Unknown provider: ${provider}`);\n\t\t\tconsole.error(`Use 'npx @apholdings/jensen-ai list' to see available providers`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconsole.log(`Logging in to ${provider}...`);\n\t\tawait login(provider);\n\t\treturn;\n\t}\n\n\tconsole.error(`Unknown command: ${command}`);\n\tconsole.error(`Use 'npx @apholdings/jensen-ai --help' for usage`);\n\tprocess.exit(1);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"Error:\", err.message);\n\tprocess.exit(1);\n});\n"]}
|
package/dist/cli.js
CHANGED
|
@@ -55,7 +55,7 @@ async function main() {
|
|
|
55
55
|
const command = args[0];
|
|
56
56
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
57
57
|
const providerList = PROVIDERS.map((p) => ` ${p.id.padEnd(20)} ${p.name}`).join("\n");
|
|
58
|
-
console.log(`Usage: npx @
|
|
58
|
+
console.log(`Usage: npx @apholdings/jensen-ai <command> [provider]
|
|
59
59
|
|
|
60
60
|
Commands:
|
|
61
61
|
login [provider] Login to an OAuth provider
|
|
@@ -65,9 +65,9 @@ Providers:
|
|
|
65
65
|
${providerList}
|
|
66
66
|
|
|
67
67
|
Examples:
|
|
68
|
-
npx @
|
|
69
|
-
npx @
|
|
70
|
-
npx @
|
|
68
|
+
npx @apholdings/jensen-ai login # interactive provider selection
|
|
69
|
+
npx @apholdings/jensen-ai login anthropic # login to specific provider
|
|
70
|
+
npx @apholdings/jensen-ai list # list providers
|
|
71
71
|
`);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
@@ -98,7 +98,7 @@ Examples:
|
|
|
98
98
|
}
|
|
99
99
|
if (!PROVIDERS.some((p) => p.id === provider)) {
|
|
100
100
|
console.error(`Unknown provider: ${provider}`);
|
|
101
|
-
console.error(`Use 'npx @
|
|
101
|
+
console.error(`Use 'npx @apholdings/jensen-ai list' to see available providers`);
|
|
102
102
|
process.exit(1);
|
|
103
103
|
}
|
|
104
104
|
console.log(`Logging in to ${provider}...`);
|
|
@@ -106,7 +106,7 @@ Examples:
|
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
console.error(`Unknown command: ${command}`);
|
|
109
|
-
console.error(`Use 'npx @
|
|
109
|
+
console.error(`Use 'npx @apholdings/jensen-ai --help' for usage`);
|
|
110
110
|
process.exit(1);
|
|
111
111
|
}
|
|
112
112
|
main().catch((err) => {
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG7E,MAAM,SAAS,GAAG,WAAW,CAAC;AAC9B,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;AAEtC,SAAS,MAAM,CAAC,EAAsC,EAAE,QAAgB,EAAmB;IAC1F,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAAA,CAChE;AAED,SAAS,QAAQ,GAAyD;IACzE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,EAAE,CAAC;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AC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,KAAK,CAAC,CAAC;QAC5C,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;QACtB,OAAO;IACR,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAAA,CAChB;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IACrB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAAA,CAChB,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport { existsSync, readFileSync, writeFileSync } from \"fs\";\nimport { createInterface } from \"readline\";\nimport { getOAuthProvider, getOAuthProviders } from \"./utils/oauth/index.js\";\nimport type { OAuthCredentials, OAuthProviderId } from \"./utils/oauth/types.js\";\n\nconst AUTH_FILE = \"auth.json\";\nconst PROVIDERS = getOAuthProviders();\n\nfunction prompt(rl: ReturnType<typeof createInterface>, question: string): Promise<string> {\n\treturn new Promise((resolve) => rl.question(question, resolve));\n}\n\nfunction loadAuth(): Record<string, { type: \"oauth\" } & OAuthCredentials> {\n\tif (!existsSync(AUTH_FILE)) return {};\n\ttry {\n\t\treturn JSON.parse(readFileSync(AUTH_FILE, \"utf-8\"));\n\t} catch {\n\t\treturn {};\n\t}\n}\n\nfunction saveAuth(auth: Record<string, { type: \"oauth\" } & OAuthCredentials>): void {\n\twriteFileSync(AUTH_FILE, JSON.stringify(auth, null, 2), \"utf-8\");\n}\n\nasync function login(providerId: OAuthProviderId): Promise<void> {\n\tconst provider = getOAuthProvider(providerId);\n\tif (!provider) {\n\t\tconsole.error(`Unknown provider: ${providerId}`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\tconst promptFn = (msg: string) => prompt(rl, `${msg} `);\n\n\ttry {\n\t\tconst credentials = await provider.login({\n\t\t\tonAuth: (info) => {\n\t\t\t\tconsole.log(`\\nOpen this URL in your browser:\\n${info.url}`);\n\t\t\t\tif (info.instructions) console.log(info.instructions);\n\t\t\t\tconsole.log();\n\t\t\t},\n\t\t\tonPrompt: async (p) => {\n\t\t\t\treturn await promptFn(`${p.message}${p.placeholder ? ` (${p.placeholder})` : \"\"}:`);\n\t\t\t},\n\t\t\tonProgress: (msg) => console.log(msg),\n\t\t});\n\n\t\tconst auth = loadAuth();\n\t\tauth[providerId] = { type: \"oauth\", ...credentials };\n\t\tsaveAuth(auth);\n\n\t\tconsole.log(`\\nCredentials saved to ${AUTH_FILE}`);\n\t} finally {\n\t\trl.close();\n\t}\n}\n\nasync function main(): Promise<void> {\n\tconst args = process.argv.slice(2);\n\tconst command = args[0];\n\n\tif (!command || command === \"help\" || command === \"--help\" || command === \"-h\") {\n\t\tconst providerList = PROVIDERS.map((p) => ` ${p.id.padEnd(20)} ${p.name}`).join(\"\\n\");\n\t\tconsole.log(`Usage: npx @apholdings/jensen-ai <command> [provider]\n\nCommands:\n login [provider] Login to an OAuth provider\n list List available providers\n\nProviders:\n${providerList}\n\nExamples:\n npx @apholdings/jensen-ai login # interactive provider selection\n npx @apholdings/jensen-ai login anthropic # login to specific provider\n npx @apholdings/jensen-ai list # list providers\n`);\n\t\treturn;\n\t}\n\n\tif (command === \"list\") {\n\t\tconsole.log(\"Available OAuth providers:\\n\");\n\t\tfor (const p of PROVIDERS) {\n\t\t\tconsole.log(` ${p.id.padEnd(20)} ${p.name}`);\n\t\t}\n\t\treturn;\n\t}\n\n\tif (command === \"login\") {\n\t\tlet provider = args[1] as OAuthProviderId | undefined;\n\n\t\tif (!provider) {\n\t\t\tconst rl = createInterface({ input: process.stdin, output: process.stdout });\n\t\t\tconsole.log(\"Select a provider:\\n\");\n\t\t\tfor (let i = 0; i < PROVIDERS.length; i++) {\n\t\t\t\tconsole.log(` ${i + 1}. ${PROVIDERS[i].name}`);\n\t\t\t}\n\t\t\tconsole.log();\n\n\t\t\tconst choice = await prompt(rl, `Enter number (1-${PROVIDERS.length}): `);\n\t\t\trl.close();\n\n\t\t\tconst index = parseInt(choice, 10) - 1;\n\t\t\tif (index < 0 || index >= PROVIDERS.length) {\n\t\t\t\tconsole.error(\"Invalid selection\");\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t\tprovider = PROVIDERS[index].id;\n\t\t}\n\n\t\tif (!PROVIDERS.some((p) => p.id === provider)) {\n\t\t\tconsole.error(`Unknown provider: ${provider}`);\n\t\t\tconsole.error(`Use 'npx @apholdings/jensen-ai list' to see available providers`);\n\t\t\tprocess.exit(1);\n\t\t}\n\n\t\tconsole.log(`Logging in to ${provider}...`);\n\t\tawait login(provider);\n\t\treturn;\n\t}\n\n\tconsole.error(`Unknown command: ${command}`);\n\tconsole.error(`Use 'npx @apholdings/jensen-ai --help' for usage`);\n\tprocess.exit(1);\n}\n\nmain().catch((err) => {\n\tconsole.error(\"Error:\", err.message);\n\tprocess.exit(1);\n});\n"]}
|
|
@@ -85,40 +85,6 @@ export declare const MODELS: {
|
|
|
85
85
|
contextWindow: number;
|
|
86
86
|
maxTokens: number;
|
|
87
87
|
};
|
|
88
|
-
readonly "amazon.titan-text-express-v1": {
|
|
89
|
-
id: string;
|
|
90
|
-
name: string;
|
|
91
|
-
api: "bedrock-converse-stream";
|
|
92
|
-
provider: string;
|
|
93
|
-
baseUrl: string;
|
|
94
|
-
reasoning: false;
|
|
95
|
-
input: "text"[];
|
|
96
|
-
cost: {
|
|
97
|
-
input: number;
|
|
98
|
-
output: number;
|
|
99
|
-
cacheRead: number;
|
|
100
|
-
cacheWrite: number;
|
|
101
|
-
};
|
|
102
|
-
contextWindow: number;
|
|
103
|
-
maxTokens: number;
|
|
104
|
-
};
|
|
105
|
-
readonly "amazon.titan-text-express-v1:0:8k": {
|
|
106
|
-
id: string;
|
|
107
|
-
name: string;
|
|
108
|
-
api: "bedrock-converse-stream";
|
|
109
|
-
provider: string;
|
|
110
|
-
baseUrl: string;
|
|
111
|
-
reasoning: false;
|
|
112
|
-
input: "text"[];
|
|
113
|
-
cost: {
|
|
114
|
-
input: number;
|
|
115
|
-
output: number;
|
|
116
|
-
cacheRead: number;
|
|
117
|
-
cacheWrite: number;
|
|
118
|
-
};
|
|
119
|
-
contextWindow: number;
|
|
120
|
-
maxTokens: number;
|
|
121
|
-
};
|
|
122
88
|
readonly "anthropic.claude-3-5-haiku-20241022-v1:0": {
|
|
123
89
|
id: string;
|
|
124
90
|
name: string;
|
|
@@ -204,40 +170,6 @@ export declare const MODELS: {
|
|
|
204
170
|
contextWindow: number;
|
|
205
171
|
maxTokens: number;
|
|
206
172
|
};
|
|
207
|
-
readonly "anthropic.claude-3-opus-20240229-v1:0": {
|
|
208
|
-
id: string;
|
|
209
|
-
name: string;
|
|
210
|
-
api: "bedrock-converse-stream";
|
|
211
|
-
provider: string;
|
|
212
|
-
baseUrl: string;
|
|
213
|
-
reasoning: false;
|
|
214
|
-
input: ("image" | "text")[];
|
|
215
|
-
cost: {
|
|
216
|
-
input: number;
|
|
217
|
-
output: number;
|
|
218
|
-
cacheRead: number;
|
|
219
|
-
cacheWrite: number;
|
|
220
|
-
};
|
|
221
|
-
contextWindow: number;
|
|
222
|
-
maxTokens: number;
|
|
223
|
-
};
|
|
224
|
-
readonly "anthropic.claude-3-sonnet-20240229-v1:0": {
|
|
225
|
-
id: string;
|
|
226
|
-
name: string;
|
|
227
|
-
api: "bedrock-converse-stream";
|
|
228
|
-
provider: string;
|
|
229
|
-
baseUrl: string;
|
|
230
|
-
reasoning: false;
|
|
231
|
-
input: ("image" | "text")[];
|
|
232
|
-
cost: {
|
|
233
|
-
input: number;
|
|
234
|
-
output: number;
|
|
235
|
-
cacheRead: number;
|
|
236
|
-
cacheWrite: number;
|
|
237
|
-
};
|
|
238
|
-
contextWindow: number;
|
|
239
|
-
maxTokens: number;
|
|
240
|
-
};
|
|
241
173
|
readonly "anthropic.claude-haiku-4-5-20251001-v1:0": {
|
|
242
174
|
id: string;
|
|
243
175
|
name: string;
|
|
@@ -374,40 +306,6 @@ export declare const MODELS: {
|
|
|
374
306
|
contextWindow: number;
|
|
375
307
|
maxTokens: number;
|
|
376
308
|
};
|
|
377
|
-
readonly "cohere.command-r-plus-v1:0": {
|
|
378
|
-
id: string;
|
|
379
|
-
name: string;
|
|
380
|
-
api: "bedrock-converse-stream";
|
|
381
|
-
provider: string;
|
|
382
|
-
baseUrl: string;
|
|
383
|
-
reasoning: false;
|
|
384
|
-
input: "text"[];
|
|
385
|
-
cost: {
|
|
386
|
-
input: number;
|
|
387
|
-
output: number;
|
|
388
|
-
cacheRead: number;
|
|
389
|
-
cacheWrite: number;
|
|
390
|
-
};
|
|
391
|
-
contextWindow: number;
|
|
392
|
-
maxTokens: number;
|
|
393
|
-
};
|
|
394
|
-
readonly "cohere.command-r-v1:0": {
|
|
395
|
-
id: string;
|
|
396
|
-
name: string;
|
|
397
|
-
api: "bedrock-converse-stream";
|
|
398
|
-
provider: string;
|
|
399
|
-
baseUrl: string;
|
|
400
|
-
reasoning: false;
|
|
401
|
-
input: "text"[];
|
|
402
|
-
cost: {
|
|
403
|
-
input: number;
|
|
404
|
-
output: number;
|
|
405
|
-
cacheRead: number;
|
|
406
|
-
cacheWrite: number;
|
|
407
|
-
};
|
|
408
|
-
contextWindow: number;
|
|
409
|
-
maxTokens: number;
|
|
410
|
-
};
|
|
411
309
|
readonly "deepseek.r1-v1:0": {
|
|
412
310
|
id: string;
|
|
413
311
|
name: string;
|
|
@@ -442,7 +340,7 @@ export declare const MODELS: {
|
|
|
442
340
|
contextWindow: number;
|
|
443
341
|
maxTokens: number;
|
|
444
342
|
};
|
|
445
|
-
readonly "deepseek.v3.2
|
|
343
|
+
readonly "deepseek.v3.2": {
|
|
446
344
|
id: string;
|
|
447
345
|
name: string;
|
|
448
346
|
api: "bedrock-converse-stream";
|
|
@@ -697,6 +595,23 @@ export declare const MODELS: {
|
|
|
697
595
|
contextWindow: number;
|
|
698
596
|
maxTokens: number;
|
|
699
597
|
};
|
|
598
|
+
readonly "meta.llama3-1-405b-instruct-v1:0": {
|
|
599
|
+
id: string;
|
|
600
|
+
name: string;
|
|
601
|
+
api: "bedrock-converse-stream";
|
|
602
|
+
provider: string;
|
|
603
|
+
baseUrl: string;
|
|
604
|
+
reasoning: false;
|
|
605
|
+
input: "text"[];
|
|
606
|
+
cost: {
|
|
607
|
+
input: number;
|
|
608
|
+
output: number;
|
|
609
|
+
cacheRead: number;
|
|
610
|
+
cacheWrite: number;
|
|
611
|
+
};
|
|
612
|
+
contextWindow: number;
|
|
613
|
+
maxTokens: number;
|
|
614
|
+
};
|
|
700
615
|
readonly "meta.llama3-1-70b-instruct-v1:0": {
|
|
701
616
|
id: string;
|
|
702
617
|
name: string;
|
|
@@ -901,6 +816,23 @@ export declare const MODELS: {
|
|
|
901
816
|
contextWindow: number;
|
|
902
817
|
maxTokens: number;
|
|
903
818
|
};
|
|
819
|
+
readonly "mistral.magistral-small-2509": {
|
|
820
|
+
id: string;
|
|
821
|
+
name: string;
|
|
822
|
+
api: "bedrock-converse-stream";
|
|
823
|
+
provider: string;
|
|
824
|
+
baseUrl: string;
|
|
825
|
+
reasoning: true;
|
|
826
|
+
input: ("image" | "text")[];
|
|
827
|
+
cost: {
|
|
828
|
+
input: number;
|
|
829
|
+
output: number;
|
|
830
|
+
cacheRead: number;
|
|
831
|
+
cacheWrite: number;
|
|
832
|
+
};
|
|
833
|
+
contextWindow: number;
|
|
834
|
+
maxTokens: number;
|
|
835
|
+
};
|
|
904
836
|
readonly "mistral.ministral-3-14b-instruct": {
|
|
905
837
|
id: string;
|
|
906
838
|
name: string;
|
|
@@ -918,6 +850,23 @@ export declare const MODELS: {
|
|
|
918
850
|
contextWindow: number;
|
|
919
851
|
maxTokens: number;
|
|
920
852
|
};
|
|
853
|
+
readonly "mistral.ministral-3-3b-instruct": {
|
|
854
|
+
id: string;
|
|
855
|
+
name: string;
|
|
856
|
+
api: "bedrock-converse-stream";
|
|
857
|
+
provider: string;
|
|
858
|
+
baseUrl: string;
|
|
859
|
+
reasoning: false;
|
|
860
|
+
input: ("image" | "text")[];
|
|
861
|
+
cost: {
|
|
862
|
+
input: number;
|
|
863
|
+
output: number;
|
|
864
|
+
cacheRead: number;
|
|
865
|
+
cacheWrite: number;
|
|
866
|
+
};
|
|
867
|
+
contextWindow: number;
|
|
868
|
+
maxTokens: number;
|
|
869
|
+
};
|
|
921
870
|
readonly "mistral.ministral-3-8b-instruct": {
|
|
922
871
|
id: string;
|
|
923
872
|
name: string;
|
|
@@ -935,14 +884,31 @@ export declare const MODELS: {
|
|
|
935
884
|
contextWindow: number;
|
|
936
885
|
maxTokens: number;
|
|
937
886
|
};
|
|
938
|
-
readonly "mistral.mistral-large-
|
|
887
|
+
readonly "mistral.mistral-large-3-675b-instruct": {
|
|
939
888
|
id: string;
|
|
940
889
|
name: string;
|
|
941
890
|
api: "bedrock-converse-stream";
|
|
942
891
|
provider: string;
|
|
943
892
|
baseUrl: string;
|
|
944
893
|
reasoning: false;
|
|
945
|
-
input: "text"[];
|
|
894
|
+
input: ("image" | "text")[];
|
|
895
|
+
cost: {
|
|
896
|
+
input: number;
|
|
897
|
+
output: number;
|
|
898
|
+
cacheRead: number;
|
|
899
|
+
cacheWrite: number;
|
|
900
|
+
};
|
|
901
|
+
contextWindow: number;
|
|
902
|
+
maxTokens: number;
|
|
903
|
+
};
|
|
904
|
+
readonly "mistral.pixtral-large-2502-v1:0": {
|
|
905
|
+
id: string;
|
|
906
|
+
name: string;
|
|
907
|
+
api: "bedrock-converse-stream";
|
|
908
|
+
provider: string;
|
|
909
|
+
baseUrl: string;
|
|
910
|
+
reasoning: false;
|
|
911
|
+
input: ("image" | "text")[];
|
|
946
912
|
cost: {
|
|
947
913
|
input: number;
|
|
948
914
|
output: number;
|
|
@@ -1037,6 +1003,23 @@ export declare const MODELS: {
|
|
|
1037
1003
|
contextWindow: number;
|
|
1038
1004
|
maxTokens: number;
|
|
1039
1005
|
};
|
|
1006
|
+
readonly "nvidia.nemotron-nano-3-30b": {
|
|
1007
|
+
id: string;
|
|
1008
|
+
name: string;
|
|
1009
|
+
api: "bedrock-converse-stream";
|
|
1010
|
+
provider: string;
|
|
1011
|
+
baseUrl: string;
|
|
1012
|
+
reasoning: true;
|
|
1013
|
+
input: "text"[];
|
|
1014
|
+
cost: {
|
|
1015
|
+
input: number;
|
|
1016
|
+
output: number;
|
|
1017
|
+
cacheRead: number;
|
|
1018
|
+
cacheWrite: number;
|
|
1019
|
+
};
|
|
1020
|
+
contextWindow: number;
|
|
1021
|
+
maxTokens: number;
|
|
1022
|
+
};
|
|
1040
1023
|
readonly "nvidia.nemotron-nano-9b-v2": {
|
|
1041
1024
|
id: string;
|
|
1042
1025
|
name: string;
|