@lioneltay/claude-pilot 0.1.0 → 0.1.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/dist/server.js +1 -1
- package/package.json +8 -9
package/dist/server.js
CHANGED
|
@@ -359,7 +359,7 @@ ${r}`),t.destroy(e)}function J$(e){if(typeof e!="function")throw new U$(typeof e
|
|
|
359
359
|
- Information that may have changed since your knowledge cutoff
|
|
360
360
|
- Topics you're uncertain about and want to verify
|
|
361
361
|
|
|
362
|
-
Returns a summary with source citations.`,input_schema:{type:"object",properties:{query:{type:"string",description:"The search query - be specific and descriptive for best results"}},required:["query"]}};function Am(e){let t=e.toLowerCase();return t.includes("opus")?"claude-opus-4":t.includes("sonnet")?"claude-sonnet-4.5":t.includes("haiku")?"claude-haiku-4.5":e}function NJ(e){return typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join("")}function CJ(e){return typeof e=="string"?e:e.some(r=>r.type!=="text")?e.filter(r=>r.type==="text"||r.type==="image").map(r=>{if(r.type==="text")return{type:"text",text:r.text};if(r.type==="image")return{type:"image_url",image_url:{url:`data:${r.source.media_type};base64,${r.source.data}`}};throw new Error("Unexpected block type")}):e.filter(r=>r.type==="text").map(r=>r.text).join("")}function kJ(e){return e.filter(t=>t.type==="tool_use").map(t=>({id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.input)}}))}function xJ(e){if(e.role==="user"){if(typeof e.content!="string"){let n=e.content.filter(s=>s.type==="tool_result");if(n.length>0)return n.map(s=>{if(s.type!=="tool_result")throw new Error("Expected tool_result");return{role:"tool",tool_call_id:s.tool_use_id,content:typeof s.content=="string"?s.content:JSON.stringify(s.content)}})}return{role:"user",content:CJ(e.content)}}if(typeof e.content=="string")return{role:"assistant",content:e.content};let t=kJ(e.content);return{role:"assistant",content:NJ(e.content)||null,...t.length>0?{tool_calls:t}:{}}}function LJ(e){return{type:"function",function:{name:e.name,description:e.description,parameters:e.input_schema}}}function qJ(e){if(e)switch(e.type){case"auto":return"auto";case"any":return"required";case"tool":return e.name?{type:"function",function:{name:e.name}}:"auto";default:return"auto"}}function Nm(e){let t=[];if(e.system){let r=typeof e.system=="string"?e.system:e.system.map(n=>n.text).join(`
|
|
362
|
+
Returns a summary with source citations.`,input_schema:{type:"object",properties:{query:{type:"string",description:"The search query - be specific and descriptive for best results"}},required:["query"]}};function Am(e){let t=e.toLowerCase();return t.includes("opus")?"claude-opus-4.5":t.includes("sonnet")?"claude-sonnet-4.5":t.includes("haiku")?"claude-haiku-4.5":e}function NJ(e){return typeof e=="string"?e:e.filter(t=>t.type==="text").map(t=>t.text).join("")}function CJ(e){return typeof e=="string"?e:e.some(r=>r.type!=="text")?e.filter(r=>r.type==="text"||r.type==="image").map(r=>{if(r.type==="text")return{type:"text",text:r.text};if(r.type==="image")return{type:"image_url",image_url:{url:`data:${r.source.media_type};base64,${r.source.data}`}};throw new Error("Unexpected block type")}):e.filter(r=>r.type==="text").map(r=>r.text).join("")}function kJ(e){return e.filter(t=>t.type==="tool_use").map(t=>({id:t.id,type:"function",function:{name:t.name,arguments:JSON.stringify(t.input)}}))}function xJ(e){if(e.role==="user"){if(typeof e.content!="string"){let n=e.content.filter(s=>s.type==="tool_result");if(n.length>0)return n.map(s=>{if(s.type!=="tool_result")throw new Error("Expected tool_result");return{role:"tool",tool_call_id:s.tool_use_id,content:typeof s.content=="string"?s.content:JSON.stringify(s.content)}})}return{role:"user",content:CJ(e.content)}}if(typeof e.content=="string")return{role:"assistant",content:e.content};let t=kJ(e.content);return{role:"assistant",content:NJ(e.content)||null,...t.length>0?{tool_calls:t}:{}}}function LJ(e){return{type:"function",function:{name:e.name,description:e.description,parameters:e.input_schema}}}function qJ(e){if(e)switch(e.type){case"auto":return"auto";case"any":return"required";case"tool":return e.name?{type:"function",function:{name:e.name}}:"auto";default:return"auto"}}function Nm(e){let t=[];if(e.system){let r=typeof e.system=="string"?e.system:e.system.map(n=>n.text).join(`
|
|
363
363
|
`);t.push({role:"system",content:r})}for(let r of e.messages){let n=xJ(r);Array.isArray(n)?t.push(...n):t.push(n)}return{model:Am(e.model),messages:t,max_tokens:e.max_tokens,temperature:e.temperature,top_p:e.top_p,stop:e.stop_sequences,stream:e.stream,tools:e.tools?.map(LJ),tool_choice:qJ(e.tool_choice)}}function jJ(e){switch(e){case"stop":return"end_turn";case"length":return"max_tokens";case"tool_calls":return"tool_use";case"content_filter":return"end_turn";default:return null}}function Cm(e){let t=e.choices[0];if(!t)throw new Error("No choices in OpenAI response");let r=[];if(t.message.content&&r.push({type:"text",text:t.message.content}),t.message.tool_calls)for(let n of t.message.tool_calls)r.push({type:"tool_use",id:n.id,name:n.function.name,input:JSON.parse(n.function.arguments)});return{id:e.id,type:"message",role:"assistant",content:r,model:e.model,stop_reason:jJ(t.finish_reason),stop_sequence:null,usage:{input_tokens:e.usage.prompt_tokens,output_tokens:e.usage.completion_tokens}}}function km(e){return`event: ${e.type}
|
|
364
364
|
data: ${JSON.stringify(e)}
|
|
365
365
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lioneltay/claude-pilot",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI to run Claude Code through GitHub Copilot's API",
|
|
6
6
|
"bin": {
|
|
@@ -10,18 +10,13 @@
|
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "node esbuild.config.js",
|
|
15
|
-
"dev": "tsx src/index.ts",
|
|
16
|
-
"prepublishOnly": "npm run build"
|
|
17
|
-
},
|
|
18
13
|
"devDependencies": {
|
|
19
|
-
"@claude-pilot/proxy": "workspace:*",
|
|
20
14
|
"@types/node": "^22.0.0",
|
|
21
15
|
"commander": "^12.1.0",
|
|
22
16
|
"esbuild": "^0.24.0",
|
|
23
17
|
"tsx": "^4.21.0",
|
|
24
|
-
"typescript": "^5.9.3"
|
|
18
|
+
"typescript": "^5.9.3",
|
|
19
|
+
"@claude-pilot/proxy": "1.0.0"
|
|
25
20
|
},
|
|
26
21
|
"engines": {
|
|
27
22
|
"node": ">=20.0.0"
|
|
@@ -42,5 +37,9 @@
|
|
|
42
37
|
"repository": {
|
|
43
38
|
"type": "git",
|
|
44
39
|
"url": "https://github.com/lioneltay/claude-pilot"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "node esbuild.config.js",
|
|
43
|
+
"dev": "tsx src/index.ts"
|
|
45
44
|
}
|
|
46
|
-
}
|
|
45
|
+
}
|