@hienlh/ppm 0.8.37 → 0.8.39

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 (55) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +7 -1
  3. package/dist/web/assets/{api-client-Bs-0pRox.js → api-client-B0aMOJxF.js} +1 -1
  4. package/dist/web/assets/{api-settings-D42qxHtn.js → api-settings-0Hx_9lIU.js} +1 -1
  5. package/dist/web/assets/chat-tab-CGic5t8w.js +7 -0
  6. package/dist/web/assets/code-editor-DZlXHMtA.js +1 -0
  7. package/dist/web/assets/columns-2-BZ5wv2wA.js +1 -0
  8. package/dist/web/assets/database-viewer-BaxjPtYR.js +1 -0
  9. package/dist/web/assets/diff-viewer-CDdO3tqP.js +4 -0
  10. package/dist/web/assets/{dist-CU2je4l7.js → dist-QgqOdSYG.js} +2 -2
  11. package/dist/web/assets/git-graph-C-TRbbx7.js +1 -0
  12. package/dist/web/assets/index-CvbNQ1mi.js +28 -0
  13. package/dist/web/assets/input-4ElbicvY.js +41 -0
  14. package/dist/web/assets/jsx-runtime-wQxeESYQ.js +1 -0
  15. package/dist/web/assets/keybindings-store-Dqs-i9cV.js +1 -0
  16. package/dist/web/assets/{markdown-renderer-DmuIK1-X.js → markdown-renderer-DE503g9L.js} +2 -2
  17. package/dist/web/assets/postgres-viewer-hmqfZRr-.js +1 -0
  18. package/dist/web/assets/react-CYzKIDNi.js +1 -0
  19. package/dist/web/assets/{react-Dhei_cB0.js → react-Dk7fkoaB.js} +1 -1
  20. package/dist/web/assets/{settings-store-CIOAyrzs.js → settings-store-Clv3ZNje.js} +2 -2
  21. package/dist/web/assets/settings-tab-BdgsQeES.js +1 -0
  22. package/dist/web/assets/sqlite-viewer-9X_1ZHJE.js +1 -0
  23. package/dist/web/assets/tab-store-D7tRt0VT.js +1 -0
  24. package/dist/web/assets/table-B6neW6Hr.js +1 -0
  25. package/dist/web/assets/{terminal-tab-ZMG3urJd.js → terminal-tab-V7x81Qpr.js} +2 -2
  26. package/dist/web/assets/{use-monaco-theme-D6807XbV.js → use-monaco-theme-czriskTO.js} +1 -1
  27. package/dist/web/index.html +10 -11
  28. package/dist/web/sw.js +1 -1
  29. package/package.json +1 -1
  30. package/scripts/install.ps1 +116 -0
  31. package/scripts/install.sh +8 -15
  32. package/scripts/release.sh +34 -7
  33. package/src/cli/commands/restart.ts +5 -1
  34. package/src/server/index.ts +9 -16
  35. package/src/server/routes/static.ts +7 -2
  36. package/src/server/routes/tunnel.ts +0 -14
  37. package/src/services/tunnel.service.ts +22 -0
  38. package/dist/web/assets/chat-tab-DesJNGlM.js +0 -7
  39. package/dist/web/assets/code-editor-BJSi0tN8.js +0 -1
  40. package/dist/web/assets/columns-2-BSNHGqVP.js +0 -1
  41. package/dist/web/assets/database-viewer-BRtti__1.js +0 -1
  42. package/dist/web/assets/diff-viewer-BtqxNPvT.js +0 -4
  43. package/dist/web/assets/git-graph-BwaH1gCr.js +0 -1
  44. package/dist/web/assets/index-cCRyobYW.js +0 -237
  45. package/dist/web/assets/input-D3FZB4A8.js +0 -45
  46. package/dist/web/assets/jsx-dev-runtime-B0R0R7SH.js +0 -6
  47. package/dist/web/assets/jsx-runtime-CdTrtNt5.js +0 -6
  48. package/dist/web/assets/keybindings-store-EctjzvyI.js +0 -1
  49. package/dist/web/assets/postgres-viewer-BToBpDFs.js +0 -1
  50. package/dist/web/assets/react-4j_0SqET.js +0 -13
  51. package/dist/web/assets/settings-tab-CIM3X82k.js +0 -1
  52. package/dist/web/assets/sqlite-viewer-CSsYLA1Q.js +0 -1
  53. package/dist/web/assets/tab-store-HCmwXLYA.js +0 -1
  54. package/dist/web/assets/table-CSrbr8mU.js +0 -1
  55. /package/dist/web/assets/{utils-DC-bdPS3.js → utils-DBpa1UZX.js} +0 -0
