@proveanything/smartlinks 1.17.0 → 1.17.4

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.
@@ -0,0 +1,168 @@
1
+ # AI Tools & Skills
2
+
3
+ The platform's AI can research the web, extract structured data, screenshot pages, and
4
+ generate images — through a **capability registry**. This page is the catalog: what the
5
+ AI can do, and how an app reaches for it. You should not need to call an API to find
6
+ this out — it's documented here so that when you build an app (or an AI assistant helps
7
+ you), you *know* these capabilities exist and can shape your app to use them.
8
+
9
+ ## Two layers: tools vs skills
10
+
11
+ - **Skills** are the app-facing verbs — named, composed capabilities with the
12
+ orchestration and prompt **baked in**. You invoke a skill by name with structured
13
+ input and get structured output back. **You never write a prompt.** Example:
14
+ `research.brand`.
15
+ - **Tools** are the atomic building blocks (fetch a page, generate an image). The AI
16
+ reaches for these *itself* during a skill or agent run — you rarely call them directly.
17
+
18
+ Rule of thumb: **if a skill exists for what you want, call the skill.** Drop to the
19
+ agent loop (below) only for open-ended tasks with no matching skill.
20
+
21
+ ## Using a skill
22
+
23
+ ```ts
24
+ import { ai } from '@proveanything/smartlinks'
25
+
26
+ // Research a client's brand from their website — no prompt, just input.
27
+ const { profile, sources } = await ai.skills.run(collectionId, 'research.brand', {
28
+ url: 'https://acme.com',
29
+ })
30
+ // profile → { name, description, tagline, palette:[{hex}], logoUrl, tone, keyProducts, socials }
31
+ // sources → which signals were available (markdown, branding, schema.org)
32
+
33
+ // Discover skills at runtime too (this catalog, live):
34
+ const { skills } = await ai.skills.list(collectionId)
35
+ ```
36
+
37
+ ## Deterministic extraction (no AI)
38
+
39
+ For structured pages, skip the LLM entirely — `research.fetch` returns schema.org
40
+ JSON-LD deterministically:
41
+
42
+ ```ts
43
+ const res = await ai./* research */ // see the `research` namespace
44
+ // or the tool directly inside an agent run: web.extractSchema
45
+ ```
46
+ (See the **Integrations / research** doc for `research.fetch`, used e.g. by the Recipes
47
+ app to pull a recipe's schema.org data without any AI.)
48
+
49
+ ## Open-ended tasks: the agent loop
50
+
51
+ When no skill fits, run the agent — it's given the tool catalog and reaches for tools
52
+ as your prompt warrants:
53
+
54
+ ```ts
55
+ const result = await ai.agent.run(collectionId, {
56
+ prompt: 'Research acme.com and draft a one-paragraph brand summary with 3 hero image ideas.',
57
+ allowCapabilities: ['web:read', 'ai:image'], // cap blast radius to these capabilities
58
+ })
59
+ // result.finalText + result.toolResults (the trace of tools the AI called)
60
+
61
+ const { tools } = await ai.agent.listTools(collectionId) // what the AI could reach for
62
+ ```
63
+
64
+ `allowCapabilities` gates which tools a run may use (e.g. omit `ai:image` to forbid
65
+ image generation). Capability tags are listed against each tool below.
66
+
67
+ ## How the AI discovers tools
68
+
69
+ Within a skill or `ai.agent.run`, the tool definitions (names, descriptions, JSON
70
+ schemas) are passed to the model, so it discovers and calls them automatically. Outside
71
+ a run — e.g. the plain chat endpoints — tools are **not** auto-injected; use a skill or
72
+ the agent loop to give the AI tool access.
73
+
74
+ ---
75
+
76
+ <!-- The section below is GENERATED from the server registry (single source of truth),
77
+ also served live at GET /admin/collection/:collectionId/ai/catalog.
78
+ Regenerate with `node scripts/gen-ai-catalog.js` in prove/server. -->
79
+
80
+ ## Skills
81
+
82
+ Named, composed capabilities an app invokes **by name** with structured input — no prompt-shaping. Call `SL.ai.skills.run(collectionId, name, input)`.
83
+
84
+ ### `research.brand`
85
+
86
+ Research a brand or company from its website URL into a structured brand profile (name, description, palette, logo, tone, key products, socials). Gathers page content + schema.org + branding deterministically, then synthesises with AI.
87
+
88
+ _Capabilities: web:read, ai:text_
89
+
90
+ **Input**
91
+ - `url` _(required)_ — string: The brand's website URL (https).
92
+ - `instructions` — string: Optional extra guidance for the researcher.
93
+
94
+ ## Tools
95
+
96
+ Atomic building blocks the AI reaches for **during** an agent/skill run — you rarely call these directly. Enumerable via `SL.ai.agent.listTools(collectionId)`; capability tags cap what a run may use.
97
+
98
+ ### `web.fetchPage`
99
+
100
+ Fetch a web page by URL and return clean markdown, page metadata, and any structured schema.org/JSON-LD data. Use to research a brand or product website.
101
+
102
+ _Capabilities: web:read_
103
+
104
+ **Parameters**
105
+ - `url` _(required)_ — string: Absolute URL to fetch (https).
106
+ - `type` — string: Optional schema.org @type filter for the returned JSON-LD, e.g. "Product" or "Recipe".
107
+ - `forceRefresh` — boolean: Bypass the cache and re-fetch.
108
+
109
+ ### `web.extractSchema`
110
+
111
+ Fetch a URL and return only its schema.org structured data (JSON-LD) of the given @type, e.g. "Recipe" or "Product". Deterministic — no AI.
112
+
113
+ _Capabilities: web:read_
114
+
115
+ **Parameters**
116
+ - `url` _(required)_ — string: Absolute URL to fetch (https).
117
+ - `schemaType` — string: schema.org @type to extract, e.g. "Recipe" or "Product".
118
+ - `forceRefresh` — boolean
119
+
120
+ ### `web.screenshot`
121
+
122
+ Capture a screenshot of a web page. Returns a stable hosted image URL (screenshotUrl) you can then read with image.describe.
123
+
124
+ _Capabilities: web:read_
125
+
126
+ **Parameters**
127
+ - `url` _(required)_ — string: Absolute URL to screenshot (https).
128
+
129
+ ### `image.describe`
130
+
131
+ Describe an image at a URL, or read text from it (image-to-text / vision). Use on a screenshot or photo to extract what it shows or says.
132
+
133
+ _Capabilities: ai:vision_
134
+
135
+ **Parameters**
136
+ - `imageUrl` _(required)_ — string: URL of the image to analyse.
137
+ - `prompt` — string: What to extract or describe (default: describe + transcribe visible text).
138
+
139
+ ### `brand.assets`
140
+
141
+ Extract a website's brand elements — logo, colours, design — plus page metadata. Use to research a brand's visual identity.
142
+
143
+ _Capabilities: web:read_
144
+
145
+ **Parameters**
146
+ - `url` _(required)_ — string: The brand's website URL (https).
147
+
148
+ ### `image.generate`
149
+
150
+ Generate a new image from a text prompt. Returns the generated image (url or base64).
151
+
152
+ _Capabilities: ai:image_
153
+
154
+ **Parameters**
155
+ - `prompt` _(required)_ — string: Description of the image to generate.
156
+ - `size` — string: e.g. "1024x1024".
157
+ - `provider` — `openai` | `gemini`: Image model provider.
158
+
159
+ ### `image.searchStock`
160
+
161
+ Search stock photography (Unsplash) for real photos matching a query. Returns candidate image URLs.
162
+
163
+ _Capabilities: web:read_
164
+
165
+ **Parameters**
166
+ - `query` _(required)_ — string: What to search for.
167
+ - `per_page` — number: How many results (default 10).
168
+ - `orientation` — `landscape` | `portrait` | `squarish`
package/openapi.yaml CHANGED
@@ -9,6 +9,8 @@ servers:
9
9
  tags:
10
10
  - name: responses
11
11
  - name: completions
12
+ - name: agent
13
+ - name: skills
12
14
  - name: models
13
15
  - name: rag
14
16
  - name: sessions
@@ -50,6 +52,7 @@ tags:
50
52
  - name: proof
51
53
  - name: qr
52
54
  - name: realtime
55
+ - name: research
53
56
  - name: segments
54
57
  - name: tags
55
58
  - name: template
@@ -619,6 +622,108 @@ paths:
619
622
  description: Unauthorized
620
623
  404:
621
624
  description: Not found
625
+ /admin/collection/{collectionId}/ai/agent/run:
626
+ post:
627
+ tags:
628
+ - agent
629
+ summary: "Run the server-side AI agent loop once: assembles the tool set, runs the model, executes tool calls, and returns the final text + the tool trace."
630
+ operationId: agent_run
631
+ security:
632
+ - bearerAuth: []
633
+ parameters:
634
+ - name: collectionId
635
+ in: path
636
+ required: true
637
+ schema:
638
+ type: string
639
+ responses:
640
+ 200:
641
+ description: Success
642
+ content:
643
+ application/json:
644
+ schema:
645
+ $ref: "#/components/schemas/AgentRunResult"
646
+ 400:
647
+ description: Bad request
648
+ 401:
649
+ description: Unauthorized
650
+ 404:
651
+ description: Not found
652
+ requestBody:
653
+ required: true
654
+ content:
655
+ application/json:
656
+ schema:
657
+ $ref: "#/components/schemas/AgentRunRequest"
658
+ /admin/collection/{collectionId}/ai/agent/tools:
659
+ get:
660
+ tags:
661
+ - agent
662
+ summary: List the tools the agent can use (optionally scoped by capability / name).
663
+ operationId: agent_listTools
664
+ security:
665
+ - bearerAuth: []
666
+ parameters:
667
+ - name: collectionId
668
+ in: path
669
+ required: true
670
+ schema:
671
+ type: string
672
+ - name: allowCapabilities
673
+ in: query
674
+ required: false
675
+ schema:
676
+ type: string
677
+ - name: only
678
+ in: query
679
+ required: false
680
+ schema:
681
+ type: string
682
+ - name: exclude
683
+ in: query
684
+ required: false
685
+ schema:
686
+ type: string
687
+ responses:
688
+ 200:
689
+ description: Success
690
+ content:
691
+ application/json:
692
+ schema:
693
+ $ref: "#/components/schemas/AgentToolsResponse"
694
+ 400:
695
+ description: Bad request
696
+ 401:
697
+ description: Unauthorized
698
+ 404:
699
+ description: Not found
700
+ /admin/collection/{collectionId}/ai/catalog:
701
+ get:
702
+ tags:
703
+ - skills
704
+ summary: The full self-describing catalog (tools + skills).
705
+ operationId: skills_catalog
706
+ security:
707
+ - bearerAuth: []
708
+ parameters:
709
+ - name: collectionId
710
+ in: path
711
+ required: true
712
+ schema:
713
+ type: string
714
+ responses:
715
+ 200:
716
+ description: Success
717
+ content:
718
+ application/json:
719
+ schema:
720
+ $ref: "#/components/schemas/CatalogResponse"
721
+ 400:
722
+ description: Bad request
723
+ 401:
724
+ description: Unauthorized
725
+ 404:
726
+ description: Not found
622
727
  /admin/collection/{collectionId}/ai/configureAssistant:
623
728
  post:
624
729
  tags:
@@ -947,6 +1052,33 @@ paths:
947
1052
  description: Unauthorized
948
1053
  404:
949
1054
  description: Not found
1055
+ /admin/collection/{collectionId}/ai/skills:
1056
+ get:
1057
+ tags:
1058
+ - skills
1059
+ summary: List the skills apps can invoke (name, description, input/output schema).
1060
+ operationId: skills_list
1061
+ security:
1062
+ - bearerAuth: []
1063
+ parameters:
1064
+ - name: collectionId
1065
+ in: path
1066
+ required: true
1067
+ schema:
1068
+ type: string
1069
+ responses:
1070
+ 200:
1071
+ description: Success
1072
+ content:
1073
+ application/json:
1074
+ schema:
1075
+ $ref: "#/components/schemas/SkillsListResponse"
1076
+ 400:
1077
+ description: Bad request
1078
+ 401:
1079
+ description: Unauthorized
1080
+ 404:
1081
+ description: Not found
950
1082
  /admin/collection/{collectionId}/ai/tts:
951
1083
  post:
952
1084
  tags:
@@ -7404,6 +7536,39 @@ paths:
7404
7536
  description: Unauthorized
7405
7537
  404:
7406
7538
  description: Not found
7539
+ /admin/collection/{collectionId}/research/fetch:
7540
+ post:
7541
+ tags:
7542
+ - research
7543
+ summary: "Fetch + extract a web page: clean markdown, page metadata, and any schema.org JSON-LD (filtered by `type` when given)."
7544
+ operationId: research_fetch
7545
+ security:
7546
+ - bearerAuth: []
7547
+ parameters:
7548
+ - name: collectionId
7549
+ in: path
7550
+ required: true
7551
+ schema:
7552
+ type: string
7553
+ responses:
7554
+ 200:
7555
+ description: Success
7556
+ content:
7557
+ application/json:
7558
+ schema:
7559
+ $ref: "#/components/schemas/ResearchFetchResult"
7560
+ 400:
7561
+ description: Bad request
7562
+ 401:
7563
+ description: Unauthorized
7564
+ 404:
7565
+ description: Not found
7566
+ requestBody:
7567
+ required: true
7568
+ content:
7569
+ application/json:
7570
+ schema:
7571
+ $ref: "#/components/schemas/ResearchFetchRequest"
7407
7572
  /admin/collection/{collectionId}/segments:
7408
7573
  get:
7409
7574
  tags:
@@ -15814,6 +15979,143 @@ components:
15814
15979
  type: string
15815
15980
  required:
15816
15981
  - url
15982
+ AgentRunRequest:
15983
+ type: object
15984
+ properties:
15985
+ input:
15986
+ type: string
15987
+ prompt:
15988
+ type: string
15989
+ instructions:
15990
+ type: string
15991
+ model:
15992
+ type: string
15993
+ maxSteps:
15994
+ type: number
15995
+ allowCapabilities:
15996
+ type: array
15997
+ items:
15998
+ type: string
15999
+ only:
16000
+ type: array
16001
+ items:
16002
+ type: string
16003
+ exclude:
16004
+ type: array
16005
+ items:
16006
+ type: string
16007
+ AgentToolResult:
16008
+ type: object
16009
+ properties:
16010
+ name:
16011
+ type: string
16012
+ isError:
16013
+ type: boolean
16014
+ result: {}
16015
+ required:
16016
+ - name
16017
+ - isError
16018
+ - result
16019
+ AgentRunResult:
16020
+ type: object
16021
+ properties:
16022
+ finalText:
16023
+ type: string
16024
+ steps:
16025
+ type: number
16026
+ maxStepsReached:
16027
+ type: boolean
16028
+ toolResults:
16029
+ type: array
16030
+ items:
16031
+ $ref: "#/components/schemas/AgentToolResult"
16032
+ availableTools:
16033
+ type: array
16034
+ items:
16035
+ type: string
16036
+ required:
16037
+ - finalText
16038
+ - steps
16039
+ - maxStepsReached
16040
+ - toolResults
16041
+ - availableTools
16042
+ AgentToolDefinition:
16043
+ type: object
16044
+ properties:
16045
+ name:
16046
+ type: string
16047
+ description:
16048
+ type: string
16049
+ capabilities:
16050
+ type: array
16051
+ items:
16052
+ type: string
16053
+ parameters: {}
16054
+ required:
16055
+ - name
16056
+ - description
16057
+ - capabilities
16058
+ - parameters
16059
+ AgentToolsResponse:
16060
+ type: object
16061
+ properties:
16062
+ tools:
16063
+ type: array
16064
+ items:
16065
+ $ref: "#/components/schemas/AgentToolDefinition"
16066
+ required:
16067
+ - tools
16068
+ AgentToolsQuery:
16069
+ type: object
16070
+ properties:
16071
+ allowCapabilities:
16072
+ type: string
16073
+ only:
16074
+ type: string
16075
+ exclude:
16076
+ type: string
16077
+ SkillDescriptor:
16078
+ type: object
16079
+ properties:
16080
+ name:
16081
+ type: string
16082
+ description:
16083
+ type: string
16084
+ inputSchema: {}
16085
+ outputSchema: {}
16086
+ capabilities:
16087
+ type: array
16088
+ items:
16089
+ type: string
16090
+ required:
16091
+ - name
16092
+ - description
16093
+ - inputSchema
16094
+ - outputSchema
16095
+ - capabilities
16096
+ SkillsListResponse:
16097
+ type: object
16098
+ properties:
16099
+ skills:
16100
+ type: array
16101
+ items:
16102
+ $ref: "#/components/schemas/SkillDescriptor"
16103
+ required:
16104
+ - skills
16105
+ CatalogResponse:
16106
+ type: object
16107
+ properties:
16108
+ tools:
16109
+ type: array
16110
+ items:
16111
+ $ref: "#/components/schemas/AgentToolDefinition"
16112
+ skills:
16113
+ type: array
16114
+ items:
16115
+ $ref: "#/components/schemas/SkillDescriptor"
16116
+ required:
16117
+ - tools
16118
+ - skills
15817
16119
  AnalyticsLocation:
15818
16120
  type: object
15819
16121
  properties:
@@ -26399,6 +26701,51 @@ components:
26399
26701
  - nonce
26400
26702
  - mac
26401
26703
  - clientId
26704
+ ResearchFetchRequest:
26705
+ type: object
26706
+ properties:
26707
+ url:
26708
+ type: string
26709
+ type:
26710
+ type: string
26711
+ schemaType:
26712
+ type: string
26713
+ forceRefresh:
26714
+ type: boolean
26715
+ required:
26716
+ - url
26717
+ ResearchFetchResult:
26718
+ type: object
26719
+ properties:
26720
+ provider:
26721
+ type: string
26722
+ enum:
26723
+ - firecrawl
26724
+ - web
26725
+ status:
26726
+ type: number
26727
+ markdown:
26728
+ type: string
26729
+ html:
26730
+ type: string
26731
+ metadata:
26732
+ type: object
26733
+ additionalProperties: true
26734
+ schemas:
26735
+ type: array
26736
+ items: {}
26737
+ url:
26738
+ type: string
26739
+ cached:
26740
+ type: boolean
26741
+ fetchedAt:
26742
+ type: string
26743
+ required:
26744
+ - provider
26745
+ - status
26746
+ - schemas
26747
+ - url
26748
+ - cached
26402
26749
  InteractionFilterValue:
26403
26750
  type: object
26404
26751
  properties:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proveanything/smartlinks",
3
- "version": "1.17.0",
3
+ "version": "1.17.4",
4
4
  "description": "Official JavaScript/TypeScript SDK for the Smartlinks API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",