@cobbl-ai/sdk 0.1.1 → 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.
package/README.md CHANGED
@@ -28,6 +28,27 @@ yarn add @cobbl-ai/sdk
28
28
  pnpm add @cobbl-ai/sdk
29
29
  ```
30
30
 
31
+ ### CDN / Script Tag
32
+
33
+ For use without a bundler, load the SDK via a `<script>` tag. This exposes `CobblPublicClient` on `window.Cobbl`:
34
+
35
+ ```html
36
+ <script src="https://cdn.jsdelivr.net/npm/@cobbl-ai/sdk"></script>
37
+
38
+ <script>
39
+ const client = new Cobbl.CobblPublicClient()
40
+
41
+ client.createFeedback({
42
+ runId: 'your-run-id',
43
+ helpful: 'helpful',
44
+ }).then(({ id }) => {
45
+ console.log('Feedback created:', id)
46
+ })
47
+ </script>
48
+ ```
49
+
50
+ > **Note:** Only `CobblPublicClient` is available via the CDN bundle. The `CobblAdminClient` requires an API key and should only be used server-side.
51
+
31
52
  ## Quick Start
32
53
 
33
54
  ```typescript
@@ -560,6 +581,7 @@ sdk/
560
581
  ├── src/
561
582
  │ ├── admin.ts # Admin API client
562
583
  │ ├── public.ts # Public API client
584
+ │ ├── browser.ts # Browser entry point (CDN/script tag)
563
585
  │ ├── errors.ts # Error classes
564
586
  │ ├── types.ts # Type definitions
565
587
  │ └── index.ts # Public exports
@@ -570,6 +592,7 @@ sdk/
570
592
  │ ├── admin.mjs # ES modules bundle (admin)
571
593
  │ ├── public.js # CommonJS bundle (public)
572
594
  │ ├── public.mjs # ES modules bundle (public)
595
+ │ ├── cobbl-sdk.global.js # IIFE bundle for CDN/script tag
573
596
  │ └── *.d.ts # TypeScript declarations
574
597
  ├── tsup.config.ts # Build configuration
575
598
  ├── package.json
@@ -609,9 +632,8 @@ pnpm publish --tag beta --access public
609
632
  ## Support
610
633
 
611
634
  - 📧 Email: support@cobbl.ai
