@maintainer-pro/ai-cli 0.1.5 → 0.1.7
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/index.cjs +1094 -51
- package/dist/index.d.cts +176 -6
- package/dist/index.d.ts +176 -6
- package/dist/index.js +1063 -51
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -52,7 +52,7 @@ interface CallAiOptions {
|
|
|
52
52
|
/** Absolute paths to screenshot/image files the agent should inspect. */
|
|
53
53
|
attachmentPaths?: string[];
|
|
54
54
|
/**
|
|
55
|
-
* Compact excerpts from other
|
|
55
|
+
* Compact excerpts from other project chats.
|
|
56
56
|
* Injected into the prompt for the model to use when relevant.
|
|
57
57
|
*/
|
|
58
58
|
priorConversationsContext?: string;
|
|
@@ -299,17 +299,25 @@ interface ChatStoreLike {
|
|
|
299
299
|
}>): Promise<void>;
|
|
300
300
|
/**
|
|
301
301
|
* Optional remote/local upload hook. When present, chat images are persisted
|
|
302
|
-
* through the store instead of
|
|
302
|
+
* through the store instead of the project data uploads folder.
|
|
303
303
|
* `localPaths` are absolute paths for CLI inspection; `refs` are stored on messages.
|
|
304
304
|
*/
|
|
305
305
|
uploadAttachments?(conversationId: string, attachments: ChatAttachment[] | undefined): Promise<{
|
|
306
306
|
refs: string[];
|
|
307
307
|
localPaths: string[];
|
|
308
308
|
}>;
|
|
309
|
+
/**
|
|
310
|
+
* Download stored message images into the project data folder so the coding CLI can
|
|
311
|
+
* open them. Used on working turns where the chat POST has no image bytes.
|
|
312
|
+
*/
|
|
313
|
+
materializeMessageAttachments?(conversationId: string, messageId: string | undefined, workspaceDir: string): Promise<string[]>;
|
|
309
314
|
}
|
|
310
315
|
interface ChatHandlerOptions {
|
|
311
316
|
systemPrompt: string;
|
|
312
317
|
workspaceDir?: string;
|
|
318
|
+
/** Bridge-owned data dir (~/.maintainer-pro/projects/<id>). */
|
|
319
|
+
dataDir?: string;
|
|
320
|
+
sandboxId?: string;
|
|
313
321
|
providerPreference?: CallAiOptions["providerPreference"];
|
|
314
322
|
providers?: AiProvider[];
|
|
315
323
|
tools?: ToolSchemaMap;
|
|
@@ -328,8 +336,11 @@ declare function toNextRoute(handlers: ChatHandlers): {
|
|
|
328
336
|
POST: (request: Request) => Promise<Response>;
|
|
329
337
|
};
|
|
330
338
|
|
|
331
|
-
/** Persist chat image attachments under the
|
|
332
|
-
declare function saveChatAttachments(attachments: ChatAttachment[] | undefined, workspaceDir: string
|
|
339
|
+
/** Persist chat image attachments under the project data dir and return absolute paths. */
|
|
340
|
+
declare function saveChatAttachments(attachments: ChatAttachment[] | undefined, workspaceDir: string, extra?: {
|
|
341
|
+
dataDir?: string | null;
|
|
342
|
+
sandboxId?: string | null;
|
|
343
|
+
}): Promise<string[]>;
|
|
333
344
|
|
|
334
345
|
interface LocalStoredMessage {
|
|
335
346
|
id: string;
|
|
@@ -371,6 +382,7 @@ type SyncedChatStore = ChatStoreLike & {
|
|
|
371
382
|
};
|
|
372
383
|
type RemoteStore = ChatStoreLike & {
|
|
373
384
|
uploadAttachments?: NonNullable<ChatStoreLike["uploadAttachments"]>;
|
|
385
|
+
materializeMessageAttachments?: NonNullable<ChatStoreLike["materializeMessageAttachments"]>;
|
|
374
386
|
listSnapshot?: () => Promise<CachedConversation[]>;
|
|
375
387
|
};
|
|
376
388
|
type WorkingTurnEvent = {
|
|
@@ -418,7 +430,7 @@ type UploadResult = {
|
|
|
418
430
|
attachmentIds: string[];
|
|
419
431
|
};
|
|
420
432
|
/**
|
|
421
|
-
* Persist chat data via Maintainer Pro HTTP API (no
|
|
433
|
+
* Persist chat data via Maintainer Pro HTTP API (no writes into the host app).
|
|
422
434
|
*/
|
|
423
435
|
declare function createMaintainerProStore(options: MaintainerProStoreOptions): SyncedChatStore & {
|
|
424
436
|
uploadAttachments: (conversationId: string, attachments: ChatAttachment[] | undefined) => Promise<UploadResult>;
|
|
@@ -472,6 +484,13 @@ interface WorkspaceInspectResult {
|
|
|
472
484
|
provider: string;
|
|
473
485
|
rawText: string;
|
|
474
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Read-only config analysis for interactive onboarding.
|
|
489
|
+
* Never instructs the agent to edit the repo; times out so UI stays responsive.
|
|
490
|
+
*/
|
|
491
|
+
declare function inspectConfigOnly(input: WorkspaceInspectInput, opts?: {
|
|
492
|
+
timeoutMs?: number;
|
|
493
|
+
}): Promise<WorkspaceInspectResult>;
|
|
475
494
|
/**
|
|
476
495
|
* Ask the coding-agent CLI (via callAi) to inspect a workspace and optionally
|
|
477
496
|
* repair setup issues. Used by ai-bridge so host-process planning uses the
|
|
@@ -479,4 +498,155 @@ interface WorkspaceInspectResult {
|
|
|
479
498
|
*/
|
|
480
499
|
declare function inspectAndRepairWorkspace(input: WorkspaceInspectInput): Promise<WorkspaceInspectResult>;
|
|
481
500
|
|
|
482
|
-
|
|
501
|
+
/** Top-level folder under the user home (bridge.json, per-project data). */
|
|
502
|
+
declare const MAINTAINER_PRO_HOME_DIR = ".maintainer-pro";
|
|
503
|
+
declare const HOST_APPS_FILE = "apps.json";
|
|
504
|
+
type ProjectDataInput = {
|
|
505
|
+
workspaceDir: string;
|
|
506
|
+
/** Distinguishes sandboxes when one bridge runs several apps. */
|
|
507
|
+
sandboxId?: string | null;
|
|
508
|
+
/** Absolute override (e.g. already resolved by the bridge). */
|
|
509
|
+
dataDir?: string | null;
|
|
510
|
+
};
|
|
511
|
+
declare function maintainerProHome(): string;
|
|
512
|
+
declare function projectIdForFolder(folder: string): string;
|
|
513
|
+
declare function sanitizeProjectId(id: string): string;
|
|
514
|
+
/**
|
|
515
|
+
* Per-project data lives next to the bridge, not in the host app:
|
|
516
|
+
* `~/.maintainer-pro/projects/<sandboxId or folder-hash>/`.
|
|
517
|
+
*/
|
|
518
|
+
declare function resolveProjectDataDir(input: ProjectDataInput): string;
|
|
519
|
+
declare function projectUploadsDir(input: ProjectDataInput): string;
|
|
520
|
+
declare function hostAppsCachePath$1(input: ProjectDataInput): string;
|
|
521
|
+
declare function ensureProjectDataDir(input: ProjectDataInput): string;
|
|
522
|
+
|
|
523
|
+
/** @deprecated Host-apps cache lives under ~/.maintainer-pro/projects/<id>. */
|
|
524
|
+
declare const COLLABORATER_DIR = ".collaborater";
|
|
525
|
+
declare const AI_SERVER_APP_ID = "ai-server";
|
|
526
|
+
declare const AI_SERVER_DEFAULT_PORT = 3100;
|
|
527
|
+
type HostAppRole = "ai-server" | "ui" | "backend" | "app" | "custom";
|
|
528
|
+
type HostAppSource = "default" | "env" | "package" | "ai" | "manual";
|
|
529
|
+
type HostEnvMap = {
|
|
530
|
+
key: string;
|
|
531
|
+
sourceAppId: string;
|
|
532
|
+
};
|
|
533
|
+
type HostApp = {
|
|
534
|
+
id: string;
|
|
535
|
+
name: string;
|
|
536
|
+
role: HostAppRole;
|
|
537
|
+
port: number;
|
|
538
|
+
startCommand?: string | null;
|
|
539
|
+
source: HostAppSource;
|
|
540
|
+
locked?: boolean;
|
|
541
|
+
/** Share URL / CORS UI — the page the browser opens. */
|
|
542
|
+
host?: boolean;
|
|
543
|
+
envMaps?: HostEnvMap[];
|
|
544
|
+
};
|
|
545
|
+
type HostAppsResolveInput = {
|
|
546
|
+
workspaceDir: string;
|
|
547
|
+
appName?: string;
|
|
548
|
+
preferredAiPort?: number;
|
|
549
|
+
/** Desired list from Maintainer Pro — used as source of truth when present. */
|
|
550
|
+
desired?: HostApp[] | null;
|
|
551
|
+
/** Re-scan files / optionally ask the agent. */
|
|
552
|
+
force?: boolean;
|
|
553
|
+
/** Only call the coding-agent CLI when files are missing or conflicting. */
|
|
554
|
+
allowAi?: boolean;
|
|
555
|
+
sandboxId?: string | null;
|
|
556
|
+
dataDir?: string | null;
|
|
557
|
+
};
|
|
558
|
+
type HostAppsResolveResult = {
|
|
559
|
+
apps: HostApp[];
|
|
560
|
+
source: "desired" | "cache" | "env" | "ai" | "default";
|
|
561
|
+
cached: boolean;
|
|
562
|
+
usedAi: boolean;
|
|
563
|
+
confused: boolean;
|
|
564
|
+
reasons: string[];
|
|
565
|
+
fingerprint: string;
|
|
566
|
+
};
|
|
567
|
+
type SetupProposalConfidence = "high" | "medium" | "low";
|
|
568
|
+
type HostAppAlternative = {
|
|
569
|
+
/** Primary app id this alternative can replace. */
|
|
570
|
+
appId: string;
|
|
571
|
+
port: number;
|
|
572
|
+
startCommand?: string | null;
|
|
573
|
+
label: string;
|
|
574
|
+
source: HostAppSource;
|
|
575
|
+
};
|
|
576
|
+
type SetupProposal = {
|
|
577
|
+
apps: HostApp[];
|
|
578
|
+
alternatives: HostAppAlternative[];
|
|
579
|
+
reasons: string[];
|
|
580
|
+
confidence: SetupProposalConfidence;
|
|
581
|
+
projectSummary: string;
|
|
582
|
+
usedAi: boolean;
|
|
583
|
+
needsReview: boolean;
|
|
584
|
+
fingerprint: string;
|
|
585
|
+
};
|
|
586
|
+
type ProposeHostAppsInput = {
|
|
587
|
+
workspaceDir: string;
|
|
588
|
+
appName?: string;
|
|
589
|
+
preferredAiPort?: number;
|
|
590
|
+
/**
|
|
591
|
+
* When true (default), call read-only AI if file detect is confused / low confidence.
|
|
592
|
+
* Never edits the repo.
|
|
593
|
+
*/
|
|
594
|
+
allowAi?: boolean;
|
|
595
|
+
};
|
|
596
|
+
declare function parsePort(value: unknown, fallback?: number): number;
|
|
597
|
+
declare function hostAppsCachePath(folder: string, extra?: {
|
|
598
|
+
sandboxId?: string | null;
|
|
599
|
+
dataDir?: string | null;
|
|
600
|
+
}): string;
|
|
601
|
+
declare function defaultAiServerApp(port?: number): HostApp;
|
|
602
|
+
declare function normalizeHostApp(raw: unknown): HostApp | null;
|
|
603
|
+
declare function normalizeEnvMaps(raw: unknown): HostEnvMap[];
|
|
604
|
+
declare function ensureSingleHost(apps: HostApp[]): HostApp[];
|
|
605
|
+
declare function normalizeHostApps(raw: unknown): HostApp[];
|
|
606
|
+
declare function ensureAiServerApp(apps: HostApp[], preferredPort?: number): HostApp[];
|
|
607
|
+
declare function readProjectEnvLayers(folder: string): {
|
|
608
|
+
merged: Record<string, string>;
|
|
609
|
+
layers: Array<{
|
|
610
|
+
file: string;
|
|
611
|
+
values: Record<string, string>;
|
|
612
|
+
}>;
|
|
613
|
+
};
|
|
614
|
+
declare function hostAppsFingerprint(folder: string): string;
|
|
615
|
+
declare function detectHostAppsFromFiles(folder: string, opts?: {
|
|
616
|
+
preferredAiPort?: number;
|
|
617
|
+
appName?: string;
|
|
618
|
+
}): {
|
|
619
|
+
apps: HostApp[];
|
|
620
|
+
reasons: string[];
|
|
621
|
+
confused: boolean;
|
|
622
|
+
};
|
|
623
|
+
declare function readHostAppsCache(folder: string, extra?: {
|
|
624
|
+
sandboxId?: string | null;
|
|
625
|
+
dataDir?: string | null;
|
|
626
|
+
}): {
|
|
627
|
+
apps: HostApp[];
|
|
628
|
+
fingerprint?: string;
|
|
629
|
+
updatedAt?: string;
|
|
630
|
+
} | null;
|
|
631
|
+
/** @deprecated Use readHostAppsCache. */
|
|
632
|
+
declare const readCollaboraterApps: typeof readHostAppsCache;
|
|
633
|
+
declare function writeHostAppsCache(folder: string, apps: HostApp[], extra?: Record<string, unknown>, loc?: {
|
|
634
|
+
sandboxId?: string | null;
|
|
635
|
+
dataDir?: string | null;
|
|
636
|
+
}): void;
|
|
637
|
+
/** @deprecated Use writeHostAppsCache. */
|
|
638
|
+
declare const writeCollaboraterApps: typeof writeHostAppsCache;
|
|
639
|
+
declare function mergeDesiredHostApps(desired: HostApp[], detected: HostApp[]): HostApp[];
|
|
640
|
+
/**
|
|
641
|
+
* Fast, interactive onboarding propose: file detect first, optional read-only AI.
|
|
642
|
+
* Never edits the repository.
|
|
643
|
+
*/
|
|
644
|
+
declare function proposeHostAppsFromConfig(input: ProposeHostAppsInput): Promise<SetupProposal>;
|
|
645
|
+
/**
|
|
646
|
+
* Resolve host apps without calling the coding-agent CLI unless files are
|
|
647
|
+
* missing, conflicting, or the caller forced a redetect.
|
|
648
|
+
* When allowAi is set, uses read-only config inspect (does not edit the repo).
|
|
649
|
+
*/
|
|
650
|
+
declare function resolveHostApps(input: HostAppsResolveInput): Promise<HostAppsResolveResult>;
|
|
651
|
+
|
|
652
|
+
export { ACCESS_IGNORE_BEGIN, ACCESS_IGNORE_END, AI_SERVER_APP_ID, AI_SERVER_DEFAULT_PORT, type AiCliProviderId, type AiProvider, type AiResponse, COLLABORATER_DIR, type CachedChatMessage, type CachedConversation, type CallAiOptions, type ChatAttachment, type ChatHandlerOptions, type ChatHandlers, type ChatMessage, type ChatSenderType, type ChatStoreLike, type ChatUser, type ClientContext, DEFAULT_AI_IGNORE_PATHS, HOST_APPS_FILE, type HostApp, type HostAppAlternative, type HostAppRole, type HostAppSource, type HostAppsResolveInput, type HostAppsResolveResult, type HostEnvMap, type LocalStoredMessage, MAINTAINER_PRO_HOME_DIR, type MaintainerProStoreOptions, PROMPT_SECTION, type ParentChainEntry, type ParentChainSource, type PriorConversationOptions, type ProjectDataInput, type ProposeHostAppsInput, type ProviderPreference, type SetupProposal, type SetupProposalConfidence, type SyncedChatStore, type SyncedChatStoreOptions, type SyncedStoreStats, type ToolCall, type ToolSchemaMap, WORKING_PROVIDER, type WorkingTurnEvent, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceKind, buildClaudeUserPrompt, buildConversationPrompt, buildCursorPrompt, buildPriorConversationsContext, callAi, collectParentChain, commandExists, createAntigravityProvider, createBuiltinProviders, createChatHandler, createClaudeProvider, createCursorProvider, createDefaultSystemPrompt, createInfoLogger, createLocalDirectoryStore, createLogger, createMaintainerProStore, createMaintainerProStoreFromEnv, createSyncedChatStore, createToolValidator, defaultAiServerApp, detectHostAppsFromFiles, ensureAiServerApp, ensureProjectDataDir, ensureSingleHost, formatAccessPolicyPromptSection, formatClientContext, formatParentChainContext, getProviderPreference, hostAppsCachePath, hostAppsFingerprint, inspectAndRepairWorkspace, inspectConfigOnly, isDevMode, isIgnoredRelative, isInsideWorkspace, isPathAllowed, maintainerProHome, mergeDesiredHostApps, normalizeEnvMaps, normalizeHostApp, normalizeHostApps, normalizeIgnorePaths, parentChainForTurn, parseAiResponse, parseIgnorePathsEnv, parsePort, previewText, hostAppsCachePath$1 as projectHostAppsPath, projectIdForFolder, projectUploadsDir, proposeHostAppsFromConfig, providerLabel, readCollaboraterApps, readHostAppsCache, readProjectEnvLayers, renderManagedIgnoreBlock, resolveCliBinary, resolveHostApps, resolveIgnorePaths, resolveLogLevel, resolveProjectDataDir, resolveProvider, sanitizeProjectId, saveChatAttachments, toNextRoute, upsertManagedIgnoreFile, writeCollaboraterApps, writeHostAppsCache };
|
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ interface CallAiOptions {
|
|
|
52
52
|
/** Absolute paths to screenshot/image files the agent should inspect. */
|
|
53
53
|
attachmentPaths?: string[];
|
|
54
54
|
/**
|
|
55
|
-
* Compact excerpts from other
|
|
55
|
+
* Compact excerpts from other project chats.
|
|
56
56
|
* Injected into the prompt for the model to use when relevant.
|
|
57
57
|
*/
|
|
58
58
|
priorConversationsContext?: string;
|
|
@@ -299,17 +299,25 @@ interface ChatStoreLike {
|
|
|
299
299
|
}>): Promise<void>;
|
|
300
300
|
/**
|
|
301
301
|
* Optional remote/local upload hook. When present, chat images are persisted
|
|
302
|
-
* through the store instead of
|
|
302
|
+
* through the store instead of the project data uploads folder.
|
|
303
303
|
* `localPaths` are absolute paths for CLI inspection; `refs` are stored on messages.
|
|
304
304
|
*/
|
|
305
305
|
uploadAttachments?(conversationId: string, attachments: ChatAttachment[] | undefined): Promise<{
|
|
306
306
|
refs: string[];
|
|
307
307
|
localPaths: string[];
|
|
308
308
|
}>;
|
|
309
|
+
/**
|
|
310
|
+
* Download stored message images into the project data folder so the coding CLI can
|
|
311
|
+
* open them. Used on working turns where the chat POST has no image bytes.
|
|
312
|
+
*/
|
|
313
|
+
materializeMessageAttachments?(conversationId: string, messageId: string | undefined, workspaceDir: string): Promise<string[]>;
|
|
309
314
|
}
|
|
310
315
|
interface ChatHandlerOptions {
|
|
311
316
|
systemPrompt: string;
|
|
312
317
|
workspaceDir?: string;
|
|
318
|
+
/** Bridge-owned data dir (~/.maintainer-pro/projects/<id>). */
|
|
319
|
+
dataDir?: string;
|
|
320
|
+
sandboxId?: string;
|
|
313
321
|
providerPreference?: CallAiOptions["providerPreference"];
|
|
314
322
|
providers?: AiProvider[];
|
|
315
323
|
tools?: ToolSchemaMap;
|
|
@@ -328,8 +336,11 @@ declare function toNextRoute(handlers: ChatHandlers): {
|
|
|
328
336
|
POST: (request: Request) => Promise<Response>;
|
|
329
337
|
};
|
|
330
338
|
|
|
331
|
-
/** Persist chat image attachments under the
|
|
332
|
-
declare function saveChatAttachments(attachments: ChatAttachment[] | undefined, workspaceDir: string
|
|
339
|
+
/** Persist chat image attachments under the project data dir and return absolute paths. */
|
|
340
|
+
declare function saveChatAttachments(attachments: ChatAttachment[] | undefined, workspaceDir: string, extra?: {
|
|
341
|
+
dataDir?: string | null;
|
|
342
|
+
sandboxId?: string | null;
|
|
343
|
+
}): Promise<string[]>;
|
|
333
344
|
|
|
334
345
|
interface LocalStoredMessage {
|
|
335
346
|
id: string;
|
|
@@ -371,6 +382,7 @@ type SyncedChatStore = ChatStoreLike & {
|
|
|
371
382
|
};
|
|
372
383
|
type RemoteStore = ChatStoreLike & {
|
|
373
384
|
uploadAttachments?: NonNullable<ChatStoreLike["uploadAttachments"]>;
|
|
385
|
+
materializeMessageAttachments?: NonNullable<ChatStoreLike["materializeMessageAttachments"]>;
|
|
374
386
|
listSnapshot?: () => Promise<CachedConversation[]>;
|
|
375
387
|
};
|
|
376
388
|
type WorkingTurnEvent = {
|
|
@@ -418,7 +430,7 @@ type UploadResult = {
|
|
|
418
430
|
attachmentIds: string[];
|
|
419
431
|
};
|
|
420
432
|
/**
|
|
421
|
-
* Persist chat data via Maintainer Pro HTTP API (no
|
|
433
|
+
* Persist chat data via Maintainer Pro HTTP API (no writes into the host app).
|
|
422
434
|
*/
|
|
423
435
|
declare function createMaintainerProStore(options: MaintainerProStoreOptions): SyncedChatStore & {
|
|
424
436
|
uploadAttachments: (conversationId: string, attachments: ChatAttachment[] | undefined) => Promise<UploadResult>;
|
|
@@ -472,6 +484,13 @@ interface WorkspaceInspectResult {
|
|
|
472
484
|
provider: string;
|
|
473
485
|
rawText: string;
|
|
474
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Read-only config analysis for interactive onboarding.
|
|
489
|
+
* Never instructs the agent to edit the repo; times out so UI stays responsive.
|
|
490
|
+
*/
|
|
491
|
+
declare function inspectConfigOnly(input: WorkspaceInspectInput, opts?: {
|
|
492
|
+
timeoutMs?: number;
|
|
493
|
+
}): Promise<WorkspaceInspectResult>;
|
|
475
494
|
/**
|
|
476
495
|
* Ask the coding-agent CLI (via callAi) to inspect a workspace and optionally
|
|
477
496
|
* repair setup issues. Used by ai-bridge so host-process planning uses the
|
|
@@ -479,4 +498,155 @@ interface WorkspaceInspectResult {
|
|
|
479
498
|
*/
|
|
480
499
|
declare function inspectAndRepairWorkspace(input: WorkspaceInspectInput): Promise<WorkspaceInspectResult>;
|
|
481
500
|
|
|
482
|
-
|
|
501
|
+
/** Top-level folder under the user home (bridge.json, per-project data). */
|
|
502
|
+
declare const MAINTAINER_PRO_HOME_DIR = ".maintainer-pro";
|
|
503
|
+
declare const HOST_APPS_FILE = "apps.json";
|
|
504
|
+
type ProjectDataInput = {
|
|
505
|
+
workspaceDir: string;
|
|
506
|
+
/** Distinguishes sandboxes when one bridge runs several apps. */
|
|
507
|
+
sandboxId?: string | null;
|
|
508
|
+
/** Absolute override (e.g. already resolved by the bridge). */
|
|
509
|
+
dataDir?: string | null;
|
|
510
|
+
};
|
|
511
|
+
declare function maintainerProHome(): string;
|
|
512
|
+
declare function projectIdForFolder(folder: string): string;
|
|
513
|
+
declare function sanitizeProjectId(id: string): string;
|
|
514
|
+
/**
|
|
515
|
+
* Per-project data lives next to the bridge, not in the host app:
|
|
516
|
+
* `~/.maintainer-pro/projects/<sandboxId or folder-hash>/`.
|
|
517
|
+
*/
|
|
518
|
+
declare function resolveProjectDataDir(input: ProjectDataInput): string;
|
|
519
|
+
declare function projectUploadsDir(input: ProjectDataInput): string;
|
|
520
|
+
declare function hostAppsCachePath$1(input: ProjectDataInput): string;
|
|
521
|
+
declare function ensureProjectDataDir(input: ProjectDataInput): string;
|
|
522
|
+
|
|
523
|
+
/** @deprecated Host-apps cache lives under ~/.maintainer-pro/projects/<id>. */
|
|
524
|
+
declare const COLLABORATER_DIR = ".collaborater";
|
|
525
|
+
declare const AI_SERVER_APP_ID = "ai-server";
|
|
526
|
+
declare const AI_SERVER_DEFAULT_PORT = 3100;
|
|
527
|
+
type HostAppRole = "ai-server" | "ui" | "backend" | "app" | "custom";
|
|
528
|
+
type HostAppSource = "default" | "env" | "package" | "ai" | "manual";
|
|
529
|
+
type HostEnvMap = {
|
|
530
|
+
key: string;
|
|
531
|
+
sourceAppId: string;
|
|
532
|
+
};
|
|
533
|
+
type HostApp = {
|
|
534
|
+
id: string;
|
|
535
|
+
name: string;
|
|
536
|
+
role: HostAppRole;
|
|
537
|
+
port: number;
|
|
538
|
+
startCommand?: string | null;
|
|
539
|
+
source: HostAppSource;
|
|
540
|
+
locked?: boolean;
|
|
541
|
+
/** Share URL / CORS UI — the page the browser opens. */
|
|
542
|
+
host?: boolean;
|
|
543
|
+
envMaps?: HostEnvMap[];
|
|
544
|
+
};
|
|
545
|
+
type HostAppsResolveInput = {
|
|
546
|
+
workspaceDir: string;
|
|
547
|
+
appName?: string;
|
|
548
|
+
preferredAiPort?: number;
|
|
549
|
+
/** Desired list from Maintainer Pro — used as source of truth when present. */
|
|
550
|
+
desired?: HostApp[] | null;
|
|
551
|
+
/** Re-scan files / optionally ask the agent. */
|
|
552
|
+
force?: boolean;
|
|
553
|
+
/** Only call the coding-agent CLI when files are missing or conflicting. */
|
|
554
|
+
allowAi?: boolean;
|
|
555
|
+
sandboxId?: string | null;
|
|
556
|
+
dataDir?: string | null;
|
|
557
|
+
};
|
|
558
|
+
type HostAppsResolveResult = {
|
|
559
|
+
apps: HostApp[];
|
|
560
|
+
source: "desired" | "cache" | "env" | "ai" | "default";
|
|
561
|
+
cached: boolean;
|
|
562
|
+
usedAi: boolean;
|
|
563
|
+
confused: boolean;
|
|
564
|
+
reasons: string[];
|
|
565
|
+
fingerprint: string;
|
|
566
|
+
};
|
|
567
|
+
type SetupProposalConfidence = "high" | "medium" | "low";
|
|
568
|
+
type HostAppAlternative = {
|
|
569
|
+
/** Primary app id this alternative can replace. */
|
|
570
|
+
appId: string;
|
|
571
|
+
port: number;
|
|
572
|
+
startCommand?: string | null;
|
|
573
|
+
label: string;
|
|
574
|
+
source: HostAppSource;
|
|
575
|
+
};
|
|
576
|
+
type SetupProposal = {
|
|
577
|
+
apps: HostApp[];
|
|
578
|
+
alternatives: HostAppAlternative[];
|
|
579
|
+
reasons: string[];
|
|
580
|
+
confidence: SetupProposalConfidence;
|
|
581
|
+
projectSummary: string;
|
|
582
|
+
usedAi: boolean;
|
|
583
|
+
needsReview: boolean;
|
|
584
|
+
fingerprint: string;
|
|
585
|
+
};
|
|
586
|
+
type ProposeHostAppsInput = {
|
|
587
|
+
workspaceDir: string;
|
|
588
|
+
appName?: string;
|
|
589
|
+
preferredAiPort?: number;
|
|
590
|
+
/**
|
|
591
|
+
* When true (default), call read-only AI if file detect is confused / low confidence.
|
|
592
|
+
* Never edits the repo.
|
|
593
|
+
*/
|
|
594
|
+
allowAi?: boolean;
|
|
595
|
+
};
|
|
596
|
+
declare function parsePort(value: unknown, fallback?: number): number;
|
|
597
|
+
declare function hostAppsCachePath(folder: string, extra?: {
|
|
598
|
+
sandboxId?: string | null;
|
|
599
|
+
dataDir?: string | null;
|
|
600
|
+
}): string;
|
|
601
|
+
declare function defaultAiServerApp(port?: number): HostApp;
|
|
602
|
+
declare function normalizeHostApp(raw: unknown): HostApp | null;
|
|
603
|
+
declare function normalizeEnvMaps(raw: unknown): HostEnvMap[];
|
|
604
|
+
declare function ensureSingleHost(apps: HostApp[]): HostApp[];
|
|
605
|
+
declare function normalizeHostApps(raw: unknown): HostApp[];
|
|
606
|
+
declare function ensureAiServerApp(apps: HostApp[], preferredPort?: number): HostApp[];
|
|
607
|
+
declare function readProjectEnvLayers(folder: string): {
|
|
608
|
+
merged: Record<string, string>;
|
|
609
|
+
layers: Array<{
|
|
610
|
+
file: string;
|
|
611
|
+
values: Record<string, string>;
|
|
612
|
+
}>;
|
|
613
|
+
};
|
|
614
|
+
declare function hostAppsFingerprint(folder: string): string;
|
|
615
|
+
declare function detectHostAppsFromFiles(folder: string, opts?: {
|
|
616
|
+
preferredAiPort?: number;
|
|
617
|
+
appName?: string;
|
|
618
|
+
}): {
|
|
619
|
+
apps: HostApp[];
|
|
620
|
+
reasons: string[];
|
|
621
|
+
confused: boolean;
|
|
622
|
+
};
|
|
623
|
+
declare function readHostAppsCache(folder: string, extra?: {
|
|
624
|
+
sandboxId?: string | null;
|
|
625
|
+
dataDir?: string | null;
|
|
626
|
+
}): {
|
|
627
|
+
apps: HostApp[];
|
|
628
|
+
fingerprint?: string;
|
|
629
|
+
updatedAt?: string;
|
|
630
|
+
} | null;
|
|
631
|
+
/** @deprecated Use readHostAppsCache. */
|
|
632
|
+
declare const readCollaboraterApps: typeof readHostAppsCache;
|
|
633
|
+
declare function writeHostAppsCache(folder: string, apps: HostApp[], extra?: Record<string, unknown>, loc?: {
|
|
634
|
+
sandboxId?: string | null;
|
|
635
|
+
dataDir?: string | null;
|
|
636
|
+
}): void;
|
|
637
|
+
/** @deprecated Use writeHostAppsCache. */
|
|
638
|
+
declare const writeCollaboraterApps: typeof writeHostAppsCache;
|
|
639
|
+
declare function mergeDesiredHostApps(desired: HostApp[], detected: HostApp[]): HostApp[];
|
|
640
|
+
/**
|
|
641
|
+
* Fast, interactive onboarding propose: file detect first, optional read-only AI.
|
|
642
|
+
* Never edits the repository.
|
|
643
|
+
*/
|
|
644
|
+
declare function proposeHostAppsFromConfig(input: ProposeHostAppsInput): Promise<SetupProposal>;
|
|
645
|
+
/**
|
|
646
|
+
* Resolve host apps without calling the coding-agent CLI unless files are
|
|
647
|
+
* missing, conflicting, or the caller forced a redetect.
|
|
648
|
+
* When allowAi is set, uses read-only config inspect (does not edit the repo).
|
|
649
|
+
*/
|
|
650
|
+
declare function resolveHostApps(input: HostAppsResolveInput): Promise<HostAppsResolveResult>;
|
|
651
|
+
|
|
652
|
+
export { ACCESS_IGNORE_BEGIN, ACCESS_IGNORE_END, AI_SERVER_APP_ID, AI_SERVER_DEFAULT_PORT, type AiCliProviderId, type AiProvider, type AiResponse, COLLABORATER_DIR, type CachedChatMessage, type CachedConversation, type CallAiOptions, type ChatAttachment, type ChatHandlerOptions, type ChatHandlers, type ChatMessage, type ChatSenderType, type ChatStoreLike, type ChatUser, type ClientContext, DEFAULT_AI_IGNORE_PATHS, HOST_APPS_FILE, type HostApp, type HostAppAlternative, type HostAppRole, type HostAppSource, type HostAppsResolveInput, type HostAppsResolveResult, type HostEnvMap, type LocalStoredMessage, MAINTAINER_PRO_HOME_DIR, type MaintainerProStoreOptions, PROMPT_SECTION, type ParentChainEntry, type ParentChainSource, type PriorConversationOptions, type ProjectDataInput, type ProposeHostAppsInput, type ProviderPreference, type SetupProposal, type SetupProposalConfidence, type SyncedChatStore, type SyncedChatStoreOptions, type SyncedStoreStats, type ToolCall, type ToolSchemaMap, WORKING_PROVIDER, type WorkingTurnEvent, type WorkspaceInspectInput, type WorkspaceInspectResult, type WorkspaceKind, buildClaudeUserPrompt, buildConversationPrompt, buildCursorPrompt, buildPriorConversationsContext, callAi, collectParentChain, commandExists, createAntigravityProvider, createBuiltinProviders, createChatHandler, createClaudeProvider, createCursorProvider, createDefaultSystemPrompt, createInfoLogger, createLocalDirectoryStore, createLogger, createMaintainerProStore, createMaintainerProStoreFromEnv, createSyncedChatStore, createToolValidator, defaultAiServerApp, detectHostAppsFromFiles, ensureAiServerApp, ensureProjectDataDir, ensureSingleHost, formatAccessPolicyPromptSection, formatClientContext, formatParentChainContext, getProviderPreference, hostAppsCachePath, hostAppsFingerprint, inspectAndRepairWorkspace, inspectConfigOnly, isDevMode, isIgnoredRelative, isInsideWorkspace, isPathAllowed, maintainerProHome, mergeDesiredHostApps, normalizeEnvMaps, normalizeHostApp, normalizeHostApps, normalizeIgnorePaths, parentChainForTurn, parseAiResponse, parseIgnorePathsEnv, parsePort, previewText, hostAppsCachePath$1 as projectHostAppsPath, projectIdForFolder, projectUploadsDir, proposeHostAppsFromConfig, providerLabel, readCollaboraterApps, readHostAppsCache, readProjectEnvLayers, renderManagedIgnoreBlock, resolveCliBinary, resolveHostApps, resolveIgnorePaths, resolveLogLevel, resolveProjectDataDir, resolveProvider, sanitizeProjectId, saveChatAttachments, toNextRoute, upsertManagedIgnoreFile, writeCollaboraterApps, writeHostAppsCache };
|