ovrule-lab 0.1.3 → 0.2.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/README.md CHANGED
@@ -8,6 +8,8 @@ TypeScript client for Ovrule case-file classification, guardrails, and receipt v
8
8
  npm install ovrule-lab
9
9
  ```
10
10
 
11
+ On the first successful `classify()` or `guard()` call in a process, the SDK prints a one-line ready message plus a permalink to the created case. Later successful audits print only the case permalink. Set `OVRULE_QUIET=1` to suppress those logs.
12
+
11
13
  ## 1. Simple classify
12
14
 
13
15
  ```ts
package/dist/index.js CHANGED
@@ -1,3 +1,31 @@
1
+ const DEFAULT_OVRULE_BASE_URL = "https://decision-receipt-lab.vercel.app";
2
+ let hasShownReadyMessage = false;
3
+ function isQuietModeEnabled() {
4
+ return (typeof process !== "undefined" &&
5
+ typeof process.env === "object" &&
6
+ typeof process.env.OVRULE_QUIET !== "undefined" &&
7
+ process.env.OVRULE_QUIET !== "");
8
+ }
9
+ function getConsoleBaseUrl(baseUrl) {
10
+ if (baseUrl) {
11
+ return baseUrl;
12
+ }
13
+ if (typeof window !== "undefined" && window.location?.origin) {
14
+ return window.location.origin;
15
+ }
16
+ return DEFAULT_OVRULE_BASE_URL;
17
+ }
18
+ function logSuccessfulAudit(receipt, baseUrl) {
19
+ if (isQuietModeEnabled()) {
20
+ return;
21
+ }
22
+ const caseUrl = `${getConsoleBaseUrl(baseUrl)}/case/${receipt.receiptId}`;
23
+ if (!hasShownReadyMessage) {
24
+ console.info(`[ovrule-lab v0.2.0] ready · docs: ${DEFAULT_OVRULE_BASE_URL}/docs`);
25
+ hasShownReadyMessage = true;
26
+ }
27
+ console.info(`[ovrule-lab] ✓ audited via ${caseUrl}`);
28
+ }
1
29
  function normalizeAction(action, options) {
2
30
  if (typeof action === "string") {
3
31
  return {
@@ -21,7 +49,7 @@ export class OvruleClient {
21
49
  baseUrl;
22
50
  fetchImpl;
23
51
  constructor(options = {}) {
24
- this.baseUrl = options.baseUrl?.replace(/\/$/, "") ?? "";
52
+ this.baseUrl = options.baseUrl?.replace(/\/$/, "") ?? DEFAULT_OVRULE_BASE_URL;
25
53
  this.fetchImpl = options.fetch ?? globalThis.fetch;
26
54
  if (!this.fetchImpl) {
27
55
  throw new Error("No fetch implementation available. Pass one in OvruleClient options.");
@@ -85,6 +113,7 @@ export class OvruleClient {
85
113
  if (!finalReceipt) {
86
114
  throw new Error("Ovrule classify stream finished without a final receipt.");
87
115
  }
116
+ logSuccessfulAudit(finalReceipt, this.baseUrl);
88
117
  return finalReceipt;
89
118
  }
90
119
  async guard(action, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ovrule-lab",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript SDK for Ovrule case-file classification, guardrails, and receipt verification.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,18 +14,12 @@
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
- "README.md",
18
- "postinstall.js",
19
- "bin/welcome.js"
17
+ "README.md"
20
18
  ],
21
- "bin": {
22
- "ovrule-lab": "./bin/welcome.js"
23
- },
24
19
  "scripts": {
25
20
  "build": "tsc -p tsconfig.json",
26
21
  "clean": "rm -rf dist",
27
- "prepublishOnly": "npm run clean && npm run build",
28
- "postinstall": "node postinstall.js"
22
+ "prepublishOnly": "npm run clean && npm run build"
29
23
  },
30
24
  "keywords": [
31
25
  "ovrule",
package/bin/welcome.js DELETED
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
-
4
- const reset = "\x1b[0m";
5
- const dim = "\x1b[2m";
6
- const bold = "\x1b[1m";
7
- const cyan = "\x1b[36m";
8
- const magenta = "\x1b[35m";
9
- const yellow = "\x1b[33m";
10
-
11
- const lines = [
12
- "",
13
- `${bold}${cyan} ╔═══════════════════════════════════════════════╗${reset}`,
14
- `${bold}${cyan} ║${reset} ${bold}O${reset}${magenta}━━${reset}${bold}V${reset} ${bold}Ovrule${reset} · SDK v0.1.3 ${bold}${cyan}║${reset}`,
15
- `${bold}${cyan} ║${reset} ${dim}Auditable receipts for AI agents${reset} ${bold}${cyan}║${reset}`,
16
- `${bold}${cyan} ╚═══════════════════════════════════════════════╝${reset}`,
17
- "",
18
- ` ${bold}Quickstart${reset}`,
19
- ` ${dim}import { classify } from "ovrule-lab";${reset}`,
20
- ` ${dim}const receipt = await classify("your agent action", {${reset}`,
21
- ` ${dim} baseUrl: "https://decision-receipt-lab.vercel.app"${reset}`,
22
- ` ${dim}});${reset}`,
23
- "",
24
- ` ${bold}Methods${reset}`,
25
- ` ${dim}classify(action, opts)${reset} — full case file audit`,
26
- ` ${dim}guard(action, opts)${reset} — returns { allowed, decision, ... }`,
27
- ` ${dim}verify(receipt, sig, opts)${reset} — verify a signed receipt`,
28
- "",
29
- ` ${bold}Docs${reset} ${yellow}https://decision-receipt-lab.vercel.app/docs${reset}`,
30
- ` ${bold}GitHub${reset} ${yellow}https://github.com/elakumuk/decision-receipt-lab${reset}`,
31
- "",
32
- ` ${dim}Built with Codex for the OpenAI Creator Challenge, April 2026.${reset}`,
33
- "",
34
- ];
35
-
36
- console.log(lines.join("\n"));
package/postinstall.js DELETED
@@ -1,41 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
-
4
- // Allow users to opt out
5
- if (process.env.OVRULE_SILENT) {
6
- process.exit(0);
7
- }
8
-
9
- // Skip in CI to avoid cluttering build logs
10
- if (process.env.CI) {
11
- process.exit(0);
12
- }
13
-
14
- const reset = "\x1b[0m";
15
- const dim = "\x1b[2m";
16
- const bold = "\x1b[1m";
17
- const cyan = "\x1b[36m";
18
- const magenta = "\x1b[35m";
19
- const yellow = "\x1b[33m";
20
-
21
- const lines = [
22
- "",
23
- `${bold}${cyan} ╔═══════════════════════════════════════════════╗${reset}`,
24
- `${bold}${cyan} ║${reset} ${bold}O${reset}${magenta}━━${reset}${bold}V${reset} ${bold}Ovrule${reset} · SDK v0.1.2 ${bold}${cyan}║${reset}`,
25
- `${bold}${cyan} ║${reset} ${dim}Auditable receipts for AI agents${reset} ${bold}${cyan}║${reset}`,
26
- `${bold}${cyan} ╚═══════════════════════════════════════════════╝${reset}`,
27
- "",
28
- ` ${bold}Quickstart${reset}`,
29
- ` ${dim}import { classify } from "ovrule-lab";${reset}`,
30
- ` ${dim}const receipt = await classify("your agent action", {${reset}`,
31
- ` ${dim} baseUrl: "https://decision-receipt-lab.vercel.app"${reset}`,
32
- ` ${dim}});${reset}`,
33
- "",
34
- ` ${bold}Docs${reset} ${yellow}https://decision-receipt-lab.vercel.app/docs${reset}`,
35
- ` ${bold}GitHub${reset} ${yellow}https://github.com/elakumuk/decision-receipt-lab${reset}`,
36
- "",
37
- ` ${dim}Built with Codex for the OpenAI Creator Challenge, April 2026.${reset}`,
38
- "",
39
- ];
40
-
41
- console.log(lines.join("\n"));