Files
orca/src/shared/agent-skill-sharing-contract.ts
T
Jinwoo Hong ebef2ea99c fix(skills): share again under an existing skill bundle name as a new version (#29090)
* fix(skills): republish under an existing skill bundle name as a new version

Look up the caller's package by bundle name before packaging so a re-share
reuses its package id, and explain a name a teammate already holds instead of
a generic failure. Also stop classifying cloud request failures as filesystem
failures (same fix as #20848).

Fixes #20770

* fix(skills): keep the cloud request error importable without Electron

The runtime now classifies SkillCloudRequestError, and orcad has no Electron.

* fix(skills): map a held name only at lookup; leave classification to #20848

A finalize 409 after a signed-out preview is the user's own name, so it falls
back to the generic publish failure instead of blaming a teammate.

* fix(skills): say the skill name is in use instead of blaming a teammate

Orca has no team UI, so the copy states only what the server told us.
2026-10-15 14:09:41 -04:00

46 lines
1.6 KiB
TypeScript

import { z } from 'zod'
import type { SkillCloudOperation, SkillCloudPublishResult } from './skill-cloud-contract'
import { SkillDiscoveryTargetSchema } from './skills'
export const AGENT_SKILL_SHARING_UNSUPPORTED_ENVIRONMENT_CODE =
'agent_skill_sharing_unsupported_environment'
export const AGENT_SKILL_SELECTOR_NOT_FOUND_CODE = 'agent_skill_selector_not_found'
export const AGENT_SKILL_SELECTOR_AMBIGUOUS_CODE = 'agent_skill_selector_ambiguous'
export const AGENT_SKILL_SHARING_BUSY_CODE = 'agent_skill_sharing_busy'
export const AGENT_SKILL_NOT_SHAREABLE_CODE = 'agent_skill_not_shareable'
export const AGENT_SKILL_BUNDLE_NAME_TAKEN_CODE = 'agent_skill_bundle_name_taken'
export const AgentSkillShareRequestSchema = z
.object({
skillSelectors: z.array(z.string().trim().min(1).max(4_096)).min(1).max(512),
bundleName: z.string().regex(/^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]{0,62}[a-z0-9])?$/),
releaseNotes: z.string().max(10_000).default(''),
target: SkillDiscoveryTargetSchema.optional()
})
.strict()
export type AgentSkillShareRequest = z.infer<typeof AgentSkillShareRequestSchema>
export type AgentSkillShareSelectedSkill = {
id: string
name: string
description: string | null
}
export type AgentSkillShareResult = SkillCloudPublishResult & {
selectedSkills: AgentSkillShareSelectedSkill[]
}
export type AgentSkillShareOperation = SkillCloudOperation<AgentSkillShareResult>
export class AgentSkillSharingError extends Error {
constructor(
readonly code: string,
message: string,
readonly data?: unknown
) {
super(message)
this.name = 'AgentSkillSharingError'
}
}