palmier 0.9.28 → 0.9.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/command-runners.js +3 -7
- package/dist/commands/serve.js +2 -7
- package/dist/event-queues.d.ts +11 -2
- package/dist/event-queues.js +20 -2
- package/dist/pwa/assets/index-6T1kYgQ7.js +120 -0
- package/dist/pwa/assets/{web-BtNEakaJ.js → web-B_QZ1Xz7.js} +1 -1
- package/dist/pwa/assets/{web-SpprOq9I.js → web-C7WZtjWG.js} +1 -1
- package/dist/pwa/assets/{web-DqJat-O8.js → web-CwAQf0-V.js} +1 -1
- package/dist/pwa/index.html +1 -1
- package/dist/trigger-dispatch.d.ts +14 -0
- package/dist/trigger-dispatch.js +53 -0
- package/package.json +1 -1
- package/dist/pwa/assets/index-B405SEvB.js +0 -120
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as t}from"./index-
|
|
1
|
+
import{W as t}from"./index-6T1kYgQ7.js";class s extends t{constructor(){super(),this.handleVisibilityChange=()=>{const e={isActive:document.hidden!==!0};this.notifyListeners("appStateChange",e),document.hidden?this.notifyListeners("pause",null):this.notifyListeners("resume",null)},document.addEventListener("visibilitychange",this.handleVisibilityChange,!1)}exitApp(){throw this.unimplemented("Not implemented on web.")}async getInfo(){throw this.unimplemented("Not implemented on web.")}async getLaunchUrl(){return{url:""}}async getState(){return{isActive:document.hidden!==!0}}async minimizeApp(){throw this.unimplemented("Not implemented on web.")}async toggleBackButtonHandler(){throw this.unimplemented("Not implemented on web.")}async getAppLanguage(){return{value:navigator.language.split("-")[0].toLowerCase()}}}export{s as AppWeb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as i}from"./index-
|
|
1
|
+
import{W as i}from"./index-6T1kYgQ7.js";function o(){const t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;let n="unknown";const e=t?t.type||t.effectiveType:null;if(e&&typeof e=="string")switch(e){case"bluetooth":case"cellular":n="cellular";break;case"none":n="none";break;case"ethernet":case"wifi":case"wimax":n="wifi";break;case"other":case"unknown":n="unknown";break;case"slow-2g":case"2g":case"3g":n="cellular";break;case"4g":n="wifi";break}return n}class s extends i{constructor(){super(),this.handleOnline=()=>{const e={connected:!0,connectionType:o()};this.notifyListeners("networkStatusChange",e)},this.handleOffline=()=>{const n={connected:!1,connectionType:"none"};this.notifyListeners("networkStatusChange",n)},typeof window<"u"&&(window.addEventListener("online",this.handleOnline),window.addEventListener("offline",this.handleOffline))}async getStatus(){if(!window.navigator)throw this.unavailable("Browser does not support the Network Information API");const n=window.navigator.onLine,e=o();return{connected:n,connectionType:n?e:"none"}}}const r=new s;export{r as Network,s as NetworkWeb};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as p}from"./index-
|
|
1
|
+
import{W as p}from"./index-6T1kYgQ7.js";class f extends p{constructor(){super(...arguments),this.group="CapacitorStorage"}async configure({group:e}){typeof e=="string"&&(this.group=e)}async get(e){return{value:this.impl.getItem(this.applyPrefix(e.key))}}async set(e){this.impl.setItem(this.applyPrefix(e.key),e.value)}async remove(e){this.impl.removeItem(this.applyPrefix(e.key))}async keys(){return{keys:this.rawKeys().map(t=>t.substring(this.prefix.length))}}async clear(){for(const e of this.rawKeys())this.impl.removeItem(e)}async migrate(){var e;const t=[],s=[],n="_cap_",o=Object.keys(this.impl).filter(i=>i.indexOf(n)===0);for(const i of o){const r=i.substring(n.length),a=(e=this.impl.getItem(i))!==null&&e!==void 0?e:"",{value:l}=await this.get({key:r});typeof l=="string"?s.push(r):(await this.set({key:r,value:a}),t.push(r))}return{migrated:t,existing:s}}async removeOld(){const e="_cap_",t=Object.keys(this.impl).filter(s=>s.indexOf(e)===0);for(const s of t)this.impl.removeItem(s)}get impl(){return window.localStorage}get prefix(){return this.group==="NativeStorage"?"":`${this.group}.`}rawKeys(){return Object.keys(this.impl).filter(e=>e.indexOf(this.prefix)===0)}applyPrefix(e){return this.prefix+e}}export{f as PreferencesWeb};
|
package/dist/pwa/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
9
9
|
<title>Palmier</title>
|
|
10
10
|
<meta name="description" content="Run tasks from anywhere, approve actions on the go, and let your agents use your phone’s built-in capabilities when needed." />
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-6T1kYgQ7.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-BpsVmTp9.css">
|
|
13
13
|
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
|
14
14
|
<body>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared entry point for trigger-driven tasks (on_new_* device events and
|
|
3
|
+
* command-output lines): enqueue the payload, launch a run on the idle→active
|
|
4
|
+
* edge, and run a self-healing watchdog.
|
|
5
|
+
*
|
|
6
|
+
* Why the watchdog: the per-task active flag is cleared on the empty pop while
|
|
7
|
+
* the previous run is still tearing down (its OS unit still "active"). A
|
|
8
|
+
* trigger landing in that window re-sets the flag but its `startTask` no-ops on
|
|
9
|
+
* the still-active unit, stranding the queued payload forever. The watchdog
|
|
10
|
+
* detects "work queued but no live run" shortly after triggers quiesce and
|
|
11
|
+
* relaunches. High-frequency sources (commands) would otherwise wedge fast.
|
|
12
|
+
*/
|
|
13
|
+
/** Enqueue a trigger payload and ensure a run is (or will be) draining it. */
|
|
14
|
+
export declare function dispatchTrigger(taskId: string, payload: string): void;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared entry point for trigger-driven tasks (on_new_* device events and
|
|
3
|
+
* command-output lines): enqueue the payload, launch a run on the idle→active
|
|
4
|
+
* edge, and run a self-healing watchdog.
|
|
5
|
+
*
|
|
6
|
+
* Why the watchdog: the per-task active flag is cleared on the empty pop while
|
|
7
|
+
* the previous run is still tearing down (its OS unit still "active"). A
|
|
8
|
+
* trigger landing in that window re-sets the flag but its `startTask` no-ops on
|
|
9
|
+
* the still-active unit, stranding the queued payload forever. The watchdog
|
|
10
|
+
* detects "work queued but no live run" shortly after triggers quiesce and
|
|
11
|
+
* relaunches. High-frequency sources (commands) would otherwise wedge fast.
|
|
12
|
+
*/
|
|
13
|
+
import { enqueueEvent, hasPendingEvents, pendingCount, resetActiveRun, markActiveRun } from "./event-queues.js";
|
|
14
|
+
import { getPlatform } from "./platform/index.js";
|
|
15
|
+
const WATCHDOG_MS = 3000;
|
|
16
|
+
const watchdogs = new Map();
|
|
17
|
+
function startRun(taskId) {
|
|
18
|
+
console.log(`[trigger] ${taskId} requesting run start`);
|
|
19
|
+
getPlatform().startTask(taskId)
|
|
20
|
+
.then(() => console.log(`[trigger] ${taskId} run start request returned`))
|
|
21
|
+
.catch((err) => console.error(`[trigger] failed to start run for ${taskId}:`, err));
|
|
22
|
+
}
|
|
23
|
+
function armWatchdog(taskId) {
|
|
24
|
+
const existing = watchdogs.get(taskId);
|
|
25
|
+
if (existing)
|
|
26
|
+
clearTimeout(existing);
|
|
27
|
+
watchdogs.set(taskId, setTimeout(() => watchdogTick(taskId), WATCHDOG_MS));
|
|
28
|
+
}
|
|
29
|
+
function watchdogTick(taskId) {
|
|
30
|
+
watchdogs.delete(taskId);
|
|
31
|
+
if (!hasPendingEvents(taskId))
|
|
32
|
+
return;
|
|
33
|
+
// A run is mid-flight and will drain the queue — check again later.
|
|
34
|
+
if (getPlatform().isTaskRunning(taskId)) {
|
|
35
|
+
armWatchdog(taskId);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
console.warn(`[trigger] ${taskId} has queued work but no running task; relaunching`);
|
|
39
|
+
resetActiveRun(taskId);
|
|
40
|
+
markActiveRun(taskId);
|
|
41
|
+
startRun(taskId);
|
|
42
|
+
// Keep watching: if this relaunch also fails to take (e.g. HTTP not yet up),
|
|
43
|
+
// the next tick retries until the queue actually drains.
|
|
44
|
+
armWatchdog(taskId);
|
|
45
|
+
}
|
|
46
|
+
/** Enqueue a trigger payload and ensure a run is (or will be) draining it. */
|
|
47
|
+
export function dispatchTrigger(taskId, payload) {
|
|
48
|
+
const { shouldStart } = enqueueEvent(taskId, payload);
|
|
49
|
+
console.log(`[trigger] ${taskId} enqueued (shouldStart=${shouldStart}, pending=${pendingCount(taskId)})`);
|
|
50
|
+
if (shouldStart)
|
|
51
|
+
startRun(taskId);
|
|
52
|
+
armWatchdog(taskId);
|
|
53
|
+
}
|