@buoy-gg/agent-core 7.0.40 → 7.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/lib/commonjs/blocks/receipts.js +1 -761
  2. package/lib/commonjs/blocks/runId.js +1 -31
  3. package/lib/commonjs/blocks/types.js +1 -140
  4. package/lib/commonjs/blocks/uiTool.js +6 -1405
  5. package/lib/commonjs/catalog/catalog.g.js +5 -4207
  6. package/lib/commonjs/catalog/catalog.source.json +656 -12
  7. package/lib/commonjs/catalog/catalog.types.g.js +1 -44
  8. package/lib/commonjs/catalog/normalizeParams.js +2 -332
  9. package/lib/commonjs/catalog/signature.js +1 -68
  10. package/lib/commonjs/catalog/snapshotReads.js +1 -263
  11. package/lib/commonjs/catalog/toProviderTools.js +2 -145
  12. package/lib/commonjs/catalog/validateParams.js +1 -129
  13. package/lib/commonjs/context/buildContextPack.js +1 -489
  14. package/lib/commonjs/effects/digest.js +1 -34
  15. package/lib/commonjs/effects/ledger.js +1 -325
  16. package/lib/commonjs/engine/askGate.js +1 -287
  17. package/lib/commonjs/engine/effectFor.js +1 -176
  18. package/lib/commonjs/engine/evidence.js +3 -111
  19. package/lib/commonjs/engine/historyBudget.js +1 -363
  20. package/lib/commonjs/engine/retrieve.js +1 -214
  21. package/lib/commonjs/engine/runAgentTurn.js +8 -1803
  22. package/lib/commonjs/engine/systemPrompt.js +54 -163
  23. package/lib/commonjs/engine/textToolCalls.js +1 -276
  24. package/lib/commonjs/engine/tokenCalibration.js +1 -81
  25. package/lib/commonjs/engine/verify.js +4 -297
  26. package/lib/commonjs/index.js +1 -384
  27. package/lib/commonjs/policy/labels.js +1 -319
  28. package/lib/commonjs/policy/policy.js +1 -148
  29. package/lib/commonjs/policy/redact.js +1 -172
  30. package/lib/commonjs/providers/anthropic.js +3 -445
  31. package/lib/commonjs/providers/openai.js +4 -324
  32. package/lib/commonjs/providers/problem.js +1 -98
  33. package/lib/commonjs/providers/sse.js +1 -240
  34. package/lib/commonjs/providers/streamTimer.js +1 -123
  35. package/lib/commonjs/providers/transport.js +1 -123
  36. package/lib/commonjs/providers/types.js +1 -6
  37. package/lib/commonjs/providers/xhrStream.js +1 -212
  38. package/lib/commonjs/realNow.js +1 -0
  39. package/lib/commonjs/session.js +1 -393
  40. package/lib/commonjs/types.js +0 -1
  41. package/lib/module/blocks/receipts.js +1 -755
  42. package/lib/module/blocks/runId.js +1 -26
  43. package/lib/module/blocks/types.js +1 -134
  44. package/lib/module/blocks/uiTool.js +6 -1396
  45. package/lib/module/catalog/catalog.g.js +5 -4203
  46. package/lib/module/catalog/catalog.source.json +656 -12
  47. package/lib/module/catalog/catalog.types.g.js +1 -40
  48. package/lib/module/catalog/normalizeParams.js +2 -326
  49. package/lib/module/catalog/signature.js +1 -63
  50. package/lib/module/catalog/snapshotReads.js +1 -259
  51. package/lib/module/catalog/toProviderTools.js +2 -139
  52. package/lib/module/catalog/validateParams.js +1 -124
  53. package/lib/module/context/buildContextPack.js +1 -485
  54. package/lib/module/effects/digest.js +1 -29
  55. package/lib/module/effects/ledger.js +1 -319
  56. package/lib/module/engine/askGate.js +1 -280
  57. package/lib/module/engine/effectFor.js +1 -173
  58. package/lib/module/engine/evidence.js +3 -105
  59. package/lib/module/engine/historyBudget.js +1 -355
  60. package/lib/module/engine/retrieve.js +1 -210
  61. package/lib/module/engine/runAgentTurn.js +8 -1794
  62. package/lib/module/engine/systemPrompt.js +54 -157
  63. package/lib/module/engine/textToolCalls.js +1 -270
  64. package/lib/module/engine/tokenCalibration.js +1 -75
  65. package/lib/module/engine/verify.js +4 -289
  66. package/lib/module/index.js +1 -35
  67. package/lib/module/policy/labels.js +1 -312
  68. package/lib/module/policy/policy.js +1 -142
  69. package/lib/module/policy/redact.js +1 -165
  70. package/lib/module/providers/anthropic.js +3 -441
  71. package/lib/module/providers/openai.js +4 -320
  72. package/lib/module/providers/problem.js +1 -92
  73. package/lib/module/providers/sse.js +1 -231
  74. package/lib/module/providers/streamTimer.js +1 -118
  75. package/lib/module/providers/transport.js +1 -119
  76. package/lib/module/providers/types.js +1 -4
  77. package/lib/module/providers/xhrStream.js +1 -207
  78. package/lib/module/realNow.js +1 -0
  79. package/lib/module/session.js +1 -369
  80. package/lib/module/types.js +0 -1
  81. package/lib/typescript/catalog/catalog.g.d.ts +3 -3
  82. package/lib/typescript/catalog/catalog.types.g.d.ts +7 -4
  83. package/lib/typescript/effects/ledger.d.ts +16 -1
  84. package/lib/typescript/providers/problem.d.ts +0 -20
  85. package/lib/typescript/providers/streamTimer.d.ts +0 -24
  86. package/lib/typescript/realNow.d.ts +18 -0
  87. package/lib/web/index.mjs +152 -0
  88. package/package.json +24 -3
  89. package/lib/commonjs/blocks/receipts.js.map +0 -1
  90. package/lib/commonjs/blocks/runId.js.map +0 -1
  91. package/lib/commonjs/blocks/types.js.map +0 -1
  92. package/lib/commonjs/blocks/uiTool.js.map +0 -1
  93. package/lib/commonjs/catalog/catalog.g.js.map +0 -1
  94. package/lib/commonjs/catalog/catalog.types.g.js.map +0 -1
  95. package/lib/commonjs/catalog/normalizeParams.js.map +0 -1
  96. package/lib/commonjs/catalog/signature.js.map +0 -1
  97. package/lib/commonjs/catalog/snapshotReads.js.map +0 -1
  98. package/lib/commonjs/catalog/toProviderTools.js.map +0 -1
  99. package/lib/commonjs/catalog/validateParams.js.map +0 -1
  100. package/lib/commonjs/context/buildContextPack.js.map +0 -1
  101. package/lib/commonjs/effects/digest.js.map +0 -1
  102. package/lib/commonjs/effects/ledger.js.map +0 -1
  103. package/lib/commonjs/engine/askGate.js.map +0 -1
  104. package/lib/commonjs/engine/effectFor.js.map +0 -1
  105. package/lib/commonjs/engine/evidence.js.map +0 -1
  106. package/lib/commonjs/engine/historyBudget.js.map +0 -1
  107. package/lib/commonjs/engine/retrieve.js.map +0 -1
  108. package/lib/commonjs/engine/runAgentTurn.js.map +0 -1
  109. package/lib/commonjs/engine/systemPrompt.js.map +0 -1
  110. package/lib/commonjs/engine/textToolCalls.js.map +0 -1
  111. package/lib/commonjs/engine/tokenCalibration.js.map +0 -1
  112. package/lib/commonjs/engine/verify.js.map +0 -1
  113. package/lib/commonjs/index.js.map +0 -1
  114. package/lib/commonjs/policy/labels.js.map +0 -1
  115. package/lib/commonjs/policy/policy.js.map +0 -1
  116. package/lib/commonjs/policy/redact.js.map +0 -1
  117. package/lib/commonjs/providers/anthropic.js.map +0 -1
  118. package/lib/commonjs/providers/openai.js.map +0 -1
  119. package/lib/commonjs/providers/problem.js.map +0 -1
  120. package/lib/commonjs/providers/sse.js.map +0 -1
  121. package/lib/commonjs/providers/streamTimer.js.map +0 -1
  122. package/lib/commonjs/providers/transport.js.map +0 -1
  123. package/lib/commonjs/providers/types.js.map +0 -1
  124. package/lib/commonjs/providers/xhrStream.js.map +0 -1
  125. package/lib/commonjs/session.js.map +0 -1
  126. package/lib/commonjs/types.js.map +0 -1
  127. package/lib/module/blocks/receipts.js.map +0 -1
  128. package/lib/module/blocks/runId.js.map +0 -1
  129. package/lib/module/blocks/types.js.map +0 -1
  130. package/lib/module/blocks/uiTool.js.map +0 -1
  131. package/lib/module/catalog/catalog.g.js.map +0 -1
  132. package/lib/module/catalog/catalog.types.g.js.map +0 -1
  133. package/lib/module/catalog/normalizeParams.js.map +0 -1
  134. package/lib/module/catalog/signature.js.map +0 -1
  135. package/lib/module/catalog/snapshotReads.js.map +0 -1
  136. package/lib/module/catalog/toProviderTools.js.map +0 -1
  137. package/lib/module/catalog/validateParams.js.map +0 -1
  138. package/lib/module/context/buildContextPack.js.map +0 -1
  139. package/lib/module/effects/digest.js.map +0 -1
  140. package/lib/module/effects/ledger.js.map +0 -1
  141. package/lib/module/engine/askGate.js.map +0 -1
  142. package/lib/module/engine/effectFor.js.map +0 -1
  143. package/lib/module/engine/evidence.js.map +0 -1
  144. package/lib/module/engine/historyBudget.js.map +0 -1
  145. package/lib/module/engine/retrieve.js.map +0 -1
  146. package/lib/module/engine/runAgentTurn.js.map +0 -1
  147. package/lib/module/engine/systemPrompt.js.map +0 -1
  148. package/lib/module/engine/textToolCalls.js.map +0 -1
  149. package/lib/module/engine/tokenCalibration.js.map +0 -1
  150. package/lib/module/engine/verify.js.map +0 -1
  151. package/lib/module/index.js.map +0 -1
  152. package/lib/module/policy/labels.js.map +0 -1
  153. package/lib/module/policy/policy.js.map +0 -1
  154. package/lib/module/policy/redact.js.map +0 -1
  155. package/lib/module/providers/anthropic.js.map +0 -1
  156. package/lib/module/providers/openai.js.map +0 -1
  157. package/lib/module/providers/problem.js.map +0 -1
  158. package/lib/module/providers/sse.js.map +0 -1
  159. package/lib/module/providers/streamTimer.js.map +0 -1
  160. package/lib/module/providers/transport.js.map +0 -1
  161. package/lib/module/providers/types.js.map +0 -1
  162. package/lib/module/providers/xhrStream.js.map +0 -1
  163. package/lib/module/session.js.map +0 -1
  164. package/lib/module/types.js.map +0 -1
  165. package/lib/typescript/blocks/receipts.d.ts.map +0 -1
  166. package/lib/typescript/blocks/runId.d.ts.map +0 -1
  167. package/lib/typescript/blocks/types.d.ts.map +0 -1
  168. package/lib/typescript/blocks/uiTool.d.ts.map +0 -1
  169. package/lib/typescript/catalog/catalog.g.d.ts.map +0 -1
  170. package/lib/typescript/catalog/catalog.types.g.d.ts.map +0 -1
  171. package/lib/typescript/catalog/normalizeParams.d.ts.map +0 -1
  172. package/lib/typescript/catalog/signature.d.ts.map +0 -1
  173. package/lib/typescript/catalog/snapshotReads.d.ts.map +0 -1
  174. package/lib/typescript/catalog/toProviderTools.d.ts.map +0 -1
  175. package/lib/typescript/catalog/validateParams.d.ts.map +0 -1
  176. package/lib/typescript/context/buildContextPack.d.ts.map +0 -1
  177. package/lib/typescript/effects/digest.d.ts.map +0 -1
  178. package/lib/typescript/effects/ledger.d.ts.map +0 -1
  179. package/lib/typescript/engine/askGate.d.ts.map +0 -1
  180. package/lib/typescript/engine/effectFor.d.ts.map +0 -1
  181. package/lib/typescript/engine/evidence.d.ts.map +0 -1
  182. package/lib/typescript/engine/historyBudget.d.ts.map +0 -1
  183. package/lib/typescript/engine/retrieve.d.ts.map +0 -1
  184. package/lib/typescript/engine/runAgentTurn.d.ts.map +0 -1
  185. package/lib/typescript/engine/systemPrompt.d.ts.map +0 -1
  186. package/lib/typescript/engine/textToolCalls.d.ts.map +0 -1
  187. package/lib/typescript/engine/tokenCalibration.d.ts.map +0 -1
  188. package/lib/typescript/engine/verify.d.ts.map +0 -1
  189. package/lib/typescript/index.d.ts.map +0 -1
  190. package/lib/typescript/policy/labels.d.ts.map +0 -1
  191. package/lib/typescript/policy/policy.d.ts.map +0 -1
  192. package/lib/typescript/policy/redact.d.ts.map +0 -1
  193. package/lib/typescript/providers/anthropic.d.ts.map +0 -1
  194. package/lib/typescript/providers/openai.d.ts.map +0 -1
  195. package/lib/typescript/providers/problem.d.ts.map +0 -1
  196. package/lib/typescript/providers/sse.d.ts.map +0 -1
  197. package/lib/typescript/providers/streamTimer.d.ts.map +0 -1
  198. package/lib/typescript/providers/transport.d.ts.map +0 -1
  199. package/lib/typescript/providers/types.d.ts.map +0 -1
  200. package/lib/typescript/providers/xhrStream.d.ts.map +0 -1
  201. package/lib/typescript/session.d.ts.map +0 -1
  202. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,319 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.humanise = humanise;
