@crewx/sdk 0.9.0-rc.11 → 0.9.0-rc.111
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 +1 -1
- package/dist/account/auth-client.d.ts +61 -0
- package/dist/account/auth-json-v2.d.ts +1 -0
- package/dist/account/auth-json.d.ts +30 -0
- package/dist/account/config.d.ts +37 -0
- package/dist/account/env-bootstrap.d.ts +5 -0
- package/dist/account/errors.d.ts +24 -0
- package/dist/account/index.d.ts +12 -0
- package/dist/account/index.js +2 -0
- package/dist/account/session-manager.d.ts +47 -0
- package/dist/activity-log/builder.d.ts +56 -6
- package/dist/agent/agent-list-view.d.ts +19 -0
- package/dist/boxing/box.types.d.ts +4 -0
- package/dist/config/canonicalize-agent-options.d.ts +17 -0
- package/dist/config/default-agent-models.d.ts +11 -0
- package/dist/config/global-settings.d.ts +33 -0
- package/dist/config/migrate-grok-mode.d.ts +6 -0
- package/dist/config/model-compat.d.ts +31 -0
- package/dist/config/models.generated.d.ts +37 -0
- package/dist/config/models.remote.d.ts +1 -0
- package/dist/config/overdrive.d.ts +7 -0
- package/dist/config/pricing.d.ts +7 -3
- package/dist/config/pricing.generated.d.ts +4 -0
- package/dist/config/pricing.types.d.ts +4 -10
- package/dist/config/timeout.config.d.ts +4 -0
- package/dist/config/wi-boards.d.ts +19 -0
- package/dist/context-budget/continuity.d.ts +61 -0
- package/dist/context-budget/index.d.ts +141 -0
- package/dist/conversation/index.d.ts +1 -1
- package/dist/conversation/sqlite-provider.d.ts +6 -2
- package/dist/conversation/to-template-messages.d.ts +9 -0
- package/dist/conversation/types.d.ts +47 -1
- package/dist/desktop/command-runner.d.ts +4 -0
- package/dist/desktop/default-adapters.d.ts +4 -0
- package/dist/desktop/global-install.d.ts +19 -0
- package/dist/desktop/index.d.ts +3 -0
- package/dist/desktop/index.js +3 -0
- package/dist/desktop/install.d.ts +5 -0
- package/dist/desktop/lnk.d.ts +22 -0
- package/dist/desktop/manifest.d.ts +21 -0
- package/dist/desktop/types.d.ts +67 -0
- package/dist/desktop/version.d.ts +1 -0
- package/dist/desktop/windows-paths.d.ts +21 -0
- package/dist/desktop/wrapper.d.ts +18 -0
- package/dist/esm/account/index.js +2 -0
- package/dist/esm/desktop/index.js +3 -0
- package/dist/esm/index.js +700 -183
- package/dist/esm/plugins/index.js +302 -180
- package/dist/esm/process/index.js +1 -0
- package/dist/esm/publish/index.js +2 -0
- package/dist/esm/repository/index.js +370 -170
- package/dist/esm/skills/index.js +1 -0
- package/dist/esm/testing/index.js +1 -1
- package/dist/events/types.d.ts +9 -0
- package/dist/facade/Crewx.d.ts +54 -4
- package/dist/highlight/thread-highlight-prompt.d.ts +2 -0
- package/dist/highlight/thread-highlighter.d.ts +326 -0
- package/dist/index.browser.d.ts +14 -1
- package/dist/index.browser.js +6 -2
- package/dist/index.d.ts +108 -15
- package/dist/index.js +700 -183
- package/dist/internal/console-decoder.d.ts +38 -0
- package/dist/internal/windows-spawn.d.ts +10 -0
- package/dist/layout/types.d.ts +18 -1
- package/dist/lifecycle/process-lease.d.ts +80 -0
- package/dist/lifecycle/task-heartbeat.d.ts +41 -0
- package/dist/lifecycle/task-stop.d.ts +82 -0
- package/dist/lifecycle/update-admission.d.ts +44 -0
- package/dist/local-server/base-url.d.ts +18 -0
- package/dist/local-server/index.d.ts +8 -0
- package/dist/local-server/opencode.d.ts +8 -0
- package/dist/local-server/probe.d.ts +3 -0
- package/dist/local-server/runtime.d.ts +26 -0
- package/dist/local-server/types.d.ts +43 -0
- package/dist/mcp-app/apps-context.d.ts +5 -0
- package/dist/mcp-app/catalog.d.ts +7 -0
- package/dist/mcp-app/discovery.d.ts +105 -0
- package/dist/mcp-app/errors.d.ts +7 -0
- package/dist/mcp-app/index.d.ts +18 -0
- package/dist/mcp-app/installed-app-ref.d.ts +25 -0
- package/dist/mcp-app/node-app-discovery-fs.d.ts +20 -0
- package/dist/mcp-app/projection.d.ts +13 -0
- package/dist/mcp-app/registry.d.ts +19 -0
- package/dist/mcp-app/state-set.d.ts +9 -0
- package/dist/mcp-app/types.d.ts +362 -0
- package/dist/mcp-app/workspace-snapshot.d.ts +53 -0
- package/dist/migrations/0008_careful_black_bird.sql +17 -0
- package/dist/migrations/0009_hot_dark_phoenix.sql +1 -0
- package/dist/migrations/0010_analyze_stats.sql +6 -0
- package/dist/migrations/0011_far_black_tarantula.sql +1 -0
- package/dist/migrations/0012_blue_turbo.sql +23 -0
- package/dist/migrations/0013_hesitant_adam_destine.sql +15 -0
- package/dist/migrations/0014_organic_mongu.sql +73 -0
- package/dist/migrations/0015_panoramic_gorilla_man.sql +71 -0
- package/dist/migrations/0016_fuzzy_hemingway.sql +14 -0
- package/dist/migrations/0017_project_stage_sdk_migration.sql +29 -0
- package/dist/migrations/0018_bored_jackal.sql +33 -0
- package/dist/migrations/0019_backfill_task_thread_ids.sql +74 -0
- package/dist/migrations/0020_useful_iron_lad.sql +55 -0
- package/dist/migrations/0021_dashing_peter_quill.sql +51 -0
- package/dist/migrations/0022_wandering_bucky.sql +1 -0
- package/dist/migrations/0023_red_payback.sql +1 -0
- package/dist/migrations/0024_storage_metadata.sql +262 -0
- package/dist/migrations/0025_task_heartbeat.sql +8 -0
- package/dist/migrations/0025_thread_app_instance_ledger.sql +2 -0
- package/dist/migrations/0026_mcp_action_source.sql +47 -0
- package/dist/migrations/0027_task_stop_scope_cleanup.sql +5 -0
- package/dist/migrations/0027_ui_instance_active_unique.sql +2 -0
- package/dist/migrations/0029_nice_rhino.sql +1 -0
- package/dist/migrations/0031_petite_arclight.sql +6 -0
- package/dist/migrations/meta/0008_snapshot.json +1327 -0
- package/dist/migrations/meta/0009_snapshot.json +1335 -0
- package/dist/migrations/meta/0010_snapshot.json +1335 -0
- package/dist/migrations/meta/0011_snapshot.json +1342 -0
- package/dist/migrations/meta/0012_snapshot.json +1494 -0
- package/dist/migrations/meta/0013_snapshot.json +1592 -0
- package/dist/migrations/meta/0014_snapshot.json +1975 -0
- package/dist/migrations/meta/0015_snapshot.json +2315 -0
- package/dist/migrations/meta/0016_snapshot.json +2419 -0
- package/dist/migrations/meta/0017_snapshot.json +2419 -0
- package/dist/migrations/meta/0018_snapshot.json +2570 -0
- package/dist/migrations/meta/0020_snapshot.json +2895 -0
- package/dist/migrations/meta/0021_snapshot.json +3031 -0
- package/dist/migrations/meta/0022_snapshot.json +3039 -0
- package/dist/migrations/meta/0023_snapshot.json +3047 -0
- package/dist/migrations/meta/0029_snapshot.json +3206 -0
- package/dist/migrations/meta/0031_snapshot.json +3251 -0
- package/dist/migrations/meta/_journal.json +168 -0
- package/dist/paths.d.ts +1 -0
- package/dist/plugin/types.d.ts +1 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +302 -180
- package/dist/plugins/sqlite-tracing.d.ts +46 -0
- package/dist/process/index.d.ts +2 -0
- package/dist/process/index.js +1 -0
- package/dist/process/process-control.d.ts +41 -0
- package/dist/prompt/tag-names.d.ts +20 -0
- package/dist/provider/acp/connection.d.ts +6 -0
- package/dist/provider/acp/meta.d.ts +11 -0
- package/dist/provider/bridge.d.ts +7 -1
- package/dist/provider/classify-task-error.d.ts +2 -0
- package/dist/provider/cli/adapter.types.d.ts +9 -1
- package/dist/provider/cli/adapters/agent-call.util.d.ts +1 -1
- package/dist/provider/cli/adapters/cli-knob.util.d.ts +7 -0
- package/dist/provider/cli/adapters/event-timestamp.util.d.ts +1 -0
- package/dist/provider/cli/adapters/grok.d.ts +2 -0
- package/dist/provider/cli/adapters/index.d.ts +1 -0
- package/dist/provider/cli/index.d.ts +1 -1
- package/dist/provider/cli/meta.d.ts +5 -0
- package/dist/provider/cli/protocol-envelope.d.ts +2 -0
- package/dist/provider/errors.d.ts +5 -1
- package/dist/provider/idle-watchdog.d.ts +19 -0
- package/dist/provider/models.d.ts +17 -12
- package/dist/provider/order.d.ts +1 -1
- package/dist/provider/parse-usage.d.ts +6 -0
- package/dist/provider/provider-selection.d.ts +8 -0
- package/dist/provider/redact-technical-message.d.ts +1 -0
- package/dist/provider/task-error.types.d.ts +17 -0
- package/dist/publish/constants.d.ts +6 -0
- package/dist/publish/errors.d.ts +7 -0
- package/dist/publish/index.d.ts +50 -0
- package/dist/publish/index.js +2 -0
- package/dist/publish/manifest.d.ts +47 -0
- package/dist/publish/marketplace-api.constants.d.ts +1 -0
- package/dist/publish/pack.d.ts +6 -0
- package/dist/publish/scan.d.ts +9 -0
- package/dist/publish/secrets.d.ts +6 -0
- package/dist/publish/upload.d.ts +19 -0
- package/dist/remote/execution-profile.d.ts +9 -0
- package/dist/remote/index.d.ts +1 -0
- package/dist/remote/types.d.ts +28 -0
- package/dist/repository/agent-suggestion.repository.d.ts +34 -0
- package/dist/repository/base-sqlite-repository.d.ts +1 -0
- package/dist/repository/common-code.repository.d.ts +45 -0
- package/dist/repository/db.d.ts +12 -1
- package/dist/repository/index.d.ts +38 -5
- package/dist/repository/index.js +370 -170
- package/dist/repository/notification.repository.d.ts +58 -0
- package/dist/repository/project.repository.d.ts +90 -0
- package/dist/repository/request-log.repository.d.ts +1 -0
- package/dist/repository/storage-metadata.repository.d.ts +64 -0
- package/dist/repository/task-log-migration.d.ts +74 -0
- package/dist/repository/task-log.repository.d.ts +44 -0
- package/dist/repository/task-status.d.ts +14 -0
- package/dist/repository/task.repository.d.ts +246 -7
- package/dist/repository/thread-history.repository.d.ts +193 -0
- package/dist/repository/thread-title.types.d.ts +29 -0
- package/dist/repository/thread.repository.d.ts +47 -5
- package/dist/repository/usage-backfill.d.ts +62 -0
- package/dist/repository/usage-from-logs.d.ts +21 -0
- package/dist/repository/usage-report.repository.d.ts +27 -0
- package/dist/repository/workspace.repository.d.ts +3 -0
- package/dist/schema/agent-suggestions.d.ts +199 -0
- package/dist/schema/common-codes.d.ts +216 -0
- package/dist/schema/index.d.ts +10 -0
- package/dist/schema/notifications.d.ts +303 -0
- package/dist/schema/projects.d.ts +610 -0
- package/dist/schema/storage-metadata.d.ts +181 -0
- package/dist/schema/task-log-events.d.ts +119 -0
- package/dist/schema/tasks.d.ts +165 -0
- package/dist/schema/thread-history.d.ts +734 -0
- package/dist/schema/threads.d.ts +59 -0
- package/dist/schema/ui-action-receipts.d.ts +303 -0
- package/dist/schema/ui-instances.d.ts +286 -0
- package/dist/schema/usage-reports.d.ts +252 -0
- package/dist/schema/workspaces.d.ts +17 -0
- package/dist/skills/index.d.ts +7 -0
- package/dist/skills/index.js +1 -0
- package/dist/skills/types.d.ts +18 -0
- package/dist/task-log/anchor-child-tasks.d.ts +7 -0
- package/dist/task-log/delegation-trailer.d.ts +34 -0
- package/dist/template/engine.d.ts +2 -2
- package/dist/template/helpers/exec.browser.d.ts +4 -3
- package/dist/template/helpers/exec.d.ts +4 -3
- package/dist/template/types.d.ts +20 -0
- package/dist/testing/index.js +1 -1
- package/dist/types/index.d.ts +1569 -3
- package/dist/types/task-log.types.d.ts +2 -0
- package/dist/ui-card/index.d.ts +2 -0
- package/dist/ui-card/legacy-card-parser.d.ts +11 -0
- package/dist/ui-instance/definition.d.ts +6 -0
- package/dist/ui-instance/errors.d.ts +17 -0
- package/dist/ui-instance/index.d.ts +9 -0
- package/dist/ui-instance/json.d.ts +5 -0
- package/dist/ui-instance/runtime.d.ts +18 -0
- package/dist/ui-instance/store.d.ts +99 -0
- package/dist/ui-instance/types.d.ts +213 -0
- package/dist/ui-plugin/index.d.ts +4 -0
- package/dist/ui-plugin/limits.d.ts +27 -0
- package/dist/ui-plugin/manifest.d.ts +3 -0
- package/dist/ui-plugin/types.d.ts +174 -0
- package/dist/ui-plugin/validator.d.ts +15 -0
- package/dist/utils/crewx-executable.d.ts +54 -0
- package/dist/utils/crewx-home.d.ts +1 -0
- package/dist/utils/env-defaults.d.ts +2 -0
- package/dist/utils/id.d.ts +1 -1
- package/dist/utils/runner-env.d.ts +3 -0
- package/dist/utils/timestamp.d.ts +1 -0
- package/dist/utils/workspace.d.ts +1 -0
- package/dist/wi/create.d.ts +48 -0
- package/dist/wi/select.d.ts +20 -0
- package/package.json +40 -2
- package/templates/agents/default.yaml +269 -127
- package/templates/documents/crewx-manual.md +138 -138
- package/templates/documents/crewx-quick-guide.md +1 -1
- package/templates/workflows/wi-default-flow.yaml +65 -0
- package/templates/workflows/wi-plan-flow.yaml +140 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DelegationResult } from '../task-log/delegation-trailer.js';
|
|
1
2
|
export type TaskLogEntryType = 'text' | 'thinking' | 'tool_use' | 'tool_result' | 'error' | 'info' | 'running_instruction' | 'agent_call';
|
|
2
3
|
export interface TaskLogEntry {
|
|
3
4
|
timestamp: string;
|
|
@@ -8,6 +9,7 @@ export interface TaskLogEntry {
|
|
|
8
9
|
toolUseId?: string;
|
|
9
10
|
resultPreview?: string;
|
|
10
11
|
isError?: boolean;
|
|
12
|
+
delegationResult?: DelegationResult | null;
|
|
11
13
|
targetAgent?: string;
|
|
12
14
|
targetTaskId?: string;
|
|
13
15
|
errorMessage?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LegacyUiCardTag {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
raw: string;
|
|
5
|
+
closed: boolean;
|
|
6
|
+
attrs: Readonly<Record<string, string>>;
|
|
7
|
+
privileged: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function scanLegacyUiCardAt(text: string, start: number): LegacyUiCardTag;
|
|
10
|
+
export declare function scanLegacyUiCardTags(text: string): LegacyUiCardTag[];
|
|
11
|
+
export declare function extractLegacyWorkflowRunId(text: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UiDefinition, UiDefinitionInput, UiDefinitionRef } from './types.js';
|
|
2
|
+
export declare function hashUiDefinition(input: UiDefinitionInput): string;
|
|
3
|
+
export declare function definitionKey(ref: UiDefinitionRef): string;
|
|
4
|
+
export declare function validateDefinition(definition: UiDefinition): void;
|
|
5
|
+
export declare function isExactCapability(value: string): boolean;
|
|
6
|
+
export declare function refFromDefinition(definition: UiDefinition): UiDefinitionRef;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type UiRuntimeErrorCode = 'UNAUTHENTICATED' | 'INSTANCE_NOT_FOUND' | 'WORKSPACE_MISMATCH' | 'INSTANCE_NOT_ACTIONABLE' | 'DEFINITION_UNSUPPORTED' | 'CAPABILITY_DENIED' | 'INPUT_INVALID' | 'REVISION_CONFLICT' | 'ACTION_UNAVAILABLE' | 'HANDLER_NOT_FOUND' | 'ACTION_IN_FLIGHT' | 'DOMAIN_REJECTED' | 'EXECUTION_FAILED';
|
|
2
|
+
export declare class UiRuntimeError extends Error {
|
|
3
|
+
readonly code: UiRuntimeErrorCode;
|
|
4
|
+
readonly currentRevision?: number | undefined;
|
|
5
|
+
readonly name = "UiRuntimeError";
|
|
6
|
+
constructor(code: UiRuntimeErrorCode, message?: string, currentRevision?: number | undefined);
|
|
7
|
+
}
|
|
8
|
+
export declare class UiRetryableDatabaseError extends Error {
|
|
9
|
+
readonly cause: unknown;
|
|
10
|
+
readonly name = "UiRetryableDatabaseError";
|
|
11
|
+
constructor(cause: unknown);
|
|
12
|
+
}
|
|
13
|
+
export declare class UiReservationConflictError extends Error {
|
|
14
|
+
readonly currentRevision: number;
|
|
15
|
+
readonly name = "UiReservationConflictError";
|
|
16
|
+
constructor(currentRevision: number);
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { ActionReceipt, ActionReceiptOutcome, CreateUiInstanceInput, JsonObject, JsonPrimitive, JsonValue, UiActionHandlerContext, UiActionHandlerRegistration, UiActionHandlerResult, UiActionEnvelope, UiActionConfirmation, UiActor, UiDefinition, UiDefinitionAction, UiDefinitionDisplayMode, UiDefinitionInput, UiDefinitionRef, UiDefinitionUsage, UiProjectionPolicy, UiExecutionContext, UiAuthenticatedActor, UiAuthenticatedExecutionContext, UiAuthenticatedGrantPolicy, UiServerRuntimeFacade, UiServerRuntimeOptions, UiAgentContextProjection, UiExternalActionHandlerRegistration, UiInstance, UiInstanceStatus, UiLocalGrantPolicy, UiRuntimeFacade, UiRuntimeOptions, UiStateActionHandlerRegistration, } from './types.js';
|
|
2
|
+
export { resolveUiEffectiveCapabilities } from './types.js';
|
|
3
|
+
export { UiRuntimeError } from './errors.js';
|
|
4
|
+
export type { UiRuntimeErrorCode } from './errors.js';
|
|
5
|
+
export { projectSafeJsonObject } from './json.js';
|
|
6
|
+
export { hashUiDefinition } from './definition.js';
|
|
7
|
+
export { UiInstanceStore, openUiInstanceReadStore } from './store.js';
|
|
8
|
+
export type { UiAuditSnapshotInput, UiInstanceReadStore } from './store.js';
|
|
9
|
+
export { createUiRuntimeForTest, createUiServerRuntime } from './runtime.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from './types.js';
|
|
2
|
+
export declare function projectSafeJsonObject(value: unknown, envelopeDepth?: number): JsonObject;
|
|
3
|
+
export declare function serializeJson(value: JsonValue): string;
|
|
4
|
+
export declare function canonicalJson(value: JsonValue): string;
|
|
5
|
+
export declare function utf8ByteLength(value: string): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UiRuntimeFacade, UiRuntimeOptions, UiServerRuntimeFacade, UiServerRuntimeOptions } from './types.js';
|
|
2
|
+
import { UiInstanceStore } from './store.js';
|
|
3
|
+
export interface UiRuntimeTestHooks {
|
|
4
|
+
beforeReservation?: () => Promise<void> | void;
|
|
5
|
+
injectDatabaseError?: () => unknown | undefined;
|
|
6
|
+
bumpRevisionBeforeCas?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UiRuntimeForTestOptions extends UiRuntimeOptions {
|
|
9
|
+
workspaceId: string;
|
|
10
|
+
testHooks?: UiRuntimeTestHooks;
|
|
11
|
+
store?: UiInstanceStore;
|
|
12
|
+
}
|
|
13
|
+
export interface UiRuntimeStoreOptions {
|
|
14
|
+
readonly store?: UiInstanceStore;
|
|
15
|
+
}
|
|
16
|
+
export declare function createUiRuntime(workspaceId: string, options: UiRuntimeOptions & UiRuntimeStoreOptions): UiRuntimeFacade;
|
|
17
|
+
export declare function createUiRuntimeForTest(options: UiRuntimeForTestOptions): UiRuntimeFacade;
|
|
18
|
+
export declare function createUiServerRuntime(options: UiServerRuntimeOptions & UiRuntimeStoreOptions): UiServerRuntimeFacade;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { ActionReceipt, ActionReceiptOutcome, JsonObject, UiActionHandlerContext, UiActor, UiInstance } from './types.js';
|
|
2
|
+
interface UiInstanceStoreTestHooks {
|
|
3
|
+
injectDatabaseError?: () => unknown | undefined;
|
|
4
|
+
bumpRevisionBeforeCas?: boolean;
|
|
5
|
+
beforeOpenRead?: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface ReservationInput {
|
|
8
|
+
instanceId: string;
|
|
9
|
+
requestId: string;
|
|
10
|
+
actionId: string;
|
|
11
|
+
actor: UiActor;
|
|
12
|
+
source: 'cli' | 'ui_host' | 'system' | 'mcp';
|
|
13
|
+
expectedRevision: number;
|
|
14
|
+
input: JsonObject;
|
|
15
|
+
now: number;
|
|
16
|
+
}
|
|
17
|
+
export interface StateHandlerExecution {
|
|
18
|
+
handle: (context: UiActionHandlerContext) => {
|
|
19
|
+
state?: JsonObject;
|
|
20
|
+
result?: JsonObject;
|
|
21
|
+
} | {
|
|
22
|
+
outcome: 'rejected' | 'failed';
|
|
23
|
+
errorCode: string;
|
|
24
|
+
state?: JsonObject;
|
|
25
|
+
result?: JsonObject;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface ExternalReservation {
|
|
29
|
+
instance: UiInstance;
|
|
30
|
+
receipt: ActionReceipt;
|
|
31
|
+
reservedRevision: number;
|
|
32
|
+
reservationMarker: number;
|
|
33
|
+
}
|
|
34
|
+
export interface UiAuditSnapshotInput {
|
|
35
|
+
instanceId: string;
|
|
36
|
+
workspaceId: string;
|
|
37
|
+
updatedAt: number;
|
|
38
|
+
state: JsonObject;
|
|
39
|
+
}
|
|
40
|
+
export interface UiInstanceReadStore {
|
|
41
|
+
get(instanceId: string): UiInstance | null;
|
|
42
|
+
listByThread(workspaceId: string, threadId: string): UiInstance[];
|
|
43
|
+
close(): void;
|
|
44
|
+
}
|
|
45
|
+
export declare function openUiInstanceReadStore(dbPath?: string): UiInstanceReadStore;
|
|
46
|
+
export declare class UiInstanceStore {
|
|
47
|
+
private readonly handle;
|
|
48
|
+
private readonly db;
|
|
49
|
+
private readonly testHooks?;
|
|
50
|
+
constructor(dbPath?: string, testHooks?: UiInstanceStoreTestHooks);
|
|
51
|
+
close(): void;
|
|
52
|
+
create(input: {
|
|
53
|
+
id: string;
|
|
54
|
+
definitionId: string;
|
|
55
|
+
definitionVersion: number;
|
|
56
|
+
definitionHash: string;
|
|
57
|
+
workspaceId: string;
|
|
58
|
+
threadId: string;
|
|
59
|
+
appId?: string | null;
|
|
60
|
+
anchorTaskId: string | null;
|
|
61
|
+
domainRef: JsonObject;
|
|
62
|
+
state: JsonObject;
|
|
63
|
+
grants: readonly string[];
|
|
64
|
+
now: number;
|
|
65
|
+
}): UiInstance;
|
|
66
|
+
get(instanceId: string): UiInstance | null;
|
|
67
|
+
open(input: {
|
|
68
|
+
id?: string;
|
|
69
|
+
appId: string;
|
|
70
|
+
definitionId: string;
|
|
71
|
+
definitionVersion: number;
|
|
72
|
+
definitionHash: string;
|
|
73
|
+
workspaceId: string;
|
|
74
|
+
threadId: string;
|
|
75
|
+
anchorTaskId?: string | null;
|
|
76
|
+
domainRef: JsonObject;
|
|
77
|
+
state: JsonObject;
|
|
78
|
+
grants: readonly string[];
|
|
79
|
+
now: number;
|
|
80
|
+
}): UiInstance;
|
|
81
|
+
listByThread(workspaceId: string, threadId: string): UiInstance[];
|
|
82
|
+
updateAuditSnapshot(input: UiAuditSnapshotInput): UiInstance | null;
|
|
83
|
+
getReceipt(instanceId: string, requestId: string): ActionReceipt | null;
|
|
84
|
+
runStateOnly(reservation: ReservationInput, handler: StateHandlerExecution['handle']): ActionReceipt;
|
|
85
|
+
reserveExternal(reservation: ReservationInput): ExternalReservation;
|
|
86
|
+
settleExternal(input: {
|
|
87
|
+
reservation: ReservationInput;
|
|
88
|
+
reservedRevision: number;
|
|
89
|
+
reservationMarker: number;
|
|
90
|
+
outcome: ActionReceiptOutcome;
|
|
91
|
+
state: JsonObject;
|
|
92
|
+
result: JsonObject | null;
|
|
93
|
+
errorCode: string | null;
|
|
94
|
+
apply?: () => ReturnType<StateHandlerExecution['handle']>;
|
|
95
|
+
restoreRevisionOnFailure?: boolean;
|
|
96
|
+
now: number;
|
|
97
|
+
}): ActionReceipt;
|
|
98
|
+
}
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export type JsonPrimitive = string | number | boolean | null;
|
|
2
|
+
export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
|
|
3
|
+
export interface JsonObject {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
}
|
|
6
|
+
export type UiInstanceStatus = 'active' | 'completed' | 'expired' | 'revoked' | 'unsupported';
|
|
7
|
+
export interface UiDefinitionRef {
|
|
8
|
+
id: string;
|
|
9
|
+
version: number;
|
|
10
|
+
hash: string;
|
|
11
|
+
}
|
|
12
|
+
export type UiDefinitionUsage = 'card' | 'window';
|
|
13
|
+
export type UiDefinitionDisplayMode = 'inline' | 'floating' | 'focused';
|
|
14
|
+
export declare const DEFAULT_UI_DEFINITION_USAGE: UiDefinitionUsage;
|
|
15
|
+
export type UiActionConfirmation = 'none' | 'native';
|
|
16
|
+
export interface UiDefinitionAction {
|
|
17
|
+
readonly capabilities: readonly string[];
|
|
18
|
+
readonly inputKeys?: readonly string[];
|
|
19
|
+
readonly confirmation?: UiActionConfirmation;
|
|
20
|
+
readonly resultProjection?: UiProjectionPolicy;
|
|
21
|
+
}
|
|
22
|
+
export interface UiProjectionPolicy {
|
|
23
|
+
allow: readonly string[];
|
|
24
|
+
}
|
|
25
|
+
export interface UiDefinitionInput {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly version: number;
|
|
28
|
+
readonly sourceHash?: string;
|
|
29
|
+
readonly usage?: UiDefinitionUsage;
|
|
30
|
+
readonly detailPanel?: boolean;
|
|
31
|
+
readonly displayModes?: readonly UiDefinitionDisplayMode[];
|
|
32
|
+
readonly actions: Readonly<Record<string, UiDefinitionAction>>;
|
|
33
|
+
readonly renderer?: string;
|
|
34
|
+
readonly surfaces?: readonly string[];
|
|
35
|
+
readonly stateProjection?: UiProjectionPolicy;
|
|
36
|
+
}
|
|
37
|
+
export interface UiDefinition extends UiDefinitionInput {
|
|
38
|
+
readonly hash: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CreateUiInstanceInput {
|
|
41
|
+
definition: UiDefinitionRef;
|
|
42
|
+
workspaceId: string;
|
|
43
|
+
threadId: string;
|
|
44
|
+
anchorTaskId?: string;
|
|
45
|
+
domainRef: JsonObject;
|
|
46
|
+
state: JsonObject;
|
|
47
|
+
}
|
|
48
|
+
export interface UiInstance {
|
|
49
|
+
id: string;
|
|
50
|
+
definition: UiDefinitionRef;
|
|
51
|
+
workspaceId: string;
|
|
52
|
+
threadId: string;
|
|
53
|
+
appId: string | null;
|
|
54
|
+
anchorTaskId: string | null;
|
|
55
|
+
domainRef: JsonObject;
|
|
56
|
+
state: JsonObject;
|
|
57
|
+
revision: number;
|
|
58
|
+
status: UiInstanceStatus;
|
|
59
|
+
grantedCapabilities: readonly string[];
|
|
60
|
+
createdAt: number;
|
|
61
|
+
updatedAt: number;
|
|
62
|
+
}
|
|
63
|
+
export interface UiActionEnvelope {
|
|
64
|
+
instanceId: string;
|
|
65
|
+
actionId: string;
|
|
66
|
+
expectedRevision: number;
|
|
67
|
+
requestId: string;
|
|
68
|
+
input: JsonObject;
|
|
69
|
+
}
|
|
70
|
+
export type UiActor = {
|
|
71
|
+
kind: 'local';
|
|
72
|
+
id: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: 'authenticated';
|
|
75
|
+
id: string;
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'agent';
|
|
78
|
+
id: string;
|
|
79
|
+
};
|
|
80
|
+
export interface UiExecutionContext {
|
|
81
|
+
source: 'cli' | 'ui_host' | 'system' | 'mcp';
|
|
82
|
+
workspaceId: string;
|
|
83
|
+
actor: UiActor;
|
|
84
|
+
}
|
|
85
|
+
export interface UiAuthenticatedActor {
|
|
86
|
+
kind: 'authenticated';
|
|
87
|
+
id: string;
|
|
88
|
+
}
|
|
89
|
+
export interface UiAuthenticatedExecutionContext {
|
|
90
|
+
source: 'ui_host' | 'system';
|
|
91
|
+
workspaceId: string;
|
|
92
|
+
threadId: string;
|
|
93
|
+
actor: UiAuthenticatedActor;
|
|
94
|
+
}
|
|
95
|
+
export type ActionReceiptOutcome = 'succeeded' | 'rejected' | 'failed' | 'conflicted' | 'expired';
|
|
96
|
+
export interface ActionReceipt {
|
|
97
|
+
id: string;
|
|
98
|
+
instanceId: string;
|
|
99
|
+
requestId: string;
|
|
100
|
+
actionId: string;
|
|
101
|
+
actor: UiActor;
|
|
102
|
+
source: 'cli' | 'ui_host' | 'system' | 'mcp';
|
|
103
|
+
expectedRevision: number;
|
|
104
|
+
beforeRevision: number;
|
|
105
|
+
afterRevision: number | null;
|
|
106
|
+
status: 'requested' | 'settled';
|
|
107
|
+
outcome: ActionReceiptOutcome | null;
|
|
108
|
+
input: JsonObject;
|
|
109
|
+
result: JsonObject | null;
|
|
110
|
+
errorCode: string | null;
|
|
111
|
+
requestedAt: number;
|
|
112
|
+
settledAt: number | null;
|
|
113
|
+
}
|
|
114
|
+
export interface UiLocalGrantPolicy {
|
|
115
|
+
resolveInstanceGrants(input: {
|
|
116
|
+
definition: UiDefinitionRef;
|
|
117
|
+
workspaceId: string;
|
|
118
|
+
actor: Extract<UiActor, {
|
|
119
|
+
kind: 'local';
|
|
120
|
+
}>;
|
|
121
|
+
}): readonly string[];
|
|
122
|
+
resolveActionCapabilities(input: {
|
|
123
|
+
definition: UiDefinitionRef;
|
|
124
|
+
actionId: string;
|
|
125
|
+
}): readonly string[];
|
|
126
|
+
}
|
|
127
|
+
export interface UiActionHandlerContext {
|
|
128
|
+
instance: UiInstance;
|
|
129
|
+
actor: UiActor;
|
|
130
|
+
source: 'cli' | 'ui_host' | 'system' | 'mcp';
|
|
131
|
+
input: JsonObject;
|
|
132
|
+
requestId: string;
|
|
133
|
+
}
|
|
134
|
+
export type UiActionHandlerResult = {
|
|
135
|
+
state?: JsonObject;
|
|
136
|
+
result?: JsonObject;
|
|
137
|
+
} | {
|
|
138
|
+
outcome: 'rejected' | 'failed';
|
|
139
|
+
errorCode: string;
|
|
140
|
+
state?: JsonObject;
|
|
141
|
+
result?: JsonObject;
|
|
142
|
+
};
|
|
143
|
+
export interface UiStateActionHandlerRegistration {
|
|
144
|
+
definitionId: string;
|
|
145
|
+
version: number;
|
|
146
|
+
actionId: string;
|
|
147
|
+
kind: 'state';
|
|
148
|
+
handle: (context: UiActionHandlerContext) => UiActionHandlerResult;
|
|
149
|
+
}
|
|
150
|
+
export interface UiExternalActionHandlerRegistration {
|
|
151
|
+
definitionId: string;
|
|
152
|
+
version: number;
|
|
153
|
+
actionId: string;
|
|
154
|
+
kind: 'external';
|
|
155
|
+
handle: (context: UiActionHandlerContext) => Promise<UiActionHandlerResult>;
|
|
156
|
+
}
|
|
157
|
+
export type UiActionHandlerRegistration = UiStateActionHandlerRegistration | UiExternalActionHandlerRegistration;
|
|
158
|
+
export interface UiRuntimeOptions {
|
|
159
|
+
dbPath?: string;
|
|
160
|
+
localActor: Extract<UiActor, {
|
|
161
|
+
kind: 'local';
|
|
162
|
+
}>;
|
|
163
|
+
localGrantPolicy?: UiLocalGrantPolicy;
|
|
164
|
+
definitions?: readonly UiDefinition[];
|
|
165
|
+
handlers?: readonly UiActionHandlerRegistration[];
|
|
166
|
+
clock?: () => number;
|
|
167
|
+
}
|
|
168
|
+
export interface UiRuntimeFacade {
|
|
169
|
+
resolveDefinition(ref: UiDefinitionRef): UiDefinition | null;
|
|
170
|
+
createInstance(input: CreateUiInstanceInput): Promise<UiInstance>;
|
|
171
|
+
dispatchAction(input: UiActionEnvelope, context: UiExecutionContext): Promise<ActionReceipt>;
|
|
172
|
+
getReceipt(instanceId: string, requestId: string): Promise<ActionReceipt | null>;
|
|
173
|
+
close(): void;
|
|
174
|
+
}
|
|
175
|
+
export interface UiAuthenticatedGrantPolicy {
|
|
176
|
+
resolveInstanceGrants(input: {
|
|
177
|
+
definition: UiDefinitionRef;
|
|
178
|
+
workspaceId: string;
|
|
179
|
+
actor: UiAuthenticatedActor;
|
|
180
|
+
}): readonly string[];
|
|
181
|
+
resolveDispatchCapabilities?(input: {
|
|
182
|
+
definition: UiDefinitionRef;
|
|
183
|
+
actionId: string;
|
|
184
|
+
actor: UiAuthenticatedActor;
|
|
185
|
+
source: 'ui_host' | 'system';
|
|
186
|
+
}): readonly string[];
|
|
187
|
+
}
|
|
188
|
+
export declare function resolveUiEffectiveCapabilities(declared: readonly string[], instanceGranted: readonly string[], dispatchGranted?: readonly string[]): readonly string[];
|
|
189
|
+
export interface UiServerRuntimeOptions {
|
|
190
|
+
workspaceId: string;
|
|
191
|
+
dbPath: string;
|
|
192
|
+
definitions: readonly UiDefinition[];
|
|
193
|
+
handlers: readonly UiActionHandlerRegistration[];
|
|
194
|
+
grantPolicy: UiAuthenticatedGrantPolicy;
|
|
195
|
+
clock?: () => number;
|
|
196
|
+
}
|
|
197
|
+
export interface UiServerRuntimeFacade {
|
|
198
|
+
resolveDefinition(ref: UiDefinitionRef): UiDefinition | null;
|
|
199
|
+
getInstance(instanceId: string, context: UiAuthenticatedExecutionContext): Promise<UiInstance | null>;
|
|
200
|
+
createInstance(input: CreateUiInstanceInput, context: UiAuthenticatedExecutionContext): Promise<UiInstance>;
|
|
201
|
+
dispatchAction(input: UiActionEnvelope, context: UiAuthenticatedExecutionContext): Promise<ActionReceipt>;
|
|
202
|
+
getReceipt(instanceId: string, requestId: string, context: UiAuthenticatedExecutionContext): Promise<ActionReceipt | null>;
|
|
203
|
+
close(): void;
|
|
204
|
+
}
|
|
205
|
+
export interface UiAgentContextProjection {
|
|
206
|
+
instanceId: string;
|
|
207
|
+
definition: UiDefinitionRef;
|
|
208
|
+
revision: number;
|
|
209
|
+
facts: JsonObject;
|
|
210
|
+
recentChanges: readonly JsonObject[];
|
|
211
|
+
pendingDecision: JsonObject | null;
|
|
212
|
+
availableActions: readonly string[];
|
|
213
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { canonicalManifestJson, manifestHash } from './manifest.js';
|
|
2
|
+
export { UiPluginValidationError, normalizeManifest, validateInitialState, validateManifest, validatePayload, } from './validator.js';
|
|
3
|
+
export { UI_PLUGIN_CAPABILITY_PATTERN, UI_PLUGIN_HANDLER_PATTERN, UI_PLUGIN_IDENTIFIER_PATTERN, UI_PLUGIN_MAX_ACTIONS, UI_PLUGIN_MAX_ARRAY_LENGTH, UI_PLUGIN_MAX_CANDIDATE_DEPTH, UI_PLUGIN_MAX_COMMAND_LENGTH, UI_PLUGIN_MAX_COMMAND_PARTS, UI_PLUGIN_MAX_DISCOVERED_APPS, UI_PLUGIN_MAX_DISCOVERY_TIME_MS, UI_PLUGIN_MAX_HEIGHT, UI_PLUGIN_MAX_INITIAL_STATE_BYTES, UI_PLUGIN_MAX_JSON_DEPTH, UI_PLUGIN_MAX_MANIFEST_BYTES, UI_PLUGIN_MAX_PROJECTION_PATHS, UI_PLUGIN_MAX_SCHEMA_DEPTH, UI_PLUGIN_MAX_SCHEMA_PROPERTIES, UI_PLUGIN_MAX_STRING_LENGTH, UI_PLUGIN_MAX_SUBTREE_BYTES, UI_PLUGIN_MAX_SURFACES, UI_PLUGIN_RESERVED_STATE_KEYS, UI_PLUGIN_SAFE_PATH_PATTERN, UI_PLUGIN_SAFE_PATH_SEGMENT_PATTERN, UI_PLUGIN_SKILL_TOKEN_PATTERN, UI_PLUGIN_SURFACES, UI_PLUGIN_TONES, isUiPluginReservedStateKey, } from './limits.js';
|
|
4
|
+
export type { UiPluginActivation, UiPluginAction, UiPluginBackend, UiPluginCardShellNode, UiPluginCoreBackend, UiPluginFieldSchema, UiPluginHeadingNode, UiPluginInputSchema, UiPluginJsonSchema, UiPluginJsonSchemaType, UiPluginLabeledTextNode, UiPluginLayoutNode, UiPluginLayout, UiPluginManifest, UiPluginManifestMode, UiPluginManifestV1, UiPluginManifestV2, UiPluginMetaBannerNode, UiPluginNormalizedManifestV2, UiPluginNormalizedV2, UiPluginPayload, UiPluginPayloadValue, UiPluginPrimitive, UiPluginProjectionPolicy, UiPluginResourceMetadata, UiPluginResourceRef, UiPluginSchemaType, UiPluginSchema, UiPluginSize, UiPluginSkillBackend, UiPluginStep, UiPluginStepFlowNode, UiPluginStepListSchema, UiPluginTextListNode, UiPluginTextListSchema, UiPluginTextSchema, UiPluginSurface, UiPluginTone, UiPluginHandlerMetadata, UiPluginValidationErrorCode, UiPluginValidationOptions, } from './types.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const UI_PLUGIN_MAX_STRING_LENGTH = 4096;
|
|
2
|
+
export declare const UI_PLUGIN_MAX_ARRAY_LENGTH = 128;
|
|
3
|
+
export declare const UI_PLUGIN_MAX_SUBTREE_BYTES: number;
|
|
4
|
+
export declare const UI_PLUGIN_MAX_INITIAL_STATE_BYTES: number;
|
|
5
|
+
export declare const UI_PLUGIN_MAX_JSON_DEPTH = 8;
|
|
6
|
+
export declare const UI_PLUGIN_MAX_SCHEMA_DEPTH = 8;
|
|
7
|
+
export declare const UI_PLUGIN_MAX_SCHEMA_PROPERTIES = 64;
|
|
8
|
+
export declare const UI_PLUGIN_MAX_ACTIONS = 32;
|
|
9
|
+
export declare const UI_PLUGIN_MAX_SURFACES = 2;
|
|
10
|
+
export declare const UI_PLUGIN_MAX_PROJECTION_PATHS = 128;
|
|
11
|
+
export declare const UI_PLUGIN_MAX_COMMAND_PARTS = 16;
|
|
12
|
+
export declare const UI_PLUGIN_MAX_COMMAND_LENGTH = 256;
|
|
13
|
+
export declare const UI_PLUGIN_MAX_HEIGHT = 720;
|
|
14
|
+
export declare const UI_PLUGIN_MAX_DISCOVERED_APPS = 64;
|
|
15
|
+
export declare const UI_PLUGIN_MAX_MANIFEST_BYTES: number;
|
|
16
|
+
export declare const UI_PLUGIN_MAX_CANDIDATE_DEPTH = 2;
|
|
17
|
+
export declare const UI_PLUGIN_MAX_DISCOVERY_TIME_MS = 5000;
|
|
18
|
+
export declare const UI_PLUGIN_RESERVED_STATE_KEYS: readonly ["__proto__", "prototype", "constructor", "proof", "token", "secret", "password", "cookie", "authorization", "private_key", "private-key", "stack", "exception", "plugin_text", "url", "uri", "endpoint", "path", "filename", "filepath", "cwd", "shell", "directory", "dir", "folder"];
|
|
19
|
+
export declare function isUiPluginReservedStateKey(key: string): boolean;
|
|
20
|
+
export declare const UI_PLUGIN_SAFE_PATH_SEGMENT_PATTERN: RegExp;
|
|
21
|
+
export declare const UI_PLUGIN_SAFE_PATH_PATTERN: RegExp;
|
|
22
|
+
export declare const UI_PLUGIN_IDENTIFIER_PATTERN: RegExp;
|
|
23
|
+
export declare const UI_PLUGIN_CAPABILITY_PATTERN: RegExp;
|
|
24
|
+
export declare const UI_PLUGIN_HANDLER_PATTERN: RegExp;
|
|
25
|
+
export declare const UI_PLUGIN_SKILL_TOKEN_PATTERN: RegExp;
|
|
26
|
+
export declare const UI_PLUGIN_TONES: readonly ["blue", "violet", "emerald", "amber", "rose", "sky", "slate", "indigo"];
|
|
27
|
+
export declare const UI_PLUGIN_SURFACES: readonly ["inline", "panel"];
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import type { JsonValue, UiDefinitionInput } from '../ui-instance/types.js';
|
|
2
|
+
export type UiPluginPrimitive = 'card-shell' | 'meta-banner' | 'heading' | 'labeled-text' | 'step-flow' | 'text-list';
|
|
3
|
+
export type UiPluginSchemaType = 'text' | 'text-list' | 'step-list';
|
|
4
|
+
export interface UiPluginTextSchema {
|
|
5
|
+
readonly type: 'text';
|
|
6
|
+
readonly maxLength: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UiPluginTextListSchema {
|
|
9
|
+
readonly type: 'text-list';
|
|
10
|
+
readonly max: number;
|
|
11
|
+
readonly itemMaxLength: number;
|
|
12
|
+
}
|
|
13
|
+
export interface UiPluginStepListSchema {
|
|
14
|
+
readonly type: 'step-list';
|
|
15
|
+
readonly min: number;
|
|
16
|
+
readonly max: number;
|
|
17
|
+
readonly labelMaxLength: number;
|
|
18
|
+
readonly detailMaxLength: number;
|
|
19
|
+
}
|
|
20
|
+
export type UiPluginFieldSchema = UiPluginTextSchema | UiPluginTextListSchema | UiPluginStepListSchema;
|
|
21
|
+
export type UiPluginSchema = Readonly<Record<string, UiPluginFieldSchema>>;
|
|
22
|
+
export interface UiPluginActivation {
|
|
23
|
+
readonly kind: 'fenced-code';
|
|
24
|
+
readonly language: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UiPluginCardShellNode {
|
|
27
|
+
readonly primitive: 'card-shell';
|
|
28
|
+
}
|
|
29
|
+
export interface UiPluginMetaBannerNode {
|
|
30
|
+
readonly primitive: 'meta-banner';
|
|
31
|
+
readonly badgeToken: string;
|
|
32
|
+
readonly noticeToken: string;
|
|
33
|
+
}
|
|
34
|
+
export interface UiPluginHeadingNode {
|
|
35
|
+
readonly primitive: 'heading';
|
|
36
|
+
readonly field: string;
|
|
37
|
+
}
|
|
38
|
+
export interface UiPluginLabeledTextNode {
|
|
39
|
+
readonly primitive: 'labeled-text';
|
|
40
|
+
readonly titleToken: string;
|
|
41
|
+
readonly field: string;
|
|
42
|
+
readonly variant: 'callout';
|
|
43
|
+
}
|
|
44
|
+
export interface UiPluginStepFlowNode {
|
|
45
|
+
readonly primitive: 'step-flow';
|
|
46
|
+
readonly titleToken: string;
|
|
47
|
+
readonly field: string;
|
|
48
|
+
}
|
|
49
|
+
export interface UiPluginTextListNode {
|
|
50
|
+
readonly primitive: 'text-list';
|
|
51
|
+
readonly titleToken: string;
|
|
52
|
+
readonly field: string;
|
|
53
|
+
readonly emptyToken?: string;
|
|
54
|
+
readonly hideWhenEmpty?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export type UiPluginLayoutNode = UiPluginCardShellNode | UiPluginMetaBannerNode | UiPluginHeadingNode | UiPluginLabeledTextNode | UiPluginStepFlowNode | UiPluginTextListNode;
|
|
57
|
+
export type UiPluginLayout = readonly UiPluginLayoutNode[];
|
|
58
|
+
export interface UiPluginManifestV1 {
|
|
59
|
+
readonly manifestVersion: 1;
|
|
60
|
+
readonly pluginId: string;
|
|
61
|
+
readonly definitionId: string;
|
|
62
|
+
readonly version: number;
|
|
63
|
+
readonly primitiveSet: number;
|
|
64
|
+
readonly activation: UiPluginActivation;
|
|
65
|
+
readonly schema: UiPluginSchema;
|
|
66
|
+
readonly layout: UiPluginLayout;
|
|
67
|
+
}
|
|
68
|
+
export type UiPluginManifestMode = 'local' | 'installed' | 'published';
|
|
69
|
+
export type UiPluginSurface = 'inline' | 'panel';
|
|
70
|
+
export type UiPluginTone = 'blue' | 'violet' | 'emerald' | 'amber' | 'rose' | 'sky' | 'slate' | 'indigo';
|
|
71
|
+
export type UiPluginJsonSchemaType = 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'null';
|
|
72
|
+
export interface UiPluginJsonSchema {
|
|
73
|
+
readonly type: UiPluginJsonSchemaType;
|
|
74
|
+
readonly enum?: readonly JsonValue[];
|
|
75
|
+
readonly minLength?: number;
|
|
76
|
+
readonly maxLength?: number;
|
|
77
|
+
readonly minItems?: number;
|
|
78
|
+
readonly maxItems?: number;
|
|
79
|
+
readonly minProperties?: number;
|
|
80
|
+
readonly maxProperties?: number;
|
|
81
|
+
readonly minimum?: number;
|
|
82
|
+
readonly maximum?: number;
|
|
83
|
+
readonly items?: UiPluginJsonSchema;
|
|
84
|
+
readonly properties?: Readonly<Record<string, UiPluginJsonSchema>>;
|
|
85
|
+
readonly required?: readonly string[];
|
|
86
|
+
readonly additionalProperties?: false;
|
|
87
|
+
}
|
|
88
|
+
export interface UiPluginInputSchema extends UiPluginJsonSchema {
|
|
89
|
+
readonly type: 'object';
|
|
90
|
+
readonly properties: Readonly<Record<string, UiPluginJsonSchema>>;
|
|
91
|
+
}
|
|
92
|
+
export interface UiPluginProjectionPolicy {
|
|
93
|
+
readonly allow: readonly string[];
|
|
94
|
+
}
|
|
95
|
+
export interface UiPluginCoreBackend {
|
|
96
|
+
readonly type: 'core';
|
|
97
|
+
readonly handler: string;
|
|
98
|
+
}
|
|
99
|
+
export interface UiPluginSkillBackend {
|
|
100
|
+
readonly type: 'skill';
|
|
101
|
+
readonly command: readonly string[];
|
|
102
|
+
}
|
|
103
|
+
export type UiPluginBackend = UiPluginCoreBackend | UiPluginSkillBackend;
|
|
104
|
+
export interface UiPluginAction {
|
|
105
|
+
readonly actionId: string;
|
|
106
|
+
readonly capability: string;
|
|
107
|
+
readonly mutation: boolean;
|
|
108
|
+
readonly inputSchema: UiPluginInputSchema;
|
|
109
|
+
readonly resultProjection: UiPluginProjectionPolicy;
|
|
110
|
+
readonly backend: UiPluginBackend;
|
|
111
|
+
}
|
|
112
|
+
export interface UiPluginResourceRef {
|
|
113
|
+
readonly path: 'ui/index.html' | 'ui/state.json';
|
|
114
|
+
readonly hash?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface UiPluginSize {
|
|
117
|
+
readonly height: number;
|
|
118
|
+
}
|
|
119
|
+
export interface UiPluginManifestV2 {
|
|
120
|
+
readonly manifestVersion: 2;
|
|
121
|
+
readonly pluginId: string;
|
|
122
|
+
readonly definitionId: string;
|
|
123
|
+
readonly version: number;
|
|
124
|
+
readonly name: string;
|
|
125
|
+
readonly description: string;
|
|
126
|
+
readonly icon?: string;
|
|
127
|
+
readonly tone?: UiPluginTone;
|
|
128
|
+
readonly entry: 'ui/index.html';
|
|
129
|
+
readonly entryHash?: string;
|
|
130
|
+
readonly initialState?: {
|
|
131
|
+
readonly path: 'ui/state.json';
|
|
132
|
+
readonly hash?: string;
|
|
133
|
+
};
|
|
134
|
+
readonly usage?: UiDefinitionInput['usage'];
|
|
135
|
+
readonly detailPanel?: UiDefinitionInput['detailPanel'];
|
|
136
|
+
readonly displayModes?: UiDefinitionInput['displayModes'];
|
|
137
|
+
readonly surfaces: readonly UiPluginSurface[];
|
|
138
|
+
readonly size: UiPluginSize;
|
|
139
|
+
readonly stateProjection: UiPluginProjectionPolicy;
|
|
140
|
+
readonly actions: readonly UiPluginAction[];
|
|
141
|
+
}
|
|
142
|
+
export type UiPluginManifest = UiPluginManifestV1 | UiPluginManifestV2;
|
|
143
|
+
export interface UiPluginHandlerMetadata {
|
|
144
|
+
readonly actionId: string;
|
|
145
|
+
readonly mutation: boolean;
|
|
146
|
+
readonly backend: UiPluginBackend;
|
|
147
|
+
readonly launchPolicy: 'allowed' | 'denied';
|
|
148
|
+
readonly denialCode?: 'EXEC_DENIED';
|
|
149
|
+
}
|
|
150
|
+
export interface UiPluginResourceMetadata {
|
|
151
|
+
readonly entry: UiPluginResourceRef;
|
|
152
|
+
readonly initialState?: {
|
|
153
|
+
readonly path: 'ui/state.json';
|
|
154
|
+
readonly hash?: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
export interface UiPluginNormalizedManifestV2 {
|
|
158
|
+
readonly manifest: UiPluginManifestV2;
|
|
159
|
+
readonly definition: UiDefinitionInput;
|
|
160
|
+
readonly handlers: Readonly<Record<string, UiPluginHandlerMetadata>>;
|
|
161
|
+
readonly resources: UiPluginResourceMetadata;
|
|
162
|
+
}
|
|
163
|
+
export type UiPluginNormalizedV2 = UiPluginNormalizedManifestV2;
|
|
164
|
+
export interface UiPluginStep {
|
|
165
|
+
readonly label: string;
|
|
166
|
+
readonly detail: string;
|
|
167
|
+
}
|
|
168
|
+
export type UiPluginPayloadValue = string | string[] | UiPluginStep[];
|
|
169
|
+
export type UiPluginPayload = Record<string, UiPluginPayloadValue>;
|
|
170
|
+
export interface UiPluginValidationOptions {
|
|
171
|
+
readonly supportedPrimitiveSet?: number;
|
|
172
|
+
readonly mode?: UiPluginManifestMode;
|
|
173
|
+
}
|
|
174
|
+
export type UiPluginValidationErrorCode = 'MANIFEST_INVALID' | 'PRIMITIVE_UNKNOWN' | 'PRIMITIVE_SET_UNSUPPORTED' | 'SCHEMA_TYPE_UNSUPPORTED' | 'TOKEN_INVALID' | 'UNSAFE_VALUE' | 'LIMIT_EXCEEDED' | 'INITIAL_STATE_INVALID';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UiPluginManifest, UiPluginManifestV1, UiPluginManifestV2, UiPluginNormalizedManifestV2, UiPluginPayload, UiPluginValidationErrorCode, UiPluginValidationOptions } from './types.js';
|
|
2
|
+
import type { JsonObject } from '../ui-instance/types.js';
|
|
3
|
+
export declare class UiPluginValidationError extends Error {
|
|
4
|
+
readonly code: UiPluginValidationErrorCode;
|
|
5
|
+
readonly name = "UiPluginValidationError";
|
|
6
|
+
constructor(code: UiPluginValidationErrorCode, message?: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function validateInitialState(value: unknown): JsonObject;
|
|
9
|
+
export declare function validateManifest(input: UiPluginManifestV1, options?: UiPluginValidationOptions): UiPluginManifestV1;
|
|
10
|
+
export declare function validateManifest(input: UiPluginManifestV2, options?: UiPluginValidationOptions): UiPluginManifestV2;
|
|
11
|
+
export declare function validateManifest(input: unknown, options?: UiPluginValidationOptions): UiPluginManifest;
|
|
12
|
+
export declare function normalizeManifest(input: UiPluginManifestV1, options?: UiPluginValidationOptions): UiPluginManifestV1;
|
|
13
|
+
export declare function normalizeManifest(input: UiPluginManifestV2, options?: UiPluginValidationOptions): UiPluginNormalizedManifestV2;
|
|
14
|
+
export declare function normalizeManifest(input: unknown, options?: UiPluginValidationOptions): UiPluginManifestV1 | UiPluginNormalizedManifestV2;
|
|
15
|
+
export declare function validatePayload(manifest: UiPluginManifestV1, rawPayload: unknown): UiPluginPayload;
|