poe-code 3.0.222 → 3.0.224
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/dist/cli/commands/configure-payload.js +72 -15
- package/dist/cli/commands/configure-payload.js.map +1 -1
- package/dist/cli/commands/configure.d.ts +2 -0
- package/dist/cli/commands/configure.js +55 -15
- package/dist/cli/commands/configure.js.map +1 -1
- package/dist/cli/commands/ensure-isolated-config.js +24 -3
- package/dist/cli/commands/ensure-isolated-config.js.map +1 -1
- package/dist/cli/commands/harness.js +45 -2
- package/dist/cli/commands/harness.js.map +1 -1
- package/dist/cli/commands/login.js +11 -2
- package/dist/cli/commands/login.js.map +1 -1
- package/dist/cli/commands/plan.js +52 -20
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/cli/commands/provider.d.ts +2 -0
- package/dist/cli/commands/provider.js +126 -3
- package/dist/cli/commands/provider.js.map +1 -1
- package/dist/cli/commands/shared.d.ts +16 -1
- package/dist/cli/commands/shared.js +141 -18
- package/dist/cli/commands/shared.js.map +1 -1
- package/dist/cli/commands/spawn.js +24 -3
- package/dist/cli/commands/spawn.js.map +1 -1
- package/dist/cli/commands/tasks-options.d.ts +9 -1
- package/dist/cli/commands/tasks-options.js +88 -5
- package/dist/cli/commands/tasks-options.js.map +1 -1
- package/dist/cli/commands/tasks.js +250 -7
- package/dist/cli/commands/tasks.js.map +1 -1
- package/dist/cli/constants.d.ts +1 -2
- package/dist/cli/constants.js +1 -13
- package/dist/cli/constants.js.map +1 -1
- package/dist/cli/container.js +22 -9
- package/dist/cli/container.js.map +1 -1
- package/dist/cli/environment.d.ts +1 -0
- package/dist/cli/environment.js +3 -1
- package/dist/cli/environment.js.map +1 -1
- package/dist/cli/options.d.ts +1 -1
- package/dist/cli/options.js +10 -1
- package/dist/cli/options.js.map +1 -1
- package/dist/cli/program.js +127 -13
- package/dist/cli/program.js.map +1 -1
- package/dist/cli/prompt-runner.js +4 -2
- package/dist/cli/prompt-runner.js.map +1 -1
- package/dist/cli/prompts.d.ts +3 -1
- package/dist/cli/prompts.js +13 -0
- package/dist/cli/prompts.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +47146 -26676
- package/dist/index.js.map +4 -4
- package/dist/providers/claude-code.js +4547 -1202
- package/dist/providers/claude-code.js.map +4 -4
- package/dist/providers/codex.js +4558 -1210
- package/dist/providers/codex.js.map +4 -4
- package/dist/providers/goose.js +4652 -1137
- package/dist/providers/goose.js.map +4 -4
- package/dist/providers/kimi.js +4548 -1203
- package/dist/providers/kimi.js.map +4 -4
- package/dist/providers/opencode.js +4543 -1198
- package/dist/providers/opencode.js.map +4 -4
- package/dist/providers/poe-agent.js +12879 -11508
- package/dist/providers/poe-agent.js.map +4 -4
- package/dist/providers/spawn-options.d.ts +1 -0
- package/dist/sdk/container.js +22 -9
- package/dist/sdk/container.js.map +1 -1
- package/dist/sdk/pipeline.js +1 -0
- package/dist/sdk/pipeline.js.map +1 -1
- package/dist/sdk/spawn-core.d.ts +2 -0
- package/dist/sdk/spawn-core.js +2 -1
- package/dist/sdk/spawn-core.js.map +1 -1
- package/dist/sdk/spawn.d.ts +6 -1
- package/dist/sdk/spawn.js +192 -4
- package/dist/sdk/spawn.js.map +1 -1
- package/dist/sdk/types.d.ts +10 -1
- package/dist/services/config.d.ts +4 -14
- package/dist/services/config.js +12 -54
- package/dist/services/config.js.map +1 -1
- package/dist/workflow-templates/maestro-turn.yml +159 -0
- package/package.json +6 -2
- package/packages/agent-skill-config/dist/bridge-active-skills.d.ts +23 -0
- package/packages/agent-skill-config/dist/bridge-active-skills.js +194 -0
- package/packages/agent-skill-config/dist/configs.d.ts +1 -1
- package/packages/agent-skill-config/dist/configs.js +5 -5
- package/packages/agent-skill-config/dist/git-exclude.d.ts +4 -0
- package/packages/agent-skill-config/dist/git-exclude.js +93 -0
- package/packages/agent-skill-config/dist/index.d.ts +5 -0
- package/packages/agent-skill-config/dist/index.js +3 -0
- package/packages/agent-skill-config/dist/resolve-skill-reference.d.ts +22 -0
- package/packages/agent-skill-config/dist/resolve-skill-reference.js +82 -0
- package/packages/design-system/dist/components/browser.d.ts +15 -0
- package/packages/design-system/dist/components/browser.js +26 -0
- package/packages/design-system/dist/explorer/index.d.ts +1 -1
- package/packages/design-system/dist/explorer/keymap.js +6 -3
- package/packages/design-system/dist/explorer/render/footer.js +14 -0
- package/packages/design-system/dist/explorer/runtime.js +11 -4
- package/packages/design-system/dist/explorer/state.d.ts +6 -1
- package/packages/design-system/dist/index.d.ts +2 -1
- package/packages/design-system/dist/index.js +1 -0
- package/packages/memory/dist/index.js +2564 -568
- package/packages/memory/dist/index.js.map +4 -4
- package/scripts/postinstall-sync-skills.mjs +15 -2
package/dist/services/config.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { createTimestamp, isNotFound, readFileIfExists } from "@poe-code/config-mutations";
|
|
3
|
-
import { defineScope, planConfigScope as sharedPlanConfigScope, readDocument, readMergedDocument, writeScope } from "@poe-code/poe-code-config";
|
|
3
|
+
import { defineScope, loadConfiguredServices, planConfigScope as sharedPlanConfigScope, readDocument, readMergedDocument, saveConfiguredService, unconfigureService, writeScope } from "@poe-code/poe-code-config";
|
|
4
4
|
import { parseNullablePluginConfigEntries } from "@poe-code/poe-agent";
|
|
5
5
|
import { superintendentConfigScope } from "@poe-code/superintendent";
|
|
6
|
+
export { loadConfiguredServices, saveConfiguredService, unconfigureService };
|
|
6
7
|
export const coreConfigScope = defineScope("core", {
|
|
7
8
|
apiKey: {
|
|
8
9
|
type: "string",
|
|
@@ -108,33 +109,6 @@ export async function deleteConfig(options) {
|
|
|
108
109
|
throw error;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
export async function loadConfiguredServices(options) {
|
|
112
|
-
const { fs, filePath, projectFilePath } = options;
|
|
113
|
-
await migrateLegacyCredentialsIfNeeded(fs, filePath);
|
|
114
|
-
await migrateServicesProviderIfNeeded(fs, filePath);
|
|
115
|
-
const document = await readMergedDocument(fs, filePath, projectFilePath);
|
|
116
|
-
return normalizeConfiguredServices(document[configuredServicesScope]);
|
|
117
|
-
}
|
|
118
|
-
export async function saveConfiguredService(options) {
|
|
119
|
-
const { fs, filePath, service, metadata } = options;
|
|
120
|
-
await migrateLegacyConfigIfNeeded(fs, filePath);
|
|
121
|
-
const document = await readDocument(fs, filePath);
|
|
122
|
-
const services = normalizeConfiguredServices(document[configuredServicesScope]);
|
|
123
|
-
services[service] = normalizeConfiguredServiceMetadata(metadata);
|
|
124
|
-
await writeScope(fs, filePath, configuredServicesScope, services);
|
|
125
|
-
}
|
|
126
|
-
export async function unconfigureService(options) {
|
|
127
|
-
const { fs, filePath, service } = options;
|
|
128
|
-
await migrateLegacyConfigIfNeeded(fs, filePath);
|
|
129
|
-
const document = await readDocument(fs, filePath);
|
|
130
|
-
const services = normalizeConfiguredServices(document[configuredServicesScope]);
|
|
131
|
-
if (!(service in services)) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
delete services[service];
|
|
135
|
-
await writeScope(fs, filePath, configuredServicesScope, services);
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
112
|
function normalizeConfiguredServiceMetadata(metadata) {
|
|
139
113
|
const seen = new Set();
|
|
140
114
|
const files = [];
|
|
@@ -147,30 +121,11 @@ function normalizeConfiguredServiceMetadata(metadata) {
|
|
|
147
121
|
seen.add(entry);
|
|
148
122
|
}
|
|
149
123
|
}
|
|
150
|
-
return {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (!isRecord(rawServices)) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
let needsMigration = false;
|
|
159
|
-
const migrated = {};
|
|
160
|
-
for (const [k, entry] of Object.entries(rawServices)) {
|
|
161
|
-
if (!isRecord(entry))
|
|
162
|
-
continue;
|
|
163
|
-
if (typeof entry.provider !== "string") {
|
|
164
|
-
needsMigration = true;
|
|
165
|
-
migrated[k] = { ...entry, provider: "poe" };
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
migrated[k] = entry;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
if (needsMigration) {
|
|
172
|
-
await writeScope(fs, filePath, configuredServicesScope, migrated);
|
|
173
|
-
}
|
|
124
|
+
return {
|
|
125
|
+
provider: metadata.provider,
|
|
126
|
+
...(metadata.apiShape ? { apiShape: metadata.apiShape } : {}),
|
|
127
|
+
files
|
|
128
|
+
};
|
|
174
129
|
}
|
|
175
130
|
async function migrateLegacyConfigIfNeeded(fs, filePath) {
|
|
176
131
|
await migrateLegacyCredentialsIfNeeded(fs, filePath);
|
|
@@ -259,8 +214,11 @@ function normalizeConfiguredServices(value) {
|
|
|
259
214
|
continue;
|
|
260
215
|
}
|
|
261
216
|
entries[key] = normalizeConfiguredServiceMetadata({
|
|
262
|
-
|
|
263
|
-
|
|
217
|
+
provider: typeof entry.provider === "string" ? entry.provider : "poe",
|
|
218
|
+
apiShape: typeof entry.apiShape === "string"
|
|
219
|
+
? entry.apiShape
|
|
220
|
+
: undefined,
|
|
221
|
+
files: Array.isArray(entry.files) ? entry.files : []
|
|
264
222
|
});
|
|
265
223
|
}
|
|
266
224
|
return entries;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EACL,WAAW,EACX,eAAe,IAAI,qBAAqB,EACxC,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACX,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EA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AAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AACtD,MAAM,cAAc,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
name: Maestro Turn
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types: [labeled, unlabeled, opened]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
issues: write
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: maestro-turn-${{ github.event.issue.number }}
|
|
13
|
+
cancel-in-progress: false
|
|
14
|
+
|
|
15
|
+
env:
|
|
16
|
+
MAESTRO_STATES: '["queued","agent-running","human-review","done","failed","archived"]'
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
tick:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- name: Preflight
|
|
23
|
+
env:
|
|
24
|
+
MAESTRO_GH_TOKEN: ${{ secrets.MAESTRO_GH_TOKEN }}
|
|
25
|
+
run: |
|
|
26
|
+
if [ -z "$MAESTRO_GH_TOKEN" ]; then
|
|
27
|
+
echo "::error::Missing required secret: MAESTRO_GH_TOKEN"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
with:
|
|
33
|
+
token: ${{ secrets.MAESTRO_GH_TOKEN }}
|
|
34
|
+
|
|
35
|
+
- uses: actions/setup-node@v4
|
|
36
|
+
with:
|
|
37
|
+
node-version: 20
|
|
38
|
+
|
|
39
|
+
- name: Install poe-code
|
|
40
|
+
run: npm install -g poe-code@latest
|
|
41
|
+
|
|
42
|
+
- name: Derive Maestro transition
|
|
43
|
+
id: transition
|
|
44
|
+
env:
|
|
45
|
+
GH_TOKEN: ${{ secrets.MAESTRO_GH_TOKEN }}
|
|
46
|
+
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
47
|
+
REPOSITORY: ${{ github.repository }}
|
|
48
|
+
run: |
|
|
49
|
+
set -euo pipefail
|
|
50
|
+
|
|
51
|
+
action="$(jq -r '.action' "$GITHUB_EVENT_PATH")"
|
|
52
|
+
event_label="$(jq -r '.label.name // ""' "$GITHUB_EVENT_PATH")"
|
|
53
|
+
mapfile -t known_states < <(jq -r '.[]' <<< "$MAESTRO_STATES")
|
|
54
|
+
|
|
55
|
+
is_known_state() {
|
|
56
|
+
local candidate="$1"
|
|
57
|
+
local state
|
|
58
|
+
for state in "${known_states[@]}"; do
|
|
59
|
+
if [ "$candidate" = "$state" ]; then
|
|
60
|
+
return 0
|
|
61
|
+
fi
|
|
62
|
+
done
|
|
63
|
+
return 1
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
skip_transition() {
|
|
67
|
+
local reason="$1"
|
|
68
|
+
{
|
|
69
|
+
echo "should_run=false"
|
|
70
|
+
echo "transition="
|
|
71
|
+
echo "reason=$reason"
|
|
72
|
+
} >> "$GITHUB_OUTPUT"
|
|
73
|
+
echo "Skipping Maestro tick: $reason"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
load_current_labels() {
|
|
77
|
+
mapfile -t current_labels < <(
|
|
78
|
+
gh api "repos/${REPOSITORY}/issues/${ISSUE_NUMBER}/labels" --jq '.[].name'
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
pick_current_state() {
|
|
83
|
+
local excluded="$1"
|
|
84
|
+
local state
|
|
85
|
+
local label
|
|
86
|
+
for state in "${known_states[@]}"; do
|
|
87
|
+
if [ "$state" = "$excluded" ]; then
|
|
88
|
+
continue
|
|
89
|
+
fi
|
|
90
|
+
for label in "${current_labels[@]}"; do
|
|
91
|
+
if [ "$label" = "$state" ]; then
|
|
92
|
+
printf '%s\n' "$state"
|
|
93
|
+
return 0
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
done
|
|
97
|
+
return 1
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
from=""
|
|
101
|
+
to=""
|
|
102
|
+
|
|
103
|
+
case "$action" in
|
|
104
|
+
opened)
|
|
105
|
+
from="*"
|
|
106
|
+
to="queued"
|
|
107
|
+
;;
|
|
108
|
+
labeled)
|
|
109
|
+
if ! is_known_state "$event_label"; then
|
|
110
|
+
skip_transition "label '$event_label' is not a Maestro state"
|
|
111
|
+
exit 0
|
|
112
|
+
fi
|
|
113
|
+
load_current_labels
|
|
114
|
+
to="$event_label"
|
|
115
|
+
from="$(pick_current_state "$to" || true)"
|
|
116
|
+
if [ -z "$from" ]; then
|
|
117
|
+
skip_transition "no previous Maestro state label found"
|
|
118
|
+
exit 0
|
|
119
|
+
fi
|
|
120
|
+
;;
|
|
121
|
+
unlabeled)
|
|
122
|
+
if ! is_known_state "$event_label"; then
|
|
123
|
+
skip_transition "label '$event_label' is not a Maestro state"
|
|
124
|
+
exit 0
|
|
125
|
+
fi
|
|
126
|
+
load_current_labels
|
|
127
|
+
from="$event_label"
|
|
128
|
+
to="$(pick_current_state "" || true)"
|
|
129
|
+
if [ -z "$to" ]; then
|
|
130
|
+
skip_transition "no current Maestro state label found"
|
|
131
|
+
exit 0
|
|
132
|
+
fi
|
|
133
|
+
;;
|
|
134
|
+
*)
|
|
135
|
+
skip_transition "unsupported issue action '$action'"
|
|
136
|
+
exit 0
|
|
137
|
+
;;
|
|
138
|
+
esac
|
|
139
|
+
|
|
140
|
+
transition="${from}:${to}"
|
|
141
|
+
{
|
|
142
|
+
echo "should_run=true"
|
|
143
|
+
echo "transition=$transition"
|
|
144
|
+
echo "reason="
|
|
145
|
+
} >> "$GITHUB_OUTPUT"
|
|
146
|
+
echo "Derived Maestro transition: $transition"
|
|
147
|
+
|
|
148
|
+
- name: Run Maestro tick
|
|
149
|
+
if: steps.transition.outputs.should_run == 'true'
|
|
150
|
+
env:
|
|
151
|
+
GH_TOKEN: ${{ secrets.MAESTRO_GH_TOKEN }}
|
|
152
|
+
GITHUB_TOKEN: ${{ secrets.MAESTRO_GH_TOKEN }}
|
|
153
|
+
MAESTRO_GH_TOKEN: ${{ secrets.MAESTRO_GH_TOKEN }}
|
|
154
|
+
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
|
155
|
+
TRANSITION: ${{ steps.transition.outputs.transition }}
|
|
156
|
+
run: |
|
|
157
|
+
poe-code maestro tick \
|
|
158
|
+
--task "$ISSUE_NUMBER" \
|
|
159
|
+
--transition "$TRANSITION"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poe-code",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.224",
|
|
4
4
|
"description": "CLI tool to configure Poe API for developer workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dev": "tsx --import ./scripts/register-template-loader.mjs src/index.ts",
|
|
29
29
|
"start": "node dist/bin.cjs",
|
|
30
30
|
"dev:bundle": "npm run build && node dist/bin.cjs",
|
|
31
|
-
"test": "turbo run test:unit --concurrency=
|
|
31
|
+
"test": "turbo run test:unit --concurrency=1 --",
|
|
32
32
|
"test:unit": "vitest run",
|
|
33
33
|
"typecheck": "npm run lint:types",
|
|
34
34
|
"check:semver": "node -e \"const semver=require('semver'); const pkg=require('./package.json'); if(!semver.valid(pkg.version)){console.error('Invalid semver version in package.json:', pkg.version); process.exit(1);}\"",
|
|
@@ -121,6 +121,7 @@
|
|
|
121
121
|
"parse-duration": "^2.1.5",
|
|
122
122
|
"semver": "^7.7.4",
|
|
123
123
|
"shell-quote": "^1.8.3",
|
|
124
|
+
"simple-git": "^3.36.0",
|
|
124
125
|
"smol-toml": "^1.6.0",
|
|
125
126
|
"tiktoken": "^1.0.22",
|
|
126
127
|
"turndown": "^7.2.4",
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
"@poe-code/acp-telemetry": "*",
|
|
133
134
|
"@poe-code/agent-child-process": "*",
|
|
134
135
|
"@poe-code/agent-defs": "*",
|
|
136
|
+
"@poe-code/agent-eval": "*",
|
|
135
137
|
"@poe-code/agent-harness": "*",
|
|
136
138
|
"@poe-code/agent-harness-tools": "*",
|
|
137
139
|
"@poe-code/agent-human-in-loop": "*",
|
|
@@ -149,6 +151,7 @@
|
|
|
149
151
|
"@poe-code/experiment-loop": "*",
|
|
150
152
|
"@poe-code/file-lock": "*",
|
|
151
153
|
"@poe-code/github-workflows": "*",
|
|
154
|
+
"@poe-code/maestro-tui": "*",
|
|
152
155
|
"@poe-code/markdown-reader": "*",
|
|
153
156
|
"@poe-code/memory": "*",
|
|
154
157
|
"@poe-code/pipeline": "*",
|
|
@@ -192,6 +195,7 @@
|
|
|
192
195
|
"tiny-stdio-mcp-test-server": "*",
|
|
193
196
|
"tokenfill": "*",
|
|
194
197
|
"toolcraft": "*",
|
|
198
|
+
"toolcraft-codemode": "*",
|
|
195
199
|
"toolcraft-openapi": "*",
|
|
196
200
|
"toolcraft-schema": "*",
|
|
197
201
|
"ts-morph": "^27.0.2",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface BridgeEntry {
|
|
2
|
+
ref: string;
|
|
3
|
+
sourcePath: string;
|
|
4
|
+
targetPath: string;
|
|
5
|
+
createdParents: string[];
|
|
6
|
+
}
|
|
7
|
+
export type BridgeWarningKind = "local-collision" | "global-collision" | "self-reference" | "intra-batch-collision";
|
|
8
|
+
export interface BridgeWarning {
|
|
9
|
+
kind: BridgeWarningKind;
|
|
10
|
+
ref: string;
|
|
11
|
+
sourcePath: string;
|
|
12
|
+
conflictingPath: string;
|
|
13
|
+
message: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BridgeManifest {
|
|
16
|
+
spawnAgentId: string;
|
|
17
|
+
cwd: string;
|
|
18
|
+
runId: string;
|
|
19
|
+
entries: BridgeEntry[];
|
|
20
|
+
warnings: BridgeWarning[];
|
|
21
|
+
}
|
|
22
|
+
export declare function bridgeActiveSkills(spawnAgentId: string, cwd: string, refs: string[], homeDir: string, runId: string): BridgeManifest;
|
|
23
|
+
export declare function cleanupBridgedSkills(manifest: BridgeManifest): void;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { getAgentConfig, resolveAgentSupport, resolveSkillDir, supportedAgents } from "./configs.js";
|
|
4
|
+
import { appendExcludeBlock, removeExcludeBlock } from "./git-exclude.js";
|
|
5
|
+
import { resolveSkillReference } from "./resolve-skill-reference.js";
|
|
6
|
+
function isNodeError(error) {
|
|
7
|
+
return error instanceof Error && "code" in error;
|
|
8
|
+
}
|
|
9
|
+
function pathExists(targetPath) {
|
|
10
|
+
try {
|
|
11
|
+
fs.statSync(targetPath);
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (isNodeError(error) && error.code === "ENOENT") {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function isDirectory(targetPath) {
|
|
22
|
+
try {
|
|
23
|
+
return fs.statSync(targetPath).isDirectory();
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (isNodeError(error) && error.code === "ENOENT") {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function formatResolutionFailureError(failures) {
|
|
33
|
+
const malformed = failures.filter((failure) => failure.kind === "malformed");
|
|
34
|
+
const unknownAgent = failures.filter((failure) => failure.kind === "unknown-agent");
|
|
35
|
+
const notFound = failures.filter((failure) => failure.kind === "not-found");
|
|
36
|
+
const lines = [
|
|
37
|
+
`Failed to bridge active skills: ${failures.length} skill reference(s) could not be resolved.`
|
|
38
|
+
];
|
|
39
|
+
if (malformed.length > 0) {
|
|
40
|
+
lines.push("", "Malformed skill references:");
|
|
41
|
+
for (const failure of malformed) {
|
|
42
|
+
lines.push(`- ${failure.ref}`);
|
|
43
|
+
}
|
|
44
|
+
lines.push('Expected syntax: "<name>" or "<agentId>/<name>".');
|
|
45
|
+
}
|
|
46
|
+
if (unknownAgent.length > 0) {
|
|
47
|
+
lines.push("", "Unknown agent references:");
|
|
48
|
+
for (const failure of unknownAgent) {
|
|
49
|
+
lines.push(`- ${failure.ref} (agent token: ${failure.agentInput})`);
|
|
50
|
+
}
|
|
51
|
+
lines.push(`Supported agents: ${supportedAgents.join(", ")}.`);
|
|
52
|
+
}
|
|
53
|
+
if (notFound.length > 0) {
|
|
54
|
+
lines.push("", "Not found skill references.");
|
|
55
|
+
for (const failure of notFound) {
|
|
56
|
+
lines.push(`- ${failure.ref}`);
|
|
57
|
+
lines.push(" searched paths:");
|
|
58
|
+
for (const searchedPath of failure.searchedPaths) {
|
|
59
|
+
lines.push(` - ${searchedPath}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return new Error(lines.join("\n"));
|
|
64
|
+
}
|
|
65
|
+
function copyDirectory(sourcePath, targetPath) {
|
|
66
|
+
fs.mkdirSync(targetPath, { recursive: true });
|
|
67
|
+
for (const dirent of fs.readdirSync(sourcePath, { withFileTypes: true })) {
|
|
68
|
+
const childSource = path.join(sourcePath, dirent.name);
|
|
69
|
+
const childTarget = path.join(targetPath, dirent.name);
|
|
70
|
+
if (dirent.isDirectory()) {
|
|
71
|
+
copyDirectory(childSource, childTarget);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (dirent.isFile()) {
|
|
75
|
+
fs.copyFileSync(childSource, childTarget);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function collectMissingParents(targetPath) {
|
|
80
|
+
const parents = [];
|
|
81
|
+
let current = path.dirname(targetPath);
|
|
82
|
+
while (!pathExists(current)) {
|
|
83
|
+
parents.push(current);
|
|
84
|
+
const parent = path.dirname(current);
|
|
85
|
+
if (parent === current) {
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
current = parent;
|
|
89
|
+
}
|
|
90
|
+
return parents.reverse();
|
|
91
|
+
}
|
|
92
|
+
function removeDirectoryIfEmpty(targetPath) {
|
|
93
|
+
try {
|
|
94
|
+
fs.rmdirSync(targetPath);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
if (isNodeError(error) &&
|
|
98
|
+
(error.code === "ENOENT" || error.code === "ENOTEMPTY" || error.code === "EEXIST")) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function removeTarget(targetPath) {
|
|
105
|
+
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
106
|
+
}
|
|
107
|
+
function toCwdRelative(cwd, targetPath) {
|
|
108
|
+
return path.relative(cwd, targetPath);
|
|
109
|
+
}
|
|
110
|
+
function warning(kind, ref, sourcePath, conflictingPath) {
|
|
111
|
+
const messages = {
|
|
112
|
+
"intra-batch-collision": `Skipping ${ref}: an earlier bridged skill already targets ${conflictingPath}.`,
|
|
113
|
+
"local-collision": `Skipping ${ref}: local skill already exists at ${conflictingPath}.`,
|
|
114
|
+
"global-collision": `Skipping ${ref}: global skill already exists at ${conflictingPath}.`,
|
|
115
|
+
"self-reference": `Skipping ${ref}: spawning agent already sees this native skill at ${conflictingPath}.`
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
kind,
|
|
119
|
+
ref,
|
|
120
|
+
sourcePath,
|
|
121
|
+
conflictingPath,
|
|
122
|
+
message: messages[kind]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export function bridgeActiveSkills(spawnAgentId, cwd, refs, homeDir, runId) {
|
|
126
|
+
const spawnConfig = getAgentConfig(spawnAgentId);
|
|
127
|
+
const spawnSupport = resolveAgentSupport(spawnAgentId);
|
|
128
|
+
if (!spawnConfig || spawnSupport.status !== "supported" || !spawnSupport.id) {
|
|
129
|
+
throw new Error(`Unsupported spawn agent "${spawnAgentId}". Supported agents: ${supportedAgents.join(", ")}.`);
|
|
130
|
+
}
|
|
131
|
+
const targetDir = resolveSkillDir(spawnConfig, "local", cwd);
|
|
132
|
+
const globalTargetDir = resolveSkillDir(spawnConfig, "global", cwd, homeDir);
|
|
133
|
+
const resolutions = refs.map((ref) => resolveSkillReference(ref, cwd, homeDir));
|
|
134
|
+
const failures = resolutions.filter((resolution) => resolution.kind !== "resolved");
|
|
135
|
+
if (failures.length > 0) {
|
|
136
|
+
throw formatResolutionFailureError(failures);
|
|
137
|
+
}
|
|
138
|
+
const sources = resolutions.map((source, index) => ({
|
|
139
|
+
ref: refs[index],
|
|
140
|
+
source: source,
|
|
141
|
+
targetPath: path.resolve(targetDir, source.name),
|
|
142
|
+
globalTargetPath: path.resolve(globalTargetDir, source.name)
|
|
143
|
+
}));
|
|
144
|
+
const entries = [];
|
|
145
|
+
const warnings = [];
|
|
146
|
+
const claimedTargets = new Set();
|
|
147
|
+
for (const item of sources) {
|
|
148
|
+
if (claimedTargets.has(item.targetPath)) {
|
|
149
|
+
warnings.push(warning("intra-batch-collision", item.ref, item.source.sourcePath, item.targetPath));
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
if (item.source.sourceAgentId === spawnSupport.id) {
|
|
153
|
+
warnings.push(warning("self-reference", item.ref, item.source.sourcePath, item.source.sourcePath));
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
if (pathExists(item.targetPath)) {
|
|
157
|
+
warnings.push(warning("local-collision", item.ref, item.source.sourcePath, item.targetPath));
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (isDirectory(item.globalTargetPath)) {
|
|
161
|
+
warnings.push(warning("global-collision", item.ref, item.source.sourcePath, item.globalTargetPath));
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
const createdParents = collectMissingParents(item.targetPath);
|
|
165
|
+
fs.mkdirSync(path.dirname(item.targetPath), { recursive: true });
|
|
166
|
+
copyDirectory(item.source.sourcePath, item.targetPath);
|
|
167
|
+
claimedTargets.add(item.targetPath);
|
|
168
|
+
entries.push({
|
|
169
|
+
ref: item.ref,
|
|
170
|
+
sourcePath: item.source.sourcePath,
|
|
171
|
+
targetPath: item.targetPath,
|
|
172
|
+
createdParents
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
if (entries.length > 0) {
|
|
176
|
+
appendExcludeBlock(cwd, runId, entries.map((entry) => toCwdRelative(cwd, entry.targetPath)));
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
spawnAgentId,
|
|
180
|
+
cwd,
|
|
181
|
+
runId,
|
|
182
|
+
entries,
|
|
183
|
+
warnings
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
export function cleanupBridgedSkills(manifest) {
|
|
187
|
+
for (const entry of manifest.entries) {
|
|
188
|
+
removeTarget(entry.targetPath);
|
|
189
|
+
for (const parent of [...entry.createdParents].reverse()) {
|
|
190
|
+
removeDirectoryIfEmpty(parent);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
removeExcludeBlock(manifest.cwd, manifest.runId);
|
|
194
|
+
}
|
|
@@ -13,4 +13,4 @@ export interface AgentSupportResult {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function resolveAgentSupport(input: string, registry?: Record<string, AgentSkillConfig>): AgentSupportResult;
|
|
15
15
|
export declare function getAgentConfig(agentId: string): AgentSkillConfig | undefined;
|
|
16
|
-
export declare function resolveSkillDir(config: AgentSkillConfig, scope: SkillScope, cwd: string): string;
|
|
16
|
+
export declare function resolveSkillDir(config: AgentSkillConfig, scope: SkillScope, cwd: string, homeDir?: string): string;
|
|
@@ -35,12 +35,12 @@ export function getAgentConfig(agentId) {
|
|
|
35
35
|
const support = resolveAgentSupport(agentId);
|
|
36
36
|
return support.status === "supported" ? support.config : undefined;
|
|
37
37
|
}
|
|
38
|
-
function expandHome(targetPath) {
|
|
38
|
+
function expandHome(targetPath, homeDir = os.homedir()) {
|
|
39
39
|
if (!targetPath?.startsWith("~")) {
|
|
40
40
|
return targetPath;
|
|
41
41
|
}
|
|
42
42
|
if (targetPath === "~") {
|
|
43
|
-
return
|
|
43
|
+
return homeDir;
|
|
44
44
|
}
|
|
45
45
|
// Handle ~./ -> ~/.
|
|
46
46
|
if (targetPath.startsWith("~./")) {
|
|
@@ -56,11 +56,11 @@ function expandHome(targetPath) {
|
|
|
56
56
|
remainder = remainder.slice(1);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
return remainder.length === 0 ?
|
|
59
|
+
return remainder.length === 0 ? homeDir : path.join(homeDir, remainder);
|
|
60
60
|
}
|
|
61
|
-
export function resolveSkillDir(config, scope, cwd) {
|
|
61
|
+
export function resolveSkillDir(config, scope, cwd, homeDir) {
|
|
62
62
|
if (scope === "global") {
|
|
63
|
-
return path.resolve(expandHome(config.globalSkillDir));
|
|
63
|
+
return path.resolve(expandHome(config.globalSkillDir, homeDir));
|
|
64
64
|
}
|
|
65
65
|
return path.resolve(cwd, config.localSkillDir);
|
|
66
66
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type GitDirRunner = (cwd: string) => string | undefined;
|
|
2
|
+
export declare function setGitDirRunnerForTest(runner: GitDirRunner): () => void;
|
|
3
|
+
export declare function appendExcludeBlock(cwd: string, runId: string, entries: string[]): void;
|
|
4
|
+
export declare function removeExcludeBlock(cwd: string, runId: string): void;
|