Files
makelore/shared/device-packages.ts

75 lines
1.8 KiB
TypeScript

export type DevicePackageSourceKind = 'npm' | 'git' | 'file';
export type DevicePackageKind = 'skill-only' | 'pi-extension' | 'mixed';
export interface DevicePackageSkillEntry {
id: string;
entryPath: string;
}
export interface InstallPreviewV1 {
schemaVersion: 1;
planId: string;
expiresAt: string;
requestedSource: string;
resolvedSource: string;
packageId: string;
displayName: string;
resolvedVersion: string;
kind: DevicePackageKind;
skillEntries: readonly DevicePackageSkillEntry[];
extensionEntries: readonly string[];
includesExecutableCode: boolean;
ignoredLifecycleScripts: readonly string[];
warnings: readonly string[];
scope: 'device-parent-workers';
}
export interface DevicePackageRecordV1 {
schemaVersion: 1;
packageId: string;
displayName: string;
resolvedVersion: string;
source: Readonly<{
kind: DevicePackageSourceKind;
requested: string;
resolved: string;
}>;
kind: DevicePackageKind;
skillEntries: readonly DevicePackageSkillEntry[];
extensionEntries: readonly string[];
enabled: boolean;
confirmedExecutableCode: boolean;
installedAt: string;
}
export interface DevicePackageIndexV1 {
schemaVersion: 1;
generation: number;
packages: readonly DevicePackageRecordV1[];
}
export type DevicePackageToolOperation =
| 'prepare'
| 'commit'
| 'list'
| 'set_enabled'
| 'uninstall';
export const DEVICE_PACKAGE_TOOL_NAMES = Object.freeze([
'local_package_prepare',
'local_package_commit',
'local_package_list',
'local_package_set_enabled',
'local_package_uninstall',
] as const);
export type DevicePackageToolName = typeof DEVICE_PACKAGE_TOOL_NAMES[number];
export type DevicePackageToolDetailsV1 = Readonly<{
schema: 'makelore-device-package.v1';
operation: DevicePackageToolOperation;
success: true;
preview?: InstallPreviewV1;
index?: DevicePackageIndexV1;
}>;