@aexol/opencode-wizard 0.3.2 → 0.3.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/README.md +4 -0
- package/dist/graphql-operations.d.ts +4 -0
- package/dist/graphql-operations.js +225 -0
- package/dist/graphql-operations.js.map +1 -0
- package/dist/plugin-tools.d.ts +64 -0
- package/dist/plugin-tools.js +57 -0
- package/dist/plugin-tools.js.map +1 -0
- package/dist/published-skills-system-note.d.ts +9 -0
- package/dist/published-skills-system-note.js +34 -0
- package/dist/published-skills-system-note.js.map +1 -0
- package/dist/published-skills-transform.d.ts +161 -0
- package/dist/published-skills-transform.js +238 -0
- package/dist/published-skills-transform.js.map +1 -0
- package/dist/server/auth-flow.d.ts +10 -0
- package/dist/server/auth-flow.js +215 -0
- package/dist/server/auth-flow.js.map +1 -0
- package/dist/server/auth-store.d.ts +19 -0
- package/dist/server/auth-store.js +177 -0
- package/dist/server/auth-store.js.map +1 -0
- package/dist/server/client.d.ts +51 -0
- package/dist/server/client.js +244 -0
- package/dist/server/client.js.map +1 -0
- package/dist/server/config.d.ts +2 -0
- package/dist/server/config.js +82 -0
- package/dist/server/config.js.map +1 -0
- package/dist/server/constants.d.ts +26 -0
- package/dist/server/constants.js +32 -0
- package/dist/server/constants.js.map +1 -0
- package/dist/server/path-utils.d.ts +2 -0
- package/dist/server/path-utils.js +8 -0
- package/dist/server/path-utils.js.map +1 -0
- package/dist/server/presence.d.ts +14 -0
- package/dist/server/presence.js +68 -0
- package/dist/server/presence.js.map +1 -0
- package/dist/server/runtime.d.ts +32 -0
- package/dist/server/runtime.js +1110 -0
- package/dist/server/runtime.js.map +1 -0
- package/dist/server/status.d.ts +27 -0
- package/dist/server/status.js +224 -0
- package/dist/server/status.js.map +1 -0
- package/dist/server/types.d.ts +321 -0
- package/dist/server/types.js +2 -0
- package/dist/server/types.js.map +1 -0
- package/dist/server/workspace.d.ts +15 -0
- package/dist/server/workspace.js +126 -0
- package/dist/server/workspace.js.map +1 -0
- package/dist/server.d.ts +4 -304
- package/dist/server.js +4 -2489
- package/dist/server.js.map +1 -1
- package/dist/smoke-published-skills.js +11 -9
- package/dist/smoke-published-skills.js.map +1 -1
- package/dist/tui/components/common.d.ts +15 -0
- package/dist/tui/components/common.js +81 -0
- package/dist/tui/components/common.js.map +1 -0
- package/dist/tui/components/preference-action-notice-row.d.ts +5 -0
- package/dist/tui/components/preference-action-notice-row.js +17 -0
- package/dist/tui/components/preference-action-notice-row.js.map +1 -0
- package/dist/tui/components/skill-catalog-row.d.ts +8 -0
- package/dist/tui/components/skill-catalog-row.js +124 -0
- package/dist/tui/components/skill-catalog-row.js.map +1 -0
- package/dist/tui/components/status-content.d.ts +14 -0
- package/dist/tui/components/status-content.js +131 -0
- package/dist/tui/components/status-content.js.map +1 -0
- package/dist/tui/components/wizard-skills-dialog-content.d.ts +9 -0
- package/dist/tui/components/wizard-skills-dialog-content.js +219 -0
- package/dist/tui/components/wizard-skills-dialog-content.js.map +1 -0
- package/dist/tui/components/wizard-skills-dialog.d.ts +7 -0
- package/dist/tui/components/wizard-skills-dialog.js +156 -0
- package/dist/tui/components/wizard-skills-dialog.js.map +1 -0
- package/dist/tui/constants.d.ts +8 -0
- package/dist/tui/constants.js +9 -0
- package/dist/tui/constants.js.map +1 -0
- package/dist/tui/formatting.d.ts +8 -0
- package/dist/tui/formatting.js +45 -0
- package/dist/tui/formatting.js.map +1 -0
- package/dist/tui/plugin.d.ts +2 -0
- package/dist/tui/plugin.js +26 -0
- package/dist/tui/plugin.js.map +1 -0
- package/dist/tui/rendering.d.ts +2 -0
- package/dist/tui/rendering.js +8 -0
- package/dist/tui/rendering.js.map +1 -0
- package/dist/tui/skill-helpers.d.ts +13 -0
- package/dist/tui/skill-helpers.js +49 -0
- package/dist/tui/skill-helpers.js.map +1 -0
- package/dist/tui/slots.d.ts +2 -0
- package/dist/tui/slots.js +56 -0
- package/dist/tui/slots.js.map +1 -0
- package/dist/tui/status.d.ts +2 -0
- package/dist/tui/status.js +21 -0
- package/dist/tui/status.js.map +1 -0
- package/dist/tui/types.d.ts +75 -0
- package/dist/tui/types.js +2 -0
- package/dist/tui/types.js.map +1 -0
- package/dist/tui.d.ts +1 -44
- package/dist/tui.js +2 -870
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import type { ToolFactory } from '../plugin-tools.js';
|
|
2
|
+
import type { PublishedSkillDetail, PublishedSkillSummary, PublishedSkillsSuccessState } from '../published-skills-transform.js';
|
|
3
|
+
import type { NativeSkillsUrlCompatibility } from './constants.js';
|
|
4
|
+
export type ResolvedConfig = {
|
|
5
|
+
backendOrigin: string;
|
|
6
|
+
graphqlUrl: string;
|
|
7
|
+
authSessionUrl: string;
|
|
8
|
+
presenceUrl: string;
|
|
9
|
+
actionsUrl: string;
|
|
10
|
+
configuredWorkspaceSlug: string | null;
|
|
11
|
+
fallbackWorkspaceSlug: string;
|
|
12
|
+
rootSkillSeedPath: string;
|
|
13
|
+
authStatePath: string;
|
|
14
|
+
};
|
|
15
|
+
export type WorkspaceResolution = {
|
|
16
|
+
requestedDirectory: string;
|
|
17
|
+
repositoryRoot: string;
|
|
18
|
+
repositoryUrl: string | null;
|
|
19
|
+
workspaceSlug?: string | null;
|
|
20
|
+
workspaceSlugSource?: 'configured' | 'learned' | 'backend' | 'fallback' | 'repositoryUrl' | 'placeholder';
|
|
21
|
+
fallbackWorkspaceSlug: string | null;
|
|
22
|
+
directoryPath: string;
|
|
23
|
+
cacheKey: string;
|
|
24
|
+
};
|
|
25
|
+
export type WorkspaceResolutionOutput = {
|
|
26
|
+
requestedDirectory: string;
|
|
27
|
+
repositoryRoot: string;
|
|
28
|
+
repositoryUrl: string | null;
|
|
29
|
+
workspaceSlug?: string | null;
|
|
30
|
+
workspaceSlugSource?: WorkspaceResolution['workspaceSlugSource'];
|
|
31
|
+
fallbackWorkspaceSlug: string | null;
|
|
32
|
+
directoryPath: string;
|
|
33
|
+
};
|
|
34
|
+
export type StoredWorkspaceSlugMapping = {
|
|
35
|
+
repositoryUrl: string | null;
|
|
36
|
+
repositoryRoot: string | null;
|
|
37
|
+
workspaceSlug: string;
|
|
38
|
+
updatedAt: string;
|
|
39
|
+
};
|
|
40
|
+
export type PublishedSkillCatalogResponse = {
|
|
41
|
+
pluginPublishedSkills: PublishedSkillCatalogPayload;
|
|
42
|
+
};
|
|
43
|
+
export type PublishedSkillDetailResponse = {
|
|
44
|
+
pluginPublishedSkillVersionArtifact: PublishedSkillArtifactDetailPayload | null;
|
|
45
|
+
};
|
|
46
|
+
export type PublishedSkillCatalogPayload = {
|
|
47
|
+
workspace: {
|
|
48
|
+
id: string;
|
|
49
|
+
slug: string;
|
|
50
|
+
name: string;
|
|
51
|
+
repositoryUrl?: string | null;
|
|
52
|
+
defaultBranch?: string | null;
|
|
53
|
+
status: string;
|
|
54
|
+
} | null;
|
|
55
|
+
directoryPath: string;
|
|
56
|
+
skills: PublishedSkillCatalogItem[];
|
|
57
|
+
catalogSkills: PublishedSkillInstallableCatalogItem[];
|
|
58
|
+
userPreferences: PublishedSkillUserPreferences;
|
|
59
|
+
};
|
|
60
|
+
export type PublishedSkillUserPreferences = {
|
|
61
|
+
scopeKey: string;
|
|
62
|
+
userKey: string;
|
|
63
|
+
ignoredSkills: PublishedSkillCatalogItem[];
|
|
64
|
+
};
|
|
65
|
+
export type PublishedSkillPreferenceScope = 'GLOBAL' | 'WORKSPACE';
|
|
66
|
+
export type CreateOrUpdateSkillFromMarkdownResponse = {
|
|
67
|
+
createOrUpdateSkillFromMarkdown: {
|
|
68
|
+
success: boolean;
|
|
69
|
+
skillSlug: string;
|
|
70
|
+
skillVersionId: string | null;
|
|
71
|
+
errors: string[];
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
export type SetPublishedSkillPreferenceResponse = {
|
|
75
|
+
setPublishedSkillPreference: PublishedSkillUserPreferences;
|
|
76
|
+
};
|
|
77
|
+
export type PublishedSkillInstallableCatalogItem = Pick<PublishedSkillCatalogItem, 'skill' | 'skillVersion' | 'publishedArtifact'>;
|
|
78
|
+
export type PublishedSkillCatalogItem = {
|
|
79
|
+
assignmentSource: string;
|
|
80
|
+
assignmentType: string;
|
|
81
|
+
scopePath: string;
|
|
82
|
+
includeChildren?: boolean | null;
|
|
83
|
+
skill: {
|
|
84
|
+
id: string;
|
|
85
|
+
slug: string;
|
|
86
|
+
name: string;
|
|
87
|
+
summary?: string | null;
|
|
88
|
+
whenToUse?: string | null;
|
|
89
|
+
status: string;
|
|
90
|
+
installPolicy: PublishedSkillInstallPolicy;
|
|
91
|
+
tags: PublishedSkillTag[];
|
|
92
|
+
};
|
|
93
|
+
skillVersion: {
|
|
94
|
+
id: string;
|
|
95
|
+
version: string;
|
|
96
|
+
title?: string | null;
|
|
97
|
+
summary?: string | null;
|
|
98
|
+
status: string;
|
|
99
|
+
};
|
|
100
|
+
publishedArtifact: {
|
|
101
|
+
id: string;
|
|
102
|
+
frontmatterName: string;
|
|
103
|
+
frontmatterDescription: string;
|
|
104
|
+
checksum: string;
|
|
105
|
+
publishedAt: string;
|
|
106
|
+
fileCount: number;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export type PublishedSkillArtifactFilePayload = {
|
|
110
|
+
id: string;
|
|
111
|
+
relativePath: string;
|
|
112
|
+
contentType: string;
|
|
113
|
+
content: string;
|
|
114
|
+
checksum: string;
|
|
115
|
+
size: number;
|
|
116
|
+
sortOrder: number;
|
|
117
|
+
};
|
|
118
|
+
export type PublishedSkillFacet = {
|
|
119
|
+
id: string;
|
|
120
|
+
slug: string;
|
|
121
|
+
label: string;
|
|
122
|
+
description?: string | null;
|
|
123
|
+
};
|
|
124
|
+
export type PublishedSkillTag = {
|
|
125
|
+
id: string;
|
|
126
|
+
slug: string;
|
|
127
|
+
label: string;
|
|
128
|
+
description?: string | null;
|
|
129
|
+
facet?: PublishedSkillFacet | null;
|
|
130
|
+
};
|
|
131
|
+
export type PublishedSkillInstallPolicy = 'GLOBAL_CONTEXT' | 'PROJECT_INSTALLABLE';
|
|
132
|
+
export type PublishedSkillDetailItem = PublishedSkillCatalogItem & {
|
|
133
|
+
publishedArtifact: PublishedSkillCatalogItem['publishedArtifact'] & {
|
|
134
|
+
markdownBody: string;
|
|
135
|
+
renderedContent: string;
|
|
136
|
+
files: PublishedSkillArtifactFilePayload[];
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
export type PublishedSkillArtifactDetailPayload = PublishedSkillCatalogItem['publishedArtifact'] & {
|
|
140
|
+
markdownBody: string;
|
|
141
|
+
renderedContent: string;
|
|
142
|
+
files: PublishedSkillArtifactFilePayload[];
|
|
143
|
+
};
|
|
144
|
+
export type PublishedSkillArtifactDetailPurpose = 'TOOL_FETCH';
|
|
145
|
+
export type GraphQLErrorItem = {
|
|
146
|
+
message: string;
|
|
147
|
+
};
|
|
148
|
+
export type GraphQLResponse<TData> = {
|
|
149
|
+
data?: TData;
|
|
150
|
+
errors?: GraphQLErrorItem[];
|
|
151
|
+
};
|
|
152
|
+
export type AuthState = {
|
|
153
|
+
pluginId: string;
|
|
154
|
+
sessionToken: string;
|
|
155
|
+
expiresAt: string;
|
|
156
|
+
authenticatedAt: string;
|
|
157
|
+
userId: string;
|
|
158
|
+
email: string;
|
|
159
|
+
role?: 'ADMIN' | 'EDITOR' | null;
|
|
160
|
+
};
|
|
161
|
+
export type PresenceEventType = 'START' | 'STOP';
|
|
162
|
+
export type PluginActionEventType = PresenceEventType | 'FETCH_SUCCESS' | 'FETCH_FAILED' | 'LOGIN_SUCCESS' | 'LOGIN_FAILED' | 'PREFERENCE_SUCCESS' | 'PREFERENCE_FAILED';
|
|
163
|
+
export type LoginBootstrapTrigger = 'fetch' | 'status';
|
|
164
|
+
export type LoginBootstrapSnapshot = {
|
|
165
|
+
status: 'idle' | 'starting' | 'pending' | 'authenticated' | 'failed';
|
|
166
|
+
trigger: LoginBootstrapTrigger | null;
|
|
167
|
+
startedAt: string | null;
|
|
168
|
+
expiresAt: string | null;
|
|
169
|
+
browserUrl: string | null;
|
|
170
|
+
browserOpenError: string | null;
|
|
171
|
+
email: string | null;
|
|
172
|
+
message: string | null;
|
|
173
|
+
};
|
|
174
|
+
export type StatusPathLoginBootstrap = {
|
|
175
|
+
promise: Promise<AuthState> | null;
|
|
176
|
+
status: 'idle' | 'pending' | 'authenticated' | 'failed';
|
|
177
|
+
message: string | null;
|
|
178
|
+
failedAt: number | null;
|
|
179
|
+
};
|
|
180
|
+
export type FetchResult = {
|
|
181
|
+
ok: true;
|
|
182
|
+
status: 'ready';
|
|
183
|
+
authMode: 'session';
|
|
184
|
+
payload: PublishedSkillCatalogPayload;
|
|
185
|
+
fetchedAt: string;
|
|
186
|
+
source: 'network' | 'cache';
|
|
187
|
+
} | {
|
|
188
|
+
ok: false;
|
|
189
|
+
status: 'missing_auth' | 'request_failed';
|
|
190
|
+
authMode: 'missing' | 'session';
|
|
191
|
+
message: string;
|
|
192
|
+
fetchedAt: string;
|
|
193
|
+
source: 'network' | 'cache';
|
|
194
|
+
};
|
|
195
|
+
export type CacheEntry = {
|
|
196
|
+
result: FetchResult;
|
|
197
|
+
expiresAt: number;
|
|
198
|
+
};
|
|
199
|
+
export type DetailCacheEntry = {
|
|
200
|
+
artifact: PublishedSkillArtifactDetailPayload;
|
|
201
|
+
expiresAt: number;
|
|
202
|
+
};
|
|
203
|
+
export type PublishedSkillPreferenceAction = 'install' | 'uninstall' | 'ignore' | 'unignore';
|
|
204
|
+
export type OpencodePluginModule = {
|
|
205
|
+
tool: ToolFactory;
|
|
206
|
+
};
|
|
207
|
+
export type OpencodePluginServerInput = {
|
|
208
|
+
worktree: string;
|
|
209
|
+
directory: string;
|
|
210
|
+
};
|
|
211
|
+
export type OpencodePluginSystemTransformOutput = {
|
|
212
|
+
system: string[];
|
|
213
|
+
};
|
|
214
|
+
export type OpencodePluginServer = (input: OpencodePluginServerInput) => Promise<{
|
|
215
|
+
tool: Record<string, unknown>;
|
|
216
|
+
'experimental.chat.system.transform': (hookInput: unknown, output: OpencodePluginSystemTransformOutput) => Promise<void>;
|
|
217
|
+
}>;
|
|
218
|
+
export type PublishedSkillsResult = {
|
|
219
|
+
directoryPath: string;
|
|
220
|
+
workspaceResolution: WorkspaceResolution;
|
|
221
|
+
fetchResult: FetchResult;
|
|
222
|
+
};
|
|
223
|
+
export type PublishedSkillsIgnoreState = {
|
|
224
|
+
scopeKey: string;
|
|
225
|
+
userKey: string;
|
|
226
|
+
ignoredSkillSlugs: string[];
|
|
227
|
+
installedGlobalSkillSlugs: string[];
|
|
228
|
+
installedWorkspaceSkillSlugs: string[];
|
|
229
|
+
};
|
|
230
|
+
export type PublishedSkillPreferenceCacheContext = {
|
|
231
|
+
userKey: string;
|
|
232
|
+
preferenceVersion: number;
|
|
233
|
+
};
|
|
234
|
+
export type FilteredPublishedSkillsResult = PublishedSkillsResult & {
|
|
235
|
+
ignoreState: PublishedSkillsIgnoreState;
|
|
236
|
+
ignoredSkills: PublishedSkillSummary[];
|
|
237
|
+
};
|
|
238
|
+
export type PublishedSkillDetailResult = {
|
|
239
|
+
ok: true;
|
|
240
|
+
detail: PublishedSkillDetail;
|
|
241
|
+
} | {
|
|
242
|
+
ok: false;
|
|
243
|
+
status: 'not_found' | 'missing_auth' | 'request_failed';
|
|
244
|
+
output: string;
|
|
245
|
+
metadata: Record<string, string>;
|
|
246
|
+
};
|
|
247
|
+
export type PluginAuthStateSummary = {
|
|
248
|
+
status: 'missing' | 'authenticated';
|
|
249
|
+
email: string | null;
|
|
250
|
+
userId: string | null;
|
|
251
|
+
role: 'ADMIN' | 'EDITOR' | null;
|
|
252
|
+
authenticatedAt: string | null;
|
|
253
|
+
expiresAt: string | null;
|
|
254
|
+
};
|
|
255
|
+
export type PluginStatusSnapshot = {
|
|
256
|
+
pluginId: string;
|
|
257
|
+
runtimeMode: 'tool_fetch_only';
|
|
258
|
+
nativeSkillsUrlCompatibility: NativeSkillsUrlCompatibility;
|
|
259
|
+
backendOrigin: string;
|
|
260
|
+
graphqlUrl: string;
|
|
261
|
+
fallbackWorkspaceSlug: string;
|
|
262
|
+
workspaceResolution: WorkspaceResolutionOutput;
|
|
263
|
+
rootSkillSeedPath: string;
|
|
264
|
+
authStatePath: string;
|
|
265
|
+
authState: PluginAuthStateSummary;
|
|
266
|
+
status: FetchResult['status'];
|
|
267
|
+
authMode: FetchResult['authMode'];
|
|
268
|
+
fetchedAt: string;
|
|
269
|
+
source: FetchResult['source'];
|
|
270
|
+
availableTools: string[];
|
|
271
|
+
message: string | null;
|
|
272
|
+
catalog: PublishedSkillsSuccessState | null;
|
|
273
|
+
installableCatalog: {
|
|
274
|
+
count: number;
|
|
275
|
+
skills: PublishedSkillSummary[];
|
|
276
|
+
} | null;
|
|
277
|
+
ignoredPublishedSkills: {
|
|
278
|
+
scopeKey: string;
|
|
279
|
+
userKey: string;
|
|
280
|
+
count: number;
|
|
281
|
+
skills: PublishedSkillSummary[];
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
export type AiFacingIgnoredPublishedSkillsSummary = {
|
|
285
|
+
scopeKey: string;
|
|
286
|
+
count: number;
|
|
287
|
+
};
|
|
288
|
+
export type AiFacingPluginStatusSnapshot = Omit<PluginStatusSnapshot, 'ignoredPublishedSkills' | 'installableCatalog'> & {
|
|
289
|
+
ignoredPublishedSkills: AiFacingIgnoredPublishedSkillsSummary;
|
|
290
|
+
};
|
|
291
|
+
export type OidcDiscoveryDocument = {
|
|
292
|
+
authorization_endpoint: string;
|
|
293
|
+
};
|
|
294
|
+
export type PluginSessionResponse = {
|
|
295
|
+
success: true;
|
|
296
|
+
session: {
|
|
297
|
+
jwtToken: string;
|
|
298
|
+
expiresAt: string;
|
|
299
|
+
user: {
|
|
300
|
+
id: string;
|
|
301
|
+
email: string;
|
|
302
|
+
role?: 'ADMIN' | 'EDITOR';
|
|
303
|
+
};
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
export type OidcCallbackPayload = {
|
|
307
|
+
status: 'success';
|
|
308
|
+
code: string;
|
|
309
|
+
state: string;
|
|
310
|
+
} | {
|
|
311
|
+
status: 'error';
|
|
312
|
+
message: string;
|
|
313
|
+
};
|
|
314
|
+
export type OidcLoginStart = {
|
|
315
|
+
browserUrl: string;
|
|
316
|
+
expiresAt: string;
|
|
317
|
+
codeVerifier: string;
|
|
318
|
+
expectedState: string;
|
|
319
|
+
callbackPromise: Promise<OidcCallbackPayload>;
|
|
320
|
+
closeCallbackServer: () => Promise<void>;
|
|
321
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/server/types.ts"],"sourcesContent":["import type { ToolFactory } from '../plugin-tools.js';\nimport type { PublishedSkillDetail, PublishedSkillSummary, PublishedSkillsSuccessState } from '../published-skills-transform.js';\nimport type { NativeSkillsUrlCompatibility } from './constants.js';\n\nexport type ResolvedConfig = {\n backendOrigin: string;\n graphqlUrl: string;\n authSessionUrl: string;\n presenceUrl: string;\n actionsUrl: string;\n configuredWorkspaceSlug: string | null;\n fallbackWorkspaceSlug: string;\n rootSkillSeedPath: string;\n authStatePath: string;\n};\n\nexport type WorkspaceResolution = {\n requestedDirectory: string;\n repositoryRoot: string;\n repositoryUrl: string | null;\n workspaceSlug?: string | null;\n workspaceSlugSource?: 'configured' | 'learned' | 'backend' | 'fallback' | 'repositoryUrl' | 'placeholder';\n fallbackWorkspaceSlug: string | null;\n directoryPath: string;\n cacheKey: string;\n};\n\nexport type WorkspaceResolutionOutput = {\n requestedDirectory: string;\n repositoryRoot: string;\n repositoryUrl: string | null;\n workspaceSlug?: string | null;\n workspaceSlugSource?: WorkspaceResolution['workspaceSlugSource'];\n fallbackWorkspaceSlug: string | null;\n directoryPath: string;\n};\n\nexport type StoredWorkspaceSlugMapping = {\n repositoryUrl: string | null;\n repositoryRoot: string | null;\n workspaceSlug: string;\n updatedAt: string;\n};\n\nexport type PublishedSkillCatalogResponse = {\n pluginPublishedSkills: PublishedSkillCatalogPayload;\n};\n\nexport type PublishedSkillDetailResponse = {\n pluginPublishedSkillVersionArtifact: PublishedSkillArtifactDetailPayload | null;\n};\n\nexport type PublishedSkillCatalogPayload = {\n workspace: {\n id: string;\n slug: string;\n name: string;\n repositoryUrl?: string | null;\n defaultBranch?: string | null;\n status: string;\n } | null;\n directoryPath: string;\n skills: PublishedSkillCatalogItem[];\n catalogSkills: PublishedSkillInstallableCatalogItem[];\n userPreferences: PublishedSkillUserPreferences;\n};\n\nexport type PublishedSkillUserPreferences = {\n scopeKey: string;\n userKey: string;\n ignoredSkills: PublishedSkillCatalogItem[];\n};\n\nexport type PublishedSkillPreferenceScope = 'GLOBAL' | 'WORKSPACE';\n\nexport type CreateOrUpdateSkillFromMarkdownResponse = {\n createOrUpdateSkillFromMarkdown: {\n success: boolean;\n skillSlug: string;\n skillVersionId: string | null;\n errors: string[];\n };\n};\n\nexport type SetPublishedSkillPreferenceResponse = {\n setPublishedSkillPreference: PublishedSkillUserPreferences;\n};\n\nexport type PublishedSkillInstallableCatalogItem = Pick<\n PublishedSkillCatalogItem,\n 'skill' | 'skillVersion' | 'publishedArtifact'\n>;\n\nexport type PublishedSkillCatalogItem = {\n assignmentSource: string;\n assignmentType: string;\n scopePath: string;\n includeChildren?: boolean | null;\n skill: {\n id: string;\n slug: string;\n name: string;\n summary?: string | null;\n whenToUse?: string | null;\n status: string;\n installPolicy: PublishedSkillInstallPolicy;\n tags: PublishedSkillTag[];\n };\n skillVersion: {\n id: string;\n version: string;\n title?: string | null;\n summary?: string | null;\n status: string;\n };\n publishedArtifact: {\n id: string;\n frontmatterName: string;\n frontmatterDescription: string;\n checksum: string;\n publishedAt: string;\n fileCount: number;\n };\n};\n\nexport type PublishedSkillArtifactFilePayload = {\n id: string;\n relativePath: string;\n contentType: string;\n content: string;\n checksum: string;\n size: number;\n sortOrder: number;\n};\n\nexport type PublishedSkillFacet = {\n id: string;\n slug: string;\n label: string;\n description?: string | null;\n};\n\nexport type PublishedSkillTag = {\n id: string;\n slug: string;\n label: string;\n description?: string | null;\n facet?: PublishedSkillFacet | null;\n};\n\nexport type PublishedSkillInstallPolicy = 'GLOBAL_CONTEXT' | 'PROJECT_INSTALLABLE';\n\nexport type PublishedSkillDetailItem = PublishedSkillCatalogItem & {\n publishedArtifact: PublishedSkillCatalogItem['publishedArtifact'] & {\n markdownBody: string;\n renderedContent: string;\n files: PublishedSkillArtifactFilePayload[];\n };\n};\n\nexport type PublishedSkillArtifactDetailPayload = PublishedSkillCatalogItem['publishedArtifact'] & {\n markdownBody: string;\n renderedContent: string;\n files: PublishedSkillArtifactFilePayload[];\n};\n\nexport type PublishedSkillArtifactDetailPurpose = 'TOOL_FETCH';\n\nexport type GraphQLErrorItem = {\n message: string;\n};\n\nexport type GraphQLResponse<TData> = {\n data?: TData;\n errors?: GraphQLErrorItem[];\n};\n\nexport type AuthState = {\n pluginId: string;\n sessionToken: string;\n expiresAt: string;\n authenticatedAt: string;\n userId: string;\n email: string;\n role?: 'ADMIN' | 'EDITOR' | null;\n};\n\nexport type PresenceEventType = 'START' | 'STOP';\n\nexport type PluginActionEventType =\n | PresenceEventType\n | 'FETCH_SUCCESS'\n | 'FETCH_FAILED'\n | 'LOGIN_SUCCESS'\n | 'LOGIN_FAILED'\n | 'PREFERENCE_SUCCESS'\n | 'PREFERENCE_FAILED';\n\nexport type LoginBootstrapTrigger = 'fetch' | 'status';\n\nexport type LoginBootstrapSnapshot = {\n status: 'idle' | 'starting' | 'pending' | 'authenticated' | 'failed';\n trigger: LoginBootstrapTrigger | null;\n startedAt: string | null;\n expiresAt: string | null;\n browserUrl: string | null;\n browserOpenError: string | null;\n email: string | null;\n message: string | null;\n};\n\nexport type StatusPathLoginBootstrap = {\n promise: Promise<AuthState> | null;\n status: 'idle' | 'pending' | 'authenticated' | 'failed';\n message: string | null;\n failedAt: number | null;\n};\n\nexport type FetchResult =\n | {\n ok: true;\n status: 'ready';\n authMode: 'session';\n payload: PublishedSkillCatalogPayload;\n fetchedAt: string;\n source: 'network' | 'cache';\n }\n | {\n ok: false;\n status: 'missing_auth' | 'request_failed';\n authMode: 'missing' | 'session';\n message: string;\n fetchedAt: string;\n source: 'network' | 'cache';\n };\n\nexport type CacheEntry = {\n result: FetchResult;\n expiresAt: number;\n};\n\nexport type DetailCacheEntry = {\n artifact: PublishedSkillArtifactDetailPayload;\n expiresAt: number;\n};\n\nexport type PublishedSkillPreferenceAction = 'install' | 'uninstall' | 'ignore' | 'unignore';\n\nexport type OpencodePluginModule = {\n tool: ToolFactory;\n};\n\nexport type OpencodePluginServerInput = {\n worktree: string;\n directory: string;\n};\n\nexport type OpencodePluginSystemTransformOutput = {\n system: string[];\n};\n\nexport type OpencodePluginServer = (input: OpencodePluginServerInput) => Promise<{\n tool: Record<string, unknown>;\n 'experimental.chat.system.transform': (\n hookInput: unknown,\n output: OpencodePluginSystemTransformOutput,\n ) => Promise<void>;\n}>;\n\nexport type PublishedSkillsResult = {\n directoryPath: string;\n workspaceResolution: WorkspaceResolution;\n fetchResult: FetchResult;\n};\n\nexport type PublishedSkillsIgnoreState = {\n scopeKey: string;\n userKey: string;\n ignoredSkillSlugs: string[];\n installedGlobalSkillSlugs: string[];\n installedWorkspaceSkillSlugs: string[];\n};\n\nexport type PublishedSkillPreferenceCacheContext = {\n userKey: string;\n preferenceVersion: number;\n};\n\nexport type FilteredPublishedSkillsResult = PublishedSkillsResult & {\n ignoreState: PublishedSkillsIgnoreState;\n ignoredSkills: PublishedSkillSummary[];\n};\n\nexport type PublishedSkillDetailResult =\n | {\n ok: true;\n detail: PublishedSkillDetail;\n }\n | {\n ok: false;\n status: 'not_found' | 'missing_auth' | 'request_failed';\n output: string;\n metadata: Record<string, string>;\n };\n\nexport type PluginAuthStateSummary = {\n status: 'missing' | 'authenticated';\n email: string | null;\n userId: string | null;\n role: 'ADMIN' | 'EDITOR' | null;\n authenticatedAt: string | null;\n expiresAt: string | null;\n};\n\nexport type PluginStatusSnapshot = {\n pluginId: string;\n runtimeMode: 'tool_fetch_only';\n nativeSkillsUrlCompatibility: NativeSkillsUrlCompatibility;\n backendOrigin: string;\n graphqlUrl: string;\n fallbackWorkspaceSlug: string;\n workspaceResolution: WorkspaceResolutionOutput;\n rootSkillSeedPath: string;\n authStatePath: string;\n authState: PluginAuthStateSummary;\n status: FetchResult['status'];\n authMode: FetchResult['authMode'];\n fetchedAt: string;\n source: FetchResult['source'];\n availableTools: string[];\n message: string | null;\n catalog: PublishedSkillsSuccessState | null;\n installableCatalog: {\n count: number;\n skills: PublishedSkillSummary[];\n } | null;\n ignoredPublishedSkills: {\n scopeKey: string;\n userKey: string;\n count: number;\n skills: PublishedSkillSummary[];\n };\n};\n\nexport type AiFacingIgnoredPublishedSkillsSummary = {\n scopeKey: string;\n count: number;\n};\n\nexport type AiFacingPluginStatusSnapshot = Omit<PluginStatusSnapshot, 'ignoredPublishedSkills' | 'installableCatalog'> & {\n ignoredPublishedSkills: AiFacingIgnoredPublishedSkillsSummary;\n};\n\nexport type OidcDiscoveryDocument = {\n authorization_endpoint: string;\n};\n\nexport type PluginSessionResponse = {\n success: true;\n session: {\n jwtToken: string;\n expiresAt: string;\n user: {\n id: string;\n email: string;\n role?: 'ADMIN' | 'EDITOR';\n };\n };\n};\n\nexport type OidcCallbackPayload =\n | {\n status: 'success';\n code: string;\n state: string;\n }\n | {\n status: 'error';\n message: string;\n };\n\nexport type OidcLoginStart = {\n browserUrl: string;\n expiresAt: string;\n codeVerifier: string;\n expectedState: string;\n callbackPromise: Promise<OidcCallbackPayload>;\n closeCallbackServer: () => Promise<void>;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResolvedConfig, WorkspaceResolution, WorkspaceResolutionOutput } from './types.js';
|
|
2
|
+
export declare const normalizeRepositoryPath: (worktree: string, directory: string) => string;
|
|
3
|
+
export declare const resolveWorkspace: ({ config, directory, }: {
|
|
4
|
+
config: ResolvedConfig;
|
|
5
|
+
directory: string;
|
|
6
|
+
}) => Promise<WorkspaceResolution>;
|
|
7
|
+
export declare const toDeliveryInput: (resolution: WorkspaceResolution) => Record<string, string>;
|
|
8
|
+
export declare const toWorkspaceResolutionOutput: (resolution: WorkspaceResolution) => WorkspaceResolutionOutput;
|
|
9
|
+
export declare const toWorkspaceResolutionMetadata: (resolution: WorkspaceResolution) => Record<string, string>;
|
|
10
|
+
export declare const getPublishedSkillIgnoreScopeKey: (resolution: WorkspaceResolution, payload?: {
|
|
11
|
+
workspace: {
|
|
12
|
+
slug: string;
|
|
13
|
+
} | null;
|
|
14
|
+
}) => string;
|
|
15
|
+
export declare const normalizeDirectoryArg: (contextDirectory: string, directory?: string) => string;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
|
+
import { findWorkspaceSlugMapping } from './auth-store.js';
|
|
5
|
+
import { normalizeAbsolutePath, toWorkspaceSlug } from './path-utils.js';
|
|
6
|
+
const execFileAsync = promisify(execFile);
|
|
7
|
+
export const normalizeRepositoryPath = (worktree, directory) => {
|
|
8
|
+
const absoluteWorktree = normalizeAbsolutePath(worktree);
|
|
9
|
+
const absoluteDirectory = normalizeAbsolutePath(directory);
|
|
10
|
+
const relativePath = path.relative(absoluteWorktree, absoluteDirectory);
|
|
11
|
+
if (!relativePath || relativePath === '') return '.';
|
|
12
|
+
if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) return '.';
|
|
13
|
+
return relativePath.split(path.sep).join('/');
|
|
14
|
+
};
|
|
15
|
+
const tryExecGit = async args => {
|
|
16
|
+
try {
|
|
17
|
+
const {
|
|
18
|
+
stdout
|
|
19
|
+
} = await execFileAsync('git', args, {
|
|
20
|
+
encoding: 'utf8'
|
|
21
|
+
});
|
|
22
|
+
const normalizedOutput = stdout.trim();
|
|
23
|
+
if (normalizedOutput) return normalizedOutput;
|
|
24
|
+
return null;
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const resolveGitRoot = async directory => {
|
|
30
|
+
const gitRoot = await tryExecGit(['-C', directory, 'rev-parse', '--show-toplevel']);
|
|
31
|
+
if (!gitRoot) return null;
|
|
32
|
+
return normalizeAbsolutePath(gitRoot);
|
|
33
|
+
};
|
|
34
|
+
const normalizeGitRemoteUrl = remoteUrl => {
|
|
35
|
+
if (!remoteUrl) return null;
|
|
36
|
+
const trimmedRemoteUrl = remoteUrl.trim();
|
|
37
|
+
if (!trimmedRemoteUrl) return null;
|
|
38
|
+
const scpLikeMatch = /^git@([^:]+):(.+)$/u.exec(trimmedRemoteUrl);
|
|
39
|
+
if (scpLikeMatch) {
|
|
40
|
+
return `ssh://git@${scpLikeMatch[1]}/${scpLikeMatch[2].replace(/^\/+/, '')}`;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
const parsedUrl = new URL(trimmedRemoteUrl);
|
|
44
|
+
return parsedUrl.toString().replace(/\/+$/u, '');
|
|
45
|
+
} catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const resolveGitRemoteOriginUrl = async repositoryRoot => {
|
|
50
|
+
const remoteUrl = await tryExecGit(['-C', repositoryRoot, 'remote', 'get-url', 'origin']);
|
|
51
|
+
return normalizeGitRemoteUrl(remoteUrl);
|
|
52
|
+
};
|
|
53
|
+
export const resolveWorkspace = async ({
|
|
54
|
+
config,
|
|
55
|
+
directory
|
|
56
|
+
}) => {
|
|
57
|
+
const requestedDirectory = normalizeAbsolutePath(directory);
|
|
58
|
+
const gitRoot = await resolveGitRoot(requestedDirectory);
|
|
59
|
+
const repositoryRoot = gitRoot ?? requestedDirectory;
|
|
60
|
+
const repositoryUrl = gitRoot ? await resolveGitRemoteOriginUrl(gitRoot) : null;
|
|
61
|
+
const learnedWorkspaceMapping = await findWorkspaceSlugMapping({
|
|
62
|
+
configFile: config.authStatePath,
|
|
63
|
+
repositoryUrl,
|
|
64
|
+
repositoryRoot
|
|
65
|
+
});
|
|
66
|
+
const fallbackWorkspaceSlug = config.fallbackWorkspaceSlug;
|
|
67
|
+
const directoryPath = normalizeRepositoryPath(repositoryRoot, requestedDirectory);
|
|
68
|
+
const workspaceSlug = config.configuredWorkspaceSlug ?? learnedWorkspaceMapping?.workspaceSlug ?? fallbackWorkspaceSlug ?? null;
|
|
69
|
+
const workspaceSlugSource = config.configuredWorkspaceSlug ? 'configured' : learnedWorkspaceMapping?.workspaceSlug ? 'learned' : fallbackWorkspaceSlug ? 'fallback' : repositoryUrl ? 'repositoryUrl' : 'placeholder';
|
|
70
|
+
const workspaceIdentity = workspaceSlug ? `workspaceSlug:${workspaceSlug}` : repositoryUrl ? `repository:${repositoryUrl}` : 'workspace:placeholder';
|
|
71
|
+
return {
|
|
72
|
+
requestedDirectory,
|
|
73
|
+
repositoryRoot,
|
|
74
|
+
repositoryUrl,
|
|
75
|
+
workspaceSlug,
|
|
76
|
+
workspaceSlugSource,
|
|
77
|
+
fallbackWorkspaceSlug,
|
|
78
|
+
directoryPath,
|
|
79
|
+
cacheKey: JSON.stringify([workspaceIdentity, directoryPath])
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export const toDeliveryInput = resolution => {
|
|
83
|
+
if (resolution.workspaceSlug) {
|
|
84
|
+
return {
|
|
85
|
+
workspaceSlug: resolution.workspaceSlug,
|
|
86
|
+
directoryPath: resolution.directoryPath
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
if (resolution.repositoryUrl) {
|
|
90
|
+
return {
|
|
91
|
+
repositoryUrl: resolution.repositoryUrl,
|
|
92
|
+
directoryPath: resolution.directoryPath
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
workspaceSlug: 'workspace',
|
|
97
|
+
directoryPath: resolution.directoryPath
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
export const toWorkspaceResolutionOutput = resolution => ({
|
|
101
|
+
requestedDirectory: resolution.requestedDirectory,
|
|
102
|
+
repositoryRoot: resolution.repositoryRoot,
|
|
103
|
+
repositoryUrl: resolution.repositoryUrl,
|
|
104
|
+
workspaceSlug: resolution.workspaceSlug,
|
|
105
|
+
workspaceSlugSource: resolution.workspaceSlugSource,
|
|
106
|
+
fallbackWorkspaceSlug: resolution.fallbackWorkspaceSlug,
|
|
107
|
+
directoryPath: resolution.directoryPath
|
|
108
|
+
});
|
|
109
|
+
export const toWorkspaceResolutionMetadata = resolution => ({
|
|
110
|
+
directoryPath: resolution.directoryPath,
|
|
111
|
+
repositoryRoot: resolution.repositoryRoot,
|
|
112
|
+
repositoryUrl: resolution.repositoryUrl ?? '',
|
|
113
|
+
workspaceSlug: resolution.workspaceSlug ?? '',
|
|
114
|
+
workspaceSlugSource: resolution.workspaceSlugSource ?? 'placeholder',
|
|
115
|
+
fallbackWorkspaceSlug: resolution.fallbackWorkspaceSlug ?? ''
|
|
116
|
+
});
|
|
117
|
+
export const getPublishedSkillIgnoreScopeKey = (resolution, payload) => {
|
|
118
|
+
const workspaceSlug = payload?.workspace?.slug ?? resolution.workspaceSlug ?? resolution.fallbackWorkspaceSlug;
|
|
119
|
+
if (workspaceSlug) return `workspace:${toWorkspaceSlug(workspaceSlug)}`;
|
|
120
|
+
if (resolution.repositoryUrl) return `repository:${resolution.repositoryUrl}`;
|
|
121
|
+
return `path:${toWorkspaceSlug(path.basename(resolution.repositoryRoot))}`;
|
|
122
|
+
};
|
|
123
|
+
export const normalizeDirectoryArg = (contextDirectory, directory) => {
|
|
124
|
+
return normalizeAbsolutePath(directory ? path.resolve(contextDirectory, directory) : contextDirectory);
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["execFile","path","promisify","findWorkspaceSlugMapping","normalizeAbsolutePath","toWorkspaceSlug","execFileAsync","normalizeRepositoryPath","worktree","directory","absoluteWorktree","absoluteDirectory","relativePath","relative","startsWith","isAbsolute","split","sep","join","tryExecGit","args","stdout","encoding","normalizedOutput","trim","resolveGitRoot","gitRoot","normalizeGitRemoteUrl","remoteUrl","trimmedRemoteUrl","scpLikeMatch","exec","replace","parsedUrl","URL","toString","resolveGitRemoteOriginUrl","repositoryRoot","resolveWorkspace","config","requestedDirectory","repositoryUrl","learnedWorkspaceMapping","configFile","authStatePath","fallbackWorkspaceSlug","directoryPath","workspaceSlug","configuredWorkspaceSlug","workspaceSlugSource","workspaceIdentity","cacheKey","JSON","stringify","toDeliveryInput","resolution","toWorkspaceResolutionOutput","toWorkspaceResolutionMetadata","getPublishedSkillIgnoreScopeKey","payload","workspace","slug","basename","normalizeDirectoryArg","contextDirectory","resolve"],"sources":["../../src/server/workspace.ts"],"sourcesContent":["import { execFile } from 'node:child_process';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\nimport { findWorkspaceSlugMapping } from './auth-store.js';\nimport { normalizeAbsolutePath, toWorkspaceSlug } from './path-utils.js';\nimport type { ResolvedConfig, WorkspaceResolution, WorkspaceResolutionOutput } from './types.js';\n\nconst execFileAsync = promisify(execFile);\n\nexport const normalizeRepositoryPath = (worktree: string, directory: string): string => {\n const absoluteWorktree = normalizeAbsolutePath(worktree);\n const absoluteDirectory = normalizeAbsolutePath(directory);\n const relativePath = path.relative(absoluteWorktree, absoluteDirectory);\n\n if (!relativePath || relativePath === '') return '.';\n if (relativePath.startsWith('..') || path.isAbsolute(relativePath)) return '.';\n\n return relativePath.split(path.sep).join('/');\n};\n\nconst tryExecGit = async (args: string[]): Promise<string | null> => {\n try {\n const { stdout } = await execFileAsync('git', args, {\n encoding: 'utf8',\n });\n const normalizedOutput = stdout.trim();\n if (normalizedOutput) return normalizedOutput;\n return null;\n } catch {\n return null;\n }\n};\n\nconst resolveGitRoot = async (directory: string): Promise<string | null> => {\n const gitRoot = await tryExecGit(['-C', directory, 'rev-parse', '--show-toplevel']);\n if (!gitRoot) return null;\n return normalizeAbsolutePath(gitRoot);\n};\n\nconst normalizeGitRemoteUrl = (remoteUrl: string | null): string | null => {\n if (!remoteUrl) return null;\n\n const trimmedRemoteUrl = remoteUrl.trim();\n if (!trimmedRemoteUrl) return null;\n\n const scpLikeMatch = /^git@([^:]+):(.+)$/u.exec(trimmedRemoteUrl);\n if (scpLikeMatch) {\n return `ssh://git@${scpLikeMatch[1]}/${scpLikeMatch[2].replace(/^\\/+/, '')}`;\n }\n\n try {\n const parsedUrl = new URL(trimmedRemoteUrl);\n return parsedUrl.toString().replace(/\\/+$/u, '');\n } catch {\n return null;\n }\n};\n\nconst resolveGitRemoteOriginUrl = async (repositoryRoot: string): Promise<string | null> => {\n const remoteUrl = await tryExecGit(['-C', repositoryRoot, 'remote', 'get-url', 'origin']);\n return normalizeGitRemoteUrl(remoteUrl);\n};\n\nexport const resolveWorkspace = async ({\n config,\n directory,\n}: {\n config: ResolvedConfig;\n directory: string;\n}): Promise<WorkspaceResolution> => {\n const requestedDirectory = normalizeAbsolutePath(directory);\n const gitRoot = await resolveGitRoot(requestedDirectory);\n const repositoryRoot = gitRoot ?? requestedDirectory;\n const repositoryUrl = gitRoot ? await resolveGitRemoteOriginUrl(gitRoot) : null;\n const learnedWorkspaceMapping = await findWorkspaceSlugMapping({\n configFile: config.authStatePath,\n repositoryUrl,\n repositoryRoot,\n });\n const fallbackWorkspaceSlug = config.fallbackWorkspaceSlug;\n const directoryPath = normalizeRepositoryPath(repositoryRoot, requestedDirectory);\n const workspaceSlug =\n config.configuredWorkspaceSlug ?? learnedWorkspaceMapping?.workspaceSlug ?? fallbackWorkspaceSlug ?? null;\n const workspaceSlugSource = config.configuredWorkspaceSlug\n ? 'configured'\n : learnedWorkspaceMapping?.workspaceSlug\n ? 'learned'\n : fallbackWorkspaceSlug\n ? 'fallback'\n : repositoryUrl\n ? 'repositoryUrl'\n : 'placeholder';\n const workspaceIdentity = workspaceSlug\n ? `workspaceSlug:${workspaceSlug}`\n : repositoryUrl\n ? `repository:${repositoryUrl}`\n : 'workspace:placeholder';\n\n return {\n requestedDirectory,\n repositoryRoot,\n repositoryUrl,\n workspaceSlug,\n workspaceSlugSource,\n fallbackWorkspaceSlug,\n directoryPath,\n cacheKey: JSON.stringify([workspaceIdentity, directoryPath]),\n };\n};\n\nexport const toDeliveryInput = (resolution: WorkspaceResolution): Record<string, string> => {\n if (resolution.workspaceSlug) {\n return {\n workspaceSlug: resolution.workspaceSlug,\n directoryPath: resolution.directoryPath,\n };\n }\n\n if (resolution.repositoryUrl) {\n return {\n repositoryUrl: resolution.repositoryUrl,\n directoryPath: resolution.directoryPath,\n };\n }\n\n return {\n workspaceSlug: 'workspace',\n directoryPath: resolution.directoryPath,\n };\n};\n\nexport const toWorkspaceResolutionOutput = (resolution: WorkspaceResolution): WorkspaceResolutionOutput => ({\n requestedDirectory: resolution.requestedDirectory,\n repositoryRoot: resolution.repositoryRoot,\n repositoryUrl: resolution.repositoryUrl,\n workspaceSlug: resolution.workspaceSlug,\n workspaceSlugSource: resolution.workspaceSlugSource,\n fallbackWorkspaceSlug: resolution.fallbackWorkspaceSlug,\n directoryPath: resolution.directoryPath,\n});\n\nexport const toWorkspaceResolutionMetadata = (resolution: WorkspaceResolution): Record<string, string> => ({\n directoryPath: resolution.directoryPath,\n repositoryRoot: resolution.repositoryRoot,\n repositoryUrl: resolution.repositoryUrl ?? '',\n workspaceSlug: resolution.workspaceSlug ?? '',\n workspaceSlugSource: resolution.workspaceSlugSource ?? 'placeholder',\n fallbackWorkspaceSlug: resolution.fallbackWorkspaceSlug ?? '',\n});\n\nexport const getPublishedSkillIgnoreScopeKey = (\n resolution: WorkspaceResolution,\n payload?: { workspace: { slug: string } | null },\n): string => {\n const workspaceSlug = payload?.workspace?.slug ?? resolution.workspaceSlug ?? resolution.fallbackWorkspaceSlug;\n if (workspaceSlug) return `workspace:${toWorkspaceSlug(workspaceSlug)}`;\n if (resolution.repositoryUrl) return `repository:${resolution.repositoryUrl}`;\n return `path:${toWorkspaceSlug(path.basename(resolution.repositoryRoot))}`;\n};\n\nexport const normalizeDirectoryArg = (contextDirectory: string, directory?: string): string => {\n return normalizeAbsolutePath(directory ? path.resolve(contextDirectory, directory) : contextDirectory);\n};\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,qBAAqB,EAAEC,eAAe,QAAQ,iBAAiB;AAGxE,MAAMC,aAAa,GAAGJ,SAAS,CAACF,QAAQ,CAAC;AAEzC,OAAO,MAAMO,uBAAuB,GAAGA,CAACC,QAAgB,EAAEC,SAAiB,KAAa;EACtF,MAAMC,gBAAgB,GAAGN,qBAAqB,CAACI,QAAQ,CAAC;EACxD,MAAMG,iBAAiB,GAAGP,qBAAqB,CAACK,SAAS,CAAC;EAC1D,MAAMG,YAAY,GAAGX,IAAI,CAACY,QAAQ,CAACH,gBAAgB,EAAEC,iBAAiB,CAAC;EAEvE,IAAI,CAACC,YAAY,IAAIA,YAAY,KAAK,EAAE,EAAE,OAAO,GAAG;EACpD,IAAIA,YAAY,CAACE,UAAU,CAAC,IAAI,CAAC,IAAIb,IAAI,CAACc,UAAU,CAACH,YAAY,CAAC,EAAE,OAAO,GAAG;EAE9E,OAAOA,YAAY,CAACI,KAAK,CAACf,IAAI,CAACgB,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;AAC/C,CAAC;AAED,MAAMC,UAAU,GAAG,MAAOC,IAAc,IAA6B;EACnE,IAAI;IACF,MAAM;MAAEC;IAAO,CAAC,GAAG,MAAMf,aAAa,CAAC,KAAK,EAAEc,IAAI,EAAE;MAClDE,QAAQ,EAAE;IACZ,CAAC,CAAC;IACF,MAAMC,gBAAgB,GAAGF,MAAM,CAACG,IAAI,CAAC,CAAC;IACtC,IAAID,gBAAgB,EAAE,OAAOA,gBAAgB;IAC7C,OAAO,IAAI;EACb,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb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