@vertesia/tools-sdk 1.0.0-dev.20260128.144200 → 1.0.0-dev.20260203.130115Z
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/package.json +5 -5
- package/src/ContentTypesCollection.ts +51 -0
- package/src/InteractionCollection.ts +1 -94
- package/src/SkillCollection.ts +3 -2
- package/src/ToolCollection.ts +6 -4
- package/src/ToolRegistry.ts +10 -4
- package/src/index.ts +1 -0
- package/src/server/app-package.ts +102 -0
- package/src/server/conyent-types.ts +71 -0
- package/src/server/interactions.ts +24 -3
- package/src/server/site.ts +9 -0
- package/src/server/types.ts +18 -0
- package/src/server.ts +5 -0
- package/src/site/styles.ts +55 -0
- package/src/site/templates.ts +107 -84
- package/src/types.ts +2 -18
- package/lib/cjs/InteractionCollection.js +0 -164
- package/lib/cjs/InteractionCollection.js.map +0 -1
- package/lib/cjs/SkillCollection.js +0 -376
- package/lib/cjs/SkillCollection.js.map +0 -1
- package/lib/cjs/ToolCollection.js +0 -228
- package/lib/cjs/ToolCollection.js.map +0 -1
- package/lib/cjs/ToolRegistry.js +0 -111
- package/lib/cjs/ToolRegistry.js.map +0 -1
- package/lib/cjs/auth.js +0 -104
- package/lib/cjs/auth.js.map +0 -1
- package/lib/cjs/build/validate.js +0 -7
- package/lib/cjs/build/validate.js.map +0 -1
- package/lib/cjs/copy-assets.js +0 -84
- package/lib/cjs/copy-assets.js.map +0 -1
- package/lib/cjs/index.js +0 -31
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/server/interactions.js +0 -66
- package/lib/cjs/server/interactions.js.map +0 -1
- package/lib/cjs/server/mcp.js +0 -45
- package/lib/cjs/server/mcp.js.map +0 -1
- package/lib/cjs/server/site.js +0 -30
- package/lib/cjs/server/site.js.map +0 -1
- package/lib/cjs/server/skills.js +0 -114
- package/lib/cjs/server/skills.js.map +0 -1
- package/lib/cjs/server/tools.js +0 -104
- package/lib/cjs/server/tools.js.map +0 -1
- package/lib/cjs/server/types.js +0 -3
- package/lib/cjs/server/types.js.map +0 -1
- package/lib/cjs/server/widgets.js +0 -27
- package/lib/cjs/server/widgets.js.map +0 -1
- package/lib/cjs/server.js +0 -132
- package/lib/cjs/server.js.map +0 -1
- package/lib/cjs/site/styles.js +0 -637
- package/lib/cjs/site/styles.js.map +0 -1
- package/lib/cjs/site/templates.js +0 -995
- package/lib/cjs/site/templates.js.map +0 -1
- package/lib/cjs/types.js +0 -3
- package/lib/cjs/types.js.map +0 -1
- package/lib/cjs/utils.js +0 -31
- package/lib/cjs/utils.js.map +0 -1
- package/lib/esm/InteractionCollection.js +0 -125
- package/lib/esm/InteractionCollection.js.map +0 -1
- package/lib/esm/SkillCollection.js +0 -369
- package/lib/esm/SkillCollection.js.map +0 -1
- package/lib/esm/ToolCollection.js +0 -190
- package/lib/esm/ToolCollection.js.map +0 -1
- package/lib/esm/ToolRegistry.js +0 -106
- package/lib/esm/ToolRegistry.js.map +0 -1
- package/lib/esm/auth.js +0 -97
- package/lib/esm/auth.js.map +0 -1
- package/lib/esm/build/validate.js +0 -4
- package/lib/esm/build/validate.js.map +0 -1
- package/lib/esm/copy-assets.js +0 -81
- package/lib/esm/copy-assets.js.map +0 -1
- package/lib/esm/index.js +0 -11
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/server/interactions.js +0 -63
- package/lib/esm/server/interactions.js.map +0 -1
- package/lib/esm/server/mcp.js +0 -42
- package/lib/esm/server/mcp.js.map +0 -1
- package/lib/esm/server/site.js +0 -27
- package/lib/esm/server/site.js.map +0 -1
- package/lib/esm/server/skills.js +0 -111
- package/lib/esm/server/skills.js.map +0 -1
- package/lib/esm/server/tools.js +0 -101
- package/lib/esm/server/tools.js.map +0 -1
- package/lib/esm/server/types.js +0 -2
- package/lib/esm/server/types.js.map +0 -1
- package/lib/esm/server/widgets.js +0 -24
- package/lib/esm/server/widgets.js.map +0 -1
- package/lib/esm/server.js +0 -128
- package/lib/esm/server.js.map +0 -1
- package/lib/esm/site/styles.js +0 -634
- package/lib/esm/site/styles.js.map +0 -1
- package/lib/esm/site/templates.js +0 -983
- package/lib/esm/site/templates.js.map +0 -1
- package/lib/esm/types.js +0 -2
- package/lib/esm/types.js.map +0 -1
- package/lib/esm/utils.js +0 -26
- package/lib/esm/utils.js.map +0 -1
- package/lib/types/InteractionCollection.d.ts +0 -48
- package/lib/types/InteractionCollection.d.ts.map +0 -1
- package/lib/types/SkillCollection.d.ts +0 -118
- package/lib/types/SkillCollection.d.ts.map +0 -1
- package/lib/types/ToolCollection.d.ts +0 -72
- package/lib/types/ToolCollection.d.ts.map +0 -1
- package/lib/types/ToolRegistry.d.ts +0 -41
- package/lib/types/ToolRegistry.d.ts.map +0 -1
- package/lib/types/auth.d.ts +0 -32
- package/lib/types/auth.d.ts.map +0 -1
- package/lib/types/build/validate.d.ts +0 -2
- package/lib/types/build/validate.d.ts.map +0 -1
- package/lib/types/copy-assets.d.ts +0 -14
- package/lib/types/copy-assets.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -11
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/server/interactions.d.ts +0 -4
- package/lib/types/server/interactions.d.ts.map +0 -1
- package/lib/types/server/mcp.d.ts +0 -4
- package/lib/types/server/mcp.d.ts.map +0 -1
- package/lib/types/server/site.d.ts +0 -4
- package/lib/types/server/site.d.ts.map +0 -1
- package/lib/types/server/skills.d.ts +0 -4
- package/lib/types/server/skills.d.ts.map +0 -1
- package/lib/types/server/tools.d.ts +0 -4
- package/lib/types/server/tools.d.ts.map +0 -1
- package/lib/types/server/types.d.ts +0 -66
- package/lib/types/server/types.d.ts.map +0 -1
- package/lib/types/server/widgets.d.ts +0 -9
- package/lib/types/server/widgets.d.ts.map +0 -1
- package/lib/types/server.d.ts +0 -27
- package/lib/types/server.d.ts.map +0 -1
- package/lib/types/site/styles.d.ts +0 -5
- package/lib/types/site/styles.d.ts.map +0 -1
- package/lib/types/site/templates.d.ts +0 -55
- package/lib/types/site/templates.d.ts.map +0 -1
- package/lib/types/types.d.ts +0 -280
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/utils.d.ts +0 -4
- package/lib/types/utils.d.ts.map +0 -1
package/src/site/styles.ts
CHANGED
|
@@ -396,6 +396,43 @@ hr {
|
|
|
396
396
|
font-family: ui-monospace, monospace;
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
+
.endpoint-box {
|
|
400
|
+
display: flex;
|
|
401
|
+
align-items: center;
|
|
402
|
+
gap: 0.75rem;
|
|
403
|
+
background: #f3f4f6;
|
|
404
|
+
padding: 0.75rem 1rem;
|
|
405
|
+
border-radius: 8px;
|
|
406
|
+
margin-top: 0.5rem;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.endpoint-box code {
|
|
410
|
+
flex: 1;
|
|
411
|
+
font-family: ui-monospace, monospace;
|
|
412
|
+
font-size: 0.875rem;
|
|
413
|
+
color: #1f2937;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.copy-btn {
|
|
417
|
+
background: #e5e7eb;
|
|
418
|
+
border: none;
|
|
419
|
+
padding: 0.5rem;
|
|
420
|
+
border-radius: 6px;
|
|
421
|
+
cursor: pointer;
|
|
422
|
+
color: #6b7280;
|
|
423
|
+
transition: all 0.15s;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.copy-btn:hover {
|
|
427
|
+
background: #d1d5db;
|
|
428
|
+
color: #374151;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.copy-btn svg {
|
|
432
|
+
width: 16px;
|
|
433
|
+
height: 16px;
|
|
434
|
+
}
|
|
435
|
+
|
|
399
436
|
.badge {
|
|
400
437
|
display: inline-block;
|
|
401
438
|
font-size: 0.75rem;
|
|
@@ -583,6 +620,24 @@ hr {
|
|
|
583
620
|
background: rgba(15, 23, 42, 0.95);
|
|
584
621
|
}
|
|
585
622
|
|
|
623
|
+
.endpoint-box {
|
|
624
|
+
background: rgba(31, 41, 55, 0.95);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.endpoint-box code {
|
|
628
|
+
color: #e5e7eb;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.copy-btn {
|
|
632
|
+
background: rgba(55, 65, 81, 0.95);
|
|
633
|
+
color: #e5e7eb;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.copy-btn:hover {
|
|
637
|
+
background: rgba(75, 85, 99, 0.98);
|
|
638
|
+
color: #f9fafb;
|
|
639
|
+
}
|
|
640
|
+
|
|
586
641
|
.badge {
|
|
587
642
|
background: rgba(15, 23, 42, 0.96);
|
|
588
643
|
color: #e5e7eb;
|
package/src/site/templates.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { InteractionCollection } from "../InteractionCollection.js";
|
|
|
2
2
|
import { ToolServerConfig } from "../server/types.js";
|
|
3
3
|
import type { SkillCollection } from "../SkillCollection.js";
|
|
4
4
|
import type { ToolCollection } from "../ToolCollection.js";
|
|
5
|
+
import type { ContentTypesCollection } from "../ContentTypesCollection.js";
|
|
5
6
|
import type { ICollection, SkillDefinition, Tool } from "../types.js";
|
|
6
7
|
import { join } from "../utils.js";
|
|
7
8
|
import { baseStyles } from "./styles.js";
|
|
@@ -230,43 +231,6 @@ ${baseStyles}
|
|
|
230
231
|
white-space: pre-wrap;
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
.endpoint-box {
|
|
234
|
-
display: flex;
|
|
235
|
-
align-items: center;
|
|
236
|
-
gap: 0.75rem;
|
|
237
|
-
background: #f3f4f6;
|
|
238
|
-
padding: 0.75rem 1rem;
|
|
239
|
-
border-radius: 8px;
|
|
240
|
-
margin-top: 0.5rem;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
.endpoint-box code {
|
|
244
|
-
flex: 1;
|
|
245
|
-
font-family: ui-monospace, monospace;
|
|
246
|
-
font-size: 0.875rem;
|
|
247
|
-
color: #1f2937;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.copy-btn {
|
|
251
|
-
background: #e5e7eb;
|
|
252
|
-
border: none;
|
|
253
|
-
padding: 0.5rem;
|
|
254
|
-
border-radius: 6px;
|
|
255
|
-
cursor: pointer;
|
|
256
|
-
color: #6b7280;
|
|
257
|
-
transition: all 0.15s;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.copy-btn:hover {
|
|
261
|
-
background: #d1d5db;
|
|
262
|
-
color: #374151;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.copy-btn svg {
|
|
266
|
-
width: 16px;
|
|
267
|
-
height: 16px;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
234
|
.empty-state {
|
|
271
235
|
text-align: center;
|
|
272
236
|
padding: 3rem;
|
|
@@ -347,24 +311,6 @@ ${baseStyles}
|
|
|
347
311
|
color: #e5e7eb;
|
|
348
312
|
}
|
|
349
313
|
|
|
350
|
-
.endpoint-box {
|
|
351
|
-
background: rgba(31, 41, 55, 0.95);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.endpoint-box code {
|
|
355
|
-
color: #e5e7eb;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.copy-btn {
|
|
359
|
-
background: rgba(55, 65, 81, 0.95);
|
|
360
|
-
color: #e5e7eb;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.copy-btn:hover {
|
|
364
|
-
background: rgba(75, 85, 99, 0.98);
|
|
365
|
-
color: #f9fafb;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
314
|
.empty-state {
|
|
369
315
|
color: #9ca3af;
|
|
370
316
|
}
|
|
@@ -719,6 +665,7 @@ export function indexPage(
|
|
|
719
665
|
tools = [],
|
|
720
666
|
interactions = [],
|
|
721
667
|
skills = [],
|
|
668
|
+
types = [],
|
|
722
669
|
mcpProviders = [],
|
|
723
670
|
hideUILinks = false,
|
|
724
671
|
} = config;
|
|
@@ -744,12 +691,13 @@ export function indexPage(
|
|
|
744
691
|
<p class="hero-eyebrow">Tools Server</p>
|
|
745
692
|
<h1 class="hero-title">${title}</h1>
|
|
746
693
|
<p class="hero-tagline">
|
|
747
|
-
Discover the tools, skills, and
|
|
694
|
+
Discover the tools, skills, interactions, and content types exposed by this server.
|
|
748
695
|
</p>
|
|
749
696
|
<div class="hero-summary">
|
|
750
697
|
${tools.length ? /*html*/`<span><dot></dot> ${tools.length} tool collection${tools.length !== 1 ? 's' : ''}</span>` : ''}
|
|
751
698
|
${skills.length ? /*html*/`<span><dot></dot> ${skills.length} skill collection${skills.length !== 1 ? 's' : ''}</span>` : ''}
|
|
752
699
|
${interactions.length ? /*html*/`<span><dot></dot> ${interactions.length} interaction collection${interactions.length !== 1 ? 's' : ''}</span>` : ''}
|
|
700
|
+
${types.length ? /*html*/`<span><dot></dot> ${types.length} content type collection${types.length !== 1 ? 's' : ''}</span>` : ''}
|
|
753
701
|
${mcpProviders.length ? /*html*/`<span><dot></dot> ${mcpProviders.length} MCP provider${mcpProviders.length !== 1 ? 's' : ''}</span>` : ''}
|
|
754
702
|
</div>
|
|
755
703
|
${hideUILinks ? '' : renderUILinks()}
|
|
@@ -758,6 +706,13 @@ export function indexPage(
|
|
|
758
706
|
<aside class="hero-panel">
|
|
759
707
|
<div class="hero-panel-label">Base endpoint</div>
|
|
760
708
|
<div class="hero-panel-endpoint"><code>/api</code></div>
|
|
709
|
+
<div class="hero-panel-label" style="margin-top: 1rem;">Package endpoint</div>
|
|
710
|
+
<div class="endpoint-box" style="margin-top: 0.5rem;">
|
|
711
|
+
<code id="package-endpoint-url">/api/package</code>
|
|
712
|
+
<button class="copy-btn" onclick="copyPackageUrl(this)" title="Copy package endpoint URL">
|
|
713
|
+
${copyIcon}
|
|
714
|
+
</button>
|
|
715
|
+
</div>
|
|
761
716
|
<p class="hero-panel-hint">
|
|
762
717
|
Use <strong>POST /api/tools/<collection></strong> or
|
|
763
718
|
<strong>POST /api/skills/<collection></strong> to call these from your apps or agents.
|
|
@@ -770,7 +725,7 @@ export function indexPage(
|
|
|
770
725
|
type="search"
|
|
771
726
|
id="collection-search"
|
|
772
727
|
class="search-input"
|
|
773
|
-
placeholder="Search tools, skills, interactions..."
|
|
728
|
+
placeholder="Search tools, skills, interactions, types..."
|
|
774
729
|
aria-label="Search collections"
|
|
775
730
|
autocomplete="off"
|
|
776
731
|
/>
|
|
@@ -823,6 +778,22 @@ export function indexPage(
|
|
|
823
778
|
</section>
|
|
824
779
|
` : ''}
|
|
825
780
|
|
|
781
|
+
${types.length > 0 ? /*html*/`
|
|
782
|
+
<section data-section="types">
|
|
783
|
+
<hr>
|
|
784
|
+
<div class="section-header">
|
|
785
|
+
<h2>Content Type Collections</h2>
|
|
786
|
+
<p class="section-subtitle">Schema definitions for structured content in the data store.</p>
|
|
787
|
+
</div>
|
|
788
|
+
<div class="card-grid">
|
|
789
|
+
${types.map((t: ContentTypesCollection) => {
|
|
790
|
+
const count = t.getContentTypes().length;
|
|
791
|
+
return collectionCard(t, 'types', `${count} type${count !== 1 ? 's' : ''}`);
|
|
792
|
+
}).join('')}
|
|
793
|
+
</div>
|
|
794
|
+
</section>
|
|
795
|
+
` : ''}
|
|
796
|
+
|
|
826
797
|
${mcpProviders.length > 0 ? /*html*/`
|
|
827
798
|
<section data-section="mcp">
|
|
828
799
|
<hr>
|
|
@@ -884,6 +855,18 @@ export function indexPage(
|
|
|
884
855
|
update(input.value);
|
|
885
856
|
});
|
|
886
857
|
}());
|
|
858
|
+
|
|
859
|
+
function copyPackageUrl(btn) {
|
|
860
|
+
var url = window.location.origin + '/api/package';
|
|
861
|
+
navigator.clipboard.writeText(url);
|
|
862
|
+
var originalHtml = btn.innerHTML;
|
|
863
|
+
btn.innerHTML = '✓';
|
|
864
|
+
btn.style.color = '#10b981';
|
|
865
|
+
setTimeout(function() {
|
|
866
|
+
btn.innerHTML = originalHtml;
|
|
867
|
+
btn.style.color = '#6b7280';
|
|
868
|
+
}, 1500);
|
|
869
|
+
}
|
|
887
870
|
</script>
|
|
888
871
|
</body>
|
|
889
872
|
</html>`;
|
|
@@ -976,19 +959,10 @@ export function skillCollectionPage(collection: SkillCollection): string {
|
|
|
976
959
|
}
|
|
977
960
|
|
|
978
961
|
/**
|
|
979
|
-
* Render
|
|
962
|
+
* Render a collection header with icon, title, description, and endpoint
|
|
980
963
|
*/
|
|
981
|
-
|
|
964
|
+
function collectionDetailHeader(collection: ICollection, pathPrefix: string): string {
|
|
982
965
|
return /*html*/`
|
|
983
|
-
<!DOCTYPE html>
|
|
984
|
-
<html lang="en">
|
|
985
|
-
<head>
|
|
986
|
-
<meta charset="UTF-8">
|
|
987
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
988
|
-
<title>${collection.title || collection.name} - Interactions</title>
|
|
989
|
-
<style>${detailStyles}</style>
|
|
990
|
-
</head>
|
|
991
|
-
<body>
|
|
992
966
|
<nav class="nav">
|
|
993
967
|
<a href="/">${backArrow} Back to all collections</a>
|
|
994
968
|
</nav>
|
|
@@ -999,30 +973,79 @@ export function interactionCollectionPage(collection: InteractionCollection): st
|
|
|
999
973
|
<h1>${collection.title || collection.name}</h1>
|
|
1000
974
|
<p style="color: #6b7280; margin: 0.25rem 0 0 0;">${collection.description || ''}</p>
|
|
1001
975
|
<div class="endpoint-box">
|
|
1002
|
-
<code>/api
|
|
1003
|
-
<button class="copy-btn" onclick="navigator.clipboard.writeText(window.location.origin + '/api
|
|
976
|
+
<code>/api/${pathPrefix}/${collection.name}</code>
|
|
977
|
+
<button class="copy-btn" onclick="navigator.clipboard.writeText(window.location.origin + '/api/${pathPrefix}/${collection.name}')" title="Copy endpoint URL">
|
|
1004
978
|
${copyIcon}
|
|
1005
979
|
</button>
|
|
1006
980
|
</div>
|
|
1007
981
|
</div>
|
|
1008
|
-
</div
|
|
982
|
+
</div>`;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Render a simple item card with name, description, and tags
|
|
987
|
+
*/
|
|
988
|
+
function simpleItemCard(item: { name: string; description?: string; tags?: string[] }): string {
|
|
989
|
+
return /*html*/`
|
|
990
|
+
<div class="detail-card">
|
|
991
|
+
<div class="detail-header">
|
|
992
|
+
<div>
|
|
993
|
+
<h3 class="detail-title">${item.name}</h3>
|
|
994
|
+
<p class="detail-desc">${item.description || 'No description'}</p>
|
|
995
|
+
</div>
|
|
996
|
+
<div class="detail-badges">
|
|
997
|
+
${item.tags?.map(tag => `<span class="badge">${tag}</span>`).join('') || ''}
|
|
998
|
+
</div>
|
|
999
|
+
</div>
|
|
1000
|
+
</div>`;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* Render an interaction collection detail page
|
|
1005
|
+
*/
|
|
1006
|
+
export function interactionCollectionPage(collection: InteractionCollection): string {
|
|
1007
|
+
return /*html*/`
|
|
1008
|
+
<!DOCTYPE html>
|
|
1009
|
+
<html lang="en">
|
|
1010
|
+
<head>
|
|
1011
|
+
<meta charset="UTF-8">
|
|
1012
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1013
|
+
<title>${collection.title || collection.name} - Interactions</title>
|
|
1014
|
+
<style>${detailStyles}</style>
|
|
1015
|
+
</head>
|
|
1016
|
+
<body>
|
|
1017
|
+
${collectionDetailHeader(collection, 'interactions')}
|
|
1009
1018
|
|
|
1010
1019
|
<h2>${collection.interactions.length} Interaction${collection.interactions.length !== 1 ? 's' : ''}</h2>
|
|
1011
1020
|
|
|
1012
1021
|
<div class="item-list">
|
|
1013
|
-
${collection.interactions.map(inter =>
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1022
|
+
${collection.interactions.map(inter => simpleItemCard(inter)).join('')}
|
|
1023
|
+
</div>
|
|
1024
|
+
</body>
|
|
1025
|
+
</html>`;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Render a content type collection detail page
|
|
1030
|
+
*/
|
|
1031
|
+
export function contentTypeCollectionPage(collection: ContentTypesCollection): string {
|
|
1032
|
+
const typesArray = collection.getContentTypes();
|
|
1033
|
+
return /*html*/`
|
|
1034
|
+
<!DOCTYPE html>
|
|
1035
|
+
<html lang="en">
|
|
1036
|
+
<head>
|
|
1037
|
+
<meta charset="UTF-8">
|
|
1038
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1039
|
+
<title>${collection.title || collection.name} - Content Types</title>
|
|
1040
|
+
<style>${detailStyles}</style>
|
|
1041
|
+
</head>
|
|
1042
|
+
<body>
|
|
1043
|
+
${collectionDetailHeader(collection, 'types')}
|
|
1044
|
+
|
|
1045
|
+
<h2>${typesArray.length} Content Type${typesArray.length !== 1 ? 's' : ''}</h2>
|
|
1046
|
+
|
|
1047
|
+
<div class="item-list">
|
|
1048
|
+
${typesArray.map(type => simpleItemCard(type)).join('')}
|
|
1026
1049
|
</div>
|
|
1027
1050
|
</body>
|
|
1028
1051
|
</html>`;
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ToolDefinition, ToolUse } from "@llumiverse/common";
|
|
2
2
|
import { VertesiaClient } from "@vertesia/client";
|
|
3
|
-
import { AuthTokenPayload, ToolExecutionMetadata, ToolResult, ToolResultContent } from "@vertesia/common";
|
|
3
|
+
import { AgentToolDefinition, AuthTokenPayload, ToolExecutionMetadata, ToolResult, ToolResultContent } from "@vertesia/common";
|
|
4
4
|
|
|
5
5
|
export type { ToolExecutionMetadata };
|
|
6
6
|
|
|
@@ -97,22 +97,6 @@ export interface Tool<ParamsT extends Record<string, any>> extends ToolDefinitio
|
|
|
97
97
|
default?: boolean;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/**
|
|
101
|
-
* Tool definition with optional activation control for agent exposure.
|
|
102
|
-
*/
|
|
103
|
-
export interface ToolDefinitionWithDefault extends ToolDefinition {
|
|
104
|
-
/**
|
|
105
|
-
* Whether this tool is available by default.
|
|
106
|
-
* - true/undefined: Tool is always available to agents
|
|
107
|
-
* - false: Tool is only available when activated by a skill's related_tools
|
|
108
|
-
*/
|
|
109
|
-
default?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* For skill tools (learn_*): list of related tool names that become available
|
|
112
|
-
* when this skill is called. Used for dynamic tool discovery.
|
|
113
|
-
*/
|
|
114
|
-
related_tools?: string[];
|
|
115
|
-
}
|
|
116
100
|
|
|
117
101
|
/**
|
|
118
102
|
* The interface that should be returned when requesting a collection endpoint using a GET
|
|
@@ -121,7 +105,7 @@ export interface ToolCollectionDefinition {
|
|
|
121
105
|
title: string;
|
|
122
106
|
description: string;
|
|
123
107
|
src: string;
|
|
124
|
-
tools:
|
|
108
|
+
tools: AgentToolDefinition[];
|
|
125
109
|
}
|
|
126
110
|
|
|
127
111
|
export type { ToolDefinition };
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.InteractionCollection = void 0;
|
|
37
|
-
exports.loadInteractionsFromDirectory = loadInteractionsFromDirectory;
|
|
38
|
-
exports.readPromptFile = readPromptFile;
|
|
39
|
-
const fs_1 = require("fs");
|
|
40
|
-
const path_1 = require("path");
|
|
41
|
-
const url_1 = require("url");
|
|
42
|
-
const utils_js_1 = require("./utils.js");
|
|
43
|
-
class InteractionCollection {
|
|
44
|
-
interactions;
|
|
45
|
-
name;
|
|
46
|
-
title;
|
|
47
|
-
icon;
|
|
48
|
-
description;
|
|
49
|
-
constructor({ name, title, icon, description, interactions }) {
|
|
50
|
-
this.name = name;
|
|
51
|
-
this.title = title || (0, utils_js_1.kebabCaseToTitle)(name);
|
|
52
|
-
this.icon = icon;
|
|
53
|
-
this.description = description;
|
|
54
|
-
this.interactions = interactions;
|
|
55
|
-
}
|
|
56
|
-
addInteraction(interaction) {
|
|
57
|
-
this.interactions.push(interaction);
|
|
58
|
-
}
|
|
59
|
-
getInteractions() {
|
|
60
|
-
return this.interactions;
|
|
61
|
-
}
|
|
62
|
-
[Symbol.iterator]() {
|
|
63
|
-
let index = 0;
|
|
64
|
-
const interactions = this.interactions;
|
|
65
|
-
return {
|
|
66
|
-
next() {
|
|
67
|
-
if (index < interactions.length) {
|
|
68
|
-
return { value: interactions[index++], done: false };
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
return { done: true, value: undefined };
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
map(callback) {
|
|
77
|
-
return this.interactions.map(callback);
|
|
78
|
-
}
|
|
79
|
-
getInteractionByName(name) {
|
|
80
|
-
return this.interactions.find(interaction => interaction.name === name);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.InteractionCollection = InteractionCollection;
|
|
84
|
-
/**
|
|
85
|
-
* Load all interactions from a directory.
|
|
86
|
-
* Scans for subdirectories containing index.ts/index.js files.
|
|
87
|
-
*
|
|
88
|
-
* Directory structure:
|
|
89
|
-
* ```
|
|
90
|
-
* interactions/
|
|
91
|
-
* nagare/
|
|
92
|
-
* extract-fund-actuals/
|
|
93
|
-
* index.ts # exports default InteractionSpec
|
|
94
|
-
* prompt.jst # prompt template (read via readPromptFile helper)
|
|
95
|
-
* parse-fund-document/
|
|
96
|
-
* index.ts
|
|
97
|
-
* prompt.md
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* @param interactionsDir - Path to the interactions collection directory
|
|
101
|
-
* @returns Promise resolving to array of InteractionSpec objects
|
|
102
|
-
*/
|
|
103
|
-
async function loadInteractionsFromDirectory(interactionsDir) {
|
|
104
|
-
const interactions = [];
|
|
105
|
-
if (!(0, fs_1.existsSync)(interactionsDir)) {
|
|
106
|
-
console.warn(`Interactions directory not found: ${interactionsDir}`);
|
|
107
|
-
return interactions;
|
|
108
|
-
}
|
|
109
|
-
let entries;
|
|
110
|
-
try {
|
|
111
|
-
entries = (0, fs_1.readdirSync)(interactionsDir);
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
console.warn(`Could not read interactions directory: ${interactionsDir}`);
|
|
115
|
-
return interactions;
|
|
116
|
-
}
|
|
117
|
-
for (const entry of entries) {
|
|
118
|
-
// Skip hidden files and index files
|
|
119
|
-
if (entry.startsWith('.'))
|
|
120
|
-
continue;
|
|
121
|
-
if (entry === 'index.ts' || entry === 'index.js')
|
|
122
|
-
continue;
|
|
123
|
-
const entryPath = (0, path_1.join)(interactionsDir, entry);
|
|
124
|
-
try {
|
|
125
|
-
const stat = (0, fs_1.statSync)(entryPath);
|
|
126
|
-
if (!stat.isDirectory())
|
|
127
|
-
continue;
|
|
128
|
-
// Look for index.ts or index.js in the subdirectory
|
|
129
|
-
const indexTs = (0, path_1.join)(entryPath, 'index.ts');
|
|
130
|
-
const indexJs = (0, path_1.join)(entryPath, 'index.js');
|
|
131
|
-
const indexPath = (0, fs_1.existsSync)(indexTs) ? indexTs : (0, fs_1.existsSync)(indexJs) ? indexJs : null;
|
|
132
|
-
if (!indexPath) {
|
|
133
|
-
continue; // No index file, skip
|
|
134
|
-
}
|
|
135
|
-
// Dynamic import
|
|
136
|
-
const fileUrl = (0, url_1.pathToFileURL)(indexPath).href;
|
|
137
|
-
const module = await Promise.resolve(`${fileUrl}`).then(s => __importStar(require(s)));
|
|
138
|
-
const interaction = module.default || module.interaction;
|
|
139
|
-
if (interaction && typeof interaction.name === 'string') {
|
|
140
|
-
interactions.push(interaction);
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
console.warn(`No valid InteractionSpec export found in ${entry}/index`);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (err) {
|
|
147
|
-
console.warn(`Error loading interaction from ${entry}:`, err);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return interactions;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Helper to read a prompt file from the same directory as the interaction.
|
|
154
|
-
* Use this in interaction index.ts files to load prompt templates.
|
|
155
|
-
*
|
|
156
|
-
* @param dirname - Pass __dirname or dirname(fileURLToPath(import.meta.url))
|
|
157
|
-
* @param filename - Prompt filename (e.g., 'prompt.jst' or 'prompt.md')
|
|
158
|
-
* @returns File contents as string
|
|
159
|
-
*/
|
|
160
|
-
function readPromptFile(dirname, filename) {
|
|
161
|
-
const filePath = (0, path_1.join)(dirname, filename);
|
|
162
|
-
return (0, fs_1.readFileSync)(filePath, 'utf-8');
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=InteractionCollection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionCollection.js","sourceRoot":"","sources":["../../src/InteractionCollection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4EA,sEAqDC;AAUD,wCAGC;AA9ID,2BAAqE;AACrE,+BAA4B;AAC5B,6BAAoC;AAGpC,yCAA8C;AAK9C,MAAa,qBAAqB;IAC9B,YAAY,CAAoB;IAChC,IAAI,CAAS;IACb,KAAK,CAAU;IACf,IAAI,CAAU;IACd,WAAW,CAAU;IACrB,YAAY,EACR,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EACnB;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,IAAI,IAAA,2BAAgB,EAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACrC,CAAC;IACD,cAAc,CAAC,WAAgB;QAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACxC,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC;QACb,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QAEvC,OAAO;YACH,IAAI;gBACA,IAAI,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE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