@justin06lee/yagami 0.4.1

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.
@@ -0,0 +1,85 @@
1
+ import { ServerType } from '@hono/node-server';
2
+ import { n as ProviderConfigEntry, j as MessagesRequest, f as CompleteResult, s as StreamOptions, u as StreamStart, E as EngineModel, Y as YagamiEngine, S as SessionCache } from './engine-pmCK3S7z.js';
3
+ import { Hono } from 'hono';
4
+
5
+ interface YagamiConfig {
6
+ host: string;
7
+ port: number;
8
+ apiKeys: string[];
9
+ /** @deprecated Use providers.claude.path. */
10
+ claudePath?: string;
11
+ /** @deprecated Use providers.claude.configDir. */
12
+ claudeConfigDir?: string;
13
+ defaultModel?: string;
14
+ cors?: boolean;
15
+ /** Provider used for bare model ids (default: claude). */
16
+ defaultProvider?: string;
17
+ /** Per-provider settings, keyed by provider id. */
18
+ providers?: Record<string, ProviderConfigEntry>;
19
+ }
20
+ declare function yagamiConfigDir(): string;
21
+ declare function configFilePath(): string;
22
+ declare function sessionCachePath(): string;
23
+ declare function serverStatePath(): string;
24
+ declare function logFilePath(): string;
25
+ /** What a running server records about itself for `stop`/`status`. */
26
+ interface ServerState {
27
+ pid: number;
28
+ host: string;
29
+ port: number;
30
+ url: string;
31
+ startedAt: string;
32
+ version: string;
33
+ log?: string;
34
+ }
35
+ declare function readServerState(): ServerState | undefined;
36
+ declare function writeServerState(state: ServerState): void;
37
+ /** Remove the state file; with `pid`, only if it still belongs to that pid. */
38
+ declare function clearServerState(pid?: number): void;
39
+ declare function isProcessAlive(pid: number): boolean;
40
+ /** Config as stored on disk, without env overrides (safe to save back). */
41
+ declare function loadFileConfig(): YagamiConfig;
42
+ /** File config plus environment overrides. */
43
+ declare function loadConfig(): YagamiConfig;
44
+ declare function saveConfig(cfg: YagamiConfig): string;
45
+ declare function generateApiKey(): string;
46
+
47
+ /** What the app needs from an engine — lets tests inject a fake. */
48
+ interface EngineLike {
49
+ /** Executable of the default provider. */
50
+ executable: string;
51
+ defaultProviderId: string;
52
+ providerIds: string[];
53
+ complete(req: MessagesRequest): Promise<CompleteResult>;
54
+ stream(req: MessagesRequest, opts?: StreamOptions): StreamStart;
55
+ listModels(): Promise<EngineModel[]>;
56
+ }
57
+ interface AppOptions {
58
+ engine: EngineLike;
59
+ apiKeys: string[];
60
+ cors?: boolean;
61
+ version?: string;
62
+ /** Sink for one-line request logs; omit to disable request logging. */
63
+ log?: (line: string) => void;
64
+ }
65
+ declare function createApp(options: AppOptions): Hono;
66
+
67
+ interface RunningServer {
68
+ server: ServerType;
69
+ engine: YagamiEngine;
70
+ sessionCache: SessionCache;
71
+ config: YagamiConfig;
72
+ url: string;
73
+ close(): Promise<void>;
74
+ }
75
+ interface StartOptions extends Partial<YagamiConfig> {
76
+ /** Sink for one-line request logs (default: console.log). Pass null to disable. */
77
+ log?: ((line: string) => void) | null;
78
+ }
79
+ /**
80
+ * Start a yagami server. Overrides are merged over the loaded config
81
+ * (~/.config/yagami/config.json plus YAGAMI_* env vars).
82
+ */
83
+ declare function startYagami(overrides?: StartOptions): Promise<RunningServer>;
84
+
85
+ export { type AppOptions, type EngineLike, type RunningServer, type ServerState, type StartOptions, type YagamiConfig, clearServerState, configFilePath, createApp, generateApiKey, isProcessAlive, loadConfig, loadFileConfig, logFilePath, readServerState, saveConfig, serverStatePath, sessionCachePath, startYagami, writeServerState, yagamiConfigDir };
package/dist/server.js ADDED
@@ -0,0 +1,36 @@
1
+ import {
2
+ clearServerState,
3
+ configFilePath,
4
+ createApp,
5
+ generateApiKey,
6
+ isProcessAlive,
7
+ loadConfig,
8
+ loadFileConfig,
9
+ logFilePath,
10
+ readServerState,
11
+ saveConfig,
12
+ serverStatePath,
13
+ sessionCachePath,
14
+ startYagami,
15
+ writeServerState,
16
+ yagamiConfigDir
17
+ } from "./chunk-M5UHR273.js";
18
+ import "./chunk-ASS6MJ7C.js";
19
+ export {
20
+ clearServerState,
21
+ configFilePath,
22
+ createApp,
23
+ generateApiKey,
24
+ isProcessAlive,
25
+ loadConfig,
26
+ loadFileConfig,
27
+ logFilePath,
28
+ readServerState,
29
+ saveConfig,
30
+ serverStatePath,
31
+ sessionCachePath,
32
+ startYagami,
33
+ writeServerState,
34
+ yagamiConfigDir
35
+ };
36
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@justin06lee/yagami",
3
+ "version": "0.4.1",
4
+ "description": "Self-hosted Anthropic-compatible API backed by your signed-in Claude Code CLI, plus an embeddable library for driving Claude Code sessions from your own apps.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "justin06lee",
8
+ "engines": {
9
+ "node": ">=20"
10
+ },
11
+ "bin": {
12
+ "yagami": "dist/cli.js"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ },
19
+ "./server": {
20
+ "types": "./dist/server.d.ts",
21
+ "default": "./dist/server.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsup",
29
+ "dev": "tsx src/cli.ts start",
30
+ "typecheck": "tsc --noEmit",
31
+ "test": "vitest run",
32
+ "smoke": "tsx scripts/smoke.ts",
33
+ "live:providers": "tsx scripts/live-providers.ts",
34
+ "live:session": "tsx scripts/live-session.ts",
35
+ "prepack": "bun run build",
36
+ "prepublishOnly": "bun run typecheck && bun run test"
37
+ },
38
+ "dependencies": {
39
+ "@agentclientprotocol/sdk": "^1.3.0",
40
+ "@anthropic-ai/claude-agent-sdk": "^0.3.0",
41
+ "@hono/node-server": "^1.14.0",
42
+ "commander": "^14.0.0",
43
+ "hono": "^4.7.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^24.0.0",
47
+ "tsup": "^8.4.0",
48
+ "tsx": "^4.19.0",
49
+ "typescript": "^5.8.0",
50
+ "vitest": "^3.1.0"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/justin06lee/yagami.git"
58
+ },
59
+ "homepage": "https://github.com/justin06lee/yagami#readme",
60
+ "bugs": {
61
+ "url": "https://github.com/justin06lee/yagami/issues"
62
+ },
63
+ "keywords": [
64
+ "anthropic",
65
+ "claude",
66
+ "claude-code",
67
+ "codex",
68
+ "opencode",
69
+ "acp",
70
+ "agent-client-protocol",
71
+ "llm",
72
+ "api",
73
+ "proxy",
74
+ "self-hosted",
75
+ "messages-api",
76
+ "coding-agent"
77
+ ]
78
+ }