<TaskerData sr="" dvi="1" tv="6.5.11">
    <Profile sr="prof301" ve="2">
        <id>301</id>
        <mid0>311</mid0>
        <nme>CyanBridge AutoDiary Observe Debug</nme>
        <Share sr="Share">
            <b>false</b>
            <d>Manual/debug request-response observation path. Normal AutoDiary capture is scheduled and pushed by Tasker.</d>
            <g>CyanBridge,AutoDiary,AutoInput</g>
            <p>true</p>
            <t></t>
        </Share>
        <Event sr="con0" ve="2">
            <code>599</code>
            <Str sr="arg0" ve="3">com.fersaiyan.cyanbridge.TASKER_AUTO_DIARY_OBSERVE</Str>
            <Int sr="arg1" val="0"/>
            <Int sr="arg2" val="0"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
        </Event>
    </Profile>
    <Profile sr="prof302" ve="2">
        <id>302</id>
        <mid0>312</mid0>
        <nme>CyanBridge AutoDiary Enable</nme>
        <Event sr="con0" ve="2">
            <code>599</code>
            <Str sr="arg0" ve="3">com.fersaiyan.cyanbridge.TASKER_AUTO_DIARY_ENABLE</Str>
            <Int sr="arg1" val="0"/>
            <Int sr="arg2" val="0"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
        </Event>
    </Profile>
    <Profile sr="prof303" ve="2">
        <id>303</id>
        <mid0>313</mid0>
        <nme>CyanBridge AutoDiary Disable</nme>
        <Event sr="con0" ve="2">
            <code>599</code>
            <Str sr="arg0" ve="3">com.fersaiyan.cyanbridge.TASKER_AUTO_DIARY_DISABLE</Str>
            <Int sr="arg1" val="0"/>
            <Int sr="arg2" val="0"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3"/>
        </Event>
    </Profile>
    <Profile sr="prof304" ve="2">
        <id>304</id>
        <mid0>314</mid0>
        <nme>CyanBridge AutoDiary Periodic Capture</nme>
        <Share sr="Share">
            <b>false</b>
            <d>Default every 10 minutes. Edit this Time context in Tasker to change periodicity. Excluded packages are read from the Tasker global variable %CB_AutoDiaryExcluded as comma, semicolon, space or newline separated package names.</d>
            <g>CyanBridge,AutoDiary,Schedule,Privacy</g>
            <p>true</p>
            <t></t>
        </Share>
        <Time sr="con0">
            <fh>-1</fh>
            <fm>-1</fm>
            <rep>2</rep>
            <repval>10</repval>
            <th>-1</th>
            <tm>-1</tm>
        </Time>
    </Profile>
    <Project sr="proj0" ve="2">
        <cdate>1787360400000</cdate>
        <name>CyanBridge AutoDiary</name>
        <pids>301,302,303,304</pids>
        <tids>311,312,313,314</tids>
    </Project>
    <Task sr="task311">
        <id>311</id>
        <nme>CyanBridge AutoDiary Observe Debug Handler</nme>
        <pri>10</pri>
        <Action sr="act0" ve="7">
            <code>1040876951</code>
            <Bundle sr="arg0">
                <Vals sr="val">
                    <AppPackage>&lt;null&gt;</AppPackage>
                    <AppPackage-type>java.lang.String</AppPackage-type>
                    <EnableDisableAccessibilityService>&lt;null&gt;</EnableDisableAccessibilityService>
                    <EnableDisableAccessibilityService-type>java.lang.String</EnableDisableAccessibilityService-type>
                    <IsFirstAction>false</IsFirstAction>
                    <IsFirstAction-type>java.lang.Boolean</IsFirstAction-type>
                    <OnlyClickable>false</OnlyClickable>
                    <OnlyClickable-type>java.lang.Boolean</OnlyClickable-type>
                    <OnlyVisible>true</OnlyVisible>
                    <OnlyVisible-type>java.lang.Boolean</OnlyVisible-type>
                    <Password>&lt;null&gt;</Password>
                    <Password-type>java.lang.String</Password-type>
                    <Regex>false</Regex>
                    <Regex-type>java.lang.Boolean</Regex-type>
                    <UIUpdateFields>&lt;null&gt;</UIUpdateFields>
                    <UIUpdateFields-type>java.lang.String</UIUpdateFields-type>
                    <UIUpdateText>&lt;null&gt;</UIUpdateText>
                    <UIUpdateText-type>java.lang.String</UIUpdateText-type>
                    <com.twofortyfouram.locale.intent.extra.BLURB>Query visible Android UI for CyanBridge AutoDiary debug capture</com.twofortyfouram.locale.intent.extra.BLURB>
                    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
                    <plugininstanceid>cyanbridge-autodiary-query-v2-debug</plugininstanceid>
                    <plugininstanceid-type>java.lang.String</plugininstanceid-type>
                    <plugintypeid>com.joaomgcd.autoinput.intent.IntentUIQuery</plugintypeid>
                    <plugintypeid-type>java.lang.String</plugintypeid-type>
                    <net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>AppPackage UIUpdateFields plugininstanceid plugintypeid </net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
                    <net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>
                    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
                    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
                </Vals>
            </Bundle>
            <Str sr="arg1" ve="3">com.joaomgcd.autoinput</Str>
            <Str sr="arg2" ve="3">com.joaomgcd.autoinput.activity.ActivityConfigUIQuery</Str>
            <Int sr="arg3" val="10"/>
            <Int sr="arg4" val="1"/>
        </Action>
        <Action sr="act1" ve="7">
            <code>129</code>
            <Str sr="arg0" ve="3">function arr(v) {
    if (typeof v === "undefined" || v === null) return [];
    if (Array.isArray(v)) return v;
    return [v];
}
function clean(v) { return String(v == null ? "" : v).trim(); }
var texts = (typeof aitext !== "undefined") ? arr(aitext) : [];
var ids = (typeof aiid !== "undefined") ? arr(aiid) : [];
var coords = (typeof aicoordinates !== "undefined") ? arr(aicoordinates) : ((typeof aicoords !== "undefined") ? arr(aicoords) : []);
var count = Math.max(texts.length, ids.length, coords.length);
var nodes = [];
for (var i = 0; i &lt; count &amp;&amp; i &lt; 240; i++) {
    var match = String(coords[i] || "").match(/(-?\d+)\s*,\s*(-?\d+)/);
    var x = match ? parseInt(match[1], 10) : 0;
    var y = match ? parseInt(match[2], 10) : 0;
    nodes.push({index:i,depth:0,text:clean(texts[i]),content_description:"",hint_text:"",class_name:"",view_id:clean(ids[i]),clickable:false,editable:false,scrollable:false,password:false,checkable:false,checked:false,focused:false,bounds:{left:x,top:y,right:x,bottom:y}});
}
var seen = {};
var summaryParts = [];
for (var j = 0; j &lt; texts.length &amp;&amp; summaryParts.length &lt; 400; j++) {
    var value = clean(texts[j]);
    if (!value || seen[value]) continue;
    seen[value] = true;
    summaryParts.push(value);
}
var pkg = (typeof aipackage !== "undefined") ? clean(aipackage) : "";
var observation = {created_at_ms:Date.now(),package_name:pkg,text_summary:summaryParts.join("\n").slice(0,25000),nodes:nodes};
var envelope = {contract_version:1,request_id:String(request_id || ""),callback_token:String(callback_token || ""),success:true,payload:JSON.stringify(observation),error:null};
// Same transport-escaping rationale as the periodic handler below.
var response = JSON.stringify(envelope).replace(/\\/g, "\\\\");</Str>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="45"/>
        </Action>
        <Action sr="act2" ve="7">
            <code>877</code>
            <Str sr="arg0" ve="3">com.fersaiyan.cyanbridge.TASKER_AGENT_RESPONSE</Str>
            <Int sr="arg1" val="0"/>
            <Str sr="arg2" ve="3"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3">response:%response</Str>
            <Str sr="arg5" ve="3"/>
            <Str sr="arg6" ve="3"/>
            <Str sr="arg7" ve="3">com.fersaiyan.cyanbridge</Str>
            <Str sr="arg8" ve="3"/>
            <Int sr="arg9" val="0"/>
        </Action>
    </Task>
    <Task sr="task312">
        <id>312</id>
        <nme>CyanBridge AutoDiary Enable Handler</nme>
        <pri>10</pri>
        <Action sr="act0" ve="7">
            <code>129</code>
            <Str sr="arg0" ve="3">setGlobal("CB_AutoDiaryEnabled", "1");
