@reticlehq/core 3.7.0 → 3.8.1

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 (138) hide show
  1. package/dist/activation-entry.d.ts +9 -0
  2. package/dist/activation-entry.js +9 -0
  3. package/dist/artifacts/drive-script.d.ts +84 -1217
  4. package/dist/artifacts/drive-script.js +1 -1
  5. package/dist/artifacts/flow-constants.d.ts +15 -0
  6. package/dist/artifacts/flow-constants.js +15 -0
  7. package/dist/artifacts/flow-expect-flat.d.ts +8 -192
  8. package/dist/artifacts/flow-expect-flat.js +2 -2
  9. package/dist/artifacts/flow-results.d.ts +26 -0
  10. package/dist/artifacts/flow-types.d.ts +212 -2295
  11. package/dist/artifacts/flow-types.js +14 -2
  12. package/dist/artifacts/harness-credits.d.ts +6 -3
  13. package/dist/artifacts/harness-credits.js +9 -6
  14. package/dist/artifacts/harness-map.d.ts +8 -69
  15. package/dist/artifacts/harness-map.js +1 -1
  16. package/dist/artifacts/hud-notices.d.ts +8 -82
  17. package/dist/artifacts/hud-notices.js +1 -1
  18. package/dist/artifacts/impact.d.ts +104 -1665
  19. package/dist/artifacts/impact.js +38 -21
  20. package/dist/artifacts/journal.d.ts +15 -231
  21. package/dist/artifacts/journal.js +15 -2
  22. package/dist/artifacts/prompt-context.d.ts +7 -33
  23. package/dist/artifacts/prompt-context.js +15 -4
  24. package/dist/artifacts/screenshot-upload.d.ts +3 -26
  25. package/dist/artifacts/screenshot-upload.js +1 -1
  26. package/dist/graph/app-graph.d.ts +137 -0
  27. package/dist/graph/app-graph.js +498 -0
  28. package/dist/hooks/hook-events.d.ts +15 -171
  29. package/dist/hooks/hook-events.js +1 -1
  30. package/dist/hud-entry.js +1 -1
  31. package/dist/identity/checkout.d.ts +41 -0
  32. package/dist/identity/checkout.js +118 -0
  33. package/dist/identity/state-dir.d.ts +23 -0
  34. package/dist/identity/state-dir.js +43 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.js +10 -0
  37. package/dist/onboarding.d.ts +23 -52
  38. package/dist/onboarding.js +20 -1
  39. package/dist/registry/daemon-registry.d.ts +2 -14
  40. package/dist/registry/daemon-registry.js +1 -1
  41. package/dist/registry/dev-server-registry.d.ts +2 -31
  42. package/dist/registry/dev-server-registry.js +1 -1
  43. package/dist/registry/project-registry.d.ts +4 -32
  44. package/dist/registry/project-registry.js +1 -1
  45. package/dist/schema/command-message.json +65 -68
  46. package/dist/schema/command-name.json +29 -33
  47. package/dist/schema/command-result.json +25 -30
  48. package/dist/schema/event-message.json +104 -101
  49. package/dist/schema/event-payloads.json +246 -108
  50. package/dist/schema/event-type.json +47 -48
  51. package/dist/schema/hello-message.json +150 -133
  52. package/dist/schema/reticle-event.json +98 -94
  53. package/dist/schema/reticle-message.json +338 -310
  54. package/dist/telemetry-bug.d.ts +4 -75
  55. package/dist/telemetry-bug.js +1 -1
  56. package/dist/telemetry-entry.d.ts +1 -1
  57. package/dist/telemetry-entry.js +1 -1
  58. package/dist/telemetry-feedback.d.ts +17 -91
  59. package/dist/telemetry-feedback.js +20 -1
  60. package/dist/telemetry-refusal.d.ts +4 -31
  61. package/dist/telemetry-refusal.js +1 -1
  62. package/dist/telemetry-session.d.ts +45 -624
  63. package/dist/telemetry-session.js +25 -12
  64. package/dist/telemetry-signals.d.ts +211 -86
  65. package/dist/telemetry-signals.js +100 -2
  66. package/dist/telemetry.d.ts +321 -1691
  67. package/dist/telemetry.js +72 -6
  68. package/dist/verdict/check-sentence.d.ts +34 -0
  69. package/dist/verdict/check-sentence.js +228 -0
  70. package/dist/verdict/compare-source.d.ts +1 -1
  71. package/dist/verdict/compare-source.js +1 -1
  72. package/dist/verdict/consequence.d.ts +15 -0
  73. package/dist/verdict/consequence.js +11 -0
  74. package/dist/verdict/disparity.d.ts +8 -56
  75. package/dist/verdict/disparity.js +1 -1
  76. package/dist/verdict/findings.d.ts +10 -0
  77. package/dist/verdict/findings.js +13 -0
  78. package/dist/verdict/instrumentation-coverage.d.ts +6 -37
  79. package/dist/verdict/instrumentation-coverage.js +15 -59
  80. package/dist/verdict/instrumentation-gap.d.ts +72 -0
  81. package/dist/verdict/instrumentation-gap.js +64 -0
  82. package/dist/verdict/intent.d.ts +25 -224
  83. package/dist/verdict/intent.js +1 -1
  84. package/dist/verdict/predicate-tree.d.ts +2 -0
  85. package/dist/verdict/predicate-tree.js +16 -0
  86. package/dist/verdict/predicate.d.ts +3 -2
  87. package/dist/verdict/predicate.js +107 -16
  88. package/dist/verdict/property-assertion.d.ts +23 -101
  89. package/dist/verdict/property-assertion.js +1 -1
  90. package/dist/verdict/run-report.d.ts +71 -0
  91. package/dist/verdict/run-report.js +53 -0
  92. package/dist/verdict/security.d.ts +48 -2
  93. package/dist/verdict/security.js +185 -18
  94. package/dist/verdict/verification-run.d.ts +124 -1623
  95. package/dist/verdict/verification-run.js +37 -6
  96. package/dist/verdict/verify-progress.d.ts +22 -64
  97. package/dist/verdict/verify-progress.js +1 -1
  98. package/dist/wire/constants/constants.d.ts +56 -141
  99. package/dist/wire/constants/constants.js +64 -144
  100. package/dist/wire/constants/discovery.d.ts +4 -4
  101. package/dist/wire/constants/discovery.js +4 -4
  102. package/dist/wire/constants/event-types.d.ts +37 -1
  103. package/dist/wire/constants/event-types.js +35 -1
  104. package/dist/wire/constants/hud-controls.js +0 -2
  105. package/dist/wire/constants/hud-use.d.ts +4 -0
  106. package/dist/wire/constants/hud-use.js +4 -0
  107. package/dist/wire/constants/mcp-wire.d.ts +16 -0
  108. package/dist/wire/constants/mcp-wire.js +16 -0
  109. package/dist/wire/constants/response-body-reason.d.ts +19 -0
  110. package/dist/wire/constants/response-body-reason.js +18 -0
  111. package/dist/wire/constants/reticle-env.d.ts +140 -0
  112. package/dist/wire/constants/reticle-env.js +140 -0
  113. package/dist/wire/constants/session-constants.d.ts +11 -0
  114. package/dist/wire/constants/session-constants.js +11 -0
  115. package/dist/wire/event-payloads.d.ts +173 -629
  116. package/dist/wire/event-payloads.js +107 -23
  117. package/dist/wire/event-priority.js +1 -0
  118. package/dist/wire/messages.d.ts +90 -713
  119. package/dist/wire/messages.js +19 -3
  120. package/dist/wire/narrow.d.ts +6 -0
  121. package/dist/wire/narrow.js +26 -0
  122. package/dist/wire/next-step.d.ts +50 -0
  123. package/dist/wire/next-step.js +37 -0
  124. package/dist/wire/platform-link.d.ts +7 -0
  125. package/dist/wire/platform-link.js +14 -8
  126. package/dist/wire/production/activation-ticket.d.ts +64 -0
  127. package/dist/wire/production/activation-ticket.js +148 -0
  128. package/dist/wire/production/hello-mode.d.ts +35 -0
  129. package/dist/wire/production/hello-mode.js +32 -0
  130. package/dist/wire/production/production-policy.d.ts +92 -0
  131. package/dist/wire/production/production-policy.js +133 -0
  132. package/dist/wire/tool-names.d.ts +2 -0
  133. package/dist/wire/tool-names.js +2 -0
  134. package/dist/wire/types.d.ts +102 -700
  135. package/dist/wire/types.js +5 -5
  136. package/dist/words/upgrade.d.ts +3 -13
  137. package/dist/words/upgrade.js +1 -1
  138. package/package.json +7 -4
