@buoy-gg/agent-core 7.0.74 → 7.0.76

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.
@@ -502,7 +502,7 @@
502
502
  {
503
503
  "toolId": "zustand",
504
504
  "title": "Zustand",
505
- "summary": "Reads and writes the app's live Zustand stores: list registered stores with their top-level keys or full state, fetch one store's current state, fetch the real before/after trees for one recorded state change, and setState a store for time-travel/reset. Reach for it when on-screen data disagrees with the API, or when a QA user needs the app put into a specific state. The change TIMELINE (history over time) is better read via get_events sources:['zustand']; this tool is for CURRENT state plus on-demand detail. Everything here works in release builds \u2014 but setState defaults to replace:true, which wipes the store's action functions.",
505
+ "summary": "Reads and writes the app's live Zustand stores (on Vue, its Pinia stores too, named by store id and marked library \"pinia\"): list registered stores with their top-level keys or full state, fetch one store's current state, fetch the real before/after trees for one recorded state change, and setState a store for time-travel/reset. Reach for it when on-screen data disagrees with the API, or when a QA user needs the app put into a specific state. The change TIMELINE (history over time) is better read via get_events sources:['zustand']; this tool is for CURRENT state plus on-demand detail. Everything here works in release builds \u2014 but setState defaults to replace:true, which wipes the store's action functions.",
506
506
  "actions": [
507
507
  {
508
508
  "action": "getSnapshot",
@@ -4447,6 +4447,32 @@
4447
4447
  "dev build (__DEV__ === true)"
4448
4448
  ]
4449
4449
  },
4450
+ {
4451
+ "action": "getComponentSource",
4452
+ "summary": "Find the code file behind a part of the screen, and the parts around it. Pass query (a component name, testID or text from describeScreen) or nativeTag. Use this when someone asks which file or component draws something, instead of guessing a path.",
4453
+ "params": {
4454
+ "type": "object",
4455
+ "properties": {
4456
+ "query": {
4457
+ "type": "string",
4458
+ "description": "A component name, testID or visible text from describeScreen, e.g. 'RequestOptions' or 'Send'."
4459
+ },
4460
+ "nativeTag": {
4461
+ "type": "number",
4462
+ "description": "The exact nativeTag from describeScreen. Wins over query."
4463
+ }
4464
+ },
4465
+ "additionalProperties": false
4466
+ },
4467
+ "effect": "read",
4468
+ "release": "empty",
4469
+ "description": "Returns {found:true, component, owners[], sourceKind?} or {found:false, reason}. component and each owner have {name, source?:{fileName, lineNumber?, columnNumber?}, reason?}; owners run outward, up to six. React gives where each component is USED (the JSX line in its parent's file); with sourceKind \"definition\" (Vue and other DOM frameworks) each fileName is the file the component is DEFINED in, with no line. React 19 may give rawStack (bundle URLs) instead of source: read the file name out of it, and say the line may be off. A part with no file says why in reason (a library component, for example). Read only: nothing on screen moves. Needs a dev build.",
4470
+ "releaseNote": "packages/highlight-updates/src/highlight-updates/utils/componentSource.ts \u2014 React's _debugSource and the debug stack exist only in dev, and Vue sets __file only in dev, so a release build answers {found:false, reason}.",
4471
+ "requires": [
4472
+ "@buoy-gg/highlight-updates installed and registered with <FloatingDevTools>",
4473
+ "dev build (__DEV__ === true)"
4474
+ ]
4475
+ },
4450
4476
  {
4451
4477
  "action": "getRenderDetail",
4452
4478
  "summary": "Fetch one tracked component's full renderHistory and lastRenderCause (including hook-change values), which the synced snapshot omits.",
@@ -1 +1 @@
1
- "use strict";export const CATALOG_ACTIONS={"env":["getSnapshot"],"console":["getSnapshot","clearEntries"],"sentry":["getSnapshot","clearEnvelopes"],"jotai":["getSnapshot","listAtoms","getAtomValue","getChangeDetail","setAtom","clearEvents"],"route-events":["getSnapshot","getCurrentRoute","navigate","stackGoBack","stackNavigateToIndex","stackPopToIndex","stackPopToTop","clearEvents"],"debug-borders":["cycleMode","setMode"],"zustand":["getSnapshot","listStores","getStoreState","getChangeDetail","setState","rehydrate","clearEvents"],"redux":["getSnapshot","getState","getActionDetail","dispatch","setState","clearEvents"],"impersonate":["getSnapshot","searchUsers","startImpersonation","stopImpersonation","pauseImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"],"query":["listQueries","getQueryData","refetch","invalidate","reset","remove","setQueryData","triggerError","restoreError","triggerLoading","restoreLoading","clearQueryCache","clearMutationCache","setOnline"],"events":["exportEvents","setEnabledSources","clearEvents"],"network":["getSnapshot","getCaptureStatus","getEventBody","setPinned","setSaved","removeSavedRecord","clearSavedRequests","clearPinnedRequests","clearEvents","listOverrideRules","getOverrideRuleBody","debugOverrides","upsertOverrideRule","setOverrideRuleEnabled","setOverridesEnabled","deleteOverrideRule","clearOverrideRules","getNetworkConditions","setNetworkConditions"],"js-top":["sample","getOriginDetail","setEnabled","pause","resume","clear"],"app":["ping","reloadApp"],"time-machine":["list","capture","captureBaseline","wipeAll","restore","preview","inspect","delete","rename","duplicate","setExclusions","setScope","setRestoreRoute"],"clock":["getState","setTime","shift","freeze","resume","setRate","reset","updateSettings","jumpToTokenExpiry","failNextRequest","stopTokenCheck"],"lifecycle":["getState","background","interrupt","returnToApp","memoryWarning","openUrl","pressBack","setColorScheme","setPower","resetPower","relaunch","runRecipe","clearReport","reset"],"location":["getState","setLocation","startRoute","pauseRoute","resumeRoute","stopRoute","seekRoute","setSpeed","enterRegion","exitRegion","setConditions","setSignal","setServices","tune","useRealLocation","reset","updateSettings","clearLog"],"permissions":["getState","setOverride","clearOverride","resetAll","requestReal","updateSettings","simulateReturnFromSettings","clearLog"],"storage":["getSnapshot","getRequiredKeys","async.getAllKeys","async.multiGet","async.getItem","async.setItem","async.removeItem","async.multiRemove","async.multiSet","async.clear","clearAppStorage","getEventDetail","clearEvents","timeTravel.undo","timeTravel.jump","mmkv.snapshot","mmkv.get","mmkv.set","mmkv.remove","secure.keys","secure.snapshot","secure.get","secure.set","secure.delete"],"highlight-updates":["describeScreen","tapElement","waitFor","beginMeasurement","endMeasurement","locateComponent","getRenderDetail","setEnabled","toggle","setSilentTracking","toggleFreeze","setSpotlight","clearRenderCounts","startTouchCapture","stopTouchCapture","clearTouchCapture","readTouchCapture"],"scenarios":["listScenarios","getScenario","save","acceptDraft","discardDraft","preview","run","deactivate","delete","setFolder","listFolders","getActive","export"],"perf-monitor":["setEnabled","startRecording","stopRecording","savePending","discardPending","mark","startAutomation","cancelAutomation","acknowledgeAutomation","refreshIndex","getAutomationConfig","setAutomationConfig","loadReport","deleteReport","deleteBatch","clearAll"],"assets":["list","getDetail","rescan","measureSizes","saveBaseline","clearBaseline","getDiff","clearRecords","getScanStatus"],"tv-remote":["arm","getEventsSince","setMenuCapture","disarm","clear"],"focus-inspector":["rescan","focusElement","setTracking","clearHistory"],"images":["list","getDetail","getCaptureStatus","retry","flash","proveSavings","setOverride","clearOverride","setNetworkMode","setBlankImages","hardReload","evictDisk","massAction","clearRecords","clearExpoCaches"],"ask-buoy":["listChanges","undoChange","undoAll","retrieve","openProcedure"],"push-notifications":["getSnapshot","getCapabilities","getEvent","getPermissions","listPresented","refreshToken","setCaptureSession","clearCapturedEvents","scheduleLocal"],"image-overlay":["getSnapshot","listTargets","selectTarget","loadImage","setSettings","fitToScreen","resetSettings","remove"],"three":["getScene","getStats","action"]};
1
+ "use strict";export const CATALOG_ACTIONS={"env":["getSnapshot"],"console":["getSnapshot","clearEntries"],"sentry":["getSnapshot","clearEnvelopes"],"jotai":["getSnapshot","listAtoms","getAtomValue","getChangeDetail","setAtom","clearEvents"],"route-events":["getSnapshot","getCurrentRoute","navigate","stackGoBack","stackNavigateToIndex","stackPopToIndex","stackPopToTop","clearEvents"],"debug-borders":["cycleMode","setMode"],"zustand":["getSnapshot","listStores","getStoreState","getChangeDetail","setState","rehydrate","clearEvents"],"redux":["getSnapshot","getState","getActionDetail","dispatch","setState","clearEvents"],"impersonate":["getSnapshot","searchUsers","startImpersonation","stopImpersonation","pauseImpersonation","resumeImpersonation","updateSettings","removeFromHistory","clearHistory"],"query":["listQueries","getQueryData","refetch","invalidate","reset","remove","setQueryData","triggerError","restoreError","triggerLoading","restoreLoading","clearQueryCache","clearMutationCache","setOnline"],"events":["exportEvents","setEnabledSources","clearEvents"],"network":["getSnapshot","getCaptureStatus","getEventBody","setPinned","setSaved","removeSavedRecord","clearSavedRequests","clearPinnedRequests","clearEvents","listOverrideRules","getOverrideRuleBody","debugOverrides","upsertOverrideRule","setOverrideRuleEnabled","setOverridesEnabled","deleteOverrideRule","clearOverrideRules","getNetworkConditions","setNetworkConditions"],"js-top":["sample","getOriginDetail","setEnabled","pause","resume","clear"],"app":["ping","reloadApp"],"time-machine":["list","capture","captureBaseline","wipeAll","restore","preview","inspect","delete","rename","duplicate","setExclusions","setScope","setRestoreRoute"],"clock":["getState","setTime","shift","freeze","resume","setRate","reset","updateSettings","jumpToTokenExpiry","failNextRequest","stopTokenCheck"],"lifecycle":["getState","background","interrupt","returnToApp","memoryWarning","openUrl","pressBack","setColorScheme","setPower","resetPower","relaunch","runRecipe","clearReport","reset"],"location":["getState","setLocation","startRoute","pauseRoute","resumeRoute","stopRoute","seekRoute","setSpeed","enterRegion","exitRegion","setConditions","setSignal","setServices","tune","useRealLocation","reset","updateSettings","clearLog"],"permissions":["getState","setOverride","clearOverride","resetAll","requestReal","updateSettings","simulateReturnFromSettings","clearLog"],"storage":["getSnapshot","getRequiredKeys","async.getAllKeys","async.multiGet","async.getItem","async.setItem","async.removeItem","async.multiRemove","async.multiSet","async.clear","clearAppStorage","getEventDetail","clearEvents","timeTravel.undo","timeTravel.jump","mmkv.snapshot","mmkv.get","mmkv.set","mmkv.remove","secure.keys","secure.snapshot","secure.get","secure.set","secure.delete"],"highlight-updates":["describeScreen","tapElement","waitFor","beginMeasurement","endMeasurement","locateComponent","getComponentSource","getRenderDetail","setEnabled","toggle","setSilentTracking","toggleFreeze","setSpotlight","clearRenderCounts","startTouchCapture","stopTouchCapture","clearTouchCapture","readTouchCapture"],"scenarios":["listScenarios","getScenario","save","acceptDraft","discardDraft","preview","run","deactivate","delete","setFolder","listFolders","getActive","export"],"perf-monitor":["setEnabled","startRecording","stopRecording","savePending","discardPending","mark","startAutomation","cancelAutomation","acknowledgeAutomation","refreshIndex","getAutomationConfig","setAutomationConfig","loadReport","deleteReport","deleteBatch","clearAll"],"assets":["list","getDetail","rescan","measureSizes","saveBaseline","clearBaseline","getDiff","clearRecords","getScanStatus"],"tv-remote":["arm","getEventsSince","setMenuCapture","disarm","clear"],"focus-inspector":["rescan","focusElement","setTracking","clearHistory"],"images":["list","getDetail","getCaptureStatus","retry","flash","proveSavings","setOverride","clearOverride","setNetworkMode","setBlankImages","hardReload","evictDisk","massAction","clearRecords","clearExpoCaches"],"ask-buoy":["listChanges","undoChange","undoAll","retrieve","openProcedure"],"push-notifications":["getSnapshot","getCapabilities","getEvent","getPermissions","listPresented","refreshToken","setCaptureSession","clearCapturedEvents","scheduleLocal"],"image-overlay":["getSnapshot","listTargets","selectTarget","loadImage","setSettings","fitToScreen","resetSettings","remove"],"three":["getScene","getStats","action"]};
@@ -1 +1 @@
1
- "use strict";import{idFactory as a}from"../blocks/runId";const r=a("ask");const c=/\b(?:want me to|would you like me to|would you like|do you want me to|do you want|should i|shall i|ok(?:ay)? if i|say the word|let me know if|if you'?d (?:like|prefer)|if you want)\b/i;const u=/\b(?:tell me|let me know|just say|say|give me|pick|choose)\s+(?:the|which|what|how|your|one)\b/i;const m=new RegExp(`${c.source}|${u.source}`,"i");const h=/[*_`"'’”\s]+$/;const d=/^[*_`>\-\s]+/;const f=/[.!?]["'’”)\]]*\s+(?=[A-Z("'“])|\n+/;const g=/,?\s+or\s+/i;const y=/\(([^()]{3,140})\)/;const b=/\s*,\s*|\s+or\s+/i;const k=/^[A-Za-z0-9][^,;:—–]*$/;const w=/^[A-Za-z0-9$][^;:—–()]*$/;const E=[{id:"yes",label:"Yes, go ahead"},{id:"no",label:"No thanks"}];export function synthesizeAskBlock(o){const e=A(o);if(!e||e.length<8||e.length>240)return null;const t=m.exec(e);if(!t)return null;const n=I(e);if(n)return{id:r(),kind:"choice",question:e,options:n};const s=e.slice(t.index+t[0].length).replace(/[?.!,]+$/,"").trim();const i=s?s.split(g):[];if(i.length>2)return null;if(i.length===2){const l=S(i);return l?{id:r(),kind:"choice",question:e,options:l}:null}if(u.test(e)||!c.test(e))return null;return{id:r(),kind:"choice",question:e,options:E}}function A(o){const e=o.replace(h,"").trim();if(!e)return null;const t=e.split(f);const n=t[t.length-1]?.replace(d,"").trim();return n||null}function I(o){const e=y.exec(o)?.[1];if(!e||!/\bor\b/i.test(e))return null;const t=e.split(b).map(n=>n.trim()).filter(Boolean);if(t.length<2||t.length>5)return null;for(const n of t){if(n.length<1||n.length>48||!w.test(n))return null}return t.map((n,s)=>({id:`o${s+1}`,label:p(n)}))}function S(o){const e=o.map(t=>t.trim().replace(/[?.!]+$/,"").trim());for(const t of e){if(t.length<2||t.length>48||!k.test(t))return null}return e.map((t,n)=>({id:n===0?"a":"b",label:p(t)}))}function p(o){return/^[a-z]/.test(o)?o[0].toUpperCase()+o.slice(1):o}const L=/\b(?:that'?s (?:all|everything|it)|only|just|so far|nothing else|no others?|the rest (?:are|is)?n'?t)\b/i;const N=/\b(?:cache[ds]?|cached|loaded|fetched|in memory|visited|opened|rendered|recorded|captured)\b/i;const v=/\b(?:if|once|when|after) you (?:visit|open|go to|navigate|browse|load|tap|swipe|scroll|look at)\b/i;const _=3;export const ACQUISITION_CALLS=new Set(["route-events.navigate","route-events.stackGoBack","route-events.stackNavigateToIndex","highlight-updates.describeScreen","highlight-updates.tapElement","highlight-updates.waitFor","query.refetch","query.invalidate"]);export function synthesizeShortfallBlock({text:o,attempted:e}){if(e)return null;const t=x(o,_);if(!t)return null;const n=v.test(t)||L.test(t)&&N.test(t);if(!n)return null;return{id:T(),kind:"actions",actions:[{label:"Go get the rest",primary:true,send:"Don't stop at what's already loaded. Drive the app to get the rest \u2014 check the other layers, use the sitemap to navigate to the screen that loads it, wait for it, then answer in full. If it truly isn't reachable, tell me exactly what you tried."}]}}const T=a("gap");function x(o,e){const t=o.replace(h,"").trim();if(!t)return null;const n=t.split(f).filter(i=>i.trim());const s=n.slice(-e).join(" ").replace(d,"").trim();return s||null}
1
+ "use strict";import{idFactory as a}from"../blocks/runId";const r=a("ask");const c=/\b(?:want me to|would you like me to|would you like|do you want me to|do you want|should i|shall i|ok(?:ay)? if i|say the word|let me know if|if you'?d (?:like|prefer)|if you want)\b/i;const u=/\b(?:tell me|let me know|just say|say|give me|pick|choose)\s+(?:the|which|what|how|your|one)\b/i;const m=new RegExp(`${c.source}|${u.source}`,"i");const h=/[*_`"'’”\s]+$/;const d=/^[*_`>\-\s]+/;const f=/[.!?]["'’”)\]]*\s+(?=[A-Z("'“])|\n+/;const g=/,?\s+or\s+/i;const y=/\(([^()]{3,140})\)/;const w=/\s*,\s*|\s+or\s+/i;const A=/^[A-Za-z0-9][^,;:—–]*$/;const b=/^[A-Za-z0-9$][^;:—–()]*$/;const k=[{id:"yes",label:"Yes, go ahead"},{id:"no",label:"No thanks"}];export function synthesizeAskBlock(o){const e=E(o);if(!e||e.length<8||e.length>240)return null;const t=m.exec(e);if(!t)return null;const n=I(e);if(n)return{id:r(),kind:"choice",question:e,questionInAnswer:true,options:n};const s=e.slice(t.index+t[0].length).replace(/[?.!,]+$/,"").trim();const i=s?s.split(g):[];if(i.length>2)return null;if(i.length===2){const l=S(i);return l?{id:r(),kind:"choice",question:e,questionInAnswer:true,options:l}:null}if(u.test(e)||!c.test(e))return null;return{id:r(),kind:"choice",question:e,questionInAnswer:true,options:k}}function E(o){const e=o.replace(h,"").trim();if(!e)return null;const t=e.split(f);const n=t[t.length-1]?.replace(d,"").trim();return n||null}function I(o){const e=y.exec(o)?.[1];if(!e||!/\bor\b/i.test(e))return null;const t=e.split(w).map(n=>n.trim()).filter(Boolean);if(t.length<2||t.length>5)return null;for(const n of t){if(n.length<1||n.length>48||!b.test(n))return null}return t.map((n,s)=>({id:`o${s+1}`,label:p(n)}))}function S(o){const e=o.map(t=>t.trim().replace(/[?.!]+$/,"").trim());for(const t of e){if(t.length<2||t.length>48||!A.test(t))return null}return e.map((t,n)=>({id:n===0?"a":"b",label:p(t)}))}function p(o){return/^[a-z]/.test(o)?o[0].toUpperCase()+o.slice(1):o}const L=/\b(?:that'?s (?:all|everything|it)|only|just|so far|nothing else|no others?|the rest (?:are|is)?n'?t)\b/i;const N=/\b(?:cache[ds]?|cached|loaded|fetched|in memory|visited|opened|rendered|recorded|captured)\b/i;const v=/\b(?:if|once|when|after) you (?:visit|open|go to|navigate|browse|load|tap|swipe|scroll|look at)\b/i;const _=3;export const ACQUISITION_CALLS=new Set(["route-events.navigate","route-events.stackGoBack","route-events.stackNavigateToIndex","highlight-updates.describeScreen","highlight-updates.tapElement","highlight-updates.waitFor","query.refetch","query.invalidate"]);export function synthesizeShortfallBlock({text:o,attempted:e}){if(e)return null;const t=x(o,_);if(!t)return null;const n=v.test(t)||L.test(t)&&N.test(t);if(!n)return null;return{id:T(),kind:"actions",actions:[{label:"Go get the rest",primary:true,send:"Don't stop at what's already loaded. Drive the app to get the rest \u2014 check the other layers, use the sitemap to navigate to the screen that loads it, wait for it, then answer in full. If it truly isn't reachable, tell me exactly what you tried."}]}}const T=a("gap");function x(o,e){const t=o.replace(h,"").trim();if(!t)return null;const n=t.split(f).filter(i=>i.trim());const s=n.slice(-e).join(" ").replace(d,"").trim();return s||null}
@@ -1,13 +1,13 @@
1
- "use strict";import{CATALOG as Tt}from"../catalog/catalog.g";import{applyDefaults as Ie,validateParams as Ae}from"../catalog/validateParams";import{normalizeParams as ge,aliasNote as Zt}from"../catalog/normalizeParams";import{fromProviderToolName as ce,toProviderTools as eo}from"../catalog/toProviderTools";import{hashQueryKey as to}from"../catalog/normalizeParams";import{projectSnapshot as oo,SNAPSHOT_ACTION as Et}from"../catalog/snapshotReads";import{UNPARSEABLE_ARGS as no,isRealUserMessage as It}from"../providers/types";import{isReversible as At}from"../effects/ledger";import{classifyTurn as ro,QUESTION_DECLINED as $t,tapLabels as so}from"../policy/turnScope";import{describeCall as Je,decide as H}from"../policy/policy";import{redact as io,stripSelfTraffic as ao}from"../policy/redact";import{idGrounding as lo,UNSEEN_ID_ADVICE as co}from"./idGrounding";import{effectFor as Nt}from"./effectFor";import{digestOf as Ye}from"../effects/digest";import{buildUiBlock as uo,UI_TOOL_NAME as ke,uiProviderTool as fo}from"../blocks/uiTool";import{projectReceipt as po}from"../blocks/receipts";import{isAskBlock as ho}from"../blocks/types";import{ACQUISITION_CALLS as mo,synthesizeAskBlock as yo,synthesizeShortfallBlock as go}from"./askGate";import{couldBeToolCallEnvelope as Ct,parseTextToolCalls as ko,SALVAGE_NOTE as bo}from"./textToolCalls";import{announcesUnstartedWork as wo,PLAN_ONLY_NUDGE as vo,SILENT_NUDGE as Ro}from"./planOnlyStop";import{compactScreen as So}from"./compactScreen";import{budgetForRequest as Ge,MAX_HISTORY_TOKENS as To,MAX_REQUEST_TOKENS as Eo,messageSize as $e}from"./historyBudget";import{promptTokensOf as Io,TokenCalibration as Ao}from"./tokenCalibration";import{truncationMarker as $o}from"./evidence";import{retrieveEvidence as No}from"./retrieve";import{VERIFICATION_REPAIR as Co,verificationTrailer as _o,verifyOutcome as Oo}from"./verify";import{realClearTimeout as xo,realNow as C,realSetTimeout as Uo}from"../realNow";const _t=24e3;const Ot=2e3;const xt=3;function Po(t){const n=o=>{if(o===null||typeof o!=="object")return o;if(Array.isArray(o))return o.map(n);const d=o;return Object.keys(d).sort().reduce((l,b)=>(l[b]=n(d[b]),l),{})};return t.map(o=>`${o.name}:${JSON.stringify(n(o.input??{}))}`).join("|")}const Ut="[Buoy] You have now made this exact call three times in a row and gotten the same thing back. Repeating it again will not change the answer. Read the result you already have, then either try a different tool or different arguments, or tell the user plainly what you could not get and what you tried.";const Mo=24;const Ne="Resume where you left off. Don't redo past changes. Read the past tool results first.";const Do="You are out of steps. No more tools may run. Reply in the user's language with plain words. Name every write that ran, what you found, and what is still not done. Use the tool results as proof. A tap alone does not prove a save or an order worked. Do not claim the job is done if you have not checked it. Keep the reply short.";const Pt=18e4;const Lo=2;const qo=1;const Mt=1;const Ke=1e3;const jo=1e3;const Bo=250;const Fo=3e4;function Dt(t,n){return new Promise(o=>{if(n?.aborted)return o();const d=Uo(l,t);function l(){xo(d);n?.removeEventListener("abort",l);o()}n?.addEventListener("abort",l,{once:true})})}function Lt(t){if(typeof t==="boolean")return{approved:t,trust:false};const n=t.reason?.trim();return{approved:t.approved,...n?{reason:n}:{},trust:t.trust===true&&t.approved}}function qt(t){return t?`The user declined this change and said: "${t}". Do not retry it as proposed; take their note into account and, if a different change would fit, propose that instead.`:"The user declined this change. Do not retry it; ask what they would prefer."}function zo(t,n){const o=t.toLowerCase();const d=n.toLowerCase();if(Math.abs(o.length-d.length)>1)return false;let l=0;while(l<o.length&&o[l]===d[l])l++;return o===d||o.slice(l+1)===d.slice(l+1)||o.slice(l+1)===d.slice(l)||o.slice(l)===d.slice(l+1)}function B(t,n,o){return t.find(d=>d.toolId===n)?.actions.find(d=>d.action===o)}const jt="Rejected: every image URL must be one you read from a tool result in THIS conversation (images.list, a storage value, a response body). Never invent or remember URLs \u2014 read them first, then show them.";const Wo=t=>` NOTE: ${t} image ${t===1?"URL was":"URLs were"} dropped \u2014 they were not read from a tool result in this conversation, so the card the user is looking at has no picture there. Do not tell them it does; read the URLs and show it again, or say the artwork is missing.`;function Ho(t){try{return JSON.stringify(t??null)}catch{return String(t)}}function Jo(t,n){if(t.length<=_t)return t;return`${t.slice(0,_t)}${$o(t.length,n)}`}function Yo(t){if(t===null||t===void 0)return"Done";if(Array.isArray(t))return Ve(t.length);if(typeof t==="boolean")return t?"Done":"Failed";if(typeof t==="object"){const n=t;if(n.ok===false)return typeof n.error==="string"?n.error:"Failed";if(n.found===false)return"Not found";if(n.tapped===false)return"Nothing to tap";if(n.active===false&&typeof n.inactiveReason==="string"&&n.inactiveReason.length>0){return"Saved, but inactive in this build"}for(const d of["returned","count","total"]){const l=n[d];if(typeof l==="number")return Ve(l)}const o=Object.values(n).filter(Array.isArray);if(o.length===1)return Ve(o[0].length);return"Done"}return String(t).slice(0,80)}function Ve(t){return t===1?"1 item":`${t} items`}function Bt(t){return typeof t==="object"&&t!==null&&t.ok===false}const Qe="tapElement needs nativeTag, testID or query. Read describeScreen and pass one.";function Ce(t,n,o){return t==="highlight-updates"&&n==="tapElement"&&![o.nativeTag,o.testID,o.query].some(d=>typeof d==="string"?d.trim().length>0:d!=null)}function Ft(t,n,o){if(t!=="highlight-updates"||n!=="tapElement"||!o||typeof o!=="object")return o;const d=o;if(d.tapped!==false)return o;return{...d,ok:false,error:typeof d.reason==="string"?d.reason:typeof d.error==="string"?d.error:"Nothing was tapped. Read describeScreen and try again."}}export async function*runAgentTurn(t){const{provider:n,catalog:o,system:d,systemVolatile:l,model:b,maxTokens:m,dispatch:u,readSnapshot:y,storeKeyOwners:M,ledger:g,policy:D,isRelease:L,requestApproval:Q,signal:$,evidence:X,trusted:N,procedures:J}=t;const Z=new Map;const x=t.calibration??new Ao;const ue=[...t.messages].reverse().find(p=>It(p));const F=ro(ue?.role==="user"?ue.text:"");const f=[...t.messages];const we=n.protocol==="anthropic"?t.feedOptions??{}:{};const Y=we.freezeHistory===true;const U=we.notices==="system-msg";const fe=(p,E=false)=>({role:"user",text:p,...n.protocol==="anthropic"?{source:"engine"}:{},...E?{systemNotice:true}:{}});const Ze=()=>{const p=f[f.length-1];return U&&(p?.role==="tool-results"||p?.role==="user"&&p.systemNotice===true)};const et=lo(f,`${t.system}
1
+ "use strict";import{CATALOG as Et}from"../catalog/catalog.g";import{applyDefaults as Ae,validateParams as $e}from"../catalog/validateParams";import{normalizeParams as ge,aliasNote as eo}from"../catalog/normalizeParams";import{fromProviderToolName as ce,toProviderTools as to}from"../catalog/toProviderTools";import{hashQueryKey as oo}from"../catalog/normalizeParams";import{projectSnapshot as no,SNAPSHOT_ACTION as St}from"../catalog/snapshotReads";import{UNPARSEABLE_ARGS as ro,isRealUserMessage as It}from"../providers/types";import{isReversible as At}from"../effects/ledger";import{classifyTurn as so,QUESTION_DECLINED as $t,tapLabels as io}from"../policy/turnScope";import{describeCall as Je,decide as H}from"../policy/policy";import{redact as ao,stripSelfTraffic as lo}from"../policy/redact";import{idGrounding as co,UNSEEN_ID_ADVICE as uo}from"./idGrounding";import{effectFor as Nt}from"./effectFor";import{digestOf as Ge}from"../effects/digest";import{buildUiBlock as fo,UI_TOOL_NAME as ke,uiProviderTool as po}from"../blocks/uiTool";import{projectReceipt as ho}from"../blocks/receipts";import{isAskBlock as mo}from"../blocks/types";import{ACQUISITION_CALLS as yo,synthesizeAskBlock as go,synthesizeShortfallBlock as ko}from"./askGate";import{couldBeToolCallEnvelope as Ct,parseTextToolCalls as bo,SALVAGE_NOTE as wo}from"./textToolCalls";import{announcesUnstartedWork as vo,PLAN_ONLY_NUDGE as Ro,SILENT_NUDGE as To}from"./planOnlyStop";import{compactScreen as Eo}from"./compactScreen";import{budgetForRequest as Ye,MAX_HISTORY_TOKENS as So,MAX_REQUEST_TOKENS as Io,messageSize as Ne}from"./historyBudget";import{promptTokensOf as Ao,TokenCalibration as $o}from"./tokenCalibration";import{truncationMarker as No}from"./evidence";import{retrieveEvidence as Co}from"./retrieve";import{VERIFICATION_REPAIR as _o,verificationTrailer as Oo,verifyOutcome as xo}from"./verify";import{realClearTimeout as Uo,realNow as C,realSetTimeout as Do}from"../realNow";const _t=24e3;const Ot=2e3;const xt=3;function Lo(t){const n=o=>{if(o===null||typeof o!=="object")return o;if(Array.isArray(o))return o.map(n);const d=o;return Object.keys(d).sort().reduce((l,b)=>(l[b]=n(d[b]),l),{})};return t.map(o=>`${o.name}:${JSON.stringify(n(o.input??{}))}`).join("|")}const Ut="[Buoy] You have now made this exact call three times in a row and gotten the same thing back. Repeating it again will not change the answer. Read the result you already have, then either try a different tool or different arguments, or tell the user plainly what you could not get and what you tried.";const Po=24;const Ce="Resume where you left off. Don't redo past changes. Read the past tool results first.";const Mo="You are out of steps. No more tools may run. Reply in the user's language with plain words. Name every write that ran, what you found, and what is still not done. Use the tool results as proof. A tap alone does not prove a save or an order worked. Do not claim the job is done if you have not checked it. Keep the reply short.";const Dt=18e4;const qo=2;const jo=1;const Lt=1;const Ke=1e3;const Bo=1e3;const Fo=250;const zo=3e4;function Pt(t,n){return new Promise(o=>{if(n?.aborted)return o();const d=Do(l,t);function l(){Uo(d);n?.removeEventListener("abort",l);o()}n?.addEventListener("abort",l,{once:true})})}function Mt(t){if(typeof t==="boolean")return{approved:t,trust:false};const n=t.reason?.trim();return{approved:t.approved,...n?{reason:n}:{},trust:t.trust===true&&t.approved}}function qt(t){return t?`The user declined this change and said: "${t}". Do not retry it as proposed; take their note into account and, if a different change would fit, propose that instead.`:"The user declined this change. Do not retry it; ask what they would prefer."}function Wo(t,n){const o=t.toLowerCase();const d=n.toLowerCase();if(Math.abs(o.length-d.length)>1)return false;let l=0;while(l<o.length&&o[l]===d[l])l++;return o===d||o.slice(l+1)===d.slice(l+1)||o.slice(l+1)===d.slice(l)||o.slice(l)===d.slice(l+1)}function B(t,n,o){return t.find(d=>d.toolId===n)?.actions.find(d=>d.action===o)}const jt="Rejected: every image URL must be one you read from a tool result in THIS conversation (images.list, a storage value, a response body). Never invent or remember URLs \u2014 read them first, then show them.";const Ho=t=>` NOTE: ${t} image ${t===1?"URL was":"URLs were"} dropped \u2014 they were not read from a tool result in this conversation, so the card the user is looking at has no picture there. Do not tell them it does; read the URLs and show it again, or say the artwork is missing.`;const Jo="Done. This action sends back no data. Read the app's state to see what changed.";const Bt="The app is reloading.";function Go(t){if(t===void 0)return Jo;try{return JSON.stringify(t??null)}catch{return String(t)}}function Yo(t,n){if(t.length<=_t)return t;return`${t.slice(0,_t)}${No(t.length,n)}`}function Ko(t){if(t===null||t===void 0)return"Done";if(Array.isArray(t))return Ve(t.length);if(typeof t==="boolean")return t?"Done":"Failed";if(typeof t==="object"){const n=t;if(n.ok===false)return typeof n.error==="string"?n.error:"Failed";if(n.found===false)return"Not found";if(n.tapped===false)return"Nothing to tap";if(n.active===false&&typeof n.inactiveReason==="string"&&n.inactiveReason.length>0){return"Saved, but inactive in this build"}for(const d of["returned","count","total"]){const l=n[d];if(typeof l==="number")return Ve(l)}const o=Object.values(n).filter(Array.isArray);if(o.length===1)return Ve(o[0].length);return"Done"}return String(t).slice(0,80)}function Ve(t){return t===1?"1 item":`${t} items`}function Ft(t){return typeof t==="object"&&t!==null&&t.ok===false}const Qe="tapElement needs nativeTag, testID or query. Read describeScreen and pass one.";function _e(t,n,o){return t==="highlight-updates"&&n==="tapElement"&&![o.nativeTag,o.testID,o.query].some(d=>typeof d==="string"?d.trim().length>0:d!=null)}function zt(t,n,o){if(t!=="highlight-updates"||n!=="tapElement"||!o||typeof o!=="object")return o;const d=o;if(d.tapped!==false)return o;return{...d,ok:false,error:typeof d.reason==="string"?d.reason:typeof d.error==="string"?d.error:"Nothing was tapped. Read describeScreen and try again."}}export async function*runAgentTurn(t){const{provider:n,catalog:o,system:d,systemVolatile:l,model:b,maxTokens:m,dispatch:f,readSnapshot:y,storeKeyOwners:L,ledger:g,policy:P,isRelease:M,requestApproval:Q,signal:$,evidence:X,trusted:N,procedures:J}=t;const Z=new Map;const x=t.calibration??new $o;const ue=[...t.messages].reverse().find(p=>It(p));const F=so(ue?.role==="user"?ue.text:"");const u=[...t.messages];const we=n.protocol==="anthropic"?t.feedOptions??{}:{};const G=we.freezeHistory===true;const U=we.notices==="system-msg";const fe=(p,I=false)=>({role:"user",text:p,...n.protocol==="anthropic"?{source:"engine"}:{},...I?{systemNotice:true}:{}});const Ze=()=>{const p=u[u.length-1];return U&&(p?.role==="tool-results"||p?.role==="user"&&p.systemNotice===true)};const et=co(u,`${t.system}
2
2
  ${t.systemVolatile??""}${ue?.role==="user"&&ue.liveBlock?`
3
3
  ${ue.liveBlock.text}`:""}
4
- ${JSON.stringify(J??[])}`);let ee=eo(o,{availableToolIds:t.availableToolIds,availableActions:t.availableActions,isRelease:L});ee.push(fo());if(Y)ee=JSON.parse(JSON.stringify(ee));const te=D.maxSteps??Mo;const tt=Qo();const Wt=g.generation;const Ht=new Set(g.list().map(p=>p.id));const ot=d.length+(l?.length??0)+ee.reduce((p,E)=>p+E.description.length+JSON.stringify(E.inputSchema).length,0);const ve=()=>ot+x.chars(m);let pe=C()+Pt;const oe={throttled:0,overflow:0,network:0};let ne=To;const _e=t.seenUrls??new Set;const Jt=/https?:\/\/[^\s"'\\)\]}>]+/g;let Oe=false;const re=[];let nt=false;const xe=[];let Ue=false;let rt=false;let Re=false;let st=false;let it=false;const Yt=[...f].reverse().find(It);const Gt=/\?\s*$/.test(Yt?.text?.trim()??"");const at=p=>p.reduce((E,_)=>E+$e(_),0)<=Math.min(x.chars(ne),x.chars(Eo)-ve());const Pe="This turn has no room left. Tap Continue to go on.";for(let p=0;p<te;p++){if($?.aborted){yield{type:"done",stopReason:"stopped"};return f}if(C()>pe){yield{type:"block",block:{id:`cap${C()}`,kind:"notice",tone:"warning",text:`This is taking too long \u2014 stopped after ${Math.round(Pt/1e3)}s. What it found so far is above.`,actions:[{label:"Continue",primary:true,send:Ne}]}};yield{type:"done",stopReason:"time-cap"};return f}const E=Y&&p>0?{messages:f,droppedRounds:0,droppedPinned:0}:Ge(f,ve(),x.chars(ne),x.charsPerToken,g.liveCallIds());if(E.droppedRounds>0){f.length=0;f.push(...E.messages);yield{type:"history-trimmed",droppedRounds:E.droppedRounds,droppedPinned:E.droppedPinned}}else if(E.messages!==f){f.length=0;f.push(...E.messages)}if(te>6&&p===te-6){f.push(fe("6 steps left. Finish what the user asked. Skip extra checks. Batch reads that do not depend on each other in one round.",Ze()))}if(Y&&!at(f)){yield{type:"block",block:{id:`space${C()}`,kind:"notice",tone:"warning",text:Pe,actions:[{label:"Continue",primary:true,send:Ne}]}};yield{type:"done",stopReason:"incomplete"};return f}let _="";let ut=false;const ie=e=>{const c=Oe&&!ut;ut=true;Oe=true;return c?{type:"text",delta:e,breakBefore:true}:{type:"text",delta:e}};let v=[];const ft=new Set;let P="";let De=true;let ae=[];let Se=false;let G;let K;let Le=0;for(;;){Le+=1;_="";v=[];P="";De=true;ae=[];Se=false;G=void 0;K=void 0;let e;const c=ot+f.reduce((i,I)=>i+$e(I),0);let r=false;try{for await(const i of n.send({messages:f,system:d,systemVolatile:l,tools:ee,model:b,maxTokens:m,signal:$,meta:{askId:tt,round:p+1,attempt:Le}})){if(i.type==="text"){_+=i.delta;if(!De){yield ie(i.delta)}else if(Ct(_)){P+=i.delta}else{De=false;P="";yield ie(_)}}else if(i.type==="tool-call"){v.push(i.call)}else if(i.type==="meter"){yield{type:"meter",frame:i.frame}}else if(i.type==="thinking"){ae.push(i.block);if(i.block.type==="thinking"&&i.block.thinking.trim()){yield{type:"reasoning",text:i.block.thinking}}}else if(i.type==="error"){if(i.kind==="truncated"||i.kind==="timeout"){K={message:i.message}}else if(i.problem&&(i.problem.kind==="throttled"||i.problem.kind==="overflow")&&_===""&&v.length===0&&ae.length===0){e={problem:i.problem,message:i.message}}else{yield{type:"error",message:i.message,...i.problem?.hosted?{hosted:i.problem.hosted}:{}};Se=true}}else if(i.type==="done"){G=i.outcome;if(i.usage){x.observe(c,Io(i.usage,n.protocol));yield{type:"usage",...i.usage,model:i.model}}}}}catch(i){const I=_===""&&v.length===0&&ae.length===0;if($?.aborted||!I||oe.network>=Mt||C()+Ke>pe)throw i;r=true}if(r){oe.network+=1;yield{type:"retrying",reason:"network",attempt:oe.network+1,maxAttempts:1+Mt,inMs:Ke};await Dt(Ke,$);if($?.aborted){yield{type:"done",stopReason:"stopped"};return f}continue}if(!e)break;const s=e.problem.kind;if(Y&&s==="overflow"){K={message:Pe};break}const k=1+(s==="throttled"?Lo:qo);const h=oe[s];let O=s==="throttled"?Math.min(e.problem.retryAfterMs??jo*2**h,Fo)+Math.floor(Math.random()*Bo):0;let q=h>=k-1||$?.aborted===true||C()+O>pe;if(e.problem.hosted&&Le>=2)q=true;if(!q&&s==="overflow"){ne=Math.floor(ne/2);const i=f.reduce((V,W)=>V+$e(W),0);const I=Ge(f,ve(),x.chars(ne),x.charsPerToken,g.liveCallIds());const je=I.messages.reduce((V,W)=>V+$e(W),0);if(je>=i){q=true}else{f.length=0;f.push(...I.messages);if(I.droppedRounds>0)yield{type:"history-trimmed",droppedRounds:I.droppedRounds,droppedPinned:I.droppedPinned}}}if(q){const i=s==="throttled"?h>0?`The AI endpoint is rate-limiting requests \u2014 tried ${h+1} times.`:"The AI endpoint is rate-limiting requests.":"This conversation is too large for the AI endpoint and there was nothing older to trim. Start a new conversation, or ask a shorter question.";const I=e.problem.hosted;yield I?{type:"error",message:I.message,hosted:I}:{type:"error",message:`${i} (${e.message})`};Se=true;break}oe[s]+=1;yield{type:"retrying",reason:s,attempt:oe[s]+1,maxAttempts:k,inMs:O};if(O>0)await Dt(O,$);if($?.aborted){yield{type:"done",stopReason:"stopped"};return f}}if(G==="refused"||G==="context-limited"){yield{type:"error",message:G==="refused"?"Claude could not help with this request.":"Claude ran out of room for this turn. Please send a new message."};yield{type:"done",stopReason:"error"};return f}if(Se){if(P)yield ie(P);yield{type:"done",stopReason:"error"};return f}if(!K&&G!=="completed"){K={message:G==="output-limited"?v.length?"The model ran out of room mid-plan, so nothing was run. What it found so far is above.":"The model ran out of room before finishing this answer.":"The answer ended before the endpoint said it was finished, so nothing was run."}}if(K){if(P)yield ie(P);if(_.trim())f.push({role:"assistant",text:_});yield{type:"block",block:{id:`cut${C()}`,kind:"notice",tone:"warning",text:K.message,actions:[{label:"Continue",primary:true,send:Ne}]}};yield{type:"done",stopReason:"incomplete"};return f}if(P){const e=v.length===0?ko(P,o):void 0;if(e){for(const c of e.calls){v.push(c);ft.add(c.id)}_=e.reply;if(e.reply)yield ie(e.reply)}else{yield ie(P)}P=""}f.push({role:"assistant",text:_,toolCalls:v.length?v:void 0,thinking:ae.length?ae:void 0});if(_.trim())xe.push(_.trim());if(v.length===0&&!Re&&!Ue&&p<te-1&&(wo(_,F==="task")||st&&!it&&!Gt)){Re=true;f.push(fe(vo));continue}if(v.length===0&&!Re&&xe.length===0&&p<te-1){Re=true;f.push(fe(Ro));continue}if(v.length===0){const e=xe.join("\n\n");const c=go({text:e,attempted:rt});if(c)yield{type:"block",block:c};const r=Ue||c?null:yo(e);if(r){yield{type:"block",block:r};yield{type:"awaiting-user",blockId:r.id}}yield{type:"done",stopReason:r?"awaiting-user":"answered"};return f}const w=[];const Te=[];const j=e=>{if(!U)return e;Te.push(e.trim());return""};let pt=false;const ht=new Map;if(v.length>1){const e=v.every(c=>{if(c.name===ke)return false;const r=ce(c.name,o);if(!r||r==="ask-buoy")return false;const s=c.input?.action;if(typeof s!=="string"||s===Et)return false;const k=B(o,r,s);if(!k||k.effect!=="read")return false;return H({descriptor:k,toolId:r,policy:D,isRelease:L}).verdict==="allow"});if(e){for(const c of v){const r=ce(c.name,o);const s=String(c.input.action);const k={...c.input.params??{}};const h=B(o,r,s);const O=ge(r,s,k);const q=Ie(O.params,h.params);if(!Ae(q,h.params).ok)continue;const i=Promise.resolve(u(r,s,q)).catch(I=>{throw I});i.catch(()=>{});ht.set(c.id,i)}}}let qe=null;const Vt=e=>{const c=ce(e.name,o)??e.name;const r=typeof e.input?.action==="string"?e.input.action:"";const s=r?B(o,c,r):void 0;const k=e.input?.params??{};return[{type:"tool-start",id:e.id,toolId:c,action:r,label:s?Je(c,s,k):`${c}.${r}`,description:s?.summary??"",params:k,effect:s?.effect??"read"},{type:"tool-end",id:e.id,ok:false,summary:"stopped",durationMs:0}]};const Ee=new Map;if(F==="question"){for(const e of v){if(ce(e.name,o)!=="highlight-updates"||e.input?.action!=="tapElement")continue;const c=ge("highlight-updates","tapElement",e.input.params??{}).params;if(Ce("highlight-updates","tapElement",c))continue;const r=B(o,"highlight-updates","describeScreen");const s=B(o,"highlight-updates","tapElement");if($?.aborted||!r||!s||H({descriptor:r,toolId:"highlight-updates",policy:D,isRelease:L}).verdict!=="allow"||H({descriptor:s,toolId:"highlight-updates",policy:D,isRelease:L,turnScope:F,params:c}).verdict==="refuse")continue;const k=await u("highlight-updates","describeScreen",{}).catch(()=>void 0);Ee.set(e.id,so(k,c))}}const mt=v.map(e=>{if(e.name===ke)return void 0;const c=ce(e.name,o);const r=typeof e.input?.action==="string"?e.input.action:void 0;if(!c||!r)return void 0;const s=B(o,c,r);if(!s)return void 0;const k=e.input.params??{};const h=Ie(ge(c,r,k).params,s.params);if(Ce(c,r,h)||!Ae(h,s.params).ok)return void 0;const O=H({descriptor:s,toolId:c,policy:D,isRelease:L,turnScope:F,params:h,tapLabels:Ee.get(e.id)});return{call:e,toolId:c,action:r,descriptor:s,params:h,label:Je(c,s,h),mutates:s.effect!=="read",gated:O.verdict==="needs-approval",turnScoped:O.verdict==="needs-approval"&&O.turnScoped,reason:O.verdict==="needs-approval"?O.reason:""}});const Qt=mt.some(e=>e?.gated);const z=new Map;let yt=false;let gt=false;async function*Xt(){yt=true;for(const e of mt){if(!e?.gated||z.has(e.call.id))continue;if(!e.turnScoped&&N?.has(`${e.toolId}.${e.action}`)){z.set(e.call.id,true);continue}yield{type:"approval-required",id:e.call.id,toolId:e.toolId,action:e.action,label:e.label,description:e.descriptor.summary,reason:e.reason};const c=C();const r=await readTargetDigest({toolId:e.toolId,action:e.action,params:e.params,dispatch:u,catalog:o});const s=Lt(!e.turnScoped&&N?.has(`${e.toolId}.${e.action}`)?true:Q?await Q({id:e.call.id,toolId:e.toolId,action:e.action,label:e.label,description:e.descriptor.summary,reason:e.reason,params:e.params,targetDigest:r}):false);pe+=C()-c;const k=s.approved;z.set(e.call.id,k);if(s.trust)N?.add(`${e.toolId}.${e.action}`);if(s.reason)Z.set(e.call.id,s.reason);if(!k){gt=true;return}}}for(const e of v){if($?.aborted){if(e.name!==ke){for(const a of Vt(e))yield a}w.push({toolCallId:e.id,content:"Not run \u2014 the user pressed Stop before this call started.",isError:true});continue}const c=e.input?.[no];if(typeof c==="string"){w.push({toolCallId:e.id,content:`Not run \u2014 this call's arguments were not valid JSON, so nothing changed (${c.slice(0,120)}). Send the call again with compact JSON: {"action": "...", "params": {...}}.`,isError:true});continue}if(e.name===ke){const a=uo(e.input);if(!a.ok||!a.block){w.push({toolCallId:e.id,content:`Invalid ${ke} block:
5
- ${a.errors.join("\n")}`+j("\n\nResend ONLY the corrected block. Do not rewrite your answer \u2014 whatever you already said this turn has been shown to the user, and saying it again repeats it on their screen."),isError:true});continue}let S=0;if(a.block.kind==="imageGrid"){const A=a.block.images.filter(T=>_e.has(T.url));S=a.block.images.length-A.length;if(A.length===0){w.push({toolCallId:e.id,content:U?"Rejected: image URLs were not read from a tool result."+j(jt):jt,isError:true});continue}a.block={...a.block,images:A}}if(a.block.kind==="list"){const A=a.block.items.map(T=>{if(!T.image||_e.has(T.image))return T;S+=1;return{...T,image:void 0}});a.block={...a.block,items:A}}yield{type:"block",block:a.block,forToolCallId:e.id};if(a.block.kind==="actions"||a.block.kind==="suggestions"||a.block.kind==="plan"&&a.block.pending){Ue=true}if(ho(a.block)){qe=a.block.id;w.push({toolCallId:e.id,content:"Shown. Waiting for the user's answer \u2014 it will arrive as their next message."+j(" Do not guess it.")})}else{w.push({toolCallId:e.id,content:"Shown to the user."+j(" Don't repeat its contents in text.")+(S>0?Wo(S):"")})}continue}const r=ce(e.name,o);const s=e.input.action;const k=(a,S)=>[{type:"tool-start",id:e.id,toolId:r??e.name,action:s??"",label:a,description:"",params:e.input.params??{},effect:"read"},{type:"tool-end",id:e.id,ok:false,summary:S,durationMs:0}];if(!r){for(const a of k(e.name,"No such tool"))yield a;w.push({toolCallId:e.id,content:`There is no tool called "${e.name}". Use one of the tools you were given.`,isError:true});continue}if(!s){for(const a of k(e.name,"No action given"))yield a;w.push({toolCallId:e.id,content:`"${e.name}" needs an "action" \u2014 it is required, and it names which of this tool's actions to run. See the action list in the tool's description.`,isError:true});continue}const h=B(o,r,s);if(!h){const a=o.find(R=>R.toolId===r)?.actions.map(R=>R.action)??[];const S=o.filter(R=>R.toolId!==r&&R.actions.some(ze=>ze.action===s));const A=a.filter(R=>zo(R,s));const T=[...S.map(R=>`${R.toolId}.${s}`),...A.map(R=>`${r}.${R}`)].slice(0,3);const le=`${r} has no ${s}.${T.length?` Did you mean ${T.join(" or ")}?`:""}`;for(const R of k(`${r}.${s}`,T.length?le:"No such action"))yield R;w.push({toolCallId:e.id,content:`${le}${a.length?` Valid actions: ${a.join(", ")}.`:""}`,isError:true});continue}const O=e.input.params??{};const q=ge(r,s,O);const i=Ie(q.params,h.params);if(Ce(r,s,i)){for(const a of k(`${r}.${s}`,Qe))yield a;w.push({toolCallId:e.id,content:JSON.stringify({ok:false,error:U?"tapElement needs nativeTag, testID or query."+j("Read describeScreen and pass nativeTag, testID or query."):Qe}),isError:true});continue}const I=Ae(i,h.params);if(!I.ok){w.push({toolCallId:e.id,content:`Invalid parameters for ${r}.${s}:
6
- ${I.errors.join("\n")}
4
+ ${JSON.stringify(J??[])}`);let ee=to(o,{availableToolIds:t.availableToolIds,availableActions:t.availableActions,isRelease:M});ee.push(po());if(G)ee=JSON.parse(JSON.stringify(ee));const te=P.maxSteps??Po;const tt=Zo();const Ht=g.generation;const Jt=new Set(g.list().map(p=>p.id));const ot=d.length+(l?.length??0)+ee.reduce((p,I)=>p+I.description.length+JSON.stringify(I.inputSchema).length,0);const ve=()=>ot+x.chars(m);let pe=C()+Dt;const oe={throttled:0,overflow:0,network:0};let ne=So;const Oe=t.seenUrls??new Set;const Gt=/https?:\/\/[^\s"'\\)\]}>]+/g;let Re=false;const re=[];let nt=false;const xe=[];let Ue=false;let rt=false;let Te=false;let st=false;let it=false;const Yt=[...u].reverse().find(It);const Kt=/\?\s*$/.test(Yt?.text?.trim()??"");const at=p=>p.reduce((I,_)=>I+Ne(_),0)<=Math.min(x.chars(ne),x.chars(Io)-ve());const De="This turn has no room left. Tap Continue to go on.";for(let p=0;p<te;p++){if($?.aborted){yield{type:"done",stopReason:"stopped"};return u}if(C()>pe){yield{type:"block",block:{id:`cap${C()}`,kind:"notice",tone:"warning",text:`This is taking too long \u2014 stopped after ${Math.round(Dt/1e3)}s. What it found so far is above.`,actions:[{label:"Continue",primary:true,send:Ce}]}};yield{type:"done",stopReason:"time-cap"};return u}const I=G&&p>0?{messages:u,droppedRounds:0,droppedPinned:0}:Ye(u,ve(),x.chars(ne),x.charsPerToken,g.liveCallIds());if(I.droppedRounds>0){u.length=0;u.push(...I.messages);yield{type:"history-trimmed",droppedRounds:I.droppedRounds,droppedPinned:I.droppedPinned}}else if(I.messages!==u){u.length=0;u.push(...I.messages)}if(te>6&&p===te-6){u.push(fe("6 steps left. Finish what the user asked. Skip extra checks. Batch reads that do not depend on each other in one round.",Ze()))}if(G&&!at(u)){yield{type:"block",block:{id:`space${C()}`,kind:"notice",tone:"warning",text:De,actions:[{label:"Continue",primary:true,send:Ce}]}};yield{type:"done",stopReason:"incomplete"};return u}let _="";let ut=false;const ie=e=>{const c=Re&&!ut;ut=true;Re=true;return c?{type:"text",delta:e,breakBefore:true}:{type:"text",delta:e}};let v=[];const ft=new Set;let D="";let Pe=true;let ae=[];let Ee=false;let Y;let K;let Me=0;for(;;){Me+=1;_="";v=[];D="";Pe=true;ae=[];Ee=false;Y=void 0;K=void 0;let e;const c=ot+u.reduce((i,A)=>i+Ne(A),0);let r=false;try{for await(const i of n.send({messages:u,system:d,systemVolatile:l,tools:ee,model:b,maxTokens:m,signal:$,meta:{askId:tt,round:p+1,attempt:Me}})){if(i.type==="text"){_+=i.delta;if(!Pe){yield ie(i.delta)}else if(Ct(_)){D+=i.delta}else{Pe=false;D="";yield ie(_)}}else if(i.type==="tool-call"){v.push(i.call)}else if(i.type==="meter"){yield{type:"meter",frame:i.frame}}else if(i.type==="thinking"){ae.push(i.block);if(i.block.type==="thinking"&&i.block.thinking.trim()){yield{type:"reasoning",text:i.block.thinking}}}else if(i.type==="error"){if(i.kind==="truncated"||i.kind==="timeout"){K={message:i.message}}else if(i.problem&&(i.problem.kind==="throttled"||i.problem.kind==="overflow")&&_===""&&v.length===0&&ae.length===0){e={problem:i.problem,message:i.message}}else{yield{type:"error",message:i.message,...i.problem?.hosted?{hosted:i.problem.hosted}:{}};Ee=true}}else if(i.type==="done"){Y=i.outcome;if(i.usage){x.observe(c,Ao(i.usage,n.protocol));yield{type:"usage",...i.usage,model:i.model}}}}}catch(i){const A=_===""&&v.length===0&&ae.length===0;if($?.aborted||!A||oe.network>=Lt||C()+Ke>pe)throw i;r=true}if(r){oe.network+=1;yield{type:"retrying",reason:"network",attempt:oe.network+1,maxAttempts:1+Lt,inMs:Ke};await Pt(Ke,$);if($?.aborted){yield{type:"done",stopReason:"stopped"};return u}continue}if(!e)break;const s=e.problem.kind;if(G&&s==="overflow"){K={message:De};break}const k=1+(s==="throttled"?qo:jo);const h=oe[s];let O=s==="throttled"?Math.min(e.problem.retryAfterMs??Bo*2**h,zo)+Math.floor(Math.random()*Fo):0;let q=h>=k-1||$?.aborted===true||C()+O>pe;if(e.problem.hosted&&Me>=2)q=true;if(!q&&s==="overflow"){ne=Math.floor(ne/2);const i=u.reduce((V,W)=>V+Ne(W),0);const A=Ye(u,ve(),x.chars(ne),x.charsPerToken,g.liveCallIds());const je=A.messages.reduce((V,W)=>V+Ne(W),0);if(je>=i){q=true}else{u.length=0;u.push(...A.messages);if(A.droppedRounds>0)yield{type:"history-trimmed",droppedRounds:A.droppedRounds,droppedPinned:A.droppedPinned}}}if(q){const i=s==="throttled"?h>0?`The AI endpoint is rate-limiting requests \u2014 tried ${h+1} times.`:"The AI endpoint is rate-limiting requests.":"This conversation is too large for the AI endpoint and there was nothing older to trim. Start a new conversation, or ask a shorter question.";const A=e.problem.hosted;yield A?{type:"error",message:A.message,hosted:A}:{type:"error",message:`${i} (${e.message})`};Ee=true;break}oe[s]+=1;yield{type:"retrying",reason:s,attempt:oe[s]+1,maxAttempts:k,inMs:O};if(O>0)await Pt(O,$);if($?.aborted){yield{type:"done",stopReason:"stopped"};return u}}if(Y==="refused"||Y==="context-limited"){yield{type:"error",message:Y==="refused"?"Claude could not help with this request.":"Claude ran out of room for this turn. Please send a new message."};yield{type:"done",stopReason:"error"};return u}if(Ee){if(D)yield ie(D);yield{type:"done",stopReason:"error"};return u}if(!K&&Y!=="completed"){K={message:Y==="output-limited"?v.length?"The model ran out of room mid-plan, so nothing was run. What it found so far is above.":"The model ran out of room before finishing this answer.":"The answer ended before the endpoint said it was finished, so nothing was run."}}if(K){if(D)yield ie(D);if(_.trim())u.push({role:"assistant",text:_});yield{type:"block",block:{id:`cut${C()}`,kind:"notice",tone:"warning",text:K.message,actions:[{label:"Continue",primary:true,send:Ce}]}};yield{type:"done",stopReason:"incomplete"};return u}if(D){const e=v.length===0?bo(D,o):void 0;if(e){for(const c of e.calls){v.push(c);ft.add(c.id)}_=e.reply;if(e.reply)yield ie(e.reply)}else{yield ie(D)}D=""}u.push({role:"assistant",text:_,toolCalls:v.length?v:void 0,thinking:ae.length?ae:void 0});if(_.trim())xe.push(_.trim());if(v.length===0&&!Te&&!Ue&&p<te-1&&(vo(_,F==="task")||st&&!it&&!Kt)){Te=true;u.push(fe(Ro));continue}if(v.length===0&&!Te&&xe.length===0&&p<te-1){Te=true;u.push(fe(To));continue}if(v.length===0){const e=xe.join("\n\n");const c=ko({text:e,attempted:rt});if(c)yield{type:"block",block:c};const r=Ue||c?null:go(e);if(r){yield{type:"block",block:r};yield{type:"awaiting-user",blockId:r.id}}yield{type:"done",stopReason:r?"awaiting-user":"answered"};return u}const w=[];const Se=[];const j=e=>{if(!U)return e;Se.push(e.trim());return""};let pt=false;const ht=new Map;if(v.length>1){const e=v.every(c=>{if(c.name===ke)return false;const r=ce(c.name,o);if(!r||r==="ask-buoy")return false;const s=c.input?.action;if(typeof s!=="string"||s===St)return false;const k=B(o,r,s);if(!k||k.effect!=="read")return false;return H({descriptor:k,toolId:r,policy:P,isRelease:M}).verdict==="allow"});if(e){for(const c of v){const r=ce(c.name,o);const s=String(c.input.action);const k={...c.input.params??{}};const h=B(o,r,s);const O=ge(r,s,k);const q=Ae(O.params,h.params);if(!$e(q,h.params).ok)continue;const i=Promise.resolve(f(r,s,q)).catch(A=>{throw A});i.catch(()=>{});ht.set(c.id,i)}}}let qe=null;const Qt=e=>{const c=ce(e.name,o)??e.name;const r=typeof e.input?.action==="string"?e.input.action:"";const s=r?B(o,c,r):void 0;const k=e.input?.params??{};return[{type:"tool-start",id:e.id,toolId:c,action:r,label:s?Je(c,s,k):`${c}.${r}`,description:s?.summary??"",params:k,effect:s?.effect??"read"},{type:"tool-end",id:e.id,ok:false,summary:"stopped",durationMs:0}]};const Ie=new Map;if(F==="question"){for(const e of v){if(ce(e.name,o)!=="highlight-updates"||e.input?.action!=="tapElement")continue;const c=ge("highlight-updates","tapElement",e.input.params??{}).params;if(_e("highlight-updates","tapElement",c))continue;const r=B(o,"highlight-updates","describeScreen");const s=B(o,"highlight-updates","tapElement");if($?.aborted||!r||!s||H({descriptor:r,toolId:"highlight-updates",policy:P,isRelease:M}).verdict!=="allow"||H({descriptor:s,toolId:"highlight-updates",policy:P,isRelease:M,turnScope:F,params:c}).verdict==="refuse")continue;const k=await f("highlight-updates","describeScreen",{}).catch(()=>void 0);Ie.set(e.id,io(k,c))}}const mt=v.map(e=>{if(e.name===ke)return void 0;const c=ce(e.name,o);const r=typeof e.input?.action==="string"?e.input.action:void 0;if(!c||!r)return void 0;const s=B(o,c,r);if(!s)return void 0;const k=e.input.params??{};const h=Ae(ge(c,r,k).params,s.params);if(_e(c,r,h)||!$e(h,s.params).ok)return void 0;const O=H({descriptor:s,toolId:c,policy:P,isRelease:M,turnScope:F,params:h,tapLabels:Ie.get(e.id)});return{call:e,toolId:c,action:r,descriptor:s,params:h,label:Je(c,s,h),mutates:s.effect!=="read",gated:O.verdict==="needs-approval",turnScoped:O.verdict==="needs-approval"&&O.turnScoped,reason:O.verdict==="needs-approval"?O.reason:""}});const Xt=mt.some(e=>e?.gated);const z=new Map;let yt=false;let gt=false;async function*Zt(){yt=true;for(const e of mt){if(!e?.gated||z.has(e.call.id))continue;if(!e.turnScoped&&N?.has(`${e.toolId}.${e.action}`)){z.set(e.call.id,true);continue}yield{type:"approval-required",id:e.call.id,toolId:e.toolId,action:e.action,label:e.label,description:e.descriptor.summary,reason:e.reason};const c=C();const r=await readTargetDigest({toolId:e.toolId,action:e.action,params:e.params,dispatch:f,catalog:o});const s=Mt(!e.turnScoped&&N?.has(`${e.toolId}.${e.action}`)?true:Q?await Q({id:e.call.id,toolId:e.toolId,action:e.action,label:e.label,description:e.descriptor.summary,reason:e.reason,params:e.params,targetDigest:r}):false);pe+=C()-c;const k=s.approved;z.set(e.call.id,k);if(s.trust)N?.add(`${e.toolId}.${e.action}`);if(s.reason)Z.set(e.call.id,s.reason);if(!k){gt=true;return}}}for(const e of v){if($?.aborted){if(e.name!==ke){for(const a of Qt(e))yield a}w.push({toolCallId:e.id,content:"Not run \u2014 the user pressed Stop before this call started.",isError:true});continue}const c=e.input?.[ro];if(typeof c==="string"){w.push({toolCallId:e.id,content:`Not run \u2014 this call's arguments were not valid JSON, so nothing changed (${c.slice(0,120)}). Send the call again with compact JSON: {"action": "...", "params": {...}}.`,isError:true});continue}if(e.name===ke){const a=fo(e.input);if(!a.ok||!a.block){w.push({toolCallId:e.id,content:`Invalid ${ke} block:
5
+ ${a.errors.join("\n")}`+j("\n\nResend ONLY the corrected block. Do not rewrite your answer \u2014 whatever you already said this turn has been shown to the user, and saying it again repeats it on their screen."),isError:true});continue}let T=0;if(a.block.kind==="imageGrid"){const E=a.block.images.filter(S=>Oe.has(S.url));T=a.block.images.length-E.length;if(E.length===0){w.push({toolCallId:e.id,content:U?"Rejected: image URLs were not read from a tool result."+j(jt):jt,isError:true});continue}a.block={...a.block,images:E}}if(a.block.kind==="list"){const E=a.block.items.map(S=>{if(!S.image||Oe.has(S.image))return S;T+=1;return{...S,image:void 0}});a.block={...a.block,items:E}}yield{type:"block",block:a.block,forToolCallId:e.id};if(a.block.kind==="actions"||a.block.kind==="suggestions"||a.block.kind==="plan"&&a.block.pending){Ue=true}if(mo(a.block)){qe=a.block.id;w.push({toolCallId:e.id,content:"Shown. Waiting for the user's answer \u2014 it will arrive as their next message."+j(" Do not guess it.")})}else{w.push({toolCallId:e.id,content:"Shown to the user."+j(" Don't repeat its contents in text.")+(T>0?Ho(T):"")})}continue}const r=ce(e.name,o);const s=e.input.action;const k=(a,T)=>[{type:"tool-start",id:e.id,toolId:r??e.name,action:s??"",label:a,description:"",params:e.input.params??{},effect:"read"},{type:"tool-end",id:e.id,ok:false,summary:T,durationMs:0}];if(!r){for(const a of k(e.name,"No such tool"))yield a;w.push({toolCallId:e.id,content:`There is no tool called "${e.name}". Use one of the tools you were given.`,isError:true});continue}if(!s){for(const a of k(e.name,"No action given"))yield a;w.push({toolCallId:e.id,content:`"${e.name}" needs an "action" \u2014 it is required, and it names which of this tool's actions to run. See the action list in the tool's description.`,isError:true});continue}const h=B(o,r,s);if(!h){const a=o.find(R=>R.toolId===r)?.actions.map(R=>R.action)??[];const T=o.filter(R=>R.toolId!==r&&R.actions.some(ze=>ze.action===s));const E=a.filter(R=>Wo(R,s));const S=[...T.map(R=>`${R.toolId}.${s}`),...E.map(R=>`${r}.${R}`)].slice(0,3);const le=`${r} has no ${s}.${S.length?` Did you mean ${S.join(" or ")}?`:""}`;for(const R of k(`${r}.${s}`,S.length?le:"No such action"))yield R;w.push({toolCallId:e.id,content:`${le}${a.length?` Valid actions: ${a.join(", ")}.`:""}`,isError:true});continue}const O=e.input.params??{};const q=ge(r,s,O);const i=Ae(q.params,h.params);if(_e(r,s,i)){for(const a of k(`${r}.${s}`,Qe))yield a;w.push({toolCallId:e.id,content:JSON.stringify({ok:false,error:U?"tapElement needs nativeTag, testID or query."+j("Read describeScreen and pass nativeTag, testID or query."):Qe}),isError:true});continue}const A=$e(i,h.params);if(!A.ok){w.push({toolCallId:e.id,content:`Invalid parameters for ${r}.${s}:
6
+ ${A.errors.join("\n")}
7
7
 
8
8
  Expected schema:
9
- ${JSON.stringify(h.params)}`,isError:true});continue}const je=Zt(q.notes);const V=h.effect!=="read"?et.trailer(i,!U):"";if(U&&V)j(co);const W=Je(r,h,i);const de=H({descriptor:h,toolId:r,policy:D,isRelease:L,turnScope:F,params:i,tapLabels:Ee.get(e.id)});const me=a=>[{type:"tool-start",id:e.id,toolId:r,action:s,label:W,description:h.summary,params:i,effect:h.effect},{type:"tool-end",id:e.id,ok:false,summary:a,durationMs:0}];if(de.verdict==="refuse"){for(const a of me("refused"))yield a;w.push({toolCallId:e.id,content:de.reason,isError:true});continue}const Be=de.verdict==="needs-approval";if(Qt&&!yt&&(h.effect!=="read"||Be)){yield*Xt()}if(gt&&(h.effect!=="read"||Be)){for(const a of me("declined"))yield a;w.push({toolCallId:e.id,content:F==="question"?$t:z.get(e.id)===false?qt(Z.get(e.id)):"Not run \u2014 the user declined another change in this same batch, so none of it was applied. Ask what they would prefer before proposing it again.",isError:true});continue}if(Be){let a;if(z.has(e.id)){a=z.get(e.id)}else if(!de.turnScoped&&N?.has(`${r}.${s}`)){a=true;z.set(e.id,true)}else{yield{type:"approval-required",id:e.id,toolId:r,action:s,label:W,description:h.summary,reason:de.reason};const S=C();const A=await readTargetDigest({toolId:r,action:s,params:i,dispatch:u,catalog:o});const T=Lt(Q?await Q({id:e.id,toolId:r,action:s,label:W,description:h.summary,reason:de.reason,params:i,targetDigest:A}):false);pe+=C()-S;a=T.approved;z.set(e.id,a);if(T.trust)N?.add(`${r}.${s}`);if(T.reason)Z.set(e.id,T.reason)}if(!a){for(const S of me("declined"))yield S;w.push({toolCallId:e.id,content:F==="question"?$t:qt(Z.get(e.id)),isError:true});continue}}if(mo.has(`${r}.${s}`))rt=true;if(r==="ask-buoy"&&s==="openProcedure")st=true;yield{type:"tool-start",id:e.id,toolId:r,action:s,label:W,description:h.summary,params:i,effect:h.effect};const kt=C();const bt=await Xe(h,r,i,u);const Fe=await be(h,r,i,u);if($?.aborted){for(const a of me("stopped"))yield a;w.push({toolCallId:e.id,content:"Not run \u2014 the user pressed Stop before this call started.",isError:true});continue}const wt=H({descriptor:h,toolId:r,policy:D,isRelease:L,turnScope:F,params:i,tapLabels:Ee.get(e.id)});if(wt.verdict==="refuse"){for(const a of me("refused"))yield a;w.push({toolCallId:e.id,content:wt.reason,isError:true});continue}try{let a=s===Et?oo(r,await Ko(y,r),i):r==="ask-buoy"?await zt(s,g,u,X,i,J):await(ht.get(e.id)??u(r,s,i));a=Ft(r,s,a);const S=io(ao(a));const A=Bt(a);if(h.effect!=="read"&&!A)it=true;const T=Ho(r==="highlight-updates"&&s==="describeScreen"&&!A?So(S):S);const le=X&&!A&&!(r==="ask-buoy"&&s==="retrieve")?X.stash({toolId:r,action:s,params:i,capturedAt:C(),text:T}):void 0;const R=Jo(T,le);et.add(T);const ze=R.length>Ot?`${R.slice(0,Ot)}\u2026`:R;yield{type:"tool-end",id:e.id,ok:!A,summary:Yo(a),durationMs:C()-kt,result:ze};const We=Fe===void 0||A?void 0:await be(h,r,i,u);if(h.effect!=="read"&&r!=="ask-buoy"&&!A){const He=g.noteExternalRevert(r,s,i);const Rt=Nt(r,h,i,a,bt,{before:Fe,after:We});if(Rt&&!He){const St=g.record(r,s,Rt,Wt);if(St)St.callId=e.id}}const vt=A?void 0:po({toolId:r,action:s,params:i,result:S,before:Fe??bt,after:We,effect:h.effect});if(vt)yield{type:"block",block:vt,forToolCallId:e.id};const ye=h.effect!=="read"&&!A?await Oo({toolId:r,action:s,params:i,result:a,dispatch:u,readSnapshot:y,signal:$,after:We}):void 0;if(ye)yield{type:"tool-verified",id:e.id,verification:ye};if(U&&ye?.status==="failed")j(Co);for(const He of R.match(Jt)??[])_e.add(He);w.push({toolCallId:e.id,content:R+Go(r,h,i,M,U?j:void 0)+je+V+(ye?_o(ye,!U):"")+(ft.has(e.id)?j(bo):""),...le?{ref:le}:{}});if(r==="app"&&(s==="reloadApp"||s==="reload")){pt=true}}catch(a){const S=a instanceof Error?a.message:String(a);yield{type:"tool-end",id:e.id,ok:false,summary:S,durationMs:C()-kt};w.push({toolCallId:e.id,content:`Failed: ${S}${V}`,isError:true})}}if(v.length){re.push(Po(v));if(re.length>xt)re.shift();const e=!nt&&re.length===xt&&re.every(c=>c===re[0]);if(e){nt=true;const c=w[w.length-1];if(U)Te.push(Ut);else if(c)c.content=`${c.content}
9
+ ${JSON.stringify(h.params)}`,isError:true});continue}const je=eo(q.notes);const V=h.effect!=="read"?et.trailer(i,!U):"";if(U&&V)j(uo);const W=Je(r,h,i);const de=H({descriptor:h,toolId:r,policy:P,isRelease:M,turnScope:F,params:i,tapLabels:Ie.get(e.id)});const me=a=>[{type:"tool-start",id:e.id,toolId:r,action:s,label:W,description:h.summary,params:i,effect:h.effect},{type:"tool-end",id:e.id,ok:false,summary:a,durationMs:0}];if(de.verdict==="refuse"){for(const a of me("refused"))yield a;w.push({toolCallId:e.id,content:de.reason,isError:true});continue}const Be=de.verdict==="needs-approval";if(Xt&&!yt&&(h.effect!=="read"||Be)){yield*Zt()}if(gt&&(h.effect!=="read"||Be)){for(const a of me("declined"))yield a;w.push({toolCallId:e.id,content:F==="question"?$t:z.get(e.id)===false?qt(Z.get(e.id)):"Not run \u2014 the user declined another change in this same batch, so none of it was applied. Ask what they would prefer before proposing it again.",isError:true});continue}if(Be){let a;if(z.has(e.id)){a=z.get(e.id)}else if(!de.turnScoped&&N?.has(`${r}.${s}`)){a=true;z.set(e.id,true)}else{yield{type:"approval-required",id:e.id,toolId:r,action:s,label:W,description:h.summary,reason:de.reason};const T=C();const E=await readTargetDigest({toolId:r,action:s,params:i,dispatch:f,catalog:o});const S=Mt(Q?await Q({id:e.id,toolId:r,action:s,label:W,description:h.summary,reason:de.reason,params:i,targetDigest:E}):false);pe+=C()-T;a=S.approved;z.set(e.id,a);if(S.trust)N?.add(`${r}.${s}`);if(S.reason)Z.set(e.id,S.reason)}if(!a){for(const T of me("declined"))yield T;w.push({toolCallId:e.id,content:F==="question"?$t:qt(Z.get(e.id)),isError:true});continue}}if(yo.has(`${r}.${s}`))rt=true;if(r==="ask-buoy"&&s==="openProcedure")st=true;yield{type:"tool-start",id:e.id,toolId:r,action:s,label:W,description:h.summary,params:i,effect:h.effect};const kt=C();const bt=await Xe(h,r,i,f);const Fe=await be(h,r,i,f);if($?.aborted){for(const a of me("stopped"))yield a;w.push({toolCallId:e.id,content:"Not run \u2014 the user pressed Stop before this call started.",isError:true});continue}const wt=H({descriptor:h,toolId:r,policy:P,isRelease:M,turnScope:F,params:i,tapLabels:Ie.get(e.id)});if(wt.verdict==="refuse"){for(const a of me("refused"))yield a;w.push({toolCallId:e.id,content:wt.reason,isError:true});continue}try{let a=s===St?no(r,await Qo(y,r),i):r==="ask-buoy"?await Wt(s,g,f,X,i,J):await(ht.get(e.id)??f(r,s,i));a=zt(r,s,a);const T=ao(lo(a));const E=Ft(a);if(h.effect!=="read"&&!E)it=true;const S=Go(r==="highlight-updates"&&s==="describeScreen"&&!E?Eo(T):T);const le=X&&!E&&!(r==="ask-buoy"&&s==="retrieve")?X.stash({toolId:r,action:s,params:i,capturedAt:C(),text:S}):void 0;const R=Yo(S,le);et.add(S);const ze=R.length>Ot?`${R.slice(0,Ot)}\u2026`:R;yield{type:"tool-end",id:e.id,ok:!E,summary:Ko(a),durationMs:C()-kt,result:ze};const We=Fe===void 0||E?void 0:await be(h,r,i,f);if(h.effect!=="read"&&r!=="ask-buoy"&&!E){const He=g.noteExternalRevert(r,s,i);const Rt=Nt(r,h,i,a,bt,{before:Fe,after:We});if(Rt&&!He){const Tt=g.record(r,s,Rt,Ht);if(Tt)Tt.callId=e.id}}const vt=E?void 0:ho({toolId:r,action:s,params:i,result:T,before:Fe??bt,after:We,effect:h.effect});if(vt)yield{type:"block",block:vt,forToolCallId:e.id};const ye=h.effect!=="read"&&!E?await xo({toolId:r,action:s,params:i,result:a,dispatch:f,readSnapshot:y,signal:$,after:We}):void 0;if(ye)yield{type:"tool-verified",id:e.id,verification:ye};if(U&&ye?.status==="failed")j(_o);for(const He of R.match(Gt)??[])Oe.add(He);w.push({toolCallId:e.id,content:R+Vo(r,h,i,L,U?j:void 0)+je+V+(ye?Oo(ye,!U):"")+(ft.has(e.id)?j(wo):""),...le?{ref:le}:{}});if(!E&&r==="app"&&(s==="reloadApp"||s==="reload")){pt=true}}catch(a){const T=a instanceof Error?a.message:String(a);yield{type:"tool-end",id:e.id,ok:false,summary:T,durationMs:C()-kt};w.push({toolCallId:e.id,content:`Failed: ${T}${V}`,isError:true})}}if(v.length){re.push(Lo(v));if(re.length>xt)re.shift();const e=!nt&&re.length===xt&&re.every(c=>c===re[0]);if(e){nt=true;const c=w[w.length-1];if(U)Se.push(Ut);else if(c)c.content=`${c.content}
10
10
 
11
- ${Ut}`}}f.push({role:"tool-results",results:w});if(Te.length)f.push(fe([...new Set(Te)].join("\n\n"),true));if(qe){yield{type:"awaiting-user",blockId:qe};yield{type:"done",stopReason:"awaiting-user"};return f}if(pt){yield{type:"done",stopReason:"realm-died"};return f}}if($?.aborted){yield{type:"done",stopReason:"stopped"};return f}const se=[];let dt=false;let Me=false;const he=[...f,fe(Do,Ze())];const Kt=Y?{messages:he}:Ge(he,ve(),x.chars(ne),x.charsPerToken,g.liveCallIds());try{if(Y&&!at(he))throw new Error(Pe);if(Y||U||we.liveBlock==="append"||we.liveBlock==="system-msg")f.push(he[he.length-1]);for await(const p of n.send({messages:Kt.messages,system:d,systemVolatile:l,tools:ee,toolChoice:"none",model:b,maxTokens:m,signal:$,meta:{askId:tt,round:te+1,attempt:1}})){if(p.type==="text")se.push(p.delta);else if(p.type==="tool-call"||p.type==="error")Me=true;else if(p.type==="meter")yield{type:"meter",frame:p.frame};else if(p.type==="done"){if(p.outcome==="refused"||p.outcome==="context-limited"){yield{type:"error",message:p.outcome==="refused"?"Claude could not help with this request.":"Claude ran out of room for this turn. Please send a new message."};yield{type:"done",stopReason:"error"};return f}dt=p.outcome==="completed";if(p.usage)yield{type:"usage",...p.usage,model:p.model}}}}catch{Me=true}if($?.aborted){yield{type:"done",stopReason:"stopped"};return f}const lt=se.join("");if(Me||!dt||!lt.trim()||Ct(lt)){const p=g.list().filter(E=>!Ht.has(E.id));se.length=0;se.push(["I ran out of steps. The job is not done.",...p.length?["These steps ran:",...p.map(E=>`- ${E.effect.label}${E.undoneAt?" (since undone)":""}`),"This list does not prove each change worked."]:[]].join("\n"))}let ct=true;for(const p of se){if(!p)continue;yield{type:"text",delta:p,...ct&&Oe?{breakBefore:true}:{}};ct=false}f.push({role:"assistant",text:se.join("")});yield{type:"block",block:{id:`cap${C()}`,kind:"notice",tone:"warning",text:"I ran out of steps. The job is not done. Tap Continue to go on.",actions:[{label:"Continue",primary:true,send:Ne}]}};yield{type:"done",stopReason:"step-cap"};return f}function Go(t,n,o,d,l){if(t!=="storage"||n.effect==="read")return"";if(!d||typeof o.key!=="string")return"";const b=d[o.key];if(!b)return"";const m=`
11
+ ${Ut}`}}u.push({role:"tool-results",results:w});if(Se.length)u.push(fe([...new Set(Se)].join("\n\n"),true));if(qe){yield{type:"awaiting-user",blockId:qe};yield{type:"done",stopReason:"awaiting-user"};return u}if(pt){yield{type:"text",delta:Bt,...Re?{breakBefore:true}:{}};u.push({role:"assistant",text:Bt});yield{type:"done",stopReason:"realm-died"};return u}}if($?.aborted){yield{type:"done",stopReason:"stopped"};return u}const se=[];let dt=false;let Le=false;const he=[...u,fe(Mo,Ze())];const Vt=G?{messages:he}:Ye(he,ve(),x.chars(ne),x.charsPerToken,g.liveCallIds());try{if(G&&!at(he))throw new Error(De);if(G||U||we.liveBlock==="append"||we.liveBlock==="system-msg")u.push(he[he.length-1]);for await(const p of n.send({messages:Vt.messages,system:d,systemVolatile:l,tools:ee,toolChoice:"none",model:b,maxTokens:m,signal:$,meta:{askId:tt,round:te+1,attempt:1}})){if(p.type==="text")se.push(p.delta);else if(p.type==="tool-call"||p.type==="error")Le=true;else if(p.type==="meter")yield{type:"meter",frame:p.frame};else if(p.type==="done"){if(p.outcome==="refused"||p.outcome==="context-limited"){yield{type:"error",message:p.outcome==="refused"?"Claude could not help with this request.":"Claude ran out of room for this turn. Please send a new message."};yield{type:"done",stopReason:"error"};return u}dt=p.outcome==="completed";if(p.usage)yield{type:"usage",...p.usage,model:p.model}}}}catch{Le=true}if($?.aborted){yield{type:"done",stopReason:"stopped"};return u}const lt=se.join("");if(Le||!dt||!lt.trim()||Ct(lt)){const p=g.list().filter(I=>!Jt.has(I.id));se.length=0;se.push(["I ran out of steps. The job is not done.",...p.length?["These steps ran:",...p.map(I=>`- ${I.effect.label}${I.undoneAt?" (since undone)":""}`),"This list does not prove each change worked."]:[]].join("\n"))}let ct=true;for(const p of se){if(!p)continue;yield{type:"text",delta:p,...ct&&Re?{breakBefore:true}:{}};ct=false}u.push({role:"assistant",text:se.join("")});yield{type:"block",block:{id:`cap${C()}`,kind:"notice",tone:"warning",text:"I ran out of steps. The job is not done. Tap Continue to go on.",actions:[{label:"Continue",primary:true,send:Ce}]}};yield{type:"done",stopReason:"step-cap"};return u}function Vo(t,n,o,d,l){if(t!=="storage"||n.effect==="read")return"";if(!d||typeof o.key!=="string")return"";const b=d[o.key];if(!b)return"";const m=`
12
12
 
13
- [Buoy] This wrote to disk, but "${o.key}" is the saved copy of the live "${b}" store, so nothing on screen has changed \u2014 the app read that key once at startup and has held the state in memory since.`;if(l){l("Use zustand.rehydrate for the store named in the result to load the saved value. Use zustand.setState to change the live store. If the change was for the next app launch, no more work is needed.");return m}return m+` Call zustand.rehydrate({"storeName":"${b}"}) to make the app pick this up, or use zustand.setState next time to change the store directly. If you meant to set the value for the app's next launch, this is already done and no further action is needed.`}export{Ye as digestOf};export async function readTargetDigest(t){const n=B(t.catalog??Tt,t.toolId,t.action);if(!n||n.effect==="read")return void 0;const o=await be(n,t.toolId,t.params,t.dispatch);if(o!==void 0)return Ye(o);const d=await Xe(n,t.toolId,t.params,t.dispatch);if(d!==void 0)return Ye(d);return void 0}export async function runGatedAction(t){const{toolId:n,action:o,dispatch:d,ledger:l,policy:b,isRelease:m}=t;const u=t.catalog??Tt;const y=B(u,n,o);if(!y){return{ok:false,error:`${n}.${o} is not in Buoy's catalog.`}}const M=ge(n,o,t.params??{});const g=Ie(M.params,y.params);if(Ce(n,o,g))return{ok:false,error:Qe};const D=Ae(g,y.params);if(!D.ok){return{ok:false,error:D.errors.join("\n")}}const L=H({descriptor:y,toolId:n,policy:b,isRelease:m});if(L.verdict==="refuse"){return{ok:false,error:L.reason}}const Q=await Xe(y,n,g,d);const $=await be(y,n,g,d);const X=H({descriptor:y,toolId:n,policy:b,isRelease:m});if(X.verdict==="refuse"){return{ok:false,error:X.reason}}try{let N=n==="ask-buoy"?await zt(o,l,d,void 0,g):await d(n,o,g);N=Ft(n,o,N);if(Bt(N)){const J=N.error;return{ok:false,error:typeof J==="string"?J:"The tool refused this."}}if(y.effect!=="read"&&n!=="ask-buoy"){const J=l.noteExternalRevert(n,o,g);const Z=await be(y,n,g,d);const x=Nt(n,y,g,N,Q,{before:$,after:Z});if(x&&!J)l.record(n,o,x)}return{ok:true,result:N}}catch(N){return{ok:false,error:N instanceof Error?N.message:String(N)}}}async function zt(t,n,o,d,l,b){if(t==="retrieve"){return No(d,l??{})}if(t==="openProcedure"){const m=typeof l?.id==="string"?l.id:"";const u=b?.find(y=>y.id===m);if(!u){const y=(b??[]).map(M=>M.id);return{ok:false,error:y.length?`No procedure "${m}". This app's procedures: ${y.join(", ")}.`:"This app has no procedures written for it."}}return{id:u.id,title:u.title,...u.version?{version:u.version}:{},...u.requires?.length?{requires:u.requires}:{},body:u.body,note:"Follow these steps with the ordinary tools. Every write still goes through the same policy, approval and undo as any other call; a step that is refused stays refused."}}if(t==="listChanges"){const m=n.list().filter(u=>!u.undoneAt).map(u=>({id:u.id,toolId:u.toolId,action:u.action,kind:u.effect.kind,label:u.effect.label,reversible:At(u.effect)}));return{changes:m,returned:m.length}}if(t==="undoChange"){const m=typeof l?.id==="string"?l.id:"";const u=n.list().find(M=>M.id===m);if(!u){const M=n.list().filter(g=>!g.undoneAt).map(g=>g.id);return{ok:false,error:`No change with id "${m}". Call listChanges for the current ids${M.length?` (${M.join(", ")})`:""}.`}}if(u.undoneAt)return{ok:false,error:`"${u.effect.label}" was already undone.`};if(!At(u.effect)){return{ok:false,error:`"${u.effect.label}" can't be undone automatically \u2014 it is permanent.`}}const y=await n.revertOne(u,o);return y?{ok:false,error:y}:{ok:true,undone:{id:u.id,label:u.effect.label}}}if(t==="undoAll"){const m=await n.revertAll(o);return{ok:m.failed.length===0,...m}}throw new Error(`Unknown ask-buoy action "${t}"`)}async function Ko(t,n){if(!t){throw new Error(`This app cannot read ${n}'s snapshot \u2014 Buoy's tool registry is not published here.`)}return await t(n)}async function be(t,n,o,d){if(n==="zustand"&&t.action==="setState"){if(typeof o.storeName!=="string")return void 0;try{return await d(n,"getStoreState",{storeName:o.storeName})}catch{return void 0}}if(n==="query"&&t.action==="setQueryData"){const l=typeof o.queryHash==="string"?o.queryHash:Array.isArray(o.queryKey)?to(o.queryKey):void 0;if(!l)return void 0;try{return await d(n,"getQueryData",{queryHash:l})}catch{return void 0}}return void 0}async function Xe(t,n,o,d){if(t.effect==="read")return void 0;if(n==="network")return Vo(t,o,d);if(n!=="storage"||typeof o.key!=="string")return void 0;const l=t.action.startsWith("async.")?"async.getItem":t.action.startsWith("mmkv.")?"mmkv.get":void 0;if(!l)return void 0;const b={key:o.key};if(l==="mmkv.get"){if(typeof o.instanceId!=="string")return void 0;b.instanceId=o.instanceId}try{const m=await d(n,l,b);const u=m&&typeof m==="object"?m:void 0;if(u?.found===false)return void 0;const y=u?u.value:m;return{had:y!==void 0&&y!==null,value:y??void 0}}catch{return void 0}}async function Vo(t,n,o){if(t.action!=="setOverrideRuleEnabled"&&t.action!=="setOverridesEnabled"){return void 0}try{const d=await o("network","listOverrideRules",{});if(!d||typeof d!=="object")return void 0;if(t.action==="setOverridesEnabled"){return{had:true,value:String(d.enabled!==false)}}const l=(d.rules??[]).find(b=>b&&b.id===n.id);if(!l)return void 0;return{had:true,value:String(l.enabled!==false)}}catch{return void 0}}function Qo(){const t="abcdefghijklmnopqrstuvwxyz0123456789";let n="ask_";for(let o=0;o<20;o++)n+=t[Math.floor(Math.random()*t.length)];return n}
13
+ [Buoy] This wrote to disk, but "${o.key}" is the saved copy of the live "${b}" store, so nothing on screen has changed \u2014 the app read that key once at startup and has held the state in memory since.`;if(l){l("Use zustand.rehydrate for the store named in the result to load the saved value. Use zustand.setState to change the live store. If the change was for the next app launch, no more work is needed.");return m}return m+` Call zustand.rehydrate({"storeName":"${b}"}) to make the app pick this up, or use zustand.setState next time to change the store directly. If you meant to set the value for the app's next launch, this is already done and no further action is needed.`}export{Ge as digestOf};export async function readTargetDigest(t){const n=B(t.catalog??Et,t.toolId,t.action);if(!n||n.effect==="read")return void 0;const o=await be(n,t.toolId,t.params,t.dispatch);if(o!==void 0)return Ge(o);const d=await Xe(n,t.toolId,t.params,t.dispatch);if(d!==void 0)return Ge(d);return void 0}export async function runGatedAction(t){const{toolId:n,action:o,dispatch:d,ledger:l,policy:b,isRelease:m}=t;const f=t.catalog??Et;const y=B(f,n,o);if(!y){return{ok:false,error:`${n}.${o} is not in Buoy's catalog.`}}const L=ge(n,o,t.params??{});const g=Ae(L.params,y.params);if(_e(n,o,g))return{ok:false,error:Qe};const P=$e(g,y.params);if(!P.ok){return{ok:false,error:P.errors.join("\n")}}const M=H({descriptor:y,toolId:n,policy:b,isRelease:m});if(M.verdict==="refuse"){return{ok:false,error:M.reason}}const Q=await Xe(y,n,g,d);const $=await be(y,n,g,d);const X=H({descriptor:y,toolId:n,policy:b,isRelease:m});if(X.verdict==="refuse"){return{ok:false,error:X.reason}}try{let N=n==="ask-buoy"?await Wt(o,l,d,void 0,g):await d(n,o,g);N=zt(n,o,N);if(Ft(N)){const J=N.error;return{ok:false,error:typeof J==="string"?J:"The tool refused this."}}if(y.effect!=="read"&&n!=="ask-buoy"){const J=l.noteExternalRevert(n,o,g);const Z=await be(y,n,g,d);const x=Nt(n,y,g,N,Q,{before:$,after:Z});if(x&&!J)l.record(n,o,x)}return{ok:true,result:N}}catch(N){return{ok:false,error:N instanceof Error?N.message:String(N)}}}async function Wt(t,n,o,d,l,b){if(t==="retrieve"){return Co(d,l??{})}if(t==="openProcedure"){const m=typeof l?.id==="string"?l.id:"";const f=b?.find(y=>y.id===m);if(!f){const y=(b??[]).map(L=>L.id);return{ok:false,error:y.length?`No procedure "${m}". This app's procedures: ${y.join(", ")}.`:"This app has no procedures written for it."}}return{id:f.id,title:f.title,...f.version?{version:f.version}:{},...f.requires?.length?{requires:f.requires}:{},body:f.body,note:"Follow these steps with the ordinary tools. Every write still goes through the same policy, approval and undo as any other call; a step that is refused stays refused."}}if(t==="listChanges"){const m=n.list().filter(f=>!f.undoneAt).map(f=>({id:f.id,toolId:f.toolId,action:f.action,kind:f.effect.kind,label:f.effect.label,reversible:At(f.effect)}));return{changes:m,returned:m.length}}if(t==="undoChange"){const m=typeof l?.id==="string"?l.id:"";const f=n.list().find(L=>L.id===m);if(!f){const L=n.list().filter(g=>!g.undoneAt).map(g=>g.id);return{ok:false,error:`No change with id "${m}". Call listChanges for the current ids${L.length?` (${L.join(", ")})`:""}.`}}if(f.undoneAt)return{ok:false,error:`"${f.effect.label}" was already undone.`};if(!At(f.effect)){return{ok:false,error:`"${f.effect.label}" can't be undone automatically \u2014 it is permanent.`}}const y=await n.revertOne(f,o);return y?{ok:false,error:y}:{ok:true,undone:{id:f.id,label:f.effect.label}}}if(t==="undoAll"){const m=await n.revertAll(o);return{ok:m.failed.length===0,...m}}throw new Error(`Unknown ask-buoy action "${t}"`)}async function Qo(t,n){if(!t){throw new Error(`This app cannot read ${n}'s snapshot \u2014 Buoy's tool registry is not published here.`)}return await t(n)}async function be(t,n,o,d){if(n==="zustand"&&t.action==="setState"){if(typeof o.storeName!=="string")return void 0;try{return await d(n,"getStoreState",{storeName:o.storeName})}catch{return void 0}}if(n==="query"&&t.action==="setQueryData"){const l=typeof o.queryHash==="string"?o.queryHash:Array.isArray(o.queryKey)?oo(o.queryKey):void 0;if(!l)return void 0;try{return await d(n,"getQueryData",{queryHash:l})}catch{return void 0}}return void 0}async function Xe(t,n,o,d){if(t.effect==="read")return void 0;if(n==="network")return Xo(t,o,d);if(n!=="storage"||typeof o.key!=="string")return void 0;const l=t.action.startsWith("async.")?"async.getItem":t.action.startsWith("mmkv.")?"mmkv.get":void 0;if(!l)return void 0;const b={key:o.key};if(l==="mmkv.get"){if(typeof o.instanceId!=="string")return void 0;b.instanceId=o.instanceId}try{const m=await d(n,l,b);const f=m&&typeof m==="object"?m:void 0;if(f?.found===false)return void 0;const y=f?f.value:m;return{had:y!==void 0&&y!==null,value:y??void 0}}catch{return void 0}}async function Xo(t,n,o){if(t.action!=="setOverrideRuleEnabled"&&t.action!=="setOverridesEnabled"){return void 0}try{const d=await o("network","listOverrideRules",{});if(!d||typeof d!=="object")return void 0;if(t.action==="setOverridesEnabled"){return{had:true,value:String(d.enabled!==false)}}const l=(d.rules??[]).find(b=>b&&b.id===n.id);if(!l)return void 0;return{had:true,value:String(l.enabled!==false)}}catch{return void 0}}function Zo(){const t="abcdefghijklmnopqrstuvwxyz0123456789";let n="ask_";for(let o=0;o<20;o++)n+=t[Math.floor(Math.random()*t.length)];return n}
@@ -1,4 +1,4 @@
1
- "use strict";export function buildSystemPrompt(a){const{context:e,isRelease:n,readOnly:r,readOnlySource:s,requireApproval:i,approvalsBypassed:h,appName:d,platform:l,availableToolIds:c}=a;const t=[];t.push(`You are Ask Buoy, an assistant embedded inside ${d?`the ${d} app`:"a React Native app"} via Buoy devtools${l?` on ${l}`:""}.
1
+ "use strict";export function buildSystemPrompt(a){const{context:e,isRelease:n,readOnly:r,readOnlySource:s,requireApproval:i,approvalsBypassed:h,appName:d,platform:l,availableToolIds:c}=a;const t=[];t.push(`You are Ask Buoy, an assistant embedded inside ${d?`the ${d} app`:"this app"} via Buoy devtools${l?` on ${l}`:""}.
2
2
 
3
3
  The people who talk to you are usually NOT developers \u2014 QA testers, customer support, product managers. Write like you are talking to a smart colleague who does not read code. Never show raw JSON, stack traces, or internal ids unless they ask. Say what you found and what it means.
4
4
 
@@ -53,6 +53,12 @@ interface Base {
53
53
  export interface ChoiceBlock extends Base {
54
54
  kind: "choice";
55
55
  question: string;
56
+ /**
57
+ * The question is the last sentence of the answer right above the card, so
58
+ * the card does not print it again. Still kept in `question` for a chat
59
+ * restored from disk. Set by the ask gate (engine/askGate.ts).
60
+ */
61
+ questionInAnswer?: boolean;
56
62
  options: ChoiceOption[];
57
63
  /** Let the user type instead (default true — typing always works). */
58
64
  allowFreeText?: boolean;
@@ -2,10 +2,10 @@
2
2
  * GENERATED by scripts/gen-agent-catalog.mjs — do not edit.
3
3
  * Source: packages/agent-core/src/catalog/catalog.source.json
4
4
  *
5
- * 31 Buoy tools, 279 actions.
5
+ * 31 Buoy tools, 280 actions.
6
6
  */
7
7
  import type { ToolDescriptor } from "../types";
8
8
  export declare const CATALOG: ToolDescriptor[];
9
9
  export declare const CATALOG_TOOL_COUNT = 31;
10
- export declare const CATALOG_ACTION_COUNT = 279;
10
+ export declare const CATALOG_ACTION_COUNT = 280;
11
11
  //# sourceMappingURL=catalog.g.d.ts.map
@@ -5,7 +5,7 @@
5
5
  * The catalog's tool ids and action names as types, so a wrong name fails
6
6
  * at compile time. `catalog.g.ts` carries the data.
7
7
  *
8
- * 31 Buoy tools, 279 actions.
8
+ * 31 Buoy tools, 280 actions.
9
9
  */
10
10
  export type CatalogToolId = "env" | "console" | "sentry" | "jotai" | "route-events" | "debug-borders" | "zustand" | "redux" | "impersonate" | "query" | "events" | "network" | "js-top" | "app" | "time-machine" | "clock" | "lifecycle" | "location" | "permissions" | "storage" | "highlight-updates" | "scenarios" | "perf-monitor" | "assets" | "tv-remote" | "focus-inspector" | "images" | "ask-buoy" | "push-notifications" | "image-overlay" | "three";
11
11
  export interface CatalogActionMap {
@@ -29,7 +29,7 @@ export interface CatalogActionMap {
29
29
  "location": "getState" | "setLocation" | "startRoute" | "pauseRoute" | "resumeRoute" | "stopRoute" | "seekRoute" | "setSpeed" | "enterRegion" | "exitRegion" | "setConditions" | "setSignal" | "setServices" | "tune" | "useRealLocation" | "reset" | "updateSettings" | "clearLog";
30
30
  "permissions": "getState" | "setOverride" | "clearOverride" | "resetAll" | "requestReal" | "updateSettings" | "simulateReturnFromSettings" | "clearLog";
31
31
  "storage": "getSnapshot" | "getRequiredKeys" | "async.getAllKeys" | "async.multiGet" | "async.getItem" | "async.setItem" | "async.removeItem" | "async.multiRemove" | "async.multiSet" | "async.clear" | "clearAppStorage" | "getEventDetail" | "clearEvents" | "timeTravel.undo" | "timeTravel.jump" | "mmkv.snapshot" | "mmkv.get" | "mmkv.set" | "mmkv.remove" | "secure.keys" | "secure.snapshot" | "secure.get" | "secure.set" | "secure.delete";
32
- "highlight-updates": "describeScreen" | "tapElement" | "waitFor" | "beginMeasurement" | "endMeasurement" | "locateComponent" | "getRenderDetail" | "setEnabled" | "toggle" | "setSilentTracking" | "toggleFreeze" | "setSpotlight" | "clearRenderCounts" | "startTouchCapture" | "stopTouchCapture" | "clearTouchCapture" | "readTouchCapture";
32
+ "highlight-updates": "describeScreen" | "tapElement" | "waitFor" | "beginMeasurement" | "endMeasurement" | "locateComponent" | "getComponentSource" | "getRenderDetail" | "setEnabled" | "toggle" | "setSilentTracking" | "toggleFreeze" | "setSpotlight" | "clearRenderCounts" | "startTouchCapture" | "stopTouchCapture" | "clearTouchCapture" | "readTouchCapture";
33
33
  "scenarios": "listScenarios" | "getScenario" | "save" | "acceptDraft" | "discardDraft" | "preview" | "run" | "deactivate" | "delete" | "setFolder" | "listFolders" | "getActive" | "export";
34
34
  "perf-monitor": "setEnabled" | "startRecording" | "stopRecording" | "savePending" | "discardPending" | "mark" | "startAutomation" | "cancelAutomation" | "acknowledgeAutomation" | "refreshIndex" | "getAutomationConfig" | "setAutomationConfig" | "loadReport" | "deleteReport" | "deleteBatch" | "clearAll";
35
35
  "assets": "list" | "getDetail" | "rescan" | "measureSizes" | "saveBaseline" | "clearBaseline" | "getDiff" | "clearRecords" | "getScanStatus";