if (global("CB_AutoDiaryExcluded") == null) setGlobal("CB_AutoDiaryExcluded", "");</Str>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="45"/>
        </Action>
    </Task>
    <Task sr="task313">
        <id>313</id>
        <nme>CyanBridge AutoDiary Disable Handler</nme>
        <pri>10</pri>
        <Action sr="act0" ve="7">
            <code>129</code>
            <Str sr="arg0" ve="3">setGlobal("CB_AutoDiaryEnabled", "0");</Str>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="45"/>
        </Action>
    </Task>
    <Task sr="task314">
        <id>314</id>
        <nme>CyanBridge AutoDiary Periodic Handler</nme>
        <pri>10</pri>
        <Action sr="act0" ve="7">
            <code>129</code>
            <Str sr="arg0" ve="3">var cb_enabled = global("CB_AutoDiaryEnabled") === "1" ? "true" : "false";</Str>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="45"/>
        </Action>
        <Action sr="act1" ve="7">
            <ConditionList sr="if"><Condition sr="c0" ve="3"><lhs>%cb_enabled</lhs><op>2</op><rhs>true</rhs></Condition></ConditionList>
            <code>1040876951</code>
            <Bundle sr="arg0">
                <Vals sr="val">
                    <AppPackage>&lt;null&gt;</AppPackage>
                    <AppPackage-type>java.lang.String</AppPackage-type>
                    <EnableDisableAccessibilityService>&lt;null&gt;</EnableDisableAccessibilityService>
                    <EnableDisableAccessibilityService-type>java.lang.String</EnableDisableAccessibilityService-type>
                    <IsFirstAction>false</IsFirstAction>
                    <IsFirstAction-type>java.lang.Boolean</IsFirstAction-type>
                    <OnlyClickable>false</OnlyClickable>
                    <OnlyClickable-type>java.lang.Boolean</OnlyClickable-type>
                    <OnlyVisible>true</OnlyVisible>
                    <OnlyVisible-type>java.lang.Boolean</OnlyVisible-type>
                    <Password>&lt;null&gt;</Password>
                    <Password-type>java.lang.String</Password-type>
                    <Regex>false</Regex>
                    <Regex-type>java.lang.Boolean</Regex-type>
                    <UIUpdateFields>&lt;null&gt;</UIUpdateFields>
                    <UIUpdateFields-type>java.lang.String</UIUpdateFields-type>
                    <UIUpdateText>&lt;null&gt;</UIUpdateText>
                    <UIUpdateText-type>java.lang.String</UIUpdateText-type>
                    <com.twofortyfouram.locale.intent.extra.BLURB>Periodic CyanBridge AutoDiary UI Query</com.twofortyfouram.locale.intent.extra.BLURB>
                    <com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
                    <plugininstanceid>cyanbridge-autodiary-query-v2-periodic</plugininstanceid>
                    <plugininstanceid-type>java.lang.String</plugininstanceid-type>
                    <plugintypeid>com.joaomgcd.autoinput.intent.IntentUIQuery</plugintypeid>
                    <plugintypeid-type>java.lang.String</plugintypeid-type>
                    <net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>AppPackage UIUpdateFields plugininstanceid plugintypeid </net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
                    <net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>
                    <net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
                    <net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
                </Vals>
            </Bundle>
            <Str sr="arg1" ve="3">com.joaomgcd.autoinput</Str>
            <Str sr="arg2" ve="3">com.joaomgcd.autoinput.activity.ActivityConfigUIQuery</Str>
            <Int sr="arg3" val="10"/>
            <Int sr="arg4" val="1"/>
        </Action>
        <Action sr="act2" ve="7">
            <ConditionList sr="if"><Condition sr="c0" ve="3"><lhs>%cb_enabled</lhs><op>2</op><rhs>true</rhs></Condition></ConditionList>
            <code>129</code>
            <Str sr="arg0" ve="3">var capture_payload = "";