@@ -0,0 +1,133 @@
1
+ import * as z from 'zod';
2
+ import { HelloScope } from './hello-mode.js';
3
+ /**
4
+ * The production action policy: what a drive on a live site may not do unless its intent says so.
5
+ *
6
+ * A wire contract because two sides supply it. The engine ships `DEFAULT_PRODUCTION_POLICY`; the
7
+ * service that issues the activation ticket may send its own list, which replaces the default for
8
+ * that drive. The daemon enforces it where commands are dispatched, never in the page.
9
+ */
10
+ /** Each refusal names one of these. The text follows "production policy: " in the refusal. */
11
+ export const ProductionRule = {
12
+ PAYMENT: 'payment or checkout',
13
+ DELETE_WORKSPACE: 'delete a workspace or project',
14
+ REVOKE_KEY: 'revoke or rotate a key',
15
+ SEND_INVITE: 'send an invite or email',
16
+ CANCEL_SUBSCRIPTION: 'cancel a subscription',
17
+ CHANGE_ROLE: "change a member's role",
18
+ /** `scope: "observe"` reads only. */
19
+ OBSERVE_ONLY: 'the session scope is observe, so it does not act',
20
+ /** The drive stays on the origin it was activated for. */
21
+ OFF_ORIGIN: 'leave the activated origin',
22
+ /** The nonce's time is up; the drive is over. */
23
+ EXPIRED: 'the session nonce expired',
24
+ };
25
+ /** The rules an intent can allow. The other three are never lifted. */
26
+ export const LIFTABLE_PRODUCTION_RULES = [
27
+ ProductionRule.PAYMENT,
28
+ ProductionRule.DELETE_WORKSPACE,
29
+ ProductionRule.REVOKE_KEY,
30
+ ProductionRule.SEND_INVITE,
31
+ ProductionRule.CANCEL_SUBSCRIPTION,
32
+ ProductionRule.CHANGE_ROLE,
33
+ ];
34
+ /** Limits on a supplied policy list, so a ticket cannot hand the daemon an unbounded regex load. */
35
+ const MAX_POLICY_ENTRIES = 64;
36
+ const MAX_POLICY_PATTERN_LENGTH = 256;
37
+ /**
38
+ * One request the policy refuses: an HTTP method and a path pattern (a RegExp source, matched
39
+ * case-insensitively anywhere in the URL's pathname).
40
+ */
41
+ export const ProductionPolicyEntrySchema = z.object({
42
+ rule: z.enum(LIFTABLE_PRODUCTION_RULES),
43
+ methods: z.array(z.string().min(1).max(16)).min(1).max(8),
44
+ path: z
45
+ .string()
46
+ .min(1)
47
+ .max(MAX_POLICY_PATTERN_LENGTH)
48
+ .refine((source) => {
49
+ try {
50
+ new RegExp(source, 'i');
51
+ return true;
52
+ }
53
+ catch {
54
+ return false;
55
+ }
56
+ }, 'not a valid regular expression'),
57
+ });
58
+ export const ProductionPolicySchema = z.array(ProductionPolicyEntrySchema).max(MAX_POLICY_ENTRIES);
59
+ /** The default list: the REST shapes of the six refused actions. A service may send its own. */
60
+ export const DEFAULT_PRODUCTION_POLICY = [
61
+ {
62
+ rule: ProductionRule.CANCEL_SUBSCRIPTION,
63
+ methods: ['DELETE'],
64
+ path: '/subscriptions?(/[^/]+)?/?$',
65
+ },
66
+ {
67
+ rule: ProductionRule.CANCEL_SUBSCRIPTION,
68
+ methods: ['POST', 'PUT', 'PATCH'],
69
+ path: '/subscriptions?(/[^/]+)?/cancel',
70
+ },
71
+ {
72
+ rule: ProductionRule.PAYMENT,
73
+ methods: ['POST', 'PUT', 'PATCH'],
74
+ path: '/(billing|checkout|payments?|subscriptions?|purchases?|orders?)(/|$)',
75
+ },
76
+ {
77
+ rule: ProductionRule.DELETE_WORKSPACE,
78
+ methods: ['DELETE'],
79
+ path: '/(workspaces?|orgs?|organi[sz]ations?|projects?)/[^/]+/?$',
80
+ },
81
+ { rule: ProductionRule.REVOKE_KEY, methods: ['DELETE'], path: '/(api-?)?keys?/[^/]+/?$' },
82
+ {
83
+ rule: ProductionRule.REVOKE_KEY,
84
+ methods: ['POST', 'PUT', 'PATCH'],
85
+ path: '/(api-?keys?|keys?|tokens?|secrets?)(/[^/]+)?/(rotate|revoke|regenerate|roll)',
86
+ },
87
+ {
88
+ rule: ProductionRule.SEND_INVITE,
89
+ methods: ['POST', 'PUT'],
90
+ path: '/(invites?|invitations?|emails?|mail)(/|$)',
91
+ },
92
+ {
93
+ rule: ProductionRule.CHANGE_ROLE,
94
+ methods: ['PATCH', 'PUT', 'POST'],
95
+ path: '/members?/[^/]+(/role)?/?$',
96
+ },
97
+ ];
98
+ /** What the refusal says. Every refusal is this sentence; nothing is a silent no-op. */
99
+ export const PRODUCTION_REFUSAL_PREFIX = 'refused: production policy: ';
100
+ export const productionRefusal = (rule) => `${PRODUCTION_REFUSAL_PREFIX}${rule}. ` +
101
+ (LIFTABLE_PRODUCTION_RULES.includes(rule)
102
+ ? 'A production drive does this only when its declared intent names it ' +
103
+ '(reticle_lease production.intent).'
104
+ : 'No intent allows this.');
105
+ // ── The activation ticket: daemon -> service ───────────────────────────────────────────────────
106
+ /** The service route that issues an activation ticket, authenticated with the person's API key. */
107
+ export const PRODUCTION_TICKET_PATH = '/v1/production-mode/tickets';
108
+ export const ProductionTicketRequestSchema = z.object({
109
+ workspaceId: z.string().min(1).max(128),
110
+ /** The single-use HELLO token the daemon minted for this drive. */
111
+ nonce: z.string().min(1).max(256),
112
+ /** The daemon's bridge port. The service puts it in the page's bootstrap and its CSP. */
113
+ bridgePort: z.number().int().min(1).max(65535),
114
+ scope: z.nativeEnum(HelloScope),
115
+ /**
116
+ * The site origin the lease opens: the ticket's `origin`. Optional only so an older daemon still
117
+ * gets a ticket; a service that is told it binds the ticket to it rather than guessing.
118
+ */
119
+ origin: z.string().url().max(2048).optional(),
120
+ /**
121
+ * The bridge the page must dial (`ws://127.0.0.1:<port>/reticle` for the daemon's own): the
122
+ * ticket's `bridge`. Optional for the same reason; absent, the service builds it from `bridgePort`.
123
+ */
124
+ bridge: z.string().url().max(2048).optional(),
125
+ });
126
+ export const ProductionTicketResponseSchema = z.object({
127
+ /** Signed by the service (format: `activation-ticket.ts`). The lease opens `<url>?reticle_activate=<ticket>`. */
128
+ ticket: z.string().min(1).max(4096),
129
+ /** When the ticket must be redeemed by (ISO 8601). Informational. */
130
+ expiresAt: z.string().max(64).optional(),
131
+ /** The service's own refused requests for this drive. Absent: `DEFAULT_PRODUCTION_POLICY`. */
132
+ policy: ProductionPolicySchema.optional(),
133
+ });
@@ -72,6 +72,8 @@ export declare const ReticleTool: {
72
72
  readonly INTENT: "reticle_intent";
73
73
  /** what THIS run has established, proved, and not yet discharged — pulled when memory is gone. */
74
74
  readonly CONTEXT: "reticle_context";
75
+ /** the app as the App Graph sees it, folded from the project's journals: screens, frontier, a path. */
76
+ readonly MAP: "reticle_map";
75
77
  readonly VERIFY: "reticle_verify";
76
78
  /** read cross-run history (.reticle/project.json) + diff-vs-last for a name. */
77
79
  readonly PROJECT: "reticle_project";
@@ -82,6 +82,8 @@ export const ReticleTool = {
82
82
  INTENT: 'reticle_intent',
83
83
  /** what THIS run has established, proved, and not yet discharged — pulled when memory is gone. */
84
84
  CONTEXT: 'reticle_context',
85
+ /** the app as the App Graph sees it, folded from the project's journals: screens, frontier, a path. */
86
+ MAP: 'reticle_map',
85
87
  VERIFY: 'reticle_verify',
86
88
  /** read cross-run history (.reticle/project.json) + diff-vs-last for a name. */
87
89
  PROJECT: 'reticle_project',