7
- exports.titleCall = titleCall;
8
- exports.toolTitle = toolTitle;
9
- var _catalog = require("../catalog/catalog.g");
10
- /**
11
- * Human titles for tool calls.
12
- *
13
- * The catalog's `summary` field is written FOR THE MODEL — "Navigate the
14
- * device to a concrete path (pushes by default; replace:true swaps the
15
- * current screen)". Shown to a QA person in a 300pt-wide chat row it was
16
- * truncated to "Navigate the device to a concrete path (pushes by default;
17
- * replace:tru…", which is the worst of both worlds: too long to fit and too
18
- * technical to help. The transcript, the changes bar and the approval card
19
- * all render THIS layer instead: a short present-tense sentence with the one
20
- * or two parameters a person would recognise ("Open /bag", "Update the cart
21
- * store"), and the catalog sentence is kept alongside as the expandable
22
- * "what this does" detail.
23
- *
24
- * Phrases are keyed `toolId.action`. `{a|b.c}` interpolates the first defined
25
- * string/number among those parameter paths; a placeholder that resolves to
26
- * nothing disappears with its surrounding space. Anything not phrased here
27
- * falls back to the humanised action name plus the tool title, which is
28
- * still short and still honest — never the model-facing paragraph.
29
- */
30
-
31
- const PHRASES = {
32
- // Routes
33
- "route-events.getSnapshot": "Check which screen is open",
34
- "route-events.getCurrentRoute": "Check the current screen",
35
- "route-events.navigate": "Open {path}",
36
- "route-events.stackGoBack": "Go back one screen",
37
- "route-events.stackNavigateToIndex": "Jump to screen {index} in the stack",
38
- "route-events.stackPopToIndex": "Go back to screen {index}",
39
- "route-events.stackPopToTop": "Go back to the first screen",
40
- // State stores
41
- "zustand.listStores": "List the app's stores",
42
- "zustand.getStoreState": "Read the {storeName} store",
43
- "zustand.getChangeDetail": "Inspect a store change",
44
- "zustand.setState": "Update the {storeName} store",
45
- "zustand.rehydrate": "Reload the {storeName} store from disk",
46
- "redux.getState": "Read the Redux state",
47
- "redux.getActionDetail": "Inspect a Redux action",
48
- "redux.dispatch": "Dispatch {action.type}",
49
- "jotai.listAtoms": "List the app's atoms",
50
- "jotai.getAtomValue": "Read atom {label}",
51
- "jotai.getChangeDetail": "Inspect an atom change",
52
- "jotai.setAtom": "Set atom {label}",
53
- // React Query
54
- "query.listQueries": "List cached queries",
55
- "query.getQueryData": "Read cached data for {queryHash}",
56
- "query.refetch": "Refetch {queryHash}",
57
- "query.invalidate": "Refresh {queryHash}",
58
- "query.reset": "Reset {queryHash}",
59
- "query.remove": "Drop {queryHash} from the cache",
60
- "query.setQueryData": "Replace cached data for {queryHash|queryKey}",
61
- "query.triggerError": "Force {queryHash} into an error",
62
- "query.restoreError": "Clear the forced error on {queryHash}",
63
- "query.triggerLoading": "Force {queryHash} to keep loading",
64
- "query.restoreLoading": "Clear the forced loading on {queryHash}",
65
- "query.clearQueryCache": "Clear the query cache",
66
- "query.clearMutationCache": "Clear the mutation cache",
67
- // Network
68
- "network.getSnapshot": "Read recent network requests",
69
- "network.getCaptureStatus": "Check network capture",
70
- "network.getEventBody": "Read a request's body",
71
- "network.setPinned": "Pin a request",
72
- "network.setSaved": "Save a request",
73
- "network.removeSavedRecord": "Remove saved request {key}",
74
- "network.clearSavedRequests": "Clear saved requests",
75
- "network.clearPinnedRequests": "Clear pinned requests",
76
- "network.listOverrideRules": "List network overrides",
77
- "network.getOverrideRuleBody": "Read a network override",
78
- "network.debugOverrides": "Check overrides for {url}",
79
- "network.upsertOverrideRule": "Add a network override",
80
- "network.deleteOverrideRule": "Delete a network override",
81
- "network.clearOverrideRules": "Clear all network overrides",
82
- // Storage
83
- "storage.async.getAllKeys": "List saved storage keys",
84
- "storage.async.multiGet": "Read saved values",
85
- "storage.async.getItem": "Read saved value {key}",
86
- "storage.async.setItem": "Save {key}",
87
- "storage.async.removeItem": "Delete saved value {key}",
88
- "storage.async.multiRemove": "Delete saved values",
89
- "storage.async.multiSet": "Save several values",
90
- // These two MUST read differently. They were both "Clear all saved app data",
91
- // and the difference is the whole point: `async.clear` also wipes Buoy's own
92
- // devtool settings, `clearAppStorage` preserves them. A user approving the
93
- // shared wording had no way to tell which one they were about to get.
94
- "storage.async.clear": "Clear ALL saved data — including Buoy's own settings",
95
- "storage.clearAppStorage": "Clear the app's saved data (keeps Buoy's settings)",
96
- "storage.getEventDetail": "Inspect a storage change",
97
- "storage.timeTravel.undo": "Undo a storage change",
98
- "storage.timeTravel.jump": "Rewind storage to an earlier point",
99
- "storage.mmkv.snapshot": "Read MMKV storage",
100
- "storage.mmkv.get": "Read {key} from MMKV",
101
- "storage.mmkv.set": "Save {key} to MMKV",
102
- "storage.mmkv.remove": "Delete {key} from MMKV",
103
- "storage.secure.keys": "List secure storage keys",
104
- "storage.secure.snapshot": "Read secure storage",
105
- "storage.secure.get": "Read secure value {key}",
106
- "storage.secure.set": "Save secure value {key}",
107
- "storage.secure.delete": "Delete secure value {key}",
108
- // Console / env / events
109
- "console.getSnapshot": "Read recent console logs",
110
- "console.clearEntries": "Clear the console",
111
- "env.getSnapshot": "Read environment variables",
112
- "events.exportEvents": "Export recent events",
113
- "events.setEnabledSources": "Change which events are recorded",
114
- "sentry.getSnapshot": "Read what's been sent to Sentry",
115
- "sentry.clearEnvelopes": "Clear captured Sentry traffic",
116
- // Ask Buoy's own session
117
- "ask-buoy.listChanges": "List Ask Buoy's changes",
118
- "ask-buoy.undoAll": "Undo everything Ask Buoy changed",
119
- // Screen
120
- "highlight-updates.describeScreen": "Look at what's on screen",
121
- "highlight-updates.tapElement": "Tap {query|testID|text}",
122
- "highlight-updates.waitFor": "Wait for {query|testID}",
123
- "highlight-updates.locateComponent": "Find {query} on screen",
124
- "highlight-updates.getRenderDetail": "Inspect a component's renders",
125
- "highlight-updates.beginMeasurement": "Start counting renders",
126
- "highlight-updates.endMeasurement": "Stop counting renders",
127
- "highlight-updates.clearRenderCounts": "Clear render counts",
128
- "debug-borders.cycleMode": "Cycle debug borders",
129
- "debug-borders.setMode": "Set debug borders to {mode}",
130
- // Impersonate
131
- "impersonate.searchUsers": "Search users for {query}",
132
- "impersonate.startImpersonation": "Impersonate {user.name|user.email|user.id}",
133
- "impersonate.stopImpersonation": "Stop impersonating",
134
- "impersonate.pauseImpersonation": "Pause impersonation",
135
- "impersonate.resumeImpersonation": "Resume impersonation",
136
- "impersonate.clearHistory": "Clear impersonation history",
137
- // App / time machine / scenarios / perf
138
- "app.ping": "Check the app is responding",
139
- "app.reloadApp": "Reload the app",
140
- "time-machine.list": "List saved snapshots",
141
- "time-machine.capture": "Save a snapshot {name}",
142
- "time-machine.captureBaseline": "Save a baseline snapshot",
143
- "time-machine.restore": "Restore snapshot {id}",
144
- "time-machine.preview": "Preview snapshot {id}",
145
- "time-machine.inspect": "Inspect snapshot {id}",
146
- "time-machine.delete": "Delete snapshot {id}",
147
- "time-machine.rename": "Rename a snapshot to {name}",
148
- "time-machine.duplicate": "Duplicate snapshot {id}",
149
- // NOT "delete every snapshot" — that is `time-machine.delete`, and this card
150
- // said so for months. `wipeAll` clears EVERY registered state source to
151
- // fresh-install and reloads the app (timeMachineStore.ts:639); no snapshot is
152
- // involved and there is no undo. The approval card is the last thing standing
153
- // between a user and that, so it has to name the real blast radius.
154
- "time-machine.wipeAll": "Wipe ALL app state to fresh install and reload",
155
- "scenarios.listScenarios": "List scenarios",
156
- "scenarios.getScenario": "Read scenario {id}",
157
- "scenarios.run": "Run scenario {id}",
158
- "scenarios.preview": "Preview scenario {id}",
159
- "scenarios.deactivate": "Stop the active scenario",
160
- "scenarios.delete": "Delete scenario {id}",
161
- "perf-monitor.startRecording": "Start recording performance",
162
- "perf-monitor.stopRecording": "Stop recording performance",
163
- "perf-monitor.mark": "Mark {label} on the timeline",
164
- "perf-monitor.loadReport": "Load a performance report",
165
- "perf-monitor.clearAll": "Clear all performance reports",
166
- "js-top.sample": "Sample the JS thread",
167
- "js-top.getOriginDetail": "Inspect {key} on the JS thread",
168
- // Assets / images
169
- "assets.list": "List bundled assets",
170
- "assets.getDetail": "Inspect an asset",
171
- "assets.rescan": "Rescan bundled assets",
172
- "assets.measureSizes": "Measure asset sizes",
173
- "images.list": "List loaded images",
174
- "images.getDetail": "Inspect an image",
175
- "images.getCaptureStatus": "Check image capture",
176
- "images.retry": "Retry loading an image",
177
- "images.flash": "Flash an image on screen",
178
- "images.setNetworkMode": "Set image network mode to {mode}",
179
- "images.clearExpoCaches": "Clear the image caches",
180
- // TV
181
- "tv-remote.arm": "Start capturing remote presses",
182
- "tv-remote.disarm": "Stop capturing remote presses",
183
- "focus-inspector.rescan": "Rescan focusable elements",
184
- "focus-inspector.focusElement": "Move focus to an element"
185
- };
186
-
187
- /** Boolean-switch actions read better as two sentences than one template. */
188
- const SWITCHES = {
189
- "query.setOnline": {
190
- param: "online",
191
- on: "Put the app back online",
192
- off: "Take the app offline"
193
- },
194
- "network.setOverridesEnabled": {
195
- param: "enabled",
196
- on: "Turn network overrides on",
197
- off: "Turn network overrides off"
198
- },
199
- "network.setOverrideRuleEnabled": {
200
- param: "enabled",
201
- on: "Enable a network override",
202
- off: "Disable a network override"
203
- },
204
- "highlight-updates.setEnabled": {
205
- param: "enabled",
206
- on: "Turn render highlighting on",
207
- off: "Turn render highlighting off"
208
- },
209
- "perf-monitor.setEnabled": {
210
- param: "enabled",
211
- on: "Turn the perf monitor on",
212
- off: "Turn the perf monitor off"
213
- },
214
- "js-top.setEnabled": {
215
- param: "enabled",
216
- on: "Turn JS Top on",
217
- off: "Turn JS Top off"
218
- },
219
- "images.setBlankImages": {
220
- param: "enabled",
221
- on: "Blank out every image",
222
- off: "Show images again"
223
- },
224
- "focus-inspector.setTracking": {
225
- param: "enabled",
226
- on: "Start tracking focus",
227
- off: "Stop tracking focus"
228
- },
229
- "highlight-updates.setSilentTracking": {
230
- param: "enabled",
231
- on: "Track renders silently",
232
- off: "Stop silent render tracking"
233
- }
234
- };
235
- const TOOL_TITLES = Object.fromEntries(_catalog.CATALOG.map(t => [t.toolId, cleanTitle(t.title)]));
236
-
237
- /** "JS TOP (JS-thread task manager)" → "JS Top"; everything else as-is. */
238
- function cleanTitle(title) {
239
- const base = title.replace(/\s*\(.*\)\s*$/, "").trim();
240
- if (base !== base.toUpperCase() || base.length <= 3) return base;
241
- return base.split(" ").map(w => w.length <= 2 ? w : w.charAt(0) + w.slice(1).toLowerCase()).join(" ");
242
- }
243
-
244
- /** The display name of a tool: "Routes", "Zustand", "React Query". */
245
- function toolTitle(toolId) {
246
- return TOOL_TITLES[toolId] ?? humanise(toolId);
247
- }
248
- const MAX_VALUE = 48;
249
- function readPath(params, path) {
250
- let cur = params;
251
- for (const seg of path.split(".")) {
252
- if (!cur || typeof cur !== "object") return undefined;
253
- cur = cur[seg];
254
- }
255
- if (typeof cur === "string" && cur.trim()) return truncate(cur.trim());
256
- if (typeof cur === "number") return String(cur);
257
- // A query key is an array — `["pokemon","pikachu","fetch"]` — and the ledger
258
- // row for the product's headline write read "Replace cached data for" with
259
- // nothing after it. Primitive arrays render as a path; anything else stays
260
- // out of a label.
261
- if (Array.isArray(cur) && cur.length > 0 && cur.every(v => typeof v === "string" || typeof v === "number")) {
262
- return truncate(cur.map(String).join(" / "));
263
- }
264
- return undefined;
265
- }
266
- function truncate(value) {
267
- return value.length > MAX_VALUE ? `${value.slice(0, MAX_VALUE - 1)}…` : value;
268
- }
269
- function fill(template, params) {
270
- return template.replace(/\{([^}]+)\}/g, (_, spec) => {
271
- for (const path of spec.split("|")) {
272
- const v = readPath(params, path.trim());
273
- if (v !== undefined) return v;
274
- }
275
- return "";
276
- }).replace(/\s{2,}/g, " ").trim();
277
- }
278
-
279
- /** `getStoreState` → "Get store state"; `async.getItem` → "Get item". */
280
- function humanise(action) {
281
- const last = action.split(".").pop() ?? action;
282
- const words = last.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").toLowerCase();
283
- return words.charAt(0).toUpperCase() + words.slice(1);
284
- }
285
-
286
- /** The one or two parameters a person would recognise in a fallback title. */
287
- function notableParams(params) {
288
- const parts = [];
289
- for (const key of ["key", "id", "url", "name", "route", "path", "userId", "storeId", "type"]) {
290
- const v = readPath(params, key);
291
- if (v !== undefined) parts.push(v);
292
- if (parts.length >= 2) break;
293
- }
294
- return parts.join(", ");
295
- }
296
-
297
- /**
298
- * A short, present-tense title for a call — the thing a transcript row, a
299
- * ledger row and an approval card all show first.
300
- */
301
- function titleCall(toolId, action, params) {
302
- const key = `${toolId}.${action}`;
303
- const sw = SWITCHES[key];
304
- if (sw) return params[sw.param] === false ? sw.off : sw.on;
305
- const phrase = PHRASES[key];
306
- if (phrase) {
307
- const out = fill(phrase, params);
308
- if (out) return out;
309
- }
310
-
311
- // Generic verbs the whole suite shares.
312
- const leaf = action.split(".").pop() ?? action;
313
- if (leaf === "clearEvents") return `Clear the ${toolTitle(toolId)} timeline`;
314
- if (leaf === "getSnapshot") return `Read ${toolTitle(toolId)}`;
315
- const detail = notableParams(params);
316
- const base = `${humanise(action)} in ${toolTitle(toolId)}`;
317
- return detail ? `${base} (${detail})` : base;
318
- }
319
- //# sourceMappingURL=labels.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.humanise=humanise;exports.titleCall=titleCall;exports.toolTitle=toolTitle;var _catalog=require("../catalog/catalog.g");const PHRASES={"route-events.getSnapshot":"Check which screen is open","route-events.getCurrentRoute":"Check the current screen","route-events.navigate":"Open {path}","route-events.stackGoBack":"Go back one screen","route-events.stackNavigateToIndex":"Jump to screen {index} in the stack","route-events.stackPopToIndex":"Go back to screen {index}","route-events.stackPopToTop":"Go back to the first screen","zustand.listStores":"List the app's stores","zustand.getStoreState":"Read the {storeName} store","zustand.getChangeDetail":"Inspect a store change","zustand.setState":"Update the {storeName} store","zustand.rehydrate":"Reload the {storeName} store from disk","redux.getState":"Read the Redux state","redux.getActionDetail":"Inspect a Redux action","redux.dispatch":"Dispatch {action.type}","jotai.listAtoms":"List the app's atoms","jotai.getAtomValue":"Read atom {label}","jotai.getChangeDetail":"Inspect an atom change","jotai.setAtom":"Set atom {label}","query.listQueries":"List cached queries","query.getQueryData":"Read cached data for {queryHash}","query.refetch":"Refetch {queryHash}","query.invalidate":"Refresh {queryHash}","query.reset":"Reset {queryHash}","query.remove":"Drop {queryHash} from the cache","query.setQueryData":"Replace cached data for {queryHash|queryKey}","query.triggerError":"Force {queryHash} into an error","query.restoreError":"Clear the forced error on {queryHash}","query.triggerLoading":"Force {queryHash} to keep loading","query.restoreLoading":"Clear the forced loading on {queryHash}","query.clearQueryCache":"Clear the query cache","query.clearMutationCache":"Clear the mutation cache","network.getSnapshot":"Read recent network requests","network.getCaptureStatus":"Check network capture","network.getEventBody":"Read a request's body","network.setPinned":"Pin a request","network.setSaved":"Save a request","network.removeSavedRecord":"Remove saved request {key}","network.clearSavedRequests":"Clear saved requests","network.clearPinnedRequests":"Clear pinned requests","network.listOverrideRules":"List network overrides","network.getOverrideRuleBody":"Read a network override","network.debugOverrides":"Check overrides for {url}","network.upsertOverrideRule":"Add a network override","network.deleteOverrideRule":"Delete a network override","network.clearOverrideRules":"Clear all network overrides","storage.async.getAllKeys":"List saved storage keys","storage.async.multiGet":"Read saved values","storage.async.getItem":"Read saved value {key}","storage.async.setItem":"Save {key}","storage.async.removeItem":"Delete saved value {key}","storage.async.multiRemove":"Delete saved values","storage.async.multiSet":"Save several values","storage.async.clear":"Clear ALL saved data \u2014 including Buoy's own settings","storage.clearAppStorage":"Clear the app's saved data (keeps Buoy's settings)","storage.getEventDetail":"Inspect a storage change","storage.timeTravel.undo":"Undo a storage change","storage.timeTravel.jump":"Rewind storage to an earlier point","storage.mmkv.snapshot":"Read MMKV storage","storage.mmkv.get":"Read {key} from MMKV","storage.mmkv.set":"Save {key} to MMKV","storage.mmkv.remove":"Delete {key} from MMKV","storage.secure.keys":"List secure storage keys","storage.secure.snapshot":"Read secure storage","storage.secure.get":"Read secure value {key}","storage.secure.set":"Save secure value {key}","storage.secure.delete":"Delete secure value {key}","console.getSnapshot":"Read recent console logs","console.clearEntries":"Clear the console","env.getSnapshot":"Read environment variables","events.exportEvents":"Export recent events","events.setEnabledSources":"Change which events are recorded","sentry.getSnapshot":"Read what's been sent to Sentry","sentry.clearEnvelopes":"Clear captured Sentry traffic","ask-buoy.listChanges":"List Ask Buoy's changes","ask-buoy.undoAll":"Undo everything Ask Buoy changed","highlight-updates.describeScreen":"Look at what's on screen","highlight-updates.tapElement":"Tap {query|testID|text}","highlight-updates.waitFor":"Wait for {query|testID}","highlight-updates.locateComponent":"Find {query} on screen","highlight-updates.getRenderDetail":"Inspect a component's renders","highlight-updates.beginMeasurement":"Start counting renders","highlight-updates.endMeasurement":"Stop counting renders","highlight-updates.clearRenderCounts":"Clear render counts","debug-borders.cycleMode":"Cycle debug borders","debug-borders.setMode":"Set debug borders to {mode}","impersonate.searchUsers":"Search users for {query}","impersonate.startImpersonation":"Impersonate {user.name|user.email|user.id}","impersonate.stopImpersonation":"Stop impersonating","impersonate.pauseImpersonation":"Pause impersonation","impersonate.resumeImpersonation":"Resume impersonation","impersonate.clearHistory":"Clear impersonation history","app.ping":"Check the app is responding","app.reloadApp":"Reload the app","time-machine.list":"List saved snapshots","time-machine.capture":"Save a snapshot {name}","time-machine.captureBaseline":"Save a baseline snapshot","time-machine.restore":"Restore snapshot {id}","time-machine.preview":"Preview snapshot {id}","time-machine.inspect":"Inspect snapshot {id}","time-machine.delete":"Delete snapshot {id}","time-machine.rename":"Rename a snapshot to {name}","time-machine.duplicate":"Duplicate snapshot {id}","time-machine.wipeAll":"Wipe ALL app state to fresh install and reload","scenarios.listScenarios":"List scenarios","scenarios.getScenario":"Read scenario {id}","scenarios.run":"Run scenario {id}","scenarios.preview":"Preview scenario {id}","scenarios.deactivate":"Stop the active scenario","scenarios.delete":"Delete scenario {id}","perf-monitor.startRecording":"Start recording performance","perf-monitor.stopRecording":"Stop recording performance","perf-monitor.mark":"Mark {label} on the timeline","perf-monitor.loadReport":"Load a performance report","perf-monitor.clearAll":"Clear all performance reports","js-top.sample":"Sample the JS thread","js-top.getOriginDetail":"Inspect {key} on the JS thread","assets.list":"List bundled assets","assets.getDetail":"Inspect an asset","assets.rescan":"Rescan bundled assets","assets.measureSizes":"Measure asset sizes","images.list":"List loaded images","images.getDetail":"Inspect an image","images.getCaptureStatus":"Check image capture","images.retry":"Retry loading an image","images.flash":"Flash an image on screen","images.setNetworkMode":"Set image network mode to {mode}","images.clearExpoCaches":"Clear the image caches","tv-remote.arm":"Start capturing remote presses","tv-remote.disarm":"Stop capturing remote presses","focus-inspector.rescan":"Rescan focusable elements","focus-inspector.focusElement":"Move focus to an element"};const SWITCHES={"query.setOnline":{param:"online",on:"Put the app back online",off:"Take the app offline"},"network.setOverridesEnabled":{param:"enabled",on:"Turn network overrides on",off:"Turn network overrides off"},"network.setOverrideRuleEnabled":{param:"enabled",on:"Enable a network override",off:"Disable a network override"},"highlight-updates.setEnabled":{param:"enabled",on:"Turn render highlighting on",off:"Turn render highlighting off"},"perf-monitor.setEnabled":{param:"enabled",on:"Turn the perf monitor on",off:"Turn the perf monitor off"},"js-top.setEnabled":{param:"enabled",on:"Turn JS Top on",off:"Turn JS Top off"},"images.setBlankImages":{param:"enabled",on:"Blank out every image",off:"Show images again"},"focus-inspector.setTracking":{param:"enabled",on:"Start tracking focus",off:"Stop tracking focus"},"highlight-updates.setSilentTracking":{param:"enabled",on:"Track renders silently",off:"Stop silent render tracking"}};const TOOL_TITLES=Object.fromEntries(_catalog.CATALOG.map(t=>[t.toolId,cleanTitle(t.title)]));function cleanTitle(t){const r=t.replace(/\s*\(.*\)\s*$/,"").trim();if(r!==r.toUpperCase()||r.length<=3)return r;return r.split(" ").map(e=>e.length<=2?e:e.charAt(0)+e.slice(1).toLowerCase()).join(" ")}function toolTitle(t){return TOOL_TITLES[t]??humanise(t)}const MAX_VALUE=48;function readPath(t,r){let e=t;for(const a of r.split(".")){if(!e||typeof e!=="object")return void 0;e=e[a]}if(typeof e==="string"&&e.trim())return truncate(e.trim());if(typeof e==="number")return String(e);if(Array.isArray(e)&&e.length>0&&e.every(a=>typeof a==="string"||typeof a==="number")){return truncate(e.map(String).join(" / "))}return void 0}function truncate(t){return t.length>MAX_VALUE?`${t.slice(0,MAX_VALUE-1)}\u2026`:t}function fill(t,r){return t.replace(/\{([^}]+)\}/g,(e,a)=>{for(const s of a.split("|")){const n=readPath(r,s.trim());if(n!==void 0)return n}return""}).replace(/\s{2,}/g," ").trim()}function humanise(t){const r=t.split(".").pop()??t;const e=r.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").toLowerCase();return e.charAt(0).toUpperCase()+e.slice(1)}function notableParams(t){const r=[];for(const e of["key","id","url","name","route","path","userId","storeId","type"]){const a=readPath(t,e);if(a!==void 0)r.push(a);if(r.length>=2)break}return r.join(", ")}function titleCall(t,r,e){const a=`${t}.${r}`;const s=SWITCHES[a];if(s)return e[s.param]===false?s.off:s.on;const n=PHRASES[a];if(n){const l=fill(n,e);if(l)return l}const o=r.split(".").pop()??r;if(o==="clearEvents")return`Clear the ${toolTitle(t)} timeline`;if(o==="getSnapshot")return`Read ${toolTitle(t)}`;const i=notableParams(e);const c=`${humanise(r)} in ${toolTitle(t)}`;return i?`${c} (${i})`:c}
@@ -1,148 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.DEFAULT_REQUIRE_APPROVAL = void 0;
7
- exports.decide = decide;
8
- exports.describeCall = describeCall;
9
- exports.resolveRequireApproval = resolveRequireApproval;
10
- var _labels = require("./labels");
11
- /**
12
- * What the agent is allowed to do, decided before dispatch.
13
- *
14
- * The default: reads and writes auto-run — the banner plus the effect ledger
15
- * keep the user in control — but DESTRUCTIVE actions need a human tap unless
16
- * the app explicitly passes `requireApproval: []`. Auto-running wipes proved
17
- * too sharp in live evals (five destructive calls in one confused turn), and
18
- * the approval gate is also the blast-radius control if injected text in a
19
- * tool result ever steers the model.
20
- *
21
- * The one thing the policy layer will not do is let the agent report success
22
- * for an action that cannot work in this build. Several Buoy actions return
23
- * `{ok:true}` and do nothing once `__DEV__` is false — `upsertOverrideRule`
24
- * persists a rule the engine never consults — and a QA tester who files a bug
25
- * against data that was never applied is a worse outcome than no agent at all.
26
- * So `release !== "works"` is refused BEFORE dispatch, with the reason handed
27
- * back to the model as the tool result, and `unknown` fails closed.
28
- */
29
-
30
- /**
31
- * One allow rule. A call is permitted when it matches ANY rule; every field a
32
- * rule specifies must match. So a support seat that may impersonate and look
33
- * at anything, and nothing else, is two rules:
34
- *
35
- * allow: [{ effect: "read" }, { toolId: "impersonate" }]
36
- */
37
-
38
- /** The one place the approval default lives; `decide` and the system prompt both resolve through it. */
39
- const DEFAULT_REQUIRE_APPROVAL = exports.DEFAULT_REQUIRE_APPROVAL = ["destructive"];
40
- function resolveRequireApproval(policy) {
41
- return policy.requireApproval ?? DEFAULT_REQUIRE_APPROVAL;
42
- }
43
- /** SecureStore VALUE reads — gated behind `policy.secureReads`. Names stay open. */
44
- const SECURE_VALUE_READS = new Set(["secure.get", "secure.snapshot"]);
45
- function decide({
46
- descriptor,
47
- toolId,
48
- policy,
49
- isRelease
50
- }) {
51
- for (const rule of policy.deny ?? []) {
52
- if (rule.toolId === toolId && (!rule.action || rule.action === descriptor.action)) {
53
- return {
54
- verdict: "refuse",
55
- reason: "This action is disabled in this app."
56
- };
57
- }
58
- }
59
- if (isRelease && descriptor.release !== "works") {
60
- return {
61
- verdict: "refuse",
62
- reason: releaseRefusal(descriptor)
63
- };
64
- }
65
- if (policy.allow) {
66
- const permitted = policy.allow.some(rule => (rule.toolId === undefined || rule.toolId === toolId) && (rule.action === undefined || rule.action === descriptor.action) && (rule.effect === undefined || rule.effect === descriptor.effect));
67
- if (!permitted) {
68
- return {
69
- verdict: "refuse",
70
- reason: "This action isn't on Ask Buoy's allow list in this app."
71
- };
72
- }
73
- }
74
- if (toolId === "storage" && SECURE_VALUE_READS.has(descriptor.action) && policy.secureReads !== true) {
75
- return {
76
- verdict: "refuse",
77
- reason: "Reading SecureStore values is off by default — they are credentials, and they would be sent to the configured model endpoint. Key names are still readable via secure.keys; the app can opt in with policy.secureReads: true."
78
- };
79
- }
80
- if (descriptor.effect !== "read" && policy.readOnly) {
81
- return {
82
- verdict: "refuse",
83
- reason: "Ask Buoy is in read-only mode in this app, so it can look at state but not change it."
84
- };
85
- }
86
- for (const rule of policy.requireApprovalFor ?? []) {
87
- if (rule.toolId === toolId && (!rule.action || rule.action === descriptor.action)) {
88
- return {
89
- verdict: "needs-approval",
90
- reason: "This app asks for a tap before this particular action runs."
91
- };
92
- }
93
- }
94
- if (descriptor.effect === "read") return {
95
- verdict: "allow"
96
- };
97
- if (resolveRequireApproval(policy).includes(descriptor.effect)) {
98
- return {
99
- verdict: "needs-approval",
100
- reason: descriptor.effect === "destructive"
101
- // Not "this will wipe or reset something": most destructive actions
102
- // in the catalog are ordinary edits that simply cannot be put back
103
- // (a store write, a cache reset), and telling someone their quantity
104
- // change is a wipe teaches them to stop reading the card.
105
- ? "Buoy can't undo this one — that's why it's asking." : "This will change the app's state."
106
- };
107
- }
108
- return {
109
- verdict: "allow"
110
- };
111
- }
112
-
113
- /**
114
- * The message the model gets back instead of a result. Written to be relayed
115
- * to a non-developer, because it usually will be.
116
- */
117
- function releaseRefusal(d) {
118
- const base = `\`${d.action}\` does not work in this build (a release build).`;
119
- switch (d.release) {
120
- case "noop":
121
- return `${base} It would report success and change nothing, so Buoy refused to run it rather than let you be told it worked. ${d.releaseNote ?? ""}`.trim();
122
- case "empty":
123
- return `${base} It relies on React's developer hook, which React Native only installs in development builds, so it can only ever return empty results here. ${d.releaseNote ?? ""}`.trim();
124
- case "throws":
125
- return `${base} It is explicitly disabled outside development. ${d.releaseNote ?? ""}`.trim();
126
- default:
127
- return `${base} Buoy could not confirm it behaves correctly outside development, so it refused rather than guess.`;
128
- }
129
- }
130
-
131
- /**
132
- * A short, domain-flavoured title for what a call will do — the first line of
133
- * a transcript row, a ledger row and an approval card.
134
- *
135
- * The raw tool payload is deliberately NOT what gets shown. A QA person cannot
136
- * evaluate `redux_dispatch({type:'SET_ENTITLEMENTS', payload:{...}})`, and an
137
- * approval prompt nobody can read is a rubber stamp, which is worse than no
138
- * prompt because it looks like oversight.
139
- *
140
- * Nor is the catalog `summary`: that sentence is written for the model and
141
- * ran to three lines in a phone-width row before it was cut off. The phrasing
142
- * lives in ./labels.ts; the catalog sentence travels separately on the event
143
- * as `description`, for a row the user chooses to expand.
144
- */
145
- function describeCall(toolId, descriptor, params) {
146
- return (0, _labels.titleCall)(toolId, descriptor.action, params);
147
- }
148
- //# sourceMappingURL=policy.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.DEFAULT_REQUIRE_APPROVAL=void 0;exports.decide=decide;exports.describeCall=describeCall;exports.resolveRequireApproval=resolveRequireApproval;var _labels=require("./labels");const DEFAULT_REQUIRE_APPROVAL=exports.DEFAULT_REQUIRE_APPROVAL=["destructive"];function resolveRequireApproval(e){return e.requireApproval??DEFAULT_REQUIRE_APPROVAL}const SECURE_VALUE_READS=new Set(["secure.get","secure.snapshot"]);function decide({descriptor:e,toolId:t,policy:r,isRelease:a}){for(const n of r.deny??[]){if(n.toolId===t&&(!n.action||n.action===e.action)){return{verdict:"refuse",reason:"This action is disabled in this app."}}}if(a&&e.release!=="works"){return{verdict:"refuse",reason:releaseRefusal(e)}}if(r.allow){const n=r.allow.some(s=>(s.toolId===void 0||s.toolId===t)&&(s.action===void 0||s.action===e.action)&&(s.effect===void 0||s.effect===e.effect));if(!n){return{verdict:"refuse",reason:"This action isn't on Ask Buoy's allow list in this app."}}}if(t==="storage"&&SECURE_VALUE_READS.has(e.action)&&r.secureReads!==true){return{verdict:"refuse",reason:"Reading SecureStore values is off by default \u2014 they are credentials, and they would be sent to the configured model endpoint. Key names are still readable via secure.keys; the app can opt in with policy.secureReads: true."}}if(e.effect!=="read"&&r.readOnly){return{verdict:"refuse",reason:"Ask Buoy is in read-only mode in this app, so it can look at state but not change it."}}for(const n of r.requireApprovalFor??[]){if(n.toolId===t&&(!n.action||n.action===e.action)){return{verdict:"needs-approval",reason:"This app asks for a tap before this particular action runs."}}}if(e.effect==="read")return{verdict:"allow"};if(resolveRequireApproval(r).includes(e.effect)){return{verdict:"needs-approval",reason:e.effect==="destructive"?"Buoy can't undo this one \u2014 that's why it's asking.":"This will change the app's state."}}return{verdict:"allow"}}function releaseRefusal(e){const t=`\`${e.action}\` does not work in this build (a release build).`;switch(e.release){case"noop":return`${t} It would report success and change nothing, so Buoy refused to run it rather than let you be told it worked. ${e.releaseNote??""}`.trim();case"empty":return`${t} It relies on React's developer hook, which React Native only installs in development builds, so it can only ever return empty results here. ${e.releaseNote??""}`.trim();case"throws":return`${t} It is explicitly disabled outside development. ${e.releaseNote??""}`.trim();default:return`${t} Buoy could not confirm it behaves correctly outside development, so it refused rather than guess.`}}function describeCall(e,t,r){return(0,_labels.titleCall)(e,t.action,r)}