agents-inc 0.159.0 → 0.161.0
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/CHANGELOG.md +23 -0
- package/README.md +1 -1
- package/dist/{chunk-PEHYVSJG.js → chunk-264XDRU7.js} +2 -2
- package/dist/{chunk-WVKGO3Y5.js → chunk-2MPXMJ2O.js} +7 -7
- package/dist/{chunk-IO2DPRDS.js → chunk-3H42U56X.js} +2 -2
- package/dist/{chunk-FBRLHNUT.js → chunk-3M75HVIM.js} +3 -3
- package/dist/{chunk-YKRPWZ3G.js → chunk-3TM4FHTG.js} +2 -2
- package/dist/{chunk-5YOSLSQJ.js → chunk-5DWDT6GM.js} +115 -96
- package/dist/chunk-5DWDT6GM.js.map +1 -0
- package/dist/{chunk-4APXK7ZY.js → chunk-5MML3K36.js} +2 -2
- package/dist/{chunk-F35G42TF.js → chunk-6PVWDTEM.js} +12 -12
- package/dist/{chunk-VCUXNKOY.js → chunk-A2NA377T.js} +6 -6
- package/dist/{chunk-4RYWFQK7.js → chunk-ADDYIMWN.js} +3 -3
- package/dist/{chunk-V625APR6.js → chunk-AMZO4YJK.js} +10789 -18786
- package/dist/chunk-AMZO4YJK.js.map +1 -0
- package/dist/{chunk-4VMLCWLD.js → chunk-AO6DXJUK.js} +3 -3
- package/dist/{chunk-G7TYOPON.js → chunk-B3YSTZZC.js} +3 -3
- package/dist/{chunk-THLQS2AW.js → chunk-B7YTQVAF.js} +4 -4
- package/dist/{chunk-7Z4N4JWQ.js → chunk-BLGETWYI.js} +6 -113
- package/dist/chunk-BLGETWYI.js.map +1 -0
- package/dist/{chunk-ITEJARWI.js → chunk-BRHU6J3C.js} +3 -3
- package/dist/{chunk-AU5FS3QK.js → chunk-DGXW2ZFY.js} +3 -3
- package/dist/{chunk-LSSGS2QS.js → chunk-DHRW3MDM.js} +3 -3
- package/dist/{chunk-OJIQOVWB.js → chunk-DTCUZL7S.js} +2 -2
- package/dist/{chunk-SKDTGHCD.js → chunk-EEFTUZHZ.js} +5 -5
- package/dist/{chunk-BQJVHD6Y.js → chunk-EERGAAGE.js} +5 -10
- package/dist/chunk-EERGAAGE.js.map +1 -0
- package/dist/{chunk-Z6G24ROK.js → chunk-EQSMVZGS.js} +10 -10
- package/dist/{chunk-2Q65K6E3.js → chunk-EY7Z34Y4.js} +15 -15
- package/dist/{chunk-BNHD2GIB.js → chunk-F6LS2BQD.js} +11 -11
- package/dist/{chunk-SITF5EZM.js → chunk-HB3YIAFD.js} +2 -2
- package/dist/{chunk-GPZQCLZJ.js → chunk-LZPRLHUE.js} +9 -9
- package/dist/{chunk-YAHTF4NO.js → chunk-MED6GNV3.js} +288 -203
- package/dist/chunk-MED6GNV3.js.map +1 -0
- package/dist/chunk-N6CILY5A.js +35 -0
- package/dist/chunk-N6CILY5A.js.map +1 -0
- package/dist/{chunk-42PQKBVU.js → chunk-ODUACQLV.js} +6 -6
- package/dist/{chunk-VZRO7RYT.js → chunk-OI2H6M5I.js} +1 -103
- package/dist/chunk-OI2H6M5I.js.map +1 -0
- package/dist/{chunk-MPLWPWL4.js → chunk-QKMT6OOP.js} +2 -2
- package/dist/{chunk-WVBJRFFM.js → chunk-SX57ZIGM.js} +4 -4
- package/dist/{chunk-62XKTOUI.js → chunk-T4RVCFWN.js} +5 -15
- package/dist/chunk-T4RVCFWN.js.map +1 -0
- package/dist/{chunk-4VVKVOOP.js → chunk-UMYEY6BA.js} +2 -2
- package/dist/{chunk-X5PLVOJS.js → chunk-W2RXRWDB.js} +2 -2
- package/dist/{chunk-JV4P7BL4.js → chunk-WVCF7KFV.js} +5 -5
- package/dist/chunk-XA4SWA2Z.js +591 -0
- package/dist/chunk-XA4SWA2Z.js.map +1 -0
- package/dist/{chunk-LVA6XJGR.js → chunk-YOVUXONB.js} +9 -43
- package/dist/chunk-YOVUXONB.js.map +1 -0
- package/dist/chunk-YSQ76LWG.js +8734 -0
- package/dist/chunk-YSQ76LWG.js.map +1 -0
- package/dist/{chunk-Z6KROWH4.js → chunk-ZQZHDYHQ.js} +7 -7
- package/dist/commands/build/marketplace.js +8 -8
- package/dist/commands/build/plugins.js +8 -8
- package/dist/commands/compile.js +14 -14
- package/dist/commands/doctor.js +13 -13
- package/dist/commands/edit.js +45 -45
- package/dist/commands/eject.js +11 -11
- package/dist/commands/init.js +37 -37
- package/dist/commands/list.js +9 -9
- package/dist/commands/new/marketplace.js +8 -9
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/search.js +11 -11
- package/dist/commands/share.js +11 -10
- package/dist/commands/share.js.map +1 -1
- package/dist/commands/uninstall.js +12 -12
- package/dist/commands/update.js +7 -7
- package/dist/components/common/removal-plan-confirm.js +2 -2
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/wizard/category-grid.js +4 -4
- package/dist/components/wizard/checkbox-grid.js +4 -4
- package/dist/components/wizard/domain-selection.js +10 -10
- package/dist/components/wizard/run-wizard-session.js +27 -27
- package/dist/components/wizard/scroll-affordance.js +2 -2
- package/dist/components/wizard/skill-agent-summary.js +6 -6
- package/dist/components/wizard/source-grid.js +5 -5
- package/dist/components/wizard/stack-selection.js +8 -8
- package/dist/components/wizard/step-agents.js +9 -9
- package/dist/components/wizard/step-build.js +8 -8
- package/dist/components/wizard/step-confirm.js +10 -10
- package/dist/components/wizard/step-sources.js +9 -9
- package/dist/components/wizard/step-stack.js +9 -9
- package/dist/components/wizard/summary-panel.js +9 -9
- package/dist/components/wizard/toast.js +2 -2
- package/dist/components/wizard/wizard-layout.js +13 -13
- package/dist/components/wizard/wizard-tabs.js +2 -2
- package/dist/components/wizard/wizard.js +26 -26
- package/dist/config-exports.js +1 -1
- package/dist/hooks/init.js +37 -37
- package/dist/load-agent-defs-LDSND43G.js +13 -0
- package/dist/recompile-project-agents-GQLODH24.js +17 -0
- package/dist/{source-loader-CC6ZWKTI.js → source-loader-TSF5VS6V.js} +5 -5
- package/dist/src/agents/_templates/methodologies/anti-over-engineering.liquid +14 -0
- package/dist/src/agents/_templates/methodologies/context-management.liquid +7 -154
- package/dist/src/agents/_templates/methodologies/investigation-requirements.liquid +12 -0
- package/dist/src/agents/_templates/methodologies/success-criteria.liquid +10 -0
- package/dist/stores/wizard-store.js +5 -5
- package/package.json +9 -4
- package/src/agents/_templates/methodologies/anti-over-engineering.liquid +14 -0
- package/src/agents/_templates/methodologies/context-management.liquid +7 -154
- package/src/agents/_templates/methodologies/investigation-requirements.liquid +12 -0
- package/src/agents/_templates/methodologies/success-criteria.liquid +10 -0
- package/dist/chunk-5KB4I5J7.js +0 -262
- package/dist/chunk-5KB4I5J7.js.map +0 -1
- package/dist/chunk-5YOSLSQJ.js.map +0 -1
- package/dist/chunk-62XKTOUI.js.map +0 -1
- package/dist/chunk-7Z4N4JWQ.js.map +0 -1
- package/dist/chunk-BQJVHD6Y.js.map +0 -1
- package/dist/chunk-LVA6XJGR.js.map +0 -1
- package/dist/chunk-NS5COBTT.js +0 -254
- package/dist/chunk-NS5COBTT.js.map +0 -1
- package/dist/chunk-V625APR6.js.map +0 -1
- package/dist/chunk-VZRO7RYT.js.map +0 -1
- package/dist/chunk-YAHTF4NO.js.map +0 -1
- package/dist/chunk-YVQSDBTK.js +0 -169
- package/dist/chunk-YVQSDBTK.js.map +0 -1
- package/dist/load-agent-defs-2H42B2OO.js +0 -13
- package/dist/recompile-project-agents-QIAMBCM4.js +0 -17
- /package/dist/{chunk-PEHYVSJG.js.map → chunk-264XDRU7.js.map} +0 -0
- /package/dist/{chunk-WVKGO3Y5.js.map → chunk-2MPXMJ2O.js.map} +0 -0
- /package/dist/{chunk-IO2DPRDS.js.map → chunk-3H42U56X.js.map} +0 -0
- /package/dist/{chunk-FBRLHNUT.js.map → chunk-3M75HVIM.js.map} +0 -0
- /package/dist/{chunk-YKRPWZ3G.js.map → chunk-3TM4FHTG.js.map} +0 -0
- /package/dist/{chunk-4APXK7ZY.js.map → chunk-5MML3K36.js.map} +0 -0
- /package/dist/{chunk-F35G42TF.js.map → chunk-6PVWDTEM.js.map} +0 -0
- /package/dist/{chunk-VCUXNKOY.js.map → chunk-A2NA377T.js.map} +0 -0
- /package/dist/{chunk-4RYWFQK7.js.map → chunk-ADDYIMWN.js.map} +0 -0
- /package/dist/{chunk-4VMLCWLD.js.map → chunk-AO6DXJUK.js.map} +0 -0
- /package/dist/{chunk-G7TYOPON.js.map → chunk-B3YSTZZC.js.map} +0 -0
- /package/dist/{chunk-THLQS2AW.js.map → chunk-B7YTQVAF.js.map} +0 -0
- /package/dist/{chunk-ITEJARWI.js.map → chunk-BRHU6J3C.js.map} +0 -0
- /package/dist/{chunk-AU5FS3QK.js.map → chunk-DGXW2ZFY.js.map} +0 -0
- /package/dist/{chunk-LSSGS2QS.js.map → chunk-DHRW3MDM.js.map} +0 -0
- /package/dist/{chunk-OJIQOVWB.js.map → chunk-DTCUZL7S.js.map} +0 -0
- /package/dist/{chunk-SKDTGHCD.js.map → chunk-EEFTUZHZ.js.map} +0 -0
- /package/dist/{chunk-Z6G24ROK.js.map → chunk-EQSMVZGS.js.map} +0 -0
- /package/dist/{chunk-2Q65K6E3.js.map → chunk-EY7Z34Y4.js.map} +0 -0
- /package/dist/{chunk-BNHD2GIB.js.map → chunk-F6LS2BQD.js.map} +0 -0
- /package/dist/{chunk-SITF5EZM.js.map → chunk-HB3YIAFD.js.map} +0 -0
- /package/dist/{chunk-GPZQCLZJ.js.map → chunk-LZPRLHUE.js.map} +0 -0
- /package/dist/{chunk-42PQKBVU.js.map → chunk-ODUACQLV.js.map} +0 -0
- /package/dist/{chunk-MPLWPWL4.js.map → chunk-QKMT6OOP.js.map} +0 -0
- /package/dist/{chunk-WVBJRFFM.js.map → chunk-SX57ZIGM.js.map} +0 -0
- /package/dist/{chunk-4VVKVOOP.js.map → chunk-UMYEY6BA.js.map} +0 -0
- /package/dist/{chunk-X5PLVOJS.js.map → chunk-W2RXRWDB.js.map} +0 -0
- /package/dist/{chunk-JV4P7BL4.js.map → chunk-WVCF7KFV.js.map} +0 -0
- /package/dist/{chunk-Z6KROWH4.js.map → chunk-ZQZHDYHQ.js.map} +0 -0
- /package/dist/{load-agent-defs-2H42B2OO.js.map → load-agent-defs-LDSND43G.js.map} +0 -0
- /package/dist/{recompile-project-agents-QIAMBCM4.js.map → recompile-project-agents-GQLODH24.js.map} +0 -0
- /package/dist/{source-loader-CC6ZWKTI.js.map → source-loader-TSF5VS6V.js.map} +0 -0
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
claimSlug,
|
|
4
|
+
computeFileHash,
|
|
5
|
+
glob,
|
|
6
|
+
injectForkedFromMetadata,
|
|
7
|
+
readFile,
|
|
8
|
+
readLocalSkillMetadata,
|
|
9
|
+
readSkillMetadata,
|
|
10
|
+
resolveInstallPaths,
|
|
11
|
+
validateSkillPath,
|
|
12
|
+
writeFile,
|
|
13
|
+
writeMetadataYaml
|
|
14
|
+
} from "./chunk-YSQ76LWG.js";
|
|
15
|
+
import {
|
|
16
|
+
getCategoryDomain,
|
|
17
|
+
typedEntries
|
|
18
|
+
} from "./chunk-BLGETWYI.js";
|
|
19
|
+
import {
|
|
20
|
+
GITHUB_SOURCE,
|
|
21
|
+
LOCAL_SKILLS_PATH,
|
|
22
|
+
STANDARD_FILES,
|
|
23
|
+
seedExternalSkillSchema,
|
|
24
|
+
seedPayloadSchema
|
|
25
|
+
} from "./chunk-AMZO4YJK.js";
|
|
26
|
+
|
|
27
|
+
// src/cli/lib/seed/external-skills.ts
|
|
28
|
+
import path from "path";
|
|
29
|
+
function pluginInstallError(ids) {
|
|
30
|
+
return [
|
|
31
|
+
"This configuration cannot be installed: these skills travel inside it, so no marketplace serves them and they cannot be installed as plugins:",
|
|
32
|
+
...ids.map((id) => ` ${id}`),
|
|
33
|
+
"Re-share it with each skill above set to eject, which is the only way a carried skill installs."
|
|
34
|
+
].join("\n");
|
|
35
|
+
}
|
|
36
|
+
function selectedExternals(payload) {
|
|
37
|
+
return typedEntries(payload.external ?? {}).flatMap(([id, skill]) => {
|
|
38
|
+
const entry = payload.skills[id];
|
|
39
|
+
return entry ? [{ id, skill, entry }] : [];
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function askedForAsPlugin(externals) {
|
|
43
|
+
return externals.filter(({ entry }) => entry.install !== "eject").map(({ id }) => id);
|
|
44
|
+
}
|
|
45
|
+
function externalSlug(id) {
|
|
46
|
+
return id;
|
|
47
|
+
}
|
|
48
|
+
function skillAuthor(repo) {
|
|
49
|
+
const [owner = repo] = repo.split("/");
|
|
50
|
+
return `@${owner}`;
|
|
51
|
+
}
|
|
52
|
+
function repoRef(repo) {
|
|
53
|
+
return `${GITHUB_SOURCE.GITHUB_PREFIX}${repo}`;
|
|
54
|
+
}
|
|
55
|
+
function externalSkillDir(id, scope, projectDir) {
|
|
56
|
+
return path.join(resolveInstallPaths(projectDir, scope).skillsDir, id);
|
|
57
|
+
}
|
|
58
|
+
function externalCatalogueEntry(install) {
|
|
59
|
+
return {
|
|
60
|
+
id: install.id,
|
|
61
|
+
slug: externalSlug(install.id),
|
|
62
|
+
displayName: install.skill.displayName,
|
|
63
|
+
description: install.skill.description,
|
|
64
|
+
// Boundary cast held by the guard above it: the category was confirmed against the catalogue
|
|
65
|
+
// the payload names, and this one has just been shown to declare it too.
|
|
66
|
+
category: install.skill.categoryId,
|
|
67
|
+
author: skillAuthor(install.skill.repo),
|
|
68
|
+
path: `${LOCAL_SKILLS_PATH}/${install.id}/`,
|
|
69
|
+
conflictsWith: [],
|
|
70
|
+
requires: [],
|
|
71
|
+
alternatives: [],
|
|
72
|
+
discourages: [],
|
|
73
|
+
// Local and custom for the same reason: the bytes are on this machine and nowhere else, and
|
|
74
|
+
// the skill was authored outside the vocabulary this catalogue ships.
|
|
75
|
+
local: true,
|
|
76
|
+
custom: true,
|
|
77
|
+
localPath: install.skillDir
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function seatExternalSkill({ id, skill, entry }, matrix, projectDir) {
|
|
81
|
+
const domain = getCategoryDomain(skill.categoryId);
|
|
82
|
+
if (domain === void 0) return [];
|
|
83
|
+
const install = {
|
|
84
|
+
id,
|
|
85
|
+
skill,
|
|
86
|
+
domain,
|
|
87
|
+
scope: entry.scope,
|
|
88
|
+
skillDir: externalSkillDir(id, entry.scope, projectDir)
|
|
89
|
+
};
|
|
90
|
+
matrix.skills[id] = externalCatalogueEntry(install);
|
|
91
|
+
claimSlug(matrix.slugMap, externalSlug(id), id);
|
|
92
|
+
return [install];
|
|
93
|
+
}
|
|
94
|
+
function registerExternalSkills(payload, matrix, projectDir) {
|
|
95
|
+
const externals = selectedExternals(payload);
|
|
96
|
+
const asPlugin = askedForAsPlugin(externals);
|
|
97
|
+
if (asPlugin.length > 0) throw new Error(pluginInstallError(asPlugin));
|
|
98
|
+
return externals.flatMap((external) => seatExternalSkill(external, matrix, projectDir));
|
|
99
|
+
}
|
|
100
|
+
async function writeExternalSkills(installs) {
|
|
101
|
+
for (const install of installs) {
|
|
102
|
+
await writeSkillTree(install);
|
|
103
|
+
await writeSkillManifest(install);
|
|
104
|
+
await registerSkillOnDisk(install);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function writeSkillTree(install) {
|
|
108
|
+
for (const [relativePath, contents] of Object.entries(install.skill.files)) {
|
|
109
|
+
const filePath = path.join(install.skillDir, relativePath);
|
|
110
|
+
validateSkillPath(filePath, install.skillDir, relativePath);
|
|
111
|
+
await writeFile(filePath, contents);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var FRONTMATTER_BLOCK = /^---\r?\n([\s\S]*?)\r?\n---/;
|
|
115
|
+
var NAME_FIELD = /^name:.*$/m;
|
|
116
|
+
function withInstalledName(manifest, install) {
|
|
117
|
+
const named = `name: ${install.id}`;
|
|
118
|
+
const block = FRONTMATTER_BLOCK.exec(manifest);
|
|
119
|
+
if (!block) {
|
|
120
|
+
return `---
|
|
121
|
+
${named}
|
|
122
|
+
description: ${install.skill.description}
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
${manifest}`;
|
|
126
|
+
}
|
|
127
|
+
const [whole, fields = ""] = block;
|
|
128
|
+
const renamed = NAME_FIELD.test(fields) ? fields.replace(NAME_FIELD, named) : `${named}
|
|
129
|
+
${fields}`;
|
|
130
|
+
return `---
|
|
131
|
+
${renamed}
|
|
132
|
+
---${manifest.slice(whole.length)}`;
|
|
133
|
+
}
|
|
134
|
+
async function writeSkillManifest(install) {
|
|
135
|
+
const manifestPath = path.join(install.skillDir, STANDARD_FILES.SKILL_MD);
|
|
136
|
+
await writeFile(manifestPath, withInstalledName(await readFile(manifestPath), install));
|
|
137
|
+
}
|
|
138
|
+
function externalSkillMetadata(install, shipped) {
|
|
139
|
+
return {
|
|
140
|
+
author: skillAuthor(install.skill.repo),
|
|
141
|
+
usageGuidance: `Use when working with ${install.skill.displayName}`,
|
|
142
|
+
...shipped,
|
|
143
|
+
displayName: install.skill.displayName,
|
|
144
|
+
slug: install.id,
|
|
145
|
+
category: install.skill.categoryId,
|
|
146
|
+
domain: install.domain,
|
|
147
|
+
cliDescription: install.skill.description,
|
|
148
|
+
custom: true
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async function registerSkillOnDisk(install) {
|
|
152
|
+
const metadataPath = path.join(install.skillDir, STANDARD_FILES.METADATA_YAML);
|
|
153
|
+
const shipped = await readLocalSkillMetadata(install.skillDir);
|
|
154
|
+
await writeMetadataYaml(metadataPath, externalSkillMetadata(install, shipped));
|
|
155
|
+
await injectForkedFromMetadata(
|
|
156
|
+
install.skillDir,
|
|
157
|
+
install.id,
|
|
158
|
+
await computeFileHash(path.join(install.skillDir, STANDARD_FILES.SKILL_MD)),
|
|
159
|
+
{ source: repoRef(install.skill.repo), path: install.skill.path }
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
function unnameableRepoMessage(id) {
|
|
163
|
+
return `${id} travels inside a shared configuration, and this installation does not record the repository its content came from`;
|
|
164
|
+
}
|
|
165
|
+
function uncarryableContentMessage(id, reason) {
|
|
166
|
+
return `${id} travels inside a shared configuration, and ${reason}`;
|
|
167
|
+
}
|
|
168
|
+
function repoFromRef(ref) {
|
|
169
|
+
if (ref === void 0 || !ref.startsWith(GITHUB_SOURCE.GITHUB_PREFIX)) return void 0;
|
|
170
|
+
return ref.slice(GITHUB_SOURCE.GITHUB_PREFIX.length);
|
|
171
|
+
}
|
|
172
|
+
async function readSkillTree(skillDir) {
|
|
173
|
+
const files = await glob("**/*", skillDir, { dot: true });
|
|
174
|
+
const entries = await Promise.all(
|
|
175
|
+
files.map(async (file) => [file, await readFile(path.join(skillDir, file))])
|
|
176
|
+
);
|
|
177
|
+
return Object.fromEntries(entries);
|
|
178
|
+
}
|
|
179
|
+
async function readCarriedSkill({ id, skillDir, provenance }) {
|
|
180
|
+
if (provenance.path === void 0) return { carries: "nothing" };
|
|
181
|
+
const repo = repoFromRef(provenance.source);
|
|
182
|
+
if (repo === void 0) return { carries: "unshareable", line: unnameableRepoMessage(id) };
|
|
183
|
+
const described = await readSkillMetadata(path.join(skillDir, STANDARD_FILES.METADATA_YAML));
|
|
184
|
+
if (!described.usable) {
|
|
185
|
+
return { carries: "unshareable", line: uncarryableContentMessage(id, described.reason) };
|
|
186
|
+
}
|
|
187
|
+
const parsed = seedExternalSkillSchema.safeParse({
|
|
188
|
+
displayName: described.metadata.displayName,
|
|
189
|
+
description: described.metadata.cliDescription,
|
|
190
|
+
categoryId: described.metadata.category,
|
|
191
|
+
repo,
|
|
192
|
+
path: provenance.path,
|
|
193
|
+
files: await readSkillTree(skillDir)
|
|
194
|
+
});
|
|
195
|
+
if (!parsed.success) {
|
|
196
|
+
const reason = parsed.error.issues.map((issue) => issue.message).join("; ");
|
|
197
|
+
return { carries: "unshareable", line: uncarryableContentMessage(id, reason) };
|
|
198
|
+
}
|
|
199
|
+
return { carries: "content", id, skill: parsed.data };
|
|
200
|
+
}
|
|
201
|
+
async function readCarriedSkills(owned) {
|
|
202
|
+
const reads = await Promise.all(owned.map(readCarriedSkill));
|
|
203
|
+
return {
|
|
204
|
+
external: Object.fromEntries(
|
|
205
|
+
reads.flatMap((read) => read.carries === "content" ? [[read.id, read.skill]] : [])
|
|
206
|
+
),
|
|
207
|
+
uncarryable: reads.flatMap((read) => read.carries === "unshareable" ? [read.line] : [])
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ../../node_modules/hono/dist/utils/cookie.js
|
|
212
|
+
var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
|
|
213
|
+
var _serialize = (name, value, opt = {}) => {
|
|
214
|
+
if (!validCookieNameRegEx.test(name)) {
|
|
215
|
+
throw new Error("Invalid cookie name");
|
|
216
|
+
}
|
|
217
|
+
let cookie = `${name}=${value}`;
|
|
218
|
+
if (name.startsWith("__Secure-") && !opt.secure) {
|
|
219
|
+
throw new Error("__Secure- Cookie must have Secure attributes");
|
|
220
|
+
}
|
|
221
|
+
if (name.startsWith("__Host-")) {
|
|
222
|
+
if (!opt.secure) {
|
|
223
|
+
throw new Error("__Host- Cookie must have Secure attributes");
|
|
224
|
+
}
|
|
225
|
+
if (opt.path !== "/") {
|
|
226
|
+
throw new Error('__Host- Cookie must have Path attributes with "/"');
|
|
227
|
+
}
|
|
228
|
+
if (opt.domain) {
|
|
229
|
+
throw new Error("__Host- Cookie must not have Domain attributes");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
for (const key of ["domain", "path", "sameSite", "priority"]) {
|
|
233
|
+
if (opt[key] && /[;\r\n]/.test(opt[key])) {
|
|
234
|
+
throw new Error(`${key} must not contain ";", "\\r", or "\\n"`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (opt && typeof opt.maxAge === "number" && opt.maxAge >= 0) {
|
|
238
|
+
if (opt.maxAge > 3456e4) {
|
|
239
|
+
throw new Error(
|
|
240
|
+
"Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration."
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
cookie += `; Max-Age=${opt.maxAge | 0}`;
|
|
244
|
+
}
|
|
245
|
+
if (opt.domain && opt.prefix !== "host") {
|
|
246
|
+
cookie += `; Domain=${opt.domain}`;
|
|
247
|
+
}
|
|
248
|
+
if (opt.path) {
|
|
249
|
+
cookie += `; Path=${opt.path}`;
|
|
250
|
+
}
|
|
251
|
+
if (opt.expires) {
|
|
252
|
+
if (opt.expires.getTime() - Date.now() > 3456e7) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
"Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future."
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
cookie += `; Expires=${opt.expires.toUTCString()}`;
|
|
258
|
+
}
|
|
259
|
+
if (opt.httpOnly) {
|
|
260
|
+
cookie += "; HttpOnly";
|
|
261
|
+
}
|
|
262
|
+
if (opt.secure) {
|
|
263
|
+
cookie += "; Secure";
|
|
264
|
+
}
|
|
265
|
+
if (opt.sameSite) {
|
|
266
|
+
cookie += `; SameSite=${opt.sameSite.charAt(0).toUpperCase() + opt.sameSite.slice(1)}`;
|
|
267
|
+
}
|
|
268
|
+
if (opt.priority) {
|
|
269
|
+
cookie += `; Priority=${opt.priority.charAt(0).toUpperCase() + opt.priority.slice(1)}`;
|
|
270
|
+
}
|
|
271
|
+
if (opt.partitioned) {
|
|
272
|
+
if (!opt.secure) {
|
|
273
|
+
throw new Error("Partitioned Cookie must have Secure attributes");
|
|
274
|
+
}
|
|
275
|
+
cookie += "; Partitioned";
|
|
276
|
+
}
|
|
277
|
+
return cookie;
|
|
278
|
+
};
|
|
279
|
+
var serialize = (name, value, opt) => {
|
|
280
|
+
value = encodeURIComponent(value);
|
|
281
|
+
return _serialize(name, value, opt);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// ../../node_modules/hono/dist/client/utils.js
|
|
285
|
+
var mergePath = (base, path2) => {
|
|
286
|
+
base = base.replace(/\/+$/, "");
|
|
287
|
+
base = base + "/";
|
|
288
|
+
path2 = path2.replace(/^\/+/, "");
|
|
289
|
+
return base + path2;
|
|
290
|
+
};
|
|
291
|
+
var replaceUrlParam = (urlString, params) => {
|
|
292
|
+
for (const [k, v] of Object.entries(params)) {
|
|
293
|
+
const reg = new RegExp("/:" + k + "(?:{[^/]+})?\\??(?=/|$)");
|
|
294
|
+
urlString = urlString.replace(reg, v ? `/${v}` : "");
|
|
295
|
+
}
|
|
296
|
+
return urlString;
|
|
297
|
+
};
|
|
298
|
+
var buildSearchParams = (query) => {
|
|
299
|
+
const searchParams = new URLSearchParams();
|
|
300
|
+
for (const [k, v] of Object.entries(query)) {
|
|
301
|
+
if (v === void 0) {
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if (Array.isArray(v)) {
|
|
305
|
+
for (const v2 of v) {
|
|
306
|
+
searchParams.append(k, v2);
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
searchParams.set(k, v);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return searchParams;
|
|
313
|
+
};
|
|
314
|
+
var replaceUrlProtocol = (urlString, protocol) => {
|
|
315
|
+
switch (protocol) {
|
|
316
|
+
case "ws":
|
|
317
|
+
return urlString.replace(/^http/, "ws");
|
|
318
|
+
case "http":
|
|
319
|
+
return urlString.replace(/^ws/, "http");
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
var removeIndexString = (urlString) => {
|
|
323
|
+
if (/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(urlString)) {
|
|
324
|
+
return urlString.replace(/\/index(?=\?|$)/, "/");
|
|
325
|
+
}
|
|
326
|
+
return urlString.replace(/\/index(?=\?|$)/, "");
|
|
327
|
+
};
|
|
328
|
+
function isObject(item) {
|
|
329
|
+
return typeof item === "object" && item !== null && !Array.isArray(item);
|
|
330
|
+
}
|
|
331
|
+
function deepMerge(target, source) {
|
|
332
|
+
if (!isObject(target) && !isObject(source)) {
|
|
333
|
+
return source;
|
|
334
|
+
}
|
|
335
|
+
const merged = { ...target };
|
|
336
|
+
for (const key in source) {
|
|
337
|
+
const value = source[key];
|
|
338
|
+
if (isObject(merged[key]) && isObject(value)) {
|
|
339
|
+
merged[key] = deepMerge(merged[key], value);
|
|
340
|
+
} else {
|
|
341
|
+
merged[key] = value;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return merged;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ../../node_modules/hono/dist/client/client.js
|
|
348
|
+
var createProxy = (callback, path2) => {
|
|
349
|
+
const proxy = new Proxy(() => {
|
|
350
|
+
}, {
|
|
351
|
+
get(_obj, key) {
|
|
352
|
+
if (typeof key !== "string" || key === "then") {
|
|
353
|
+
return void 0;
|
|
354
|
+
}
|
|
355
|
+
return createProxy(callback, [...path2, key]);
|
|
356
|
+
},
|
|
357
|
+
apply(_1, _2, args) {
|
|
358
|
+
return callback({
|
|
359
|
+
path: path2,
|
|
360
|
+
args
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
return proxy;
|
|
365
|
+
};
|
|
366
|
+
var ClientRequestImpl = class {
|
|
367
|
+
url;
|
|
368
|
+
method;
|
|
369
|
+
buildSearchParams;
|
|
370
|
+
queryParams = void 0;
|
|
371
|
+
pathParams = {};
|
|
372
|
+
rBody;
|
|
373
|
+
cType = void 0;
|
|
374
|
+
constructor(url, method, options) {
|
|
375
|
+
this.url = url;
|
|
376
|
+
this.method = method;
|
|
377
|
+
this.buildSearchParams = options.buildSearchParams;
|
|
378
|
+
}
|
|
379
|
+
fetch = async (args, opt) => {
|
|
380
|
+
if (args) {
|
|
381
|
+
if (args.query) {
|
|
382
|
+
this.queryParams = this.buildSearchParams(args.query);
|
|
383
|
+
}
|
|
384
|
+
if (args.form) {
|
|
385
|
+
const form = new FormData();
|
|
386
|
+
for (const [k, v] of Object.entries(args.form)) {
|
|
387
|
+
if (v === void 0) {
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
if (Array.isArray(v)) {
|
|
391
|
+
for (const v2 of v) {
|
|
392
|
+
form.append(k, v2);
|
|
393
|
+
}
|
|
394
|
+
} else {
|
|
395
|
+
form.append(k, v);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
this.rBody = form;
|
|
399
|
+
}
|
|
400
|
+
if (args.json) {
|
|
401
|
+
this.rBody = JSON.stringify(args.json);
|
|
402
|
+
this.cType = "application/json";
|
|
403
|
+
}
|
|
404
|
+
if (args.param) {
|
|
405
|
+
this.pathParams = args.param;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
let methodUpperCase = this.method.toUpperCase();
|
|
409
|
+
const headerValues = {
|
|
410
|
+
...args?.header,
|
|
411
|
+
...typeof opt?.headers === "function" ? await opt.headers() : opt?.headers
|
|
412
|
+
};
|
|
413
|
+
if (args?.cookie) {
|
|
414
|
+
const cookies = [];
|
|
415
|
+
for (const [key, value] of Object.entries(args.cookie)) {
|
|
416
|
+
cookies.push(serialize(key, value, { path: "/" }));
|
|
417
|
+
}
|
|
418
|
+
headerValues["Cookie"] = cookies.join(",");
|
|
419
|
+
}
|
|
420
|
+
if (this.cType) {
|
|
421
|
+
headerValues["Content-Type"] = this.cType;
|
|
422
|
+
}
|
|
423
|
+
const headers = new Headers(headerValues ?? void 0);
|
|
424
|
+
let url = this.url;
|
|
425
|
+
url = removeIndexString(url);
|
|
426
|
+
url = replaceUrlParam(url, this.pathParams);
|
|
427
|
+
if (this.queryParams) {
|
|
428
|
+
url = url + "?" + this.queryParams.toString();
|
|
429
|
+
}
|
|
430
|
+
methodUpperCase = this.method.toUpperCase();
|
|
431
|
+
const setBody = !(methodUpperCase === "GET" || methodUpperCase === "HEAD");
|
|
432
|
+
return (opt?.fetch || fetch)(url, {
|
|
433
|
+
body: setBody ? this.rBody : void 0,
|
|
434
|
+
method: methodUpperCase,
|
|
435
|
+
headers,
|
|
436
|
+
...opt?.init
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
var hc = (baseUrl, options) => createProxy(function proxyCallback(opts) {
|
|
441
|
+
const buildSearchParamsOption = options?.buildSearchParams ?? buildSearchParams;
|
|
442
|
+
const parts = [...opts.path];
|
|
443
|
+
const lastParts = parts.slice(-3).reverse();
|
|
444
|
+
if (lastParts[0] === "toString") {
|
|
445
|
+
if (lastParts[1] === "name") {
|
|
446
|
+
return lastParts[2] || "";
|
|
447
|
+
}
|
|
448
|
+
return proxyCallback.toString();
|
|
449
|
+
}
|
|
450
|
+
if (lastParts[0] === "valueOf") {
|
|
451
|
+
if (lastParts[1] === "name") {
|
|
452
|
+
return lastParts[2] || "";
|
|
453
|
+
}
|
|
454
|
+
return proxyCallback;
|
|
455
|
+
}
|
|
456
|
+
let method = "";
|
|
457
|
+
if (/^\$/.test(lastParts[0])) {
|
|
458
|
+
const last = parts.pop();
|
|
459
|
+
if (last) {
|
|
460
|
+
method = last.replace(/^\$/, "");
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
const path2 = parts.join("/");
|
|
464
|
+
const url = mergePath(baseUrl, path2);
|
|
465
|
+
if (method === "url" || method === "path") {
|
|
466
|
+
let result = url;
|
|
467
|
+
if (opts.args[0]) {
|
|
468
|
+
if (opts.args[0].param) {
|
|
469
|
+
result = replaceUrlParam(url, opts.args[0].param);
|
|
470
|
+
}
|
|
471
|
+
if (opts.args[0].query) {
|
|
472
|
+
result = result + "?" + buildSearchParamsOption(opts.args[0].query).toString();
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
result = removeIndexString(result);
|
|
476
|
+
if (method === "url") {
|
|
477
|
+
return new URL(result);
|
|
478
|
+
}
|
|
479
|
+
return result.slice(baseUrl.replace(/\/+$/, "").length).replace(/^\/?/, "/");
|
|
480
|
+
}
|
|
481
|
+
if (method === "ws") {
|
|
482
|
+
const webSocketUrl = replaceUrlProtocol(
|
|
483
|
+
opts.args[0] && opts.args[0].param ? replaceUrlParam(url, opts.args[0].param) : url,
|
|
484
|
+
"ws"
|
|
485
|
+
);
|
|
486
|
+
const targetUrl = new URL(webSocketUrl);
|
|
487
|
+
const queryParams = opts.args[0]?.query;
|
|
488
|
+
if (queryParams) {
|
|
489
|
+
Object.entries(queryParams).forEach(([key, value]) => {
|
|
490
|
+
if (Array.isArray(value)) {
|
|
491
|
+
value.forEach((item) => targetUrl.searchParams.append(key, item));
|
|
492
|
+
} else {
|
|
493
|
+
targetUrl.searchParams.set(key, value);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
const establishWebSocket = (...args) => {
|
|
498
|
+
if (options?.webSocket !== void 0 && typeof options.webSocket === "function") {
|
|
499
|
+
return options.webSocket(...args);
|
|
500
|
+
}
|
|
501
|
+
return new WebSocket(...args);
|
|
502
|
+
};
|
|
503
|
+
return establishWebSocket(targetUrl.toString());
|
|
504
|
+
}
|
|
505
|
+
const req = new ClientRequestImpl(url, method, {
|
|
506
|
+
buildSearchParams: buildSearchParamsOption
|
|
507
|
+
});
|
|
508
|
+
if (method) {
|
|
509
|
+
options ??= {};
|
|
510
|
+
const reqOptions = { ...opts.args[1] };
|
|
511
|
+
const baseHeaders = options.headers;
|
|
512
|
+
const reqHeaders = reqOptions.headers;
|
|
513
|
+
if (baseHeaders && reqHeaders) {
|
|
514
|
+
reqOptions.headers = async () => ({
|
|
515
|
+
...typeof baseHeaders === "function" ? await baseHeaders() : baseHeaders,
|
|
516
|
+
...typeof reqHeaders === "function" ? await reqHeaders() : reqHeaders
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
const args = deepMerge(options, reqOptions);
|
|
520
|
+
return req.fetch(opts.args[0], args);
|
|
521
|
+
}
|
|
522
|
+
return req;
|
|
523
|
+
}, []);
|
|
524
|
+
|
|
525
|
+
// ../api/src/client.ts
|
|
526
|
+
var resolvePolicy = ({
|
|
527
|
+
headers = {},
|
|
528
|
+
credentials = "include"
|
|
529
|
+
}) => ({ headers, credentials });
|
|
530
|
+
var createApiClient = ({
|
|
531
|
+
baseUrl,
|
|
532
|
+
fetch: fetch2,
|
|
533
|
+
...policy
|
|
534
|
+
}) => {
|
|
535
|
+
const { headers, credentials } = resolvePolicy(policy);
|
|
536
|
+
return hc(baseUrl, {
|
|
537
|
+
headers,
|
|
538
|
+
init: { credentials },
|
|
539
|
+
// Spread rather than named. Under `exactOptionalPropertyTypes` hc's
|
|
540
|
+
// optional `fetch` does not accept an explicit `undefined`, so writing
|
|
541
|
+
// `fetch,` here is a TS2379 whenever a caller omits one.
|
|
542
|
+
...fetch2 && { fetch: fetch2 }
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/cli/lib/seed/fetch-seed.ts
|
|
547
|
+
var SEED_API_URL = process.env.AGENTS_INC_API_URL ?? "https://api.agentsinc.sh";
|
|
548
|
+
var SEED_USER_AGENT = "agents-inc-cli";
|
|
549
|
+
var store = createApiClient({
|
|
550
|
+
baseUrl: SEED_API_URL,
|
|
551
|
+
headers: { accept: "application/json", "user-agent": SEED_USER_AGENT },
|
|
552
|
+
credentials: "omit"
|
|
553
|
+
});
|
|
554
|
+
async function fetchSeedConfig(id) {
|
|
555
|
+
let response;
|
|
556
|
+
try {
|
|
557
|
+
response = await store.configs[":id"].$get({ param: { id: encodeURIComponent(id) } });
|
|
558
|
+
} catch {
|
|
559
|
+
return { ok: false, error: `Could not reach ${SEED_API_URL} \u2014 check your connection.` };
|
|
560
|
+
}
|
|
561
|
+
if (response.status === 404) {
|
|
562
|
+
return { ok: false, error: `No configuration found for id '${id}'.` };
|
|
563
|
+
}
|
|
564
|
+
if (!response.ok) {
|
|
565
|
+
return { ok: false, error: `Fetching configuration failed (HTTP ${response.status}).` };
|
|
566
|
+
}
|
|
567
|
+
let body;
|
|
568
|
+
try {
|
|
569
|
+
body = await response.json();
|
|
570
|
+
} catch {
|
|
571
|
+
return { ok: false, error: "The configuration store returned something that is not JSON." };
|
|
572
|
+
}
|
|
573
|
+
const parsed = seedPayloadSchema.safeParse(body);
|
|
574
|
+
if (!parsed.success) {
|
|
575
|
+
return {
|
|
576
|
+
ok: false,
|
|
577
|
+
error: `Configuration '${id}' is not in a format this version of the CLI can install. Shared ids are never migrated \u2014 re-share the configuration to mint a current one, or update the CLI if that id came from a newer version.`
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
return { ok: true, payload: parsed.data };
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
export {
|
|
584
|
+
registerExternalSkills,
|
|
585
|
+
writeExternalSkills,
|
|
586
|
+
readCarriedSkills,
|
|
587
|
+
SEED_API_URL,
|
|
588
|
+
SEED_USER_AGENT,
|
|
589
|
+
fetchSeedConfig
|
|
590
|
+
};
|
|
591
|
+
//# sourceMappingURL=chunk-XA4SWA2Z.js.map
|