@aexol/opencode-wizard 0.3.7 → 0.3.9
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 +14 -4
- package/dist/graphql-operations.d.ts +4 -4
- package/dist/graphql-operations.js +13 -5
- package/dist/graphql-operations.js.map +1 -1
- package/dist/plugin-tools.d.ts +6 -0
- package/dist/plugin-tools.js +11 -1
- package/dist/plugin-tools.js.map +1 -1
- package/dist/published-skills-transform.d.ts +10 -2
- package/dist/published-skills-transform.js +12 -3
- package/dist/published-skills-transform.js.map +1 -1
- package/dist/server/runtime.js +227 -61
- package/dist/server/runtime.js.map +1 -1
- package/dist/server/types.d.ts +22 -9
- package/dist/server/types.js.map +1 -1
- package/dist/tui/components/status-content.js +44 -2
- package/dist/tui/components/status-content.js.map +1 -1
- package/dist/tui/plugin.js +97 -0
- package/dist/tui/plugin.js.map +1 -1
- package/dist/tui/skill-helpers.d.ts +6 -0
- package/dist/tui/skill-helpers.js +46 -0
- package/dist/tui/skill-helpers.js.map +1 -1
- package/dist/tui/types.d.ts +22 -0
- package/dist/tui/types.js.map +1 -1
- package/package.json +1 -1
package/dist/server/types.d.ts
CHANGED
|
@@ -86,13 +86,15 @@ export type PublishedSkillUserPreferences = {
|
|
|
86
86
|
};
|
|
87
87
|
export type PublishedSkillPreferenceScope = 'GLOBAL' | 'WORKSPACE';
|
|
88
88
|
export type CreateOrUpdateSkillFromMarkdownResponse = {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
89
|
+
admin: {
|
|
90
|
+
createOrUpdateSkillFromMarkdown: {
|
|
91
|
+
success: boolean;
|
|
92
|
+
skillSlug: string | null;
|
|
93
|
+
skillVersionId: string | null;
|
|
94
|
+
artifactSlug: string | null;
|
|
95
|
+
artifactVersionId: string | null;
|
|
96
|
+
errors: string[];
|
|
97
|
+
};
|
|
96
98
|
};
|
|
97
99
|
};
|
|
98
100
|
export type ImportWizardArtifactSnapshotResponse = {
|
|
@@ -136,7 +138,9 @@ export type PublishedSkillCatalogItem = {
|
|
|
136
138
|
frontmatterName: string;
|
|
137
139
|
frontmatterDescription: string;
|
|
138
140
|
checksum: string;
|
|
139
|
-
|
|
141
|
+
revision?: string | null;
|
|
142
|
+
updatedAtCursor?: string | null;
|
|
143
|
+
publishedAt?: string | null;
|
|
140
144
|
fileCount: number;
|
|
141
145
|
};
|
|
142
146
|
};
|
|
@@ -165,8 +169,10 @@ export type WizardArtifactCatalogItem = {
|
|
|
165
169
|
frontmatterName: string;
|
|
166
170
|
frontmatterDescription: string;
|
|
167
171
|
checksum: string;
|
|
172
|
+
revision?: string | null;
|
|
173
|
+
updatedAtCursor?: string | null;
|
|
168
174
|
canonicalFilePath: string;
|
|
169
|
-
publishedAt
|
|
175
|
+
publishedAt?: string | null;
|
|
170
176
|
fileCount: number;
|
|
171
177
|
};
|
|
172
178
|
};
|
|
@@ -272,6 +278,7 @@ export type FetchResult = {
|
|
|
272
278
|
export type CacheEntry = {
|
|
273
279
|
result: FetchResult;
|
|
274
280
|
expiresAt: number;
|
|
281
|
+
cursor: string;
|
|
275
282
|
};
|
|
276
283
|
export type WizardArtifactFetchResult = {
|
|
277
284
|
ok: true;
|
|
@@ -286,6 +293,12 @@ export type WizardArtifactFetchResult = {
|
|
|
286
293
|
export type DetailCacheEntry = {
|
|
287
294
|
artifact: PublishedSkillArtifactDetailPayload;
|
|
288
295
|
expiresAt: number;
|
|
296
|
+
revision: string;
|
|
297
|
+
};
|
|
298
|
+
export type WizardArtifactDetailCacheEntry = {
|
|
299
|
+
artifact: WizardArtifactDetailPayload;
|
|
300
|
+
expiresAt: number;
|
|
301
|
+
revision: string;
|
|
289
302
|
};
|
|
290
303
|
export type PublishedSkillPreferenceAction = 'install' | 'uninstall' | 'ignore' | 'unignore';
|
|
291
304
|
export type OpencodePluginModule = {
|
package/dist/server/types.js.map
CHANGED
|
@@ -1 +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 WizardArtifactKind = 'SKILL' | 'DESIGN_DOC';\n\nexport type WizardArtifactCatalogResponse = {\n pluginWizardArtifacts: WizardArtifactCatalogPayload;\n};\n\nexport type WizardArtifactDetailResponse = {\n pluginWizardArtifactVersion: WizardArtifactDetailPayload | 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 WizardArtifactCatalogPayload = {\n artifactKind: WizardArtifactKind;\n workspace: PublishedSkillCatalogPayload['workspace'];\n directoryPath: string;\n artifacts: WizardArtifactCatalogItem[];\n catalogArtifacts: WizardArtifactInstallableCatalogItem[];\n artifactPreferences: WizardArtifactUserPreferences;\n unsupportedReason?: string | null;\n message?: string | null;\n};\n\nexport type WizardArtifactUserPreferences = {\n scopeKey: string;\n userKey: string;\n ignoredArtifacts: WizardArtifactCatalogItem[];\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 artifactSlug: string | null;\n artifactVersionId: string | null;\n errors: string[];\n };\n};\n\nexport type ImportWizardArtifactSnapshotResponse = {\n importWizardArtifactSnapshot: {\n success: boolean;\n skillSlug: string | null;\n skillVersionId: string | null;\n artifactSlug: string | null;\n artifactVersionId: 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 WizardArtifactInstallableCatalogItem = Pick<\n WizardArtifactCatalogItem,\n 'artifact' | 'artifactVersion'\n>;\n\nexport type WizardArtifactCatalogItem = {\n assignmentSource: string;\n assignmentType: string;\n scopePath: string;\n includeChildren?: boolean | null;\n artifact: {\n id: string;\n kind: WizardArtifactKind;\n slug: string;\n name: string;\n summary?: string | null;\n whenToUse?: string | null;\n status: string;\n installPolicy: PublishedSkillInstallPolicy;\n };\n artifactVersion: {\n id: string;\n version: string;\n title?: string | null;\n summary?: string | null;\n status: string;\n frontmatterName: string;\n frontmatterDescription: string;\n checksum: string;\n canonicalFilePath: 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 WizardArtifactDetailItem = WizardArtifactCatalogItem & {\n artifactVersion: WizardArtifactCatalogItem['artifactVersion'] & {\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 WizardArtifactDetailPayload = WizardArtifactCatalogItem['artifactVersion'] & {\n artifact: WizardArtifactCatalogItem['artifact'];\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 WizardArtifactFetchResult =\n | {\n ok: true;\n status: 'ready';\n authMode: 'session';\n payload: WizardArtifactCatalogPayload;\n fetchedAt: string;\n source: 'network' | 'cache';\n }\n | Extract<FetchResult, { ok: false }>;\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":[]}
|
|
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 WizardArtifactKind = 'SKILL' | 'DESIGN_DOC';\n\nexport type WizardArtifactCatalogResponse = {\n pluginWizardArtifacts: WizardArtifactCatalogPayload;\n};\n\nexport type WizardArtifactDetailResponse = {\n pluginWizardArtifactVersion: WizardArtifactDetailPayload | 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 WizardArtifactCatalogPayload = {\n artifactKind: WizardArtifactKind;\n workspace: PublishedSkillCatalogPayload['workspace'];\n directoryPath: string;\n artifacts: WizardArtifactCatalogItem[];\n catalogArtifacts: WizardArtifactInstallableCatalogItem[];\n artifactPreferences: WizardArtifactUserPreferences;\n unsupportedReason?: string | null;\n message?: string | null;\n};\n\nexport type WizardArtifactUserPreferences = {\n scopeKey: string;\n userKey: string;\n ignoredArtifacts: WizardArtifactCatalogItem[];\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 admin: {\n createOrUpdateSkillFromMarkdown: {\n success: boolean;\n skillSlug: string | null;\n skillVersionId: string | null;\n artifactSlug: string | null;\n artifactVersionId: string | null;\n errors: string[];\n };\n };\n};\n\nexport type ImportWizardArtifactSnapshotResponse = {\n importWizardArtifactSnapshot: {\n success: boolean;\n skillSlug: string | null;\n skillVersionId: string | null;\n artifactSlug: string | null;\n artifactVersionId: 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 revision?: string | null;\n updatedAtCursor?: string | null;\n publishedAt?: string | null;\n fileCount: number;\n };\n};\n\nexport type WizardArtifactInstallableCatalogItem = Pick<\n WizardArtifactCatalogItem,\n 'artifact' | 'artifactVersion'\n>;\n\nexport type WizardArtifactCatalogItem = {\n assignmentSource: string;\n assignmentType: string;\n scopePath: string;\n includeChildren?: boolean | null;\n artifact: {\n id: string;\n kind: WizardArtifactKind;\n slug: string;\n name: string;\n summary?: string | null;\n whenToUse?: string | null;\n status: string;\n installPolicy: PublishedSkillInstallPolicy;\n };\n artifactVersion: {\n id: string;\n version: string;\n title?: string | null;\n summary?: string | null;\n status: string;\n frontmatterName: string;\n frontmatterDescription: string;\n checksum: string;\n revision?: string | null;\n updatedAtCursor?: string | null;\n canonicalFilePath: string;\n publishedAt?: string | null;\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 WizardArtifactDetailItem = WizardArtifactCatalogItem & {\n artifactVersion: WizardArtifactCatalogItem['artifactVersion'] & {\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 WizardArtifactDetailPayload = WizardArtifactCatalogItem['artifactVersion'] & {\n artifact: WizardArtifactCatalogItem['artifact'];\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 cursor: string;\n};\n\nexport type WizardArtifactFetchResult =\n | {\n ok: true;\n status: 'ready';\n authMode: 'session';\n payload: WizardArtifactCatalogPayload;\n fetchedAt: string;\n source: 'network' | 'cache';\n }\n | Extract<FetchResult, { ok: false }>;\n\nexport type DetailCacheEntry = {\n artifact: PublishedSkillArtifactDetailPayload;\n expiresAt: number;\n revision: string;\n};\n\nexport type WizardArtifactDetailCacheEntry = {\n artifact: WizardArtifactDetailPayload;\n expiresAt: number;\n revision: string;\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":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { memo as _$memo } from "@opentui/solid";
|
|
1
2
|
import { createComponent as _$createComponent } from "@opentui/solid";
|
|
2
3
|
import { insert as _$insert } from "@opentui/solid";
|
|
3
4
|
import { effect as _$effect } from "@opentui/solid";
|
|
@@ -7,7 +8,7 @@ import { setProp as _$setProp } from "@opentui/solid";
|
|
|
7
8
|
import { createElement as _$createElement } from "@opentui/solid";
|
|
8
9
|
import { createMemo } from 'solid-js';
|
|
9
10
|
import { compactStatusMessage, formatAuthStatus, formatBackendOriginLabel, formatSkillsCatalogUnavailableMessage } from '../formatting.js';
|
|
10
|
-
import { getInstallableNotInstalledSkills } from '../skill-helpers.js';
|
|
11
|
+
import { getInstallableNotInstalledSkills, getSkillActionRows, getSkillListRows } from '../skill-helpers.js';
|
|
11
12
|
import { Row } from './common.js';
|
|
12
13
|
export const StatusContent = props => {
|
|
13
14
|
if (props.status.kind === 'loading') {
|
|
@@ -62,6 +63,7 @@ export const SkillsRows = props => {
|
|
|
62
63
|
})();
|
|
63
64
|
};
|
|
64
65
|
export const ReadyRows = props => {
|
|
66
|
+
const actionRows = getSkillActionRows(props.snapshot);
|
|
65
67
|
const statusRows = [_$createComponent(Row, {
|
|
66
68
|
label: "url",
|
|
67
69
|
get value() {
|
|
@@ -84,7 +86,20 @@ export const ReadyRows = props => {
|
|
|
84
86
|
get valueColor() {
|
|
85
87
|
return props.theme.text;
|
|
86
88
|
}
|
|
87
|
-
})
|
|
89
|
+
}), _$memo(() => actionRows.map(row => _$createComponent(Row, {
|
|
90
|
+
get label() {
|
|
91
|
+
return row.label;
|
|
92
|
+
},
|
|
93
|
+
get value() {
|
|
94
|
+
return row.value;
|
|
95
|
+
},
|
|
96
|
+
get labelColor() {
|
|
97
|
+
return props.theme.textMuted;
|
|
98
|
+
},
|
|
99
|
+
get valueColor() {
|
|
100
|
+
return props.theme.text;
|
|
101
|
+
}
|
|
102
|
+
})))];
|
|
88
103
|
if (!props.snapshot.catalog) {
|
|
89
104
|
return (() => {
|
|
90
105
|
var _el$6 = _$createElement("box");
|
|
@@ -109,6 +124,7 @@ export const ReadyRows = props => {
|
|
|
109
124
|
}
|
|
110
125
|
const installableNotInstalledCount = getInstallableNotInstalledSkills(props.snapshot).length;
|
|
111
126
|
const catalogStatus = `${props.snapshot.catalog.publishedSkillCount} loaded · ${installableNotInstalledCount} installable · ${props.snapshot.ignoredPublishedSkills.count} ignored`;
|
|
127
|
+
const skillRows = getSkillListRows(props.snapshot);
|
|
112
128
|
return (() => {
|
|
113
129
|
var _el$7 = _$createElement("box");
|
|
114
130
|
_$setProp(_el$7, "width", "100%");
|
|
@@ -125,6 +141,32 @@ export const ReadyRows = props => {
|
|
|
125
141
|
return props.theme.text;
|
|
126
142
|
}
|
|
127
143
|
}), null);
|
|
144
|
+
_$insert(_el$7, (() => {
|
|
145
|
+
var _c$ = _$memo(() => skillRows.length > 0);
|
|
146
|
+
return () => _c$() ? skillRows.map(row => _$createComponent(Row, {
|
|
147
|
+
get label() {
|
|
148
|
+
return row.label;
|
|
149
|
+
},
|
|
150
|
+
get value() {
|
|
151
|
+
return row.value;
|
|
152
|
+
},
|
|
153
|
+
get labelColor() {
|
|
154
|
+
return props.theme.textMuted;
|
|
155
|
+
},
|
|
156
|
+
get valueColor() {
|
|
157
|
+
return props.theme.text;
|
|
158
|
+
}
|
|
159
|
+
})) : _$createComponent(Row, {
|
|
160
|
+
label: "skills",
|
|
161
|
+
value: "none assigned yet",
|
|
162
|
+
get labelColor() {
|
|
163
|
+
return props.theme.textMuted;
|
|
164
|
+
},
|
|
165
|
+
get valueColor() {
|
|
166
|
+
return props.theme.text;
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
})(), null);
|
|
128
170
|
return _el$7;
|
|
129
171
|
})();
|
|
130
172
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createMemo","compactStatusMessage","formatAuthStatus","formatBackendOriginLabel","formatSkillsCatalogUnavailableMessage","getInstallableNotInstalledSkills","Row","StatusContent","props","status","kind","_el$","_$createElement","_$insertNode","_$createTextNode","_$setProp","_$effect","_$p","theme","textMuted","_el$3","_el$4","_$insert","message","warning","_$createComponent","ReadyRows","snapshot","SkillsRows","api","current","statusContent","currentStatus","_el$5","statusRows","label","value","backendOrigin","labelColor","valueColor","text","catalog","_el$6","installableNotInstalledCount","length","catalogStatus","publishedSkillCount","ignoredPublishedSkills","count","_el$7"],"sources":["../../../src/tui/components/status-content.tsx"],"sourcesContent":["import { createMemo } from 'solid-js';\nimport type { PluginStatusSnapshot } from '../../server.js';\nimport { compactStatusMessage, formatAuthStatus, formatBackendOriginLabel, formatSkillsCatalogUnavailableMessage } from '../formatting.js';\nimport { getInstallableNotInstalledSkills } from '../skill-helpers.js';\nimport type { StatusState, TuiPluginApi } from '../types.js';\nimport { Row } from './common.js';\n\nexport const StatusContent = (props: { status: StatusState; theme: TuiPluginApi['theme']['current'] }) => {\n if (props.status.kind === 'loading') {\n return (\n <text fg={props.theme.textMuted} wrapMode=\"none\" overflow=\"hidden\">\n loading…\n </text>\n );\n }\n\n if (props.status.kind === 'error') {\n return (\n <text fg={props.theme.warning} wrapMode=\"none\" overflow=\"hidden\">\n unavailable: {compactStatusMessage(props.status.message)}\n </text>\n );\n }\n\n return <ReadyRows snapshot={props.status.snapshot} theme={props.theme} />;\n};\n\nexport const SkillsRows = (props: { api: TuiPluginApi; status: () => StatusState }) => {\n const theme = createMemo(() => props.api.theme.current);\n const statusContent = () => {\n const currentStatus = props.status();\n\n return <StatusContent status={currentStatus} theme={theme()} />;\n };\n\n return (\n <box width=\"100%\" flexDirection=\"column\" overflow=\"hidden\">\n {statusContent()}\n </box>\n );\n};\n\nexport const ReadyRows = (props: { snapshot: PluginStatusSnapshot; theme: TuiPluginApi['theme']['current'] }) => {\n const statusRows = (\n <>\n <Row\n label=\"url\"\n value={formatBackendOriginLabel(props.snapshot.backendOrigin)}\n labelColor={props.theme.textMuted}\n valueColor={props.theme.text}\n />\n <Row label=\"auth\" value={formatAuthStatus(props.snapshot)} labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n </>\n );\n\n if (!props.snapshot.catalog) {\n return (\n <box width=\"100%\" flexDirection=\"column\" overflow=\"hidden\">\n {statusRows}\n <Row\n label=\"catalog\"\n value={formatSkillsCatalogUnavailableMessage(props.snapshot)}\n labelColor={props.theme.textMuted}\n valueColor={props.theme.text}\n />\n </box>\n );\n }\n\n const installableNotInstalledCount = getInstallableNotInstalledSkills(props.snapshot).length;\n const catalogStatus = `${props.snapshot.catalog.publishedSkillCount} loaded · ${installableNotInstalledCount} installable · ${props.snapshot.ignoredPublishedSkills.count} ignored`;\n\n return (\n <box width=\"100%\" flexDirection=\"column\" overflow=\"hidden\">\n {statusRows}\n <Row label=\"catalog\" value={catalogStatus} labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n </box>\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["createMemo","compactStatusMessage","formatAuthStatus","formatBackendOriginLabel","formatSkillsCatalogUnavailableMessage","getInstallableNotInstalledSkills","getSkillActionRows","getSkillListRows","Row","StatusContent","props","status","kind","_el$","_$createElement","_$insertNode","_$createTextNode","_$setProp","_$effect","_$p","theme","textMuted","_el$3","_el$4","_$insert","message","warning","_$createComponent","ReadyRows","snapshot","SkillsRows","api","current","statusContent","currentStatus","_el$5","actionRows","statusRows","label","value","backendOrigin","labelColor","valueColor","text","_$memo","map","row","catalog","_el$6","installableNotInstalledCount","length","catalogStatus","publishedSkillCount","ignoredPublishedSkills","count","skillRows","_el$7","_c$"],"sources":["../../../src/tui/components/status-content.tsx"],"sourcesContent":["import { createMemo } from 'solid-js';\nimport type { PluginStatusSnapshot } from '../../server.js';\nimport { compactStatusMessage, formatAuthStatus, formatBackendOriginLabel, formatSkillsCatalogUnavailableMessage } from '../formatting.js';\nimport { getInstallableNotInstalledSkills, getSkillActionRows, getSkillListRows } from '../skill-helpers.js';\nimport type { StatusState, TuiPluginApi } from '../types.js';\nimport { Row } from './common.js';\n\nexport const StatusContent = (props: { status: StatusState; theme: TuiPluginApi['theme']['current'] }) => {\n if (props.status.kind === 'loading') {\n return (\n <text fg={props.theme.textMuted} wrapMode=\"none\" overflow=\"hidden\">\n loading…\n </text>\n );\n }\n\n if (props.status.kind === 'error') {\n return (\n <text fg={props.theme.warning} wrapMode=\"none\" overflow=\"hidden\">\n unavailable: {compactStatusMessage(props.status.message)}\n </text>\n );\n }\n\n return <ReadyRows snapshot={props.status.snapshot} theme={props.theme} />;\n};\n\nexport const SkillsRows = (props: { api: TuiPluginApi; status: () => StatusState }) => {\n const theme = createMemo(() => props.api.theme.current);\n const statusContent = () => {\n const currentStatus = props.status();\n\n return <StatusContent status={currentStatus} theme={theme()} />;\n };\n\n return (\n <box width=\"100%\" flexDirection=\"column\" overflow=\"hidden\">\n {statusContent()}\n </box>\n );\n};\n\nexport const ReadyRows = (props: { snapshot: PluginStatusSnapshot; theme: TuiPluginApi['theme']['current'] }) => {\n const actionRows = getSkillActionRows(props.snapshot);\n const statusRows = (\n <>\n <Row\n label=\"url\"\n value={formatBackendOriginLabel(props.snapshot.backendOrigin)}\n labelColor={props.theme.textMuted}\n valueColor={props.theme.text}\n />\n <Row label=\"auth\" value={formatAuthStatus(props.snapshot)} labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n {actionRows.map((row) => (\n <Row label={row.label} value={row.value} labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n ))}\n </>\n );\n\n if (!props.snapshot.catalog) {\n return (\n <box width=\"100%\" flexDirection=\"column\" overflow=\"hidden\">\n {statusRows}\n <Row\n label=\"catalog\"\n value={formatSkillsCatalogUnavailableMessage(props.snapshot)}\n labelColor={props.theme.textMuted}\n valueColor={props.theme.text}\n />\n </box>\n );\n }\n\n const installableNotInstalledCount = getInstallableNotInstalledSkills(props.snapshot).length;\n const catalogStatus = `${props.snapshot.catalog.publishedSkillCount} loaded · ${installableNotInstalledCount} installable · ${props.snapshot.ignoredPublishedSkills.count} ignored`;\n const skillRows = getSkillListRows(props.snapshot);\n\n return (\n <box width=\"100%\" flexDirection=\"column\" overflow=\"hidden\">\n {statusRows}\n <Row label=\"catalog\" value={catalogStatus} labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n {skillRows.length > 0 ? (\n skillRows.map((row) => (\n <Row label={row.label} value={row.value} labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n ))\n ) : (\n <Row label=\"skills\" value=\"none assigned yet\" labelColor={props.theme.textMuted} valueColor={props.theme.text} />\n )}\n </box>\n );\n};\n"],"mappings":";;;;;;;;AAAA,SAASA,UAAU,QAAQ,UAAU;AAErC,SAASC,oBAAoB,EAAEC,gBAAgB,EAAEC,wBAAwB,EAAEC,qCAAqC,QAAQ,kBAAkB;AAC1I,SAASC,gCAAgC,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QAAA,IAAEqB,UAAUA,CAAA;UAAA,OAAEhC,KAAK,CAACU,KAAK,CAACuB,IAAI;QAAA;MAAA,EAC9G;IAAA;IAAA,OAAAa,KAAA;EAAA;AAGP,CAAC","ignoreList":[]}
|
package/dist/tui/plugin.js
CHANGED
|
@@ -3,10 +3,99 @@ import { STATUS_REFRESH_INTERVAL_MS } from './constants.js';
|
|
|
3
3
|
import { requestRender } from './rendering.js';
|
|
4
4
|
import { createWizardStatusSlot } from './slots.js';
|
|
5
5
|
import { loadStatus } from './status.js';
|
|
6
|
+
const registerCommandActions = (api, actions) => {
|
|
7
|
+
const commandProvider = () => actions;
|
|
8
|
+
if (api.command?.register) {
|
|
9
|
+
return {
|
|
10
|
+
unregister: api.command.register(commandProvider) ?? null
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
if (api.commands?.register) {
|
|
14
|
+
return {
|
|
15
|
+
unregister: api.commands.register(commandProvider) ?? null
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
const createSharedSkillActions = refreshStatus => [{
|
|
21
|
+
value: 'opencode-wizard.status',
|
|
22
|
+
title: 'Wizard: status',
|
|
23
|
+
description: 'Refresh plugin auth, backend, catalog, source, and workspace-resolution status via opencode_wizard_status.',
|
|
24
|
+
category: 'Wizard',
|
|
25
|
+
slash: {
|
|
26
|
+
name: 'wizard-status'
|
|
27
|
+
},
|
|
28
|
+
onSelect: () => refreshStatus({
|
|
29
|
+
showLoading: true
|
|
30
|
+
})
|
|
31
|
+
}, {
|
|
32
|
+
value: 'opencode-wizard.fetch-published-skill',
|
|
33
|
+
title: 'Wizard: fetch published skill',
|
|
34
|
+
description: 'Fetch wizard-listed skill bodies/details with opencode_wizard_published_skills_fetch; pass refresh: true for fresh backend data.',
|
|
35
|
+
category: 'Wizard',
|
|
36
|
+
slash: {
|
|
37
|
+
name: 'wizard-fetch-skill'
|
|
38
|
+
},
|
|
39
|
+
onSelect: () => refreshStatus({
|
|
40
|
+
showLoading: true
|
|
41
|
+
})
|
|
42
|
+
}, {
|
|
43
|
+
value: 'opencode-wizard.manage-skill-preference',
|
|
44
|
+
title: 'Wizard: manage skill preference',
|
|
45
|
+
description: 'Use opencode_wizard_published_skill_preference_set to install, uninstall, ignore, or unignore a published skill for project/global scope.',
|
|
46
|
+
category: 'Wizard',
|
|
47
|
+
slash: {
|
|
48
|
+
name: 'wizard-manage-skill'
|
|
49
|
+
},
|
|
50
|
+
onSelect: () => refreshStatus({
|
|
51
|
+
showLoading: true
|
|
52
|
+
})
|
|
53
|
+
}];
|
|
54
|
+
const createEditorSkillActions = refreshStatus => [{
|
|
55
|
+
value: 'opencode-wizard.editor.create-or-update-skill',
|
|
56
|
+
title: 'Wizard: create/update skill from markdown',
|
|
57
|
+
description: 'Canonical EDITOR flow: call opencode_wizard_editor_create_or_update_skill with complete SKILL.md markdownContent; no local seed file required.',
|
|
58
|
+
category: 'Wizard',
|
|
59
|
+
slash: {
|
|
60
|
+
name: 'wizard-create-skill'
|
|
61
|
+
},
|
|
62
|
+
onSelect: () => refreshStatus({
|
|
63
|
+
showLoading: true
|
|
64
|
+
})
|
|
65
|
+
}, {
|
|
66
|
+
value: 'opencode-wizard.editor.import-artifact',
|
|
67
|
+
title: 'Wizard: import external artifact',
|
|
68
|
+
description: 'External source flow: call opencode_wizard_artifact_import for SKILL or DESIGN_DOC URLs/command-like sources; no project files are written.',
|
|
69
|
+
category: 'Wizard',
|
|
70
|
+
slash: {
|
|
71
|
+
name: 'wizard-import-artifact'
|
|
72
|
+
},
|
|
73
|
+
onSelect: () => refreshStatus({
|
|
74
|
+
showLoading: true
|
|
75
|
+
})
|
|
76
|
+
}, {
|
|
77
|
+
value: 'opencode-wizard.editor.publish-seed-skill',
|
|
78
|
+
title: 'Wizard: publish local seed skill',
|
|
79
|
+
description: 'Legacy seed flow: call opencode_wizard_editor_publish_skill for .opencode/skills/<slug>/SKILL.md when a local seed already exists.',
|
|
80
|
+
category: 'Wizard',
|
|
81
|
+
slash: {
|
|
82
|
+
name: 'wizard-publish-seed'
|
|
83
|
+
},
|
|
84
|
+
onSelect: () => refreshStatus({
|
|
85
|
+
showLoading: true
|
|
86
|
+
})
|
|
87
|
+
}];
|
|
88
|
+
const registerSkillActions = (api, refreshStatus, mode) => {
|
|
89
|
+
const sharedActions = createSharedSkillActions(refreshStatus);
|
|
90
|
+
const actions = mode === 'editor' ? [...sharedActions, ...createEditorSkillActions(refreshStatus)] : sharedActions;
|
|
91
|
+
return registerCommandActions(api, actions);
|
|
92
|
+
};
|
|
6
93
|
export const tui = async api => {
|
|
7
94
|
const [status, setStatus] = createSignal({
|
|
8
95
|
kind: 'loading'
|
|
9
96
|
});
|
|
97
|
+
let registeredActionMode = null;
|
|
98
|
+
let commandRegistration = null;
|
|
10
99
|
const refreshStatus = options => {
|
|
11
100
|
if (options?.showLoading) {
|
|
12
101
|
setStatus({
|
|
@@ -16,6 +105,14 @@ export const tui = async api => {
|
|
|
16
105
|
}
|
|
17
106
|
void loadStatus(api).then(nextStatus => {
|
|
18
107
|
setStatus(nextStatus);
|
|
108
|
+
if (nextStatus.kind === 'ready') {
|
|
109
|
+
const nextMode = nextStatus.snapshot.authState.role === 'EDITOR' ? 'editor' : 'shared';
|
|
110
|
+
if (registeredActionMode !== nextMode) {
|
|
111
|
+
commandRegistration?.unregister?.();
|
|
112
|
+
commandRegistration = registerSkillActions(api, refreshStatus, nextMode);
|
|
113
|
+
registeredActionMode = commandRegistration ? nextMode : null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
19
116
|
requestRender(api);
|
|
20
117
|
});
|
|
21
118
|
};
|
package/dist/tui/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createSignal","STATUS_REFRESH_INTERVAL_MS","requestRender","createWizardStatusSlot","loadStatus","
|
|
1
|
+
{"version":3,"names":["createSignal","STATUS_REFRESH_INTERVAL_MS","requestRender","createWizardStatusSlot","loadStatus","registerCommandActions","api","actions","commandProvider","command","register","unregister","commands","createSharedSkillActions","refreshStatus","value","title","description","category","slash","name","onSelect","showLoading","createEditorSkillActions","registerSkillActions","mode","sharedActions","tui","status","setStatus","kind","registeredActionMode","commandRegistration","options","then","nextStatus","nextMode","snapshot","authState","role","slots","setInterval"],"sources":["../../src/tui/plugin.ts"],"sourcesContent":["import { createSignal } from 'solid-js';\nimport { STATUS_REFRESH_INTERVAL_MS } from './constants.js';\nimport { requestRender } from './rendering.js';\nimport { createWizardStatusSlot } from './slots.js';\nimport { loadStatus } from './status.js';\nimport type { RefreshStatus, StatusState, TuiCommand, TuiPlugin, TuiPluginApi } from './types.js';\n\ntype RegisteredActionMode = 'shared' | 'editor';\ntype CommandRegistration = {\n unregister: (() => void) | null;\n};\n\nconst registerCommandActions = (api: TuiPluginApi, actions: TuiCommand[]): CommandRegistration | null => {\n const commandProvider = () => actions;\n\n if (api.command?.register) {\n return { unregister: api.command.register(commandProvider) ?? null };\n }\n\n if (api.commands?.register) {\n return { unregister: api.commands.register(commandProvider) ?? null };\n }\n\n return null;\n};\n\nconst createSharedSkillActions = (refreshStatus: RefreshStatus): TuiCommand[] => [\n {\n value: 'opencode-wizard.status',\n title: 'Wizard: status',\n description: 'Refresh plugin auth, backend, catalog, source, and workspace-resolution status via opencode_wizard_status.',\n category: 'Wizard',\n slash: {\n name: 'wizard-status',\n },\n onSelect: () => refreshStatus({ showLoading: true }),\n },\n {\n value: 'opencode-wizard.fetch-published-skill',\n title: 'Wizard: fetch published skill',\n description: 'Fetch wizard-listed skill bodies/details with opencode_wizard_published_skills_fetch; pass refresh: true for fresh backend data.',\n category: 'Wizard',\n slash: {\n name: 'wizard-fetch-skill',\n },\n onSelect: () => refreshStatus({ showLoading: true }),\n },\n {\n value: 'opencode-wizard.manage-skill-preference',\n title: 'Wizard: manage skill preference',\n description:\n 'Use opencode_wizard_published_skill_preference_set to install, uninstall, ignore, or unignore a published skill for project/global scope.',\n category: 'Wizard',\n slash: {\n name: 'wizard-manage-skill',\n },\n onSelect: () => refreshStatus({ showLoading: true }),\n },\n];\n\nconst createEditorSkillActions = (refreshStatus: RefreshStatus): TuiCommand[] => [\n {\n value: 'opencode-wizard.editor.create-or-update-skill',\n title: 'Wizard: create/update skill from markdown',\n description:\n 'Canonical EDITOR flow: call opencode_wizard_editor_create_or_update_skill with complete SKILL.md markdownContent; no local seed file required.',\n category: 'Wizard',\n slash: {\n name: 'wizard-create-skill',\n },\n onSelect: () => refreshStatus({ showLoading: true }),\n },\n {\n value: 'opencode-wizard.editor.import-artifact',\n title: 'Wizard: import external artifact',\n description:\n 'External source flow: call opencode_wizard_artifact_import for SKILL or DESIGN_DOC URLs/command-like sources; no project files are written.',\n category: 'Wizard',\n slash: {\n name: 'wizard-import-artifact',\n },\n onSelect: () => refreshStatus({ showLoading: true }),\n },\n {\n value: 'opencode-wizard.editor.publish-seed-skill',\n title: 'Wizard: publish local seed skill',\n description:\n 'Legacy seed flow: call opencode_wizard_editor_publish_skill for .opencode/skills/<slug>/SKILL.md when a local seed already exists.',\n category: 'Wizard',\n slash: {\n name: 'wizard-publish-seed',\n },\n onSelect: () => refreshStatus({ showLoading: true }),\n },\n];\n\nconst registerSkillActions = (\n api: TuiPluginApi,\n refreshStatus: RefreshStatus,\n mode: RegisteredActionMode,\n): CommandRegistration | null => {\n const sharedActions = createSharedSkillActions(refreshStatus);\n const actions = mode === 'editor' ? [...sharedActions, ...createEditorSkillActions(refreshStatus)] : sharedActions;\n\n return registerCommandActions(api, actions);\n};\n\nexport const tui: TuiPlugin = async (api) => {\n const [status, setStatus] = createSignal<StatusState>({ kind: 'loading' });\n let registeredActionMode: RegisteredActionMode | null = null;\n let commandRegistration: CommandRegistration | null = null;\n const refreshStatus: RefreshStatus = (options) => {\n if (options?.showLoading) {\n setStatus({ kind: 'loading' });\n requestRender(api);\n }\n\n void loadStatus(api).then((nextStatus) => {\n setStatus(nextStatus);\n if (nextStatus.kind === 'ready') {\n const nextMode: RegisteredActionMode = nextStatus.snapshot.authState.role === 'EDITOR' ? 'editor' : 'shared';\n if (registeredActionMode !== nextMode) {\n commandRegistration?.unregister?.();\n commandRegistration = registerSkillActions(api, refreshStatus, nextMode);\n registeredActionMode = commandRegistration ? nextMode : null;\n }\n }\n requestRender(api);\n });\n };\n\n api.slots.register(createWizardStatusSlot(api, status, refreshStatus));\n refreshStatus();\n setInterval(refreshStatus, STATUS_REFRESH_INTERVAL_MS);\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,UAAU;AACvC,SAASC,0BAA0B,QAAQ,gBAAgB;AAC3D,SAASC,aAAa,QAAQ,gBAAgB;AAC9C,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,UAAU,QAAQ,aAAa;AAQxC,MAAMC,sBAAsB,GAAGA,CAACC,GAAiB,EAAEC,OAAqB,KAAiC;EACvG,MAAMC,eAAe,GAAGA,CAAA,KAAMD,OAAO;EAErC,IAAID,GAAG,CAACG,OAAO,EAAEC,QAAQ,EAAE;IACzB,OAAO;MAAEC,UAAU,EAAEL,GAAG,CAACG,OAAO,CAACC,QAAQ,CAACF,eAAe,CAAC,IAAI;IAAK,CAAC;EACtE;EAEA,IAAIF,GAAG,CAACM,QAAQ,EAAEF,QAAQ,EAAE;IAC1B,OAAO;MAAEC,UAAU,EAAEL,GAAG,CAACM,QAAQ,CAACF,QAAQ,CAACF,eAAe,CAAC,IAAI;IAAK,CAAC;EACvE;EAEA,OAAO,IAAI;AACb,CAAC;AAED,MAAMK,wBAAwB,GAAIC,aAA4B,IAAmB,CAC/E;EACEC,KAAK,EAAE,wBAAwB;EAC/BC,KAAK,EAAE,gBAAgB;EACvBC,WAAW,EAAE,4GAA4G;EACzHC,QAAQ,EAAE,QAAQ;EAClBC,KAAK,EAAE;IACLC,IAAI,EAAE;EACR,CAAC;EACDC,QAAQ,EAAEA,CAAA,KAAMP,aAAa,CAAC;IAAEQ,WAAW,EAAE;EAAK,CAAC;AACrD,CAAC,EACD;EACEP,KAAK,EAAE,uCAA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L,oBAAoB,GAAGC,mBAAmB,GAAGI,QAAQ,GAAG,IAAI;QAC9D;MACF;MACAlC,aAAa,CAACI,GAAG,CAAC;IACpB,CAAC,CAAC;EACJ,CAAC;EAEDA,GAAG,CAACkC,KAAK,CAAC9B,QAAQ,CAACP,sBAAsB,CAACG,GAAG,EAAEsB,MAAM,EAAEd,aAAa,CAAC,CAAC;EACtEA,aAAa,CAAC,CAAC;EACf2B,WAAW,CAAC3B,aAAa,EAAEb,0BAA0B,CAAC;AACxD,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { PluginStatusSnapshot } from '../server.js';
|
|
2
2
|
import type { PublishedSkillSummary } from './types.js';
|
|
3
3
|
export declare const getInstallableNotInstalledSkills: (snapshot: PluginStatusSnapshot) => PublishedSkillSummary[];
|
|
4
|
+
export type SkillListRow = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const getSkillListRows: (snapshot: PluginStatusSnapshot) => SkillListRow[];
|
|
9
|
+
export declare const getSkillActionRows: (snapshot: PluginStatusSnapshot) => SkillListRow[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const MAX_LISTED_SKILLS = 6;
|
|
1
2
|
export const getInstallableNotInstalledSkills = snapshot => {
|
|
2
3
|
const installableSkills = snapshot.installableCatalog?.skills ?? [];
|
|
3
4
|
if (installableSkills.length === 0) return [];
|
|
@@ -5,4 +6,49 @@ export const getInstallableNotInstalledSkills = snapshot => {
|
|
|
5
6
|
const ignoredSkillSlugs = new Set(snapshot.ignoredPublishedSkills.skills.map(skill => skill.skillSlug));
|
|
6
7
|
return installableSkills.filter(skill => !activeSkillSlugs.has(skill.skillSlug) && !ignoredSkillSlugs.has(skill.skillSlug));
|
|
7
8
|
};
|
|
9
|
+
const compactSkillName = skill => {
|
|
10
|
+
const name = skill.skillName.trim() || skill.artifactName.trim() || skill.skillSlug;
|
|
11
|
+
if (name === skill.skillSlug) return name;
|
|
12
|
+
return `${name} (${skill.skillSlug})`;
|
|
13
|
+
};
|
|
14
|
+
const toEffectiveSkillLabel = skill => {
|
|
15
|
+
if (skill.assignmentSource.includes('USER')) return 'user';
|
|
16
|
+
if (skill.contextKind === 'global') return 'global';
|
|
17
|
+
if (skill.contextKind === 'project') return 'project';
|
|
18
|
+
return 'active';
|
|
19
|
+
};
|
|
20
|
+
export const getSkillListRows = snapshot => {
|
|
21
|
+
const activeRows = (snapshot.catalog?.skills ?? []).map(skill => ({
|
|
22
|
+
label: toEffectiveSkillLabel(skill),
|
|
23
|
+
value: compactSkillName(skill)
|
|
24
|
+
}));
|
|
25
|
+
const availableRows = getInstallableNotInstalledSkills(snapshot).map(skill => ({
|
|
26
|
+
label: 'available',
|
|
27
|
+
value: compactSkillName(skill)
|
|
28
|
+
}));
|
|
29
|
+
const ignoredRows = snapshot.ignoredPublishedSkills.skills.map(skill => ({
|
|
30
|
+
label: 'ignored',
|
|
31
|
+
value: compactSkillName(skill)
|
|
32
|
+
}));
|
|
33
|
+
const rows = [...activeRows, ...availableRows, ...ignoredRows];
|
|
34
|
+
if (rows.length <= MAX_LISTED_SKILLS) return rows;
|
|
35
|
+
return [...rows.slice(0, MAX_LISTED_SKILLS), {
|
|
36
|
+
label: 'more',
|
|
37
|
+
value: `${rows.length - MAX_LISTED_SKILLS} hidden · use opencode_wizard_published_skills_fetch`
|
|
38
|
+
}];
|
|
39
|
+
};
|
|
40
|
+
export const getSkillActionRows = snapshot => {
|
|
41
|
+
const rows = [{
|
|
42
|
+
label: 'commands',
|
|
43
|
+
value: 'Wizard: status · fetch skill · manage preference'
|
|
44
|
+
}, {
|
|
45
|
+
label: 'manage',
|
|
46
|
+
value: 'install/uninstall · ignore/unignore via preference_set'
|
|
47
|
+
}];
|
|
48
|
+
if (snapshot.authState.role !== 'EDITOR') return rows;
|
|
49
|
+
return [...rows, {
|
|
50
|
+
label: 'editor',
|
|
51
|
+
value: 'create/update markdown · import external · publish seed'
|
|
52
|
+
}];
|
|
53
|
+
};
|
|
8
54
|
//# sourceMappingURL=skill-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getInstallableNotInstalledSkills","snapshot","installableSkills","installableCatalog","skills","length","activeSkillSlugs","Set","catalog","map","skill","skillSlug","ignoredSkillSlugs","ignoredPublishedSkills","filter","has"],"sources":["../../src/tui/skill-helpers.ts"],"sourcesContent":["import type { PluginStatusSnapshot } from '../server.js';\nimport type { PublishedSkillSummary } from './types.js';\n\nexport const getInstallableNotInstalledSkills = (snapshot: PluginStatusSnapshot): PublishedSkillSummary[] => {\n const installableSkills = snapshot.installableCatalog?.skills ?? [];\n if (installableSkills.length === 0) return [];\n\n const activeSkillSlugs = new Set(snapshot.catalog?.skills.map((skill) => skill.skillSlug) ?? []);\n const ignoredSkillSlugs = new Set(snapshot.ignoredPublishedSkills.skills.map((skill) => skill.skillSlug));\n\n return installableSkills.filter(\n (skill) => !activeSkillSlugs.has(skill.skillSlug) && !ignoredSkillSlugs.has(skill.skillSlug),\n );\n};\n"],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"names":["MAX_LISTED_SKILLS","getInstallableNotInstalledSkills","snapshot","installableSkills","installableCatalog","skills","length","activeSkillSlugs","Set","catalog","map","skill","skillSlug","ignoredSkillSlugs","ignoredPublishedSkills","filter","has","compactSkillName","name","skillName","trim","artifactName","toEffectiveSkillLabel","assignmentSource","includes","contextKind","getSkillListRows","activeRows","label","value","availableRows","ignoredRows","rows","slice","getSkillActionRows","authState","role"],"sources":["../../src/tui/skill-helpers.ts"],"sourcesContent":["import type { PluginStatusSnapshot } from '../server.js';\nimport type { PublishedSkillSummary } from './types.js';\n\nconst MAX_LISTED_SKILLS = 6;\n\nexport const getInstallableNotInstalledSkills = (snapshot: PluginStatusSnapshot): PublishedSkillSummary[] => {\n const installableSkills = snapshot.installableCatalog?.skills ?? [];\n if (installableSkills.length === 0) return [];\n\n const activeSkillSlugs = new Set(snapshot.catalog?.skills.map((skill) => skill.skillSlug) ?? []);\n const ignoredSkillSlugs = new Set(snapshot.ignoredPublishedSkills.skills.map((skill) => skill.skillSlug));\n\n return installableSkills.filter(\n (skill) => !activeSkillSlugs.has(skill.skillSlug) && !ignoredSkillSlugs.has(skill.skillSlug),\n );\n};\n\nexport type SkillListRow = {\n label: string;\n value: string;\n};\n\nconst compactSkillName = (skill: PublishedSkillSummary): string => {\n const name = skill.skillName.trim() || skill.artifactName.trim() || skill.skillSlug;\n if (name === skill.skillSlug) return name;\n\n return `${name} (${skill.skillSlug})`;\n};\n\nconst toEffectiveSkillLabel = (skill: PublishedSkillSummary): string => {\n if (skill.assignmentSource.includes('USER')) return 'user';\n if (skill.contextKind === 'global') return 'global';\n if (skill.contextKind === 'project') return 'project';\n\n return 'active';\n};\n\nexport const getSkillListRows = (snapshot: PluginStatusSnapshot): SkillListRow[] => {\n const activeRows = (snapshot.catalog?.skills ?? []).map((skill) => ({\n label: toEffectiveSkillLabel(skill),\n value: compactSkillName(skill),\n }));\n const availableRows = getInstallableNotInstalledSkills(snapshot).map((skill) => ({\n label: 'available',\n value: compactSkillName(skill),\n }));\n const ignoredRows = snapshot.ignoredPublishedSkills.skills.map((skill) => ({\n label: 'ignored',\n value: compactSkillName(skill),\n }));\n const rows = [...activeRows, ...availableRows, ...ignoredRows];\n if (rows.length <= MAX_LISTED_SKILLS) return rows;\n\n return [\n ...rows.slice(0, MAX_LISTED_SKILLS),\n {\n label: 'more',\n value: `${rows.length - MAX_LISTED_SKILLS} hidden · use opencode_wizard_published_skills_fetch`,\n },\n ];\n};\n\nexport const getSkillActionRows = (snapshot: PluginStatusSnapshot): SkillListRow[] => {\n const rows: SkillListRow[] = [\n {\n label: 'commands',\n value: 'Wizard: status · fetch skill · manage preference',\n },\n {\n label: 'manage',\n value: 'install/uninstall · ignore/unignore via preference_set',\n },\n ];\n\n if (snapshot.authState.role !== 'EDITOR') return rows;\n\n return [\n ...rows,\n {\n label: 'editor',\n value: 'create/update markdown ·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,UAAU;IACjBC,KAAK,EAAE;EACT,CAAC,EACD;IACED,KAAK,EAAE,QAAQ;IACfC,KAAK,EAAE;EACT,CAAC,CACF;EAED,IAAI3B,QAAQ,CAACiC,SAAS,CAACC,IAAI,KAAK,QAAQ,EAAE,OAAOJ,IAAI;EAErD,OAAO,CACL,GAAGA,IAAI,EACP;IACEJ,KAAK,EAAE,QAAQ;IACfC,KAAK,EAAE;EACT,CAAC,CACF;AACH,CAAC","ignoreList":[]}
|
package/dist/tui/types.d.ts
CHANGED
|
@@ -15,6 +15,22 @@ export type WizardTheme = {
|
|
|
15
15
|
textMuted: string | RGBA | undefined;
|
|
16
16
|
warning: string | RGBA | undefined;
|
|
17
17
|
};
|
|
18
|
+
export type TuiCommand = {
|
|
19
|
+
title: string;
|
|
20
|
+
value: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
category?: string;
|
|
23
|
+
keybind?: string;
|
|
24
|
+
suggested?: boolean;
|
|
25
|
+
hidden?: boolean;
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
slash?: {
|
|
28
|
+
name: string;
|
|
29
|
+
aliases?: string[];
|
|
30
|
+
};
|
|
31
|
+
onSelect?: () => void;
|
|
32
|
+
};
|
|
33
|
+
export type TuiCommandRegister = (cb: () => TuiCommand[]) => (() => void) | void;
|
|
18
34
|
export type TuiPluginApi = {
|
|
19
35
|
theme: {
|
|
20
36
|
current: WizardTheme;
|
|
@@ -32,6 +48,12 @@ export type TuiPluginApi = {
|
|
|
32
48
|
slots: {
|
|
33
49
|
register: (slot: TuiSlotPlugin) => void;
|
|
34
50
|
};
|
|
51
|
+
command?: {
|
|
52
|
+
register?: TuiCommandRegister;
|
|
53
|
+
};
|
|
54
|
+
commands?: {
|
|
55
|
+
register?: TuiCommandRegister;
|
|
56
|
+
};
|
|
35
57
|
state: {
|
|
36
58
|
path: {
|
|
37
59
|
worktree: string;
|
package/dist/tui/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/tui/types.ts"],"sourcesContent":["import type { RGBA } from '@opentui/core';\nimport type { JSX } from 'solid-js';\nimport type { PluginStatusSnapshot } from '../server.js';\n\nexport type StatusState =\n | {\n kind: 'loading';\n }\n | {\n kind: 'ready';\n snapshot: PluginStatusSnapshot;\n }\n | {\n kind: 'error';\n message: string;\n };\n\nexport type WizardTheme = {\n text: string | RGBA | undefined;\n textMuted: string | RGBA | undefined;\n warning: string | RGBA | undefined;\n};\n\nexport type TuiPluginApi = {\n theme: {\n current: WizardTheme;\n };\n ui?: {\n dialog?: {\n replace?: (render: () => JSX.Element, onClose?: () => void) => void;\n clear?: () => void;\n setSize?: (size: 'medium' | 'large' | 'xlarge') => void;\n };\n };\n renderer?: {\n requestRender?: () => void;\n };\n slots: {\n register: (slot: TuiSlotPlugin) => void;\n };\n state: {\n path: {\n worktree: string;\n directory: string;\n };\n };\n};\n\nexport type TuiSlotContext = unknown;\n\nexport type TuiSlotPlugin = {\n order: number;\n slots: {\n home_bottom: () => JSX.Element;\n sidebar_content: (ctx: TuiSlotContext, value: { session_id: string }) => JSX.Element;\n };\n};\n\nexport type TuiPlugin = (api: TuiPluginApi) => void | Promise<void>;\n\nexport type PublishedSkillSummary = NonNullable<PluginStatusSnapshot['catalog']>['skills'][number];\nexport type RefreshStatus = (options?: { showLoading?: boolean }) => void;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/tui/types.ts"],"sourcesContent":["import type { RGBA } from '@opentui/core';\nimport type { JSX } from 'solid-js';\nimport type { PluginStatusSnapshot } from '../server.js';\n\nexport type StatusState =\n | {\n kind: 'loading';\n }\n | {\n kind: 'ready';\n snapshot: PluginStatusSnapshot;\n }\n | {\n kind: 'error';\n message: string;\n };\n\nexport type WizardTheme = {\n text: string | RGBA | undefined;\n textMuted: string | RGBA | undefined;\n warning: string | RGBA | undefined;\n};\n\nexport type TuiCommand = {\n title: string;\n value: string;\n description?: string;\n category?: string;\n keybind?: string;\n suggested?: boolean;\n hidden?: boolean;\n enabled?: boolean;\n slash?: {\n name: string;\n aliases?: string[];\n };\n onSelect?: () => void;\n};\n\nexport type TuiCommandRegister = (cb: () => TuiCommand[]) => (() => void) | void;\n\nexport type TuiPluginApi = {\n theme: {\n current: WizardTheme;\n };\n ui?: {\n dialog?: {\n replace?: (render: () => JSX.Element, onClose?: () => void) => void;\n clear?: () => void;\n setSize?: (size: 'medium' | 'large' | 'xlarge') => void;\n };\n };\n renderer?: {\n requestRender?: () => void;\n };\n slots: {\n register: (slot: TuiSlotPlugin) => void;\n };\n command?: {\n register?: TuiCommandRegister;\n };\n commands?: {\n register?: TuiCommandRegister;\n };\n state: {\n path: {\n worktree: string;\n directory: string;\n };\n };\n};\n\nexport type TuiSlotContext = unknown;\n\nexport type TuiSlotPlugin = {\n order: number;\n slots: {\n home_bottom: () => JSX.Element;\n sidebar_content: (ctx: TuiSlotContext, value: { session_id: string }) => JSX.Element;\n };\n};\n\nexport type TuiPlugin = (api: TuiPluginApi) => void | Promise<void>;\n\nexport type PublishedSkillSummary = NonNullable<PluginStatusSnapshot['catalog']>['skills'][number];\nexport type RefreshStatus = (options?: { showLoading?: boolean }) => void;\n"],"mappings":"","ignoreList":[]}
|