@reticlehq/core 3.6.0 → 3.7.0

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 (90) hide show
  1. package/dist/artifacts/artifacts-entry.d.ts +2 -0
  2. package/dist/artifacts/artifacts-entry.js +2 -0
  3. package/dist/artifacts/drive-script.d.ts +158 -52
  4. package/dist/artifacts/drive-script.js +24 -1
  5. package/dist/artifacts/flow-constants.d.ts +18 -0
  6. package/dist/artifacts/flow-constants.js +20 -0
  7. package/dist/artifacts/flow-results.d.ts +450 -0
  8. package/dist/artifacts/flow-results.js +1 -0
  9. package/dist/artifacts/flow-types.d.ts +25 -437
  10. package/dist/artifacts/flow-types.js +5 -2
  11. package/dist/artifacts/harness-credits.d.ts +39 -0
  12. package/dist/artifacts/harness-credits.js +69 -0
  13. package/dist/artifacts/harness-map.d.ts +98 -0
  14. package/dist/artifacts/harness-map.js +36 -0
  15. package/dist/artifacts/impact.d.ts +354 -145
  16. package/dist/artifacts/impact.js +66 -48
  17. package/dist/artifacts/journal.d.ts +56 -5
  18. package/dist/artifacts/journal.js +26 -0
  19. package/dist/artifacts/screenshot-upload.d.ts +51 -0
  20. package/dist/artifacts/screenshot-upload.js +26 -0
  21. package/dist/hooks/hook-events.d.ts +4 -4
  22. package/dist/hud-entry.d.ts +1 -0
  23. package/dist/hud-entry.js +2 -0
  24. package/dist/index.d.ts +5 -0
  25. package/dist/index.js +5 -0
  26. package/dist/onboarding.d.ts +8 -0
  27. package/dist/onboarding.js +6 -0
  28. package/dist/realm/registry.js +19 -1
  29. package/dist/schema/command-message.json +30 -0
  30. package/dist/schema/command-name.json +3 -1
  31. package/dist/schema/event-payloads.json +40 -2
  32. package/dist/schema/reticle-message.json +30 -0
  33. package/dist/telemetry-bug.d.ts +169 -0
  34. package/dist/telemetry-bug.js +123 -0
  35. package/dist/telemetry-entry.d.ts +1 -0
  36. package/dist/telemetry-entry.js +1 -0
  37. package/dist/telemetry-feedback.d.ts +2 -2
  38. package/dist/telemetry-refusal.d.ts +2 -2
  39. package/dist/telemetry-session.d.ts +74 -0
  40. package/dist/telemetry-session.js +54 -0
  41. package/dist/telemetry-signals.d.ts +339 -0
  42. package/dist/telemetry-signals.js +138 -0
  43. package/dist/telemetry.d.ts +300 -254
  44. package/dist/telemetry.js +40 -115
  45. package/dist/verdict/disparity.d.ts +105 -0
  46. package/dist/verdict/disparity.js +40 -0
  47. package/dist/verdict/findings.d.ts +6 -0
  48. package/dist/verdict/findings.js +9 -0
  49. package/dist/verdict/instrumentation-coverage.d.ts +115 -0
  50. package/dist/verdict/instrumentation-coverage.js +226 -0
  51. package/dist/verdict/instrumentation-gap.js +1 -1
  52. package/dist/verdict/intent.d.ts +19 -5
  53. package/dist/verdict/intent.js +13 -1
  54. package/dist/verdict/predicate-tree.d.ts +15 -0
  55. package/dist/verdict/predicate-tree.js +21 -0
  56. package/dist/verdict/predicate.d.ts +14 -0
  57. package/dist/verdict/predicate.js +87 -3
  58. package/dist/verdict/security.d.ts +25 -0
  59. package/dist/verdict/security.js +82 -0
  60. package/dist/verdict/verification-run.d.ts +620 -32
  61. package/dist/verdict/verification-run.js +82 -0
  62. package/dist/wire/constants/constants.d.ts +15 -16
  63. package/dist/wire/constants/constants.js +16 -17
  64. package/dist/wire/constants/hud-controls.js +17 -5
  65. package/dist/wire/constants/hud-use.d.ts +29 -4
  66. package/dist/wire/constants/hud-use.js +26 -4
  67. package/dist/wire/constants/mcp-wire.d.ts +10 -0
  68. package/dist/wire/constants/mcp-wire.js +10 -0
  69. package/dist/wire/constants/reticle-chrome.d.ts +19 -0
  70. package/dist/wire/constants/reticle-chrome.js +19 -0
  71. package/dist/wire/constants/session-constants.d.ts +15 -2
  72. package/dist/wire/constants/session-constants.js +15 -2
  73. package/dist/wire/desktop-contract.d.ts +8 -0
  74. package/dist/wire/desktop-contract.js +11 -0
  75. package/dist/wire/event-payloads.d.ts +56 -4
  76. package/dist/wire/event-payloads.js +17 -0
  77. package/dist/wire/messages.d.ts +105 -32
  78. package/dist/wire/messages.js +9 -1
  79. package/dist/wire/platform-link.d.ts +77 -0
  80. package/dist/wire/platform-link.js +45 -0
  81. package/dist/wire/tool-names.d.ts +2 -0
  82. package/dist/wire/tool-names.js +2 -0
  83. package/dist/wire/types.d.ts +19 -6
  84. package/dist/wire/types.js +5 -0
  85. package/dist/words/notices.d.ts +1 -1
  86. package/dist/words/notices.js +1 -1
  87. package/dist/words/upgrade.js +1 -1
  88. package/dist/words/writing-rule.d.ts +14 -0
  89. package/dist/words/writing-rule.js +17 -0
  90. package/package.json +1 -1
