@uppercut-labs/skills 0.0.0-stage → 1.0.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.
- package/LICENSE +21 -0
- package/NOTICE.md +25 -0
- package/README.md +86 -2
- package/bin/grokbot-postinstall.js +12 -0
- package/bin/uppercut-skills.js +4 -0
- package/dist/agent-native/index.d.ts +21 -0
- package/dist/agent-native/index.d.ts.map +1 -0
- package/dist/agent-native/index.js +119 -0
- package/dist/agent-native/index.js.map +1 -0
- package/dist/catalog/github.d.ts +9 -0
- package/dist/catalog/github.d.ts.map +1 -0
- package/dist/catalog/github.js +256 -0
- package/dist/catalog/github.js.map +1 -0
- package/dist/catalog/index.d.ts +8 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +172 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog/types.d.ts +70 -0
- package/dist/catalog/types.d.ts.map +1 -0
- package/dist/catalog/types.js +2 -0
- package/dist/catalog/types.js.map +1 -0
- package/dist/cli/args.d.ts +24 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +97 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/grokbot-postinstall.d.ts +30 -0
- package/dist/cli/grokbot-postinstall.d.ts.map +1 -0
- package/dist/cli/grokbot-postinstall.js +114 -0
- package/dist/cli/grokbot-postinstall.js.map +1 -0
- package/dist/cli/help.d.ts +2 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +28 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +40 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/node-runtime.d.ts +13 -0
- package/dist/cli/node-runtime.d.ts.map +1 -0
- package/dist/cli/node-runtime.js +759 -0
- package/dist/cli/node-runtime.js.map +1 -0
- package/dist/cli/output.d.ts +26 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +41 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/engine/index.d.ts +6 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +454 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/types.d.ts +91 -0
- package/dist/engine/types.d.ts.map +1 -0
- package/dist/engine/types.js +2 -0
- package/dist/engine/types.js.map +1 -0
- package/dist/generated/bundle.d.ts +3 -0
- package/dist/generated/bundle.d.ts.map +1 -0
- package/dist/generated/bundle.js +1205 -0
- package/dist/generated/bundle.js.map +1 -0
- package/dist/hosts/index.d.ts +24 -0
- package/dist/hosts/index.d.ts.map +1 -0
- package/dist/hosts/index.js +150 -0
- package/dist/hosts/index.js.map +1 -0
- package/dist/hosts/types.d.ts +41 -0
- package/dist/hosts/types.d.ts.map +1 -0
- package/dist/hosts/types.js +13 -0
- package/dist/hosts/types.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +135 -0
- package/dist/mcp/index.js.map +1 -0
- package/package.json +76 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Devin Thomas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Bundled content and attribution
|
|
2
|
+
|
|
3
|
+
`@uppercut-labs/skills` is Copyright (c) 2026 Devin Thomas and is
|
|
4
|
+
distributed under the accompanying [MIT License](LICENSE). This grant covers
|
|
5
|
+
the installer and the 20 skill snapshots included in this npm package. Each
|
|
6
|
+
skill's source repository, path, and pinned commit are recorded in the bundled
|
|
7
|
+
catalog and in installation receipts.
|
|
8
|
+
|
|
9
|
+
The bundle includes these separately authored source locations:
|
|
10
|
+
|
|
11
|
+
| Bundled skills | Original source | Rights in this package |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| Seventeen skills, including the Starter Pack adaptation `quick-build` | [devin-thomas/skills](https://github.com/devin-thomas/skills) | MIT for the approved package bundle |
|
|
14
|
+
| `starter-pack` and `computer-setup` | [devin-thomas/starter-pack](https://github.com/devin-thomas/starter-pack) at commit `c1576a80de0fa0c597550e600c62a1fbec8027d9` (Starter Pack 0.2.8, Computer Setup 0.2.3) | Devin Thomas expressly authorized the original bundled skill snapshots for MIT distribution in `@uppercut-labs/skills` on October 3, 2026, and these refreshed snapshots on November 8, 2026 |
|
|
15
|
+
| `vidchopper-cli` | [devin-thomas/vid-chopper](https://github.com/devin-thomas/vid-chopper) at commit `428963b6db87e47f98209c92bc59aca41b5f997a` | Upstream MIT; copyright Devin Thomas |
|
|
16
|
+
|
|
17
|
+
The original Starter Pack repository retains its own restrictive rights notice.
|
|
18
|
+
The package permission above applies to the two included skill snapshots; it
|
|
19
|
+
does not relicense the rest of that application, course, curriculum, templates,
|
|
20
|
+
or other source files. The optional `--latest` channel fetches source at a later
|
|
21
|
+
revision; that fetched content is subject to the source's terms at that revision.
|
|
22
|
+
|
|
23
|
+
References to third-party applications, services, and brands in skills do not
|
|
24
|
+
include those products or grant rights to their trademarks. Runtime dependencies
|
|
25
|
+
carry their own licenses and notices.
|
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Uppercut Skills CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@uppercut-labs/skills` installs selected public Devin/Uppercut agent skills with their required skill dependencies.
|
|
4
|
+
|
|
5
|
+
The examples below pin 1.0.2, the newest version published to npm and attached to a
|
|
6
|
+
GitHub release when this guide was written. The [npm version list](https://www.npmjs.com/package/@uppercut-labs/skills?activeTab=versions)
|
|
7
|
+
and [GitHub releases](https://github.com/devin-thomas/skills/releases) are authoritative. Pin an
|
|
8
|
+
exact version, or verify the release archive against its adjacent checksum.
|
|
9
|
+
|
|
10
|
+
## Run from this checkout
|
|
11
|
+
|
|
12
|
+
Requires Node.js 22 or newer.
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
cd packages/skills-cli
|
|
16
|
+
npm ci
|
|
17
|
+
npm run build
|
|
18
|
+
node bin/uppercut-skills.js list
|
|
19
|
+
node bin/uppercut-skills.js add execute-task-cycles --host codex --project /path/to/project
|
|
20
|
+
node bin/uppercut-skills.js doctor --host codex --project /path/to/project
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Run the public npm package:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx @uppercut-labs/skills@1.0.2 list
|
|
27
|
+
npx @uppercut-labs/skills@1.0.2 add execute-task-cycles --host codex --project /path/to/project
|
|
28
|
+
npx @uppercut-labs/skills@1.0.2 doctor --host codex --project /path/to/project
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If registry publication is unavailable, use the pinned GitHub release tarball and its adjacent checksum instead:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
curl -fL -o uppercut-labs-skills-1.0.2.tgz https://github.com/devin-thomas/skills/releases/download/v1.0.2/uppercut-labs-skills-1.0.2.tgz
|
|
35
|
+
curl -fL -o uppercut-labs-skills-1.0.2.tgz.sha256 https://github.com/devin-thomas/skills/releases/download/v1.0.2/uppercut-labs-skills-1.0.2.tgz.sha256
|
|
36
|
+
shasum -a 256 -c uppercut-labs-skills-1.0.2.tgz.sha256
|
|
37
|
+
npm exec --yes --package=./uppercut-labs-skills-1.0.2.tgz -- uppercut-skills add programmatic-harness --host codex --project /path/to/disposable-project
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
On Linux, replace `shasum -a 256 -c` with `sha256sum -c`. The checksum must verify before running the archive.
|
|
41
|
+
|
|
42
|
+
`add execute-task-cycles` also installs its required `execute-task` skill. `--no-dependencies` (or `-nd`) is an expert option that reports a degraded install if required skills are missing.
|
|
43
|
+
|
|
44
|
+
## Versions and content channels
|
|
45
|
+
|
|
46
|
+
Three different things carry versions:
|
|
47
|
+
|
|
48
|
+
- **Installer version**: the npm package version, such as `@uppercut-labs/skills@1.0.2`. It fixes the CLI code and the bundled snapshot inside it. `npx @uppercut-labs/skills@latest` means the newest installer on npm.
|
|
49
|
+
- **Bundled channel** (default): each skill is installed from the snapshot compiled into that installer, pinned to the source commit recorded in `manifest/skills.json`. It needs no network after the package is installed, and it never refreshes itself from GitHub. A newer bundled snapshot arrives only with a newer installer version.
|
|
50
|
+
- **GitHub channel** (`--latest` or `--channel github`): opt-in. It resolves the current allowed GitHub source revisions, records them, and remembers the channel for that skill's later `update`. A failed GitHub fetch reports the error; it never falls back to the bundle.
|
|
51
|
+
|
|
52
|
+
So `--latest` (newest skill content) and `@latest` (newest installer) are independent. Bundled skills derived from other repositories, such as Starter Pack, can lag their maintained source until a new installer is released; the release record names each pinned source version.
|
|
53
|
+
|
|
54
|
+
Use `--host codex|claude|cursor|antigravity|grokbot|grokcli` to select one host. Without `--host`, a noninteractive `add` refuses and writes nothing. `--global` selects user scope. Antigravity global installs also require `--surface ide|cli`. Grok Bot's project route writes `.agents/skills`. Grok CLI is a separate host with a `.grok/skills` route.
|
|
55
|
+
|
|
56
|
+
## Install-time script (Grok Bot only)
|
|
57
|
+
|
|
58
|
+
The package declares one npm `postinstall` script. It exists only to fill a fresh Grok Bot account library and writes nothing anywhere else:
|
|
59
|
+
|
|
60
|
+
- **Ordinary installs do nothing.** A local (non-`-g`) install, `npx`, or any install not run as npm's `postinstall` lifecycle prints "Grok Bot account library untouched" and exits without writing.
|
|
61
|
+
- **Global installs check the machine first.** Even with `npm install -g`, it continues only on Linux, as a non-root user whose home is `/home/box`, where `/home/box/agent-data/workflows` already exists, resolves inside that home, is a real directory, and belongs to the running user. The Bot reports that `agent-data` is a symlink, so the installer resolves the physical directory before writing. On any other computer it writes nothing.
|
|
62
|
+
- **Existing managed installs are preserved.** If the Bot library already has managed skills, postinstall changes nothing and prints the explicit `update --host grokbot --global` command.
|
|
63
|
+
- **Conflicts are skipped, not overwritten.** On a fresh library, a pre-existing folder is adopted only if its complete file set matches the bundle byte for byte. Differing, extra, or unsafe folders and the skills depending on them are skipped and named; the rest install in one transaction.
|
|
64
|
+
- **Scripts must be allowed.** npm 11 blocks package scripts unless allowed, for example `npm install -g @uppercut-labs/skills@1.0.2 --allow-scripts=@uppercut-labs/skills` on the Bot computer. Where scripts stay blocked, run `uppercut-skills add <id> --host grokbot --global` there instead; explicit `add` refuses conflicts rather than skipping them.
|
|
65
|
+
|
|
66
|
+
A successful npm install alone does not prove the skills were copied. Check with `uppercut-skills doctor --host grokbot --global --json`. The user's Bot invoked `starter-pack` from an installed account library once; that report is the only Bot account-library acceptance on record.
|
|
67
|
+
|
|
68
|
+
`update`, `remove`, `show`, `list`, and `doctor` use the same CLI. Add `--json` for one machine-readable result or `--dry-run` to inspect an intended write. The installer refuses changed or unowned files by default.
|
|
69
|
+
|
|
70
|
+
## Read-only MCP catalog
|
|
71
|
+
|
|
72
|
+
Start the opt-in loopback Streamable HTTP mount:
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
node bin/uppercut-skills.js serve-mcp
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The command prints the local `http://127.0.0.1:<port>/mcp` URL. It accepts `POST /mcp` and advertises only `catalog.list` and `catalog.show`. It exposes no install, update, remove, doctor, or local installation state. The MCP peer is `@modelcontextprotocol/server@2.3.0`; the ordinary CLI does not start the listener.
|
|
79
|
+
Use `--port <number>` to choose a loopback port; the default selects an available port.
|
|
80
|
+
|
|
81
|
+
For package consumers, the `./agent-native` export supplies a scoped capability registry factory and `./mcp` supplies the loopback server helper. Importing either starts no listener or install operation.
|
|
82
|
+
|
|
83
|
+
## Source and release boundary
|
|
84
|
+
|
|
85
|
+
The catalog is authored in the repository's `manifest/skills.json`. The bundled snapshot is compiled from pinned commits in three reviewed public source repositories. The package and approved bundled skill snapshots use [MIT](LICENSE); the [notice](NOTICE.md) records Starter Pack and VidChopper sources and the limits of the Starter Pack permission. Only public skills are bundled; the package contains no private skills and depends on none.
|
|
86
|
+
|
|
87
|
+
Each release is accepted by the repository's local [release gate](../../distribution/README.md#release-gate), which tests the exact tarball later uploaded to npm and GitHub. The gate verifies source and package behavior only. It does not prove a skill is registered or discovered in a particular host; native host results are recorded separately in the [release record](../../docs/skills-package/RELEASE.md), and hosts without recorded results are unverified.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
if (process.env.npm_config_global !== 'true' || process.env.npm_lifecycle_event !== 'postinstall') {
|
|
3
|
+
process.stdout.write('Grok Bot account library untouched (not a global npm install).\n');
|
|
4
|
+
} else {
|
|
5
|
+
try {
|
|
6
|
+
const { runGrokBotPostinstall } = await import('../dist/cli/grokbot-postinstall.js');
|
|
7
|
+
process.stdout.write(`${await runGrokBotPostinstall()}\n`);
|
|
8
|
+
} catch (error) {
|
|
9
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
10
|
+
process.exitCode = 1;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AuthorizationPort, type CapabilityRegistry, type ExecutionCaller, type RuntimeTarget, executeCapability } from '@uppercut-labs/agent-native';
|
|
2
|
+
export type SkillsCapabilityName = 'catalog.list' | 'catalog.show' | 'installation.plan' | 'installation.inspect' | 'installation.doctor' | 'installation.add' | 'installation.update' | 'installation.remove';
|
|
3
|
+
export type SkillsCapabilityContext = {
|
|
4
|
+
readonly scope: {
|
|
5
|
+
readonly host: string;
|
|
6
|
+
readonly kind: 'project' | 'global';
|
|
7
|
+
readonly rootPath?: string;
|
|
8
|
+
};
|
|
9
|
+
readonly caller: ExecutionCaller;
|
|
10
|
+
readonly authorization: AuthorizationPort;
|
|
11
|
+
readonly sourcePolicy: Readonly<Record<string, unknown>>;
|
|
12
|
+
readonly nativeRegistration: Readonly<Record<string, unknown>>;
|
|
13
|
+
readonly operations: Readonly<Partial<Record<SkillsCapabilityName, (input: unknown, context: SkillsCapabilityContext) => unknown | Promise<unknown>>>>;
|
|
14
|
+
};
|
|
15
|
+
export type SkillsRegistryHandle = {
|
|
16
|
+
readonly registry: CapabilityRegistry;
|
|
17
|
+
execute(name: SkillsCapabilityName, input: unknown): ReturnType<typeof executeCapability>;
|
|
18
|
+
};
|
|
19
|
+
/** Builds a scoped, explicit Agent Native registry without selecting paths or touching disk. */
|
|
20
|
+
export declare function createSkillsCapabilityRegistry(context: SkillsCapabilityContext, selectedNames?: readonly SkillsCapabilityName[], targets?: readonly RuntimeTarget[]): SkillsRegistryHandle;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map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E,OAAO,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CAC3F,CAAC;AAyFF,gGAAgG;AAChG,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,uBAAuB,EAChC,aAAa,GAAE,SAAS,oBAAoB,EAAU,EACtD,OAAO,GAAE,SAAS,aAAa,EAAc,GAC5C,oBAAoB,CAqBtB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { bindCapability, createCapabilityRegistry, defineCapability, executeCapability, } from '@uppercut-labs/agent-native';
|
|
2
|
+
const jsonSchema = {
|
|
3
|
+
parse(input) {
|
|
4
|
+
const visit = (value, seen) => {
|
|
5
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean')
|
|
6
|
+
return value;
|
|
7
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
8
|
+
return value;
|
|
9
|
+
if (typeof value !== 'object')
|
|
10
|
+
throw new TypeError('Capability output must be JSON-compatible');
|
|
11
|
+
if (seen.has(value))
|
|
12
|
+
throw new TypeError('Capability output cannot contain cycles');
|
|
13
|
+
seen.add(value);
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
const result = value.map((item) => visit(item, seen));
|
|
16
|
+
seen.delete(value);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
const result = {};
|
|
20
|
+
for (const [key, item] of Object.entries(value))
|
|
21
|
+
result[key] = visit(item, seen);
|
|
22
|
+
seen.delete(value);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
return visit(input, new Set());
|
|
26
|
+
},
|
|
27
|
+
toJSONSchema: () => ({}),
|
|
28
|
+
};
|
|
29
|
+
const inputSchema = {
|
|
30
|
+
parse(input) {
|
|
31
|
+
if (typeof input !== 'object' || input === null || Array.isArray(input))
|
|
32
|
+
throw new TypeError('Capability input must be an object');
|
|
33
|
+
return input;
|
|
34
|
+
},
|
|
35
|
+
toJSONSchema: () => ({ type: 'object', additionalProperties: true }),
|
|
36
|
+
};
|
|
37
|
+
const names = [
|
|
38
|
+
'catalog.list', 'catalog.show', 'installation.plan', 'installation.inspect',
|
|
39
|
+
'installation.doctor', 'installation.add', 'installation.update', 'installation.remove',
|
|
40
|
+
];
|
|
41
|
+
function identity(name) {
|
|
42
|
+
return { namespace: 'uppercut.skills', name, majorVersion: 1 };
|
|
43
|
+
}
|
|
44
|
+
function definition(name) {
|
|
45
|
+
const isCatalog = name.startsWith('catalog.');
|
|
46
|
+
const access = isCatalog
|
|
47
|
+
? { kind: 'public' }
|
|
48
|
+
: { kind: 'protected', scopes: [name.endsWith('.remove') ? 'skills:remove' : name.endsWith('.add') || name.endsWith('.update') ? 'skills:write' : 'skills:read'] };
|
|
49
|
+
return defineCapability({
|
|
50
|
+
identity: identity(name),
|
|
51
|
+
description: `Uppercut Skills ${name.replace('.', ' ')}`,
|
|
52
|
+
input: inputSchemaFor(name),
|
|
53
|
+
output: jsonSchema,
|
|
54
|
+
risk: name.endsWith('.remove') ? 'destructive' : name.endsWith('.add') || name.endsWith('.update') ? 'write' : 'read',
|
|
55
|
+
access,
|
|
56
|
+
...((name === 'catalog.list' || name === 'catalog.show') ? {
|
|
57
|
+
surfaces: { http: { method: 'GET', path: name === 'catalog.list' ? '/catalog' : '/catalog/show' } },
|
|
58
|
+
} : {}),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function inputSchemaFor(name) {
|
|
62
|
+
return {
|
|
63
|
+
parse(input) {
|
|
64
|
+
if (typeof input !== 'object' || input === null || Array.isArray(input))
|
|
65
|
+
throw new TypeError('Capability input must be an object');
|
|
66
|
+
const value = input;
|
|
67
|
+
if (name === 'catalog.show') {
|
|
68
|
+
if (typeof value.id !== 'string' || !value.id.trim())
|
|
69
|
+
throw new TypeError('A skill ID is required');
|
|
70
|
+
}
|
|
71
|
+
else if (name === 'installation.add' || name === 'installation.remove') {
|
|
72
|
+
if (!Array.isArray(value.ids) || !value.ids.length || !value.ids.every((id) => typeof id === 'string' && id.trim())) {
|
|
73
|
+
throw new TypeError('A non-empty IDs array is required');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else if (name === 'installation.plan' && value.ids !== undefined) {
|
|
77
|
+
if (!Array.isArray(value.ids) || !value.ids.every((id) => typeof id === 'string' && id.trim()))
|
|
78
|
+
throw new TypeError('IDs must be an array of skill IDs');
|
|
79
|
+
}
|
|
80
|
+
else if (name === 'installation.update' && value.ids !== undefined) {
|
|
81
|
+
if (!Array.isArray(value.ids) || !value.ids.every((id) => typeof id === 'string' && id.trim()))
|
|
82
|
+
throw new TypeError('IDs must be an array of skill IDs');
|
|
83
|
+
}
|
|
84
|
+
return value;
|
|
85
|
+
},
|
|
86
|
+
toJSONSchema: () => name === 'catalog.show'
|
|
87
|
+
? { type: 'object', properties: { id: { type: 'string', minLength: 1 } }, required: ['id'], additionalProperties: false }
|
|
88
|
+
: name === 'installation.add' || name === 'installation.remove'
|
|
89
|
+
? { type: 'object', properties: { ids: { type: 'array', items: { type: 'string', minLength: 1 }, minItems: 1 } }, required: ['ids'], additionalProperties: false }
|
|
90
|
+
: name === 'installation.update' || name === 'installation.plan'
|
|
91
|
+
? { type: 'object', properties: { ids: { type: 'array', items: { type: 'string', minLength: 1 } } }, additionalProperties: false }
|
|
92
|
+
: { type: 'object', additionalProperties: false },
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/** Builds a scoped, explicit Agent Native registry without selecting paths or touching disk. */
|
|
96
|
+
export function createSkillsCapabilityRegistry(context, selectedNames = names, targets = ['local']) {
|
|
97
|
+
const definitions = selectedNames.map(definition);
|
|
98
|
+
const bindings = definitions.map((capability) => bindCapability(capability, {
|
|
99
|
+
id: `uppercut-skills-${capability.identity.name.replaceAll('.', '-')}-v1`,
|
|
100
|
+
targets,
|
|
101
|
+
execute: (input) => {
|
|
102
|
+
const handler = context.operations[capability.identity.name];
|
|
103
|
+
if (!handler)
|
|
104
|
+
throw new Error(`No operation handler is configured for ${capability.identity.name}`);
|
|
105
|
+
return handler(input, context);
|
|
106
|
+
},
|
|
107
|
+
}));
|
|
108
|
+
const registry = createCapabilityRegistry(definitions, bindings);
|
|
109
|
+
return {
|
|
110
|
+
registry,
|
|
111
|
+
execute(name, input) {
|
|
112
|
+
return executeCapability(registry, {
|
|
113
|
+
identity: identity(name), runtime: 'local', input,
|
|
114
|
+
caller: context.caller, authorization: context.authorization,
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agent-native/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,gBAAgB,EAOhB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AA2BrC,MAAM,UAAU,GAAG;IACjB,KAAK,CAAC,KAAc;QAClB,MAAM,KAAK,GAAG,CAAC,KAAc,EAAE,IAAiB,EAAa,EAAE;YAC7D,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;YAC5F,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YACtE,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,MAAM,IAAI,SAAS,CAAC,2CAA2C,CAAC,CAAC;YAChG,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBAAE,MAAM,IAAI,SAAS,CAAC,yCAAyC,CAAC,CAAC;YACpF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAChB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,I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C;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CatalogBundle, CatalogSnapshot } from './types.js';
|
|
2
|
+
export interface GitHubBundleOptions {
|
|
3
|
+
fetch?: typeof fetch;
|
|
4
|
+
catalogRepository?: string;
|
|
5
|
+
catalogRef?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function loadGitHubCatalog(options?: GitHubBundleOptions): Promise<CatalogSnapshot>;
|
|
8
|
+
export declare function loadGitHubBundle(requestedIds: readonly string[], options?: GitHubBundleOptions): Promise<CatalogBundle>;
|
|
9
|
+
//# sourceMappingURL=github.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/catalog/github.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AA4B9E,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,eAAe,CAAC,CAcnG;AAED,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAiFjI"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { posix } from 'node:path';
|
|
3
|
+
import { validateCatalog } from './index.js';
|
|
4
|
+
const CATALOG_REPOSITORY = 'devin-thomas/skills';
|
|
5
|
+
const CATALOG_PATH = 'manifest/skills.json';
|
|
6
|
+
const MAX_JSON_BYTES = 12 * 1024 * 1024;
|
|
7
|
+
const MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
8
|
+
const MAX_TOTAL_BYTES = 30 * 1024 * 1024;
|
|
9
|
+
const MAX_FILES = 300;
|
|
10
|
+
export async function loadGitHubCatalog(options = {}) {
|
|
11
|
+
const fetcher = options.fetch ?? fetch;
|
|
12
|
+
const repository = options.catalogRepository ?? CATALOG_REPOSITORY;
|
|
13
|
+
const ref = options.catalogRef ?? 'main';
|
|
14
|
+
if (repository !== CATALOG_REPOSITORY)
|
|
15
|
+
throw new Error(`Unapproved catalog repository: ${repository}`);
|
|
16
|
+
assertApprovedRef(ref, repository);
|
|
17
|
+
const commit = await requestJson(fetcher, `https://api.github.com/repos/${repository}/commits/${encodeURIComponent(ref)}`);
|
|
18
|
+
if (!isCommit(commit))
|
|
19
|
+
throw new Error(`GitHub did not return a verified commit for ${repository}@${ref}`);
|
|
20
|
+
const tree = await requestJson(fetcher, `https://api.github.com/repos/${repository}/git/trees/${commit.commit.tree.sha}?recursive=1`);
|
|
21
|
+
if (tree.sha !== commit.commit.tree.sha || !Array.isArray(tree.tree) || tree.truncated)
|
|
22
|
+
throw new Error(`GitHub returned an incomplete source tree for ${repository}@${commit.sha}`);
|
|
23
|
+
const bytes = await fetchGitBlob(fetcher, repository, commit.sha, tree.tree, CATALOG_PATH);
|
|
24
|
+
const manifest = parseCatalog(bytes);
|
|
25
|
+
validateCatalog(manifest);
|
|
26
|
+
return manifest;
|
|
27
|
+
}
|
|
28
|
+
export async function loadGitHubBundle(requestedIds, options = {}) {
|
|
29
|
+
const fetcher = options.fetch ?? fetch;
|
|
30
|
+
const catalogRepository = options.catalogRepository ?? CATALOG_REPOSITORY;
|
|
31
|
+
if (catalogRepository !== CATALOG_REPOSITORY)
|
|
32
|
+
throw new Error(`Unapproved catalog repository: ${catalogRepository}`);
|
|
33
|
+
const catalogRef = options.catalogRef ?? 'main';
|
|
34
|
+
assertApprovedRef(catalogRef, catalogRepository);
|
|
35
|
+
const commits = new Map();
|
|
36
|
+
const trees = new Map();
|
|
37
|
+
const commitsByRepository = new Map();
|
|
38
|
+
const resolveCommit = async (repository, ref) => {
|
|
39
|
+
assertApprovedRepository(repository);
|
|
40
|
+
assertApprovedRef(ref, repository);
|
|
41
|
+
const key = `${repository}@${ref}`;
|
|
42
|
+
const cached = commits.get(key);
|
|
43
|
+
if (cached)
|
|
44
|
+
return cached;
|
|
45
|
+
const response = await requestJson(fetcher, `https://api.github.com/repos/${repository}/commits/${encodeURIComponent(ref)}`);
|
|
46
|
+
if (!response || !isCommit(response))
|
|
47
|
+
throw new Error(`GitHub did not return a verified commit for ${repository}@${ref}`);
|
|
48
|
+
commits.set(key, response);
|
|
49
|
+
commitsByRepository.set(repository, response);
|
|
50
|
+
return response;
|
|
51
|
+
};
|
|
52
|
+
const loadTree = async (repository, commit) => {
|
|
53
|
+
const key = `${repository}@${commit.sha}`;
|
|
54
|
+
const cached = trees.get(key);
|
|
55
|
+
if (cached)
|
|
56
|
+
return cached;
|
|
57
|
+
const response = await requestJson(fetcher, `https://api.github.com/repos/${repository}/git/trees/${commit.commit.tree.sha}?recursive=1`);
|
|
58
|
+
if (!response || response.sha !== commit.commit.tree.sha || !Array.isArray(response.tree) || response.truncated) {
|
|
59
|
+
throw new Error(`GitHub returned an incomplete source tree for ${repository}@${commit.sha}`);
|
|
60
|
+
}
|
|
61
|
+
if (response.tree.length > 100_000)
|
|
62
|
+
throw new Error(`GitHub source tree is too large: ${repository}`);
|
|
63
|
+
trees.set(key, response.tree);
|
|
64
|
+
return response.tree;
|
|
65
|
+
};
|
|
66
|
+
const catalogCommit = await resolveCommit(catalogRepository, catalogRef);
|
|
67
|
+
const catalogTree = await loadTree(catalogRepository, catalogCommit);
|
|
68
|
+
const manifestBytes = await fetchGitBlob(fetcher, catalogRepository, catalogCommit.sha, catalogTree, CATALOG_PATH);
|
|
69
|
+
const manifest = parseCatalog(manifestBytes);
|
|
70
|
+
validateCatalog(manifest);
|
|
71
|
+
const closure = resolveRequestedClosure(manifest, requestedIds.length ? requestedIds : manifest.skills.map((skill) => skill.id));
|
|
72
|
+
const repositories = [...new Set(closure.map((entry) => entry.sourceRepo))];
|
|
73
|
+
const pinned = new Map([[catalogRepository, catalogCommit.sha]]);
|
|
74
|
+
for (const repository of repositories) {
|
|
75
|
+
if (pinned.has(repository))
|
|
76
|
+
continue;
|
|
77
|
+
const entry = closure.find((candidate) => candidate.sourceRepo === repository);
|
|
78
|
+
pinned.set(repository, (await resolveCommit(repository, entry.sourceRef ?? 'main')).sha);
|
|
79
|
+
}
|
|
80
|
+
let totalBytes = manifestBytes.byteLength;
|
|
81
|
+
let totalFiles = 0;
|
|
82
|
+
const skills = {};
|
|
83
|
+
for (const entry of closure) {
|
|
84
|
+
const repository = entry.sourceRepo;
|
|
85
|
+
const revision = pinned.get(repository);
|
|
86
|
+
const sourceCommit = commitsByRepository.get(repository);
|
|
87
|
+
if (!sourceCommit)
|
|
88
|
+
throw new Error(`Pinned commit metadata is missing for ${repository}`);
|
|
89
|
+
const tree = await loadTree(repository, sourceCommit);
|
|
90
|
+
const skillDirectory = posix.dirname(entry.sourcePath);
|
|
91
|
+
const prefix = `${skillDirectory}/`;
|
|
92
|
+
const matching = tree.filter((item) => item.type === 'blob' && item.path.startsWith(prefix));
|
|
93
|
+
if (!matching.some((item) => item.path === entry.sourcePath))
|
|
94
|
+
throw new Error(`Pinned source is missing ${entry.sourcePath} in ${repository}@${revision}`);
|
|
95
|
+
const files = [];
|
|
96
|
+
for (const item of matching) {
|
|
97
|
+
if (item.mode !== '100644' && item.mode !== '100755')
|
|
98
|
+
throw new Error(`Unsupported Git file mode in ${repository}: ${item.path}`);
|
|
99
|
+
const relativePath = item.path.slice(prefix.length);
|
|
100
|
+
assertSafePath(relativePath);
|
|
101
|
+
totalFiles += 1;
|
|
102
|
+
if (totalFiles > MAX_FILES)
|
|
103
|
+
throw new Error(`GitHub skill closure exceeds the ${MAX_FILES} file limit`);
|
|
104
|
+
if (item.size !== undefined && item.size > MAX_FILE_BYTES)
|
|
105
|
+
throw new Error(`GitHub skill resource is too large: ${entry.id}/${relativePath}`);
|
|
106
|
+
const bytes = await fetchGitBlob(fetcher, repository, revision, tree, item.path);
|
|
107
|
+
totalBytes += bytes.byteLength;
|
|
108
|
+
if (totalBytes > MAX_TOTAL_BYTES)
|
|
109
|
+
throw new Error(`GitHub skill closure exceeds the ${MAX_TOTAL_BYTES} byte limit`);
|
|
110
|
+
files.push({ path: relativePath, contentBase64: toBase64(bytes), sha256: sha256(bytes), executable: item.mode === '100755' });
|
|
111
|
+
}
|
|
112
|
+
skills[entry.id] = { sourceRevision: revision, files };
|
|
113
|
+
}
|
|
114
|
+
const resolvedSourceRevisions = Object.fromEntries(pinned);
|
|
115
|
+
return { schemaVersion: '1.0.0', manifest, skills, resolvedSourceRevisions };
|
|
116
|
+
}
|
|
117
|
+
function parseCatalog(bytes) {
|
|
118
|
+
let parsed;
|
|
119
|
+
try {
|
|
120
|
+
parsed = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
throw new Error('GitHub catalog manifest is not valid UTF-8 JSON', { cause: error });
|
|
124
|
+
}
|
|
125
|
+
if (!isCatalogSnapshot(parsed))
|
|
126
|
+
throw new Error('GitHub catalog manifest schema is unsupported');
|
|
127
|
+
if (parsed.version !== '1.0.0')
|
|
128
|
+
throw new Error(`Unsupported catalog manifest version: ${parsed.version}`);
|
|
129
|
+
return parsed;
|
|
130
|
+
}
|
|
131
|
+
async function fetchGitBlob(fetcher, repository, commit, tree, path) {
|
|
132
|
+
const item = tree.find((candidate) => candidate.path === path && candidate.type === 'blob');
|
|
133
|
+
if (!item)
|
|
134
|
+
throw new Error(`Pinned Git tree does not contain ${repository}/${path}`);
|
|
135
|
+
if (item.size !== undefined && item.size > MAX_FILE_BYTES)
|
|
136
|
+
throw new Error(`GitHub file is too large: ${repository}/${path}`);
|
|
137
|
+
const url = `https://raw.githubusercontent.com/${repository}/${commit}/${path.split('/').map(encodeURIComponent).join('/')}`;
|
|
138
|
+
const response = await fetcher(url, { redirect: 'error', signal: AbortSignal.timeout(20_000) });
|
|
139
|
+
if (!response.ok)
|
|
140
|
+
throw new Error(`GitHub source read failed (${response.status}) for ${repository}/${path}`);
|
|
141
|
+
const bytes = await readBounded(response, MAX_FILE_BYTES);
|
|
142
|
+
const gitObjectHash = createHash('sha1').update(`blob ${bytes.byteLength}\0`).update(copyBytes(bytes)).digest('hex');
|
|
143
|
+
if (gitObjectHash !== item.sha)
|
|
144
|
+
throw new Error(`GitHub blob integrity check failed for ${repository}/${path}`);
|
|
145
|
+
return bytes;
|
|
146
|
+
}
|
|
147
|
+
async function requestJson(fetcher, url) {
|
|
148
|
+
const response = await fetcher(url, {
|
|
149
|
+
headers: { Accept: 'application/vnd.github+json', 'X-GitHub-Api-Version': '2022-11-28' },
|
|
150
|
+
redirect: 'error',
|
|
151
|
+
signal: AbortSignal.timeout(20_000),
|
|
152
|
+
});
|
|
153
|
+
if (!response.ok)
|
|
154
|
+
throw new Error(`GitHub API request failed (${response.status})`);
|
|
155
|
+
const bytes = await readBounded(response, MAX_JSON_BYTES);
|
|
156
|
+
try {
|
|
157
|
+
return JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes));
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
throw new Error('GitHub API returned invalid JSON', { cause: error });
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function readBounded(response, limit) {
|
|
164
|
+
const declaredLength = Number(response.headers.get('content-length'));
|
|
165
|
+
if (Number.isFinite(declaredLength) && declaredLength > limit)
|
|
166
|
+
throw new Error(`GitHub response exceeds the ${limit} byte limit`);
|
|
167
|
+
if (!response.body)
|
|
168
|
+
throw new Error('GitHub response has no body');
|
|
169
|
+
const reader = response.body.getReader();
|
|
170
|
+
const chunks = [];
|
|
171
|
+
let size = 0;
|
|
172
|
+
while (true) {
|
|
173
|
+
const { done, value } = await reader.read();
|
|
174
|
+
if (done)
|
|
175
|
+
break;
|
|
176
|
+
size += value.byteLength;
|
|
177
|
+
if (size > limit) {
|
|
178
|
+
await reader.cancel();
|
|
179
|
+
throw new Error(`GitHub response exceeds the ${limit} byte limit`);
|
|
180
|
+
}
|
|
181
|
+
chunks.push(value);
|
|
182
|
+
}
|
|
183
|
+
const result = new Uint8Array(size);
|
|
184
|
+
let offset = 0;
|
|
185
|
+
for (const chunk of chunks) {
|
|
186
|
+
result.set(chunk, offset);
|
|
187
|
+
offset += chunk.byteLength;
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
function resolveRequestedClosure(manifest, ids) {
|
|
192
|
+
const byId = new Map(manifest.skills.map((entry) => [entry.id, entry]));
|
|
193
|
+
const complete = [];
|
|
194
|
+
const visited = new Set();
|
|
195
|
+
const visiting = new Set();
|
|
196
|
+
const visit = (id) => {
|
|
197
|
+
const entry = byId.get(id);
|
|
198
|
+
if (!entry)
|
|
199
|
+
throw new Error(`Unknown skill: ${id}`);
|
|
200
|
+
if (visited.has(id))
|
|
201
|
+
return;
|
|
202
|
+
if (visiting.has(id))
|
|
203
|
+
throw new Error(`Prerequisite cycle includes skill: ${id}`);
|
|
204
|
+
visiting.add(id);
|
|
205
|
+
for (const prerequisite of entry.prerequisites)
|
|
206
|
+
if (prerequisite.skillId)
|
|
207
|
+
visit(prerequisite.skillId);
|
|
208
|
+
visiting.delete(id);
|
|
209
|
+
visited.add(id);
|
|
210
|
+
complete.push(entry);
|
|
211
|
+
};
|
|
212
|
+
for (const id of ids)
|
|
213
|
+
visit(id);
|
|
214
|
+
return complete;
|
|
215
|
+
}
|
|
216
|
+
function isCatalogSnapshot(value) {
|
|
217
|
+
if (typeof value !== 'object' || value === null)
|
|
218
|
+
return false;
|
|
219
|
+
const candidate = value;
|
|
220
|
+
return typeof candidate.version === 'string' && Array.isArray(candidate.categories) && Array.isArray(candidate.skills);
|
|
221
|
+
}
|
|
222
|
+
function isCommit(value) {
|
|
223
|
+
if (typeof value !== 'object' || value === null)
|
|
224
|
+
return false;
|
|
225
|
+
const candidate = value;
|
|
226
|
+
return typeof candidate.sha === 'string' && /^[0-9a-f]{40}$/.test(candidate.sha)
|
|
227
|
+
&& typeof candidate.commit === 'object' && candidate.commit !== null
|
|
228
|
+
&& typeof candidate.commit.tree?.sha === 'string' && /^[0-9a-f]{40}$/.test(candidate.commit.tree.sha);
|
|
229
|
+
}
|
|
230
|
+
function assertApprovedRepository(repository) {
|
|
231
|
+
if (!['devin-thomas/skills', 'devin-thomas/starter-pack', 'devin-thomas/vid-chopper'].includes(repository)) {
|
|
232
|
+
throw new Error(`Unapproved source repository: ${repository}`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function assertApprovedRef(ref, repository) {
|
|
236
|
+
if (ref !== 'main')
|
|
237
|
+
throw new Error(`Unsupported source ref for ${repository}: ${ref}`);
|
|
238
|
+
}
|
|
239
|
+
function assertSafePath(path) {
|
|
240
|
+
if (!path || path.startsWith('/') || path.includes('\\') || path.split('/').some((part) => !part || part === '.' || part === '..' || /[<>:"|?*\x00-\x1f]/.test(part) || /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(part))) {
|
|
241
|
+
throw new Error(`Unsafe GitHub skill path: ${path}`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function sha256(bytes) {
|
|
245
|
+
return createHash('sha256').update(copyBytes(bytes)).digest('hex');
|
|
246
|
+
}
|
|
247
|
+
function copyBytes(bytes) {
|
|
248
|
+
const copy = new Uint8Array(bytes.byteLength);
|
|
249
|
+
copy.set(bytes);
|
|
250
|
+
return copy;
|
|
251
|
+
}
|
|
252
|
+
function toBase64(bytes) {
|
|
253
|
+
const copy = copyBytes(bytes);
|
|
254
|
+
return Buffer.from(copy.buffer).toString('base64');
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=github.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/catalog/github.ts"],"names":[],"mappings":"A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C,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,KAAiB;IACjC,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CatalogBundle, CatalogEntry, CatalogPolicy, CatalogSnapshot, LatestCatalogSource, MaterializedSkill } from './types.js';
|
|
2
|
+
export declare function readBundledCatalog(bundle: CatalogBundle): CatalogSnapshot;
|
|
3
|
+
export declare function validateCatalog(snapshot: CatalogSnapshot, policy?: CatalogPolicy): void;
|
|
4
|
+
export declare function resolveSkill(snapshot: CatalogSnapshot, id: string): CatalogEntry;
|
|
5
|
+
export declare function resolveClosure(snapshot: CatalogSnapshot, ids: readonly string[]): CatalogEntry[];
|
|
6
|
+
export declare function materializeSkill(entry: CatalogEntry, bundle: CatalogBundle): MaterializedSkill;
|
|
7
|
+
export declare function loadLatestCatalog(source: LatestCatalogSource): Promise<CatalogSnapshot>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/catalog/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAmBpB,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,eAAe,CAOzE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,GAAE,aAAkB,GAAG,IAAI,CA6C3F;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAIhF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,EAAE,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,EAAE,CAqBhG;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,iBAAiB,CA+B9F;AAED,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,CAK7F"}
|