@canvs/canvs-library-skill 0.0.5 → 0.0.9
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,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: canvs-library-skill
|
|
3
|
+
description: Publishes markdown documents to Canvs Library and searches existing research. Use when the user asks to publish, post, save, or share research to Canvs Library, or to search, find, or retrieve research. Triggers on "publish to library", "save to Canvs Library", "search the library", "find research on", "get research from Canvs", or any mention of research.canvs.in.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Canvs Library
|
|
7
|
+
|
|
8
|
+
Publish markdown to [{{RESEARCH_APP_URL}}]({{RESEARCH_APP_URL}}) and search or retrieve research entries via the Canvs Library API at `{{LIBRARY_API_BASE_URL}}`.
|
|
9
|
+
|
|
10
|
+
## Authentication
|
|
11
|
+
|
|
12
|
+
All calls require `Authorization: Bearer <token>`. Get the token by asking the user to copy the `canvs_access_token` cookie from `{{LIBRARY_APP_URL}}` (DevTools → Application → Cookies). If not logged in, send them to `{{AUTH_APP_URL}}`.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
TOKEN="<token>"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Publish a document
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
curl -s -X POST "{{LIBRARY_API_BASE_URL}}/research" \
|
|
22
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
23
|
+
-H "Content-Type: application/json" \
|
|
24
|
+
-d '{
|
|
25
|
+
"markdown": "<content>",
|
|
26
|
+
"title": "<optional>",
|
|
27
|
+
"tags": ["tag1"],
|
|
28
|
+
"slug": "optional-slug",
|
|
29
|
+
"visibility": "public",
|
|
30
|
+
"source_agent": "claude"
|
|
31
|
+
}'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Required: `markdown`. Optional: `title` (inferred from first `#` if omitted), `tags`, `slug`, `visibility` (`"public"` | `"private"`, default `"public"`), `polish` (boolean — Claude polishes markdown before saving), `polish_instructions`, `source_agent`.
|
|
35
|
+
|
|
36
|
+
**Success (201):** returns `{ id, slug, url, title }`. Always report the `url` to the user.
|
|
37
|
+
|
|
38
|
+
## Add a sub-page
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
curl -s -X POST "{{LIBRARY_API_BASE_URL}}/research/{research_id}/pages" \
|
|
42
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
43
|
+
-H "Content-Type: application/json" \
|
|
44
|
+
-d '{
|
|
45
|
+
"markdown": "<content>",
|
|
46
|
+
"path": "section/subsection",
|
|
47
|
+
"title": "<optional>"
|
|
48
|
+
}'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Required: `research_id`, `markdown`, `path` (hierarchical, e.g. `"methods/sampling"`).
|
|
52
|
+
|
|
53
|
+
## Search
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
curl -s "{{LIBRARY_API_BASE_URL}}/research?q=<query>&tags=tag1&limit=20&offset=0" \
|
|
57
|
+
-H "Authorization: Bearer $TOKEN"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Returns array of entries with `id`, `title`, `slug`, `tags`, `url`, `created_at`.
|
|
61
|
+
|
|
62
|
+
## Get a research entry
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -s "{{LIBRARY_API_BASE_URL}}/research/{research_id}" \
|
|
66
|
+
-H "Authorization: Bearer $TOKEN"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Workflow
|
|
70
|
+
|
|
71
|
+
**Publish:** Ask for token if not provided → prepare markdown → `POST /research` → report URL.
|
|
72
|
+
|
|
73
|
+
**Multi-page:** `POST /research` for root (save `id`) → `POST /research/{id}/pages` for each section with its `path`.
|
|
74
|
+
|
|
75
|
+
**Search:** Ask for token if not provided → `GET /research?q=...` → present results as list with titles and URLs.
|
|
76
|
+
|
|
77
|
+
## Errors
|
|
78
|
+
|
|
79
|
+
| Status | Cause | Action |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| 401 | Token expired | Ask user to refresh cookie |
|
|
82
|
+
| 403 | Wrong account | Confirm login |
|
|
83
|
+
| 409 | Slug taken | Omit slug or choose another |
|
|
84
|
+
| 422 | Validation error | Report error detail from response body |
|
|
85
|
+
| 500 | Server error | Retry once |
|
package/package.json
CHANGED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "canvs-library-skill",
|
|
3
|
-
"version": "{{BUILD_VERSION}}",
|
|
4
|
-
"description": "Publish and search research documents in Canvs Library",
|
|
5
|
-
"base_url": "{{LIBRARY_API_BASE_URL}}",
|
|
6
|
-
"client_id": "{{LIBRARY_SKILL_CLIENT_ID}}",
|
|
7
|
-
"tools": [
|
|
8
|
-
{
|
|
9
|
-
"name": "authenticate_library",
|
|
10
|
-
"description": "Exchange Canvs agent client credentials for a Bearer token. Call before any other library tool. Cache token for 55 minutes.",
|
|
11
|
-
"input_schema": {
|
|
12
|
-
"type": "object",
|
|
13
|
-
"required": [
|
|
14
|
-
"environment"
|
|
15
|
-
],
|
|
16
|
-
"properties": {
|
|
17
|
-
"environment": {
|
|
18
|
-
"type": "string",
|
|
19
|
-
"enum": [
|
|
20
|
-
"staging",
|
|
21
|
-
"production"
|
|
22
|
-
],
|
|
23
|
-
"default": "production"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"name": "publish_document",
|
|
30
|
-
"description": "Publish a markdown document to research.canvs.in. Returns the public URL and research_id.",
|
|
31
|
-
"input_schema": {
|
|
32
|
-
"type": "object",
|
|
33
|
-
"required": [
|
|
34
|
-
"markdown"
|
|
35
|
-
],
|
|
36
|
-
"properties": {
|
|
37
|
-
"markdown": {
|
|
38
|
-
"type": "string"
|
|
39
|
-
},
|
|
40
|
-
"title": {
|
|
41
|
-
"type": "string"
|
|
42
|
-
},
|
|
43
|
-
"tags": {
|
|
44
|
-
"type": "array",
|
|
45
|
-
"items": {
|
|
46
|
-
"type": "string"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"slug": {
|
|
50
|
-
"type": "string"
|
|
51
|
-
},
|
|
52
|
-
"visibility": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"enum": [
|
|
55
|
-
"public",
|
|
56
|
-
"private"
|
|
57
|
-
],
|
|
58
|
-
"default": "public"
|
|
59
|
-
},
|
|
60
|
-
"polish": {
|
|
61
|
-
"type": "boolean",
|
|
62
|
-
"default": false
|
|
63
|
-
},
|
|
64
|
-
"polish_instructions": {
|
|
65
|
-
"type": "string"
|
|
66
|
-
},
|
|
67
|
-
"source_agent": {
|
|
68
|
-
"type": "string"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "publish_page",
|
|
75
|
-
"description": "Add a sub-page to an existing research tree.",
|
|
76
|
-
"input_schema": {
|
|
77
|
-
"type": "object",
|
|
78
|
-
"required": [
|
|
79
|
-
"research_id",
|
|
80
|
-
"markdown",
|
|
81
|
-
"path"
|
|
82
|
-
],
|
|
83
|
-
"properties": {
|
|
84
|
-
"research_id": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
},
|
|
87
|
-
"markdown": {
|
|
88
|
-
"type": "string"
|
|
89
|
-
},
|
|
90
|
-
"path": {
|
|
91
|
-
"type": "string"
|
|
92
|
-
},
|
|
93
|
-
"title": {
|
|
94
|
-
"type": "string"
|
|
95
|
-
},
|
|
96
|
-
"polish": {
|
|
97
|
-
"type": "boolean",
|
|
98
|
-
"default": false
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"name": "search_library",
|
|
105
|
-
"description": "Search published research by keyword or tags.",
|
|
106
|
-
"input_schema": {
|
|
107
|
-
"type": "object",
|
|
108
|
-
"properties": {
|
|
109
|
-
"q": {
|
|
110
|
-
"type": "string"
|
|
111
|
-
},
|
|
112
|
-
"tags": {
|
|
113
|
-
"type": "array",
|
|
114
|
-
"items": {
|
|
115
|
-
"type": "string"
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"limit": {
|
|
119
|
-
"type": "number",
|
|
120
|
-
"default": 20
|
|
121
|
-
},
|
|
122
|
-
"offset": {
|
|
123
|
-
"type": "number",
|
|
124
|
-
"default": 0
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"name": "get_research",
|
|
131
|
-
"description": "Get full metadata and page tree for a research entry.",
|
|
132
|
-
"input_schema": {
|
|
133
|
-
"type": "object",
|
|
134
|
-
"required": [
|
|
135
|
-
"research_id"
|
|
136
|
-
],
|
|
137
|
-
"properties": {
|
|
138
|
-
"research_id": {
|
|
139
|
-
"type": "string"
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
}
|