@pen.dev/cli 0.3.2 → 0.3.4

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.
Files changed (82) hide show
  1. package/README.md +18 -12
  2. package/dist/anthropic-messages-COZrsSdY.mjs +40 -0
  3. package/dist/azure-openai-responses-Dmf1EaVz.mjs +2 -0
  4. package/dist/browserAll-BZYrVO32.mjs +2 -0
  5. package/dist/{dist-BEo0Z8Vf.mjs → dist-D9ROAuw3.mjs} +348 -319
  6. package/dist/{dist-BY6vOcMF.mjs → dist-DGrygXHh.mjs} +2 -2
  7. package/dist/{error-body-D2Mrqb4g.mjs → error-body-BBlqjbe7.mjs} +1 -1
  8. package/dist/google-generative-ai-BMEzR_34.mjs +2 -0
  9. package/dist/google-shared-DXgnvvDU.mjs +318 -0
  10. package/dist/google-vertex-In7qdx36.mjs +2 -0
  11. package/dist/index.mjs +2 -2
  12. package/dist/mistral-conversations-DdYjdrRy.mjs +5 -0
  13. package/dist/models-BBd5zwn6.mjs +2 -0
  14. package/dist/{multipart-parser-DX5ZDxQv.mjs → multipart-parser-BdmM0fdd.mjs} +1 -1
  15. package/dist/node_modules/@highagency/pencil-wasm/package.json +1 -1
  16. package/dist/node_modules/@highagency/pencil-wasm/pencil.d.ts +3 -0
  17. package/dist/node_modules/@highagency/pencil-wasm/pencil.js +1 -1
  18. package/dist/node_modules/@highagency/pencil-wasm/pencil.wasm +0 -0
  19. package/dist/openai-CbFQ5q5I.mjs +18 -0
  20. package/dist/openai-codex-responses-CD-2hfWB.mjs +8 -0
  21. package/dist/openai-completions-DamtYjy7.mjs +6 -0
  22. package/dist/openai-responses-DgeWdtm-.mjs +2 -0
  23. package/dist/openai-responses-shared-DKseiGAg.mjs +11 -0
  24. package/dist/{openrouter-images-BbBWg9zF.mjs → openrouter-images-gArAwqnL.mjs} +1 -1
  25. package/dist/out/mcp-server-darwin-arm64 +0 -0
  26. package/dist/out/mcp-server-darwin-x64 +0 -0
  27. package/dist/out/mcp-server-linux-arm64 +0 -0
  28. package/dist/out/mcp-server-linux-x64 +0 -0
  29. package/dist/out/mcp-server-windows-arm64.exe +0 -0
  30. package/dist/out/mcp-server-windows-x64.exe +0 -0
  31. package/dist/out/skills/pen-dev/SKILL.md +204 -0
  32. package/dist/out/skills/pen-dev/execute.md +364 -0
  33. package/dist/out/skills/pen-dev/guide/code.md +198 -0
  34. package/dist/out/skills/pen-dev/guide/components.md +45 -0
  35. package/dist/out/skills/pen-dev/guide/design-system.md +556 -0
  36. package/dist/out/skills/pen-dev/guide/landing-page.md +31 -0
  37. package/dist/out/skills/pen-dev/guide/mobile-app.md +31 -0
  38. package/dist/out/skills/pen-dev/guide/slides.md +222 -0
  39. package/dist/out/skills/pen-dev/guide/table.md +37 -0
  40. package/dist/out/skills/pen-dev/guide/tailwind.md +328 -0
  41. package/dist/out/skills/pen-dev/guide/web-app.md +245 -0
  42. package/dist/out/skills/pen-dev/pen-schema.md +202 -0
  43. package/dist/out/skills/pen-dev/scripts-and-shaders.md +94 -0
  44. package/dist/pi-user-agent-m9a4CjJo.mjs +2 -0
  45. package/dist/{src-B_lvnEtX.mjs → src-KoDMTA_Q.mjs} +1 -1
  46. package/dist/transform-messages-BHnJzowk.mjs +2 -0
  47. package/dist/webworkerAll-CB00nbs9.mjs +2 -0
  48. package/package.json +5 -4
  49. package/dist/anthropic-messages-Bf-fvkNu.mjs +0 -40
  50. package/dist/azure-openai-responses-CzgVqECr.mjs +0 -2
  51. package/dist/browserAll-8jKh1NRi.mjs +0 -2
  52. package/dist/completionchunk-BQtPqA8U.mjs +0 -28
  53. package/dist/google-generative-ai-DSOqI0LF.mjs +0 -2
  54. package/dist/google-shared-CetPT_Vt.mjs +0 -318
  55. package/dist/google-vertex-CPtOc5oU.mjs +0 -2
  56. package/dist/mistral-conversations-CUsdbDQ8.mjs +0 -10
  57. package/dist/models-CwK5xZH9.mjs +0 -2
  58. package/dist/openai-Brr_V-tF.mjs +0 -17
  59. package/dist/openai-codex-responses-Cb5pfH5S.mjs +0 -8
  60. package/dist/openai-completions-BvTlcCeP.mjs +0 -6
  61. package/dist/openai-responses-IuaLTEHh.mjs +0 -2
  62. package/dist/openai-responses-shared-D4d0NbBE.mjs +0 -11
  63. package/dist/otel-CaADOqYZ.mjs +0 -4
  64. package/dist/transform-messages-CSBQpmXO.mjs +0 -2
  65. package/dist/webworkerAll-BD-7VH16.mjs +0 -2
  66. /package/dist/{dist-BnoSGZKP.mjs → dist-D8tvRm1b.mjs} +0 -0
  67. /package/dist/{emscripten-module.browser-F76W5DM6-CNibWX-6.mjs → emscripten-module.browser-F76W5DM6-DWhj_jYh.mjs} +0 -0
  68. /package/dist/{emscripten-module.browser-XIKQQPVU-BNfdGnMe.mjs → emscripten-module.browser-XIKQQPVU-Dmh4no3c.mjs} +0 -0
  69. /package/dist/{ffi-C5tLdQO9.mjs → ffi-BroAqW9B.mjs} +0 -0
  70. /package/dist/{ffi-BuJ13coi.mjs → ffi-DwdyvnFx.mjs} +0 -0
  71. /package/dist/{from-py2TfO8m.mjs → from-Choxbpmr.mjs} +0 -0
  72. /package/dist/{github-copilot-headers-DZOfokGy.mjs → github-copilot-headers-DCj7hJoC.mjs} +0 -0
  73. /package/dist/{hash-Kp92CI9R.mjs → hash-DNYCELl4.mjs} +0 -0
  74. /package/dist/{html-GGJ1fTRB.mjs → html-DEPARSNH.mjs} +0 -0
  75. /package/dist/{init-B9LSomNH.mjs → init-DwIpBeuP.mjs} +0 -0
  76. /package/dist/{module-ES6BEMUI-DwQ9nTMF.mjs → module-ES6BEMUI-DUGQwtIb.mjs} +0 -0
  77. /package/dist/{module-asyncify-2EFITU5U-B54Mkt6K.mjs → module-asyncify-2EFITU5U-U7fqmMTF.mjs} +0 -0
  78. /package/dist/{openai-prompt-cache-t4kk9puG.mjs → openai-prompt-cache-tVHrB8oW.mjs} +0 -0
  79. /package/dist/{photon_rs-BySSRmP5.mjs → photon_rs-o0nbTM4F.mjs} +0 -0
  80. /package/dist/{provider-retry-BM3ArvaW.mjs → provider-retry-wOYAq0sa.mjs} +0 -0
  81. /package/dist/{sanitize-unicode-CHjuq5rK.mjs → sanitize-unicode-Byz9nlLd.mjs} +0 -0
  82. /package/dist/{standalone-DYT2Zg6I.mjs → standalone-DwaYVpTH.mjs} +0 -0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{a as e}from"./diagnostics-B0j2bfEp.mjs";import{n as t,t as n}from"./models-BBd5zwn6.mjs";import{t as r}from"./provider-env-CL5ShLlj.mjs";import{n as i}from"./headers-BvGum5dc.mjs";import{t as a}from"./sanitize-unicode-Byz9nlLd.mjs";import{i as o}from"./transform-messages-BHnJzowk.mjs";import{n as s,t as c}from"./error-body-BBlqjbe7.mjs";import{a as l,c as u,d,i as f,l as p,n as m,o as h,r as g,s as _,t as v,u as y}from"./google-shared-DXgnvvDU.mjs";const b={THINKING_LEVEL_UNSPECIFIED:d.THINKING_LEVEL_UNSPECIFIED,MINIMAL:d.MINIMAL,LOW:d.LOW,MEDIUM:d.MEDIUM,HIGH:d.HIGH};let x=0;const S=(t,r,i)=>{let a=new e;return(async()=>{let e={role:`assistant`,content:[],api:`google-vertex`,provider:t.provider,model:t.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()};try{if(i?.fetch&&i.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Vertex adapter`);let o=A(i),s=o?T(t,o,i?.headers):w(t,M(i),N(i),i?.headers,i?.env),c=P(t,r,i),l=await i?.onPayload?.(c,t);l!==void 0&&(c=l);let u=await _(()=>s.models.generateContentStream(c),i);a.push({type:`start`,partial:e});let d=null,p=e.content,m=()=>p.length-1;for await(let r of u){e.responseId||=r.responseId;let i=r.candidates?.[0];if(i?.content?.parts)for(let t of i.content.parts){if(t.text!==void 0){let n=g(t);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:p.length-1,content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},e.content.push(d),a.push({type:`thinking_start`,contentIndex:m(),partial:e})):(d={type:`text`,text:``},e.content.push(d),a.push({type:`text_start`,contentIndex:m(),partial:e}))),d.type===`thinking`?(d.thinking+=t.text,d.thinkingSignature=h(d.thinkingSignature,t.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:m(),delta:t.text,partial:e})):(d.text+=t.text,d.textSignature=h(d.textSignature,t.thoughtSignature),a.push({type:`text_delta`,contentIndex:m(),delta:t.text,partial:e}))}if(t.functionCall){d&&=(d.type===`text`?a.push({type:`text_end`,contentIndex:m(),content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e}),null);let n=t.functionCall.id,r={type:`toolCall`,id:!n||e.content.some(e=>e.type===`toolCall`&&e.id===n)?`${t.functionCall.name}_${Date.now()}_${++x}`:n,name:t.functionCall.name||``,arguments:t.functionCall.args??{},...t.thoughtSignature&&{thoughtSignature:t.thoughtSignature}};e.content.push(r),a.push({type:`toolcall_start`,contentIndex:m(),partial:e}),a.push({type:`toolcall_delta`,contentIndex:m(),delta:JSON.stringify(r.arguments),partial:e}),a.push({type:`toolcall_end`,contentIndex:m(),toolCall:r,partial:e})}}i?.finishReason&&(e.rawStopReason=i.finishReason,e.stopReason=f(i.finishReason),e.content.some(e=>e.type===`toolCall`)&&e.stopReason===`stop`&&(e.stopReason=`toolUse`)),r.usageMetadata&&(e.usage={input:(r.usageMetadata.promptTokenCount||0)-(r.usageMetadata.cachedContentTokenCount||0),output:(r.usageMetadata.candidatesTokenCount||0)+(r.usageMetadata.thoughtsTokenCount||0),cacheRead:r.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:r.usageMetadata.thoughtsTokenCount||0,totalTokens:r.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},n(t,e.usage))}if(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:m(),content:d.text,partial:e}):a.push({type:`thinking_end`,contentIndex:m(),content:d.thinking,partial:e})),i?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`pending`)throw Error(`Google Vertex stream ended without a finish reason`);if(e.stopReason===`aborted`||e.stopReason===`error`){let t=e.rawStopReason?`Provider stopped with: ${e.rawStopReason}`:`An unknown error occurred`;throw Error(t)}a.push({type:`done`,reason:e.stopReason,message:e}),a.end()}catch(t){for(let t of e.content)`index`in t&&delete t.index;e.stopReason=i?.signal?.aborted?`aborted`:`error`,e.errorMessage=c(s(t)),a.push({type:`error`,reason:e.stopReason,error:e}),a.end()}})(),a},C=(e,n,r)=>{let i=o(e,n,r,void 0);if(!r?.reasoning)return S(e,n,{...i,thinking:{enabled:!1}});let a=t(e,r.reasoning),s=a===`off`?`high`:a,c=e;return F(c)||I(c)?S(e,n,{...i,thinking:{enabled:!0,level:R(s,c)}}):S(e,n,{...i,thinking:{enabled:!0,budgetTokens:z(c,s,r.thinkingBudgets)}})};function w(e,t,n,r,i){let a=k(i);return new p({vertexai:!0,project:t,location:n,apiVersion:`v1`,...a?{googleAuthOptions:a}:{},httpOptions:E(e,r)})}function T(e,t,n){return new p({vertexai:!0,apiKey:t,apiVersion:`v1`,httpOptions:E(e,n)})}function E(e,t){let n={},r=D(e.baseUrl);r&&(n.baseUrl=r,n.baseUrlResourceScope=y.COLLECTION,O(r)&&(n.apiVersion=``));let a=i({...e.headers,...t});return a&&(n.headers=a),Object.keys(n).length>0?n:void 0}function D(e){let t=e.trim();if(!(!t||t.includes(`{location}`)))return t}function O(e){try{return new URL(e).pathname.split(`/`).some(e=>/^v\d+(?:beta\d*)?$/.test(e))}catch{return/(?:^|\/)v\d+(?:beta\d*)?(?:\/|$)/.test(e)}}function k(e){let t=r(`GOOGLE_APPLICATION_CREDENTIALS`,e);return t?{keyFilename:t}:void 0}function A(e){let t=e?.apiKey?.trim();if(!(!t||t===`gcp-vertex-credentials`||j(t)))return t}function j(e){return/^<[^>]+>$/.test(e)}function M(e){let t=e?.project||r(`GOOGLE_CLOUD_PROJECT`,e?.env)||r(`GCLOUD_PROJECT`,e?.env);if(!t)throw Error(`Vertex AI requires a project ID. Set GOOGLE_CLOUD_PROJECT/GCLOUD_PROJECT or pass project in options.`);return t}function N(e){let t=e?.location||r(`GOOGLE_CLOUD_LOCATION`,e?.env);if(!t)throw Error(`Vertex AI requires a location. Set GOOGLE_CLOUD_LOCATION or pass location in options.`);return t}function P(e,t,n={}){let r=v(e,t),i={};n.temperature!==void 0&&(i.temperature=n.temperature),n.maxTokens!==void 0&&(i.maxOutputTokens=n.maxTokens);let o=u(e.id),s=t.tools?.length?l(t.tools,n.toolChoice,o):void 0,c={...Object.keys(i).length>0&&i,...t.systemPrompt&&{systemInstruction:a(t.systemPrompt)},...t.tools&&t.tools.length>0&&{tools:m(t.tools,!1,o)},...s!==void 0&&{toolConfig:{functionCallingConfig:{mode:s}}}};if(n.thinking?.enabled&&e.reasoning){let e={includeThoughts:!0};n.thinking.level===void 0?n.thinking.budgetTokens!==void 0&&(e.thinkingBudget=n.thinking.budgetTokens):e.thinkingLevel=b[n.thinking.level],c.thinkingConfig=e}else e.reasoning&&n.thinking&&!n.thinking.enabled&&(c.thinkingConfig=L(e));if(n.signal){if(n.signal.aborted)throw Error(`Request aborted`);c.abortSignal=n.signal}return{model:e.id,contents:r,config:c}}function F(e){return/gemini-3(?:\.\d+)?-pro/.test(e.id.toLowerCase())}function I(e){let t=e.id.toLowerCase();return/gemini-3(?:\.\d+)?-flash/.test(t)||t===`gemini-flash-latest`||t===`gemini-flash-lite-latest`}function L(e){let t=e;return F(t)?{thinkingLevel:d.LOW}:I(t)?{thinkingLevel:d.MINIMAL}:{thinkingBudget:0}}function R(e,t){if(F(t))switch(e){case`minimal`:case`low`:return`LOW`;case`medium`:case`high`:return`HIGH`}switch(e){case`minimal`:return`MINIMAL`;case`low`:return`LOW`;case`medium`:return`MEDIUM`;case`high`:return`HIGH`}}function z(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{S as stream,C as streamSimple};