loopengine 0.1.15 → 0.1.24

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 (42) hide show
  1. package/README.md +124 -299
  2. package/dist/bin/{package-manager.d.ts → ability-manager.d.ts} +39 -33
  3. package/dist/bin/{package-manager.js → ability-manager.js} +85 -74
  4. package/dist/bin/cli.js +22 -22
  5. package/dist/core/agent-config.d.ts +1 -1
  6. package/dist/core/gateway-tools.js +4 -4
  7. package/dist/core/mcpplug.d.ts +23 -0
  8. package/dist/core/mcpplug.js +64 -0
  9. package/dist/core/run-agent.js +2 -2
  10. package/dist/core/session-store.d.ts +1 -1
  11. package/dist/core/session-store.js +1 -1
  12. package/dist/core/sessionknit.d.ts +87 -0
  13. package/dist/core/sessionknit.js +189 -0
  14. package/dist/core/skillgarden/activation.d.ts +4 -0
  15. package/dist/core/skillgarden/activation.js +16 -0
  16. package/dist/core/skillgarden/budget.d.ts +20 -0
  17. package/dist/core/skillgarden/budget.js +28 -0
  18. package/dist/core/skillgarden/discovery.d.ts +11 -0
  19. package/dist/core/skillgarden/discovery.js +40 -0
  20. package/dist/core/skillgarden/frontmatter.d.ts +10 -0
  21. package/dist/core/skillgarden/frontmatter.js +35 -0
  22. package/dist/core/skillgarden/index.d.ts +8 -0
  23. package/dist/core/skillgarden/index.js +12 -0
  24. package/dist/core/skillgarden/loader.d.ts +31 -0
  25. package/dist/core/skillgarden/loader.js +70 -0
  26. package/dist/core/skillgarden/substitute.d.ts +4 -0
  27. package/dist/core/skillgarden/substitute.js +13 -0
  28. package/dist/core/skillgarden/types.d.ts +23 -0
  29. package/dist/core/skillgarden/types.js +1 -0
  30. package/dist/core/toollane.d.ts +46 -0
  31. package/dist/core/toollane.js +69 -0
  32. package/dist/index.d.ts +8 -2
  33. package/dist/index.js +4 -1
  34. package/dist/web/agents-config-page.js +7 -203
  35. package/dist/web/env-admin.d.ts +6 -6
  36. package/dist/web/env-admin.js +11 -11
  37. package/dist/web/http-tool-admin.d.ts +2 -2
  38. package/dist/web/http-tool-admin.js +4 -4
  39. package/dist/web/skills-admin.js +1 -1
  40. package/package.json +10 -7
  41. package/dist/web/skillgarden-admin.d.ts +0 -24
  42. package/dist/web/skillgarden-admin.js +0 -76
@@ -1,76 +0,0 @@
1
- // Lets an operator browse skillgarden's own bundled skill registry from
2
- // the Skills tab in /agents/config, and add one straight into an agent's
3
- // agents/<name>/skills/ folder — a shortcut for the same thing
4
- // `npx skillgarden add <skill> --agent <name>` already does from a
5
- // terminal, surfaced in the UI instead. This module only ever *reads*
6
- // the registry and delegates the actual copy to skillgarden's own
7
- // exported `addSkill` (see below) — it never re-implements that logic.
8
- import { createRequire } from 'node:module';
9
- import { dirname, join } from 'node:path';
10
- import { SkillGarden, addSkill as skillgardenAddSkill } from 'skillgarden';
11
- export class SkillgardenUnavailableError extends Error {
12
- }
13
- // skillgarden's own CLI resolves its bundled registry/ relative to its
14
- // own compiled dist/cli.js location (see its cli.ts's own
15
- // DEFAULT_REGISTRY_DIR), but doesn't export that path — `addSkill`
16
- // itself defaults to it internally, which is enough for *installing* a
17
- // skill, but browsing/previewing the catalog needs the directory path
18
- // itself. Re-derived here the same way Node's own module resolution
19
- // would: from package.json's real installed location, not assumed
20
- // relative to this file (skillgarden is a real npm dependency, not a
21
- // vendored copy).
22
- function registryDir() {
23
- const require = createRequire(import.meta.url);
24
- let pkgJsonPath;
25
- try {
26
- pkgJsonPath = require.resolve('skillgarden/package.json');
27
- }
28
- catch {
29
- throw new SkillgardenUnavailableError('skillgarden is not installed — run `npm install skillgarden` to enable the skill catalog.');
30
- }
31
- return join(dirname(pkgJsonPath), 'registry');
32
- }
33
- // A large, fixed budget, not run-agent.ts's own live skillIndexBudgetTokens
34
- // default — this indexes a small, fixed, bundled catalog for browsing,
35
- // not an agent's own live context, so nothing here should ever silently
36
- // truncate the list an operator sees.
37
- const CATALOG_INDEX_BUDGET_TOKENS = 1_000_000;
38
- // discoverSkillFiles namespaces registry/<category>/<skill>/SKILL.md as
39
- // "<category>:<skill>" (colon-joined, one level of nesting) — split on
40
- // just the first colon, not skillId itself, in case a future entry ever
41
- // nests deeper than one category level.
42
- function splitNamespacedName(namespacedName) {
43
- const colon = namespacedName.indexOf(':');
44
- return { category: namespacedName.slice(0, colon), id: namespacedName.slice(colon + 1) };
45
- }
46
- function catalogGarden() {
47
- return new SkillGarden({ dirs: [registryDir()], indexBudgetTokens: CATALOG_INDEX_BUDGET_TOKENS });
48
- }
49
- export function listSkillgardenCatalog() {
50
- const { included } = catalogGarden().buildIndex();
51
- return included
52
- .map((entry) => ({ ...splitNamespacedName(entry.name), description: entry.description }))
53
- .sort((a, b) => (a.category === b.category ? a.id.localeCompare(b.id) : a.category.localeCompare(b.category)));
54
- }
55
- export function readSkillgardenCatalogEntry(category, id) {
56
- const garden = catalogGarden();
57
- garden.buildIndex();
58
- // load() throws a plain Error for an unindexed name — same "not found"
59
- // shape a bad category/id combination should surface as; the caller
60
- // (adapters/http.ts) maps any throw here to 404, so there's nothing
61
- // more specific to catch and re-throw.
62
- const loaded = garden.load(`${category}:${id}`);
63
- return { category, id, description: loaded.description, body: loaded.body };
64
- }
65
- /** Copies `registry/<category>/<id>/` into `agents/<agentName>/skills/<id>/`
66
- * — delegates entirely to skillgarden's own `addSkill`, which already
67
- * knows this exact `agents/<agent>/skills` destination convention (see
68
- * its own doc comment) and already refuses (or, with `force`,
69
- * overwrites) an existing destination. Returns the bare skill id actually
70
- * installed — never category-qualified, matching `addSkill`'s own
71
- * "category is a registry-organization concept, not forced onto what a
72
- * caller now owns" convention. */
73
- export function addSkillgardenSkillToAgent(agentName, category, id, force = false) {
74
- const result = skillgardenAddSkill({ skill: `${category}/${id}`, agent: agentName, registryDir: registryDir(), force });
75
- return { id, path: join(result.destination, 'SKILL.md') };
76
- }