612
- - 🐛 Issues: [GitHub Issues](https://github.com/your-org/cobbl-ai/issues)
635
+ - 🐛 Issues: [GitHub Issues](https://github.com/cobbl-ai/sdk/issues)
613
636
  - 📚 Documentation: [docs.cobbl.ai](https://docs.cobbl.ai)
614
- - 💬 Discord: [Join our community](https://discord.gg/cobbl)
615
637
 
616
638
  ## License
617
639
 
@@ -0,0 +1,2 @@
1
+ "use strict";var Cobbl=(()=>{var u=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var m=(e,r)=>{for(var t in r)u(e,t,{get:r[t],enumerable:!0})},w=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of h(r))!E.call(e,a)&&a!==t&&u(e,a,{get:()=>r[a],enumerable:!(s=f(r,a))||s.enumerable});return e};var F=e=>w(u({},"__esModule",{value:!0}),e);var C={};m(C,{CobblPublicClient:()=>l});var o=class e extends Error{constructor(r,t,s){super(r),this.name="CobblError",this.code=t,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,e)}static isCobblError(r){return r instanceof e}toJSON(){return{name:this.name,message:this.message,code:this.code,details:this.details}}},c=async e=>{let r;try{r=await e.json()}catch(a){throw new o(`HTTP ${e.status}: ${e.statusText}`,"API_ERROR",{status:e.status})}let t=r.error||r.message||"Unknown error",s=r.details;switch(e.status){case 400:throw new o(t,"INVALID_REQUEST",s);case 401:throw new o(t,"UNAUTHORIZED",s);case 403:throw new o(t,"FORBIDDEN",s);case 404:throw new o(t,"NOT_FOUND",s);case 410:throw new o(t,"ARCHIVED",s);case 429:throw new o(t,"RATE_LIMIT_EXCEEDED",s);case 500:case 502:case 503:case 504:throw new o(t,"SERVER_ERROR",s);default:throw new o(t,"API_ERROR",{status:e.status,...s})}};var b=["helpful","not_helpful"];function p(e){return!e.runId||e.runId.trim().length===0?"runId is required":e.helpful!==void 0&&!b.includes(e.helpful)?'helpful must be "helpful" or "not_helpful"':e.userFeedback!==void 0&&e.userFeedback.trim().length===0?"userFeedback cannot be empty":e.helpful===void 0&&e.userFeedback===void 0?"At least one of helpful or userFeedback is required":null}function R(e){return e.helpful!==void 0&&!b.includes(e.helpful)?'helpful must be "helpful" or "not_helpful"':e.userFeedback!==void 0&&e.userFeedback.trim().length===0?"userFeedback cannot be empty":e.helpful===void 0&&e.userFeedback===void 0?"At least one of helpful or userFeedback is required":null}var k=3e4,l=class{constructor(r={}){var t;this.baseUrl=((t=r.baseUrl)==null?void 0:t.trim())||"https://api.cobbl.ai"}async createFeedback(r){var s;let t=p(r);if(t)throw new o(t,"INVALID_REQUEST");try{let a={runId:r.runId.trim(),helpful:r.helpful,userFeedback:(s=r.userFeedback)==null?void 0:s.trim()},n=await this.makeRequest("/public/v1/feedback",{method:"POST",body:JSON.stringify(a)});n.ok||await c(n);let i=await n.json();return{id:i.id,message:i.message}}catch(a){throw a instanceof o?a:new o(`Failed to create feedback: ${a instanceof Error?a.message:"Unknown error"}`,"NETWORK_ERROR")}}async updateFeedback(r,t){var a;if(!r||r.trim().length===0)throw new o("id is required","INVALID_REQUEST");let s=R(t);if(s)throw new o(s,"INVALID_REQUEST");try{let n={helpful:t.helpful,userFeedback:(a=t.userFeedback)==null?void 0:a.trim()},i=await this.makeRequest(`/public/v1/feedback/${r.trim()}`,{method:"PATCH",body:JSON.stringify(n)});i.ok||await c(i);let d=await i.json();return{id:d.id,message:d.message}}catch(n){throw n instanceof o?n:new o(`Failed to update feedback: ${n instanceof Error?n.message:"Unknown error"}`,"NETWORK_ERROR")}}async makeRequest(r,t){let s=`${this.baseUrl}${r}`,a=new AbortController,n=setTimeout(()=>a.abort(),k);try{return await fetch(s,{...t,headers:{"Content-Type":"application/json",...t.headers},signal:a.signal})}finally{clearTimeout(n)}}};typeof window!="undefined"&&(window.Cobbl={CobblPublicClient:l});return F(C);})();
2
+ //# sourceMappingURL=cobbl-sdk.global.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/browser.ts","../src/errors.ts","../src/validation.ts","../src/public.ts"],"sourcesContent":["import { CobblPublicClient } from './public'\nexport { CobblPublicClient }\n\ndeclare global {\n interface Window {\n Cobbl: { CobblPublicClient: typeof CobblPublicClient }\n }\n}\n\nif (typeof window !== 'undefined') {\n window.Cobbl = { CobblPublicClient }\n}\n","/**\n * Error types that can be thrown by the Cobbl SDK\n */\nexport type CobblErrorCode =\n | 'INVALID_CONFIG'\n | 'INVALID_REQUEST'\n | 'UNAUTHORIZED'\n | 'FORBIDDEN'\n | 'NOT_FOUND'\n | 'ARCHIVED'\n | 'RATE_LIMIT_EXCEEDED'\n | 'SERVER_ERROR'\n | 'NETWORK_ERROR'\n | 'API_ERROR'\n\n/**\n * Custom error class for Cobbl SDK errors\n *\n * @example\n * ```typescript\n * try {\n * await client.runPrompt('my-prompt', { topic: 'test' })\n * } catch (error) {\n * if (error instanceof CobblError) {\n * console.error(`Error [${error.code}]: ${error.message}`)\n * console.error('Details:', error.details)\n * }\n * }\n * ```\n */\nexport class CobblError extends Error {\n /**\n * Error code indicating the type of error\n */\n public readonly code: CobblErrorCode\n\n /**\n * Additional details about the error (e.g., missing variables, validation issues)\n */\n public readonly details?: unknown\n\n constructor(message: string, code: CobblErrorCode, details?: unknown) {\n super(message)\n this.name = 'CobblError'\n this.code = code\n this.details = details\n\n // Maintains proper stack trace for where error was thrown (V8 only)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CobblError)\n }\n }\n\n /**\n * Check if an error is a CobblError\n */\n static isCobblError(error: unknown): error is CobblError {\n return error instanceof CobblError\n }\n\n /**\n * Convert error to JSON-serializable object\n */\n toJSON() {\n return {\n name: this.name,\n message: this.message,\n code: this.code,\n details: this.details,\n }\n }\n}\n\n/**\n * Handle error responses from the API\n * @internal\n */\nexport const handleErrorResponse = async (\n response: Response\n): Promise<never> => {\n let errorData: any\n try {\n errorData = await response.json()\n } catch {\n throw new CobblError(\n `HTTP ${response.status}: ${response.statusText}`,\n 'API_ERROR',\n { status: response.status }\n )\n }\n\n const message = errorData.error || errorData.message || 'Unknown error'\n const details = errorData.details\n\n switch (response.status) {\n case 400:\n throw new CobblError(message, 'INVALID_REQUEST', details)\n case 401:\n throw new CobblError(message, 'UNAUTHORIZED', details)\n case 403:\n throw new CobblError(message, 'FORBIDDEN', details)\n case 404:\n throw new CobblError(message, 'NOT_FOUND', details)\n case 410:\n throw new CobblError(message, 'ARCHIVED', details)\n case 429:\n throw new CobblError(message, 'RATE_LIMIT_EXCEEDED', details)\n case 500:\n case 502:\n case 503:\n case 504:\n throw new CobblError(message, 'SERVER_ERROR', details)\n default:\n throw new CobblError(message, 'API_ERROR', {\n status: response.status,\n ...details,\n })\n }\n}\n","import type {\n CreateFeedbackRequest,\n UpdateFeedbackRequest,\n Helpful,\n} from './types'\n\nconst VALID_HELPFUL_VALUES: Helpful[] = ['helpful', 'not_helpful']\n\nexport function validateCreateFeedback(\n feedback: CreateFeedbackRequest\n): string | null {\n if (!feedback.runId || feedback.runId.trim().length === 0) {\n return 'runId is required'\n }\n if (\n feedback.helpful !== undefined &&\n !VALID_HELPFUL_VALUES.includes(feedback.helpful)\n ) {\n return 'helpful must be \"helpful\" or \"not_helpful\"'\n }\n if (\n feedback.userFeedback !== undefined &&\n feedback.userFeedback.trim().length === 0\n ) {\n return 'userFeedback cannot be empty'\n }\n if (feedback.helpful === undefined && feedback.userFeedback === undefined) {\n return 'At least one of helpful or userFeedback is required'\n }\n return null\n}\n\nexport function validateUpdateFeedback(\n update: UpdateFeedbackRequest\n): string | null {\n if (\n update.helpful !== undefined &&\n !VALID_HELPFUL_VALUES.includes(update.helpful)\n ) {\n return 'helpful must be \"helpful\" or \"not_helpful\"'\n }\n if (\n update.userFeedback !== undefined &&\n update.userFeedback.trim().length === 0\n ) {\n return 'userFeedback cannot be empty'\n }\n if (update.helpful === undefined && update.userFeedback === undefined) {\n return 'At least one of helpful or userFeedback is required'\n }\n return null\n}\n","/**\n * Cobbl SDK - Public API Client\n *\n * A lightweight client for public-facing feedback operations.\n * Use this in client-side or user-facing contexts.\n * No authentication required - designed for end-user feedback submission.\n *\n * @example\n * ```typescript\n * import { CobblPublicClient } from '@cobbl-ai/sdk/public'\n *\n * const client = new CobblPublicClient({\n * baseUrl: 'https://api.cobbl.ai' // Optional, defaults to production\n * })\n *\n * // Submit feedback\n * const { id } = await client.createFeedback({\n * runId: 'run_abc123',\n * helpful: 'not_helpful'\n * })\n *\n * // Update feedback with details later\n * await client.updateFeedback(id, {\n * userFeedback: 'Too formal'\n * })\n * ```\n */\n\nimport type {\n CreateFeedbackRequest,\n CreateFeedbackResponse,\n UpdateFeedbackRequest,\n UpdateFeedbackResponse,\n} from './types'\nimport { CobblError, handleErrorResponse } from './errors'\nimport { validateCreateFeedback, validateUpdateFeedback } from './validation'\n\n/**\n * Configuration options for CobblPublicClient\n */\nexport interface CobblPublicConfig {\n /**\n * Base URL for the API\n * @optional\n * @default 'https://api.cobbl.ai'\n * @internal\n * @example 'http://localhost:5001/your-project/us-central1/externalApi' // For local development\n */\n baseUrl?: string\n}\n\nconst REQUEST_TIMEOUT_MS = 30_000\n\n/**\n * Public API Client for Cobbl\n *\n * Provides methods to submit and update feedback via the public API.\n * This client is suitable for use in client-side or user-facing contexts.\n * No authentication required - designed for end-user feedback submission.\n */\nexport class CobblPublicClient {\n private readonly baseUrl: string\n\n /**\n * Initialize the Cobbl Public SDK client\n *\n * @param config - Configuration object\n * @param config.baseUrl - Optional base URL for the API (defaults to 'https://api.cobbl.ai')\n */\n constructor(config: CobblPublicConfig = {}) {\n this.baseUrl = config.baseUrl?.trim() || 'https://api.cobbl.ai'\n }\n\n /**\n * Create user feedback for a prompt run\n * Supports segmented feedback - you can provide just helpful, just userFeedback, or both\n * Use updateFeedback to add additional data later\n *\n * @param feedback - Feedback submission data\n * @param feedback.runId - The run ID from a previous runPrompt call\n * @param feedback.helpful - Whether the output was helpful ('helpful' or 'not_helpful') - optional\n * @param feedback.userFeedback - Detailed feedback message from the user - optional\n * @returns Promise containing the created feedback ID\n *\n * @throws {CobblError} When the request fails or API returns an error\n *\n * @example Submit just thumbs down first\n * ```typescript\n * const { id } = await client.createFeedback({\n * runId: result.runId,\n * helpful: 'not_helpful'\n * })\n * // Later, add details\n * await client.updateFeedback(id, {\n * userFeedback: 'The response was too formal and lengthy'\n * })\n * ```\n *\n * @example Submit both at once\n * ```typescript\n * await client.createFeedback({\n * runId: result.runId,\n * helpful: 'not_helpful',\n * userFeedback: 'The response was too formal and lengthy'\n * })\n * ```\n */\n async createFeedback(\n feedback: CreateFeedbackRequest\n ): Promise<CreateFeedbackResponse> {\n const validationError = validateCreateFeedback(feedback)\n if (validationError) {\n throw new CobblError(validationError, 'INVALID_REQUEST')\n }\n\n try {\n // Build request body with only provided fields\n const body: CreateFeedbackRequest = {\n runId: feedback.runId.trim(),\n helpful: feedback.helpful,\n userFeedback: feedback.userFeedback?.trim(),\n }\n\n const response = await this.makeRequest('/public/v1/feedback', {\n method: 'POST',\n body: JSON.stringify(body),\n })\n\n if (!response.ok) {\n await handleErrorResponse(response)\n }\n\n const data = (await response.json()) as {\n id: string\n message: string\n }\n\n return {\n id: data.id,\n message: data.message,\n }\n } catch (error) {\n if (error instanceof CobblError) {\n throw error\n }\n throw new CobblError(\n `Failed to create feedback: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n )\n }\n }\n\n /**\n * Update existing feedback with additional data\n * Use this to add helpful sentiment or detailed feedback after initial submission\n *\n * @param id - The ID returned from createFeedback\n * @param update - The data to update\n * @param update.helpful - Whether the output was helpful ('helpful' or 'not_helpful') - optional\n * @param update.userFeedback - Detailed feedback message from the user - optional\n * @returns Promise containing the updated feedback ID\n *\n * @throws {CobblError} When the request fails or API returns an error\n *\n * @example Add details after initial thumbs down\n * ```typescript\n * // First, submit just the rating\n * const { id } = await client.createFeedback({\n * runId: result.runId,\n * helpful: 'not_helpful'\n * })\n *\n * // Later, add detailed feedback\n * await client.updateFeedback(id, {\n * userFeedback: 'The response was too formal and lengthy'\n * })\n * ```\n */\n async updateFeedback(\n id: string,\n update: UpdateFeedbackRequest\n ): Promise<UpdateFeedbackResponse> {\n if (!id || id.trim().length === 0) {\n throw new CobblError('id is required', 'INVALID_REQUEST')\n }\n\n const validationError = validateUpdateFeedback(update)\n if (validationError) {\n throw new CobblError(validationError, 'INVALID_REQUEST')\n }\n\n try {\n // Build request body with only provided fields\n const body: UpdateFeedbackRequest = {\n helpful: update.helpful,\n userFeedback: update.userFeedback?.trim(),\n }\n\n const response = await this.makeRequest(\n `/public/v1/feedback/${id.trim()}`,\n {\n method: 'PATCH',\n body: JSON.stringify(body),\n }\n )\n\n if (!response.ok) {\n await handleErrorResponse(response)\n }\n\n const data = (await response.json()) as {\n id: string\n message: string\n }\n\n return {\n id: data.id,\n message: data.message,\n }\n } catch (error) {\n if (error instanceof CobblError) {\n throw error\n }\n throw new CobblError(\n `Failed to update feedback: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'NETWORK_ERROR'\n )\n }\n }\n\n /**\n * Make an HTTP request to the Cobbl API\n * @private\n */\n private async makeRequest(\n path: string,\n options: RequestInit\n ): Promise<Response> {\n const url = `${this.baseUrl}${path}`\n\n const controller = new AbortController()\n const timeoutId = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS)\n\n try {\n const response = await fetch(url, {\n ...options,\n headers: {\n 'Content-Type': 'application/json',\n ...options.headers,\n },\n signal: controller.signal,\n })\n\n return response\n } finally {\n clearTimeout(timeoutId)\n }\n }\n}\n\n// Export the client\nexport { CobblError } from './errors'\nexport type { CobblErrorCode } from './errors'\nexport type {\n CreateFeedbackRequest,\n CreateFeedbackResponse,\n UpdateFeedbackRequest,\n UpdateFeedbackResponse,\n Helpful,\n} from './types'\n"],"mappings":"ybAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IC8BO,IAAMC,EAAN,MAAMC,UAAmB,KAAM,CAWpC,YAAYC,EAAiBC,EAAsBC,EAAmB,CACpE,MAAMF,CAAO,EACb,KAAK,KAAO,aACZ,KAAK,KAAOC,EACZ,KAAK,QAAUC,EAGX,MAAM,mBACR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AC9B,MAAM,IAAIN,EAAW,iBAAkB,iBAAiB,EAG1D,IAAMF,EAAkBU,EAAuBD,CAAM,EACrD,GAAIT,EACF,MAAM,IAAIE,EAAWF,EAAiB,iBAAiB,EAGzD,GAAI,CAEF,IAAMG,EAA8B,CAClC,QAASM,EAAO,QAChB,cAAcX,EAAAW,EAAO,eAAP,YAAAX,EAAqB,MACrC,EAEMM,EAAW,MAAM,KAAK,YAC1B,uBAAuBI,EAAG,KAAK,CAAC,GAChC,CACE,OAAQ,QACR,KAAM,KAAK,UAAUL,CAAI,CAC3B,CACF,EAEKC,EAAS,IACZ,MAAMC,EAAoBD,CAAQ,EAGpC,IAAME,EAAQ,MAAMF,EAAS,KAAK,EAKlC,MAAO,CACL,GAAIE,EAAK,GACT,QAASA,EAAK,OAChB,CACF,OAASC,EAAO,CACd,MAAIA,aAAiBL,EACbK,EAEF,IAAIL,EACR,8BAA8BK,aAAiB,MAAQA,EAAM,QAAU,eAAe,GACtF,eACF,CACF,CACF,CAMA,MAAc,YACZI,EACAC,EACmB,CACnB,IAAMC,EAAM,GAAG,KAAK,OAAO,GAAGF,CAAI,GAE5BG,EAAa,IAAI,gBACjBC,EAAY,WAAW,IAAMD,EAAW,MAAM,EAAGnB,CAAkB,EAEzE,GAAI,CAUF,OATiB,MAAM,MAAMkB,EAAK,CAChC,GAAGD,EACH,QAAS,CACP,eAAgB,mBAChB,GAAGA,EAAQ,OACb,EACA,OAAQE,EAAW,MACrB,CAAC,CAGH,QAAE,CACA,aAAaC,CAAS,CACxB,CACF,CACF,EHzPI,OAAO,QAAW,cACpB,OAAO,MAAQ,CAAE,kBAAAC,CAAkB","names":["browser_exports","__export","CobblPublicClient","CobblError","_CobblError","message","code","details","error","handleErrorResponse","response","errorData","e","VALID_HELPFUL_VALUES","validateCreateFeedback","feedback","validateUpdateFeedback","update","REQUEST_TIMEOUT_MS","CobblPublicClient","config","_a","feedback","validationError","validateCreateFeedback","CobblError","body","response","handleErrorResponse","data","error","id","update","validateUpdateFeedback","path","options","url","controller","timeoutId","CobblPublicClient"]}
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@cobbl-ai/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Cobbl SDK - Close the Loop on LLM Prompt Feedback",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
+ "unpkg": "dist/cobbl-sdk.global.js",
9
+ "jsdelivr": "dist/cobbl-sdk.global.js",
8
10
  "files": [
9
11
  "dist/**/*",
10
12
  "src/**/*",
@@ -67,12 +69,12 @@
67
69
  "license": "MIT",
68
70
  "repository": {
69
71
  "type": "git",
70
- "url": ""
72
+ "url": "https://github.com/Cobbl-AI/sdk.git"
71
73
  },
72
74
  "bugs": {
73
- "url": ""
75
+ "url": "https://github.com/Cobbl-AI/sdk/issues"
74
76
  },
75
- "homepage": "",
77
+ "homepage": "https://github.com/Cobbl-AI/sdk#readme",
76
78
  "engines": {
77
79
  "node": ">=18.0.0"
78
80
  },
package/src/browser.ts ADDED
@@ -0,0 +1,12 @@
1
+ import { CobblPublicClient } from './public'
2
+ export { CobblPublicClient }
3
+
4
+ declare global {
5
+ interface Window {
6
+ Cobbl: { CobblPublicClient: typeof CobblPublicClient }
7
+ }
8
+ }
9
+
10
+ if (typeof window !== 'undefined') {
11
+ window.Cobbl = { CobblPublicClient }
12
+ }