sealmetrics 0.1.0 → 0.1.2

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 (86) hide show
  1. package/PROTOCOL.md +69 -3
  2. package/dist/agent/ndjson.d.ts +111 -0
  3. package/dist/agent/ndjson.d.ts.map +1 -0
  4. package/dist/agent/ndjson.js +112 -0
  5. package/dist/agent/ndjson.js.map +1 -0
  6. package/dist/api/client.d.ts +28 -0
  7. package/dist/api/client.d.ts.map +1 -0
  8. package/dist/api/client.js +147 -0
  9. package/dist/api/client.js.map +1 -0
  10. package/dist/cli.d.ts +37 -0
  11. package/dist/cli.d.ts.map +1 -0
  12. package/dist/cli.js +172 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/commands/init.d.ts +17 -0
  15. package/dist/commands/init.d.ts.map +1 -0
  16. package/dist/commands/init.js +631 -0
  17. package/dist/commands/init.js.map +1 -0
  18. package/dist/config/env.d.ts +7 -0
  19. package/dist/config/env.d.ts.map +1 -0
  20. package/dist/config/env.js +74 -0
  21. package/dist/config/env.js.map +1 -0
  22. package/dist/config/gitignore.d.ts +5 -0
  23. package/dist/config/gitignore.d.ts.map +1 -0
  24. package/dist/config/gitignore.js +17 -0
  25. package/dist/config/gitignore.js.map +1 -0
  26. package/dist/config/seal-config.d.ts +10 -0
  27. package/dist/config/seal-config.d.ts.map +1 -0
  28. package/dist/config/seal-config.js +75 -0
  29. package/dist/config/seal-config.js.map +1 -0
  30. package/dist/detect/cms.d.ts +5 -0
  31. package/dist/detect/cms.d.ts.map +1 -0
  32. package/dist/detect/cms.js +52 -0
  33. package/dist/detect/cms.js.map +1 -0
  34. package/dist/detect/index.d.ts +5 -0
  35. package/dist/detect/index.d.ts.map +1 -0
  36. package/dist/detect/index.js +155 -0
  37. package/dist/detect/index.js.map +1 -0
  38. package/dist/embedded.d.ts +27 -0
  39. package/dist/embedded.d.ts.map +1 -0
  40. package/dist/embedded.js +27 -0
  41. package/dist/embedded.js.map +1 -0
  42. package/dist/exit-codes.d.ts +36 -0
  43. package/dist/exit-codes.d.ts.map +1 -0
  44. package/dist/exit-codes.js +41 -0
  45. package/dist/exit-codes.js.map +1 -0
  46. package/dist/fs/safe-write.d.ts +63 -0
  47. package/dist/fs/safe-write.d.ts.map +1 -0
  48. package/dist/fs/safe-write.js +229 -0
  49. package/dist/fs/safe-write.js.map +1 -0
  50. package/dist/generated/guide.d.ts +2 -0
  51. package/dist/generated/guide.d.ts.map +1 -0
  52. package/dist/generated/guide.js +5 -0
  53. package/dist/generated/guide.js.map +1 -0
  54. package/dist/handoff/install.d.ts +20 -0
  55. package/dist/handoff/install.d.ts.map +1 -0
  56. package/dist/handoff/install.js +164 -0
  57. package/dist/handoff/install.js.map +1 -0
  58. package/dist/index.d.ts +3 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +76 -0
  61. package/dist/index.js.map +1 -0
  62. package/dist/instrument/guide.d.ts +6 -0
  63. package/dist/instrument/guide.d.ts.map +1 -0
  64. package/dist/instrument/guide.js +38 -0
  65. package/dist/instrument/guide.js.map +1 -0
  66. package/dist/mcp/configure.d.ts +31 -0
  67. package/dist/mcp/configure.d.ts.map +1 -0
  68. package/dist/mcp/configure.js +121 -0
  69. package/dist/mcp/configure.js.map +1 -0
  70. package/dist/prompts.d.ts +13 -0
  71. package/dist/prompts.d.ts.map +1 -0
  72. package/dist/prompts.js +29 -0
  73. package/dist/prompts.js.map +1 -0
  74. package/dist/types.d.ts +70 -0
  75. package/dist/types.d.ts.map +1 -0
  76. package/dist/types.js +3 -0
  77. package/dist/types.js.map +1 -0
  78. package/dist/verify/pixel.d.ts +27 -0
  79. package/dist/verify/pixel.d.ts.map +1 -0
  80. package/dist/verify/pixel.js +53 -0
  81. package/dist/verify/pixel.js.map +1 -0
  82. package/dist/version.d.ts +2 -0
  83. package/dist/version.d.ts.map +1 -0
  84. package/dist/version.js +16 -0
  85. package/dist/version.js.map +1 -0
  86. package/package.json +3 -2