package/dist/web/sw.js CHANGED
@@ -1 +1 @@
1
- try{self[`workbox:core:7.3.0`]&&_()}catch{}var e={"invalid-value":({paramName:e,validValueDescription:t,value:n})=>{if(!e||!t)throw Error(`Unexpected input to 'invalid-value' error.`);return`The '${e}' parameter was given a value with an unexpected value. ${t} Received a value of ${JSON.stringify(n)}.`},"not-an-array":({moduleName:e,className:t,funcName:n,paramName:r})=>{if(!e||!t||!n||!r)throw Error(`Unexpected input to 'not-an-array' error.`);return`The parameter '${r}' passed into '${e}.${t}.${n}()' must be an array.`},"incorrect-type":({expectedType:e,paramName:t,moduleName:n,className:r,funcName:i})=>{if(!e||!t||!n||!i)throw Error(`Unexpected input to 'incorrect-type' error.`);return`The parameter '${t}' passed into '${n}.${r?`${r}.`:``}${i}()' must be of type ${e}.`},"incorrect-class":({expectedClassName:e,paramName:t,moduleName:n,className:r,funcName:i,isReturnValueProblem:a})=>{if(!e||!n||!i)throw Error(`Unexpected input to 'incorrect-class' error.`);let o=r?`${r}.`:``;return a?`The return value from '${n}.${o}${i}()' must be an instance of class ${e}.`:`The parameter '${t}' passed into '${n}.${o}${i}()' must be an instance of class ${e}.`},"missing-a-method":({expectedMethod:e,paramName:t,moduleName:n,className:r,funcName:i})=>{if(!e||!t||!n||!r||!i)throw Error(`Unexpected input to 'missing-a-method' error.`);return`${n}.${r}.${i}() expected the '${t}' parameter to expose a '${e}' method.`},"add-to-cache-list-unexpected-type":({entry:e})=>`An unexpected entry was passed to 'workbox-precaching.PrecacheController.addToCacheList()' The entry '${JSON.stringify(e)}' isn't supported. You must supply an array of strings with one or more characters, objects with a url property or Request objects.`,"add-to-cache-list-conflicting-entries":({firstEntry:e,secondEntry:t})=>{if(!e||!t)throw Error(`Unexpected input to 'add-to-cache-list-duplicate-entries' error.`);return`Two of the entries passed to 'workbox-precaching.PrecacheController.addToCacheList()' had the URL ${e} but different revision details. Workbox is unable to cache and version the asset correctly. Please remove one of the entries.`},"plugin-error-request-will-fetch":({thrownErrorMessage:e})=>{if(!e)throw Error(`Unexpected input to 'plugin-error-request-will-fetch', error.`);return`An error was thrown by a plugins 'requestWillFetch()' method. The thrown error message was: '${e}'.`},"invalid-cache-name":({cacheNameId:e,value:t})=>{if(!e)throw Error(`Expected a 'cacheNameId' for error 'invalid-cache-name'`);return`You must provide a name containing at least one character for setCacheDetails({${e}: '...'}). Received a value of '${JSON.stringify(t)}'`},"unregister-route-but-not-found-with-method":({method:e})=>{if(!e)throw Error(`Unexpected input to 'unregister-route-but-not-found-with-method' error.`);return`The route you're trying to unregister was not previously registered for the method type '${e}'.`},"unregister-route-route-not-registered":()=>`The route you're trying to unregister was not previously registered.`,"queue-replay-failed":({name:e})=>`Replaying the background sync queue '${e}' failed.`,"duplicate-queue-name":({name:e})=>`The Queue name '${e}' is already being used. All instances of backgroundSync.Queue must be given unique names.`,"expired-test-without-max-age":({methodName:e,paramName:t})=>`The '${e}()' method can only be used when the '${t}' is used in the constructor.`,"unsupported-route-type":({moduleName:e,className:t,funcName:n,paramName:r})=>`The supplied '${r}' parameter was an unsupported type. Please check the docs for ${e}.${t}.${n} for valid input types.`,"not-array-of-class":({value:e,expectedClass:t,moduleName:n,className:r,funcName:i,paramName:a})=>`The supplied '${a}' parameter must be an array of '${t}' objects. Received '${JSON.stringify(e)},'. Please check the call to ${n}.${r}.${i}() to fix the issue.`,"max-entries-or-age-required":({moduleName:e,className:t,funcName:n})=>`You must define either config.maxEntries or config.maxAgeSecondsin ${e}.${t}.${n}`,"statuses-or-headers-required":({moduleName:e,className:t,funcName:n})=>`You must define either config.statuses or config.headersin ${e}.${t}.${n}`,"invalid-string":({moduleName:e,funcName:t,paramName:n})=>{if(!n||!e||!t)throw Error(`Unexpected input to 'invalid-string' error.`);return`When using strings, the '${n}' parameter must start with 'http' (for cross-origin matches) or '/' (for same-origin matches). Please see the docs for ${e}.${t}() for more info.`},"channel-name-required":()=>`You must provide a channelName to construct a BroadcastCacheUpdate instance.`,"invalid-responses-are-same-args":()=>`The arguments passed into responsesAreSame() appear to be invalid. Please ensure valid Responses are used.`,"expire-custom-caches-only":()=>`You must provide a 'cacheName' property when using the expiration plugin with a runtime caching strategy.`,"unit-must-be-bytes":({normalizedRangeHeader:e})=>{if(!e)throw Error(`Unexpected input to 'unit-must-be-bytes' error.`);return`The 'unit' portion of the Range header must be set to 'bytes'. The Range header provided was "${e}"`},"single-range-only":({normalizedRangeHeader:e})=>{if(!e)throw Error(`Unexpected input to 'single-range-only' error.`);return`Multiple ranges are not supported. Please use a single start value, and optional end value. The Range header provided was "${e}"`},"invalid-range-values":({normalizedRangeHeader:e})=>{if(!e)throw Error(`Unexpected input to 'invalid-range-values' error.`);return`The Range header is missing both start and end values. At least one of those values is needed. The Range header provided was "${e}"`},"no-range-header":()=>`No Range header was found in the Request provided.`,"range-not-satisfiable":({size:e,start:t,end:n})=>`The start (${t}) and end (${n}) values in the Range are not satisfiable by the cached response, which is ${e} bytes.`,"attempt-to-cache-non-get-request":({url:e,method:t})=>`Unable to cache '${e}' because it is a '${t}' request and only 'GET' requests can be cached.`,"cache-put-with-no-response":({url:e})=>`There was an attempt to cache '${e}' but the response was not defined.`,"no-response":({url:e,error:t})=>{let n=`The strategy could not generate a response for '${e}'.`;return t&&(n+=` The underlying error is ${t}.`),n},"bad-precaching-response":({url:e,status:t})=>`The precaching request for '${e}' failed`+(t?` with an HTTP status of ${t}.`:`.`),"non-precached-url":({url:e})=>`createHandlerBoundToURL('${e}') was called, but that URL is not precached. Please pass in a URL that is precached instead.`,"add-to-cache-list-conflicting-integrities":({url:e})=>`Two of the entries passed to 'workbox-precaching.PrecacheController.addToCacheList()' had the URL ${e} with different integrity values. Please remove one of them.`,"missing-precache-entry":({cacheName:e,url:t})=>`Unable to find a precached response in ${e} for ${t}.`,"cross-origin-copy-response":({origin:e})=>`workbox-core.copyResponse() can only be used with same-origin responses. It was passed a response with origin ${e}.`,"opaque-streams-source":({type:e})=>{let t=`One of the workbox-streams sources resulted in an '${e}' response.`;return e===`opaqueredirect`?`${t} Please do not use a navigation request that results in a redirect as a source.`:`${t} Please ensure your sources are CORS-enabled.`}},t=(t,n={})=>{let r=e[t];if(!r)throw Error(`Unable to find message for code '${t}'.`);return r(n)},n=class extends Error{constructor(e,n){let r=t(e,n);super(r),this.name=e,this.details=n}},r={hasMethod:(e,t,r)=>{if(typeof e[t]!=`function`)throw r.expectedMethod=t,new n(`missing-a-method`,r)},isArray:(e,t)=>{if(!Array.isArray(e))throw new n(`not-an-array`,t)},isInstance:(e,t,r)=>{if(!(e instanceof t))throw r.expectedClassName=t.name,new n(`incorrect-class`,r)},isOneOf:(e,t,r)=>{if(!t.includes(e))throw r.validValueDescription=`Valid values are ${JSON.stringify(t)}.`,new n(`invalid-value`,r)},isType:(e,t,r)=>{if(typeof e!==t)throw r.expectedType=t,new n(`incorrect-type`,r)},isArrayOfClass:(e,t,r)=>{let i=new n(`not-array-of-class`,r);if(!Array.isArray(e))throw i;for(let n of e)if(!(n instanceof t))throw i}},i={googleAnalytics:`googleAnalytics`,precache:`precache-v2`,prefix:`workbox`,runtime:`runtime`,suffix:typeof registration<`u`?registration.scope:``},a=e=>[i.prefix,e,i.suffix].filter(e=>e&&e.length>0).join(`-`),o=e=>{for(let t of Object.keys(i))e(t)},s={updateDetails:e=>{o(t=>{typeof e[t]==`string`&&(i[t]=e[t])})},getGoogleAnalyticsName:e=>e||a(i.googleAnalytics),getPrecacheName:e=>e||a(i.precache),getPrefix:()=>i.prefix,getRuntimeName:e=>e||a(i.runtime),getSuffix:()=>i.suffix},c=(()=>{`__WB_DISABLE_DEV_LOGS`in globalThis||(self.__WB_DISABLE_DEV_LOGS=!1);let e=!1,t={debug:`#7f8c8d`,log:`#2ecc71`,warn:`#f39c12`,error:`#c0392b`,groupCollapsed:`#3498db`,groupEnd:null},n=function(n,r){if(self.__WB_DISABLE_DEV_LOGS)return;if(n===`groupCollapsed`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)){console[n](...r);return}let i=[`background: ${t[n]}`,`border-radius: 0.5em`,`color: white`,`font-weight: bold`,`padding: 2px 0.5em`],a=e?[]:[`%cworkbox`,i.join(`;`)];console[n](...a,...r),n===`groupCollapsed`&&(e=!0),n===`groupEnd`&&(e=!1)},r={},i=Object.keys(t);for(let e of i){let t=e;r[t]=(...e)=>{n(t,e)}}return r})();function l(e,t){let n=t();return e.waitUntil(n),n}try{self[`workbox:precaching:7.3.0`]&&_()}catch{}var u=`__WB_REVISION__`;function d(e){if(!e)throw new n(`add-to-cache-list-unexpected-type`,{entry:e});if(typeof e==`string`){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:t,url:r}=e;if(!r)throw new n(`add-to-cache-list-unexpected-type`,{entry:e});if(!t){let e=new URL(r,location.href);return{cacheKey:e.href,url:e.href}}let i=new URL(r,location.href),a=new URL(r,location.href);return i.searchParams.set(u,t),{cacheKey:i.href,url:a.href}}var f=class{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type===`install`&&t&&t.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}},p=class{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{let n=t?.cacheKey||this._precacheController.getCacheKeyForURL(e.url);return n?new Request(n,{headers:e.headers}):e},this._precacheController=e}},m=(e,t)=>{c.groupCollapsed(e);for(let e of t)c.log(e);c.groupEnd()};function h(e){let t=e.length;t>0&&(c.groupCollapsed(`During precaching cleanup, ${t} cached request${t===1?` was`:`s were`} deleted.`),m(`Deleted Cache Requests`,e),c.groupEnd())}function g(e,t){if(t.length!==0){c.groupCollapsed(e);for(let e of t)c.log(e);c.groupEnd()}}function v(e,t){let n=e.length,r=t.length;if(n||r){let i=`Precaching ${n} file${n===1?``:`s`}.`;r>0&&(i+=` ${r} file${r===1?` is`:`s are`} already cached.`),c.groupCollapsed(i),g(`View newly precached URLs.`,e),g(`View previously precached URLs.`,t),c.groupEnd()}}var y;function b(){if(y===void 0){let e=new Response(``);if(`body`in e)try{new Response(e.body),y=!0}catch{y=!1}y=!1}return y}async function x(e,t){let r=null;if(e.url&&(r=new URL(e.url).origin),r!==self.location.origin)throw new n(`cross-origin-copy-response`,{origin:r});let i=e.clone(),a={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},o=t?t(a):a,s=b()?i.body:await i.blob();return new Response(s,o)}var S=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),``);function C(e,t){let n=new URL(e);for(let e of t)n.searchParams.delete(e);return n.href}async function w(e,t,n,r){let i=C(t.url,n);if(t.url===i)return e.match(t,r);let a=Object.assign(Object.assign({},r),{ignoreSearch:!0}),o=await e.keys(t,a);for(let t of o)if(i===C(t.url,n))return e.match(t,r)}var T=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},E=new Set;async function D(){c.log(`About to run ${E.size} callbacks to clean up caches.`);for(let e of E)await e(),c.log(e,`is complete.`);c.log(`Finished running callbacks.`)}function O(e){return new Promise(t=>setTimeout(t,e))}try{self[`workbox:strategies:7.3.0`]&&_()}catch{}function k(e){return typeof e==`string`?new Request(e):e}var A=class{constructor(e,t){this._cacheKeys={},r.isInstance(t.event,ExtendableEvent,{moduleName:`workbox-strategies`,className:`StrategyHandler`,funcName:`constructor`,paramName:`options.event`}),Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new T,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let e of this._plugins)this._pluginStateMap.set(e,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:t}=this,r=k(e);if(r.mode===`navigate`&&t instanceof FetchEvent&&t.preloadResponse){let e=await t.preloadResponse;if(e)return c.log(`Using a preloaded navigation response for '${S(r.url)}'`),e}let i=this.hasCallback(`fetchDidFail`)?r.clone():null;try{for(let e of this.iterateCallbacks(`requestWillFetch`))r=await e({request:r.clone(),event:t})}catch(e){if(e instanceof Error)throw new n(`plugin-error-request-will-fetch`,{thrownErrorMessage:e.message})}let a=r.clone();try{let e;e=await fetch(r,r.mode===`navigate`?void 0:this._strategy.fetchOptions),c.debug(`Network request for '${S(r.url)}' returned a response with status '${e.status}'.`);for(let n of this.iterateCallbacks(`fetchDidSucceed`))e=await n({event:t,request:a,response:e});return e}catch(e){throw c.log(`Network request for '${S(r.url)}' threw an error.`,e),i&&await this.runCallbacks(`fetchDidFail`,{error:e,event:t,originalRequest:i.clone(),request:a.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){let t=k(e),n,{cacheName:r,matchOptions:i}=this._strategy,a=await this.getCacheKey(t,`read`),o=Object.assign(Object.assign({},i),{cacheName:r});n=await caches.match(a,o),n?c.debug(`Found a cached response in '${r}'.`):c.debug(`No cached response found in '${r}'.`);for(let e of this.iterateCallbacks(`cachedResponseWillBeUsed`))n=await e({cacheName:r,matchOptions:i,cachedResponse:n,request:a,event:this.event})||void 0;return n}async cachePut(e,t){let r=k(e);await O(0);let i=await this.getCacheKey(r,`write`);{if(i.method&&i.method!==`GET`)throw new n(`attempt-to-cache-non-get-request`,{url:S(i.url),method:i.method});let e=t.headers.get(`Vary`);e&&c.debug(`The response for ${S(i.url)} has a 'Vary: ${e}' header. Consider setting the {ignoreVary: true} option on your strategy to ensure cache matching and deletion works as expected.`)}if(!t)throw c.error(`Cannot cache non-existent response for '${S(i.url)}'.`),new n(`cache-put-with-no-response`,{url:S(i.url)});let a=await this._ensureResponseSafeToCache(t);if(!a)return c.debug(`Response '${S(i.url)}' will not be cached.`,a),!1;let{cacheName:o,matchOptions:s}=this._strategy,l=await self.caches.open(o),u=this.hasCallback(`cacheDidUpdate`),d=u?await w(l,i.clone(),[`__WB_REVISION__`],s):null;c.debug(`Updating the '${o}' cache with a new Response for ${S(i.url)}.`);try{await l.put(i,u?a.clone():a)}catch(e){if(e instanceof Error)throw e.name===`QuotaExceededError`&&await D(),e}for(let e of this.iterateCallbacks(`cacheDidUpdate`))await e({cacheName:o,oldResponse:d,newResponse:a.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){let n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let r=e;for(let e of this.iterateCallbacks(`cacheKeyWillBeUsed`))r=k(await e({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[n]=r}return this._cacheKeys[n]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]==`function`){let n=this._pluginStateMap.get(t);yield r=>{let i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){let e=this._extendLifetimePromises.splice(0),t=(await Promise.allSettled(e)).find(e=>e.status===`rejected`);if(t)throw t.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(let e of this.iterateCallbacks(`cacheWillUpdate`))if(t=await e({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||(t&&t.status!==200&&(t=void 0),t&&t.status!==200&&(t.status===0?c.warn(`The response for '${this.request.url}' is an opaque response. The caching strategy that you're using will not cache opaque responses by default.`):c.debug(`The response for '${this.request.url}' returned a status code of '${e.status}' and won't be cached as a result.`))),t}},j=class{constructor(e={}){this.cacheName=s.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,n=typeof e.request==`string`?new Request(e.request):e.request,r=`params`in e?e.params:void 0,i=new A(this,{event:t,request:n,params:r}),a=this._getResponse(i,n,t);return[a,this._awaitComplete(a,i,n,t)]}async _getResponse(e,t,r){await e.runCallbacks(`handlerWillStart`,{event:r,request:t});let i;try{if(i=await this._handle(t,e),!i||i.type===`error`)throw new n(`no-response`,{url:t.url})}catch(n){if(n instanceof Error){for(let a of e.iterateCallbacks(`handlerDidError`))if(i=await a({error:n,event:r,request:t}),i)break}if(i)c.log(`While responding to '${S(t.url)}', an ${n instanceof Error?n.toString():``} error occurred. Using a fallback response provided by a handlerDidError plugin.`);else throw n}for(let n of e.iterateCallbacks(`handlerWillRespond`))i=await n({event:r,request:t,response:i});return i}async _awaitComplete(e,t,n,r){let i,a;try{i=await e}catch{}try{await t.runCallbacks(`handlerDidRespond`,{event:r,request:n,response:i}),await t.doneWaiting()}catch(e){e instanceof Error&&(a=e)}if(await t.runCallbacks(`handlerDidComplete`,{event:r,request:n,response:i,error:a}),t.destroy(),a)throw a}},M=class e extends j{constructor(t={}){t.cacheName=s.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&t.event.type===`install`?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,t){let r,i=t.params||{};if(this._fallbackToNetwork){c.warn(`The precached response for ${S(e.url)} in ${this.cacheName} was not found. Falling back to the network.`);let n=i.integrity,a=e.integrity,o=!a||a===n;r=await t.fetch(new Request(e,{integrity:e.mode===`no-cors`?void 0:a||n})),n&&o&&e.mode!==`no-cors`&&(this._useDefaultCacheabilityPluginIfNeeded(),await t.cachePut(e,r.clone())&&c.log(`A response for ${S(e.url)} was used to "repair" the precache.`))}else throw new n(`missing-precache-entry`,{cacheName:this.cacheName,url:e.url});{let n=i.cacheKey||await t.getCacheKey(e,`read`);c.groupCollapsed(`Precaching is responding to: `+S(e.url)),c.log(`Serving the precached url: ${S(n instanceof Request?n.url:n)}`),c.groupCollapsed(`View request details here.`),c.log(e),c.groupEnd(),c.groupCollapsed(`View response details here.`),c.log(r),c.groupEnd(),c.groupEnd()}return r}async _handleInstall(e,t){this._useDefaultCacheabilityPluginIfNeeded();let r=await t.fetch(e);if(!await t.cachePut(e,r.clone()))throw new n(`bad-precaching-response`,{url:e.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,n=0;for(let[r,i]of this.plugins.entries())i!==e.copyRedirectedCacheableResponsesPlugin&&(i===e.defaultPrecacheCacheabilityPlugin&&(t=r),i.cacheWillUpdate&&n++);n===0?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):n>1&&t!==null&&this.plugins.splice(t,1)}};M.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:e}){return!e||e.status>=400?null:e}},M.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:e}){return e.redirected?await x(e):e}};var N=class{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new M({cacheName:s.getPrecacheName(e),plugins:[...t,new p({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||=(self.addEventListener(`install`,this.install),self.addEventListener(`activate`,this.activate),!0)}addToCacheList(e){r.isArray(e,{moduleName:`workbox-precaching`,className:`PrecacheController`,funcName:`addToCacheList`,paramName:`entries`});let t=[];for(let r of e){typeof r==`string`?t.push(r):r&&r.revision===void 0&&t.push(r.url);let{cacheKey:e,url:i}=d(r),a=typeof r!=`string`&&r.revision?`reload`:`default`;if(this._urlsToCacheKeys.has(i)&&this._urlsToCacheKeys.get(i)!==e)throw new n(`add-to-cache-list-conflicting-entries`,{firstEntry:this._urlsToCacheKeys.get(i),secondEntry:e});if(typeof r!=`string`&&r.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==r.integrity)throw new n(`add-to-cache-list-conflicting-integrities`,{url:i});this._cacheKeysToIntegrities.set(e,r.integrity)}if(this._urlsToCacheKeys.set(i,e),this._urlsToCacheModes.set(i,a),t.length>0){let e=`Workbox is precaching URLs without revision info: ${t.join(`, `)}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;c.warn(e)}}}install(e){return l(e,async()=>{let t=new f;this.strategy.plugins.push(t);for(let[t,n]of this._urlsToCacheKeys){let r=this._cacheKeysToIntegrities.get(n),i=this._urlsToCacheModes.get(t),a=new Request(t,{integrity:r,cache:i,credentials:`same-origin`});await Promise.all(this.strategy.handleAll({params:{cacheKey:n},request:a,event:e}))}let{updatedURLs:n,notUpdatedURLs:r}=t;return v(n,r),{updatedURLs:n,notUpdatedURLs:r}})}activate(e){return l(e,async()=>{let e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),n=new Set(this._urlsToCacheKeys.values()),r=[];for(let i of t)n.has(i.url)||(await e.delete(i),r.push(i.url));return h(r),{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){let t=this.getCacheKeyForURL(e);if(!t)throw new n(`non-precached-url`,{url:e});return n=>(n.request=new Request(e),n.params=Object.assign({cacheKey:t},n.params),this.strategy.handle(n))}},P,F=()=>(P||=new N,P);try{self[`workbox:routing:7.3.0`]&&_()}catch{}var I=[`DELETE`,`GET`,`HEAD`,`PATCH`,`POST`,`PUT`],L=e=>e&&typeof e==`object`?(r.hasMethod(e,`handle`,{moduleName:`workbox-routing`,className:`Route`,funcName:`constructor`,paramName:`handler`}),e):(r.isType(e,`function`,{moduleName:`workbox-routing`,className:`Route`,funcName:`constructor`,paramName:`handler`}),{handle:e}),R=class{constructor(e,t,n=`GET`){r.isType(e,`function`,{moduleName:`workbox-routing`,className:`Route`,funcName:`constructor`,paramName:`match`}),n&&r.isOneOf(n,I,{paramName:`method`}),this.handler=L(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=L(e)}},z=class extends R{constructor(e,t,n){r.isInstance(e,RegExp,{moduleName:`workbox-routing`,className:`RegExpRoute`,funcName:`constructor`,paramName:`pattern`}),super(({url:t})=>{let n=e.exec(t.href);if(n){if(t.origin!==location.origin&&n.index!==0){c.debug(`The regular expression '${e.toString()}' only partially matched against the cross-origin URL '${t.toString()}'. RegExpRoute's will only handle cross-origin requests if they match the entire URL.`);return}return n.slice(1)}},t,n)}},B=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener(`fetch`,(e=>{let{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener(`message`,(e=>{if(e.data&&e.data.type===`CACHE_URLS`){let{payload:t}=e.data;c.debug(`Caching URLs from the window`,t.urlsToCache);let n=Promise.all(t.urlsToCache.map(t=>{typeof t==`string`&&(t=[t]);let n=new Request(...t);return this.handleRequest({request:n,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){r.isInstance(e,Request,{moduleName:`workbox-routing`,className:`Router`,funcName:`handleRequest`,paramName:`options.request`});let n=new URL(e.url,location.href);if(!n.protocol.startsWith(`http`)){c.debug(`Workbox Router only supports URLs that start with 'http'.`);return}let i=n.origin===location.origin,{params:a,route:o}=this.findMatchingRoute({event:t,request:e,sameOrigin:i,url:n}),s=o&&o.handler,l=[];s&&(l.push([`Found a route to handle this request:`,o]),a&&l.push([`Passing the following params to the route's handler:`,a]));let u=e.method;if(!s&&this._defaultHandlerMap.has(u)&&(l.push(`Failed to find a matching route. Falling back to the default handler for ${u}.`),s=this._defaultHandlerMap.get(u)),!s){c.debug(`No route found for: ${S(n)}`);return}c.groupCollapsed(`Router is responding to: ${S(n)}`),l.forEach(e=>{Array.isArray(e)?c.log(...e):c.log(e)}),c.groupEnd();let d;try{d=s.handle({url:n,request:e,event:t,params:a})}catch(e){d=Promise.reject(e)}let f=o&&o.catchHandler;return d instanceof Promise&&(this._catchHandler||f)&&(d=d.catch(async r=>{if(f){c.groupCollapsed(`Error thrown when responding to: ${S(n)}. Falling back to route's Catch Handler.`),c.error(`Error thrown by:`,o),c.error(r),c.groupEnd();try{return await f.handle({url:n,request:e,event:t,params:a})}catch(e){e instanceof Error&&(r=e)}}if(this._catchHandler)return c.groupCollapsed(`Error thrown when responding to: ${S(n)}. Falling back to global Catch Handler.`),c.error(`Error thrown by:`,o),c.error(r),c.groupEnd(),this._catchHandler.handle({url:n,request:e,event:t});throw r})),d}findMatchingRoute({url:e,sameOrigin:t,request:n,event:r}){let i=this._routes.get(n.method)||[];for(let a of i){let i,o=a.match({url:e,sameOrigin:t,request:n,event:r});if(o)return o instanceof Promise&&c.warn(`While routing ${S(e)}, an async matchCallback function was used. Please convert the following route to use a synchronous matchCallback function:`,a),i=o,(Array.isArray(i)&&i.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o==`boolean`)&&(i=void 0),{route:a,params:i}}return{}}setDefaultHandler(e,t=`GET`){this._defaultHandlerMap.set(t,L(e))}setCatchHandler(e){this._catchHandler=L(e)}registerRoute(e){r.isType(e,`object`,{moduleName:`workbox-routing`,className:`Router`,funcName:`registerRoute`,paramName:`route`}),r.hasMethod(e,`match`,{moduleName:`workbox-routing`,className:`Router`,funcName:`registerRoute`,paramName:`route`}),r.isType(e.handler,`object`,{moduleName:`workbox-routing`,className:`Router`,funcName:`registerRoute`,paramName:`route`}),r.hasMethod(e.handler,`handle`,{moduleName:`workbox-routing`,className:`Router`,funcName:`registerRoute`,paramName:`route.handler`}),r.isType(e.method,`string`,{moduleName:`workbox-routing`,className:`Router`,funcName:`registerRoute`,paramName:`route.method`}),this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new n(`unregister-route-but-not-found-with-method`,{method:e.method});let t=this._routes.get(e.method).indexOf(e);if(t>-1)this._routes.get(e.method).splice(t,1);else throw new n(`unregister-route-route-not-registered`)}},V,H=()=>(V||(V=new B,V.addFetchListener(),V.addCacheListener()),V);function U(e,t,r){let i;if(typeof e==`string`){let a=new URL(e,location.href);{if(!(e.startsWith(`/`)||e.startsWith(`http`)))throw new n(`invalid-string`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});let t=e.startsWith(`http`)?a.pathname:e,r=`[*:?+]`;RegExp(`${r}`).exec(t)&&c.debug(`The '$capture' parameter contains an Express-style wildcard character (${r}). Strings are now always interpreted as exact matches; use a RegExp for partial or wildcard matches.`)}i=new R(({url:t})=>(t.pathname===a.pathname&&t.origin!==a.origin&&c.debug(`${e} only partially matches the cross-origin URL ${t.toString()}. This route will only handle cross-origin requests if they match the entire URL.`),t.href===a.href),t,r)}else if(e instanceof RegExp)i=new z(e,t,r);else if(typeof e==`function`)i=new R(e,t,r);else if(e instanceof R)i=e;else throw new n(`unsupported-route-type`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});return H().registerRoute(i),i}function W(e,t=[]){for(let n of[...e.searchParams.keys()])t.some(e=>e.test(n))&&e.searchParams.delete(n);return e}function*G(e,{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:n=`index.html`,cleanURLs:r=!0,urlManipulation:i}={}){let a=new URL(e,location.href);a.hash=``,yield a.href;let o=W(a,t);if(yield o.href,n&&o.pathname.endsWith(`/`)){let e=new URL(o.href);e.pathname+=n,yield e.href}if(r){let e=new URL(o.href);e.pathname+=`.html`,yield e.href}if(i){let e=i({url:a});for(let t of e)yield t.href}}var K=class extends R{constructor(e,t){super(({request:n})=>{let r=e.getURLsToCacheKeys();for(let i of G(n.url,t)){let t=r.get(i);if(t)return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}c.debug(`Precaching did not find a match for `+S(n.url))},e.strategy)}};function q(e){U(new K(F(),e))}function J(e){F().precache(e)}function Y(e,t){J(e),q(t)}Y([{"revision":"1872c500de691dce40960bb85481de07","url":"registerSW.js"},{"revision":"f727c20fe5ff32da07c4d9ab1610f527","url":"index.html"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-512.svg"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-192.svg"},{"revision":"eb9818b9094675c0c5d303168f273345","url":"monacoeditorwork/ts.worker.bundle.js"},{"revision":"9af0be92dcefdc1f1290441cb5ff5d9b","url":"monacoeditorwork/json.worker.bundle.js"},{"revision":"a261b429c39dbb75ae97972d7d005e6d","url":"monacoeditorwork/html.worker.bundle.js"},{"revision":"79953d804e1bbacecfd79b85fd679016","url":"monacoeditorwork/editor.worker.bundle.js"},{"revision":"fdcba0d09aac31df7a0bc652f6e739bd","url":"monacoeditorwork/css.worker.bundle.js"},{"revision":null,"url":"assets/utils-DC-bdPS3.js"},{"revision":null,"url":"assets/use-monaco-theme-D6807XbV.js"},{"revision":null,"url":"assets/terminal-tab-ZMG3urJd.js"},{"revision":null,"url":"assets/terminal-tab-BrP-ENHg.css"},{"revision":null,"url":"assets/table-CSrbr8mU.js"},{"revision":null,"url":"assets/tab-store-HCmwXLYA.js"},{"revision":null,"url":"assets/sqlite-viewer-CSsYLA1Q.js"},{"revision":null,"url":"assets/settings-tab-CIM3X82k.js"},{"revision":null,"url":"assets/settings-store-CIOAyrzs.js"},{"revision":null,"url":"assets/react-Dhei_cB0.js"},{"revision":null,"url":"assets/react-4j_0SqET.js"},{"revision":null,"url":"assets/postgres-viewer-BToBpDFs.js"},{"revision":null,"url":"assets/markdown-renderer-DmuIK1-X.js"},{"revision":null,"url":"assets/keybindings-store-EctjzvyI.js"},{"revision":null,"url":"assets/jsx-runtime-CdTrtNt5.js"},{"revision":null,"url":"assets/jsx-dev-runtime-B0R0R7SH.js"},{"revision":null,"url":"assets/input-D3FZB4A8.js"},{"revision":null,"url":"assets/index-cCRyobYW.js"},{"revision":null,"url":"assets/index-DXTts38q.css"},{"revision":null,"url":"assets/git-graph-BwaH1gCr.js"},{"revision":null,"url":"assets/dist-CU2je4l7.js"},{"revision":null,"url":"assets/diff-viewer-BtqxNPvT.js"},{"revision":null,"url":"assets/database-viewer-BRtti__1.js"},{"revision":null,"url":"assets/columns-2-BSNHGqVP.js"},{"revision":null,"url":"assets/code-editor-BJSi0tN8.js"},{"revision":null,"url":"assets/chat-tab-DesJNGlM.js"},{"revision":null,"url":"assets/api-settings-D42qxHtn.js"},{"revision":null,"url":"assets/api-client-Bs-0pRox.js"},{"revision":"79c8870653c8f419f2e3323085e1f4be","url":"manifest.webmanifest"}]),self.addEventListener(`push`,e=>{e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{if(t.some(e=>e.visibilityState===`visible`))return;let n=e.data?.json()??{title:`PPM`,body:`Chat completed`};return self.registration.showNotification(n.title,{body:n.body,icon:`/icon-192.png`,badge:`/icon-192.png`,tag:`ppm-chat-done`,silent:!1,data:{url:self.location.origin}})}))}),self.addEventListener(`notificationclick`,e=>{e.notification.close(),e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{for(let e of t)if(e.url.includes(self.location.origin)&&`focus`in e)return e.focus();return self.clients.openWindow(e.notification.data?.url||`/`)}))});
1
+ try{self[`workbox:core:7.3.0`]&&_()}catch{}var e=(e,...t)=>{let n=e;return t.length>0&&(n+=` :: ${JSON.stringify(t)}`),n},t=class extends Error{constructor(t,n){let r=e(t,n);super(r),this.name=t,this.details=n}},n={googleAnalytics:`googleAnalytics`,precache:`precache-v2`,prefix:`workbox`,runtime:`runtime`,suffix:typeof registration<`u`?registration.scope:``},r=e=>[n.prefix,e,n.suffix].filter(e=>e&&e.length>0).join(`-`),i=e=>{for(let t of Object.keys(n))e(t)},a={updateDetails:e=>{i(t=>{typeof e[t]==`string`&&(n[t]=e[t])})},getGoogleAnalyticsName:e=>e||r(n.googleAnalytics),getPrecacheName:e=>e||r(n.precache),getPrefix:()=>n.prefix,getRuntimeName:e=>e||r(n.runtime),getSuffix:()=>n.suffix};function o(e,t){let n=t();return e.waitUntil(n),n}try{self[`workbox:precaching:7.3.0`]&&_()}catch{}var s=`__WB_REVISION__`;function c(e){if(!e)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(typeof e==`string`){let t=new URL(e,location.href);return{cacheKey:t.href,url:t.href}}let{revision:n,url:r}=e;if(!r)throw new t(`add-to-cache-list-unexpected-type`,{entry:e});if(!n){let e=new URL(r,location.href);return{cacheKey:e.href,url:e.href}}let i=new URL(r,location.href),a=new URL(r,location.href);return i.searchParams.set(s,n),{cacheKey:i.href,url:a.href}}var l=class{constructor(){this.updatedURLs=[],this.notUpdatedURLs=[],this.handlerWillStart=async({request:e,state:t})=>{t&&(t.originalRequest=e)},this.cachedResponseWillBeUsed=async({event:e,state:t,cachedResponse:n})=>{if(e.type===`install`&&t&&t.originalRequest&&t.originalRequest instanceof Request){let e=t.originalRequest.url;n?this.notUpdatedURLs.push(e):this.updatedURLs.push(e)}return n}}},u=class{constructor({precacheController:e}){this.cacheKeyWillBeUsed=async({request:e,params:t})=>{let n=t?.cacheKey||this._precacheController.getCacheKeyForURL(e.url);return n?new Request(n,{headers:e.headers}):e},this._precacheController=e}},d;function f(){if(d===void 0){let e=new Response(``);if(`body`in e)try{new Response(e.body),d=!0}catch{d=!1}d=!1}return d}async function p(e,n){let r=null;if(e.url&&(r=new URL(e.url).origin),r!==self.location.origin)throw new t(`cross-origin-copy-response`,{origin:r});let i=e.clone(),a={headers:new Headers(i.headers),status:i.status,statusText:i.statusText},o=n?n(a):a,s=f()?i.body:await i.blob();return new Response(s,o)}var m=e=>new URL(String(e),location.href).href.replace(RegExp(`^${location.origin}`),``);function h(e,t){let n=new URL(e);for(let e of t)n.searchParams.delete(e);return n.href}async function g(e,t,n,r){let i=h(t.url,n);if(t.url===i)return e.match(t,r);let a=Object.assign(Object.assign({},r),{ignoreSearch:!0}),o=await e.keys(t,a);for(let t of o)if(i===h(t.url,n))return e.match(t,r)}var v=class{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}},y=new Set;async function b(){for(let e of y)await e()}function x(e){return new Promise(t=>setTimeout(t,e))}try{self[`workbox:strategies:7.3.0`]&&_()}catch{}function S(e){return typeof e==`string`?new Request(e):e}var C=class{constructor(e,t){this._cacheKeys={},Object.assign(this,t),this.event=t.event,this._strategy=e,this._handlerDeferred=new v,this._extendLifetimePromises=[],this._plugins=[...e.plugins],this._pluginStateMap=new Map;for(let e of this._plugins)this._pluginStateMap.set(e,{});this.event.waitUntil(this._handlerDeferred.promise)}async fetch(e){let{event:n}=this,r=S(e);if(r.mode===`navigate`&&n instanceof FetchEvent&&n.preloadResponse){let e=await n.preloadResponse;if(e)return e}let i=this.hasCallback(`fetchDidFail`)?r.clone():null;try{for(let e of this.iterateCallbacks(`requestWillFetch`))r=await e({request:r.clone(),event:n})}catch(e){if(e instanceof Error)throw new t(`plugin-error-request-will-fetch`,{thrownErrorMessage:e.message})}let a=r.clone();try{let e;e=await fetch(r,r.mode===`navigate`?void 0:this._strategy.fetchOptions);for(let t of this.iterateCallbacks(`fetchDidSucceed`))e=await t({event:n,request:a,response:e});return e}catch(e){throw i&&await this.runCallbacks(`fetchDidFail`,{error:e,event:n,originalRequest:i.clone(),request:a.clone()}),e}}async fetchAndCachePut(e){let t=await this.fetch(e),n=t.clone();return this.waitUntil(this.cachePut(e,n)),t}async cacheMatch(e){let t=S(e),n,{cacheName:r,matchOptions:i}=this._strategy,a=await this.getCacheKey(t,`read`),o=Object.assign(Object.assign({},i),{cacheName:r});n=await caches.match(a,o);for(let e of this.iterateCallbacks(`cachedResponseWillBeUsed`))n=await e({cacheName:r,matchOptions:i,cachedResponse:n,request:a,event:this.event})||void 0;return n}async cachePut(e,n){let r=S(e);await x(0);let i=await this.getCacheKey(r,`write`);if(!n)throw new t(`cache-put-with-no-response`,{url:m(i.url)});let a=await this._ensureResponseSafeToCache(n);if(!a)return!1;let{cacheName:o,matchOptions:s}=this._strategy,c=await self.caches.open(o),l=this.hasCallback(`cacheDidUpdate`),u=l?await g(c,i.clone(),[`__WB_REVISION__`],s):null;try{await c.put(i,l?a.clone():a)}catch(e){if(e instanceof Error)throw e.name===`QuotaExceededError`&&await b(),e}for(let e of this.iterateCallbacks(`cacheDidUpdate`))await e({cacheName:o,oldResponse:u,newResponse:a.clone(),request:i,event:this.event});return!0}async getCacheKey(e,t){let n=`${e.url} | ${t}`;if(!this._cacheKeys[n]){let r=e;for(let e of this.iterateCallbacks(`cacheKeyWillBeUsed`))r=S(await e({mode:t,request:r,event:this.event,params:this.params}));this._cacheKeys[n]=r}return this._cacheKeys[n]}hasCallback(e){for(let t of this._strategy.plugins)if(e in t)return!0;return!1}async runCallbacks(e,t){for(let n of this.iterateCallbacks(e))await n(t)}*iterateCallbacks(e){for(let t of this._strategy.plugins)if(typeof t[e]==`function`){let n=this._pluginStateMap.get(t);yield r=>{let i=Object.assign(Object.assign({},r),{state:n});return t[e](i)}}}waitUntil(e){return this._extendLifetimePromises.push(e),e}async doneWaiting(){for(;this._extendLifetimePromises.length;){let e=this._extendLifetimePromises.splice(0),t=(await Promise.allSettled(e)).find(e=>e.status===`rejected`);if(t)throw t.reason}}destroy(){this._handlerDeferred.resolve(null)}async _ensureResponseSafeToCache(e){let t=e,n=!1;for(let e of this.iterateCallbacks(`cacheWillUpdate`))if(t=await e({request:this.request,response:t,event:this.event})||void 0,n=!0,!t)break;return n||t&&t.status!==200&&(t=void 0),t}},w=class{constructor(e={}){this.cacheName=a.getRuntimeName(e.cacheName),this.plugins=e.plugins||[],this.fetchOptions=e.fetchOptions,this.matchOptions=e.matchOptions}handle(e){let[t]=this.handleAll(e);return t}handleAll(e){e instanceof FetchEvent&&(e={event:e,request:e.request});let t=e.event,n=typeof e.request==`string`?new Request(e.request):e.request,r=`params`in e?e.params:void 0,i=new C(this,{event:t,request:n,params:r}),a=this._getResponse(i,n,t);return[a,this._awaitComplete(a,i,n,t)]}async _getResponse(e,n,r){await e.runCallbacks(`handlerWillStart`,{event:r,request:n});let i;try{if(i=await this._handle(n,e),!i||i.type===`error`)throw new t(`no-response`,{url:n.url})}catch(t){if(t instanceof Error){for(let a of e.iterateCallbacks(`handlerDidError`))if(i=await a({error:t,event:r,request:n}),i)break}if(!i)throw t}for(let t of e.iterateCallbacks(`handlerWillRespond`))i=await t({event:r,request:n,response:i});return i}async _awaitComplete(e,t,n,r){let i,a;try{i=await e}catch{}try{await t.runCallbacks(`handlerDidRespond`,{event:r,request:n,response:i}),await t.doneWaiting()}catch(e){e instanceof Error&&(a=e)}if(await t.runCallbacks(`handlerDidComplete`,{event:r,request:n,response:i,error:a}),t.destroy(),a)throw a}},T=class e extends w{constructor(t={}){t.cacheName=a.getPrecacheName(t.cacheName),super(t),this._fallbackToNetwork=t.fallbackToNetwork!==!1,this.plugins.push(e.copyRedirectedCacheableResponsesPlugin)}async _handle(e,t){return await t.cacheMatch(e)||(t.event&&t.event.type===`install`?await this._handleInstall(e,t):await this._handleFetch(e,t))}async _handleFetch(e,n){let r,i=n.params||{};if(this._fallbackToNetwork){let t=i.integrity,a=e.integrity,o=!a||a===t;r=await n.fetch(new Request(e,{integrity:e.mode===`no-cors`?void 0:a||t})),t&&o&&e.mode!==`no-cors`&&(this._useDefaultCacheabilityPluginIfNeeded(),await n.cachePut(e,r.clone()))}else throw new t(`missing-precache-entry`,{cacheName:this.cacheName,url:e.url});return r}async _handleInstall(e,n){this._useDefaultCacheabilityPluginIfNeeded();let r=await n.fetch(e);if(!await n.cachePut(e,r.clone()))throw new t(`bad-precaching-response`,{url:e.url,status:r.status});return r}_useDefaultCacheabilityPluginIfNeeded(){let t=null,n=0;for(let[r,i]of this.plugins.entries())i!==e.copyRedirectedCacheableResponsesPlugin&&(i===e.defaultPrecacheCacheabilityPlugin&&(t=r),i.cacheWillUpdate&&n++);n===0?this.plugins.push(e.defaultPrecacheCacheabilityPlugin):n>1&&t!==null&&this.plugins.splice(t,1)}};T.defaultPrecacheCacheabilityPlugin={async cacheWillUpdate({response:e}){return!e||e.status>=400?null:e}},T.copyRedirectedCacheableResponsesPlugin={async cacheWillUpdate({response:e}){return e.redirected?await p(e):e}};var E=class{constructor({cacheName:e,plugins:t=[],fallbackToNetwork:n=!0}={}){this._urlsToCacheKeys=new Map,this._urlsToCacheModes=new Map,this._cacheKeysToIntegrities=new Map,this._strategy=new T({cacheName:a.getPrecacheName(e),plugins:[...t,new u({precacheController:this})],fallbackToNetwork:n}),this.install=this.install.bind(this),this.activate=this.activate.bind(this)}get strategy(){return this._strategy}precache(e){this.addToCacheList(e),this._installAndActiveListenersAdded||=(self.addEventListener(`install`,this.install),self.addEventListener(`activate`,this.activate),!0)}addToCacheList(e){let n=[];for(let r of e){typeof r==`string`?n.push(r):r&&r.revision===void 0&&n.push(r.url);let{cacheKey:e,url:i}=c(r),a=typeof r!=`string`&&r.revision?`reload`:`default`;if(this._urlsToCacheKeys.has(i)&&this._urlsToCacheKeys.get(i)!==e)throw new t(`add-to-cache-list-conflicting-entries`,{firstEntry:this._urlsToCacheKeys.get(i),secondEntry:e});if(typeof r!=`string`&&r.integrity){if(this._cacheKeysToIntegrities.has(e)&&this._cacheKeysToIntegrities.get(e)!==r.integrity)throw new t(`add-to-cache-list-conflicting-integrities`,{url:i});this._cacheKeysToIntegrities.set(e,r.integrity)}if(this._urlsToCacheKeys.set(i,e),this._urlsToCacheModes.set(i,a),n.length>0){let e=`Workbox is precaching URLs without revision info: ${n.join(`, `)}\nThis is generally NOT safe. Learn more at https://bit.ly/wb-precache`;console.warn(e)}}}install(e){return o(e,async()=>{let t=new l;this.strategy.plugins.push(t);for(let[t,n]of this._urlsToCacheKeys){let r=this._cacheKeysToIntegrities.get(n),i=this._urlsToCacheModes.get(t),a=new Request(t,{integrity:r,cache:i,credentials:`same-origin`});await Promise.all(this.strategy.handleAll({params:{cacheKey:n},request:a,event:e}))}let{updatedURLs:n,notUpdatedURLs:r}=t;return{updatedURLs:n,notUpdatedURLs:r}})}activate(e){return o(e,async()=>{let e=await self.caches.open(this.strategy.cacheName),t=await e.keys(),n=new Set(this._urlsToCacheKeys.values()),r=[];for(let i of t)n.has(i.url)||(await e.delete(i),r.push(i.url));return{deletedURLs:r}})}getURLsToCacheKeys(){return this._urlsToCacheKeys}getCachedURLs(){return[...this._urlsToCacheKeys.keys()]}getCacheKeyForURL(e){let t=new URL(e,location.href);return this._urlsToCacheKeys.get(t.href)}getIntegrityForCacheKey(e){return this._cacheKeysToIntegrities.get(e)}async matchPrecache(e){let t=e instanceof Request?e.url:e,n=this.getCacheKeyForURL(t);if(n)return(await self.caches.open(this.strategy.cacheName)).match(n)}createHandlerBoundToURL(e){let n=this.getCacheKeyForURL(e);if(!n)throw new t(`non-precached-url`,{url:e});return t=>(t.request=new Request(e),t.params=Object.assign({cacheKey:n},t.params),this.strategy.handle(t))}},D,O=()=>(D||=new E,D);try{self[`workbox:routing:7.3.0`]&&_()}catch{}var k=e=>e&&typeof e==`object`?e:{handle:e},A=class{constructor(e,t,n=`GET`){this.handler=k(t),this.match=e,this.method=n}setCatchHandler(e){this.catchHandler=k(e)}},j=class extends A{constructor(e,t,n){super(({url:t})=>{let n=e.exec(t.href);if(n&&!(t.origin!==location.origin&&n.index!==0))return n.slice(1)},t,n)}},M=class{constructor(){this._routes=new Map,this._defaultHandlerMap=new Map}get routes(){return this._routes}addFetchListener(){self.addEventListener(`fetch`,(e=>{let{request:t}=e,n=this.handleRequest({request:t,event:e});n&&e.respondWith(n)}))}addCacheListener(){self.addEventListener(`message`,(e=>{if(e.data&&e.data.type===`CACHE_URLS`){let{payload:t}=e.data,n=Promise.all(t.urlsToCache.map(t=>{typeof t==`string`&&(t=[t]);let n=new Request(...t);return this.handleRequest({request:n,event:e})}));e.waitUntil(n),e.ports&&e.ports[0]&&n.then(()=>e.ports[0].postMessage(!0))}}))}handleRequest({request:e,event:t}){let n=new URL(e.url,location.href);if(!n.protocol.startsWith(`http`))return;let r=n.origin===location.origin,{params:i,route:a}=this.findMatchingRoute({event:t,request:e,sameOrigin:r,url:n}),o=a&&a.handler,s=e.method;if(!o&&this._defaultHandlerMap.has(s)&&(o=this._defaultHandlerMap.get(s)),!o)return;let c;try{c=o.handle({url:n,request:e,event:t,params:i})}catch(e){c=Promise.reject(e)}let l=a&&a.catchHandler;return c instanceof Promise&&(this._catchHandler||l)&&(c=c.catch(async r=>{if(l)try{return await l.handle({url:n,request:e,event:t,params:i})}catch(e){e instanceof Error&&(r=e)}if(this._catchHandler)return this._catchHandler.handle({url:n,request:e,event:t});throw r})),c}findMatchingRoute({url:e,sameOrigin:t,request:n,event:r}){let i=this._routes.get(n.method)||[];for(let a of i){let i,o=a.match({url:e,sameOrigin:t,request:n,event:r});if(o)return i=o,(Array.isArray(i)&&i.length===0||o.constructor===Object&&Object.keys(o).length===0||typeof o==`boolean`)&&(i=void 0),{route:a,params:i}}return{}}setDefaultHandler(e,t=`GET`){this._defaultHandlerMap.set(t,k(e))}setCatchHandler(e){this._catchHandler=k(e)}registerRoute(e){this._routes.has(e.method)||this._routes.set(e.method,[]),this._routes.get(e.method).push(e)}unregisterRoute(e){if(!this._routes.has(e.method))throw new t(`unregister-route-but-not-found-with-method`,{method:e.method});let n=this._routes.get(e.method).indexOf(e);if(n>-1)this._routes.get(e.method).splice(n,1);else throw new t(`unregister-route-route-not-registered`)}},N,P=()=>(N||(N=new M,N.addFetchListener(),N.addCacheListener()),N);function F(e,n,r){let i;if(typeof e==`string`){let t=new URL(e,location.href);i=new A(({url:e})=>e.href===t.href,n,r)}else if(e instanceof RegExp)i=new j(e,n,r);else if(typeof e==`function`)i=new A(e,n,r);else if(e instanceof A)i=e;else throw new t(`unsupported-route-type`,{moduleName:`workbox-routing`,funcName:`registerRoute`,paramName:`capture`});return P().registerRoute(i),i}function I(e,t=[]){for(let n of[...e.searchParams.keys()])t.some(e=>e.test(n))&&e.searchParams.delete(n);return e}function*L(e,{ignoreURLParametersMatching:t=[/^utm_/,/^fbclid$/],directoryIndex:n=`index.html`,cleanURLs:r=!0,urlManipulation:i}={}){let a=new URL(e,location.href);a.hash=``,yield a.href;let o=I(a,t);if(yield o.href,n&&o.pathname.endsWith(`/`)){let e=new URL(o.href);e.pathname+=n,yield e.href}if(r){let e=new URL(o.href);e.pathname+=`.html`,yield e.href}if(i){let e=i({url:a});for(let t of e)yield t.href}}var R=class extends A{constructor(e,t){super(({request:n})=>{let r=e.getURLsToCacheKeys();for(let i of L(n.url,t)){let t=r.get(i);if(t)return{cacheKey:t,integrity:e.getIntegrityForCacheKey(t)}}},e.strategy)}};function z(e){F(new R(O(),e))}function B(e){O().precache(e)}function V(e,t){B(e),z(t)}V([{"revision":"1872c500de691dce40960bb85481de07","url":"registerSW.js"},{"revision":"81a25a239b5e5783d83ebff44e33d728","url":"index.html"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-512.svg"},{"revision":"a0fb34fc84eb148d51812cd62669f20d","url":"icon-192.svg"},{"revision":"eb9818b9094675c0c5d303168f273345","url":"monacoeditorwork/ts.worker.bundle.js"},{"revision":"9af0be92dcefdc1f1290441cb5ff5d9b","url":"monacoeditorwork/json.worker.bundle.js"},{"revision":"a261b429c39dbb75ae97972d7d005e6d","url":"monacoeditorwork/html.worker.bundle.js"},{"revision":"79953d804e1bbacecfd79b85fd679016","url":"monacoeditorwork/editor.worker.bundle.js"},{"revision":"fdcba0d09aac31df7a0bc652f6e739bd","url":"monacoeditorwork/css.worker.bundle.js"},{"revision":null,"url":"assets/utils-DBpa1UZX.js"},{"revision":null,"url":"assets/use-monaco-theme-czriskTO.js"},{"revision":null,"url":"assets/terminal-tab-V7x81Qpr.js"},{"revision":null,"url":"assets/terminal-tab-BrP-ENHg.css"},{"revision":null,"url":"assets/table-B6neW6Hr.js"},{"revision":null,"url":"assets/tab-store-D7tRt0VT.js"},{"revision":null,"url":"assets/sqlite-viewer-9X_1ZHJE.js"},{"revision":null,"url":"assets/settings-tab-BdgsQeES.js"},{"revision":null,"url":"assets/settings-store-Clv3ZNje.js"},{"revision":null,"url":"assets/react-Dk7fkoaB.js"},{"revision":null,"url":"assets/react-CYzKIDNi.js"},{"revision":null,"url":"assets/postgres-viewer-hmqfZRr-.js"},{"revision":null,"url":"assets/markdown-renderer-DE503g9L.js"},{"revision":null,"url":"assets/keybindings-store-Dqs-i9cV.js"},{"revision":null,"url":"assets/jsx-runtime-wQxeESYQ.js"},{"revision":null,"url":"assets/input-4ElbicvY.js"},{"revision":null,"url":"assets/index-DXTts38q.css"},{"revision":null,"url":"assets/index-CvbNQ1mi.js"},{"revision":null,"url":"assets/git-graph-C-TRbbx7.js"},{"revision":null,"url":"assets/dist-QgqOdSYG.js"},{"revision":null,"url":"assets/diff-viewer-CDdO3tqP.js"},{"revision":null,"url":"assets/database-viewer-BaxjPtYR.js"},{"revision":null,"url":"assets/columns-2-BZ5wv2wA.js"},{"revision":null,"url":"assets/code-editor-DZlXHMtA.js"},{"revision":null,"url":"assets/chat-tab-CGic5t8w.js"},{"revision":null,"url":"assets/api-settings-0Hx_9lIU.js"},{"revision":null,"url":"assets/api-client-B0aMOJxF.js"},{"revision":"79c8870653c8f419f2e3323085e1f4be","url":"manifest.webmanifest"}]),self.addEventListener(`push`,e=>{e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{if(t.some(e=>e.visibilityState===`visible`))return;let n=e.data?.json()??{title:`PPM`,body:`Chat completed`};return self.registration.showNotification(n.title,{body:n.body,icon:`/icon-192.png`,badge:`/icon-192.png`,tag:`ppm-chat-done`,silent:!1,data:{url:self.location.origin}})}))}),self.addEventListener(`notificationclick`,e=>{e.notification.close(),e.waitUntil(self.clients.matchAll({type:`window`,includeUncontrolled:!0}).then(t=>{for(let e of t)if(e.url.includes(self.location.origin)&&`focus`in e)return e.focus();return self.clients.openWindow(e.notification.data?.url||`/`)}))});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hienlh/ppm",
3
- "version": "0.8.37",
3
+ "version": "0.8.39",
4
4
  "description": "Personal Project Manager — mobile-first web IDE with AI assistance",
5
5
  "author": "hienlh",
6
6
  "license": "MIT",
@@ -0,0 +1,116 @@
1
+ $ErrorActionPreference = "Stop"
2
+ $ProgressPreference = "SilentlyContinue"
3
+ # PowerShell 5.1 defaults to TLS 1.0 — GitHub requires TLS 1.2
4
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
5
+
6
+ $Repo = "hienlh/ppm"
7
+ $InstallDir = if ($env:PPM_INSTALL_DIR) { $env:PPM_INSTALL_DIR } else { "$env:USERPROFILE\.ppm\bin" }
8
+ $Artifact = "ppm-windows-x64.exe"
9
+
10
+ Write-Host "Detected: windows/x64"
11
+
12
+ # Check current version
13
+ $Current = ""
14
+ if (Test-Path "$InstallDir\ppm.exe") {
15
+ try { $Current = & "$InstallDir\ppm.exe" --version 2>$null } catch {}
16
+ }
17
+
18
+ # Get latest release
19
+ Write-Host "Fetching latest release..."
20
+ $Release = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest"
21
+ $Tag = $Release.tag_name
22
+ if (-not $Tag) { Write-Host "Failed to fetch latest release"; exit 1 }
23
+ $Latest = $Tag -replace "^v", ""
24
+
25
+ # Check if upgrade needed
26
+ if ($Current -eq $Latest) {
27
+ Write-Host "Already up to date: v$Current"
28
+ exit 0
29
+ }
30
+ if ($Current) {
31
+ Write-Host "Upgrading: v$Current -> v$Latest"
32
+ } else {
33
+ Write-Host "Installing: v$Latest"
34
+ }
35
+
36
+ # Download and extract archive
37
+ $Archive = "ppm-windows-x64"
38
+ $Url = "https://github.com/$Repo/releases/download/$Tag/${Archive}.zip"
39
+ Write-Host "Downloading ${Archive}.zip..."
40
+ New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
41
+ $TmpZip = "$env:TEMP\ppm-install.zip"
42
+ & curl.exe -fSL# --ssl-no-revoke -o $TmpZip $Url
43
+ if ($LASTEXITCODE -ne 0) {
44
+ Write-Host "Download failed. Binary may not be available for this version."
45
+ Write-Host "Try installing via: bunx @hienlh/ppm start"
46
+ exit 1
47
+ }
48
+ # Extract ppm.exe + web/ into install dir
49
+ $TmpDir = "$env:TEMP\ppm-extract"
50
+ Remove-Item $TmpDir -Recurse -ErrorAction SilentlyContinue
51
+ Expand-Archive -Path $TmpZip -DestinationPath $TmpDir -Force
52
+ # Move contents from nested folder to install dir
53
+ $Nested = Get-ChildItem $TmpDir | Select-Object -First 1
54
+ Copy-Item "$($Nested.FullName)\*" -Destination $InstallDir -Recurse -Force
55
+ Remove-Item $TmpZip, $TmpDir -Recurse -ErrorAction SilentlyContinue
56
+
57
+ # Show changelog
58
+ Write-Host ""
59
+ Write-Host "========== Changelog =========="
60
+ try {
61
+ $Changelog = Invoke-RestMethod "https://raw.githubusercontent.com/$Repo/$Tag/CHANGELOG.md" -ErrorAction Stop
62
+ if ($Current) {
63
+ $Print = $false
64
+ foreach ($Line in $Changelog -split "`n") {
65
+ if ($Line -match "^## \[(.+?)\]") {
66
+ if ($Matches[1] -eq $Current) { break }
67
+ $Print = $true
68
+ }
69
+ if ($Print) { Write-Host $Line }
70
+ }
71
+ } else {
72
+ $Count = 0
73
+ foreach ($Line in $Changelog -split "`n") {
74
+ if ($Line -match "^## \[") { $Count++ }
75
+ if ($Count -gt 1) { break }
76
+ if ($Count -eq 1) { Write-Host $Line }
77
+ }
78
+ }
79
+ } catch {
80
+ Write-Host "(changelog unavailable)"
81
+ }
82
+ Write-Host "================================"
83
+
84
+ Write-Host ""
85
+ if ($Current) {
86
+ Write-Host "Upgraded ppm v$Current -> v$Latest"
87
+ } else {
88
+ Write-Host "Installed ppm v$Latest to $InstallDir\ppm.exe"
89
+ }
90
+
91
+ # Add to PATH
92
+ $UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
93
+ if ($UserPath -notlike "*$InstallDir*") {
94
+ [Environment]::SetEnvironmentVariable("Path", "$InstallDir;$UserPath", "User")
95
+ $env:Path = "$InstallDir;$env:Path"
96
+ Write-Host "Added to PATH. Restart your terminal to use ppm."
97
+ }
98
+
99
+ # Getting started (fresh install)
100
+ if (-not $Current) {
101
+ Write-Host ""
102
+ Write-Host "========== Getting Started =========="
103
+ Write-Host "1. Restart your terminal"
104
+ Write-Host "2. Run the setup wizard:"
105
+ Write-Host " ppm init"
106
+ Write-Host "3. Start the server:"
107
+ Write-Host " ppm start"
108
+ Write-Host "4. Open in browser:"
109
+ Write-Host " ppm open"
110
+ Write-Host ""
111
+ Write-Host "For remote access (public URL via Cloudflare tunnel):"
112
+ Write-Host " ppm start --share"
113
+ Write-Host ""
114
+ Write-Host "Docs: https://github.com/$Repo#readme"
115
+ Write-Host "====================================="
116
+ }
@@ -49,19 +49,15 @@ else
49
49
  echo "Installing: v${LATEST}"
50
50
  fi
51
51
 
52
- # Check if binary exists in release
53
- URL="https://github.com/${REPO}/releases/download/${TAG}/${ARTIFACT}"
54
- HTTP_CODE=$(curl -sL -o /dev/null -w "%{http_code}" "$URL")
55
- if [ "$HTTP_CODE" != "200" ] && [ "$HTTP_CODE" != "302" ]; then
56
- echo "Binary not available for ${os}/${arch} in ${TAG} (HTTP ${HTTP_CODE})"
57
- echo "Try installing via: bunx @hienlh/ppm start"
58
- exit 1
59
- fi
60
-
61
- # Download binary
62
- echo "Downloading ${ARTIFACT}..."
52
+ # Download and extract archive
53
+ URL="https://github.com/${REPO}/releases/download/${TAG}/${ARTIFACT}.tar.gz"
54
+ echo "Downloading ${ARTIFACT}.tar.gz..."
63
55
  mkdir -p "$INSTALL_DIR"
64
- curl -fSL# -o "${INSTALL_DIR}/ppm" "$URL"
56
+ TMPFILE=$(mktemp)
57
+ curl -fSL# -o "$TMPFILE" "$URL"
58
+ # Extract binary + web/ into install dir
59
+ tar -xzf "$TMPFILE" -C "$INSTALL_DIR"
60
+ rm -f "$TMPFILE"
65
61
  chmod +x "${INSTALL_DIR}/ppm"
66
62
 
67
63
  # Show changelog
@@ -71,7 +67,6 @@ CHANGELOG_URL="https://raw.githubusercontent.com/${REPO}/${TAG}/CHANGELOG.md"
71
67
  CHANGELOG=$(curl -fsSL "$CHANGELOG_URL" 2>/dev/null || true)
72
68
  if [ -n "$CHANGELOG" ]; then
73
69
  if [ -n "$CURRENT" ]; then
74
- # Upgrade: show entries between current and latest
75
70
  echo "$CHANGELOG" | awk -v cur="$CURRENT" '
76
71
  /^## \[/ {
77
72
  ver = $0; gsub(/.*\[/, "", ver); gsub(/\].*/, "", ver)
@@ -81,7 +76,6 @@ if [ -n "$CHANGELOG" ]; then
81
76
  printing { print }
82
77
  '
83
78
  else
84
- # Fresh install: show latest entry only
85
79
  echo "$CHANGELOG" | awk '
86
80
  /^## \[/ { count++; if (count > 1) exit }
87
81
  count == 1 { print }
@@ -104,7 +98,6 @@ PATH_LINE="export PATH=\"${INSTALL_DIR}:\$PATH\""
104
98
  case ":$PATH:" in
105
99
  *":${INSTALL_DIR}:"*) ;;
106
100
  *)
107
- # Detect shell profile
108
101
  PROFILE=""
109
102
  if [ -n "$ZSH_VERSION" ] || [ "$(basename "$SHELL")" = "zsh" ]; then
110
103
  PROFILE="$HOME/.zshrc"
@@ -36,21 +36,48 @@ for entry in "${TARGETS[@]}"; do
36
36
  bun build src/index.ts --compile --target="$target" --outfile="dist/$artifact"
37
37
  done
38
38
 
39
- # 3. Create tag if not exists
39
+ # 3. Package binaries with web assets
40
+ echo "[3/5] Packaging..."
41
+ rm -f dist/ppm-*.tar.gz dist/ppm-*.zip
42
+
43
+ for entry in "${TARGETS[@]}"; do
44
+ artifact="${entry##*:}"
45
+ if [[ "$artifact" == *.exe ]]; then
46
+ # Windows: zip
47
+ name="${artifact%.exe}"
48
+ mkdir -p "dist/$name"
49
+ cp "dist/$artifact" "dist/$name/ppm.exe"
50
+ cp -r dist/web "dist/$name/web"
51
+ (cd dist && zip -qr "${name}.zip" "$name")
52
+ rm -rf "dist/$name"
53
+ echo " -> ${name}.zip"
54
+ else
55
+ # Unix: tar.gz
56
+ mkdir -p "dist/$artifact-pkg"
57
+ cp "dist/$artifact" "dist/$artifact-pkg/ppm"
58
+ cp -r dist/web "dist/$artifact-pkg/web"
59
+ tar -czf "dist/${artifact}.tar.gz" -C "dist/$artifact-pkg" .
60
+ rm -rf "dist/$artifact-pkg"
61
+ echo " -> ${artifact}.tar.gz"
62
+ fi
63
+ done
64
+
65
+ # 4. Create tag if not exists
40
66
  if git rev-parse "$TAG" >/dev/null 2>&1; then
41
- echo "[3/4] Tag $TAG already exists, skipping"
67
+ echo "[4/5] Tag $TAG already exists, skipping"
42
68
  else
43
- echo "[3/4] Creating tag $TAG..."
69
+ echo "[4/5] Creating tag $TAG..."
44
70
  git tag "$TAG"
45
71
  git push origin "$TAG"
46
72
  fi
47
73
 
48
- # 4. Create or update release
49
- echo "[4/4] Uploading to GitHub release..."
74
+ # 5. Create or update release
75
+ echo "[5/5] Uploading to GitHub release..."
76
+ ARCHIVES=(dist/ppm-*.tar.gz dist/ppm-*.zip)
50
77
  if gh release view "$TAG" >/dev/null 2>&1; then
51
- gh release upload "$TAG" dist/ppm-* --clobber
78
+ gh release upload "$TAG" ${ARCHIVES[@]} --clobber
52
79
  else
53
- gh release create "$TAG" dist/ppm-* --title "$TAG" --generate-notes
80
+ gh release create "$TAG" ${ARCHIVES[@]} --title "$TAG" --generate-notes
54
81
  fi
55
82
 
56
83
  echo "=== Done: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/tag/$TAG ==="
@@ -126,7 +126,11 @@ async function main() {
126
126
  // Spawn new server — on Windows use PowerShell Start-Process for true detach
127
127
  // (Bun.spawn + unref on Windows keeps child in same job object → dies when worker exits)
128
128
  let childPid: number;
129
- const serverArgs = ["run", P.serverScript, "__serve__", String(P.port), P.host, P.config].filter(Boolean);
129
+ // Compiled binary: execPath IS the server, no "run script" needed
130
+ const { isCompiledBinary } = await import("../../services/autostart-generator.ts");
131
+ const serverArgs = isCompiledBinary()
132
+ ? ["__serve__", String(P.port), P.host, P.config].filter(Boolean)
133
+ : ["run", P.serverScript, "__serve__", String(P.port), P.host, P.config].filter(Boolean);
130
134
 
131
135
  if (process.platform === "win32") {
132
136
  const bunExe = process.execPath.replace(/\\\\/g, "\\\\\\\\");
@@ -247,6 +247,8 @@ export async function startServer(options: {
247
247
 
248
248
  // Spawn server child process with log file
249
249
  const { openSync } = await import("node:fs");
250
+ const { isCompiledBinary } = await import("../services/autostart-generator.ts");
251
+ const isCompiledBin = isCompiledBinary();
250
252
  const logFile = resolve(ppmDir, "ppm.log");
251
253
  const logFd = openSync(logFile, "a");
252
254
  const { resolve: resolvePath } = await import("node:path");
@@ -265,7 +267,8 @@ export async function startServer(options: {
265
267
  const logEscaped = logFile.replace(/\\/g, "\\\\");
266
268
  const errLog = logFile.replace(/\.log$/, ".err.log").replace(/\\/g, "\\\\");
267
269
  // Use "_" placeholder for empty args — PowerShell rejects empty strings in ArgumentList
268
- const argStr = ["run", script, ...args].map((a) => `'${a || "_"}'`).join(",");
270
+ const winArgs = isCompiledBin ? args : ["run", script, ...args];
271
+ const argStr = winArgs.map((a) => `'${a || "_"}'`).join(",");
269
272
  const psCmd = [
270
273
  `$p = Start-Process -PassThru -WindowStyle Hidden`,
271
274
  `-FilePath '${bunExe}'`,
@@ -288,8 +291,12 @@ export async function startServer(options: {
288
291
  }
289
292
  } else {
290
293
  // macOS/Linux: Bun.spawn + unref works fine
294
+ // Compiled binary: execPath IS the server, no "run script" needed
295
+ const cmd = isCompiledBin
296
+ ? [process.execPath, ...args]
297
+ : [process.execPath, "run", script, ...args];
291
298
  const child = Bun.spawn({
292
- cmd: [process.execPath, "run", script, ...args],
299
+ cmd,
293
300
  stdio: ["ignore", logFd, logFd],
294
301
  env: process.env,
295
302
  });
@@ -427,13 +434,6 @@ export async function startServer(options: {
427
434
  const qr = await import("qrcode-terminal");
428
435
  console.log();
429
436
  qr.generate(shareUrl, { small: true });
430
-
431
- // Auto-sync tunnel URL to PPM Cloud (if linked)
432
- import("../services/cloud.service.ts")
433
- .then(({ startHeartbeat, getCloudDevice }) => {
434
- if (getCloudDevice()) startHeartbeat(shareUrl);
435
- })
436
- .catch(() => {});
437
437
  } catch (err: unknown) {
438
438
  const msg = err instanceof Error ? err.message : String(err);
439
439
  console.error(` ✗ Share failed: ${msg}`);
@@ -492,13 +492,6 @@ if (process.argv.includes("__serve__")) {
492
492
  const { tunnelService } = await import("../services/tunnel.service.ts");
493
493
  tunnelService.setExternalUrl(status.shareUrl);
494
494
  if (status.tunnelPid) tunnelService.setExternalPid(status.tunnelPid);
495
-
496
- // Auto-sync tunnel URL to PPM Cloud (daemon mode)
497
- import("../services/cloud.service.ts")
498
- .then(({ startHeartbeat, getCloudDevice }) => {
499
- if (getCloudDevice()) startHeartbeat(status.shareUrl);
500
- })
501
- .catch(() => {});
502
495
  }
503
496
  } catch { /* status.json missing or no shareUrl — normal */ }
504
497
 
@@ -1,10 +1,15 @@
1
1
  import { Hono } from "hono";
2
2
  import { existsSync } from "node:fs";
3
- import { resolve, join, extname } from "node:path";
3
+ import { resolve, join, extname, dirname } from "node:path";
4
+ import { isCompiledBinary } from "../../services/autostart-generator.ts";
4
5
 
5
6
  export const staticRoutes = new Hono();
6
7
 
7
- const DIST_DIR = resolve(import.meta.dir, "../../../dist/web");
8
+ // Compiled binary: look for web/ next to the binary itself
9
+ // Dev mode: resolve relative to source file
10
+ const DIST_DIR = isCompiledBinary()
11
+ ? resolve(dirname(process.execPath), "web")
12
+ : resolve(import.meta.dir, "../../../dist/web");
8
13
 
9
14
  /** MIME types for common static assets */
10
15
  const MIME_TYPES: Record<string, string> = {
@@ -25,14 +25,6 @@ tunnelRoutes.post("/start", async (c) => {
25
25
  try {
26
26
  const port = configService.get("port") ?? 8080;
27
27
  const url = await tunnelService.startTunnel(port);
28
-
29
- // Sync tunnel URL to PPM Cloud (if linked)
30
- import("../../services/cloud.service.ts")
31
- .then(({ startHeartbeat, getCloudDevice }) => {
32
- if (getCloudDevice()) startHeartbeat(url);
33
- })
34
- .catch(() => {});
35
-
36
28
  return c.json(ok({ url }));
37
29
  } catch (e) {
38
30
  return c.json(err((e as Error).message), 500);
@@ -42,11 +34,5 @@ tunnelRoutes.post("/start", async (c) => {
42
34
  /** POST /api/tunnel/stop — stop tunnel */
43
35
  tunnelRoutes.post("/stop", (c) => {
44
36
  tunnelService.stopTunnel();
45
-
46
- // Stop cloud heartbeat
47
- import("../../services/cloud.service.ts")
48
- .then(({ stopHeartbeat }) => stopHeartbeat())
49
- .catch(() => {});
50
-
51
37
  return c.json(ok({ stopped: true }));
52
38
  });
@@ -82,6 +82,7 @@ class TunnelService {
82
82
 
83
83
  this.url = url;
84
84
  this.persistToStatusFile();
85
+ this.syncToCloud();
85
86
  return url;
86
87
  }
87
88
 
@@ -110,6 +111,7 @@ class TunnelService {
110
111
  }
111
112
  this.url = null;
112
113
  this.persistToStatusFile();
114
+ this.stopCloudSync();
113
115
  }
114
116
 
115
117
  /** Get current tunnel URL (null if not running) */
@@ -125,6 +127,8 @@ class TunnelService {
125
127
  /** Inject an externally-started tunnel URL (e.g. from daemon --share) */
126
128
  setExternalUrl(url: string): void {
127
129
  this.url = url;
130
+ this.persistToStatusFile();
131
+ this.syncToCloud();
128
132
  }
129
133
 
130
134
  /** Adopt an externally-started tunnel by PID (for stop management after restart) */
@@ -143,6 +147,24 @@ class TunnelService {
143
147
  writeFileSync(statusFile, JSON.stringify(data));
144
148
  } catch {}
145
149
  }
150
+
151
+ /** Start cloud heartbeat if device is linked (non-blocking) */
152
+ private syncToCloud(): void {
153
+ if (!this.url) return;
154
+ const url = this.url;
155
+ import("./cloud.service.ts")
156
+ .then(({ startHeartbeat, getCloudDevice }) => {
157
+ if (getCloudDevice()) startHeartbeat(url);
158
+ })
159
+ .catch(() => {});
160
+ }
161
+
162
+ /** Stop cloud heartbeat (non-blocking) */
163
+ private stopCloudSync(): void {
164
+ import("./cloud.service.ts")
165
+ .then(({ stopHeartbeat }) => stopHeartbeat())
166
+ .catch(() => {});
167
+ }
146
168
  }
147
169
 
148
170
  /** Singleton tunnel service */