@yoloship/ai 0.1.0-beta.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Yoloship
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,139 @@
1
+ import { EventStream, ClaudeEvent, SpawnResult, McpServerConfig } from '@yoloship/claude-sdk';
2
+ export { EventStream, ClaudeEvent as RuntimeEvent, SpawnResult, classifyEvent, extractFileChange, isErrorEvent, isFileChangedEvent, isOutputEvent, isResultEvent, isThinkingEvent, isToolUseEvent, normalizeEvent } from '@yoloship/claude-sdk';
3
+
4
+ type RuntimeEvent = ClaudeEvent;
5
+ type RuntimeProvider = 'anthropic' | 'openai' | 'openai-compatible' | 'custom';
6
+ interface RuntimeAuth {
7
+ provider: RuntimeProvider;
8
+ apiKey: string;
9
+ /** Base URL for OpenAI-compatible custom endpoints. */
10
+ baseUrl?: string;
11
+ }
12
+ interface RunOptions {
13
+ prompt: string;
14
+ systemPrompt?: string;
15
+ model?: string;
16
+ maxTurns?: number;
17
+ allowedTools?: string[];
18
+ mcpServers?: Record<string, McpServerConfig>;
19
+ cwd?: string;
20
+ env?: Record<string, string>;
21
+ auth?: RuntimeAuth;
22
+ sessionId?: string;
23
+ /** Resume a prior CLI session by id (Claude `--resume`). */
24
+ resume?: string;
25
+ /** Called for every event emitted while the run is in progress. */
26
+ onEvent?: (event: RuntimeEvent) => void;
27
+ }
28
+ interface BidirectionalSession {
29
+ readonly events: EventStream<ClaudeEvent>;
30
+ /** Send a user turn; consumed after the current turn completes. */
31
+ sendTurn: (message: string) => void;
32
+ /** Cancel the in-flight turn (no-op if already exited). */
33
+ cancel: () => void;
34
+ /** Close the session gracefully. */
35
+ close: () => void;
36
+ /** Resolves to the final SpawnResult when the session ends. */
37
+ result: Promise<SpawnResult>;
38
+ }
39
+ /**
40
+ * Runtime-agnostic contract every coding-agent runtime (Claude Code today,
41
+ * opencode tomorrow) must implement. Consumers in `@yoloship/action` depend
42
+ * on this interface, never on a concrete impl.
43
+ */
44
+ interface Runtime {
45
+ /** The concrete runtime identifier this impl represents. */
46
+ readonly id: 'claude-code' | 'opencode';
47
+ /** Verify the CLI is installed; install if absent (npm). */
48
+ ensure: (options?: {
49
+ cwd?: string;
50
+ }) => Promise<void>;
51
+ /** One-shot non-interactive run. */
52
+ run: (opts: RunOptions) => Promise<SpawnResult>;
53
+ /** Turn-based bidirectional session. */
54
+ runBidirectional: (opts: RunOptions) => BidirectionalSession;
55
+ /** Serialise MCP config into the shape this runtime expects. */
56
+ buildMcpConfig: (servers: Record<string, McpServerConfig>) => unknown;
57
+ /** Translate Claude-shape `allowedTools` into this runtime's native format. */
58
+ translateAllowedTools: (tools: string[]) => unknown;
59
+ }
60
+
61
+ type RuntimeId = 'claude-code' | 'opencode';
62
+ interface GetRuntimeOptions {
63
+ /** Apply headless CI defaults for the selected runtime. */
64
+ ci?: boolean;
65
+ }
66
+ /**
67
+ * Returns a concrete runtime instance for the requested `runtime` id.
68
+ *
69
+ * Today only `claude-code` is implemented. `opencode` is reserved for the
70
+ * next ticket and throws at resolve-time so mis-configured deployments fail
71
+ * fast rather than silently degrading.
72
+ */
73
+ declare function getRuntime(runtime?: RuntimeId, opts?: GetRuntimeOptions): Runtime;
74
+
75
+ /**
76
+ * Conventional env var name for each provider's API key. Used as the fallback
77
+ * when `YOLO_PROVIDER_API_KEY` is not set.
78
+ */
79
+ declare const PROVIDER_ENV_VAR: Record<RuntimeProvider, string | undefined>;
80
+ /**
81
+ * Default model id for each provider. Used when neither the per-agent
82
+ * `model` nor the run-level `model` override is set.
83
+ */
84
+ declare const DEFAULT_MODEL_BY_PROVIDER: Record<RuntimeProvider, string | undefined>;
85
+ /**
86
+ * Resolve the effective model for a run.
87
+ *
88
+ * Precedence (highest to lowest):
89
+ * 1. `runOverride` — CLI flag / `model` from yolo.config.ts
90
+ * 2. `agentModel` — per-agent `model` in `AgentConfig`
91
+ * 3. Provider default from `DEFAULT_MODEL_BY_PROVIDER`
92
+ *
93
+ * Returns `undefined` only when the provider has no default and nothing
94
+ * overrides it (e.g. `provider === 'custom'`).
95
+ */
96
+ declare function resolveModel(opts: {
97
+ provider: RuntimeProvider;
98
+ runOverride?: string;
99
+ agentModel?: string;
100
+ }): string | undefined;
101
+
102
+ interface ClaudeRuntimeOptions {
103
+ /** Apply headless CI defaults (skip permissions, no attribution, no memory write). */
104
+ ci?: boolean;
105
+ }
106
+ /**
107
+ * Shape returned by `buildMcpConfig` for Claude — the exact wire payload
108
+ * the Claude CLI expects for `--mcp-config`. Exposed as a distinct type so
109
+ * callers that serialise the config themselves have something to bind to.
110
+ */
111
+ interface ClaudeMcpConfig {
112
+ mcpServers: Record<string, McpServerConfig>;
113
+ }
114
+ /**
115
+ * Claude Code concrete runtime. Wraps the primitives exposed by
116
+ * `@yoloship/claude-sdk` and adapts them to the shared `Runtime` contract.
117
+ */
118
+ declare class ClaudeRuntime implements Runtime {
119
+ #private;
120
+ readonly id: "claude-code";
121
+ constructor(opts?: ClaudeRuntimeOptions);
122
+ ensure(options?: {
123
+ cwd?: string;
124
+ }): Promise<void>;
125
+ run(opts: RunOptions): Promise<SpawnResult>;
126
+ runBidirectional(opts: RunOptions): BidirectionalSession;
127
+ /**
128
+ * Canonical wire format for `--mcp-config`. Called internally by
129
+ * `#toClaudeSessionOptions` when `opts.mcpServers` is provided; also
130
+ * exposed on the `Runtime` interface for callers that need the
131
+ * serialised payload directly (e.g. writing an mcp-config file).
132
+ */
133
+ buildMcpConfig(servers: Record<string, McpServerConfig>): ClaudeMcpConfig;
134
+ /** Claude Code consumes `allowedTools` in its native shape — pass through. */
135
+ translateAllowedTools(tools: string[]): string[];
136
+ }
137
+
138
+ export { ClaudeRuntime, DEFAULT_MODEL_BY_PROVIDER, PROVIDER_ENV_VAR, getRuntime, resolveModel };
139
+ export type { BidirectionalSession, ClaudeRuntimeOptions, GetRuntimeOptions, RunOptions, Runtime, RuntimeAuth, RuntimeId, RuntimeProvider };
@@ -0,0 +1,139 @@
1
+ import { EventStream, ClaudeEvent, SpawnResult, McpServerConfig } from '@yoloship/claude-sdk';
2
+ export { EventStream, ClaudeEvent as RuntimeEvent, SpawnResult, classifyEvent, extractFileChange, isErrorEvent, isFileChangedEvent, isOutputEvent, isResultEvent, isThinkingEvent, isToolUseEvent, normalizeEvent } from '@yoloship/claude-sdk';
3
+
4
+ type RuntimeEvent = ClaudeEvent;
5
+ type RuntimeProvider = 'anthropic' | 'openai' | 'openai-compatible' | 'custom';
6
+ interface RuntimeAuth {
7
+ provider: RuntimeProvider;
8
+ apiKey: string;
9
+ /** Base URL for OpenAI-compatible custom endpoints. */
10
+ baseUrl?: string;
11
+ }
12
+ interface RunOptions {
13
+ prompt: string;
14
+ systemPrompt?: string;
15
+ model?: string;
16
+ maxTurns?: number;
17
+ allowedTools?: string[];
18
+ mcpServers?: Record<string, McpServerConfig>;
19
+ cwd?: string;
20
+ env?: Record<string, string>;
21
+ auth?: RuntimeAuth;
22
+ sessionId?: string;
23
+ /** Resume a prior CLI session by id (Claude `--resume`). */
24
+ resume?: string;
25
+ /** Called for every event emitted while the run is in progress. */
26
+ onEvent?: (event: RuntimeEvent) => void;
27
+ }
28
+ interface BidirectionalSession {
29
+ readonly events: EventStream<ClaudeEvent>;
30
+ /** Send a user turn; consumed after the current turn completes. */
31
+ sendTurn: (message: string) => void;
32
+ /** Cancel the in-flight turn (no-op if already exited). */
33
+ cancel: () => void;
34
+ /** Close the session gracefully. */
35
+ close: () => void;
36
+ /** Resolves to the final SpawnResult when the session ends. */
37
+ result: Promise<SpawnResult>;
38
+ }
39
+ /**
40
+ * Runtime-agnostic contract every coding-agent runtime (Claude Code today,
41
+ * opencode tomorrow) must implement. Consumers in `@yoloship/action` depend
42
+ * on this interface, never on a concrete impl.
43
+ */
44
+ interface Runtime {
45
+ /** The concrete runtime identifier this impl represents. */
46
+ readonly id: 'claude-code' | 'opencode';
47
+ /** Verify the CLI is installed; install if absent (npm). */
48
+ ensure: (options?: {
49
+ cwd?: string;
50
+ }) => Promise<void>;
51
+ /** One-shot non-interactive run. */
52
+ run: (opts: RunOptions) => Promise<SpawnResult>;
53
+ /** Turn-based bidirectional session. */
54
+ runBidirectional: (opts: RunOptions) => BidirectionalSession;
55
+ /** Serialise MCP config into the shape this runtime expects. */
56
+ buildMcpConfig: (servers: Record<string, McpServerConfig>) => unknown;
57
+ /** Translate Claude-shape `allowedTools` into this runtime's native format. */
58
+ translateAllowedTools: (tools: string[]) => unknown;
59
+ }
60
+
61
+ type RuntimeId = 'claude-code' | 'opencode';
62
+ interface GetRuntimeOptions {
63
+ /** Apply headless CI defaults for the selected runtime. */
64
+ ci?: boolean;
65
+ }
66
+ /**
67
+ * Returns a concrete runtime instance for the requested `runtime` id.
68
+ *
69
+ * Today only `claude-code` is implemented. `opencode` is reserved for the
70
+ * next ticket and throws at resolve-time so mis-configured deployments fail
71
+ * fast rather than silently degrading.
72
+ */
73
+ declare function getRuntime(runtime?: RuntimeId, opts?: GetRuntimeOptions): Runtime;
74
+
75
+ /**
76
+ * Conventional env var name for each provider's API key. Used as the fallback
77
+ * when `YOLO_PROVIDER_API_KEY` is not set.
78
+ */
79
+ declare const PROVIDER_ENV_VAR: Record<RuntimeProvider, string | undefined>;
80
+ /**
81
+ * Default model id for each provider. Used when neither the per-agent
82
+ * `model` nor the run-level `model` override is set.
83
+ */
84
+ declare const DEFAULT_MODEL_BY_PROVIDER: Record<RuntimeProvider, string | undefined>;
85
+ /**
86
+ * Resolve the effective model for a run.
87
+ *
88
+ * Precedence (highest to lowest):
89
+ * 1. `runOverride` — CLI flag / `model` from yolo.config.ts
90
+ * 2. `agentModel` — per-agent `model` in `AgentConfig`
91
+ * 3. Provider default from `DEFAULT_MODEL_BY_PROVIDER`
92
+ *
93
+ * Returns `undefined` only when the provider has no default and nothing
94
+ * overrides it (e.g. `provider === 'custom'`).
95
+ */
96
+ declare function resolveModel(opts: {
97
+ provider: RuntimeProvider;
98
+ runOverride?: string;
99
+ agentModel?: string;
100
+ }): string | undefined;
101
+
102
+ interface ClaudeRuntimeOptions {
103
+ /** Apply headless CI defaults (skip permissions, no attribution, no memory write). */
104
+ ci?: boolean;
105
+ }
106
+ /**
107
+ * Shape returned by `buildMcpConfig` for Claude — the exact wire payload
108
+ * the Claude CLI expects for `--mcp-config`. Exposed as a distinct type so
109
+ * callers that serialise the config themselves have something to bind to.
110
+ */
111
+ interface ClaudeMcpConfig {
112
+ mcpServers: Record<string, McpServerConfig>;
113
+ }
114
+ /**
115
+ * Claude Code concrete runtime. Wraps the primitives exposed by
116
+ * `@yoloship/claude-sdk` and adapts them to the shared `Runtime` contract.
117
+ */
118
+ declare class ClaudeRuntime implements Runtime {
119
+ #private;
120
+ readonly id: "claude-code";
121
+ constructor(opts?: ClaudeRuntimeOptions);
122
+ ensure(options?: {
123
+ cwd?: string;
124
+ }): Promise<void>;
125
+ run(opts: RunOptions): Promise<SpawnResult>;
126
+ runBidirectional(opts: RunOptions): BidirectionalSession;
127
+ /**
128
+ * Canonical wire format for `--mcp-config`. Called internally by
129
+ * `#toClaudeSessionOptions` when `opts.mcpServers` is provided; also
130
+ * exposed on the `Runtime` interface for callers that need the
131
+ * serialised payload directly (e.g. writing an mcp-config file).
132
+ */
133
+ buildMcpConfig(servers: Record<string, McpServerConfig>): ClaudeMcpConfig;
134
+ /** Claude Code consumes `allowedTools` in its native shape — pass through. */
135
+ translateAllowedTools(tools: string[]): string[];
136
+ }
137
+
138
+ export { ClaudeRuntime, DEFAULT_MODEL_BY_PROVIDER, PROVIDER_ENV_VAR, getRuntime, resolveModel };
139
+ export type { BidirectionalSession, ClaudeRuntimeOptions, GetRuntimeOptions, RunOptions, Runtime, RuntimeAuth, RuntimeId, RuntimeProvider };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ const _0x1dc346=_0x2810;(function(_0x1e66ed,_0x26d1b9){const _0x516d6b=_0x2810,_0xb2a16e=_0x1e66ed();while(!![]){try{const _0x44dc14=-parseInt(_0x516d6b(0x159,'a%%7'))/0x1+-parseInt(_0x516d6b(0x14b,'NOM5'))/0x2*(-parseInt(_0x516d6b(0x16f,'OAUz'))/0x3)+parseInt(_0x516d6b(0x183,'sAAg'))/0x4*(parseInt(_0x516d6b(0x17f,'a%%7'))/0x5)+-parseInt(_0x516d6b(0x16a,'ND)T'))/0x6+parseInt(_0x516d6b(0x17e,'gSlT'))/0x7*(parseInt(_0x516d6b(0x193,'b2B4'))/0x8)+parseInt(_0x516d6b(0x165,']9*M'))/0x9*(parseInt(_0x516d6b(0x14e,'$n%['))/0xa)+parseInt(_0x516d6b(0x18f,'11N('))/0xb*(parseInt(_0x516d6b(0x166,'eWer'))/0xc);if(_0x44dc14===_0x26d1b9)break;else _0xb2a16e['push'](_0xb2a16e['shift']());}catch(_0x4caf83){_0xb2a16e['push'](_0xb2a16e['shift']());}}}(_0x2028,0x495fe));import{ensureClaude,spawnClaude,spawnClaudeBidirectional}from'@yoloship/claude-sdk';export{EventStream,classifyEvent,extractFileChange,isErrorEvent,isFileChangedEvent,isOutputEvent,isResultEvent,isThinkingEvent,isToolUseEvent,normalizeEvent}from'@yoloship/claude-sdk';const CI_DEFAULTS={'dangerouslySkipPermissions':!![],'attribution':{'commit':'','pr':''},'autoMemoryEnabled':![]},CI_PAGER_ENV={'GIT_PAGER':_0x1dc346(0x153,'ZF(N'),'GH_PAGER':_0x1dc346(0x1a0,'MXiv'),'PAGER':_0x1dc346(0x14a,'al)l')};function toClaudeAuth(_0x318ec1){const _0x2c9d8d=_0x1dc346;if(!_0x318ec1)return void 0x0;return{'apiKey':_0x318ec1[_0x2c9d8d(0x16b,'rE#u')]};}class ClaudeRuntime{['id']=_0x1dc346(0x19e,']9*M');#ci;constructor(_0xa97c01={}){this.#ci=_0xa97c01['ci']??![];}async[_0x1dc346(0x182,'ND)T')](_0x2d042d){const _0x2fbb65=_0x1dc346,_0x3b5538={'MWXcx':function(_0x4f2b36,_0x2abde2){return _0x4f2b36(_0x2abde2);}};await _0x3b5538[_0x2fbb65(0x148,'d5JE')](ensureClaude,_0x2d042d);}[_0x1dc346(0x18c,'xkTq')](_0x9b99cf){const _0x287889=_0x1dc346,_0x246e63={'UNTnd':function(_0x4d8937,_0x2c79fc,_0x2f39a0){return _0x4d8937(_0x2c79fc,_0x2f39a0);}},_0xb2e7bb=this.#ci?{...CI_DEFAULTS,...this.#toClaudeOptions(_0x9b99cf)}:this.#toClaudeOptions(_0x9b99cf),_0x451d81=_0x246e63['UNTnd'](spawnClaude,_0xb2e7bb,toClaudeAuth(_0x9b99cf['auth']));return _0x9b99cf[_0x287889(0x184,']9*M')]&&_0x451d81['events']['on'](_0x9b99cf[_0x287889(0x17d,'a#5J')]),_0x451d81[_0x287889(0x14c,'yWc1')];}[_0x1dc346(0x180,'ZWmW')](_0x3f76ad){const _0x2ef663=_0x1dc346,_0x34ab8e={'cZJhA':function(_0x4cab24,_0x3114f1,_0x5f424a){return _0x4cab24(_0x3114f1,_0x5f424a);}},_0x1b614b=this.#ci?{...CI_DEFAULTS,...this.#toClaudeSessionOptions(_0x3f76ad)}:this.#toClaudeSessionOptions(_0x3f76ad),_0x1ef3d2=_0x34ab8e[_0x2ef663(0x15f,'a#5J')](spawnClaudeBidirectional,_0x1b614b,toClaudeAuth(_0x3f76ad[_0x2ef663(0x17b,'rE#u')]));return _0x3f76ad[_0x2ef663(0x194,'a&2o')]&&_0x1ef3d2[_0x2ef663(0x174,'b2B4')]['on'](_0x3f76ad[_0x2ef663(0x171,'%Z$]')]),{'events':_0x1ef3d2['events'],'sendTurn':_0x444bd7=>_0x1ef3d2[_0x2ef663(0x156,'rE#u')](_0x444bd7),'cancel':()=>{const _0x1218a0=_0x2ef663;try{_0x1ef3d2['process'][_0x1218a0(0x197,'a%%7')]();}catch{}},'close':()=>_0x1ef3d2[_0x2ef663(0x1a1,'OCEp')](),'result':_0x1ef3d2['result']};}[_0x1dc346(0x17a,'al)l')](_0xd4d804){return{'mcpServers':_0xd4d804};}[_0x1dc346(0x18d,'3!CA')](_0x243cca){return _0x243cca;}#toClaudeSessionOptions(_0x339b0f){const _0x35cca4=_0x1dc346,_0x3a88fa={'udYZX':function(_0x59861a,_0x16481c){return _0x59861a!==_0x16481c;},'KalBn':function(_0x378f89,_0x459a23){return _0x378f89!==_0x459a23;},'GnDIh':function(_0x20ee1f,_0x1fdcb7){return _0x20ee1f!==_0x1fdcb7;},'iuApW':_0x35cca4(0x152,'al)l')},_0x27d8c7={};_0x3a88fa[_0x35cca4(0x179,'sUm1')](_0x339b0f[_0x35cca4(0x163,'T&&@')],void 0x0)&&(_0x27d8c7[_0x35cca4(0x195,'KK4!')]=_0x339b0f[_0x35cca4(0x192,']9*M')]);_0x3a88fa[_0x35cca4(0x186,'exxV')](_0x339b0f[_0x35cca4(0x150,'T&&@')],void 0x0)&&(_0x27d8c7[_0x35cca4(0x189,'xkTq')]=_0x339b0f[_0x35cca4(0x151,'%Z$]')]);_0x3a88fa[_0x35cca4(0x18b,'a&2o')](_0x339b0f['maxTurns'],void 0x0)&&(_0x27d8c7[_0x35cca4(0x15e,'#cc]')]=_0x339b0f[_0x35cca4(0x198,'nqI)')]);_0x339b0f[_0x35cca4(0x15d,'06xU')]!==void 0x0&&(_0x27d8c7[_0x35cca4(0x147,'sUm1')]=this[_0x35cca4(0x196,'11N(')](_0x339b0f[_0x35cca4(0x158,'@lgn')]));_0x339b0f[_0x35cca4(0x160,'11N(')]!==void 0x0&&(_0x27d8c7[_0x35cca4(0x16e,'a&2o')]=this[_0x35cca4(0x14f,'Exwe')](_0x339b0f[_0x35cca4(0x18e,'eWer')])[_0x35cca4(0x19b,'b2B4')]);_0x3a88fa['KalBn'](_0x339b0f[_0x35cca4(0x19d,'b2B4')],void 0x0)&&(_0x27d8c7['cwd']=_0x339b0f['cwd']);if(this.#ci)_0x27d8c7[_0x35cca4(0x15c,'KK4!')]={...CI_PAGER_ENV,..._0x339b0f[_0x35cca4(0x173,'gSlT')]??{}};else _0x339b0f[_0x35cca4(0x168,'b2B4')]!==void 0x0&&(_0x27d8c7[_0x35cca4(0x14d,'3!CA')]=_0x339b0f['env']);return _0x339b0f[_0x35cca4(0x161,'NOM5')]!==void 0x0&&(_0x27d8c7[_0x35cca4(0x155,'ND)T')]=_0x339b0f[_0x35cca4(0x18a,'sAAg')]),_0x3a88fa[_0x35cca4(0x16c,'CrBf')](_0x339b0f[_0x35cca4(0x181,'b2B4')],void 0x0)&&(_0x27d8c7['resume']=_0x339b0f[_0x35cca4(0x170,'RN3S')]),_0x27d8c7['settingSources']=[_0x3a88fa[_0x35cca4(0x191,'RN3S')],_0x35cca4(0x188,'$MVE')],_0x27d8c7;}#toClaudeOptions(_0x1c8a87){const _0x3931e9=_0x1dc346;return{'prompt':_0x1c8a87[_0x3931e9(0x15a,'b2B4')],...this.#toClaudeSessionOptions(_0x1c8a87)};}}function getRuntime(_0x38fc83=_0x1dc346(0x19f,'sUm1'),_0x782589={}){const _0x36d461=_0x1dc346,_0x4da83e={'fLDWc':_0x36d461(0x199,'OAUz'),'KvcrZ':_0x36d461(0x19c,'a%%7'),'wTLqo':function(_0x4a63ae,_0x57e806){return _0x4a63ae(_0x57e806);}};switch(_0x38fc83){case _0x4da83e[_0x36d461(0x164,'06xU')]:return new ClaudeRuntime({'ci':_0x782589['ci']});case _0x4da83e[_0x36d461(0x169,'ND)T')]:throw new Error(_0x36d461(0x157,'vVC*'));default:{const _0x8ce92a=_0x38fc83;throw new Error(_0x36d461(0x185,'Exwe')+_0x4da83e[_0x36d461(0x172,'xkTq')](String,_0x8ce92a));}}}const PROVIDER_ENV_VAR={'anthropic':_0x1dc346(0x190,'bW[X'),'openai':_0x1dc346(0x149,'UeWm'),'openai-compatible':void 0x0,'custom':void 0x0},DEFAULT_MODEL_BY_PROVIDER={'anthropic':'claude-sonnet-4-5','openai':_0x1dc346(0x178,'QUvW'),'openai-compatible':void 0x0,'custom':void 0x0};function resolveModel(_0x564676){const _0x58565d=_0x1dc346;return _0x564676[_0x58565d(0x1a2,'gSlT')]??_0x564676[_0x58565d(0x17c,'xkTq')]??DEFAULT_MODEL_BY_PROVIDER[_0x564676['provider']];}function _0x2810(_0x5452d7,_0x56cf8a){_0x5452d7=_0x5452d7-0x147;const _0x2028e5=_0x2028();let _0x28108c=_0x2028e5[_0x5452d7];if(_0x2810['DsSXVt']===undefined){var _0x2696b6=function(_0x369e25){const _0x3e6a79='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3a95bf='',_0x137695='';for(let _0xc99116=0x0,_0x4461d9,_0x42dc2c,_0x350918=0x0;_0x42dc2c=_0x369e25['charAt'](_0x350918++);~_0x42dc2c&&(_0x4461d9=_0xc99116%0x4?_0x4461d9*0x40+_0x42dc2c:_0x42dc2c,_0xc99116++%0x4)?_0x3a95bf+=String['fromCharCode'](0xff&_0x4461d9>>(-0x2*_0xc99116&0x6)):0x0){_0x42dc2c=_0x3e6a79['indexOf'](_0x42dc2c);}for(let _0x902c5f=0x0,_0x193129=_0x3a95bf['length'];_0x902c5f<_0x193129;_0x902c5f++){_0x137695+='%'+('00'+_0x3a95bf['charCodeAt'](_0x902c5f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x137695);};const _0xa4f678=function(_0x554de1,_0x16d42b){let _0xe4a895=[],_0x42bc3c=0x0,_0x1fad64,_0x2b5952='';_0x554de1=_0x2696b6(_0x554de1);let _0x272867;for(_0x272867=0x0;_0x272867<0x100;_0x272867++){_0xe4a895[_0x272867]=_0x272867;}for(_0x272867=0x0;_0x272867<0x100;_0x272867++){_0x42bc3c=(_0x42bc3c+_0xe4a895[_0x272867]+_0x16d42b['charCodeAt'](_0x272867%_0x16d42b['length']))%0x100,_0x1fad64=_0xe4a895[_0x272867],_0xe4a895[_0x272867]=_0xe4a895[_0x42bc3c],_0xe4a895[_0x42bc3c]=_0x1fad64;}_0x272867=0x0,_0x42bc3c=0x0;for(let _0x171cad=0x0;_0x171cad<_0x554de1['length'];_0x171cad++){_0x272867=(_0x272867+0x1)%0x100,_0x42bc3c=(_0x42bc3c+_0xe4a895[_0x272867])%0x100,_0x1fad64=_0xe4a895[_0x272867],_0xe4a895[_0x272867]=_0xe4a895[_0x42bc3c],_0xe4a895[_0x42bc3c]=_0x1fad64,_0x2b5952+=String['fromCharCode'](_0x554de1['charCodeAt'](_0x171cad)^_0xe4a895[(_0xe4a895[_0x272867]+_0xe4a895[_0x42bc3c])%0x100]);}return _0x2b5952;};_0x2810['zLptei']=_0xa4f678,_0x2810['GNCoDr']={},_0x2810['DsSXVt']=!![];}const _0xd9349b=_0x2028e5[0x0],_0x1d909c=_0x5452d7+_0xd9349b,_0x18a9c2=_0x2810['GNCoDr'][_0x1d909c];return!_0x18a9c2?(_0x2810['RXTUFt']===undefined&&(_0x2810['RXTUFt']=!![]),_0x28108c=_0x2810['zLptei'](_0x28108c,_0x56cf8a),_0x2810['GNCoDr'][_0x1d909c]=_0x28108c):_0x28108c=_0x18a9c2,_0x28108c;}export{ClaudeRuntime,DEFAULT_MODEL_BY_PROVIDER,PROVIDER_ENV_VAR,getRuntime,resolveModel};function _0x2028(){const _0xfebc4f=['W5VdV8oOW4bnDmk2WPJdMCozzCkdla','BhFdSG','WR5XWRlcG30','W4CXW6tdGrxcMHtdOguzfCo2CW','WPJcGa0qjSoz','WQtcPqddMCk4','WRjBArldVSkwW5RcHJhdGmkz','WOtcQSkTWQmAn8o4WOtdHCoW','phJcTwRdUZxcM2b1g8kTh0m','d3BcKmkyaCkk','W6/cGSoPWPDBW5Tq','W6SAD8kAWQ4','CttdTa','Bg/dOCkPWOVcKG','W6ZcMJmNyJtdLa','oMdcLmkyt8oDDmkq','v8k9WQfiW7yWhLdcJrtcQLq','W5GHW7fQBq','WPVcLmouWRLL','jmoheLJcPmkQmCkEBW7dN8oqWOWu','WPJcHraZ','W70PxSkfWRxcVmkBCdX9','WQlcSvX+WRZcOSoB','iMNdKhlcJcRcGrC','W7T0yWlcRtZcKCod','pmojp2xcMmkPWQCeu8kDWR7dKmkYv8o+WOi','E3ZdT8kYWPlcHa','WPbPWQlcHfxdJG','W5iOCwztWOZcSw5vWRBdKa','WRhcSGiZDWVdQG','WO7cV8owWRBcOmodW4pcOxWYWOW4WO7dIqmaea','sCkgWPvLjG','WRfDBrJdTSkCW53cRrtdI8kG','g8orWOpcQ8kK','W7eHx8koWQ0','WPv4mY0cWRhcLuH5','WQlcQmkXWRir','W647vq','W6RcQSkGWPRcT8oUWR3cG8kqu8ksWPldKmk0W5ddHwjAW5Tcwa','WRHMw04NWOldRSkMcxu','WRvFAX/dTmo2W6tcQYVdQSkAWRi','WPu+mg/dQCkqs8kyWQW9i2pcQSoZW5ZcS8oT','fgBcOSkDoW','WQ3cPtqXDWJdJNZcQCofWQLm','pIRcSCo1W4/cUwZdVNLnWPe','WOBcP8kyWOyAk8o6','W6/dLYK1pXNdOaTfW5ZdL1O','W7iCoutcTCkOW7hcNrZdRSkLWQrdWO7cMYtcSCoUWOmIWPi','WQmOyHO','fZhcLc1AccHX','BItdRsNcR2JcHwz7mSkY','vCkLxCoGFs5IuCkkWOhcKhS','zhRdTmkuWPRcK1FdN2zA','WQCXAXJcPbdcTmo2','AM7dOa','WR3cScyWDGdcS23cQComWRW','WO3cNmoSWPzzeSoUemkeF1i','AJtcJq','jCkktr/cSa','zI/dRgFcNWdcIHyUW6OC','WO/cNmoHWOXkeSkNj8keDfTd','WQRdLmohwea','nunPWRRdO8ohW4/cKCo8tCkyxG4V','jCotdW','WRuGW5hdQxz6WR8','WPeMgLXhCW','W7VcTSk3','kCkcpuzLWPCqW6Cfc8oMWRW','WRNcPmouWRtcQ8o5W47dSu0OWOWQWO7dGW','BCoppmoiiG','W63cG8oiWOrs','nSoaff7cPCkejG','rWtcNG','v8kKv8oJFYqLDSk5WONcUxKu','WOzIWQlcGK7dHeldKg8','WORcLqO/dSofWPBcVXZdRSo4','W69hyCo2W4pcTCkBDmkJW6BcJcyWWPVcHLvrW5S1WQNcVmoiW5RdKSo/ysFdKHHzoSkme2lcICkcW4lcHCoKW5xIGAxcUCkUWO/cKwlcO1VdV07dQMxdKa','W5zOFZytpvVcUmkmmCosoa','W7PWpuFdT0BcICoEWQBdISk8WQ0','EwVdQ8kQWO/cLq','qCknWRlcKmkTAmoAW4a','W7NdGcW','a8oHW70tWRzLefxcUcVcTNq','ASoaWQ7cJSkCW5tcSmoN','WQ7cHvnGWPG','W6SnkhNcO8k2W6BcJaVdNa','W7qdW5BdUg9eWPVcJmkr','W5tcTCoPqwKQWQCZ','C8ozk8ozk2HPFSoFWOb0W6O','bmobW5uRWQi','W63dQJe/qYpdR08','W6WZtMO0WRxdOCkh'];_0x2028=function(){return _0xfebc4f;};return _0x2028();}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@yoloship/ai",
3
+ "type": "module",
4
+ "version": "0.1.0-beta.1",
5
+ "private": false,
6
+ "description": "Yoloship AI — runtime-agnostic coding-agent orchestration layer (consumes @yoloship/claude-sdk today, opencode next)",
7
+ "author": "Yoloship Team <team@yoloship.dev>",
8
+ "license": "MIT",
9
+ "homepage": "https://www.yoloship.dev",
10
+ "keywords": [
11
+ "yoloship",
12
+ "ai",
13
+ "runtime",
14
+ "claude",
15
+ "opencode",
16
+ "agent"
17
+ ],
18
+ "sideEffects": false,
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.mjs"
23
+ }
24
+ },
25
+ "main": "./dist/index.mjs",
26
+ "types": "./dist/index.d.ts",
27
+ "files": [
28
+ "LICENSE",
29
+ "dist"
30
+ ],
31
+ "engines": {
32
+ "node": ">=20"
33
+ },
34
+ "dependencies": {
35
+ "zod": "^4.4.3",
36
+ "@yoloship/claude-sdk": "0.1.0-beta.5"
37
+ },
38
+ "devDependencies": {
39
+ "@vitest/coverage-v8": "^4.1.4",
40
+ "cross-env": "^10.1.0",
41
+ "javascript-obfuscator": "^5.4.1",
42
+ "typescript": "^5.9.3",
43
+ "unbuild": "^3.5.0",
44
+ "vitest": "^4.1.4"
45
+ },
46
+ "lint-staged": {
47
+ "*.{js,ts,vue,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"
48
+ },
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "scripts": {
53
+ "build": "unbuild && node scripts/obfuscate.mjs",
54
+ "build:dev": "unbuild",
55
+ "typecheck": "tsc --noEmit",
56
+ "lint": "cross-env NODE_ENV=production eslint",
57
+ "lint:fix": "cross-env NODE_ENV=production eslint --fix",
58
+ "test:unit": "vitest run",
59
+ "test:unit:watch": "vitest watch",
60
+ "test:unit:coverage": "vitest run --coverage"
61
+ }
62
+ }