package/PROTOCOL.md CHANGED
@@ -5,6 +5,12 @@ object terminated by `\n` (never multiline). Debug logs go to **stderr** only.
5
5
  An orchestrating agent parses the stream line by line and renders progress,
6
6
  diffs and the claim URL to its user.
7
7
 
8
+ > **Report only what actually happened.** Treat the **exit code** as the source of
9
+ > truth: success is a terminal `result` event with exit `0`. On a non-zero exit or
10
+ > an `error` event, STOP and report the failure — never fabricate a success summary
11
+ > (account id, files, snippet) from what the CLI *would* have done. See
12
+ > "Error-handling contract" below.
13
+
8
14
  ## Envelope
9
15
 
10
16
  ```json
@@ -14,7 +20,7 @@ diffs and the claim URL to its user.
14
20
  | Field | Meaning |
15
21
  |---------|---------|
16
22
  | `v` | Protocol version (currently `1`). Bumped on breaking changes so parsers can branch. |
17
- | `type` | `lifecycle` \| `file_change` \| `needs_input` \| `result` \| `error` |
23
+ | `type` | `lifecycle` \| `file_change` \| `needs_input` \| `confirm` \| `result` \| `error` |
18
24
  | `level` | `info` \| `warn` \| `error` |
19
25
  | `data` | Type-specific payload (below). |
20
26
 
@@ -49,14 +55,53 @@ artefacts (`.env`, `seal.config.json`, `.sealmetrics/*`, MCP config, `.gitignore
49
55
  `action` is `plan` (with `diff`) before the write and `applied` after.
50
56
 
51
57
  ### `needs_input`
52
- In `--agent` every prompt is **auto-resolved** (from flags or a safe default)
53
- and the resolution is reported the stream never blocks on stdin.
58
+ The stream never blocks on stdin. There are **two** kinds, distinguished by the
59
+ payload do not treat them the same:
60
+
61
+ 1. **Auto-resolved** — carries `resolved`. The CLI already picked a safe value
62
+ (from a flag or a safe default) and reports it. The orchestrator just renders
63
+ it; nothing to ask.
64
+ 2. **Human-required** — carries `"requires_human": true` and **no** `resolved`.
65
+ The orchestrator **MUST ask the human** and **MUST NOT** auto-resolve, guess,
66
+ or accept on their behalf. This overrides the `--agent` auto-approve. After
67
+ collecting the answers, re-invoke the CLI with the corresponding flags.
68
+ These intentionally carry **no `default`** — there is no value to reuse, so do
69
+ not pre-fill or assume one; ask. `optional: true` means the human may leave it
70
+ blank (e.g. domain), but must still be offered the choice.
71
+
72
+ > Never auto-accept the Terms of Service (`id: "accept_tos"`) or invent an email /
73
+ > site name — those are `requires_human`. Provisioning creates a real account.
54
74
 
55
75
  ```json
76
+ // auto-resolved
56
77
  { "v":1, "type":"needs_input", "level":"info",
57
78
  "data": { "id":"…", "prompt":"…", "default":"…", "resolved":"…" } }
79
+
80
+ // human-required (ask the user; do not guess)
81
+ { "v":1, "type":"needs_input", "level":"info",
82
+ "data": { "id":"accept_tos", "prompt":"Accept the Terms of Service (…)?",
83
+ "options":["yes","no"], "requires_human": true } }
84
+ ```
85
+
86
+ ### `confirm`
87
+ Two-phase commit. In `--agent`, the first run does **not** provision: once all
88
+ required inputs are present it emits a `confirm` with the **exact payload** a real
89
+ run would send, then exits `6` (CONFIRM_REQUIRED) having created nothing and
90
+ written no files. The orchestrator **MUST** show these values to the human and,
91
+ **only on an explicit yes**, re-run the command in `data.reinvoke_with` (it adds
92
+ `--confirm`). Never add `--confirm` yourself or assume approval.
93
+
94
+ ```json
95
+ { "v":1, "type":"confirm", "level":"info",
96
+ "data": { "action":"create_free_account", "email":"…", "site_name":"…",
97
+ "domain":"…|null", "accept_tos":true, "base_url":"…",
98
+ "message":"Nothing has been created yet. …",
99
+ "reinvoke_with":"sealmetrics init --agent … --confirm" } }
58
100
  ```
59
101
 
102
+ `-y` (non-interactive scripting, not `--agent`) treats the flags as consent and
103
+ skips the gate. Interactive mode shows a summary + a `[Y/n]` prompt instead.
104
+
60
105
  ### `result`
61
106
  The final structured payload.
62
107
 
@@ -82,4 +127,25 @@ The final structured payload.
82
127
  | `3` | `AUTH_REQUIRED` — provision key invalid/revoked (`error.data.command` carries the re-invocation) |
83
128
  | `4` | Network / backend unavailable / rate-limited / kill-switch (503) |
84
129
  | `5` | Verify-failed — snippet placed but pixel did not confirm within the timeout |
130
+ | `6` | Confirm-required — `--agent` previewed the payload (`confirm` event); re-run with `--confirm` to provision |
85
131
  | `130`| Cancelled (SIGINT) |
132
+
133
+ ## Error-handling contract (orchestrators MUST follow)
134
+
135
+ The CLI signals failure in **two** redundant ways. An orchestrator MUST honor both:
136
+
137
+ 1. A **non-zero exit code** (table above), and
138
+ 2. An **`error` event** on the stream (`"type":"error"`).
139
+
140
+ On either signal, the orchestrator **MUST STOP and report the failure to the user**
141
+ — quoting `error.data.message` (and `hint`/`command` if present). It **MUST NOT**:
142
+
143
+ - claim the account was created,
144
+ - describe files as written, or
145
+ - show an `account_id` / snippet / claim URL,
146
+
147
+ unless it actually saw a **`result` event AND exit code `0`**. Success is **only** a
148
+ terminal `result` with exit `0`; anything else is a failure. On failure no account
149
+ is created and **no files are written** (the CLI writes its artefacts only after a
150
+ successful provision). Never fabricate a success summary from expected behaviour —
151
+ report exactly what the stream and exit code say.
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Output layer (Bloque 2). In `--agent` mode every stdout line is a versioned
3
+ * NDJSON envelope `{ v, type, level, data }` (RF-201/202/205); in human mode
4
+ * stdout is plain text (VAL-202). Debug logs always go to stderr (RF-201).
5
+ *
6
+ * Each envelope is a single line terminated by `\n` — never multiline
7
+ * (VAL-201), so an orchestrator can parse the stream line by line.
8
+ */
9
+ export declare const PROTOCOL_VERSION = 1;
10
+ export type EventType = "lifecycle" | "file_change" | "needs_input" | "confirm" | "result" | "error";
11
+ export type Level = "info" | "warn" | "error";
12
+ export interface Envelope {
13
+ v: number;
14
+ type: EventType;
15
+ level: Level;
16
+ data: Record<string, unknown>;
17
+ }
18
+ export interface FileChange {
19
+ path: string;
20
+ action: "plan" | "applied";
21
+ diff?: string;
22
+ bytes?: number;
23
+ }
24
+ export interface NeedsInput {
25
+ id: string;
26
+ prompt: string;
27
+ default?: string;
28
+ options?: string[];
29
+ /** Auto-resolved value (RF-203). Present ONLY for inputs the agent may resolve
30
+ * on its own; its presence is what makes auto-approve legal for this input. */
31
+ resolved?: string;
32
+ /** When true, the orchestrator MUST ask the human and MUST NOT auto-resolve,
33
+ * guess, or accept on their behalf (e.g. Terms of Service, identity fields).
34
+ * Such inputs never carry `resolved`. */
35
+ requires_human?: boolean;
36
+ /** When true, the human may leave this blank (e.g. domain). Informational. */
37
+ optional?: boolean;
38
+ }
39
+ export interface ErrorData {
40
+ code: string;
41
+ message: string;
42
+ hint?: string;
43
+ [key: string]: unknown;
44
+ }
45
+ /**
46
+ * The exact payload a real provision WOULD send, surfaced before anything is
47
+ * created (two-phase commit). The orchestrator MUST show this to the human and,
48
+ * only on an explicit yes, re-invoke with `--confirm`. Nothing is created and no
49
+ * files are written until then.
50
+ */
51
+ export interface ConfirmData {
52
+ action: string;
53
+ email: string;
54
+ site_name: string;
55
+ domain: string | null;
56
+ accept_tos: boolean;
57
+ base_url: string;
58
+ message: string;
59
+ reinvoke_with: string;
60
+ }
61
+ /**
62
+ * Reporter contract shared by the agent (NDJSON) and human renderers so the
63
+ * orchestrator logic in `init.ts` never branches on output mode.
64
+ */
65
+ export interface Reporter {
66
+ readonly agent: boolean;
67
+ lifecycle(stage: string, data?: Record<string, unknown>, level?: Level): void;
68
+ fileChange(change: FileChange): void;
69
+ needsInput(input: NeedsInput): void;
70
+ /** Preview of what a real provision would send — emitted before creating
71
+ * anything, so the human can approve it (two-phase commit). */
72
+ confirm(data: ConfirmData): void;
73
+ result(data: Record<string, unknown>): void;
74
+ error(data: ErrorData): void;
75
+ /** Human-facing info text. Suppressed in agent mode (kept off the NDJSON stream). */
76
+ info(message: string): void;
77
+ warn(message: string): void;
78
+ /** Debug — always stderr, never stdout. */
79
+ debug(message: string): void;
80
+ }
81
+ /** NDJSON reporter used in `--agent` mode. */
82
+ export declare class AgentReporter implements Reporter {
83
+ readonly agent = true;
84
+ private emit;
85
+ lifecycle(stage: string, data?: Record<string, unknown>, level?: Level): void;
86
+ fileChange(change: FileChange): void;
87
+ needsInput(input: NeedsInput): void;
88
+ confirm(data: ConfirmData): void;
89
+ result(data: Record<string, unknown>): void;
90
+ error(data: ErrorData): void;
91
+ info(_message: string): void;
92
+ warn(message: string): void;
93
+ debug(message: string): void;
94
+ }
95
+ /** Human reporter used in interactive / `-y` mode (VAL-202). */
96
+ export declare class HumanReporter implements Reporter {
97
+ readonly agent = false;
98
+ private readonly color;
99
+ constructor();
100
+ private c;
101
+ lifecycle(stage: string, data?: Record<string, unknown>): void;
102
+ fileChange(change: FileChange): void;
103
+ needsInput(input: NeedsInput): void;
104
+ confirm(_data: ConfirmData): void;
105
+ result(data: Record<string, unknown>): void;
106
+ error(data: ErrorData): void;
107
+ info(message: string): void;
108
+ warn(message: string): void;
109
+ debug(message: string): void;
110
+ }
111
+ //# sourceMappingURL=ndjson.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndjson.d.ts","sourceRoot":"","sources":["../../src/agent/ndjson.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,MAAM,MAAM,SAAS,GACjB,WAAW,GACX,aAAa,GACb,aAAa,GACb,SAAS,GACT,QAAQ,GACR,OAAO,CAAC;AAEZ,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9C,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;oFACgF;IAChF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,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAW3C,KAAK,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI;IAK5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAI3B,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAG7B"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Output layer (Bloque 2). In `--agent` mode every stdout line is a versioned
3
+ * NDJSON envelope `{ v, type, level, data }` (RF-201/202/205); in human mode
4
+ * stdout is plain text (VAL-202). Debug logs always go to stderr (RF-201).
5
+ *
6
+ * Each envelope is a single line terminated by `\n` — never multiline
7
+ * (VAL-201), so an orchestrator can parse the stream line by line.
8
+ */
9
+ export const PROTOCOL_VERSION = 1;
10
+ function write(line) {
11
+ process.stdout.write(line + "\n");
12
+ }
13
+ /** Result fields that must never be printed, even if a caller includes them (VAL-404). */
14
+ const BLOCKED_RESULT_KEYS = new Set(["api_key", "apiKey", "provision_key", "provisionKey"]);
15
+ /** NDJSON reporter used in `--agent` mode. */
16
+ export class AgentReporter {
17
+ agent = true;
18
+ emit(type, level, data) {
19
+ const env = { v: PROTOCOL_VERSION, type, level, data };
20
+ write(JSON.stringify(env));
21
+ }
22
+ lifecycle(stage, data = {}, level = "info") {
23
+ this.emit("lifecycle", level, { stage, ...data });
24
+ }
25
+ fileChange(change) {
26
+ this.emit("file_change", "info", { ...change });
27
+ }
28
+ needsInput(input) {
29
+ this.emit("needs_input", "info", { ...input });
30
+ }
31
+ confirm(data) {
32
+ this.emit("confirm", "info", { ...data });
33
+ }
34
+ result(data) {
35
+ this.emit("result", "info", data);
36
+ }
37
+ error(data) {
38
+ this.emit("error", "error", data);
39
+ }
40
+ info(_message) {
41
+ // No human prose on the NDJSON stream (RF-201). Route to stderr for debugging.
42
+ process.stderr.write(_message + "\n");
43
+ }
44
+ warn(message) {
45
+ process.stderr.write(message + "\n");
46
+ }
47
+ debug(message) {
48
+ if (process.env.SEALMETRICS_DEBUG)
49
+ process.stderr.write(message + "\n");
50
+ }
51
+ }
52
+ const bold = (s) => `\x1b[1m${s}\x1b[0m`;
53
+ const dim = (s) => `\x1b[2m${s}\x1b[0m`;
54
+ const green = (s) => `\x1b[32m${s}\x1b[0m`;
55
+ const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
56
+ const red = (s) => `\x1b[31m${s}\x1b[0m`;
57
+ /** Human reporter used in interactive / `-y` mode (VAL-202). */
58
+ export class HumanReporter {
59
+ agent = false;
60
+ color;
61
+ constructor() {
62
+ this.color = process.stdout.isTTY === true && !process.env.NO_COLOR;
63
+ }
64
+ c(fn, s) {
65
+ return this.color ? fn(s) : s;
66
+ }
67
+ lifecycle(stage, data = {}) {
68
+ const detail = data["detail"] ?? data["framework"] ?? data["account_id"] ?? "";
69
+ const suffix = detail ? this.c(dim, ` ${detail}`) : "";
70
+ write(`${this.c(green, "→")} ${stage}${suffix}`);
71
+ }
72
+ fileChange(change) {
73
+ const verb = change.action === "applied" ? "wrote" : "plan";
74
+ write(` ${this.c(dim, verb)} ${change.path}`);
75
+ }
76
+ needsInput(input) {
77
+ if (input.resolved !== undefined) {
78
+ write(` ${this.c(dim, input.prompt)} ${input.resolved}`);
79
+ }
80
+ }
81
+ confirm(_data) {
82
+ // Human mode confirms via an interactive prompt (see init.ts), not this event.
83
+ }
84
+ result(data) {
85
+ write("");
86
+ write(this.c(bold, "Done."));
87
+ for (const [k, v] of Object.entries(data)) {
88
+ if (v === undefined || v === null)
89
+ continue;
90
+ // Defensive denylist: never print a secret even if a caller mis-includes one.
91
+ if (BLOCKED_RESULT_KEYS.has(k))
92
+ continue;
93
+ write(` ${this.c(dim, k + ":")} ${String(v)}`);
94
+ }
95
+ }
96
+ error(data) {
97
+ write(`${this.c(red, "✗")} ${data.message}`);
98
+ if (data.hint)
99
+ write(` ${this.c(dim, data.hint)}`);
100
+ }
101
+ info(message) {
102
+ write(message);
103
+ }
104
+ warn(message) {
105
+ write(this.c(yellow, message));
106
+ }
107
+ debug(message) {
108
+ if (process.env.SEALMETRICS_DEBUG)
109
+ process.stderr.write(message + "\n");
110
+ }
111
+ }
112
+ //# sourceMappingURL=ndjson.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ndjson.js","sourceRoot":"","sources":["../../src/agent/ndjson.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAuFlC,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,0FAA0F;AAC1F,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;AAE5F,8CAA8C;AAC9C,MAAM,OAAO,aAAa;IACf,KAAK,GAAG,IAAI,CAAC;IAEd,IAAI,CAAC,IAAe,EAAE,KAAY,EAAE,IAA6B;QACvE,MAAM,GAAG,GAAa,EAAE,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACjE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,CAAC;IAED,SAAS,CAAC,KAAa,EAAE,OAAgC,EAAE,EAAE,QAAe,MAAM;QAChF,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,UAAU,CAAC,MAAkB;QAC3B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,MAAM,EA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;CACF"}
@@ -0,0 +1,28 @@
1
+ import type { ProvisionResult, PixelStatus } from "../types.js";
2
+ /** Raised on 409 (email already exists) — init handles it as informative, exit 0 (RF-402). */
3
+ export declare class EmailExistsError extends Error {
4
+ constructor();
5
+ }
6
+ export interface ProvisionInput {
7
+ siteName: string;
8
+ domain?: string;
9
+ email: string;
10
+ name?: string;
11
+ installSource: string;
12
+ timezone?: string;
13
+ /** Args to surface in the AUTH_REQUIRED re-invocation command (RF-204). */
14
+ reinvokeCommand?: string;
15
+ }
16
+ export declare class ApiClient {
17
+ private readonly baseUrl;
18
+ private readonly provisionKey;
19
+ constructor(baseUrl: string, provisionKey: string);
20
+ /** POST /provision. Throws CliError (3/4) or EmailExistsError on the mapped statuses. */
21
+ provision(input: ProvisionInput): Promise<ProvisionResult>;
22
+ /** GET /sites/{id}/pixel/status. Throws CliError(4) on network/backend errors. */
23
+ pixelStatus(accountId: string, apiKey: string): Promise<PixelStatus>;
24
+ private fetchWithTimeout;
25
+ private json;
26
+ private safeText;
27
+ }
28
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAIhE,8FAA8F;AAC9F,qBAAa,gBAAiB,SAAQ,KAAK;;CAK1C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AASD,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;IAKjD,yFAAyF;IACnF,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IA+EhE,kFAAkF;IAC5E,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;YA2B5D,gBAAgB;YAUhB,IAAI;YASJ,QAAQ;CAOvB"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * HTTP client for the Fase 1 backend (Bloque 4). Consumes, never changes, the
3
+ * existing contract: POST /provision (X-Provision-Key) and
4
+ * GET /sites/{id}/pixel/status (X-API-Key). Response maps to events/exit codes
5
+ * per RF-402.
6
+ */
7
+ import { CliError, ExitCode } from "../exit-codes.js";
8
+ const DEFAULT_TIMEOUT_MS = 30_000;
9
+ /** Raised on 409 (email already exists) — init handles it as informative, exit 0 (RF-402). */
10
+ export class EmailExistsError extends Error {
11
+ constructor() {
12
+ super("provision_unavailable");
13
+ this.name = "EmailExistsError";
14
+ }
15
+ }
16
+ export class ApiClient {
17
+ baseUrl;
18
+ provisionKey;
19
+ constructor(baseUrl, provisionKey) {
20
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
21
+ this.provisionKey = provisionKey;
22
+ }
23
+ /** POST /provision. Throws CliError (3/4) or EmailExistsError on the mapped statuses. */
24
+ async provision(input) {
25
+ const body = {
26
+ site_name: input.siteName,
27
+ domain: input.domain,
28
+ email: input.email,
29
+ name: input.name,
30
+ accept_terms: true,
31
+ install_source: input.installSource,
32
+ timezone: input.timezone,
33
+ };
34
+ let res;
35
+ try {
36
+ res = await this.fetchWithTimeout(`${this.baseUrl}/provision`, {
37
+ method: "POST",
38
+ headers: {
39
+ "Content-Type": "application/json",
40
+ Accept: "application/json",
41
+ "X-Provision-Key": this.provisionKey,
42
+ },
43
+ body: JSON.stringify(body),
44
+ });
45
+ }
46
+ catch (e) {
47
+ throw new CliError(ExitCode.NETWORK, "network_error", `Could not reach the SealMetrics API at ${this.baseUrl}.`, {
48
+ hint: e instanceof Error ? e.message : undefined,
49
+ });
50
+ }
51
+ if (res.status === 200) {
52
+ const json = (await this.json(res));
53
+ const data = json.data;
54
+ if (!data || !data.account_id || !data.api_key) {
55
+ throw new CliError(ExitCode.NETWORK, "bad_response", "Provisioning returned an unexpected response.");
56
+ }
57
+ return data;
58
+ }
59
+ if (res.status === 401) {
60
+ throw new CliError(ExitCode.AUTH_REQUIRED, "AUTH_REQUIRED", "The provision key was rejected (invalid or revoked).", {
61
+ hint: "Re-run with a valid publishable provision key.",
62
+ extra: {
63
+ command: input.reinvokeCommand ??
64
+ "npx sealmetrics init --provision-key <YOUR_KEY> --email <email> --accept-tos",
65
+ },
66
+ });
67
+ }
68
+ if (res.status === 409) {
69
+ throw new EmailExistsError();
70
+ }
71
+ if (res.status === 429) {
72
+ const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
73
+ throw new CliError(ExitCode.NETWORK, "rate_limited", "Provisioning is rate-limited. Please wait and retry.", {
74
+ extra: retryAfter ? { retry_after: retryAfter } : undefined,
75
+ });
76
+ }
77
+ if (res.status === 503) {
78
+ throw new CliError(ExitCode.NETWORK, "provisioning_disabled", "Provisioning is currently disabled on the server.", { hint: "The free-tier channel is not enabled yet. Try again later." });
79
+ }
80
+ const detail = await this.safeText(res);
81
+ throw new CliError(ExitCode.NETWORK, "backend_error", `Provisioning failed (HTTP ${res.status}).`, {
82
+ hint: detail.slice(0, 200) || undefined,
83
+ });
84
+ }
85
+ /** GET /sites/{id}/pixel/status. Throws CliError(4) on network/backend errors. */
86
+ async pixelStatus(accountId, apiKey) {
87
+ const url = `${this.baseUrl}/sites/${encodeURIComponent(accountId)}/pixel/status`;
88
+ let res;
89
+ try {
90
+ res = await this.fetchWithTimeout(url, {
91
+ method: "GET",
92
+ headers: { "X-API-Key": apiKey, Accept: "application/json" },
93
+ });
94
+ }
95
+ catch (e) {
96
+ throw new CliError(ExitCode.NETWORK, "network_error", "Could not reach the SealMetrics API.", {
97
+ hint: e instanceof Error ? e.message : undefined,
98
+ });
99
+ }
100
+ if (res.status !== 200) {
101
+ const detail = await this.safeText(res);
102
+ throw new CliError(ExitCode.NETWORK, "pixel_status_error", `Pixel status check failed (HTTP ${res.status}).`, {
103
+ hint: detail.slice(0, 200) || undefined,
104
+ });
105
+ }
106
+ const json = (await this.json(res));
107
+ const data = json.data;
108
+ if (!data || typeof data.installed !== "boolean") {
109
+ throw new CliError(ExitCode.NETWORK, "bad_response", "Pixel status returned an unexpected response.");
110
+ }
111
+ return data;
112
+ }
113
+ async fetchWithTimeout(url, init) {
114
+ const controller = new AbortController();
115
+ const timeout = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT_MS);
116
+ try {
117
+ return await fetch(url, { ...init, signal: controller.signal });
118
+ }
119
+ finally {
120
+ clearTimeout(timeout);
121
+ }
122
+ }
123
+ async json(res) {
124
+ const text = await res.text();
125
+ try {
126
+ return JSON.parse(text);
127
+ }
128
+ catch {
129
+ throw new CliError(ExitCode.NETWORK, "bad_response", "The API returned invalid JSON.");
130
+ }
131
+ }
132
+ async safeText(res) {
133
+ try {
134
+ return await res.text();
135
+ }
136
+ catch {
137
+ return "";
138
+ }
139
+ }
140
+ }
141
+ function parseRetryAfter(header) {
142
+ if (!header)
143
+ return undefined;
144
+ const n = parseInt(header, 10);
145
+ return Number.isFinite(n) && n > 0 ? n : undefined;
146
+ }
147
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGtD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC,8FAA8F;AAC9F,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC;QACE,KAAK,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,CAAC;QACzF,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,QAAQ,CAAC,GAAa;QAClC,IAAI,CAAC;YACH,OAAO,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AAED,SAAS,eAAe,CAAC,MAAqB;IAC5C,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ export interface InitOptions {
2
+ email?: string;
3
+ name?: string;
4
+ siteName?: string;
5
+ domain?: string;
6
+ acceptTos: boolean;
7
+ installSource: string;
8
+ baseUrl: string;
9
+ region?: string;
10
+ agent: boolean;
11
+ yes: boolean;
12
+ resume: boolean;
13
+ dryRun: boolean;
14
+ confirm: boolean;
15
+ apiKey?: string;
16
+ provisionKey?: string;
17
+ noInject: boolean;
18
+ url?: string;
19
+ verifyTimeout: number;
20
+ editor?: string;
21
+ noMcp: boolean;
22
+ cwd: string;
23
+ }
24
+ /** Default backend per region; the published binary defaults to PROD (PRE-3). */
25
+ export declare const REGION_BASE_URLS: Record<string, string>;
26
+ export interface ParseResult {
27
+ options?: InitOptions;
28
+ help?: boolean;
29
+ version?: boolean;
30
+ }
31
+ /**
32
+ * Parse argv (already sliced past `node script init`). The leading subcommand
33
+ * (`init`) is tolerated if present.
34
+ */
35
+ export declare function parseArgs(argv: string[]): ParseResult;
36
+ export declare function helpText(): string;
37
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,iFAAiF;AACjF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOnD,CAAC;AA4CF,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAkBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,WAAW,CAkGrD;AAMD,wBAAgB,QAAQ,IAAI,MAAM,CAEjC"}