@superdoc-dev/sdk 1.0.0-alpha.2 → 1.0.0-alpha.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.
Files changed (52) hide show
  1. package/dist/generated/client.d.ts +1790 -0
  2. package/dist/generated/client.d.ts.map +1 -0
  3. package/dist/generated/client.js +66 -0
  4. package/dist/generated/contract.d.ts +13676 -0
  5. package/dist/generated/contract.d.ts.map +1 -0
  6. package/dist/generated/contract.js +17809 -0
  7. package/dist/index.d.ts +23 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +29 -0
  10. package/dist/runtime/embedded-cli.d.ts +5 -0
  11. package/dist/runtime/embedded-cli.d.ts.map +1 -0
  12. package/dist/runtime/embedded-cli.js +94 -0
  13. package/dist/runtime/errors.d.ts +17 -0
  14. package/dist/runtime/errors.d.ts.map +1 -0
  15. package/dist/runtime/errors.js +18 -0
  16. package/dist/runtime/host.d.ts +36 -0
  17. package/dist/runtime/host.d.ts.map +1 -0
  18. package/dist/runtime/host.js +345 -0
  19. package/dist/runtime/process.d.ts +16 -0
  20. package/dist/runtime/process.d.ts.map +1 -0
  21. package/dist/runtime/process.js +27 -0
  22. package/dist/runtime/transport-common.d.ts +44 -0
  23. package/dist/runtime/transport-common.d.ts.map +1 -0
  24. package/dist/runtime/transport-common.js +65 -0
  25. package/dist/skills.d.ts +25 -0
  26. package/dist/skills.d.ts.map +1 -0
  27. package/dist/skills.js +140 -0
  28. package/dist/tools.d.ts +113 -0
  29. package/dist/tools.d.ts.map +1 -0
  30. package/dist/tools.js +360 -0
  31. package/package.json +20 -10
  32. package/tools/catalog.json +17128 -0
  33. package/tools/tool-name-map.json +96 -0
  34. package/tools/tools-policy.json +100 -0
  35. package/tools/tools.anthropic.json +3275 -0
  36. package/tools/tools.generic.json +16573 -0
  37. package/tools/tools.openai.json +3557 -0
  38. package/tools/tools.vercel.json +3557 -0
  39. package/skills/.gitkeep +0 -0
  40. package/skills/editing-docx.md +0 -153
  41. package/src/__tests__/skills.test.ts +0 -93
  42. package/src/generated/DO_NOT_EDIT +0 -2
  43. package/src/generated/client.ts +0 -3151
  44. package/src/generated/contract.ts +0 -13396
  45. package/src/index.ts +0 -72
  46. package/src/runtime/__tests__/transport-common.test.ts +0 -151
  47. package/src/runtime/embedded-cli.ts +0 -109
  48. package/src/runtime/errors.ts +0 -30
  49. package/src/runtime/host.ts +0 -465
  50. package/src/runtime/process.ts +0 -45
  51. package/src/runtime/transport-common.ts +0 -159
  52. package/src/skills.ts +0 -91
package/src/skills.ts DELETED
@@ -1,91 +0,0 @@
1
- import { readFileSync, readdirSync } from 'node:fs';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { SuperDocCliError } from './runtime/errors';
5
-
6
- const skillsDir = path.resolve(fileURLToPath(new URL('../skills', import.meta.url)));
7
- const SKILL_NAME_RE = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
8
-
9
- function resolveSkillFilePath(skillName: string): string {
10
- const filePath = path.resolve(skillsDir, `${skillName}.md`);
11
- const root = `${skillsDir}${path.sep}`;
12
- if (!filePath.startsWith(root)) {
13
- throw new SuperDocCliError('Skill name resolved outside SDK skill directory.', {
14
- code: 'INVALID_ARGUMENT',
15
- details: { skillName },
16
- });
17
- }
18
- return filePath;
19
- }
20
-
21
- /**
22
- * List the names of all SDK skills bundled with this package.
23
- *
24
- * @returns Sorted array of skill names (without the `.md` extension).
25
- * @throws {SuperDocCliError} With code `SKILL_IO_ERROR` if the skills directory cannot be read.
26
- */
27
- export function listSkills(): string[] {
28
- try {
29
- return readdirSync(skillsDir)
30
- .filter((entry) => path.extname(entry) === '.md')
31
- .map((entry) => path.basename(entry, '.md'))
32
- .sort();
33
- } catch (error) {
34
- throw new SuperDocCliError('Unable to enumerate SDK skills.', {
35
- code: 'SKILL_IO_ERROR',
36
- details: {
37
- skillsDir,
38
- message: error instanceof Error ? error.message : String(error),
39
- },
40
- });
41
- }
42
- }
43
-
44
- /**
45
- * Read the content of a bundled SDK skill by name.
46
- *
47
- * @param name - Skill name (e.g. `"editing-docx"`). Must match `[A-Za-z0-9][A-Za-z0-9_-]*`.
48
- * @returns The skill file content as a UTF-8 string.
49
- * @throws {SuperDocCliError} With code `INVALID_ARGUMENT` if the name is empty or contains invalid characters.
50
- * @throws {SuperDocCliError} With code `SKILL_NOT_FOUND` if no skill with that name exists.
51
- * @throws {SuperDocCliError} With code `SKILL_IO_ERROR` for other file-system read failures.
52
- */
53
- export function getSkill(name: string): string {
54
- const normalized = name.trim();
55
- if (!normalized || !SKILL_NAME_RE.test(normalized)) {
56
- throw new SuperDocCliError('Skill name is required.', {
57
- code: 'INVALID_ARGUMENT',
58
- details: { name },
59
- });
60
- }
61
-
62
- const filePath = resolveSkillFilePath(normalized);
63
- try {
64
- return readFileSync(filePath, 'utf8');
65
- } catch (error) {
66
- const nodeError = error as NodeJS.ErrnoException;
67
- if (nodeError?.code === 'ENOENT') {
68
- let available: string[] = [];
69
- try {
70
- available = listSkills();
71
- } catch {
72
- // Keep available empty when directory enumeration itself fails.
73
- }
74
- throw new SuperDocCliError('Requested SDK skill was not found.', {
75
- code: 'SKILL_NOT_FOUND',
76
- details: {
77
- name: normalized,
78
- available,
79
- },
80
- });
81
- }
82
-
83
- throw new SuperDocCliError('Requested SDK skill was not found.', {
84
- code: 'SKILL_IO_ERROR',
85
- details: {
86
- name: normalized,
87
- message: error instanceof Error ? error.message : String(error),
88
- },
89
- });
90
- }
91
- }