function arr(v) {
    if (typeof v === "undefined" || v === null) return [];
    if (Array.isArray(v)) return v;
    return [v];
}
function clean(v) { return String(v == null ? "" : v).trim(); }
function parsePackages(raw) {
    var out = {};
    String(raw == null ? "" : raw).toLowerCase().split(/[\s,;]+/).forEach(function(v){ if (v) out[v] = true; });
    return out;
}
// Foreground package comes from Tasker's %WIN (requires Tasker accessibility);
// AutoInput's %aipackage is only a fallback because it stays empty unless an
// app filter was configured on the UI Query action.
var winInfo = clean(global("WIN"));
var winPkg = winInfo.split("/")[0].trim().toLowerCase();
var pkg = "";
if (winPkg &amp;&amp; winPkg.indexOf(".") &gt; 0) {
    pkg = winPkg;
} else if (typeof aipackage !== "undefined") {
    pkg = clean(aipackage).toLowerCase();
}
if (!pkg) exit();
var excluded = parsePackages(global("CB_AutoDiaryExcluded"));
var fixedExcluded = pkg === "com.android.systemui" || pkg.indexOf("com.android.launcher") === 0 || pkg.indexOf("com.google.android.launcher") === 0 || pkg.indexOf("com.samsung.android.launcher") === 0;
if (fixedExcluded || excluded[pkg]) exit();
var texts = (typeof aitext !== "undefined") ? arr(aitext) : [];
var ids = (typeof aiid !== "undefined") ? arr(aiid) : [];
var coords = (typeof aicoordinates !== "undefined") ? arr(aicoordinates) : ((typeof aicoords !== "undefined") ? arr(aicoords) : []);
var count = Math.max(texts.length, ids.length, coords.length);
var nodes = [];
for (var i = 0; i &lt; count &amp;&amp; i &lt; 240; i++) {
    var match = String(coords[i] || "").match(/(-?\d+)\s*,\s*(-?\d+)/);
    var x = match ? parseInt(match[1], 10) : 0;
    var y = match ? parseInt(match[2], 10) : 0;
    nodes.push({index:i,depth:0,text:clean(texts[i]),content_description:"",hint_text:"",class_name:"",view_id:clean(ids[i]),clickable:false,editable:false,scrollable:false,password:false,checkable:false,checked:false,focused:false,bounds:{left:x,top:y,right:x,bottom:y}});
}
var seen = {};
var summaryParts = [];
for (var j = 0; j &lt; texts.length &amp;&amp; summaryParts.length &lt; 400; j++) {
    var value = clean(texts[j]);
    if (!value || seen[value]) continue;
    seen[value] = true;
    summaryParts.push(value);
}
if (!summaryParts.length) exit();
var observation = {created_at_ms:Date.now(),package_name:pkg,text_summary:summaryParts.join("\n").slice(0,25000),nodes:nodes};
// Tasker decodes one backslash-escape level inside Send Intent extra values, which would
// turn JSON \n sequences into raw newlines and corrupt the payload for org.json. Escape
// for transport so CyanBridge receives exactly JSON.stringify output.
var capture_payload = JSON.stringify(observation).replace(/\\/g, "\\\\");</Str>
            <Str sr="arg1" ve="3"/>
            <Int sr="arg2" val="1"/>
            <Int sr="arg3" val="45"/>
        </Action>
        <Action sr="act3" ve="7">
            <code>877</code>
            <Str sr="arg0" ve="3">com.fersaiyan.cyanbridge.TASKER_AUTO_DIARY_CAPTURE</Str>
            <Int sr="arg1" val="0"/>
            <Str sr="arg2" ve="3"/>
            <Str sr="arg3" ve="3"/>
            <Str sr="arg4" ve="3">payload:%capture_payload</Str>
            <Str sr="arg5" ve="3"/>
            <Str sr="arg6" ve="3"/>
            <Str sr="arg7" ve="3">com.fersaiyan.cyanbridge</Str>
            <Str sr="arg8" ve="3"/>
            <Int sr="arg9" val="0"/>
        </Action>
    </Task>
</TaskerData>