@@ -123,3 +123,85 @@ export function isDangerousActionText(text, role) {
123
123
  return false;
124
124
  return DANGEROUS_ACTION.test(text.replace(/[_-]+/g, ' '));
125
125
  }
126
+ // ── What the Harness may press ────────────────────────────────────────────────────────────────
127
+ /*
128
+ * An action that reaches outside the page or changes someone's workspace: it invites, sends,
129
+ * shares, deletes, pays, publishes, revokes, transfers, signs out, changes a role or creates a key.
130
+ * The Harness pressed Invite in a customer's workspace although its journey said "she does not send
131
+ * an invite", and a planner-invented journey typed a new address and pressed Invite. A Harness drive
132
+ * presses one only when its journey asks for that action; a saved flow's steps were asked for by
133
+ * whoever recorded them. The agent's own guard (`isDangerousActionText`) is narrower on purpose.
134
+ */
135
+ export const OutwardAction = {
136
+ INVITE: 'invite',
137
+ SEND: 'send',
138
+ SHARE: 'share',
139
+ DELETE: 'delete',
140
+ PAY: 'pay',
141
+ PUBLISH: 'publish',
142
+ REVOKE: 'revoke',
143
+ TRANSFER: 'transfer',
144
+ SIGN_OUT: 'sign out',
145
+ CHANGE_ROLE: 'change role',
146
+ CREATE_KEY: 'create key',
147
+ /** Reassigning, reopening, archiving, approving: changing an item's state for everyone. */
148
+ CHANGE_STATE: 'change state',
149
+ };
150
+ /** Each outward action as words on a control (or in the request it points at), and in a journey. */
151
+ const OUTWARD_WORDS = [
152
+ [OutwardAction.INVITE, /\binvit(?:e|es|ed|ing|ation|ations)\b|\/invit/i],
153
+ [OutwardAction.TRANSFER, /\b(?:transfer|send money|send funds|withdraw)\b/i],
154
+ [OutwardAction.SEND, /\b(?:send|sends|sending|resend|email (?:it|them|the))\b/i],
155
+ [OutwardAction.SHARE, /\b(?:share|shares|sharing)\b/i],
156
+ [
157
+ OutwardAction.DELETE,
158
+ /\b(?:delete|deletes|deleting|remove|removes|removing|destroy|erase|drop)\b/i,
159
+ ],
160
+ [
161
+ OutwardAction.PAY,
162
+ /\b(?:pay|pays|paying|payment|purchase|buy|checkout|check out|subscribe|upgrade|place order|confirm order|refund|add (?:a )?card|start (?:the |your |a )?(?:\d+-day |free )?trial)\b|\/(?:billing|checkout)\b/i,
163
+ ],
164
+ [OutwardAction.PUBLISH, /\b(?:publish|publishes|deploy|deploys|go live)\b/i],
165
+ [OutwardAction.REVOKE, /\b(?:revoke|revokes|deactivate|suspend)\b/i],
166
+ [OutwardAction.SIGN_OUT, /\b(?:sign ?out|log ?out|sign off)\b/i],
167
+ [
168
+ OutwardAction.CHANGE_ROLE,
169
+ /\b(?:change (?:the |their |his |her )?role|make (?:an? )?(?:admin|owner)|promote|demote|set role)\b/i,
170
+ ],
171
+ [OutwardAction.CREATE_KEY, /\b(?:create|generate|new|mint)(?: an?)?(?: api)? key\b|\/keys\b/i],
172
+ [
173
+ OutwardAction.CHANGE_STATE,
174
+ /\b(?:reassign|reassigns|reopen|reopens|re-open|archive|archives|unarchive|approve|approves|reject|rejects|mark as (?:fixed|resolved|done|closed))\b/i,
175
+ ],
176
+ ];
177
+ /** The outward action a control would take, from its text and role; value pickers take none. */
178
+ export function outwardActionOf(text, role) {
179
+ if (role !== undefined && VALUE_PICKER_ROLES.has(role.trim().toLowerCase()))
180
+ return undefined;
181
+ const words = text.replace(/[_-]+/g, ' ');
182
+ return OUTWARD_WORDS.find(([, pattern]) => pattern.test(words))?.[0];
183
+ }
184
+ /** A word that turns the action after it into one the journey forbids: "does not send". */
185
+ const NEGATION = /\b(?:not|no|never|without|nor|avoid|avoids|don't|doesn't|won't|didn't)\b/i;
186
+ /** How many words before an action a negation still governs it. */
187
+ const NEGATION_REACH = 4;
188
+ /**
189
+ * The outward actions a journey asks for in so many words. "Invite a teammate" asks for invite;
190
+ * "she does not send an invite" and "without sending" ask for nothing. Pure.
191
+ */
192
+ export function outwardActionsAsked(journey) {
193
+ const asked = [];
194
+ for (const [action, pattern] of OUTWARD_WORDS) {
195
+ const global = new RegExp(pattern.source, 'gi');
196
+ for (const match of journey.matchAll(global)) {
197
+ const before = journey.slice(0, match.index).split(/\s+/).slice(-NEGATION_REACH).join(' ');
198
+ if (!NEGATION.test(before)) {
199
+ asked.push(action);
200
+ break;
201
+ }
202
+ }
203
+ }
204
+ return asked;
205
+ }
206
+ /** What the Harness says, and the journey records, when it would not press one. */
207
+ export const outwardRefusal = (action) => `would need to ${action} — not done (outward action): the journey does not ask for it`;