@crewx/sdk 0.9.0-rc.65 → 0.9.0-rc.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/global-settings.d.ts +14 -0
- package/dist/esm/index.js +99 -92
- package/dist/esm/plugins/index.js +118 -111
- package/dist/esm/repository/index.js +141 -119
- package/dist/facade/Crewx.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +100 -93
- 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/migrations/0016_fuzzy_hemingway.sql +14 -0
- package/dist/migrations/meta/0016_snapshot.json +2419 -0
- package/dist/migrations/meta/_journal.json +7 -0
- package/dist/plugins/index.js +118 -111
- package/dist/repository/db.d.ts +8 -0
- package/dist/repository/index.d.ts +7 -2
- package/dist/repository/index.js +141 -119
- package/dist/repository/task-log-migration.d.ts +74 -0
- package/dist/repository/task-log.repository.d.ts +44 -0
- package/dist/repository/task.repository.d.ts +6 -0
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/task-log-events.d.ts +119 -0
- package/dist/schema/tasks.d.ts +53 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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,14 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS `task_log_events` (
|
|
2
|
+
`id` integer PRIMARY KEY NOT NULL,
|
|
3
|
+
`task_id` text NOT NULL,
|
|
4
|
+
`seq` integer NOT NULL,
|
|
5
|
+
`timestamp` text NOT NULL,
|
|
6
|
+
`level` text NOT NULL,
|
|
7
|
+
`message` text NOT NULL,
|
|
8
|
+
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade
|
|
9
|
+
);
|
|
10
|
+
--> statement-breakpoint
|
|
11
|
+
CREATE UNIQUE INDEX IF NOT EXISTS `task_log_events_task_seq_uq` ON `task_log_events` (`task_id`,`seq`);--> statement-breakpoint
|
|
12
|
+
ALTER TABLE `tasks` ADD `log_storage` text DEFAULT 'blob' NOT NULL CONSTRAINT "tasks_log_storage_ck" CHECK("tasks"."log_storage" IN ('blob', 'events'));--> statement-breakpoint
|
|
13
|
+
ALTER TABLE `tasks` ADD `last_log_seq` integer DEFAULT 0 NOT NULL;--> statement-breakpoint
|
|
14
|
+
ALTER TABLE `tasks` ADD `log_revision` integer DEFAULT 0 NOT NULL;
|