@reticlehq/core 3.6.0 → 3.8.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.
- package/dist/activation-entry.d.ts +9 -0
- package/dist/activation-entry.js +9 -0
- package/dist/artifacts/artifacts-entry.d.ts +2 -0
- package/dist/artifacts/artifacts-entry.js +2 -0
- package/dist/artifacts/drive-script.d.ts +222 -116
- package/dist/artifacts/drive-script.js +24 -1
- package/dist/artifacts/flow-constants.d.ts +33 -0
- package/dist/artifacts/flow-constants.js +35 -0
- package/dist/artifacts/flow-expect-flat.d.ts +8 -8
- package/dist/artifacts/flow-results.d.ts +461 -0
- package/dist/artifacts/flow-results.js +1 -0
- package/dist/artifacts/flow-types.d.ts +177 -543
- package/dist/artifacts/flow-types.js +17 -2
- package/dist/artifacts/harness-credits.d.ts +42 -0
- package/dist/artifacts/harness-credits.js +72 -0
- package/dist/artifacts/harness-map.d.ts +98 -0
- package/dist/artifacts/harness-map.js +36 -0
- package/dist/artifacts/impact.d.ts +355 -149
- package/dist/artifacts/impact.js +84 -49
- package/dist/artifacts/journal.d.ts +81 -11
- package/dist/artifacts/journal.js +39 -0
- package/dist/artifacts/prompt-context.d.ts +12 -0
- package/dist/artifacts/prompt-context.js +14 -3
- package/dist/artifacts/screenshot-upload.d.ts +51 -0
- package/dist/artifacts/screenshot-upload.js +26 -0
- package/dist/graph/app-graph.d.ts +137 -0
- package/dist/graph/app-graph.js +498 -0
- package/dist/hooks/hook-events.d.ts +26 -26
- package/dist/hud-entry.d.ts +1 -0
- package/dist/hud-entry.js +2 -0
- package/dist/identity/checkout.d.ts +41 -0
- package/dist/identity/checkout.js +118 -0
- package/dist/identity/state-dir.d.ts +23 -0
- package/dist/identity/state-dir.js +43 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +15 -0
- package/dist/onboarding.d.ts +30 -1
- package/dist/onboarding.js +25 -0
- package/dist/realm/registry.js +19 -1
- package/dist/registry/dev-server-registry.d.ts +2 -2
- package/dist/schema/command-message.json +30 -0
- package/dist/schema/command-name.json +3 -1
- package/dist/schema/event-message.json +3 -1
- package/dist/schema/event-payloads.json +156 -3
- package/dist/schema/event-type.json +3 -1
- package/dist/schema/hello-message.json +21 -0
- package/dist/schema/reticle-event.json +3 -1
- package/dist/schema/reticle-message.json +54 -1
- package/dist/telemetry-bug.d.ts +169 -0
- package/dist/telemetry-bug.js +123 -0
- package/dist/telemetry-entry.d.ts +2 -1
- package/dist/telemetry-entry.js +2 -1
- package/dist/telemetry-feedback.d.ts +16 -2
- package/dist/telemetry-feedback.js +19 -0
- package/dist/telemetry-session.d.ts +91 -2
- package/dist/telemetry-session.js +65 -0
- package/dist/telemetry-signals.d.ts +557 -0
- package/dist/telemetry-signals.js +225 -0
- package/dist/telemetry.d.ts +649 -296
- package/dist/telemetry.js +110 -119
- package/dist/verdict/check-sentence.d.ts +34 -0
- package/dist/verdict/check-sentence.js +228 -0
- package/dist/verdict/consequence.d.ts +15 -0
- package/dist/verdict/consequence.js +11 -0
- package/dist/verdict/disparity.d.ts +105 -0
- package/dist/verdict/disparity.js +40 -0
- package/dist/verdict/findings.d.ts +16 -0
- package/dist/verdict/findings.js +22 -0
- package/dist/verdict/instrumentation-coverage.d.ts +84 -0
- package/dist/verdict/instrumentation-coverage.js +182 -0
- package/dist/verdict/instrumentation-gap.d.ts +79 -0
- package/dist/verdict/instrumentation-gap.js +65 -1
- package/dist/verdict/intent.d.ts +19 -5
- package/dist/verdict/intent.js +13 -1
- package/dist/verdict/predicate-tree.d.ts +17 -0
- package/dist/verdict/predicate-tree.js +37 -0
- package/dist/verdict/predicate.d.ts +16 -1
- package/dist/verdict/predicate.js +188 -13
- package/dist/verdict/property-assertion.d.ts +2 -2
- package/dist/verdict/run-report.d.ts +166 -0
- package/dist/verdict/run-report.js +53 -0
- package/dist/verdict/security.d.ts +60 -1
- package/dist/verdict/security.js +174 -12
- package/dist/verdict/verification-run.d.ts +713 -68
- package/dist/verdict/verification-run.js +113 -0
- package/dist/verdict/verify-progress.d.ts +6 -6
- package/dist/wire/constants/constants.d.ts +69 -155
- package/dist/wire/constants/constants.js +78 -159
- package/dist/wire/constants/discovery.d.ts +4 -4
- package/dist/wire/constants/discovery.js +4 -4
- package/dist/wire/constants/event-types.d.ts +35 -1
- package/dist/wire/constants/event-types.js +33 -1
- package/dist/wire/constants/hud-controls.js +15 -5
- package/dist/wire/constants/hud-use.d.ts +33 -4
- package/dist/wire/constants/hud-use.js +30 -4
- package/dist/wire/constants/mcp-wire.d.ts +26 -0
- package/dist/wire/constants/mcp-wire.js +26 -0
- package/dist/wire/constants/response-body-reason.d.ts +19 -0
- package/dist/wire/constants/response-body-reason.js +18 -0
- package/dist/wire/constants/reticle-chrome.d.ts +19 -0
- package/dist/wire/constants/reticle-chrome.js +19 -0
- package/dist/wire/constants/reticle-env.d.ts +138 -0
- package/dist/wire/constants/reticle-env.js +138 -0
- package/dist/wire/constants/session-constants.d.ts +26 -2
- package/dist/wire/constants/session-constants.js +26 -2
- package/dist/wire/desktop-contract.d.ts +8 -0
- package/dist/wire/desktop-contract.js +11 -0
- package/dist/wire/event-payloads.d.ts +202 -36
- package/dist/wire/event-payloads.js +100 -16
- package/dist/wire/messages.d.ts +193 -54
- package/dist/wire/messages.js +25 -1
- package/dist/wire/narrow.d.ts +6 -0
- package/dist/wire/narrow.js +26 -0
- package/dist/wire/next-step.d.ts +90 -0
- package/dist/wire/next-step.js +37 -0
- package/dist/wire/platform-link.d.ts +84 -0
- package/dist/wire/platform-link.js +57 -6
- package/dist/wire/production/activation-ticket.d.ts +64 -0
- package/dist/wire/production/activation-ticket.js +148 -0
- package/dist/wire/production/hello-mode.d.ts +35 -0
- package/dist/wire/production/hello-mode.js +32 -0
- package/dist/wire/production/production-policy.d.ts +138 -0
- package/dist/wire/production/production-policy.js +133 -0
- package/dist/wire/tool-names.d.ts +4 -0
- package/dist/wire/tool-names.js +4 -0
- package/dist/wire/types.d.ts +90 -52
- package/dist/wire/types.js +5 -0
- package/dist/words/notices.d.ts +1 -1
- package/dist/words/notices.js +1 -1
- package/dist/words/upgrade.js +1 -1
- package/dist/words/writing-rule.d.ts +14 -0
- package/dist/words/writing-rule.js +17 -0
- package/package.json +5 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a page runs and what a drive may do there, as a HELLO announces it.
|
|
3
|
+
*
|
|
4
|
+
* A leaf on purpose: the browser SDK sends these two words, and nothing else about production mode
|
|
5
|
+
* belongs in a page's first load. The policy that reads them lives in `production-policy.ts`.
|
|
6
|
+
*/
|
|
7
|
+
/** The environment a page says it runs in. Absent means `development`, which is every older SDK. */
|
|
8
|
+
export declare const HelloEnv: {
|
|
9
|
+
readonly DEVELOPMENT: "development";
|
|
10
|
+
readonly PRODUCTION: "production";
|
|
11
|
+
};
|
|
12
|
+
export type HelloEnv = (typeof HelloEnv)[keyof typeof HelloEnv];
|
|
13
|
+
/**
|
|
14
|
+
* What a drive may do on the page. `observe` reads only. `act` also clicks and types.
|
|
15
|
+
* Absent means `act` in development. A production HELLO must say which.
|
|
16
|
+
*/
|
|
17
|
+
export declare const HelloScope: {
|
|
18
|
+
readonly OBSERVE: "observe";
|
|
19
|
+
readonly ACT: "act";
|
|
20
|
+
};
|
|
21
|
+
export type HelloScope = (typeof HelloScope)[keyof typeof HelloScope];
|
|
22
|
+
/**
|
|
23
|
+
* Who put the SDK in this page. Absent means `installed`: every SDK before this field was one the app
|
|
24
|
+
* imported itself.
|
|
25
|
+
*
|
|
26
|
+
* `injected` is a page a hosted verifier instrumented from outside (a URL-only check), with nothing
|
|
27
|
+
* in the app's own code. Whatever such a session reports (a framework, stores found in the React
|
|
28
|
+
* tree) came from the verifier, not the app. A reader must not count it as the app having the SDK
|
|
29
|
+
* installed: signals, registered module stores and file:line still need the app to add them.
|
|
30
|
+
*/
|
|
31
|
+
export declare const HelloInstrumentation: {
|
|
32
|
+
readonly INSTALLED: "installed";
|
|
33
|
+
readonly INJECTED: "injected";
|
|
34
|
+
};
|
|
35
|
+
export type HelloInstrumentation = (typeof HelloInstrumentation)[keyof typeof HelloInstrumentation];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where a page runs and what a drive may do there, as a HELLO announces it.
|
|
3
|
+
*
|
|
4
|
+
* A leaf on purpose: the browser SDK sends these two words, and nothing else about production mode
|
|
5
|
+
* belongs in a page's first load. The policy that reads them lives in `production-policy.ts`.
|
|
6
|
+
*/
|
|
7
|
+
/** The environment a page says it runs in. Absent means `development`, which is every older SDK. */
|
|
8
|
+
export const HelloEnv = {
|
|
9
|
+
DEVELOPMENT: 'development',
|
|
10
|
+
PRODUCTION: 'production',
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* What a drive may do on the page. `observe` reads only. `act` also clicks and types.
|
|
14
|
+
* Absent means `act` in development. A production HELLO must say which.
|
|
15
|
+
*/
|
|
16
|
+
export const HelloScope = {
|
|
17
|
+
OBSERVE: 'observe',
|
|
18
|
+
ACT: 'act',
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Who put the SDK in this page. Absent means `installed`: every SDK before this field was one the app
|
|
22
|
+
* imported itself.
|
|
23
|
+
*
|
|
24
|
+
* `injected` is a page a hosted verifier instrumented from outside (a URL-only check), with nothing
|
|
25
|
+
* in the app's own code. Whatever such a session reports (a framework, stores found in the React
|
|
26
|
+
* tree) came from the verifier, not the app. A reader must not count it as the app having the SDK
|
|
27
|
+
* installed: signals, registered module stores and file:line still need the app to add them.
|
|
28
|
+
*/
|
|
29
|
+
export const HelloInstrumentation = {
|
|
30
|
+
INSTALLED: 'installed',
|
|
31
|
+
INJECTED: 'injected',
|
|
32
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The production action policy: what a drive on a live site may not do unless its intent says so.
|
|
4
|
+
*
|
|
5
|
+
* A wire contract because two sides supply it. The engine ships `DEFAULT_PRODUCTION_POLICY`; the
|
|
6
|
+
* service that issues the activation ticket may send its own list, which replaces the default for
|
|
7
|
+
* that drive. The daemon enforces it where commands are dispatched, never in the page.
|
|
8
|
+
*/
|
|
9
|
+
/** Each refusal names one of these. The text follows "production policy: " in the refusal. */
|
|
10
|
+
export declare const ProductionRule: {
|
|
11
|
+
readonly PAYMENT: "payment or checkout";
|
|
12
|
+
readonly DELETE_WORKSPACE: "delete a workspace or project";
|
|
13
|
+
readonly REVOKE_KEY: "revoke or rotate a key";
|
|
14
|
+
readonly SEND_INVITE: "send an invite or email";
|
|
15
|
+
readonly CANCEL_SUBSCRIPTION: "cancel a subscription";
|
|
16
|
+
readonly CHANGE_ROLE: "change a member's role";
|
|
17
|
+
/** `scope: "observe"` reads only. */
|
|
18
|
+
readonly OBSERVE_ONLY: "the session scope is observe, so it does not act";
|
|
19
|
+
/** The drive stays on the origin it was activated for. */
|
|
20
|
+
readonly OFF_ORIGIN: "leave the activated origin";
|
|
21
|
+
/** The nonce's time is up; the drive is over. */
|
|
22
|
+
readonly EXPIRED: "the session nonce expired";
|
|
23
|
+
};
|
|
24
|
+
export type ProductionRule = (typeof ProductionRule)[keyof typeof ProductionRule];
|
|
25
|
+
/** The rules an intent can allow. The other three are never lifted. */
|
|
26
|
+
export declare const LIFTABLE_PRODUCTION_RULES: readonly ["payment or checkout", "delete a workspace or project", "revoke or rotate a key", "send an invite or email", "cancel a subscription", "change a member's role"];
|
|
27
|
+
export type LiftableProductionRule = (typeof LIFTABLE_PRODUCTION_RULES)[number];
|
|
28
|
+
/**
|
|
29
|
+
* One request the policy refuses: an HTTP method and a path pattern (a RegExp source, matched
|
|
30
|
+
* case-insensitively anywhere in the URL's pathname).
|
|
31
|
+
*/
|
|
32
|
+
export declare const ProductionPolicyEntrySchema: z.ZodObject<{
|
|
33
|
+
rule: z.ZodEnum<["payment or checkout", "delete a workspace or project", "revoke or rotate a key", "send an invite or email", "cancel a subscription", "change a member's role"]>;
|
|
34
|
+
methods: z.ZodArray<z.ZodString, "many">;
|
|
35
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
path: string;
|
|
38
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
39
|
+
methods: string[];
|
|
40
|
+
}, {
|
|
41
|
+
path: string;
|
|
42
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
43
|
+
methods: string[];
|
|
44
|
+
}>;
|
|
45
|
+
export type ProductionPolicyEntry = z.infer<typeof ProductionPolicyEntrySchema>;
|
|
46
|
+
export declare const ProductionPolicySchema: z.ZodArray<z.ZodObject<{
|
|
47
|
+
rule: z.ZodEnum<["payment or checkout", "delete a workspace or project", "revoke or rotate a key", "send an invite or email", "cancel a subscription", "change a member's role"]>;
|
|
48
|
+
methods: z.ZodArray<z.ZodString, "many">;
|
|
49
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
path: string;
|
|
52
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
53
|
+
methods: string[];
|
|
54
|
+
}, {
|
|
55
|
+
path: string;
|
|
56
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
57
|
+
methods: string[];
|
|
58
|
+
}>, "many">;
|
|
59
|
+
/** The default list: the REST shapes of the six refused actions. A service may send its own. */
|
|
60
|
+
export declare const DEFAULT_PRODUCTION_POLICY: readonly ProductionPolicyEntry[];
|
|
61
|
+
/** What the refusal says. Every refusal is this sentence; nothing is a silent no-op. */
|
|
62
|
+
export declare const PRODUCTION_REFUSAL_PREFIX = "refused: production policy: ";
|
|
63
|
+
export declare const productionRefusal: (rule: ProductionRule) => string;
|
|
64
|
+
/** The service route that issues an activation ticket, authenticated with the person's API key. */
|
|
65
|
+
export declare const PRODUCTION_TICKET_PATH = "/v1/production-mode/tickets";
|
|
66
|
+
export declare const ProductionTicketRequestSchema: z.ZodObject<{
|
|
67
|
+
workspaceId: z.ZodString;
|
|
68
|
+
/** The single-use HELLO token the daemon minted for this drive. */
|
|
69
|
+
nonce: z.ZodString;
|
|
70
|
+
/** The daemon's bridge port. The service puts it in the page's bootstrap and its CSP. */
|
|
71
|
+
bridgePort: z.ZodNumber;
|
|
72
|
+
scope: z.ZodNativeEnum<{
|
|
73
|
+
readonly OBSERVE: "observe";
|
|
74
|
+
readonly ACT: "act";
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* The site origin the lease opens: the ticket's `origin`. Optional only so an older daemon still
|
|
78
|
+
* gets a ticket; a service that is told it binds the ticket to it rather than guessing.
|
|
79
|
+
*/
|
|
80
|
+
origin: z.ZodOptional<z.ZodString>;
|
|
81
|
+
/**
|
|
82
|
+
* The bridge the page must dial (`ws://127.0.0.1:<port>/reticle` for the daemon's own): the
|
|
83
|
+
* ticket's `bridge`. Optional for the same reason; absent, the service builds it from `bridgePort`.
|
|
84
|
+
*/
|
|
85
|
+
bridge: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
scope: "observe" | "act";
|
|
88
|
+
nonce: string;
|
|
89
|
+
workspaceId: string;
|
|
90
|
+
bridgePort: number;
|
|
91
|
+
origin?: string | undefined;
|
|
92
|
+
bridge?: string | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
scope: "observe" | "act";
|
|
95
|
+
nonce: string;
|
|
96
|
+
workspaceId: string;
|
|
97
|
+
bridgePort: number;
|
|
98
|
+
origin?: string | undefined;
|
|
99
|
+
bridge?: string | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
export type ProductionTicketRequest = z.infer<typeof ProductionTicketRequestSchema>;
|
|
102
|
+
export declare const ProductionTicketResponseSchema: z.ZodObject<{
|
|
103
|
+
/** Signed by the service (format: `activation-ticket.ts`). The lease opens `<url>?reticle_activate=<ticket>`. */
|
|
104
|
+
ticket: z.ZodString;
|
|
105
|
+
/** When the ticket must be redeemed by (ISO 8601). Informational. */
|
|
106
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
107
|
+
/** The service's own refused requests for this drive. Absent: `DEFAULT_PRODUCTION_POLICY`. */
|
|
108
|
+
policy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
rule: z.ZodEnum<["payment or checkout", "delete a workspace or project", "revoke or rotate a key", "send an invite or email", "cancel a subscription", "change a member's role"]>;
|
|
110
|
+
methods: z.ZodArray<z.ZodString, "many">;
|
|
111
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
path: string;
|
|
114
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
115
|
+
methods: string[];
|
|
116
|
+
}, {
|
|
117
|
+
path: string;
|
|
118
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
119
|
+
methods: string[];
|
|
120
|
+
}>, "many">>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
ticket: string;
|
|
123
|
+
expiresAt?: string | undefined;
|
|
124
|
+
policy?: {
|
|
125
|
+
path: string;
|
|
126
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
127
|
+
methods: string[];
|
|
128
|
+
}[] | undefined;
|
|
129
|
+
}, {
|
|
130
|
+
ticket: string;
|
|
131
|
+
expiresAt?: string | undefined;
|
|
132
|
+
policy?: {
|
|
133
|
+
path: string;
|
|
134
|
+
rule: "payment or checkout" | "delete a workspace or project" | "revoke or rotate a key" | "send an invite or email" | "cancel a subscription" | "change a member's role";
|
|
135
|
+
methods: string[];
|
|
136
|
+
}[] | undefined;
|
|
137
|
+
}>;
|
|
138
|
+
export type ProductionTicketResponse = z.infer<typeof ProductionTicketResponseSchema>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { 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,9 +72,13 @@ 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";
|
|
80
|
+
/** Where the user stands: sign-in, project link, plan, credits, Harness. */
|
|
81
|
+
readonly ACCOUNT: "reticle_account";
|
|
78
82
|
/** The team's shared memory, read on demand — see memory/memory-tools.ts. */
|
|
79
83
|
readonly MEMORY: "reticle_memory";
|
|
80
84
|
/** explicitly record a run outcome (the manual companion to auto-recording). */
|
package/dist/wire/tool-names.js
CHANGED
|
@@ -82,9 +82,13 @@ 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',
|
|
90
|
+
/** Where the user stands: sign-in, project link, plan, credits, Harness. */
|
|
91
|
+
ACCOUNT: 'reticle_account',
|
|
88
92
|
/** The team's shared memory, read on demand — see memory/memory-tools.ts. */
|
|
89
93
|
MEMORY: 'reticle_memory',
|
|
90
94
|
/** explicitly record a run outcome (the manual companion to auto-recording). */
|