@crewx/sdk 0.9.0-rc.13 → 0.9.0-rc.131
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 +11 -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 +18 -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 +6 -3
- package/dist/config/pricing.generated.d.ts +4 -0
- package/dist/config/pricing.types.d.ts +4 -0
- 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 +934 -224
- package/dist/esm/node/index.js +2 -0
- package/dist/esm/plugins/index.js +341 -214
- package/dist/esm/process/index.js +1 -0
- package/dist/esm/publish/index.js +2 -0
- package/dist/esm/repository/index.js +416 -211
- package/dist/esm/skills/index.js +2 -0
- package/dist/esm/testing/index.js +1 -1
- package/dist/events/types.d.ts +9 -0
- package/dist/facade/Crewx.d.ts +58 -5
- package/dist/facade/task-ticket.d.ts +14 -0
- 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 +17 -1
- package/dist/index.browser.js +6 -2
- package/dist/index.d.ts +122 -17
- package/dist/index.js +934 -224
- 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/process-owner.d.ts +20 -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 +45 -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/agent-access.d.ts +26 -0
- package/dist/mcp-app/apps-context.d.ts +6 -0
- package/dist/mcp-app/bundle-provenance.d.ts +3 -0
- package/dist/mcp-app/catalog.d.ts +7 -0
- package/dist/mcp-app/content-channel.d.ts +89 -0
- package/dist/mcp-app/content-declarations.d.ts +29 -0
- package/dist/mcp-app/dev-checks.d.ts +29 -0
- package/dist/mcp-app/discovery.d.ts +153 -0
- package/dist/mcp-app/errors.d.ts +7 -0
- package/dist/mcp-app/index.d.ts +33 -0
- package/dist/mcp-app/installed-app-ref.d.ts +25 -0
- package/dist/mcp-app/model-context.d.ts +29 -0
- package/dist/mcp-app/node-app-discovery-fs.d.ts +23 -0
- package/dist/mcp-app/product-bundle-assets.d.ts +27 -0
- package/dist/mcp-app/product-bundle-loader.d.ts +53 -0
- package/dist/mcp-app/projection.d.ts +14 -0
- package/dist/mcp-app/registry.d.ts +28 -0
- package/dist/mcp-app/skill-backend.d.ts +133 -0
- package/dist/mcp-app/state-set.d.ts +9 -0
- package/dist/mcp-app/types.d.ts +458 -0
- package/dist/mcp-app/workspace-app-assets.d.ts +42 -0
- package/dist/mcp-app/workspace-app-scan-cache.d.ts +24 -0
- package/dist/mcp-app/workspace-snapshot.d.ts +70 -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/0032_ui_instance_opened_by.sql +1 -0
- package/dist/migrations/0033_thread_creator_boundary_guard.sql +38 -0
- package/dist/migrations/0034_keen_fallen_one.sql +36 -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/0034_snapshot.json +3473 -0
- package/dist/migrations/meta/_journal.json +175 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +2 -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 +341 -214
- 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 +14 -2
- 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/codex-item.d.ts +1 -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 +5 -0
- package/dist/provider/cli/index.d.ts +3 -2
- package/dist/provider/cli/meta.d.ts +5 -0
- package/dist/provider/cli/protocol-envelope.d.ts +3 -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 +37 -5
- package/dist/repository/index.js +416 -211
- 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 +224 -7
- package/dist/repository/thread-history.repository.d.ts +193 -0
- package/dist/repository/thread-origin-verdict.d.ts +27 -0
- package/dist/repository/thread-title.types.d.ts +29 -0
- package/dist/repository/thread.repository.d.ts +72 -6
- package/dist/repository/usage-backfill.d.ts +62 -0
- package/dist/repository/usage-from-logs.d.ts +21 -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 +11 -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-creator-unverified.d.ts +45 -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 +358 -0
- package/dist/schema/ui-instance-repins.d.ts +222 -0
- package/dist/schema/ui-instances.d.ts +305 -0
- package/dist/schema/workspaces.d.ts +17 -0
- package/dist/skills/index.d.ts +15 -0
- package/dist/skills/index.js +2 -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 +1572 -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 +18 -0
- package/dist/ui-instance/index.d.ts +11 -0
- package/dist/ui-instance/json.d.ts +19 -0
- package/dist/ui-instance/lineage.d.ts +22 -0
- package/dist/ui-instance/runtime.d.ts +18 -0
- package/dist/ui-instance/store.d.ts +184 -0
- package/dist/ui-instance/types.d.ts +319 -0
- package/dist/ui-plugin/csp.d.ts +25 -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 +190 -0
- package/dist/ui-plugin/validator.d.ts +15 -0
- package/dist/utils/crewx-executable.d.ts +76 -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/local-identity.d.ts +2 -0
- 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 +49 -2
- package/templates/agents/default.yaml +284 -128
- package/templates/documents/crewx-manual.md +138 -138
- package/templates/documents/crewx-quick-guide.md +8 -7
- 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,80 @@
|
|
|
1
|
+
export declare const PROCESS_LEASE_FILENAME = "process-lease.json";
|
|
2
|
+
export type ProcessLeaseClock = () => number;
|
|
3
|
+
export interface ProcessLeaseProcessProbe {
|
|
4
|
+
isAlive(pid: number): boolean | 'unknown';
|
|
5
|
+
getStartIdentity(pid: number): string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface ProcessLeaseRecord {
|
|
8
|
+
leaseId: string;
|
|
9
|
+
ownerId: string;
|
|
10
|
+
pid: number;
|
|
11
|
+
pidStartIdentity: string;
|
|
12
|
+
host: string;
|
|
13
|
+
startedAt: string;
|
|
14
|
+
heartbeatAt: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ProcessLeaseOptions {
|
|
17
|
+
leasePath?: string;
|
|
18
|
+
ownerId?: string;
|
|
19
|
+
pid?: number;
|
|
20
|
+
pidStartIdentity?: string;
|
|
21
|
+
host?: string;
|
|
22
|
+
clock?: ProcessLeaseClock;
|
|
23
|
+
now?: ProcessLeaseClock;
|
|
24
|
+
processProbe?: ProcessLeaseProcessProbe;
|
|
25
|
+
probe?: ProcessLeaseProcessProbe;
|
|
26
|
+
}
|
|
27
|
+
export interface ProcessLeasePathOptions {
|
|
28
|
+
leasePath?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ProcessLeaseMutationOptions extends ProcessLeaseOptions {
|
|
31
|
+
leaseId: string;
|
|
32
|
+
ownerId: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ProcessLeaseReclaimOptions extends ProcessLeaseOptions {
|
|
35
|
+
leaseId: string;
|
|
36
|
+
expectedOwnerId?: string;
|
|
37
|
+
}
|
|
38
|
+
export type ProcessLeaseReason = 'live-owner' | 'pid-reused' | 'owner-dead' | 'identity-unknown' | 'marker-corrupt' | 'marker-unreadable' | 'contention' | 'owner-mismatch' | 'io-error' | 'invalid-options';
|
|
39
|
+
export type ProcessLeaseReadResult = {
|
|
40
|
+
status: 'absent';
|
|
41
|
+
} | {
|
|
42
|
+
status: 'present';
|
|
43
|
+
record: ProcessLeaseRecord;
|
|
44
|
+
} | {
|
|
45
|
+
status: 'unknown';
|
|
46
|
+
reason: 'marker-corrupt' | 'marker-unreadable' | 'io-error';
|
|
47
|
+
};
|
|
48
|
+
export interface ProcessLeaseHandle {
|
|
49
|
+
readonly leasePath: string;
|
|
50
|
+
readonly leaseId: string;
|
|
51
|
+
readonly ownerId: string;
|
|
52
|
+
readonly pid: number;
|
|
53
|
+
readonly pidStartIdentity: string;
|
|
54
|
+
readonly record: ProcessLeaseRecord;
|
|
55
|
+
renew(): boolean;
|
|
56
|
+
release(): boolean;
|
|
57
|
+
}
|
|
58
|
+
export type ProcessLeaseAcquireResult = {
|
|
59
|
+
acquired: true;
|
|
60
|
+
status: 'owner';
|
|
61
|
+
role: 'owner';
|
|
62
|
+
leaseId: string;
|
|
63
|
+
ownerId: string;
|
|
64
|
+
record: ProcessLeaseRecord;
|
|
65
|
+
lease: ProcessLeaseHandle;
|
|
66
|
+
} | {
|
|
67
|
+
acquired: false;
|
|
68
|
+
status: 'standby';
|
|
69
|
+
role: 'standby';
|
|
70
|
+
reason: ProcessLeaseReason;
|
|
71
|
+
record?: ProcessLeaseRecord;
|
|
72
|
+
};
|
|
73
|
+
export declare function resolveProcessLeasePath(input?: string | ProcessLeasePathOptions): string;
|
|
74
|
+
export declare function getProcessStartIdentity(pid: number): string | null;
|
|
75
|
+
export declare const getProcessStartTime: typeof getProcessStartIdentity;
|
|
76
|
+
export declare function readProcessLease(input?: string | ProcessLeasePathOptions): ProcessLeaseReadResult;
|
|
77
|
+
export declare function acquireProcessLease(options?: ProcessLeaseOptions): ProcessLeaseAcquireResult;
|
|
78
|
+
export declare function renewProcessLease(options: ProcessLeaseMutationOptions): boolean;
|
|
79
|
+
export declare function releaseProcessLease(options: ProcessLeaseMutationOptions): boolean;
|
|
80
|
+
export declare function reclaimProcessLease(options: ProcessLeaseReclaimOptions): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ProcessOwnerIdentity {
|
|
2
|
+
pid: number;
|
|
3
|
+
pidStartIdentity: string;
|
|
4
|
+
host: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ProcessOwnerProbe {
|
|
7
|
+
isAlive(pid: number): boolean | 'unknown';
|
|
8
|
+
getStartIdentity(pid: number): string | null;
|
|
9
|
+
}
|
|
10
|
+
export type ProcessOwnerAssessment = {
|
|
11
|
+
kind: 'live';
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'dead';
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'reused';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'unknown';
|
|
18
|
+
reason: 'identity-unknown';
|
|
19
|
+
};
|
|
20
|
+
export declare function assessProcessOwner(recorded: ProcessOwnerIdentity, current: ProcessOwnerIdentity, probe: ProcessOwnerProbe): ProcessOwnerAssessment;
|
|
@@ -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,45 @@
|
|
|
1
|
+
export declare const UPDATE_QUIESCE_LOCK_FILENAME = "update-quiesce.lock";
|
|
2
|
+
export declare const UPDATE_ADMISSION_RESERVATION_DIRNAME = "update-admission";
|
|
3
|
+
export declare const UPDATE_ADMISSION_SCOPE_ENV = "CREWX_UPDATE_ADMISSION_SCOPE";
|
|
4
|
+
export declare function resolveUpdateQuiesceLockFile(): string;
|
|
5
|
+
export declare function resolveUpdateAdmissionReservationDir(): string;
|
|
6
|
+
export declare function isProcessAlive(pid: number): boolean;
|
|
7
|
+
export declare function isDurablyQuiescing(): boolean;
|
|
8
|
+
export type DurableQuiesceMarkerState = {
|
|
9
|
+
kind: 'absent';
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'owned';
|
|
12
|
+
ownerPid: number;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'unknown';
|
|
15
|
+
};
|
|
16
|
+
export declare function readDurableQuiesceMarkerOwner(): DurableQuiesceMarkerState;
|
|
17
|
+
export type AdmissionMarkerResult = {
|
|
18
|
+
ok: true;
|
|
19
|
+
} | {
|
|
20
|
+
ok: false;
|
|
21
|
+
reason: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function acquireDurableQuiesceMarker(ownerPid: number): AdmissionMarkerResult;
|
|
24
|
+
export declare function releaseDurableQuiesceMarker(ownerPid: number): AdmissionMarkerResult;
|
|
25
|
+
export type ReconcileOutcome = 'absent' | 'cleared' | 'kept-live' | 'kept-unknown';
|
|
26
|
+
export declare function reconcileDurableQuiesceMarkerIfOwnerDead(): ReconcileOutcome;
|
|
27
|
+
export interface UpdateAdmissionReservationEntry {
|
|
28
|
+
taskId: string;
|
|
29
|
+
scheduleId: string;
|
|
30
|
+
corrupt: boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function reserveUpdateAdmission(taskId: string, scheduleId: string, timeoutMs: number): boolean;
|
|
33
|
+
export declare function releaseUpdateAdmissionReservation(taskId: string): void;
|
|
34
|
+
export declare function readUpdateAdmissionReservations(): UpdateAdmissionReservationEntry[];
|
|
35
|
+
export type DurableTaskAdmission = {
|
|
36
|
+
ok: true;
|
|
37
|
+
taskId: string;
|
|
38
|
+
release: () => void;
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
reason: 'ADMISSION_UNKNOWN' | 'UPDATE_QUIESCING';
|
|
42
|
+
message: string;
|
|
43
|
+
};
|
|
44
|
+
export declare const DEFAULT_CLI_ADMISSION_TIMEOUT_MS: number;
|
|
45
|
+
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,26 @@
|
|
|
1
|
+
import type { UiActionConfirmation } from '../ui-instance/types.js';
|
|
2
|
+
import type { UiDefinition } from '../ui-instance/types.js';
|
|
3
|
+
import type { ProductAppBundleProvenance } from './discovery.js';
|
|
4
|
+
export type McpAppAgentAccess = 'allowed' | 'approval_required' | 'denied';
|
|
5
|
+
export interface McpAppAgentAccessAction {
|
|
6
|
+
readonly actionId: string;
|
|
7
|
+
readonly confirmation: UiActionConfirmation | undefined;
|
|
8
|
+
readonly content?: unknown;
|
|
9
|
+
readonly backend?: {
|
|
10
|
+
readonly type: 'core';
|
|
11
|
+
readonly handler: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly type: 'skill';
|
|
14
|
+
readonly command?: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface McpAppVerifiedBundleAccessContext {
|
|
18
|
+
readonly appId: string;
|
|
19
|
+
readonly definition: UiDefinition;
|
|
20
|
+
readonly provenance: ProductAppBundleProvenance;
|
|
21
|
+
}
|
|
22
|
+
export declare function resolveAgentAccess(action: McpAppAgentAccessAction, modelActions?: readonly string[], bundle?: McpAppVerifiedBundleAccessContext): McpAppAgentAccess;
|
|
23
|
+
export declare function listMcpAppAgentActions(actions: readonly McpAppAgentAccessAction[], modelActions?: readonly string[], bundle?: McpAppVerifiedBundleAccessContext): readonly {
|
|
24
|
+
readonly actionId: string;
|
|
25
|
+
readonly access: McpAppAgentAccess;
|
|
26
|
+
}[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { McpAppStateDescriptor } from './types.js';
|
|
2
|
+
import type { McpAppModelContext } from './model-context.js';
|
|
3
|
+
export interface McpAppsContext {
|
|
4
|
+
readonly rendered: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function buildMcpAppsContext(descriptors: readonly McpAppStateDescriptor[] | undefined, modelContext?: McpAppModelContext): McpAppsContext | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function markVerifiedProductAppBundleProvenance<T extends object>(value: T, executableRelativePath?: string): T;
|
|
2
|
+
export declare function isVerifiedProductAppBundleProvenance(value: unknown): value is object;
|
|
3
|
+
export declare function getVerifiedProductAppBundleExecutable(value: unknown): string | undefined;
|
|
@@ -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,89 @@
|
|
|
1
|
+
import { UI_CONTENT_MEDIA_TYPES, isUiContentMediaType, isValidUiAppInstanceId } from './content-declarations.js';
|
|
2
|
+
import type { UiContentMediaType } from './content-declarations.js';
|
|
3
|
+
export { UI_CONTENT_MEDIA_TYPES, isUiContentMediaType, isValidUiAppInstanceId };
|
|
4
|
+
export type { UiContentMediaType };
|
|
5
|
+
export declare const UI_CONTENT_MAX_BYTES: number;
|
|
6
|
+
export declare const UI_CONTENT_MAX_LINES = 20000;
|
|
7
|
+
export declare const UI_CONTENT_TICKET_TTL_MS = 120000;
|
|
8
|
+
export declare const UI_CONTENT_OUTPUT_TTL_MS = 120000;
|
|
9
|
+
export declare const UI_CONTENT_MAX_MEMORY_BYTES: number;
|
|
10
|
+
export declare const UI_CONTENT_ERROR_CODES: readonly ["CONTENT_SOURCE_UNSUPPORTED", "CONTENT_REQUIRED", "CONTENT_EXPIRED", "CONTENT_BINDING_MISMATCH", "CONTENT_DIGEST_MISMATCH", "CONTENT_TOO_LARGE", "CONTENT_ENCODING_INVALID", "CONTENT_BUSY", "IDENTITY_UNAVAILABLE", "EXEC_OUTPUT_INVALID"];
|
|
11
|
+
export type UiContentErrorCode = (typeof UI_CONTENT_ERROR_CODES)[number];
|
|
12
|
+
export interface UiContentInputDeclaration {
|
|
13
|
+
readonly mediaType: UiContentMediaType;
|
|
14
|
+
readonly required?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface UiContentOutputDeclaration {
|
|
17
|
+
readonly mediaType: UiContentMediaType;
|
|
18
|
+
readonly range?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface UiActionContentDeclaration {
|
|
21
|
+
readonly in?: UiContentInputDeclaration;
|
|
22
|
+
readonly out?: UiContentOutputDeclaration;
|
|
23
|
+
}
|
|
24
|
+
export interface UiContentRangeRequest {
|
|
25
|
+
readonly startLine: number;
|
|
26
|
+
readonly lineCount: number;
|
|
27
|
+
}
|
|
28
|
+
export interface UiContentRange extends UiContentRangeRequest {
|
|
29
|
+
readonly totalLines: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ContentFrame {
|
|
32
|
+
readonly bytes: Uint8Array;
|
|
33
|
+
readonly sha256: string;
|
|
34
|
+
readonly lines: number;
|
|
35
|
+
readonly mediaType: UiContentMediaType;
|
|
36
|
+
readonly range?: UiContentRange;
|
|
37
|
+
readonly complete?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface UiContentBinding {
|
|
40
|
+
readonly workspaceId: string;
|
|
41
|
+
readonly threadId: string;
|
|
42
|
+
readonly instanceId: string;
|
|
43
|
+
readonly actionId: string;
|
|
44
|
+
readonly requestId: string;
|
|
45
|
+
}
|
|
46
|
+
export interface UiContentInputTicket {
|
|
47
|
+
readonly ticket: string;
|
|
48
|
+
readonly binding: UiContentBinding;
|
|
49
|
+
readonly sha256: string;
|
|
50
|
+
readonly bytes: number;
|
|
51
|
+
readonly lines: number;
|
|
52
|
+
readonly mediaType: UiContentMediaType;
|
|
53
|
+
readonly expiresAt: number;
|
|
54
|
+
}
|
|
55
|
+
export interface UiContentChannelPort {
|
|
56
|
+
putInput(ticket: UiContentInputTicket, frame: ContentFrame): void;
|
|
57
|
+
lookupInput(ticket: string, now: number): UiContentInputTicket | null;
|
|
58
|
+
consumeInput(ticket: string, now: number): ContentFrame | null;
|
|
59
|
+
reserveOutput(binding: UiContentBinding, now: number): boolean;
|
|
60
|
+
releaseOutput(binding: UiContentBinding): void;
|
|
61
|
+
putOutput(binding: UiContentBinding, frame: ContentFrame, now: number): void;
|
|
62
|
+
readOutput(binding: UiContentBinding, now: number): ContentFrame | null;
|
|
63
|
+
}
|
|
64
|
+
export declare class UiContentChannelError extends Error {
|
|
65
|
+
readonly code: UiContentErrorCode;
|
|
66
|
+
readonly name = "UiContentChannelError";
|
|
67
|
+
constructor(code: UiContentErrorCode);
|
|
68
|
+
}
|
|
69
|
+
export declare function sha256Content(bytes: Uint8Array): string;
|
|
70
|
+
export declare function countContentLines(bytes: Uint8Array): number;
|
|
71
|
+
export declare function decodeContentUtf8(bytes: Uint8Array): string;
|
|
72
|
+
export declare function validateContentBytes(value: unknown, mediaType: unknown): {
|
|
73
|
+
readonly bytes: Uint8Array;
|
|
74
|
+
readonly sha256: string;
|
|
75
|
+
readonly lines: number;
|
|
76
|
+
};
|
|
77
|
+
export interface ValidateContentFrameOptions {
|
|
78
|
+
readonly direction: 'in' | 'out';
|
|
79
|
+
readonly mediaType: UiContentMediaType;
|
|
80
|
+
readonly expectedSha256?: string;
|
|
81
|
+
readonly expectedBytes?: number;
|
|
82
|
+
readonly expectedLines?: number;
|
|
83
|
+
readonly requestedRange?: UiContentRangeRequest;
|
|
84
|
+
}
|
|
85
|
+
export declare function validateContentFrame(value: unknown, options: ValidateContentFrameOptions): ContentFrame;
|
|
86
|
+
export declare function isUiContentDeclaration(value: unknown): value is UiActionContentDeclaration;
|
|
87
|
+
export declare function isUiContentRangeRequest(value: unknown): value is UiContentRangeRequest;
|
|
88
|
+
export declare function contentBindingMatches(left: UiContentBinding, right: UiContentBinding): boolean;
|
|
89
|
+
export declare function isValidUiThreadIdentity(value: unknown): value is string;
|