@surfaceapi/surface 0.0.0-stage → 0.1.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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -2
  3. package/index.js +29 -0
  4. package/package.json +28 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Canada Site Ops
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # Surface: check a short link before you open it
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![links checked | Surface](https://nova-otter-delta-cloud.grok.me/badge/surface.svg)](https://nova-otter-delta-cloud.grok.me)
4
+
5
+ [Surface](https://nova-otter-delta-cloud.grok.me) follows the hops on t.co, bit.ly, lnkd.in and youtu.be links (or any https URL) and says **fetch** or **skip**. It never returns the page, so it's one quick round trip.
6
+
7
+ Free for the first 1,000,000 requests every month, no card needed. After that: Preflight $0.25, Hop $0.40, Pixel $0.15, Inspect $0.20 per 1,000 requests (USD). Production plan with your own key and meter: $50 CAD/month ([billing](https://nova-otter-delta-cloud.grok.me/billing)).
8
+
9
+ [Get started](https://nova-otter-delta-cloud.grok.me/start) · [Docs](https://nova-otter-delta-cloud.grok.me/docs) · Free API key in 10 seconds: `curl -s -X POST https://nova-otter-delta-cloud.grok.me/v1/keys`
10
+
11
+ ## One install for Cursor or Claude (MCP)
12
+ Paste this into your MCP settings. The agent then calls `preflight_url` before it opens a short link.
13
+ ```json
14
+ { "mcpServers": { "surface": { "type": "http", "url": "https://nova-otter-delta-cloud.grok.me/mcp" } } }
15
+ ```
16
+
17
+ ## JavaScript
18
+ `npm install @surfaceapi/surface`
19
+ ```js
20
+ const { Surface } = require('@surfaceapi/surface');
21
+ const { key } = await new Surface().createKey(); // free key
22
+ const s = new Surface({ apiKey: key });
23
+ console.log(await s.preflight('https://youtu.be/jNQXAC9IVRw')); // next: fetch or skip
24
+ console.log(await s.inspect()); // bot, browser, or script
25
+ ```
26
+ Python: `pip install surfaceapi`
package/index.js ADDED
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+ const DEFAULT_BASE = 'https://nova-otter-delta-cloud.grok.me';
3
+ class Surface {
4
+ constructor({ apiKey, baseUrl = DEFAULT_BASE, headers = {} } = {}) {
5
+ this.apiKey = apiKey; this.baseUrl = baseUrl.replace(/\/$/, ''); this.headers = headers;
6
+ }
7
+ async _req(method, path, body) {
8
+ const h = { 'user-agent': 'surfaceapi-js/0.1.0', ...this.headers };
9
+ if (this.apiKey) h.authorization = 'Bearer ' + this.apiKey;
10
+ if (body) h['content-type'] = 'application/json';
11
+ const r = await fetch(this.baseUrl + path, { method, headers: h, body: body ? JSON.stringify(body) : undefined, redirect: 'manual' });
12
+ const t = await r.text(); let data; try { data = JSON.parse(t); } catch { data = t; }
13
+ if (r.status >= 400) { const e = new Error('Surface ' + r.status); e.status = r.status; e.data = data; throw e; }
14
+ return { status: r.status, location: r.headers.get('location'), data };
15
+ }
16
+ /** Get a free API key (first 1M requests/month free). */
17
+ async createKey(opts = {}) { return (await this._req('POST', '/v1/keys', opts)).data; }
18
+ /** Preflight a URL: reachability, status, redirects, headers. */
19
+ async preflight(url) { return (await this._req('POST', '/v1/preflight', { url })).data; }
20
+ /** Inspect the calling request as Surface sees it. */
21
+ async inspect() { return (await this._req('GET', '/v1/inspect')).data; }
22
+ /** Resolve a hop short link; returns the redirect target. */
23
+ async hop(code) { const r = await this._req('GET', '/h/' + encodeURIComponent(code)); return { status: r.status, location: r.location }; }
24
+ /** Pixel URL for embedding. */
25
+ pixelUrl(code) { return this.baseUrl + '/px/' + encodeURIComponent(code); }
26
+ /** Usage for your key. */
27
+ async usage() { return (await this._req('GET', '/v1/usage')).data; }
28
+ }
29
+ module.exports = { Surface, DEFAULT_BASE };
package/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "@surfaceapi/surface",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.1",
4
+ "description": "Check a short link before your agent opens it. Surface client: unwrap t.co/bit.ly/lnkd.in/youtu.be and get fetch or skip. 1M requests/month free.",
5
+ "main": "index.js",
6
+ "files": [
7
+ "index.js",
8
+ "README.md"
9
+ ],
10
+ "engines": {
11
+ "node": ">=18"
12
+ },
13
+ "keywords": [
14
+ "surface",
15
+ "short-link",
16
+ "unwrap",
17
+ "link-check",
18
+ "preflight",
19
+ "mcp",
20
+ "agents",
21
+ "redirect"
22
+ ],
23
+ "author": "Surface / Canada Site Ops <canada.site.ops@gmail.com>",
24
+ "license": "MIT",
25
+ "homepage": "https://nova-otter-delta-cloud.grok.me",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git+https://github.com/Surface-ops/surface.git",
29
+ "directory": "clients/js"
30
+ }
6
31
  }