@crewx/sdk 0.9.0-rc.11 → 0.9.0-rc.110
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 +106 -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/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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface ConsoleDecoderOptions {
|
|
2
|
+
platform?: NodeJS.Platform;
|
|
3
|
+
detectCodePage?: () => Promise<number | null>;
|
|
4
|
+
codePage?: number | null;
|
|
5
|
+
}
|
|
6
|
+
export interface ConsoleBufferDecodeOptions {
|
|
7
|
+
platform?: NodeJS.Platform;
|
|
8
|
+
codePage?: number | null;
|
|
9
|
+
}
|
|
10
|
+
type ConsoleByteChunk = Buffer | Uint8Array<ArrayBufferLike>;
|
|
11
|
+
export declare function parseWindowsConsoleCodePage(output: string): number | null;
|
|
12
|
+
export declare function getWindowsConsoleCodePage(): Promise<number | null>;
|
|
13
|
+
export declare function primeWindowsConsoleCodePage(): void;
|
|
14
|
+
export declare class ConsoleDecoder {
|
|
15
|
+
private readonly platform;
|
|
16
|
+
private readonly detectCodePage;
|
|
17
|
+
private utf8Decoder;
|
|
18
|
+
private codePage;
|
|
19
|
+
private fallbackDecoder;
|
|
20
|
+
private replayTail;
|
|
21
|
+
private pendingUtf8;
|
|
22
|
+
private pendingFallback;
|
|
23
|
+
private pendingBytes;
|
|
24
|
+
private queue;
|
|
25
|
+
private ended;
|
|
26
|
+
constructor(options?: ConsoleDecoderOptions);
|
|
27
|
+
write(chunk: ConsoleByteChunk): Promise<string>;
|
|
28
|
+
end(): Promise<string>;
|
|
29
|
+
private enqueue;
|
|
30
|
+
private clearPendingCandidate;
|
|
31
|
+
private resolveCodePage;
|
|
32
|
+
private getFallbackDecoder;
|
|
33
|
+
private decodeChunk;
|
|
34
|
+
private finish;
|
|
35
|
+
}
|
|
36
|
+
export declare function decodeConsoleBuffer(input: ConsoleByteChunk, options?: ConsoleBufferDecodeOptions): string;
|
|
37
|
+
export declare function decodeConsoleBufferAsync(input: ConsoleByteChunk, options?: ConsoleDecoderOptions): Promise<string>;
|
|
38
|
+
export {};
|
|
@@ -20,15 +20,25 @@ export type WindowsSpawnInvocation = {
|
|
|
20
20
|
shell?: boolean;
|
|
21
21
|
windowsHide?: boolean;
|
|
22
22
|
};
|
|
23
|
+
export type BinResolutionMode = 'global_first' | 'local_first';
|
|
24
|
+
export type ResolveExecutablePathOptions = {
|
|
25
|
+
cwd?: string;
|
|
26
|
+
env?: NodeJS.ProcessEnv;
|
|
27
|
+
platform?: NodeJS.Platform;
|
|
28
|
+
resolution?: BinResolutionMode;
|
|
29
|
+
};
|
|
23
30
|
export type ResolveWindowsSpawnProgramParams = {
|
|
24
31
|
command: string;
|
|
25
32
|
platform?: NodeJS.Platform;
|
|
26
33
|
env?: NodeJS.ProcessEnv;
|
|
27
34
|
execPath?: string;
|
|
28
35
|
packageName?: string;
|
|
36
|
+
cwd?: string;
|
|
37
|
+
resolution?: BinResolutionMode;
|
|
29
38
|
allowShellFallback?: boolean;
|
|
30
39
|
};
|
|
31
40
|
export type ResolveWindowsSpawnProgramCandidateParams = Omit<ResolveWindowsSpawnProgramParams, 'allowShellFallback'>;
|
|
41
|
+
export declare function resolveExecutablePath(command: string, options?: ResolveExecutablePathOptions): string;
|
|
32
42
|
export declare function resolveWindowsExecutablePath(command: string, env: NodeJS.ProcessEnv): string;
|
|
33
43
|
export declare function resolveWindowsSpawnProgramCandidate(params: ResolveWindowsSpawnProgramCandidateParams): WindowsSpawnProgramCandidate;
|
|
34
44
|
export declare function applyWindowsSpawnProgramPolicy(params: {
|
package/dist/layout/types.d.ts
CHANGED
|
@@ -25,6 +25,13 @@ export interface LayoutDefinition {
|
|
|
25
25
|
template: string;
|
|
26
26
|
propsSchema: Record<string, PropSchema>;
|
|
27
27
|
defaultProps: Record<string, any>;
|
|
28
|
+
capabilities?: LayoutCapabilities;
|
|
29
|
+
}
|
|
30
|
+
export interface LayoutCapabilities {
|
|
31
|
+
semanticContinuity?: boolean;
|
|
32
|
+
continuity?: boolean;
|
|
33
|
+
continuitySlot?: string;
|
|
34
|
+
slot?: string;
|
|
28
35
|
}
|
|
29
36
|
export interface CustomLayoutDefinition {
|
|
30
37
|
template: string;
|
|
@@ -32,10 +39,15 @@ export interface CustomLayoutDefinition {
|
|
|
32
39
|
version?: string;
|
|
33
40
|
propsSchema?: Record<string, any>;
|
|
34
41
|
defaultProps?: Record<string, any>;
|
|
42
|
+
capabilities?: LayoutCapabilities;
|
|
35
43
|
}
|
|
36
44
|
export type InlineLayoutSpec = string | {
|
|
37
45
|
id: string;
|
|
38
46
|
props?: Record<string, any>;
|
|
47
|
+
capabilities?: LayoutCapabilities;
|
|
48
|
+
} | {
|
|
49
|
+
template: string;
|
|
50
|
+
capabilities?: LayoutCapabilities;
|
|
39
51
|
};
|
|
40
52
|
export interface ValidationResult {
|
|
41
53
|
valid: boolean;
|
|
@@ -97,6 +109,10 @@ export interface RenderContext {
|
|
|
97
109
|
[key: string]: any;
|
|
98
110
|
};
|
|
99
111
|
context?: Record<string, any>;
|
|
112
|
+
semanticContinuity?: import('../conversation/types.js').SemanticContinuityContext;
|
|
113
|
+
thread_state?: import('../conversation/types.js').ConversationThreadState;
|
|
114
|
+
threadState?: import('../conversation/types.js').ConversationThreadState;
|
|
115
|
+
apps?: import('../mcp-app/apps-context.js').McpAppsContext;
|
|
100
116
|
contextOptions?: {
|
|
101
117
|
goals: boolean | string | string[];
|
|
102
118
|
daily: boolean;
|
|
@@ -109,7 +125,8 @@ export interface RawLayoutYaml {
|
|
|
109
125
|
description?: string;
|
|
110
126
|
propsSchema?: Record<string, any>;
|
|
111
127
|
template?: string;
|
|
112
|
-
layouts?: Record<string,
|
|
128
|
+
layouts?: Record<string, any>;
|
|
129
|
+
capabilities?: LayoutCapabilities;
|
|
113
130
|
}
|
|
114
131
|
export declare class LayoutLoadError extends Error {
|
|
115
132
|
readonly layoutId?: string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { TaskRepository } from '../repository/task.repository.js';
|
|
2
|
+
export declare const TASK_HEARTBEAT_INTERVAL_MS = 10000;
|
|
3
|
+
export declare const TASK_HEARTBEAT_STALE_MS = 30000;
|
|
4
|
+
export declare const TASK_HEARTBEAT_HARD_STALE_MS: number;
|
|
5
|
+
export declare const TASK_STOP_POLL_INTERVAL_MS = 1000;
|
|
6
|
+
export declare function resolveTaskHeartbeatIntervalMs(): number;
|
|
7
|
+
export declare function resolveTaskHeartbeatStaleMs(): number;
|
|
8
|
+
export declare function resolveTaskHeartbeatHardStaleMs(): number;
|
|
9
|
+
export interface TaskHeartbeatRow {
|
|
10
|
+
id?: string;
|
|
11
|
+
status: string;
|
|
12
|
+
run_epoch: number | null;
|
|
13
|
+
stop_requested_at: string | null;
|
|
14
|
+
stop_requested_epoch: number | null;
|
|
15
|
+
pid?: number | null;
|
|
16
|
+
metadata?: string | null;
|
|
17
|
+
started_at?: string;
|
|
18
|
+
duration_ms?: number | null;
|
|
19
|
+
}
|
|
20
|
+
export interface HeartbeatTickResult {
|
|
21
|
+
accepted: boolean;
|
|
22
|
+
row: TaskHeartbeatRow | null;
|
|
23
|
+
}
|
|
24
|
+
export interface TaskHeartbeatOptions {
|
|
25
|
+
taskId: string;
|
|
26
|
+
runEpoch: number;
|
|
27
|
+
onStopRequested?: (row: TaskHeartbeatRow) => void | Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export interface TaskHeartbeatHandle {
|
|
30
|
+
timer: ReturnType<typeof setInterval>;
|
|
31
|
+
runEpoch: number;
|
|
32
|
+
stopRequested: boolean;
|
|
33
|
+
lastHeartbeatAt: number;
|
|
34
|
+
heartbeatElapsedMs: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const taskHeartbeatRegistry: Map<string, TaskHeartbeatHandle>;
|
|
37
|
+
export declare function runHeartbeatTick(repo: Pick<TaskRepository, 'heartbeatTask' | 'getTask'>, options: TaskHeartbeatOptions & {
|
|
38
|
+
writeHeartbeat?: boolean;
|
|
39
|
+
}): HeartbeatTickResult;
|
|
40
|
+
export declare function stopTaskHeartbeat(taskId: string, runEpoch?: number | null): boolean;
|
|
41
|
+
export declare function startTaskHeartbeat(repo: Pick<TaskRepository, 'heartbeatTask' | 'getTask'>, options: TaskHeartbeatOptions): boolean;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { FinalizeTaskForHostShutdownOptions, FinalizeTaskForHostShutdownOutcome, FinalizeTaskStopOptions, TaskRepository, TaskRow, TaskStopOrigin, TaskStopRequestResult } from '../repository/task.repository.js';
|
|
2
|
+
import { checkProcessOwnershipAsync as defaultCheckProcessOwnershipAsync, terminateProcessTree as defaultTerminateProcessTree, type ProcessControlOptions } from '../process/process-control.js';
|
|
3
|
+
export declare const TASK_STOP_DEFAULT_GRACE_MS = 5000;
|
|
4
|
+
export declare const TASK_STOP_DEFAULT_POLL_MS = 250;
|
|
5
|
+
export declare function resolveTaskStopMethod(requestedAt: string | null | undefined, completedAt?: string | number, graceMs?: number): 'cooperative' | 'forced';
|
|
6
|
+
export declare const TASK_STOP_OWNED_PROCESS_MARKERS: readonly ["crewx", "claude", "codex", "opencode", "grok", "node"];
|
|
7
|
+
export type StopTaskStatus = 'stopped' | 'not_running' | 'already_requested' | 'ownership_unverified' | 'failed';
|
|
8
|
+
export interface StopTaskResult {
|
|
9
|
+
status: StopTaskStatus;
|
|
10
|
+
method?: 'cooperative' | 'forced';
|
|
11
|
+
finalStatus: string | null;
|
|
12
|
+
pid?: number;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface StopTaskProcessControl {
|
|
16
|
+
checkProcessOwnershipAsync?: typeof defaultCheckProcessOwnershipAsync;
|
|
17
|
+
terminateProcessTree?: typeof defaultTerminateProcessTree;
|
|
18
|
+
}
|
|
19
|
+
export interface StopTaskOptions {
|
|
20
|
+
origin?: TaskStopOrigin;
|
|
21
|
+
callerPid?: number;
|
|
22
|
+
callerTaskId?: string;
|
|
23
|
+
graceMs?: number;
|
|
24
|
+
pollMs?: number;
|
|
25
|
+
platform?: NodeJS.Platform;
|
|
26
|
+
ownershipMarkers?: readonly string[];
|
|
27
|
+
processControl?: StopTaskProcessControl;
|
|
28
|
+
processControlOptions?: ProcessControlOptions;
|
|
29
|
+
}
|
|
30
|
+
export interface StopTaskGenerationForInstructionOptions {
|
|
31
|
+
taskId: string;
|
|
32
|
+
targetPid: number | null | undefined;
|
|
33
|
+
sourceRunEpoch: number;
|
|
34
|
+
settleRunEpoch: number;
|
|
35
|
+
workspaceId?: string | null;
|
|
36
|
+
platform?: NodeJS.Platform;
|
|
37
|
+
ownershipMarkers?: readonly string[];
|
|
38
|
+
processControl?: StopTaskProcessControl;
|
|
39
|
+
processControlOptions?: ProcessControlOptions;
|
|
40
|
+
}
|
|
41
|
+
export interface StopTaskForHostShutdownOptions {
|
|
42
|
+
taskId: string;
|
|
43
|
+
expectedRunEpoch: number;
|
|
44
|
+
workspaceId?: string | null;
|
|
45
|
+
platform?: NodeJS.Platform;
|
|
46
|
+
ownershipMarkers?: readonly string[];
|
|
47
|
+
processControl?: StopTaskProcessControl;
|
|
48
|
+
processControlOptions?: ProcessControlOptions;
|
|
49
|
+
}
|
|
50
|
+
export declare const INSTRUCTION_STOP_TARGET_PID_MISSING = "INSTRUCTION_STOP_TARGET_PID_MISSING";
|
|
51
|
+
export declare const INSTRUCTION_STOP_EPOCH_MISMATCH = "INSTRUCTION_STOP_EPOCH_MISMATCH";
|
|
52
|
+
export declare const INSTRUCTION_STOP_WORKSPACE_MISMATCH = "INSTRUCTION_STOP_WORKSPACE_MISMATCH";
|
|
53
|
+
export declare const INSTRUCTION_STOP_GENERATION_ALREADY_SETTLED = "INSTRUCTION_STOP_GENERATION_ALREADY_SETTLED";
|
|
54
|
+
export declare const INSTRUCTION_STOP_PROCESS_TERMINATION_FAILED = "INSTRUCTION_STOP_PROCESS_TERMINATION_FAILED";
|
|
55
|
+
export declare const INSTRUCTION_STOP_SETTLE_CAS_FAILED = "INSTRUCTION_STOP_SETTLE_CAS_FAILED";
|
|
56
|
+
export declare const INSTRUCTION_STOP_REQUEST_FAILED = "INSTRUCTION_STOP_REQUEST_FAILED";
|
|
57
|
+
export declare const HOST_SHUTDOWN_EPOCH_MISMATCH = "HOST_SHUTDOWN_EPOCH_MISMATCH";
|
|
58
|
+
export declare const HOST_SHUTDOWN_WORKSPACE_MISMATCH = "HOST_SHUTDOWN_WORKSPACE_MISMATCH";
|
|
59
|
+
export declare const HOST_SHUTDOWN_TARGET_PID_MISSING = "HOST_SHUTDOWN_TARGET_PID_MISSING";
|
|
60
|
+
export declare const HOST_SHUTDOWN_OWNERSHIP_UNVERIFIED = "HOST_SHUTDOWN_OWNERSHIP_UNVERIFIED";
|
|
61
|
+
export declare const HOST_SHUTDOWN_PROCESS_TERMINATION_FAILED = "HOST_SHUTDOWN_PROCESS_TERMINATION_FAILED";
|
|
62
|
+
export declare const HOST_SHUTDOWN_SETTLE_CAS_FAILED = "HOST_SHUTDOWN_SETTLE_CAS_FAILED";
|
|
63
|
+
type StopTaskRepository = Pick<TaskRepository, 'requestTaskStop' | 'stopPendingTask' | 'getTask' | 'finalizeTaskStop'>;
|
|
64
|
+
interface InstructionStopRepository {
|
|
65
|
+
requestTaskStop: (options: {
|
|
66
|
+
id: string;
|
|
67
|
+
requestedAt: string;
|
|
68
|
+
sourceRunEpoch: number;
|
|
69
|
+
settleRunEpoch: number;
|
|
70
|
+
workspaceId?: string | null;
|
|
71
|
+
}) => TaskStopRequestResult;
|
|
72
|
+
getTask: (taskId: string) => TaskRow | undefined;
|
|
73
|
+
finalizeTaskStop: (options: FinalizeTaskStopOptions) => boolean;
|
|
74
|
+
}
|
|
75
|
+
type HostShutdownRepository = Pick<TaskRepository, 'getTask'> & {
|
|
76
|
+
finalizeTaskForHostShutdown: (options: FinalizeTaskForHostShutdownOptions) => FinalizeTaskForHostShutdownOutcome;
|
|
77
|
+
};
|
|
78
|
+
export declare function stopTaskGenerationForInstruction(repo: InstructionStopRepository, options: StopTaskGenerationForInstructionOptions): Promise<StopTaskResult>;
|
|
79
|
+
export declare function stopTaskForHostShutdown(repo: HostShutdownRepository, options: StopTaskForHostShutdownOptions): Promise<StopTaskResult>;
|
|
80
|
+
export declare function stopTask(taskId: string, options?: StopTaskOptions): Promise<StopTaskResult>;
|
|
81
|
+
export declare function stopTask(repo: StopTaskRepository, taskId: string, options?: StopTaskOptions): Promise<StopTaskResult>;
|
|
82
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const UPDATE_QUIESCE_LOCK_FILENAME = "update-quiesce.lock";
|
|
2
|
+
export declare const UPDATE_ADMISSION_RESERVATION_DIRNAME = "update-admission";
|
|
3
|
+
export declare function resolveUpdateQuiesceLockFile(): string;
|
|
4
|
+
export declare function resolveUpdateAdmissionReservationDir(): string;
|
|
5
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
6
|
+
export declare function isDurablyQuiescing(): boolean;
|
|
7
|
+
export type DurableQuiesceMarkerState = {
|
|
8
|
+
kind: 'absent';
|
|
9
|
+
} | {
|
|
10
|
+
kind: 'owned';
|
|
11
|
+
ownerPid: number;
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'unknown';
|
|
14
|
+
};
|
|
15
|
+
export declare function readDurableQuiesceMarkerOwner(): DurableQuiesceMarkerState;
|
|
16
|
+
export type AdmissionMarkerResult = {
|
|
17
|
+
ok: true;
|
|
18
|
+
} | {
|
|
19
|
+
ok: false;
|
|
20
|
+
reason: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function acquireDurableQuiesceMarker(ownerPid: number): AdmissionMarkerResult;
|
|
23
|
+
export declare function releaseDurableQuiesceMarker(ownerPid: number): AdmissionMarkerResult;
|
|
24
|
+
export type ReconcileOutcome = 'absent' | 'cleared' | 'kept-live' | 'kept-unknown';
|
|
25
|
+
export declare function reconcileDurableQuiesceMarkerIfOwnerDead(): ReconcileOutcome;
|
|
26
|
+
export interface UpdateAdmissionReservationEntry {
|
|
27
|
+
taskId: string;
|
|
28
|
+
scheduleId: string;
|
|
29
|
+
corrupt: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare function reserveUpdateAdmission(taskId: string, scheduleId: string, timeoutMs: number): boolean;
|
|
32
|
+
export declare function releaseUpdateAdmissionReservation(taskId: string): void;
|
|
33
|
+
export declare function readUpdateAdmissionReservations(): UpdateAdmissionReservationEntry[];
|
|
34
|
+
export type DurableTaskAdmission = {
|
|
35
|
+
ok: true;
|
|
36
|
+
taskId: string;
|
|
37
|
+
release: () => void;
|
|
38
|
+
} | {
|
|
39
|
+
ok: false;
|
|
40
|
+
reason: 'ADMISSION_UNKNOWN' | 'UPDATE_QUIESCING';
|
|
41
|
+
message: string;
|
|
42
|
+
};
|
|
43
|
+
export declare const DEFAULT_CLI_ADMISSION_TIMEOUT_MS: number;
|
|
44
|
+
export declare function admitDurableTask(source: string, timeoutMs?: number): DurableTaskAdmission;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const LOCAL_SERVER_BASE_URL_MAX_LENGTH = 2048;
|
|
2
|
+
export type LocalServerHostClass = 'loopback' | 'private-ipv4' | 'cgnat' | 'unique-local-ipv6';
|
|
3
|
+
export type LocalServerBaseUrlErrorCode = 'invalid_input' | 'url_too_long' | 'invalid_scheme' | 'invalid_url' | 'userinfo_not_allowed' | 'query_not_allowed' | 'fragment_not_allowed' | 'invalid_port' | 'host_not_ip_literal' | 'zone_id' | 'loopback_not_allowed' | 'metadata_address' | 'link_local' | 'multicast' | 'unspecified' | 'ipv4_mapped_ipv6' | 'ip_not_allowed';
|
|
4
|
+
export interface LocalServerBaseUrlOptions {
|
|
5
|
+
allowLoopback?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface LocalServerBaseUrlSuccess {
|
|
8
|
+
ok: true;
|
|
9
|
+
normalizedBaseUrl: string;
|
|
10
|
+
hostClass: LocalServerHostClass;
|
|
11
|
+
}
|
|
12
|
+
export interface LocalServerBaseUrlFailure {
|
|
13
|
+
ok: false;
|
|
14
|
+
code: LocalServerBaseUrlErrorCode;
|
|
15
|
+
}
|
|
16
|
+
export type LocalServerBaseUrlResult = LocalServerBaseUrlSuccess | LocalServerBaseUrlFailure;
|
|
17
|
+
export declare function parseLocalServerBaseUrl(value: unknown, options?: LocalServerBaseUrlOptions): LocalServerBaseUrlResult;
|
|
18
|
+
export declare function isAllowedLocalServerIp(value: string, options?: LocalServerBaseUrlOptions): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { isAllowedLocalServerIp, parseLocalServerBaseUrl, } from './base-url';
|
|
2
|
+
export type { LocalServerBaseUrlErrorCode, LocalServerBaseUrlFailure, LocalServerBaseUrlOptions, LocalServerBaseUrlResult, LocalServerBaseUrlSuccess, LocalServerHostClass, } from './base-url';
|
|
3
|
+
export { DEFAULT_LOCAL_SERVER_PROBE_TIMEOUT_MS, probeLocalServer } from './probe';
|
|
4
|
+
export type { LocalServerDefinition, LocalServerFetch, LocalServerKind, LocalServerModel, LocalServerOpenCodeOverlay, LocalServerProbeOptions, LocalServerProbeReason, LocalServerProbeResponse, LocalServerProbeResult, LocalServerSettings, } from './types';
|
|
5
|
+
export { buildLocalServerOpenCodeOverlay, LocalServerOpenCodeOverlayError, } from './opencode';
|
|
6
|
+
export type { LocalServerOpenCodeOverlayErrorCode } from './opencode';
|
|
7
|
+
export { isLocalServerRuntimeEligible, resolveLocalServerRuntime, LocalServerRuntimeError, LOCAL_AI_SERVER_CONFIG_INVALID, } from './runtime';
|
|
8
|
+
export type { LocalServerRuntimeMetadata, LocalServerRuntimeOptions, LocalServerRuntimeResolution, } from './runtime';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { LocalServerOpenCodeOverlay, LocalServerSettings } from './types';
|
|
2
|
+
export type LocalServerOpenCodeOverlayErrorCode = 'missing_default_model' | 'invalid_default_model' | 'invalid_label' | 'invalid_provider_id' | 'invalid_api_key_env' | 'invalid_base_url';
|
|
3
|
+
export declare class LocalServerOpenCodeOverlayError extends Error {
|
|
4
|
+
readonly code: LocalServerOpenCodeOverlayErrorCode;
|
|
5
|
+
readonly name = "LocalServerOpenCodeOverlayError";
|
|
6
|
+
constructor(code: LocalServerOpenCodeOverlayErrorCode);
|
|
7
|
+
}
|
|
8
|
+
export declare function buildLocalServerOpenCodeOverlay(settings: LocalServerSettings): LocalServerOpenCodeOverlay;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LocalServerProbeOptions, LocalServerProbeResult } from './types.js';
|
|
2
|
+
export declare const DEFAULT_LOCAL_SERVER_PROBE_TIMEOUT_MS = 3000;
|
|
3
|
+
export declare function probeLocalServer(baseUrl: string, options?: LocalServerProbeOptions): Promise<LocalServerProbeResult>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GlobalSettingsStore } from '../config/global-settings';
|
|
2
|
+
export declare const LOCAL_AI_SERVER_CONFIG_INVALID: "LOCAL_AI_SERVER_CONFIG_INVALID";
|
|
3
|
+
export interface LocalServerRuntimeMetadata {
|
|
4
|
+
providerId: string;
|
|
5
|
+
model: string;
|
|
6
|
+
source: 'global_settings';
|
|
7
|
+
}
|
|
8
|
+
export interface LocalServerRuntimeResolution {
|
|
9
|
+
model?: string;
|
|
10
|
+
env?: {
|
|
11
|
+
OPENCODE_CONFIG_CONTENT: string;
|
|
12
|
+
};
|
|
13
|
+
metadata?: LocalServerRuntimeMetadata;
|
|
14
|
+
}
|
|
15
|
+
export interface LocalServerRuntimeOptions {
|
|
16
|
+
effectiveProviderStr: string;
|
|
17
|
+
effectiveModel?: string;
|
|
18
|
+
globalSettings?: GlobalSettingsStore;
|
|
19
|
+
}
|
|
20
|
+
export declare class LocalServerRuntimeError extends Error {
|
|
21
|
+
readonly name = "LocalServerRuntimeError";
|
|
22
|
+
readonly code: "LOCAL_AI_SERVER_CONFIG_INVALID";
|
|
23
|
+
constructor();
|
|
24
|
+
}
|
|
25
|
+
export declare function isLocalServerRuntimeEligible(effectiveProviderStr: string, effectiveModel: string | undefined): boolean;
|
|
26
|
+
export declare function resolveLocalServerRuntime(options: LocalServerRuntimeOptions): LocalServerRuntimeResolution;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type LocalServerKind = 'ollama' | 'lm-studio' | 'unsloth-desktop';
|
|
2
|
+
export interface LocalServerDefinition {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
kind: LocalServerKind;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
discovery: 'tailscale' | 'manual';
|
|
8
|
+
defaultModel?: string;
|
|
9
|
+
auth?: {
|
|
10
|
+
apiKeyEnv: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface LocalServerSettings {
|
|
14
|
+
version: 1;
|
|
15
|
+
definition: LocalServerDefinition;
|
|
16
|
+
verifiedAt: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LocalServerOpenCodeOverlay {
|
|
19
|
+
env: {
|
|
20
|
+
OPENCODE_CONFIG_CONTENT: string;
|
|
21
|
+
};
|
|
22
|
+
model: string;
|
|
23
|
+
providerId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface LocalServerModel {
|
|
26
|
+
id: string;
|
|
27
|
+
}
|
|
28
|
+
export type LocalServerProbeReason = 'http_error' | 'timeout' | 'network_error' | 'invalid_json' | 'invalid_envelope';
|
|
29
|
+
export interface LocalServerProbeResponse {
|
|
30
|
+
readonly ok: boolean;
|
|
31
|
+
json(): Promise<unknown>;
|
|
32
|
+
}
|
|
33
|
+
export type LocalServerFetch = (url: string, init?: RequestInit) => Promise<LocalServerProbeResponse>;
|
|
34
|
+
export interface LocalServerProbeOptions {
|
|
35
|
+
timeoutMs?: number;
|
|
36
|
+
fetch?: LocalServerFetch;
|
|
37
|
+
}
|
|
38
|
+
export interface LocalServerProbeResult {
|
|
39
|
+
ok: boolean;
|
|
40
|
+
models: LocalServerModel[];
|
|
41
|
+
latencyMs: number;
|
|
42
|
+
reason?: LocalServerProbeReason;
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CrewxAppCatalogOptions, CrewxAppCatalogResult, CrewxAppDefinitionHashInput } from './types.js';
|
|
2
|
+
export declare function hashCrewxAppDefinition(input: CrewxAppDefinitionHashInput): string;
|
|
3
|
+
export declare const hashAppDefinition: typeof hashCrewxAppDefinition;
|
|
4
|
+
export declare function discoverWorkspaceAppCatalog(workspaceRoot: string, options?: CrewxAppCatalogOptions): Promise<CrewxAppCatalogResult>;
|
|
5
|
+
export declare const listWorkspaceApps: typeof discoverWorkspaceAppCatalog;
|
|
6
|
+
export declare const createWorkspaceAppCatalog: typeof discoverWorkspaceAppCatalog;
|
|
7
|
+
export type { CrewxAppDefinitionHashInput, CrewxAppCatalogOptions, CrewxAppCatalogResult, } from './types.js';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { JsonObject, UiDefinition } from '../ui-instance/types.js';
|
|
2
|
+
import type { UiPluginHandlerMetadata, UiPluginManifestV2, UiPluginNormalizedManifestV2 } from '../ui-plugin/types.js';
|
|
3
|
+
import { AppDiscoveryFsError, NodeAppDiscoveryFs, NodeAppDiscoveryFsAdapter, defaultAppDiscoveryFs, defaultNodeAppDiscoveryFs, type AppDiscoveryFsErrorCode } from './node-app-discovery-fs.js';
|
|
4
|
+
import type { McpAppRegistry } from './types.js';
|
|
5
|
+
export type WorkspaceAppSource = 'apps' | 'skills';
|
|
6
|
+
export type WorkspaceAppDiagnosticCode = 'MANIFEST_MISSING' | 'MANIFEST_INVALID' | 'ENTRY_INVALID' | 'INITIAL_STATE_INVALID' | 'DUPLICATE_ID' | 'RESERVED_ID' | 'PATH_ESCAPED' | 'LIMIT_EXCEEDED' | 'EXEC_DENIED';
|
|
7
|
+
export interface WorkspaceAppDiagnostic {
|
|
8
|
+
readonly code: WorkspaceAppDiagnosticCode;
|
|
9
|
+
readonly pluginId?: string;
|
|
10
|
+
readonly source: WorkspaceAppSource;
|
|
11
|
+
readonly relativePath: string;
|
|
12
|
+
}
|
|
13
|
+
export type McpAppDiscoveryDiagnostic = WorkspaceAppDiagnostic;
|
|
14
|
+
export type AppDiscoveryDiagnostic = WorkspaceAppDiagnostic;
|
|
15
|
+
export type AppDiscoveryDirectoryEntryKind = 'file' | 'directory' | 'symlink' | 'other';
|
|
16
|
+
export interface AppDiscoveryDirectoryEntry {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly kind: AppDiscoveryDirectoryEntryKind;
|
|
19
|
+
}
|
|
20
|
+
export type AppDiscoveryDirectoryListing = readonly AppDiscoveryDirectoryEntry[] | readonly string[];
|
|
21
|
+
export type AppDiscoveryBytes = Uint8Array | ArrayBuffer | readonly number[];
|
|
22
|
+
export type AppDiscoveryMaybePromise<T> = T | PromiseLike<T>;
|
|
23
|
+
export interface AppDiscoveryFileSystem {
|
|
24
|
+
readonly listDirectory?: (root: string, relativePath: string) => AppDiscoveryMaybePromise<AppDiscoveryDirectoryListing>;
|
|
25
|
+
readonly readDirectory?: (root: string, relativePath: string) => AppDiscoveryMaybePromise<AppDiscoveryDirectoryListing>;
|
|
26
|
+
readonly readdir?: (root: string, relativePath: string) => AppDiscoveryMaybePromise<AppDiscoveryDirectoryListing>;
|
|
27
|
+
readonly readVerifiedFile?: (root: string, relativePath: string, byteLimit: number) => AppDiscoveryMaybePromise<AppDiscoveryBytes>;
|
|
28
|
+
readonly readFileVerified?: (root: string, relativePath: string, byteLimit: number) => AppDiscoveryMaybePromise<AppDiscoveryBytes>;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkspaceAppReservedCatalog {
|
|
31
|
+
readonly appIds?: Iterable<string>;
|
|
32
|
+
readonly definitionIds?: Iterable<string>;
|
|
33
|
+
readonly toolNames?: Iterable<string>;
|
|
34
|
+
}
|
|
35
|
+
export type WorkspaceAppBuiltinCatalog = Pick<McpAppRegistry, 'listMcpApps' | 'listMcpAppTools'>;
|
|
36
|
+
export interface WorkspaceAppDiscoveryOptions {
|
|
37
|
+
readonly filesystem?: AppDiscoveryFileSystem;
|
|
38
|
+
readonly fileSystem?: AppDiscoveryFileSystem;
|
|
39
|
+
readonly fs?: AppDiscoveryFileSystem;
|
|
40
|
+
readonly clock?: () => number;
|
|
41
|
+
readonly reserved?: WorkspaceAppReservedCatalog;
|
|
42
|
+
readonly builtin?: WorkspaceAppReservedCatalog;
|
|
43
|
+
readonly builtins?: WorkspaceAppReservedCatalog | WorkspaceAppBuiltinCatalog;
|
|
44
|
+
readonly builtinCatalog?: WorkspaceAppBuiltinCatalog;
|
|
45
|
+
readonly reservedAppIds?: Iterable<string>;
|
|
46
|
+
readonly reservedDefinitionIds?: Iterable<string>;
|
|
47
|
+
readonly reservedToolNames?: Iterable<string>;
|
|
48
|
+
}
|
|
49
|
+
export interface WorkspaceAppToolNames {
|
|
50
|
+
readonly read: string;
|
|
51
|
+
readonly action?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface WorkspaceAppResourceSnapshot {
|
|
54
|
+
readonly entry: {
|
|
55
|
+
readonly path: 'ui/index.html';
|
|
56
|
+
readonly hash: string;
|
|
57
|
+
readonly bytes: readonly number[];
|
|
58
|
+
};
|
|
59
|
+
readonly initialState?: {
|
|
60
|
+
readonly path: 'ui/state.json';
|
|
61
|
+
readonly hash: string;
|
|
62
|
+
readonly bytes: readonly number[];
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface WorkspaceAppCandidate {
|
|
66
|
+
readonly appId: string;
|
|
67
|
+
readonly pluginId: string;
|
|
68
|
+
readonly definitionId: string;
|
|
69
|
+
readonly version: number;
|
|
70
|
+
readonly source: WorkspaceAppSource;
|
|
71
|
+
readonly relativePath: string;
|
|
72
|
+
readonly manifest: UiPluginManifestV2;
|
|
73
|
+
readonly normalized: UiPluginNormalizedManifestV2;
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly description: string;
|
|
76
|
+
readonly icon?: string;
|
|
77
|
+
readonly tone?: UiPluginManifestV2['tone'];
|
|
78
|
+
readonly definition: UiDefinition;
|
|
79
|
+
readonly handlers: Readonly<Record<string, UiPluginHandlerMetadata>>;
|
|
80
|
+
readonly resources: WorkspaceAppResourceSnapshot;
|
|
81
|
+
readonly html: string;
|
|
82
|
+
readonly entryBytes: readonly number[];
|
|
83
|
+
readonly entryHash: string;
|
|
84
|
+
readonly initialState: JsonObject;
|
|
85
|
+
readonly initialStateBytes?: readonly number[];
|
|
86
|
+
readonly initialStateHash?: string;
|
|
87
|
+
readonly sourceHash: string;
|
|
88
|
+
readonly toolNames: WorkspaceAppToolNames;
|
|
89
|
+
}
|
|
90
|
+
export interface WorkspaceAppDiscoveryResult {
|
|
91
|
+
readonly apps: readonly WorkspaceAppCandidate[];
|
|
92
|
+
readonly diagnostics: readonly WorkspaceAppDiagnostic[];
|
|
93
|
+
readonly candidates?: readonly WorkspaceAppCandidate[];
|
|
94
|
+
}
|
|
95
|
+
export declare const WORKSPACE_APP_TOOL_PREFIX = "crewx_local_app_";
|
|
96
|
+
export declare const LOCAL_APP_TOOL_PREFIX = "crewx_local_app_";
|
|
97
|
+
export declare const MCP_APP_WORKSPACE_TOOL_PREFIX = "crewx_local_app_";
|
|
98
|
+
export declare function deriveWorkspaceAppToolNames(pluginId: string): WorkspaceAppToolNames;
|
|
99
|
+
export declare function deriveWorkspaceAppToolName(pluginId: string, kind?: 'read' | 'action'): string;
|
|
100
|
+
export declare function discoverWorkspaceApps(workspaceRoot: string, fs?: AppDiscoveryFileSystem, options?: WorkspaceAppDiscoveryOptions): Promise<WorkspaceAppDiscoveryResult>;
|
|
101
|
+
export declare function discoverWorkspaceApps(workspaceRoot: string, options?: WorkspaceAppDiscoveryOptions): Promise<WorkspaceAppDiscoveryResult>;
|
|
102
|
+
export declare const discoverWorkspaceAppCandidates: typeof discoverWorkspaceApps;
|
|
103
|
+
export declare const scanWorkspaceApps: typeof discoverWorkspaceApps;
|
|
104
|
+
export { AppDiscoveryFsError, NodeAppDiscoveryFs, NodeAppDiscoveryFsAdapter, defaultAppDiscoveryFs, defaultNodeAppDiscoveryFs, };
|
|
105
|
+
export type { AppDiscoveryFsErrorCode };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type McpAppContractErrorCode = 'APP_ID_INVALID' | 'APP_ID_CONFLICT' | 'TOOL_ID_INVALID' | 'TOOL_ID_CONFLICT' | 'RESOURCE_URI_INVALID' | 'RESOURCE_NOT_FOUND' | 'HTML_INVALID' | 'TOOL_INVALID' | 'STATE_INVALID' | 'STATE_PROJECTION_INVALID' | 'BUTTON_INVALID' | 'SERIALIZATION_INVALID';
|
|
2
|
+
export declare class McpAppContractError extends Error {
|
|
3
|
+
readonly code: McpAppContractErrorCode;
|
|
4
|
+
readonly name = "McpAppContractError";
|
|
5
|
+
constructor(code: McpAppContractErrorCode, message?: string);
|
|
6
|
+
}
|
|
7
|
+
export declare function rejectMcpApp(code: McpAppContractErrorCode, message?: string): never;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type { McpAppContractErrorCode } from './errors.js';
|
|
2
|
+
export { McpAppContractError } from './errors.js';
|
|
3
|
+
export { INSTALLED_APP_ENTRY, InstalledAppRefError, buildInstalledAppRef, validateInstalledAppRef, } from './installed-app-ref.js';
|
|
4
|
+
export type { BuildInstalledAppRefInput, InstalledAppPackageFile, InstalledAppRef, InstalledAppRefErrorCode, } from './installed-app-ref.js';
|
|
5
|
+
export { MAX_HTML_LENGTH, createMcpAppRegistry, createBuiltinMcpAppRegistry, buildMcpAppLocalRegistration, createMcpAppLocalRegistration, registerLocalMcpApp, createMcpAppWorkspaceRegistry, createWorkspaceAppRegistry, createWorkspaceMcpAppRegistry, registerMcpApp, resolveMcpAppResource, resolveLocalMcpAppResource, requireMcpAppResource, toMcpAppToolRegistration, } 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 type { AppDiscoveryBytes, AppDiscoveryDiagnostic, AppDiscoveryDirectoryEntry, AppDiscoveryDirectoryEntryKind, AppDiscoveryDirectoryListing, AppDiscoveryFileSystem, AppDiscoveryFsErrorCode, AppDiscoveryMaybePromise, WorkspaceAppDiscoveryOptions as AppDiscoveryOptions, McpAppDiscoveryDiagnostic, WorkspaceAppBuiltinCatalog, WorkspaceAppCandidate, WorkspaceAppDiscoveryOptions, WorkspaceAppDiscoveryResult, WorkspaceAppDiagnostic, WorkspaceAppDiagnosticCode, WorkspaceAppResourceSnapshot, WorkspaceAppReservedCatalog, WorkspaceAppSource, WorkspaceAppToolNames, } from './discovery.js';
|
|
8
|
+
export { createWorkspaceAppCatalog, discoverWorkspaceAppCatalog, hashAppDefinition, hashCrewxAppDefinition, listWorkspaceApps, } from './catalog.js';
|
|
9
|
+
export type { CrewxAppBuiltinCatalog, CrewxAppCapability, CrewxAppCatalogOptions, CrewxAppCatalogResult, CrewxAppDefinitionHashInput, CrewxAppDefinitionSummary, CrewxAppDiagnostic, CrewxAppDiagnosticCode, CrewxAppDiagnosticSource, CrewxAppInstalledProjection, CrewxAppLocalDefinitionRef, CrewxAppOrigin, CrewxAppOwnership, CrewxAppShareability, CrewxAppSharingAvailability, CrewxAppSummary, } from './types.js';
|
|
10
|
+
export { MCP_APP_PROJECTION_MAX_BYTES, buildMcpAppStateDescriptor, buildMcpAppStateProjections, buildTerminalMcpAppStateDescriptor, buildTerminalMcpAppStateProjections, createMcpAppToolResult, serializeMcpAppStateJson, serializeMcpAppStateXml, } from './projection.js';
|
|
11
|
+
export { buildMcpAppsContext } from './apps-context.js';
|
|
12
|
+
export type { McpAppsContext } from './apps-context.js';
|
|
13
|
+
export { buildStateSetHandler, createStateSetHandler, } from './state-set.js';
|
|
14
|
+
export type { StateSetHandlerBuildInput } from './state-set.js';
|
|
15
|
+
export { MCP_APP_HOST_TOOL_ALLOWLIST, MCP_APP_LOCAL_RESOURCE_MIME_TYPE, MCP_APP_RESOURCE_MIME_TYPE, MCP_APP_RESOURCE_URI_PREFIX, } from './types.js';
|
|
16
|
+
export type { McpAppActionDispatcherToolInput, McpAppActionToolDescriptor, McpAppActionToolInput, McpAppButtonDescriptor, McpAppButtonInput, McpAppDescriptor, McpAppDescriptorInput, McpAppInputSchema, McpAppTone, McpUiResourceCsp, McpAppRegistry, McpAppResource, McpAppServerStateInput, McpAppStateDescriptor, McpAppStateProjections, McpAppHostToolInput, McpAppHostToolName, McpAppReadToolInput, McpAppSingleActionToolInput, McpAppToolCommonInput, McpAppToolDescriptor, McpAppToolInput, McpAppToolMetadata, McpAppToolRegistration, McpAppToolResult, McpAppToolVisibility, McpAppInstanceResourceBinding, McpAppMcpResourceBinding, McpAppResourceBinding, McpAppLocalResource, McpAppLocalRegistrationInput, McpAppLocalReadToolDescriptor, McpAppLocalActionToolDescriptor, McpAppLocalToolDescriptor, McpAppLocalRegistration, McpAppBuiltinRegistration, McpAppResolvedRegistration, McpAppLocalLauncher, McpAppBuiltinLauncher, McpAppLauncher, WorkspaceAppLauncher, WorkspaceAppResolvedRegistration, McpAppWorkspaceRegistry, WorkspaceAppRegistry, McpAppWorkspaceRegistryInput, } from './types.js';
|
|
17
|
+
export { buildWorkspaceAppSnapshot, discoverWorkspaceAppSnapshot, reconfirmWorkspaceAppSnapshot, } from './workspace-snapshot.js';
|
|
18
|
+
export type { WorkspaceAppSnapshot, WorkspaceAppSnapshotBuildOptions, WorkspaceAppSnapshotOptions, WorkspaceAppSnapshotReconfirmResult, WorkspaceAppSnapshotResource, WorkspaceAppSnapshotInitialState, WorkspaceAppInitialState, } from './workspace-snapshot.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { UiDefinition, UiDefinitionRef } from '../ui-instance/types.js';
|
|
2
|
+
export declare const INSTALLED_APP_ENTRY: "ui/index.html";
|
|
3
|
+
export type InstalledAppRefErrorCode = 'APP_ID_INVALID' | 'DEFINITION_REF_INVALID' | 'ENTRY_DUPLICATE' | 'ENTRY_PATH_INVALID' | 'ENTRY_MISSING' | 'ENTRY_HASH_INVALID' | 'INSTALLED_APP_REF_INVALID';
|
|
4
|
+
export declare class InstalledAppRefError extends Error {
|
|
5
|
+
readonly code: InstalledAppRefErrorCode;
|
|
6
|
+
readonly name = "InstalledAppRefError";
|
|
7
|
+
constructor(code: InstalledAppRefErrorCode, message?: string);
|
|
8
|
+
}
|
|
9
|
+
export interface InstalledAppRef {
|
|
10
|
+
readonly appId: string;
|
|
11
|
+
readonly definition: UiDefinitionRef;
|
|
12
|
+
readonly entry: typeof INSTALLED_APP_ENTRY;
|
|
13
|
+
readonly entryHash: string;
|
|
14
|
+
}
|
|
15
|
+
export interface InstalledAppPackageFile {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly sha256: string;
|
|
18
|
+
}
|
|
19
|
+
export interface BuildInstalledAppRefInput {
|
|
20
|
+
readonly appId: string;
|
|
21
|
+
readonly definition: UiDefinition;
|
|
22
|
+
readonly packageFiles: readonly InstalledAppPackageFile[];
|
|
23
|
+
}
|
|
24
|
+
export declare function validateInstalledAppRef(value: unknown): InstalledAppRef;
|
|
25
|
+
export declare function buildInstalledAppRef(input: BuildInstalledAppRefInput): InstalledAppRef;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type AppDiscoveryFsErrorCode = 'NOT_FOUND' | 'READ_DENIED' | 'LIMIT_EXCEEDED' | 'PATH_ESCAPED' | 'IDENTITY_CHANGED' | 'TOCTOU' | 'UNSUPPORTED';
|
|
2
|
+
export declare class AppDiscoveryFsError extends Error {
|
|
3
|
+
readonly code: AppDiscoveryFsErrorCode;
|
|
4
|
+
readonly name = "AppDiscoveryFsError";
|
|
5
|
+
constructor(code: AppDiscoveryFsErrorCode);
|
|
6
|
+
}
|
|
7
|
+
export interface NodeAppDiscoveryDirectoryEntry {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly kind: 'file' | 'directory' | 'symlink' | 'other';
|
|
10
|
+
}
|
|
11
|
+
export declare class NodeAppDiscoveryFs {
|
|
12
|
+
listDirectory(root: string, relativePath: string): Promise<readonly NodeAppDiscoveryDirectoryEntry[]>;
|
|
13
|
+
readdir(root: string, relativePath: string): Promise<readonly NodeAppDiscoveryDirectoryEntry[]>;
|
|
14
|
+
readDirectory(root: string, relativePath: string): Promise<readonly NodeAppDiscoveryDirectoryEntry[]>;
|
|
15
|
+
readVerifiedFile(root: string, relativePath: string, byteLimit: number): Promise<Uint8Array>;
|
|
16
|
+
readFileVerified(root: string, relativePath: string, byteLimit: number): Promise<Uint8Array>;
|
|
17
|
+
}
|
|
18
|
+
export declare const defaultAppDiscoveryFs: NodeAppDiscoveryFs;
|
|
19
|
+
export declare const defaultNodeAppDiscoveryFs: NodeAppDiscoveryFs;
|
|
20
|
+
export declare const NodeAppDiscoveryFsAdapter: typeof NodeAppDiscoveryFs;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JsonObject } from '../ui-instance/types.js';
|
|
2
|
+
import type { McpAppServerStateInput, McpAppStateDescriptor, McpAppStateProjections, McpAppToolDescriptor, McpAppToolResult } from './types.js';
|
|
3
|
+
export declare const MCP_APP_PROJECTION_MAX_BYTES: number;
|
|
4
|
+
export declare function buildMcpAppStateDescriptor(input: McpAppServerStateInput): McpAppStateDescriptor;
|
|
5
|
+
export declare function buildTerminalMcpAppStateDescriptor(input: McpAppServerStateInput): McpAppStateDescriptor;
|
|
6
|
+
export declare function serializeMcpAppStateJson(descriptor: McpAppStateDescriptor): string;
|
|
7
|
+
export declare function serializeMcpAppStateXml(descriptor: McpAppStateDescriptor): string;
|
|
8
|
+
export declare function buildMcpAppStateProjections(input: McpAppServerStateInput): McpAppStateProjections;
|
|
9
|
+
export declare function buildTerminalMcpAppStateProjections(input: McpAppServerStateInput): McpAppStateProjections;
|
|
10
|
+
export declare function createMcpAppToolResult(tool: Pick<McpAppToolDescriptor, 'textFallback'>, options?: {
|
|
11
|
+
structuredContent?: JsonObject;
|
|
12
|
+
meta?: JsonObject;
|
|
13
|
+
}): McpAppToolResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type McpAppDescriptor, type McpAppDescriptorInput, type McpAppInputSchema, type McpAppLocalRegistration, type McpAppLocalRegistrationInput, type McpAppLocalResource, type McpAppRegistry, type McpAppResource, type McpAppWorkspaceRegistry, type McpAppWorkspaceRegistryInput, type McpAppToolDescriptor, type McpAppToolRegistration } from './types.js';
|
|
2
|
+
export declare const MAX_HTML_LENGTH: number;
|
|
3
|
+
export declare function createMcpAppRegistry(): McpAppRegistry;
|
|
4
|
+
export declare function createBuiltinMcpAppRegistry(): McpAppRegistry;
|
|
5
|
+
export declare function registerMcpApp(registry: McpAppRegistry, input: McpAppDescriptorInput): McpAppDescriptor;
|
|
6
|
+
export declare function resolveMcpAppResource(registry: McpAppRegistry, uri: string): McpAppResource | null;
|
|
7
|
+
export declare function requireMcpAppResource(registry: McpAppRegistry, uri: string): McpAppResource;
|
|
8
|
+
export declare function toMcpAppToolRegistration(tool: McpAppToolDescriptor): McpAppToolRegistration;
|
|
9
|
+
export declare function buildMcpAppLocalRegistration(input: McpAppLocalRegistrationInput): McpAppLocalRegistration;
|
|
10
|
+
export declare const createMcpAppLocalRegistration: typeof buildMcpAppLocalRegistration;
|
|
11
|
+
export declare const registerLocalMcpApp: typeof buildMcpAppLocalRegistration;
|
|
12
|
+
export declare function createMcpAppWorkspaceRegistry(input?: McpAppWorkspaceRegistryInput): McpAppWorkspaceRegistry;
|
|
13
|
+
export declare const createWorkspaceAppRegistry: typeof createMcpAppWorkspaceRegistry;
|
|
14
|
+
export declare const createWorkspaceMcpAppRegistry: typeof createMcpAppWorkspaceRegistry;
|
|
15
|
+
export declare function createMcpAppLocalActionInputSchema(actions: readonly {
|
|
16
|
+
readonly actionId: string;
|
|
17
|
+
readonly inputSchema: McpAppInputSchema;
|
|
18
|
+
}[]): McpAppInputSchema;
|
|
19
|
+
export declare function resolveLocalMcpAppResource(registry: McpAppWorkspaceRegistry, appId: string, definitionHash?: string): McpAppLocalResource | null;
|