@prompt-optimizer/mcp-server 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/README.md +9 -7
- package/dist/browser.js +10 -4200
- package/dist/chunk-2AOVKKBT.js +7 -0
- package/dist/chunk-5QROM7SH.js +3 -0
- package/dist/chunk-7FYOSVIN.js +3 -0
- package/dist/chunk-AKXNS3YY.js +4 -0
- package/dist/chunk-BBXFEEUH.js +43 -0
- package/dist/chunk-CHINCAF5.js +33 -0
- package/dist/chunk-EJ2IIPFF.js +3 -0
- package/dist/chunk-FLQML3XF.js +64 -0
- package/dist/chunk-GA7S5A7R.js +3 -0
- package/dist/chunk-IABPRAPS.js +3 -0
- package/dist/chunk-JE2EBI2C.js +3 -0
- package/dist/chunk-JL6XIA4S.js +4 -0
- package/dist/chunk-JXWLV6TC.js +12 -0
- package/dist/chunk-MUXGFCOV.js +7012 -0
- package/dist/chunk-NT2DBZVA.js +3 -0
- package/dist/chunk-NVZFDKDX.js +3 -0
- package/dist/chunk-PKJ2PK6J.js +106 -0
- package/dist/chunk-SDHFVY4F.js +6 -0
- package/dist/chunk-TWLLFRFQ.js +6 -0
- package/dist/desktop-business.js +4 -1225
- package/dist/desktop-comparison-UIIN3WK4.js +3 -0
- package/dist/desktop-storage-KJWV2A3P.js +3 -0
- package/dist/desktop.js +1 -24
- package/dist/dist-OM6QMJNC.js +10 -0
- package/dist/dist-YR425RV6.js +3 -0
- package/dist/index.js +1 -10
- package/dist/legacy.js +97 -26634
- package/dist/multipart-parser-XGXMMB2Z.js +4 -0
- package/dist/node-2SMUH4FH.js +3 -0
- package/dist/node-NX6BPYD5.js +3 -0
- package/dist/node-U7LDATXE.js +17 -0
- package/dist/registry-H5F4DGAM-2GPEVJMD.js +3 -0
- package/dist/src-3F22P42W.js +5 -0
- package/dist/start.js +2 -13
- package/package.json +10 -1
- package/preload-env.cjs +3 -352
- package/dist/chunk-3FYJ3FRD.js +0 -57
- package/dist/chunk-E7Z4Y3F4.js +0 -36402
- package/dist/chunk-GBDJTSRW.js +0 -298
- package/dist/chunk-HLCN3DLS.js +0 -19745
- package/dist/chunk-HYVN7FZZ.js +0 -4787
- package/dist/chunk-MEUCFQGU.js +0 -537
- package/dist/chunk-N6AUTPPS.js +0 -10647
- package/dist/chunk-Q52SACHI.js +0 -304
- package/dist/chunk-Q5B3KFB3.js +0 -31
- package/dist/chunk-QSPNNVX3.js +0 -49017
- package/dist/chunk-SO4YJHYW.js +0 -13450
- package/dist/chunk-SV2GETJH.js +0 -65
- package/dist/chunk-TFH2LO2H.js +0 -58
- package/dist/chunk-TFJEYQ3G.js +0 -786
- package/dist/chunk-TLOFCHZI.js +0 -70
- package/dist/chunk-TQGHULC7.js +0 -188
- package/dist/chunk-UTOMPKTK.js +0 -2209
- package/dist/chunk-XXALDAL7.js +0 -1838
- package/dist/chunk-YT3U6B54.js +0 -21
- package/dist/desktop-comparison-HDIQ6K45.js +0 -22
- package/dist/desktop-storage-YRABQCLF.js +0 -14
- package/dist/dist-O5VNBF5I.js +0 -622
- package/dist/dist-UMX52UME.js +0 -481
- package/dist/multipart-parser-XE6WGDAU.js +0 -373
- package/dist/node-2RBNZOSK.js +0 -2225
- package/dist/node-4Z3USCHW.js +0 -21
- package/dist/node-QHGLD5ST.js +0 -25
- package/dist/registry-H5F4DGAM-UHR4F6LL.js +0 -13
- package/dist/src-7PBMYCGI.js +0 -1398
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __mcpCreateRequire } from "node:module";
|
|
2
|
+
const require = __mcpCreateRequire(import.meta.url);
|
|
3
|
+
import{N as A,S as y}from"./chunk-SDHFVY4F.js";import{randomUUID as g}from"node:crypto";import{isAbsolute as x,normalize as b}from"node:path";var r=class extends Error{constructor(a){super(`Desktop source request failed (${a}).`);this.code=a;this.name="DesktopSourceError"}code},R=class extends Error{constructor(a){super(`Desktop comparison request failed (${a}).`);this.code=a;this.name="DesktopComparisonRequestError"}code},U={scope:"mcp-process",sourceEpoch:"open-lease",inPlaceReplacementDetection:!1,stableAcrossRestart:!1},V=async()=>{throw new r("DESKTOP_OPENER_UNAVAILABLE")};function T(s,i,a){if(!s.length||s.length>8)throw new r("INVALID_INPUT");let O=new Set,u=s.map(e=>{if(typeof e.label!="string"||!e.label.trim()||!x(e.userDataPath))throw new r("INVALID_INPUT");let t=b(e.userDataPath),o=process.platform==="win32"?t.toLowerCase():t;if(O.has(o))throw new r("INVALID_INPUT");return O.add(o),{id:g(),profile:{label:e.label,userDataPath:t}}}),P=new Map,w=new Set,D=!1,S;function _(e){let t=e.connection;return{sourceId:e.id,kind:"desktop",label:e.profile.label,sourceEpoch:t?.executionSource.sourceEpoch??"unobserved",connectionGeneration:t?.executionSource.connectionGeneration??"unconnected",productVersion:"unknown",contractVersion:"po-capabilities/0.2",storageVersion:t?"legacy-json-migration/1":"unknown",availability:t?.active?"connected":"disconnected",readiness:t?.active?"ready":"not-ready",...e.failure?{unavailableReason:e.failure}:{}}}function d(){if(D)throw new r("OWNER_CLOSED")}function E(e){if(!e?.active||D)throw new r("CONNECTION_CLOSED")}function k(e){d();let t=P.get(e);return E(t),t}async function I(e,t=new Set){try{await e.comparison?.runner.dispose()}finally{await Promise.allSettled([...t]),await e.provider.close()}}function L(e){if(e.closePromise)return e.closePromise;e.active=!1,P.delete(e.id);let t=u.find(o=>o.connection===e);return e.closePromise=(async()=>{try{await I(e.lease,e.pending)}catch{throw t&&(t.failure="SOURCE_CLOSE_FAILED"),new r("SOURCE_CLOSE_FAILED")}finally{w.delete(e),t&&(t.connection=void 0)}})(),e.closePromise}async function v(e){let t;try{let o={kind:"desktop",sourceId:e.id,label:e.profile.label,sourceEpoch:`lease:${g()}`,connectionGeneration:g()};if(t=await a(e.profile.userDataPath,o),t.migration.version!==1)throw new r("SCHEMA_UNSUPPORTED");if(i==="compare"!=!!t.comparison)throw new r("SOURCE_NOT_READY");d();let n={id:g(),executionSource:o,active:!0,lease:t,pending:new Set,reader:t.comparison?.runner.reader??y(t.provider,o)};return e.connection=n,e.failure=void 0,P.set(n.id,n),w.add(n),n}catch(o){if(t)try{await I(t)}catch{throw e.failure="SOURCE_CLOSE_FAILED",new r("SOURCE_CLOSE_FAILED")}let n=o instanceof r?o:new r("SOURCE_OPEN_FAILED");throw e.failure=n.code,n}}async function C(e,t){let o=k(e),n=!1,c=()=>{E(o),n=!0},l=Promise.resolve().then(()=>(E(o),t(o,c)));o.pending.add(l);try{let m=await l;return E(o),m}catch(m){if(!o.active||D)throw new r(n?"WRITE_OUTCOME_UNKNOWN":"CONNECTION_CLOSED");let f=o.lease.comparison?.errorCode(m);throw f&&/^[A-Z][A-Z0-9_]{0,63}$/.test(f)?new R(f):m}finally{o.pending.delete(l)}}function p(e,t){return C(e,(o,n)=>{let c=o.lease.comparison;if(!c)throw new r("COMPARISON_ACCESS_REQUIRED");return t(c,o,n)})}return{getSourceProfile(e){return d(),u.find(t=>t.id===e)?.profile},listSources(){return d(),{sources:u.map(_),identity:U}},async open(e,t){if(d(),t!==i)throw new r("INVALID_INPUT");let o=u.find(c=>c.id===e);if(!o)throw new r("SOURCE_NOT_FOUND");if(o.failure==="SOURCE_CLOSE_FAILED")throw new r("SOURCE_CLOSE_FAILED");if(o.connection?.closePromise&&await o.connection.closePromise,d(),!o.connection){o.opening??=v(o);try{await o.opening}finally{o.opening=void 0}}let n=o.connection;return E(n),{connectionId:n.id,source:_(o),schemaVersion:"prompt-model/v1",identity:U,capabilities:{read:!0,execute:i==="compare",save:i==="compare"}}},async close(e){return await L(k(e)),{closed:!0}},listModels(e,t){return C(e,async({reader:o,lease:n})=>n.comparison?n.comparison.runner.listModels(t):o.listModels(t))},listAssets(e,t){return C(e,({reader:o})=>o.listAssets(t))},listAssetVersions(e,t,o){return C(e,({reader:n})=>n.listAssetVersions(t,o))},getAssetVersion(e,t){return C(e,({reader:o})=>o.getAssetVersion(t))},prepare(e,t){return p(e,({runner:o})=>o.prepare(t))},execute(e,t,o){return p(e,({runner:n})=>n.execute(t,o))},getTest(e,t){return p(e,({runner:o})=>o.get(t))},cancel(e,t,o){return p(e,({runner:n})=>n.cancel(t,o))},saveComparison(e,t,o){return p(e,async({runner:n,repository:c},l,m)=>{let f=await n.completed(t);m();let N=await c.save(f,o),h=N.comparison.id;return{saved:!0,comparisonId:h,revision:N.revision,viewTarget:{kind:"saved-comparison",sourceId:l.executionSource.sourceId,comparisonId:h},visibility:"reload-required"}})},listComparisons(e,t){return p(e,({repository:o})=>o.list(t))},getComparison(e,t){return p(e,({repository:o})=>o.get(t))},deleteComparison(e,t,o){return p(e,({repository:n},c,l)=>(l(),n.delete(t,o)))},dispose(){return S||(D=!0,S=(async()=>{let e=Promise.allSettled([...w].map(L)),[,t]=await Promise.all([Promise.allSettled(u.map(o=>o.opening)),e]);if(t.some(o=>o.status==="rejected")||u.some(o=>o.failure==="SOURCE_CLOSE_FAILED"))throw new r("SOURCE_CLOSE_FAILED")})(),S)}}}function G(s,i=V){return T(s,"read",a=>i(a))}function Q(s,i){return T(s,"compare",i)}function j(s,i="read"){let a=s instanceof r||s instanceof A||s instanceof R?s.code:i==="compare"?"COMPARISON_REQUEST_FAILED":"SOURCE_READ_FAILED";return{code:a,message:`Desktop ${i==="compare"?"comparison":"readonly"} request failed (${a}).`}}export{r as a,G as b,Q as c,j as d};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __mcpCreateRequire } from "node:module";
|
|
2
|
+
const require = __mcpCreateRequire(import.meta.url);
|
|
3
|
+
import{r as s}from"./chunk-7FYOSVIN.js";var c="po-browser-bridge/1",p=2*1024*1024,u=["optimize","test"],o=class extends Error{constructor(r){super(`Browser source request failed (${r}).`),s(this,"code",r),this.name="BrowserBridgeError"}},d=[{operation:"getFavorites",access:"read",arguments:["options?"],minimum:0},{operation:"getFavorite",access:"read",arguments:["id"],minimum:1},{operation:"getCategories",access:"read",arguments:[],minimum:0},{operation:"getAllTags",access:"read",arguments:[],minimum:0},{operation:"addFavorite",access:"write",arguments:["favorite"],minimum:1},{operation:"updateFavorite",access:"write",arguments:["id","updates"],minimum:2},{operation:"setFavoritePromptAssetCurrentVersion",access:"write",arguments:["id","versionId"],minimum:2},{operation:"deleteFavoritePromptAssetVersion",access:"write",arguments:["id","versionId"],minimum:2},{operation:"deleteFavorite",access:"write",arguments:["id"],minimum:1}];function n(r,e=0,t={remaining:1e5}){if(e>32||--t.remaining<0)throw new o("INVALID_INPUT");if(!(r===null||typeof r=="string"||typeof r=="boolean")&&!(typeof r=="number"&&Number.isFinite(r))){if(Array.isArray(r)){for(let i of r)n(i,e+1,t);return}if(!r||typeof r!="object"||![Object.prototype,null].includes(Object.getPrototypeOf(r)))throw new o("INVALID_INPUT");for(let[i,a]of Object.entries(r)){if(["__proto__","constructor","prototype"].includes(i))throw new o("INVALID_INPUT");n(a,e+1,t)}}}function f(r){let e=r instanceof Error&&"code"in r?r.code:void 0;return typeof e=="string"&&/^[A-Z][A-Z_]{0,79}$/.test(e)?e:"PRODUCT_REQUEST_FAILED"}export{c as a,p as b,u as c,o as d,d as e,n as f,f as g};
|