@proveanything/smartlinks 2.0.10 → 2.0.12

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.
@@ -32,7 +32,8 @@ export default defineConfig({
32
32
  'react', 'react-dom', 'react/jsx-runtime',
33
33
  '@proveanything/smartlinks',
34
34
  'react-router-dom', '@tanstack/react-query',
35
- 'lucide-react', 'date-fns', 'liquidjs', 'class-variance-authority',
35
+ 'lucide-react', 'date-fns', 'liquidjs', 'marked', 'dompurify', 'clsx', 'tailwind-merge',
36
+ 'class-variance-authority',
36
37
  '@radix-ui/react-slot', '@radix-ui/react-dialog', '@radix-ui/react-popover',
37
38
  '@radix-ui/react-tooltip', '@radix-ui/react-tabs', '@radix-ui/react-accordion',
38
39
  '@radix-ui/react-select', '@radix-ui/react-scroll-area', '@radix-ui/react-label',
@@ -44,7 +45,8 @@ export default defineConfig({
44
45
  '@proveanything/smartlinks': 'SL',
45
46
  'react-router-dom': 'ReactRouterDOM', '@tanstack/react-query': 'ReactQuery',
46
47
  'lucide-react': 'LucideReact', 'date-fns': 'dateFns', 'liquidjs': 'LiquidJS',
47
- 'class-variance-authority': 'CVA',
48
+ 'marked': 'marked', 'dompurify': 'DOMPurify', 'clsx': 'clsx',
49
+ 'tailwind-merge': 'tailwindMerge', 'class-variance-authority': 'CVA',
48
50
  '@radix-ui/react-slot': 'RadixSlot', '@radix-ui/react-dialog': 'RadixDialog',
49
51
  '@radix-ui/react-popover': 'RadixPopover', '@radix-ui/react-tooltip': 'RadixTooltip',
50
52
  '@radix-ui/react-tabs': 'RadixTabs', '@radix-ui/react-accordion': 'RadixAccordion',
@@ -71,6 +73,10 @@ export default defineConfig({
71
73
  | `lucide-react` | `LucideReact` | 1.47 |
72
74
  | `date-fns` | `dateFns` | 4.4 |
73
75
  | `liquidjs` | `LiquidJS` | 10.27+ |
76
+ | `marked` | `marked` | 12+ |
77
+ | `dompurify` | `DOMPurify` | 3+ |
78
+ | `clsx` | `clsx` | 2+ |
79
+ | `tailwind-merge` | `tailwindMerge` | 3+ |
74
80
  | `class-variance-authority` | `CVA` | 0.7 |
75
81
  | `@radix-ui/react-slot` | `RadixSlot` | 1.2.4 |
76
82
  | `@radix-ui/react-dialog` | `RadixDialog` | 1.1.23 |
@@ -85,7 +91,15 @@ export default defineConfig({
85
91
  | `@radix-ui/react-progress` | `RadixProgress` | 1.1.8 |
86
92
  | `@radix-ui/react-avatar` | `RadixAvatar` | 1.1.11 |
87
93
 
88
- `liquidjs` is **host-provided** — externalise it, don't ship a second copy (frequently missed).
94
+ `liquidjs`, `marked`, `dompurify`, `clsx` and `tailwind-merge` are **host-provided** — externalise
95
+ them, don't ship a second copy (frequently missed). `marked` arrived in **v6**; `dompurify`, `clsx`
96
+ and `tailwind-merge` in **v7**. The portal and hub render markdown in the container, so use the
97
+ host's `marked` rather than bundling your own. `marked` does not sanitise HTML — pair it with the
98
+ shared `dompurify`: `el.innerHTML = DOMPurify.sanitize(marked.parse(md))`. `window.DOMPurify` is the
99
+ **configured instance** (callable, `.sanitize()`), so `import DOMPurify from 'dompurify'` behaves
100
+ exactly like a bundled default import. `clsx` + `tailwind-merge` are the standard `cn()` pair
101
+ (`import { clsx } from 'clsx'; import { twMerge } from 'tailwind-merge'`) — keep your local `cn()`
102
+ helper if you like, it just stops paying the bundle cost.
89
103
 
90
104
  ## Backwards compatibility
91
105
 
@@ -111,7 +125,8 @@ app ships the Tailwind 4 CSS-first layout as the default; see its README.)
111
125
 
112
126
  React **19.3** · Vite **8.3** · react-router-dom **7.18** · Tailwind **4.3** (CSS-first) ·
113
127
  TypeScript **6.0** · ESLint **10.11** · `@proveanything/smartlinks` **2.0.5** ·
114
- `@proveanything/smartlinks-utils-ui` **1.16.4** · liquidjs **10.29**.
128
+ `@proveanything/smartlinks-utils-ui` **1.16.4** · liquidjs **10.29** · marked **12+** ·
129
+ dompurify **3+** · clsx **2+** · tailwind-merge **3+**.
115
130
 
116
131
  > **TypeScript 7** (the native/Go compiler) is **deliberately deferred** — tooling hasn't settled.
117
132
  > Target **TS 6** for R5; it compiles existing code with no source changes.
@@ -138,8 +153,8 @@ never drift:
138
153
 
139
154
  ```ts
140
155
  import {
141
- SHARED_DEPENDENCY_CONTRACT_VERSION, // 'v5'
142
- SHARED_DEPENDENCIES, // [{ specifier, globalName, minVersion, importMapPath }, …] (25)
156
+ SHARED_DEPENDENCY_CONTRACT_VERSION, // 'v7'
157
+ SHARED_DEPENDENCIES, // [{ specifier, globalName, minVersion, importMapPath }, …] (29)
143
158
  SHARED_DEPENDENCY_SPECIFIERS, // bare specifiers — drop straight into a bundler `external` list
144
159
  getHostSharedDependencies, // what the live host advertises at runtime, or null
145
160
  } from '@proveanything/smartlinks'
package/openapi.yaml CHANGED
@@ -777,7 +777,8 @@ paths:
777
777
  description: Success
778
778
  content:
779
779
  application/json:
780
- schema: {}
780
+ schema:
781
+ $ref: "#/components/schemas/AICacheRef"
781
782
  400:
782
783
  description: Bad request
783
784
  401:
@@ -803,7 +804,8 @@ paths:
803
804
  description: Success
804
805
  content:
805
806
  application/json:
806
- schema: {}
807
+ schema:
808
+ $ref: "#/components/schemas/AIGenerateImageResponse"
807
809
  400:
808
810
  description: Bad request
809
811
  401:
@@ -1011,9 +1013,7 @@ paths:
1011
1013
  content:
1012
1014
  application/json:
1013
1015
  schema:
1014
- type: array
1015
- items:
1016
- $ref: "#/components/schemas/AISearchPhotosPhoto"
1016
+ $ref: "#/components/schemas/AISearchPhotosResponse"
1017
1017
  400:
1018
1018
  description: Bad request
1019
1019
  401:
@@ -1132,7 +1132,8 @@ paths:
1132
1132
  description: Success
1133
1133
  content:
1134
1134
  application/json:
1135
- schema: {}
1135
+ schema:
1136
+ $ref: "#/components/schemas/AIUploadedFile"
1136
1137
  400:
1137
1138
  description: Bad request
1138
1139
  401:
@@ -15222,6 +15223,25 @@ components:
15222
15223
  - standard
15223
15224
  - flex
15224
15225
  - priority
15226
+ server_tools:
15227
+ type: array
15228
+ items:
15229
+ type: object
15230
+ additionalProperties: true
15231
+ allowCapabilities:
15232
+ type: array
15233
+ items:
15234
+ $ref: "#/components/schemas/AiToolCapability"
15235
+ only:
15236
+ type: array
15237
+ items:
15238
+ $ref: "#/components/schemas/AiToolName"
15239
+ exclude:
15240
+ type: array
15241
+ items:
15242
+ $ref: "#/components/schemas/AiToolName"
15243
+ maxSteps:
15244
+ type: number
15225
15245
  required:
15226
15246
  - enabled
15227
15247
  ResponsesResult:
@@ -15275,6 +15295,8 @@ components:
15275
15295
  - openai
15276
15296
  responseTime:
15277
15297
  type: number
15298
+ _agent:
15299
+ $ref: "#/components/schemas/ResponsesAgentTrace"
15278
15300
  required:
15279
15301
  - id
15280
15302
  - object
@@ -16023,16 +16045,121 @@ components:
16023
16045
  AISearchPhotosPhoto:
16024
16046
  type: object
16025
16047
  properties:
16048
+ id:
16049
+ type: string
16026
16050
  url:
16027
16051
  type: string
16052
+ thumb:
16053
+ type: string
16028
16054
  alt:
16029
16055
  type: string
16056
+ width:
16057
+ type: number
16058
+ height:
16059
+ type: number
16030
16060
  photographer:
16031
16061
  type: string
16032
16062
  photographerUrl:
16033
16063
  type: string
16034
16064
  required:
16035
16065
  - url
16066
+ AISearchPhotosResponse:
16067
+ type: object
16068
+ properties:
16069
+ provider:
16070
+ type: string
16071
+ results:
16072
+ type: array
16073
+ items:
16074
+ $ref: "#/components/schemas/AISearchPhotosPhoto"
16075
+ total:
16076
+ type: number
16077
+ total_pages:
16078
+ type: number
16079
+ required:
16080
+ - provider
16081
+ - results
16082
+ AIGeneratedImage:
16083
+ type: object
16084
+ properties:
16085
+ url:
16086
+ type: string
16087
+ b64_json:
16088
+ type: string
16089
+ revised_prompt:
16090
+ type: string
16091
+ required:
16092
+ - url
16093
+ - b64_json
16094
+ AIGenerateImageResponse:
16095
+ type: object
16096
+ properties:
16097
+ provider:
16098
+ type: string
16099
+ model:
16100
+ type: string
16101
+ images:
16102
+ type: array
16103
+ items:
16104
+ $ref: "#/components/schemas/AIGeneratedImage"
16105
+ required:
16106
+ - provider
16107
+ - images
16108
+ AIGenerateContentCandidate:
16109
+ type: object
16110
+ properties:
16111
+ content:
16112
+ type: object
16113
+ additionalProperties: true
16114
+ finishReason:
16115
+ type: string
16116
+ AIGenerateContentResponse:
16117
+ type: object
16118
+ properties:
16119
+ provider:
16120
+ type: string
16121
+ model:
16122
+ type: string
16123
+ candidates:
16124
+ type: array
16125
+ items:
16126
+ $ref: "#/components/schemas/AIGenerateContentCandidate"
16127
+ usageMetadata:
16128
+ type: object
16129
+ additionalProperties: true
16130
+ promptTokenCount:
16131
+ type: number
16132
+ candidatesTokenCount:
16133
+ type: number
16134
+ totalTokenCount:
16135
+ type: number
16136
+ responseTime:
16137
+ type: number
16138
+ AIUploadedFile:
16139
+ type: object
16140
+ properties:
16141
+ name:
16142
+ type: string
16143
+ uri:
16144
+ type: string
16145
+ url:
16146
+ type: string
16147
+ mimeType:
16148
+ type: string
16149
+ sizeBytes:
16150
+ type: object
16151
+ additionalProperties: true
16152
+ state:
16153
+ type: string
16154
+ AICacheRef:
16155
+ type: object
16156
+ properties:
16157
+ name:
16158
+ type: string
16159
+ model:
16160
+ type: string
16161
+ expireTime:
16162
+ type: string
16036
16163
  AgentRunRequest:
16037
16164
  type: object
16038
16165
  properties:
@@ -16170,6 +16297,357 @@ components:
16170
16297
  required:
16171
16298
  - tools
16172
16299
  - skills
16300
+ WebFetchPageArgs:
16301
+ type: object
16302
+ properties:
16303
+ url:
16304
+ type: object
16305
+ additionalProperties: true
16306
+ required:
16307
+ - url
16308
+ WebExtractSchemaArgs:
16309
+ type: object
16310
+ properties:
16311
+ url:
16312
+ type: object
16313
+ additionalProperties: true
16314
+ required:
16315
+ - url
16316
+ WebScreenshotArgs:
16317
+ type: object
16318
+ properties:
16319
+ url:
16320
+ type: string
16321
+ required:
16322
+ - url
16323
+ WebSearchArgs:
16324
+ type: object
16325
+ properties:
16326
+ query:
16327
+ type: object
16328
+ additionalProperties: true
16329
+ required:
16330
+ - query
16331
+ BrandAssetsArgs:
16332
+ type: object
16333
+ properties:
16334
+ url:
16335
+ type: string
16336
+ required:
16337
+ - url
16338
+ DocumentReadArgs:
16339
+ type: object
16340
+ properties:
16341
+ url:
16342
+ type: object
16343
+ additionalProperties: true
16344
+ required:
16345
+ - url
16346
+ DataExtractArgs:
16347
+ type: object
16348
+ properties:
16349
+ url:
16350
+ type: object
16351
+ additionalProperties: true
16352
+ required:
16353
+ - url
16354
+ ImageDescribeArgs:
16355
+ type: object
16356
+ properties:
16357
+ imageUrl:
16358
+ type: object
16359
+ additionalProperties: true
16360
+ required:
16361
+ - imageUrl
16362
+ ImageGenerateArgs:
16363
+ type: object
16364
+ properties:
16365
+ prompt:
16366
+ type: string
16367
+ enum:
16368
+ - openai
16369
+ - gemini
16370
+ required:
16371
+ - prompt
16372
+ ImageFromReferenceArgs:
16373
+ type: object
16374
+ properties:
16375
+ prompt:
16376
+ type: object
16377
+ additionalProperties: true
16378
+ required:
16379
+ - prompt
16380
+ ImageSearchStockArgs:
16381
+ type: object
16382
+ properties:
16383
+ query:
16384
+ type: string
16385
+ enum:
16386
+ - landscape
16387
+ - portrait
16388
+ - squarish
16389
+ required:
16390
+ - query
16391
+ ImageTransformArgs:
16392
+ type: object
16393
+ properties:
16394
+ imageUrl:
16395
+ type: string
16396
+ resize:
16397
+ type: string
16398
+ enum:
16399
+ - cover
16400
+ - contain
16401
+ - fill
16402
+ - inside
16403
+ - outside
16404
+ crop:
16405
+ type: object
16406
+ additionalProperties: true
16407
+ rotate:
16408
+ type: number
16409
+ flip:
16410
+ type: boolean
16411
+ flop:
16412
+ type: boolean
16413
+ grayscale:
16414
+ type: boolean
16415
+ tint:
16416
+ type: string
16417
+ modulate:
16418
+ type: object
16419
+ additionalProperties: true
16420
+ format:
16421
+ type: string
16422
+ enum:
16423
+ - jpeg
16424
+ - png
16425
+ - webp
16426
+ - avif
16427
+ quality:
16428
+ type: number
16429
+ required:
16430
+ - imageUrl
16431
+ PdfCreateArgs:
16432
+ type: object
16433
+ properties:
16434
+ html:
16435
+ type: object
16436
+ additionalProperties: true
16437
+ required:
16438
+ - html
16439
+ PdfFillArgs:
16440
+ type: object
16441
+ properties:
16442
+ url:
16443
+ type: object
16444
+ additionalProperties: true
16445
+ required:
16446
+ - url
16447
+ PdfMergeArgs:
16448
+ type: object
16449
+ properties:
16450
+ urls:
16451
+ type: array
16452
+ items:
16453
+ type: string
16454
+ required:
16455
+ - urls
16456
+ HttpRequestArgs:
16457
+ type: object
16458
+ properties:
16459
+ url:
16460
+ type: string
16461
+ enum:
16462
+ - GET
16463
+ - POST
16464
+ - PUT
16465
+ - PATCH
16466
+ - DELETE
16467
+ - HEAD
16468
+ required:
16469
+ - url
16470
+ TranslateArgs:
16471
+ type: object
16472
+ properties:
16473
+ text:
16474
+ type: object
16475
+ additionalProperties: true
16476
+ required:
16477
+ - text
16478
+ AiToolArgsMap:
16479
+ type: object
16480
+ properties:
16481
+ web.fetchPage:
16482
+ $ref: "#/components/schemas/WebFetchPageArgs"
16483
+ web.extractSchema:
16484
+ $ref: "#/components/schemas/WebExtractSchemaArgs"
16485
+ web.screenshot:
16486
+ $ref: "#/components/schemas/WebScreenshotArgs"
16487
+ web.search:
16488
+ $ref: "#/components/schemas/WebSearchArgs"
16489
+ brand.assets:
16490
+ $ref: "#/components/schemas/BrandAssetsArgs"
16491
+ document.read:
16492
+ $ref: "#/components/schemas/DocumentReadArgs"
16493
+ data.extract:
16494
+ $ref: "#/components/schemas/DataExtractArgs"
16495
+ image.describe:
16496
+ $ref: "#/components/schemas/ImageDescribeArgs"
16497
+ image.generate:
16498
+ $ref: "#/components/schemas/ImageGenerateArgs"
16499
+ image.fromReference:
16500
+ $ref: "#/components/schemas/ImageFromReferenceArgs"
16501
+ image.searchStock:
16502
+ $ref: "#/components/schemas/ImageSearchStockArgs"
16503
+ image.transform:
16504
+ $ref: "#/components/schemas/ImageTransformArgs"
16505
+ pdf.create:
16506
+ $ref: "#/components/schemas/PdfCreateArgs"
16507
+ pdf.fill:
16508
+ $ref: "#/components/schemas/PdfFillArgs"
16509
+ pdf.merge:
16510
+ $ref: "#/components/schemas/PdfMergeArgs"
16511
+ http.request:
16512
+ $ref: "#/components/schemas/HttpRequestArgs"
16513
+ translate:
16514
+ $ref: "#/components/schemas/TranslateArgs"
16515
+ required:
16516
+ - web.fetchPage
16517
+ - web.extractSchema
16518
+ - web.screenshot
16519
+ - web.search
16520
+ - brand.assets
16521
+ - document.read
16522
+ - data.extract
16523
+ - image.describe
16524
+ - image.generate
16525
+ - image.fromReference
16526
+ - image.searchStock
16527
+ - image.transform
16528
+ - pdf.create
16529
+ - pdf.fill
16530
+ - pdf.merge
16531
+ - http.request
16532
+ - translate
16533
+ WebSearchResultItem:
16534
+ type: object
16535
+ properties:
16536
+ url:
16537
+ type: object
16538
+ additionalProperties: true
16539
+ required:
16540
+ - url
16541
+ WebSearchResult:
16542
+ type: object
16543
+ properties:
16544
+ query:
16545
+ type: array
16546
+ items:
16547
+ type: object
16548
+ additionalProperties: true
16549
+ required:
16550
+ - query
16551
+ DocumentReadResult:
16552
+ type: object
16553
+ properties:
16554
+ url:
16555
+ type: object
16556
+ additionalProperties: true
16557
+ required:
16558
+ - url
16559
+ DataExtractResult:
16560
+ type: object
16561
+ properties:
16562
+ url:
16563
+ type: object
16564
+ additionalProperties: true
16565
+ required:
16566
+ - url
16567
+ WebFetchPageResult:
16568
+ type: object
16569
+ properties:
16570
+ url:
16571
+ type: object
16572
+ additionalProperties: true
16573
+ required:
16574
+ - url
16575
+ ImageDescribeResult:
16576
+ type: object
16577
+ properties:
16578
+ imageUrl:
16579
+ type: object
16580
+ additionalProperties: true
16581
+ required:
16582
+ - imageUrl
16583
+ HostedAssetResult:
16584
+ type: object
16585
+ properties:
16586
+ hostedUrl:
16587
+ type: object
16588
+ additionalProperties: true
16589
+ required:
16590
+ - hostedUrl
16591
+ HttpRequestResult:
16592
+ type: object
16593
+ properties:
16594
+ status:
16595
+ type: object
16596
+ additionalProperties: true
16597
+ required:
16598
+ - status
16599
+ TranslateResult:
16600
+ type: object
16601
+ properties:
16602
+ translations:
16603
+ type: object
16604
+ additionalProperties: true
16605
+ required:
16606
+ - translations
16607
+ ResponsesAgentTrace:
16608
+ type: object
16609
+ properties:
16610
+ steps:
16611
+ type: number
16612
+ maxStepsReached:
16613
+ type: boolean
16614
+ toolResults:
16615
+ type: array
16616
+ items:
16617
+ $ref: "#/components/schemas/AgentToolResult"
16618
+ availableTools:
16619
+ type: array
16620
+ items:
16621
+ type: string
16622
+ required:
16623
+ - steps
16624
+ - maxStepsReached
16625
+ - toolResults
16626
+ - availableTools
16627
+ AgentToolCallEvent:
16628
+ type: object
16629
+ properties:
16630
+ type:
16631
+ type: object
16632
+ additionalProperties: true
16633
+ required:
16634
+ - type
16635
+ AgentToolResultEvent:
16636
+ type: object
16637
+ properties:
16638
+ type:
16639
+ type: object
16640
+ additionalProperties: true
16641
+ required:
16642
+ - type
16643
+ AgentResponseCompletedEvent:
16644
+ type: object
16645
+ properties:
16646
+ type:
16647
+ type: object
16648
+ additionalProperties: true
16649
+ required:
16650
+ - type
16173
16651
  AnalyticsLocation:
16174
16652
  type: object
16175
16653
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -62,7 +62,8 @@
62
62
  "tag": "next"
63
63
  },
64
64
  "dependencies": {
65
- "cross-fetch": "^3.1.5"
65
+ "cross-fetch": "^3.1.5",
66
+ "es-module-lexer": "^1.7.0"
66
67
  },
67
68
  "devDependencies": {
68
69
  "ts-node": "^10.9.1",
@@ -19,6 +19,7 @@
19
19
  import { readFileSync, existsSync } from 'node:fs';
20
20
  import { resolve, dirname, join } from 'node:path';
21
21
  import { fileURLToPath, pathToFileURL } from 'node:url';
22
+ import { bareImportsOf } from './lib/bare-imports.mjs';
22
23
 
23
24
  const here = dirname(fileURLToPath(import.meta.url));
24
25
 
@@ -75,25 +76,9 @@ if (meta.sharedDependencies && meta.sharedDependencies !== SHARED_DEPENDENCY_CON
75
76
  warnings.push(`built against contract ${meta.sharedDependencies}, but this SDK ships ${SHARED_DEPENDENCY_CONTRACT_VERSION} — host may not serve a matching import map.`);
76
77
  }
77
78
 
78
- // Pull the bare imports out of a bundle (handles minified `from"x"` too).
79
- function bareImportsOf(code) {
80
- const specs = new Set();
81
- const patterns = [
82
- /\bfrom\s*["']([^"']+)["']/g, // static import/export ... from "x"
83
- /\bimport\s*["']([^"']+)["']/g, // side-effect import "x"
84
- /\bimport\(\s*["']([^"']+)["']\s*\)/g, // dynamic import("x")
85
- ];
86
- for (const re of patterns) {
87
- let m;
88
- while ((m = re.exec(code))) {
89
- const spec = m[1];
90
- if (spec.startsWith('.') || spec.startsWith('/')) continue; // internal/relative
91
- if (/^https?:/.test(spec)) continue; // absolute URL import
92
- specs.add(spec);
93
- }
94
- }
95
- return [...specs];
96
- }
79
+ // bareImportsOf (scripts/lib/bare-imports.mjs) LEXES the bundle for real import
80
+ // statements — so bundled data containing the word `from` (e.g. tailwind-merge's class
81
+ // map) is not mistaken for an import.
97
82
 
98
83
  // Resolve a manifest-relative bundle path against the likely roots (dist paths
99
84
  // are sometimes relative to the app root, sometimes to the manifest dir).