@crewx/sdk 0.9.0-rc.127 → 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.
- package/dist/esm/index.js +354 -330
- package/dist/esm/plugins/index.js +35 -33
- package/dist/esm/publish/index.js +2 -2
- package/dist/esm/repository/index.js +43 -41
- package/dist/esm/skills/index.js +2 -1
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +5 -5
- package/dist/index.d.ts +7 -3
- package/dist/index.js +349 -325
- package/dist/mcp-app/agent-access.d.ts +1 -0
- package/dist/mcp-app/bundle-provenance.d.ts +2 -1
- package/dist/mcp-app/content-channel.d.ts +89 -0
- package/dist/mcp-app/content-declarations.d.ts +29 -0
- package/dist/mcp-app/dev-checks.d.ts +1 -0
- package/dist/mcp-app/discovery.d.ts +11 -28
- package/dist/mcp-app/index.d.ts +10 -4
- package/dist/mcp-app/product-bundle-assets.d.ts +22 -0
- package/dist/mcp-app/product-bundle-loader.d.ts +53 -0
- package/dist/mcp-app/skill-backend.d.ts +55 -7
- package/dist/mcp-app/types.d.ts +3 -1
- package/dist/mcp-app/workspace-snapshot.d.ts +4 -1
- package/dist/plugins/index.js +35 -33
- package/dist/publish/index.js +2 -2
- package/dist/repository/index.d.ts +1 -0
- package/dist/repository/index.js +43 -41
- package/dist/repository/thread.repository.d.ts +19 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/index.js +2 -1
- package/dist/ui-instance/errors.d.ts +2 -1
- package/dist/ui-instance/index.d.ts +1 -1
- package/dist/ui-instance/store.d.ts +5 -0
- package/dist/ui-instance/types.d.ts +24 -0
- package/dist/ui-plugin/csp.d.ts +25 -0
- package/dist/ui-plugin/types.d.ts +7 -0
- package/package.json +2 -1
|
@@ -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,42 +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
|
|
9
|
-
readonly root: string;
|
|
10
|
-
readonly expectedIndexHash: string;
|
|
11
|
-
}
|
|
12
|
-
export interface ProductAppBundleProvenance {
|
|
13
|
-
readonly kind: 'bundled';
|
|
14
|
-
readonly indexHash: string;
|
|
15
|
-
readonly packageDir: string;
|
|
11
|
+
export interface ProductAppBundleProvenance extends LoadedProductAppBundleProvenance {
|
|
16
12
|
readonly appId: string;
|
|
17
13
|
readonly definitionId: string;
|
|
18
14
|
readonly version: number;
|
|
19
15
|
readonly definitionHash: string;
|
|
20
16
|
readonly files: readonly ProductAppBundleFileHash[];
|
|
21
17
|
}
|
|
22
|
-
export interface ProductAppBundleFileHash {
|
|
23
|
-
readonly path: string;
|
|
24
|
-
readonly sha256: string;
|
|
25
|
-
}
|
|
26
|
-
export interface ProductAppBundleDefinitionIdentity {
|
|
27
|
-
readonly id: string;
|
|
28
|
-
readonly version: number;
|
|
29
|
-
readonly hash: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ProductAppBundlePackageIndex {
|
|
32
|
-
readonly packageDir: string;
|
|
33
|
-
readonly appId: string;
|
|
34
|
-
readonly definition: ProductAppBundleDefinitionIdentity;
|
|
35
|
-
readonly lineage: readonly UiDefinitionLineageEntry[];
|
|
36
|
-
readonly files: readonly ProductAppBundleFileHash[];
|
|
37
|
-
}
|
|
38
|
-
export interface ProductAppBundleIndex {
|
|
39
|
-
readonly version: 1;
|
|
40
|
-
readonly packages: readonly ProductAppBundlePackageIndex[];
|
|
41
|
-
}
|
|
42
18
|
export type WorkspaceAppDiscoveryIncompleteReason = 'time_limit';
|
|
43
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';
|
|
44
20
|
export interface WorkspaceAppDiagnostic {
|
|
@@ -47,6 +23,12 @@ export interface WorkspaceAppDiagnostic {
|
|
|
47
23
|
readonly source: WorkspaceAppDiscoverySource;
|
|
48
24
|
readonly relativePath: string;
|
|
49
25
|
}
|
|
26
|
+
export interface ProductAppBundleSnapshotMetadata {
|
|
27
|
+
readonly indexHash?: string;
|
|
28
|
+
readonly diagnostics: readonly WorkspaceAppDiagnostic[];
|
|
29
|
+
readonly reservedAppIds: readonly string[];
|
|
30
|
+
readonly reservedDefinitionIds: readonly string[];
|
|
31
|
+
}
|
|
50
32
|
export type McpAppDiscoveryDiagnostic = WorkspaceAppDiagnostic;
|
|
51
33
|
export type AppDiscoveryDiagnostic = WorkspaceAppDiagnostic;
|
|
52
34
|
export type AppDiscoveryDirectoryEntryKind = 'file' | 'directory' | 'symlink' | 'other';
|
|
@@ -140,6 +122,7 @@ export interface WorkspaceAppDiscoveryResult {
|
|
|
140
122
|
readonly complete: boolean;
|
|
141
123
|
readonly incompleteReason?: WorkspaceAppDiscoveryIncompleteReason;
|
|
142
124
|
readonly productBundleIndexHash?: string;
|
|
125
|
+
readonly productBundleSnapshotMetadata?: ProductAppBundleSnapshotMetadata;
|
|
143
126
|
readonly candidates?: readonly WorkspaceAppCandidate[];
|
|
144
127
|
}
|
|
145
128
|
export declare const WORKSPACE_APP_TOOL_PREFIX = "crewx_local_app_";
|
package/dist/mcp-app/index.d.ts
CHANGED
|
@@ -3,21 +3,27 @@ export { McpAppContractError } from './errors.js';
|
|
|
3
3
|
export { INSTALLED_APP_ENTRY, InstalledAppRefError, buildInstalledAppRef, validateInstalledAppRef, } from './installed-app-ref.js';
|
|
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
|
-
export { AppDiscoveryFsError, NodeAppDiscoveryFs, NodeAppDiscoveryFsAdapter, defaultAppDiscoveryFs, defaultNodeAppDiscoveryFs, deriveWorkspaceAppToolName, deriveWorkspaceAppToolNames, discoverWorkspaceAppCandidates, discoverWorkspaceApps, LOCAL_APP_TOOL_PREFIX, MCP_APP_WORKSPACE_TOOL_PREFIX, scanWorkspaceApps, WORKSPACE_APP_TOOL_PREFIX, } from './discovery.js';
|
|
7
|
-
export
|
|
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';
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 {};
|
package/dist/mcp-app/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { JsonObject, UiDefinition, UiDefinitionRef, UiDefinitionDisplayMode, UiDefinitionUsage, UiProjectionPolicy, UiInstance, UiInstanceStatus, UiActionConfirmation, UiActionHandlerRegistration } from '../ui-instance/types.js';
|
|
2
|
-
import type { AppDiscoveryFileSystem, ProductAppBundleInput, ProductAppBundleProvenance } from './discovery.js';
|
|
2
|
+
import type { AppDiscoveryFileSystem, ProductAppBundleInput, ProductAppBundleProvenance, ProductAppBundleSnapshotMetadata } from './discovery.js';
|
|
3
3
|
export declare const MCP_APP_RESOURCE_MIME_TYPE: "text/html;profile=mcp-app";
|
|
4
4
|
export declare const MCP_APP_RESOURCE_URI_PREFIX = "ui://crewx/";
|
|
5
5
|
export type McpAppToolVisibility = 'model' | 'app';
|
|
@@ -167,6 +167,7 @@ export interface McpAppLocalRegistration {
|
|
|
167
167
|
readonly tone?: McpAppTone;
|
|
168
168
|
readonly builtinOnly: false;
|
|
169
169
|
readonly definition: UiDefinition;
|
|
170
|
+
readonly provenance?: ProductAppBundleProvenance;
|
|
170
171
|
readonly resourceBinding: McpAppInstanceResourceBinding;
|
|
171
172
|
readonly resource: McpAppLocalResource;
|
|
172
173
|
readonly tools: readonly McpAppLocalToolDescriptor[];
|
|
@@ -436,6 +437,7 @@ export type CrewxAppBuiltinCatalog = Pick<McpAppRegistry, 'listMcpApps' | 'listM
|
|
|
436
437
|
export interface CrewxAppCatalogOptions {
|
|
437
438
|
readonly filesystem?: AppDiscoveryFileSystem;
|
|
438
439
|
readonly productBundle?: ProductAppBundleInput;
|
|
440
|
+
readonly registeredProductBundle?: ProductAppBundleSnapshotMetadata;
|
|
439
441
|
readonly builtinCatalog?: CrewxAppBuiltinCatalog;
|
|
440
442
|
readonly installed?: readonly CrewxAppInstalledProjection[];
|
|
441
443
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { type AppDiscoveryFileSystem, type WorkspaceAppDiscoveryIncompleteReason, type WorkspaceAppDiagnostic, type WorkspaceAppDiscoveryOptions, type WorkspaceAppDiscoveryResult, type WorkspaceAppSource, type ProductAppBundleProvenance } from './discovery.js';
|
|
1
|
+
import { type AppDiscoveryFileSystem, type WorkspaceAppDiscoveryIncompleteReason, type WorkspaceAppDiagnostic, type WorkspaceAppDiscoveryOptions, type WorkspaceAppDiscoveryResult, type WorkspaceAppSource, type ProductAppBundleProvenance, type ProductAppBundleSnapshotMetadata } from './discovery.js';
|
|
2
2
|
import { type SkillBackendExecutionPort } from './skill-backend.js';
|
|
3
3
|
import type { JsonObject, UiActionHandlerRegistration, UiDefinition, UiDefinitionRef } from '../ui-instance/types.js';
|
|
4
|
+
import type { UiPluginManifestV2 } from '../ui-plugin/types.js';
|
|
4
5
|
import type { McpAppLauncher, McpAppLocalResource, McpAppRegistry, McpAppWorkspaceRegistry } from './types.js';
|
|
5
6
|
export interface WorkspaceAppSnapshotResource extends McpAppLocalResource {
|
|
6
7
|
readonly appId: string;
|
|
7
8
|
readonly definition: UiDefinitionRef;
|
|
9
|
+
readonly runtime?: NonNullable<UiPluginManifestV2['runtime']>;
|
|
8
10
|
readonly source?: WorkspaceAppSource;
|
|
9
11
|
readonly provenance?: ProductAppBundleProvenance;
|
|
10
12
|
}
|
|
@@ -20,6 +22,7 @@ export interface WorkspaceAppSnapshotBuildOptions {
|
|
|
20
22
|
readonly builtins?: McpAppRegistry;
|
|
21
23
|
readonly builtin?: McpAppRegistry;
|
|
22
24
|
readonly registry?: McpAppRegistry;
|
|
25
|
+
readonly registeredProductBundle?: ProductAppBundleSnapshotMetadata;
|
|
23
26
|
readonly skillBackend?: SkillBackendExecutionPort;
|
|
24
27
|
}
|
|
25
28
|
export type WorkspaceAppSnapshotOptions = WorkspaceAppDiscoveryOptions & WorkspaceAppSnapshotBuildOptions;
|