@crewx/sdk 0.9.0-rc.128 → 0.9.0-rc.129

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.
@@ -5,6 +5,7 @@ export type McpAppAgentAccess = 'allowed' | 'approval_required' | 'denied';
5
5
  export interface McpAppAgentAccessAction {
6
6
  readonly actionId: string;
7
7
  readonly confirmation: UiActionConfirmation | undefined;
8
+ readonly content?: unknown;
8
9
  readonly backend?: {
9
10
  readonly type: 'core';
10
11
  readonly handler: string;
@@ -1,2 +1,3 @@
1
- export declare function markVerifiedProductAppBundleProvenance<T extends object>(value: T): T;
1
+ export declare function markVerifiedProductAppBundleProvenance<T extends object>(value: T, executableRelativePath?: string): T;
2
2
  export declare function isVerifiedProductAppBundleProvenance(value: unknown): value is object;
3
+ export declare function getVerifiedProductAppBundleExecutable(value: unknown): string | undefined;
@@ -0,0 +1,89 @@
1
+ import { UI_CONTENT_MEDIA_TYPES, isUiContentMediaType, isValidUiAppInstanceId } from './content-declarations.js';
2
+ import type { UiContentMediaType } from './content-declarations.js';
3
+ export { UI_CONTENT_MEDIA_TYPES, isUiContentMediaType, isValidUiAppInstanceId };
4
+ export type { UiContentMediaType };
5
+ export declare const UI_CONTENT_MAX_BYTES: number;
6
+ export declare const UI_CONTENT_MAX_LINES = 20000;
7
+ export declare const UI_CONTENT_TICKET_TTL_MS = 120000;
8
+ export declare const UI_CONTENT_OUTPUT_TTL_MS = 120000;
9
+ export declare const UI_CONTENT_MAX_MEMORY_BYTES: number;
10
+ export declare const UI_CONTENT_ERROR_CODES: readonly ["CONTENT_SOURCE_UNSUPPORTED", "CONTENT_REQUIRED", "CONTENT_EXPIRED", "CONTENT_BINDING_MISMATCH", "CONTENT_DIGEST_MISMATCH", "CONTENT_TOO_LARGE", "CONTENT_ENCODING_INVALID", "CONTENT_BUSY", "IDENTITY_UNAVAILABLE", "EXEC_OUTPUT_INVALID"];
11
+ export type UiContentErrorCode = (typeof UI_CONTENT_ERROR_CODES)[number];
12
+ export interface UiContentInputDeclaration {
13
+ readonly mediaType: UiContentMediaType;
14
+ readonly required?: boolean;
15
+ }
16
+ export interface UiContentOutputDeclaration {
17
+ readonly mediaType: UiContentMediaType;
18
+ readonly range?: boolean;
19
+ }
20
+ export interface UiActionContentDeclaration {
21
+ readonly in?: UiContentInputDeclaration;
22
+ readonly out?: UiContentOutputDeclaration;
23
+ }
24
+ export interface UiContentRangeRequest {
25
+ readonly startLine: number;
26
+ readonly lineCount: number;
27
+ }
28
+ export interface UiContentRange extends UiContentRangeRequest {
29
+ readonly totalLines: number;
30
+ }
31
+ export interface ContentFrame {
32
+ readonly bytes: Uint8Array;
33
+ readonly sha256: string;
34
+ readonly lines: number;
35
+ readonly mediaType: UiContentMediaType;
36
+ readonly range?: UiContentRange;
37
+ readonly complete?: boolean;
38
+ }
39
+ export interface UiContentBinding {
40
+ readonly workspaceId: string;
41
+ readonly threadId: string;
42
+ readonly instanceId: string;
43
+ readonly actionId: string;
44
+ readonly requestId: string;
45
+ }
46
+ export interface UiContentInputTicket {
47
+ readonly ticket: string;
48
+ readonly binding: UiContentBinding;
49
+ readonly sha256: string;
50
+ readonly bytes: number;
51
+ readonly lines: number;
52
+ readonly mediaType: UiContentMediaType;
53
+ readonly expiresAt: number;
54
+ }
55
+ export interface UiContentChannelPort {
56
+ putInput(ticket: UiContentInputTicket, frame: ContentFrame): void;
57
+ lookupInput(ticket: string, now: number): UiContentInputTicket | null;
58
+ consumeInput(ticket: string, now: number): ContentFrame | null;
59
+ reserveOutput(binding: UiContentBinding, now: number): boolean;
60
+ releaseOutput(binding: UiContentBinding): void;
61
+ putOutput(binding: UiContentBinding, frame: ContentFrame, now: number): void;
62
+ readOutput(binding: UiContentBinding, now: number): ContentFrame | null;
63
+ }
64
+ export declare class UiContentChannelError extends Error {
65
+ readonly code: UiContentErrorCode;
66
+ readonly name = "UiContentChannelError";
67
+ constructor(code: UiContentErrorCode);
68
+ }
69
+ export declare function sha256Content(bytes: Uint8Array): string;
70
+ export declare function countContentLines(bytes: Uint8Array): number;
71
+ export declare function decodeContentUtf8(bytes: Uint8Array): string;
72
+ export declare function validateContentBytes(value: unknown, mediaType: unknown): {
73
+ readonly bytes: Uint8Array;
74
+ readonly sha256: string;
75
+ readonly lines: number;
76
+ };
77
+ export interface ValidateContentFrameOptions {
78
+ readonly direction: 'in' | 'out';
79
+ readonly mediaType: UiContentMediaType;
80
+ readonly expectedSha256?: string;
81
+ readonly expectedBytes?: number;
82
+ readonly expectedLines?: number;
83
+ readonly requestedRange?: UiContentRangeRequest;
84
+ }
85
+ export declare function validateContentFrame(value: unknown, options: ValidateContentFrameOptions): ContentFrame;
86
+ export declare function isUiContentDeclaration(value: unknown): value is UiActionContentDeclaration;
87
+ export declare function isUiContentRangeRequest(value: unknown): value is UiContentRangeRequest;
88
+ export declare function contentBindingMatches(left: UiContentBinding, right: UiContentBinding): boolean;
89
+ export declare function isValidUiThreadIdentity(value: unknown): value is string;
@@ -0,0 +1,29 @@
1
+ import type { UiDefinition, UiDefinitionRef } from '../ui-instance/types.js';
2
+ export declare const UI_CONTENT_MEDIA_TYPES: readonly ["text/plain", "application/json"];
3
+ export type UiContentMediaType = (typeof UI_CONTENT_MEDIA_TYPES)[number];
4
+ export interface McpAppContentActionDeclaration {
5
+ readonly actionId: string;
6
+ readonly in?: {
7
+ readonly mediaType: UiContentMediaType;
8
+ readonly required: boolean;
9
+ };
10
+ readonly out?: {
11
+ readonly mediaType: UiContentMediaType;
12
+ readonly range: boolean;
13
+ };
14
+ }
15
+ export interface McpAppContentActions {
16
+ readonly schemaVersion: 1;
17
+ readonly instanceId: string;
18
+ readonly definition: {
19
+ readonly id: string;
20
+ readonly version: number;
21
+ readonly hash: string;
22
+ };
23
+ readonly actions: readonly McpAppContentActionDeclaration[];
24
+ }
25
+ export declare function isUiContentMediaType(value: unknown): value is UiContentMediaType;
26
+ export declare function isValidUiAppInstanceId(value: unknown): value is string;
27
+ export declare function buildMcpAppContentActions(instanceId: string, definition: UiDefinition): McpAppContentActions | undefined;
28
+ export declare function isMcpAppContentActions(value: unknown): value is McpAppContentActions;
29
+ export declare function contentActionsMatch(value: unknown, instanceId: string, definitionRef: UiDefinitionRef): boolean;
@@ -18,6 +18,7 @@ export interface InspectSkillBackendOutputOptions {
18
18
  readonly dataPaths?: readonly string[];
19
19
  readonly durationMs?: number;
20
20
  readonly timedOut?: boolean;
21
+ readonly contentFramed?: boolean;
21
22
  }
22
23
  export interface ScanExternalResourcesOptions {
23
24
  readonly csp: string;
@@ -3,49 +3,18 @@ import type { JsonObject, UiDefinition } from '../ui-instance/types.js';
3
3
  import type { UiPluginHandlerMetadata, UiPluginManifestV2, UiPluginNormalizedManifestV2 } from '../ui-plugin/types.js';
4
4
  import { AppDiscoveryFsError, NodeAppDiscoveryFs, NodeAppDiscoveryFsAdapter, defaultAppDiscoveryFs, defaultNodeAppDiscoveryFs, type AppDiscoveryFsErrorCode } from './node-app-discovery-fs.js';
5
5
  import type { McpAppRegistry } from './types.js';
6
+ import type { ProductAppBundleFileHash, ProductAppBundleInput, ProductAppBundleProvenance as LoadedProductAppBundleProvenance } from './product-bundle-loader.js';
7
+ export type { ProductAppBundleDefinitionIdentity, ProductAppBundleFileHash, ProductAppBundleIndex, ProductAppBundleInput, ProductAppBundlePackageIndex, ProductAppBundleReservations, } from './product-bundle-loader.js';
8
+ export { productAppBundleReservations } from './product-bundle-loader.js';
6
9
  export type WorkspaceAppSource = 'apps' | 'skills';
7
10
  export type WorkspaceAppDiscoverySource = WorkspaceAppSource | 'bundled';
8
- export interface ProductAppBundleReservations {
9
- readonly appIds: readonly string[];
10
- readonly definitionIds: readonly string[];
11
- }
12
- export interface ProductAppBundleInput {
13
- readonly root: string | null;
14
- readonly expectedIndexHash: string;
15
- readonly reservedIds: ProductAppBundleReservations;
16
- }
17
- export interface ProductAppBundleProvenance {
18
- readonly kind: 'bundled';
19
- readonly launcher: boolean;
20
- readonly indexHash: string;
21
- readonly packageDir: string;
11
+ export interface ProductAppBundleProvenance extends LoadedProductAppBundleProvenance {
22
12
  readonly appId: string;
23
13
  readonly definitionId: string;
24
14
  readonly version: number;
25
15
  readonly definitionHash: string;
26
16
  readonly files: readonly ProductAppBundleFileHash[];
27
17
  }
28
- export interface ProductAppBundleFileHash {
29
- readonly path: string;
30
- readonly sha256: string;
31
- }
32
- export interface ProductAppBundleDefinitionIdentity {
33
- readonly id: string;
34
- readonly version: number;
35
- readonly hash: string;
36
- }
37
- export interface ProductAppBundlePackageIndex {
38
- readonly packageDir: string;
39
- readonly launcher?: false;
40
- readonly appId: string;
41
- readonly definition: ProductAppBundleDefinitionIdentity;
42
- readonly lineage: readonly UiDefinitionLineageEntry[];
43
- readonly files: readonly ProductAppBundleFileHash[];
44
- }
45
- export interface ProductAppBundleIndex {
46
- readonly version: 1;
47
- readonly packages: readonly ProductAppBundlePackageIndex[];
48
- }
49
18
  export type WorkspaceAppDiscoveryIncompleteReason = 'time_limit';
50
19
  export type WorkspaceAppDiagnosticCode = 'MANIFEST_MISSING' | 'MANIFEST_INVALID' | 'ENTRY_INVALID' | 'INITIAL_STATE_INVALID' | 'DUPLICATE_ID' | 'RESERVED_ID' | 'BUNDLE_INTEGRITY' | 'LINEAGE_INVALID' | 'LINEAGE_STALE' | 'PATH_ESCAPED' | 'LIMIT_EXCEEDED' | 'EXEC_DENIED';
51
20
  export interface WorkspaceAppDiagnostic {
@@ -161,7 +130,6 @@ export declare const LOCAL_APP_TOOL_PREFIX = "crewx_local_app_";
161
130
  export declare const MCP_APP_WORKSPACE_TOOL_PREFIX = "crewx_local_app_";
162
131
  export declare function deriveWorkspaceAppToolNames(pluginId: string): WorkspaceAppToolNames;
163
132
  export declare function deriveWorkspaceAppToolName(pluginId: string, kind?: 'read' | 'action'): string;
164
- export declare function productAppBundleReservations(packages: readonly ProductAppBundlePackageIndex[]): ProductAppBundleReservations;
165
133
  export declare function discoverWorkspaceApps(workspaceRoot: string, fs?: AppDiscoveryFileSystem, options?: WorkspaceAppDiscoveryOptions): Promise<WorkspaceAppDiscoveryResult>;
166
134
  export declare function discoverWorkspaceApps(workspaceRoot: string, options?: WorkspaceAppDiscoveryOptions): Promise<WorkspaceAppDiscoveryResult>;
167
135
  export declare const discoverWorkspaceAppCandidates: typeof discoverWorkspaceApps;
@@ -4,20 +4,26 @@ export { INSTALLED_APP_ENTRY, InstalledAppRefError, buildInstalledAppRef, valida
4
4
  export type { BuildInstalledAppRefInput, InstalledAppPackageFile, InstalledAppRef, InstalledAppRefErrorCode, } from './installed-app-ref.js';
5
5
  export { MAX_HTML_LENGTH, createMcpAppRegistry, createBuiltinMcpAppRegistry, buildMcpAppLocalRegistration, createMcpAppLocalRegistration, registerLocalMcpApp, createMcpAppWorkspaceRegistry, createWorkspaceAppRegistry, createWorkspaceMcpAppRegistry, registerMcpApp, resolveMcpAppResource, resolveLocalMcpAppResource, requireMcpAppResource, toMcpAppToolRegistration, makeUiUri, buildMcpAppBundleRegistrationInput, buildMcpAppBundleAgentActionDescriptors, planProductBundleLegacyToolNames, resolveMcpAppFixedResultCall, } from './registry.js';
6
6
  export { AppDiscoveryFsError, NodeAppDiscoveryFs, NodeAppDiscoveryFsAdapter, defaultAppDiscoveryFs, defaultNodeAppDiscoveryFs, deriveWorkspaceAppToolName, deriveWorkspaceAppToolNames, discoverWorkspaceAppCandidates, discoverWorkspaceApps, LOCAL_APP_TOOL_PREFIX, MCP_APP_WORKSPACE_TOOL_PREFIX, productAppBundleReservations, scanWorkspaceApps, WORKSPACE_APP_TOOL_PREFIX, } from './discovery.js';
7
+ export { loadProductAppBundleAssets } from './product-bundle-assets.js';
8
+ export type { ProductAppBundleAsset, ProductAppBundleAssetCatalog, ProductAppBundleAssetLoadOptions, } from './product-bundle-assets.js';
7
9
  export type { AppDiscoveryBytes, AppDiscoveryDiagnostic, AppDiscoveryDirectoryEntry, AppDiscoveryDirectoryEntryKind, AppDiscoveryDirectoryListing, AppDiscoveryFileSystem, AppDiscoveryFsErrorCode, AppDiscoveryMaybePromise, WorkspaceAppDiscoveryOptions as AppDiscoveryOptions, McpAppDiscoveryDiagnostic, WorkspaceAppBuiltinCatalog, WorkspaceAppCandidate, WorkspaceAppDiscoveryIncompleteReason, WorkspaceAppDiscoveryOptions, WorkspaceAppDiscoveryResult, WorkspaceAppDiagnostic, WorkspaceAppDiagnosticCode, WorkspaceAppDiscoverySource, WorkspaceAppResourceSnapshot, WorkspaceAppReservedCatalog, WorkspaceAppSource, WorkspaceAppToolNames, ProductAppBundleDefinitionIdentity, ProductAppBundleFileHash, ProductAppBundleIndex, ProductAppBundleInput, ProductAppBundlePackageIndex, ProductAppBundleReservations, ProductAppBundleProvenance, ProductAppBundleSnapshotMetadata, } from './discovery.js';
8
10
  export { createWorkspaceAppCatalog, discoverWorkspaceAppCatalog, hashAppDefinition, hashCrewxAppDefinition, listWorkspaceApps, } from './catalog.js';
9
11
  export type { CrewxAppBuiltinCatalog, CrewxAppCapability, CrewxAppCatalogOptions, CrewxAppCatalogResult, CrewxAppDefinitionHashInput, CrewxAppDefinitionSummary, CrewxAppDiagnostic, CrewxAppDiagnosticCode, CrewxAppDiagnosticSource, CrewxAppInstalledProjection, CrewxAppLocalDefinitionRef, CrewxAppOrigin, CrewxAppOwnership, CrewxAppShareability, CrewxAppSharingAvailability, CrewxAppSummary, } from './types.js';
10
12
  export { MCP_APP_PROJECTION_MAX_BYTES, buildMcpAppStateDescriptor, buildMcpAppStateProjections, buildTerminalMcpAppStateDescriptor, buildTerminalMcpAppStateProjections, createMcpAppToolResult, projectMcpAppSummaryState, serializeMcpAppStateJson, serializeMcpAppStateXml, } from './projection.js';
11
13
  export { buildMcpAppsContext } from './apps-context.js';
12
14
  export type { McpAppsContext } from './apps-context.js';
15
+ export { UI_CONTENT_ERROR_CODES, UI_CONTENT_MAX_BYTES, UI_CONTENT_MAX_LINES, UI_CONTENT_MAX_MEMORY_BYTES, UI_CONTENT_MEDIA_TYPES, UI_CONTENT_OUTPUT_TTL_MS, UI_CONTENT_TICKET_TTL_MS, UiContentChannelError, contentBindingMatches, countContentLines, decodeContentUtf8, isUiContentDeclaration, isUiContentMediaType, isUiContentRangeRequest, isValidUiAppInstanceId, isValidUiThreadIdentity, sha256Content, validateContentBytes, validateContentFrame, } from './content-channel.js';
16
+ export type { ContentFrame, UiActionContentDeclaration, UiContentBinding, UiContentChannelPort, UiContentErrorCode, UiContentInputDeclaration, UiContentInputTicket, UiContentMediaType, UiContentOutputDeclaration, UiContentRange, UiContentRangeRequest, ValidateContentFrameOptions, } from './content-channel.js';
17
+ export { buildMcpAppContentActions, contentActionsMatch, isMcpAppContentActions, } from './content-declarations.js';
18
+ export type { McpAppContentActionDeclaration, McpAppContentActions, } from './content-declarations.js';
13
19
  export { MCP_APP_MODEL_CONTEXT_MAX_ARRAY_LENGTH, MCP_APP_MODEL_CONTEXT_MAX_BYTES, MCP_APP_MODEL_CONTEXT_MAX_DEPTH, MCP_APP_MODEL_CONTEXT_MAX_STRING_LENGTH, sanitizeMcpAppModelContext, serializeMcpAppModelContextXml, } from './model-context.js';
14
20
  export type { McpAppModelContext, McpAppModelContextInput } from './model-context.js';
15
21
  export { resolveAgentAccess, listMcpAppAgentActions } from './agent-access.js';
16
22
  export type { McpAppAgentAccess, McpAppAgentAccessAction, McpAppVerifiedBundleAccessContext } from './agent-access.js';
17
23
  export { buildStateSetHandler, createStateSetHandler, } from './state-set.js';
18
24
  export type { StateSetHandlerBuildInput } from './state-set.js';
19
- export { SKILL_BACKEND_DEFAULT_TIMEOUT_MS, SKILL_BACKEND_INHERITED_ENV_ALLOWLIST, SKILL_BACKEND_MAX_INPUT_BYTES, SKILL_BACKEND_MAX_OUTPUT_BYTES, SKILL_BACKEND_SCHEMA_VERSION, buildSkillBackendChildEnvironment, buildSkillBackendHandler, buildVerifiedBundleSkillBackendHandler, } from './skill-backend.js';
20
- export type { SkillBackendChildEnvironment, SkillBackendExecutionPort, SkillBackendExecutionRequest, SkillBackendExecutionResponse, SkillBackendHandlerBuildInput, SkillBackendInfrastructureErrorCode, SkillBackendPayload, VerifiedBundleSkillBackendBuildInput, VerifiedBundleSkillRunnerPort, VerifiedBundleSkillSpawnRequest, } from './skill-backend.js';
25
+ export { SKILL_BACKEND_DEFAULT_TIMEOUT_MS, SKILL_BACKEND_INHERITED_ENV_ALLOWLIST, SKILL_BACKEND_CONTENT_SCHEMA_VERSION, SKILL_BACKEND_MAX_INPUT_BYTES, SKILL_BACKEND_MAX_OUTPUT_BYTES, SKILL_BACKEND_SCHEMA_VERSION, buildSkillBackendChildEnvironment, buildSkillBackendHandler, buildVerifiedBundleSkillBackendHandler, } from './skill-backend.js';
26
+ export type { SkillBackendChildEnvironment, SkillBackendExecutionPort, SkillBackendExecutionRequest, SkillBackendExecutionResponse, SkillBackendHandlerBuildInput, SkillBackendInfrastructureErrorCode, SkillBackendPayload, VerifiedBundleSkillBackendBuildInput, VerifiedBundleSkillRunnerPort, VerifiedBundleSkillSpawnRequest, SkillBackendPayloadV1, SkillBackendPayloadV2, SkillBackendContentInputHeader, SkillBackendContentOutputHeader, } from './skill-backend.js';
21
27
  export { externalResourceCheckItems, inspectSkillBackendOutput, scanExternalResources, } from './dev-checks.js';
22
28
  export type { AppDevCheckItem, ExternalResourceFinding, ExternalResourceKind, InspectSkillBackendOutputOptions, ScanExternalResourcesOptions, } from './dev-checks.js';
23
29
  export { MCP_APP_HOST_TOOL_ALLOWLIST, MCP_CORE_TOOL_NAMES, MCP_APP_LOCAL_RESOURCE_MIME_TYPE, MCP_APP_RESOURCE_MIME_TYPE, MCP_APP_RESOURCE_URI_PREFIX, } from './types.js';
@@ -0,0 +1,22 @@
1
+ import type { ProductAppBundleInput } from './product-bundle-loader.js';
2
+ import type { AppDiscoveryFileSystem, WorkspaceAppDiagnostic } from './discovery.js';
3
+ import type { ProductAppBundleProvenance } from './product-bundle-loader.js';
4
+ export interface ProductAppBundleAsset {
5
+ readonly sha256: string;
6
+ readonly filename: string;
7
+ readonly contentType: string;
8
+ readonly byteLength: number;
9
+ readonly provenance: ProductAppBundleProvenance;
10
+ bytes(): Uint8Array;
11
+ }
12
+ export interface ProductAppBundleAssetCatalog {
13
+ readonly indexHash?: string;
14
+ readonly complete: boolean;
15
+ readonly diagnostics: readonly WorkspaceAppDiagnostic[];
16
+ get(sha256: string, filename: string): ProductAppBundleAsset | undefined;
17
+ }
18
+ export interface ProductAppBundleAssetLoadOptions {
19
+ readonly filesystem?: AppDiscoveryFileSystem;
20
+ readonly clock?: () => number;
21
+ }
22
+ export declare function loadProductAppBundleAssets(input: ProductAppBundleInput, options?: ProductAppBundleAssetLoadOptions): Promise<ProductAppBundleAssetCatalog>;
@@ -0,0 +1,53 @@
1
+ import type { UiDefinitionLineageEntry } from '../ui-instance/lineage.js';
2
+ import type { AppDiscoveryFileSystem, WorkspaceAppDiagnostic, WorkspaceAppDiagnosticCode } from './discovery.js';
3
+ export interface ProductAppBundleReservations {
4
+ readonly appIds: readonly string[];
5
+ readonly definitionIds: readonly string[];
6
+ }
7
+ export interface ProductAppBundleInput {
8
+ readonly root: string | null;
9
+ readonly expectedIndexHash: string;
10
+ readonly reservedIds: ProductAppBundleReservations;
11
+ }
12
+ export interface ProductAppBundleProvenance {
13
+ readonly kind: 'bundled';
14
+ readonly launcher: boolean;
15
+ readonly indexHash: string;
16
+ readonly packageDir: string;
17
+ }
18
+ export interface ProductAppBundleFileHash {
19
+ readonly path: string;
20
+ readonly sha256: string;
21
+ }
22
+ export interface ProductAppBundleDefinitionIdentity {
23
+ readonly id: string;
24
+ readonly version: number;
25
+ readonly hash: string;
26
+ }
27
+ export interface ProductAppBundlePackageIndex {
28
+ readonly packageDir: string;
29
+ readonly launcher?: false;
30
+ readonly appId: string;
31
+ readonly definition: ProductAppBundleDefinitionIdentity;
32
+ readonly lineage: readonly UiDefinitionLineageEntry[];
33
+ readonly files: readonly ProductAppBundleFileHash[];
34
+ }
35
+ export interface ProductAppBundleIndex {
36
+ readonly version: 1;
37
+ readonly packages: readonly ProductAppBundlePackageIndex[];
38
+ }
39
+ export interface LoadedProductBundlePackage {
40
+ readonly indexEntry: ProductAppBundlePackageIndex;
41
+ readonly lineage?: readonly UiDefinitionLineageEntry[];
42
+ readonly files?: ReadonlyMap<string, Uint8Array>;
43
+ readonly failureCode?: WorkspaceAppDiagnosticCode;
44
+ }
45
+ export interface LoadedProductBundle {
46
+ readonly indexHash?: string;
47
+ readonly packages: readonly LoadedProductBundlePackage[];
48
+ readonly diagnostics: readonly WorkspaceAppDiagnostic[];
49
+ readonly incomplete: boolean;
50
+ readonly reservedIds: ProductAppBundleReservations;
51
+ }
52
+ export declare function productAppBundleReservations(packages: readonly ProductAppBundlePackageIndex[]): ProductAppBundleReservations;
53
+ export declare function loadProductBundle(input: ProductAppBundleInput | undefined, fs: AppDiscoveryFileSystem, startedAt: number, clock: () => number): Promise<LoadedProductBundle>;
@@ -1,28 +1,53 @@
1
- import type { JsonObject, UiExternalActionHandlerRegistration } from '../ui-instance/types.js';
1
+ import type { ContentFrame, UiContentMediaType, UiContentRangeRequest } from './content-channel.js';
2
+ import type { JsonObject, UiExternalActionHandlerRegistration, UiSkillBackendEnvironmentKey } from '../ui-instance/types.js';
2
3
  import type { UiPluginNormalizedManifestV2 } from '../ui-plugin/types.js';
3
- import type { WorkspaceAppCandidate, WorkspaceAppSource } from './discovery.js';
4
+ import type { ProductAppBundleProvenance, WorkspaceAppCandidate, WorkspaceAppSource } from './discovery.js';
4
5
  export declare const SKILL_BACKEND_SCHEMA_VERSION: 1;
6
+ export declare const SKILL_BACKEND_CONTENT_SCHEMA_VERSION: 2;
5
7
  export declare const SKILL_BACKEND_MAX_INPUT_BYTES = 524288;
6
8
  export declare const SKILL_BACKEND_MAX_OUTPUT_BYTES = 524288;
7
9
  export declare const SKILL_BACKEND_DEFAULT_TIMEOUT_MS = 15000;
8
10
  export declare const SKILL_BACKEND_INHERITED_ENV_ALLOWLIST: readonly ["CREWX_HOME", "CREWX_DB", "XDG_CONFIG_HOME"];
9
11
  export type SkillBackendInfrastructureErrorCode = 'EXEC_DENIED' | 'EXEC_TIMEOUT' | 'EXEC_OUTPUT_INVALID' | 'EXECUTION_FAILED' | 'ACTION_IN_FLIGHT' | 'INPUT_INVALID';
10
- export interface SkillBackendPayload {
12
+ export interface SkillBackendPayloadV1 {
11
13
  readonly schemaVersion: typeof SKILL_BACKEND_SCHEMA_VERSION;
12
14
  readonly actionId: string;
13
15
  readonly input: JsonObject;
14
16
  readonly state: JsonObject;
15
17
  }
18
+ export interface SkillBackendContentInputHeader {
19
+ readonly mediaType: UiContentMediaType;
20
+ readonly bytes: number;
21
+ readonly sha256: string;
22
+ readonly lines: number;
23
+ }
24
+ export interface SkillBackendContentOutputHeader {
25
+ readonly mediaType: UiContentMediaType;
26
+ readonly range: UiContentRangeRequest | null;
27
+ }
28
+ export interface SkillBackendPayloadV2 {
29
+ readonly schemaVersion: typeof SKILL_BACKEND_CONTENT_SCHEMA_VERSION;
30
+ readonly actionId: string;
31
+ readonly input: JsonObject;
32
+ readonly state: JsonObject;
33
+ readonly content: {
34
+ readonly in: SkillBackendContentInputHeader | null;
35
+ readonly out: SkillBackendContentOutputHeader | null;
36
+ };
37
+ }
38
+ export type SkillBackendPayload = SkillBackendPayloadV1 | SkillBackendPayloadV2;
16
39
  export type SkillBackendExecutionResponse = {
17
40
  readonly state?: JsonObject;
18
41
  readonly result?: JsonObject;
42
+ readonly content?: ContentFrame;
19
43
  } | {
20
44
  readonly outcome: 'rejected' | 'failed';
21
45
  readonly errorCode: string;
22
46
  readonly state?: JsonObject;
23
47
  readonly result?: JsonObject;
48
+ readonly content?: ContentFrame;
24
49
  };
25
- export interface SkillBackendExecutionRequest {
50
+ interface SkillBackendExecutionRequestBase {
26
51
  readonly requestId?: string;
27
52
  readonly reservationNowMs?: number;
28
53
  readonly actorKind?: 'user' | 'agent';
@@ -32,11 +57,25 @@ export interface SkillBackendExecutionRequest {
32
57
  readonly definitionVersion: number;
33
58
  readonly definitionHash: string;
34
59
  readonly actionId: string;
35
- readonly source: WorkspaceAppSource;
36
60
  readonly relativePath: string;
37
61
  readonly command: readonly string[];
38
62
  readonly payload: SkillBackendPayload;
63
+ readonly content?: {
64
+ readonly in?: ContentFrame;
65
+ readonly out?: {
66
+ readonly mediaType: UiContentMediaType;
67
+ readonly range?: UiContentRangeRequest;
68
+ };
69
+ };
70
+ readonly environment?: Readonly<Partial<Record<UiSkillBackendEnvironmentKey, string>>>;
39
71
  }
72
+ export type SkillBackendExecutionRequest = SkillBackendExecutionRequestBase & ({
73
+ readonly source: 'bundled';
74
+ readonly provenance: ProductAppBundleProvenance;
75
+ } | {
76
+ readonly source: WorkspaceAppSource;
77
+ readonly provenance?: never;
78
+ });
40
79
  export interface SkillBackendExecutionPort {
41
80
  execute(request: SkillBackendExecutionRequest): PromiseLike<SkillBackendExecutionResponse>;
42
81
  }
@@ -72,14 +111,23 @@ export interface VerifiedBundleSkillBackendBuildInput {
72
111
  readonly executableRelativePath: string;
73
112
  readonly runner: VerifiedBundleSkillRunnerPort;
74
113
  }
75
- export interface SkillBackendHandlerBuildInput {
114
+ interface SkillBackendHandlerBuildInputBase {
76
115
  readonly normalized: UiPluginNormalizedManifestV2;
77
116
  readonly actionId: string;
78
- readonly source: WorkspaceAppSource;
79
117
  readonly relativePath: string;
80
118
  readonly execute: SkillBackendExecutionPort;
81
119
  readonly definitionHash?: string;
82
120
  }
121
+ export type SkillBackendHandlerBuildInput = SkillBackendHandlerBuildInputBase & ({
122
+ readonly source: 'bundled';
123
+ readonly provenance: ProductAppBundleProvenance;
124
+ readonly candidate: WorkspaceAppCandidate;
125
+ } | {
126
+ readonly source: WorkspaceAppSource;
127
+ readonly provenance?: never;
128
+ readonly candidate?: never;
129
+ });
83
130
  export declare function buildSkillBackendHandler(normalized: UiPluginNormalizedManifestV2, actionId: string, source: WorkspaceAppSource, relativePath: string, execute: SkillBackendExecutionPort): UiExternalActionHandlerRegistration | undefined;
84
131
  export declare function buildSkillBackendHandler(input: SkillBackendHandlerBuildInput): UiExternalActionHandlerRegistration | undefined;
85
132
  export declare function buildVerifiedBundleSkillBackendHandler(input: VerifiedBundleSkillBackendBuildInput): UiExternalActionHandlerRegistration | undefined;
133
+ export {};