@maintainer-pro/ai-cli 0.1.7 → 0.1.9
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 +9 -25
- package/dist/index.d.cts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.js +9 -24
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -79,7 +79,6 @@ __export(index_exports, {
|
|
|
79
79
|
isPathAllowed: () => isPathAllowed,
|
|
80
80
|
maintainerProHome: () => maintainerProHome,
|
|
81
81
|
mergeDesiredHostApps: () => mergeDesiredHostApps,
|
|
82
|
-
normalizeEnvMaps: () => normalizeEnvMaps,
|
|
83
82
|
normalizeHostApp: () => normalizeHostApp,
|
|
84
83
|
normalizeHostApps: () => normalizeHostApps,
|
|
85
84
|
normalizeIgnorePaths: () => normalizeIgnorePaths,
|
|
@@ -164,9 +163,13 @@ function formatClientContext(context) {
|
|
|
164
163
|
if (!context) return "";
|
|
165
164
|
const lines = [
|
|
166
165
|
"Client context (live UI snapshot):",
|
|
167
|
-
|
|
168
|
-
`- Page title: ${context.pageTitle}`
|
|
166
|
+
"The user currently has this page open. Prefer changing this screen unless they clearly mean another."
|
|
169
167
|
];
|
|
168
|
+
if (context.pageUrl) {
|
|
169
|
+
lines.push(`- Page URL: ${context.pageUrl}`);
|
|
170
|
+
}
|
|
171
|
+
lines.push(`- Route: ${context.route}`);
|
|
172
|
+
lines.push(`- Page title: ${context.pageTitle}`);
|
|
170
173
|
if (context.visiblePanels?.length) {
|
|
171
174
|
lines.push(`- Visible panels: ${context.visiblePanels.join(", ")}`);
|
|
172
175
|
}
|
|
@@ -645,7 +648,7 @@ Only use those runtime tools for live state. Never invent runtime tools.` : "";
|
|
|
645
648
|
- Never touch paths that match this ignore list (relative to the workspace):
|
|
646
649
|
${(input.ignorePaths ?? []).filter((p) => !p.startsWith("!")).length ? (input.ignorePaths ?? []).filter((p) => !p.startsWith("!")).map((p) => `- ${p}`).join("\n") : "- (none beyond staying inside the workspace)"}
|
|
647
650
|
- If a request requires something outside the workspace or on the ignore list, refuse that part and explain you can only change allowed project files.` : "";
|
|
648
|
-
return `You are a helpful product assistant for an app the user is looking at right now.
|
|
651
|
+
return `You are a helpful product assistant for an app the user is looking at right now. The live UI snapshot (page URL / route) is the screen they have open \u2014 start there when they ask for a change.
|
|
649
652
|
|
|
650
653
|
${input.productDescription}
|
|
651
654
|
|
|
@@ -2905,26 +2908,9 @@ function normalizeHostApp(raw) {
|
|
|
2905
2908
|
row.source
|
|
2906
2909
|
) ? row.source : "manual",
|
|
2907
2910
|
locked: row.locked === true || id === AI_SERVER_APP_ID || role === "ai-server",
|
|
2908
|
-
host: role !== "ai-server" && id !== AI_SERVER_APP_ID && row.host === true
|
|
2909
|
-
envMaps: normalizeEnvMaps(row.envMaps)
|
|
2911
|
+
host: role !== "ai-server" && id !== AI_SERVER_APP_ID && row.host === true
|
|
2910
2912
|
};
|
|
2911
2913
|
}
|
|
2912
|
-
function normalizeEnvMaps(raw) {
|
|
2913
|
-
if (!Array.isArray(raw)) return [];
|
|
2914
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2915
|
-
const out = [];
|
|
2916
|
-
for (const item of raw) {
|
|
2917
|
-
if (!item || typeof item !== "object") continue;
|
|
2918
|
-
const row = item;
|
|
2919
|
-
const key = String(row.key || "").trim();
|
|
2920
|
-
const sourceAppId = String(row.sourceAppId || "").trim().slice(0, 64);
|
|
2921
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || key.length > 80) continue;
|
|
2922
|
-
if (!sourceAppId || seen.has(key)) continue;
|
|
2923
|
-
seen.add(key);
|
|
2924
|
-
out.push({ key, sourceAppId });
|
|
2925
|
-
}
|
|
2926
|
-
return out.slice(0, 30);
|
|
2927
|
-
}
|
|
2928
2914
|
function ensureSingleHost(apps) {
|
|
2929
2915
|
const next = apps.map((app) => ({
|
|
2930
2916
|
...app,
|
|
@@ -3202,8 +3188,7 @@ function mergeDesiredHostApps(desired, detected) {
|
|
|
3202
3188
|
...app,
|
|
3203
3189
|
startCommand: app.startCommand || local?.startCommand || null,
|
|
3204
3190
|
locked: app.locked || app.id === AI_SERVER_APP_ID || app.role === "ai-server",
|
|
3205
|
-
host: app.role === "ai-server" || app.id === AI_SERVER_APP_ID ? false : app.host === true || app.host !== false && local?.host === true
|
|
3206
|
-
envMaps: app.envMaps && app.envMaps.length ? app.envMaps : local?.envMaps || []
|
|
3191
|
+
host: app.role === "ai-server" || app.id === AI_SERVER_APP_ID ? false : app.host === true || app.host !== false && local?.host === true
|
|
3207
3192
|
};
|
|
3208
3193
|
});
|
|
3209
3194
|
return ensureAiServerApp(merged);
|
|
@@ -3536,7 +3521,6 @@ Return the real local ports and npm script names.`
|
|
|
3536
3521
|
isPathAllowed,
|
|
3537
3522
|
maintainerProHome,
|
|
3538
3523
|
mergeDesiredHostApps,
|
|
3539
|
-
normalizeEnvMaps,
|
|
3540
3524
|
normalizeHostApp,
|
|
3541
3525
|
normalizeHostApps,
|
|
3542
3526
|
normalizeIgnorePaths,
|
package/dist/index.d.cts
CHANGED
|
@@ -38,6 +38,8 @@ interface ChatUser {
|
|
|
38
38
|
/** Live UI / app snapshot sent with each chat request (host-defined). */
|
|
39
39
|
interface ClientContext {
|
|
40
40
|
route: string;
|
|
41
|
+
/** Full browser URL of the page the user currently has open. */
|
|
42
|
+
pageUrl?: string;
|
|
41
43
|
pageTitle: string;
|
|
42
44
|
visiblePanels?: string[];
|
|
43
45
|
focusedElement?: string | null;
|
|
@@ -526,10 +528,6 @@ declare const AI_SERVER_APP_ID = "ai-server";
|
|
|
526
528
|
declare const AI_SERVER_DEFAULT_PORT = 3100;
|
|
527
529
|
type HostAppRole = "ai-server" | "ui" | "backend" | "app" | "custom";
|
|
528
530
|
type HostAppSource = "default" | "env" | "package" | "ai" | "manual";
|
|
529
|
-
type HostEnvMap = {
|
|
530
|
-
key: string;
|
|
531
|
-
sourceAppId: string;
|
|
532
|
-
};
|
|
533
531
|
type HostApp = {
|
|
534
532
|
id: string;
|
|
535
533
|
name: string;
|
|
@@ -538,9 +536,8 @@ type HostApp = {
|
|
|
538
536
|
startCommand?: string | null;
|
|
539
537
|
source: HostAppSource;
|
|
540
538
|
locked?: boolean;
|
|
541
|
-
/** Share URL
|
|
539
|
+
/** Share URL — the page the browser opens. */
|
|
542
540
|
host?: boolean;
|
|
543
|
-
envMaps?: HostEnvMap[];
|
|
544
541
|
};
|
|
545
542
|
type HostAppsResolveInput = {
|
|
546
543
|
workspaceDir: string;
|
|
@@ -600,7 +597,6 @@ declare function hostAppsCachePath(folder: string, extra?: {
|
|
|
600
597
|
}): string;
|
|
601
598
|
declare function defaultAiServerApp(port?: number): HostApp;
|
|
602
599
|
declare function normalizeHostApp(raw: unknown): HostApp | null;
|
|
603
|
-
declare function normalizeEnvMaps(raw: unknown): HostEnvMap[];
|
|
604
600
|
declare function ensureSingleHost(apps: HostApp[]): HostApp[];
|
|
605
601
|
declare function normalizeHostApps(raw: unknown): HostApp[];
|
|
606
602
|
declare function ensureAiServerApp(apps: HostApp[], preferredPort?: number): HostApp[];
|
|
@@ -649,4 +645,4 @@ declare function proposeHostAppsFromConfig(input: ProposeHostAppsInput): Promise
|
|
|
649
645
|
*/
|
|
650
646
|
declare function resolveHostApps(input: HostAppsResolveInput): Promise<HostAppsResolveResult>;
|
|
651
647
|
|
|
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
|
|
648
|
+
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 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, 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
|
@@ -38,6 +38,8 @@ interface ChatUser {
|
|
|
38
38
|
/** Live UI / app snapshot sent with each chat request (host-defined). */
|
|
39
39
|
interface ClientContext {
|
|
40
40
|
route: string;
|
|
41
|
+
/** Full browser URL of the page the user currently has open. */
|
|
42
|
+
pageUrl?: string;
|
|
41
43
|
pageTitle: string;
|
|
42
44
|
visiblePanels?: string[];
|
|
43
45
|
focusedElement?: string | null;
|
|
@@ -526,10 +528,6 @@ declare const AI_SERVER_APP_ID = "ai-server";
|
|
|
526
528
|
declare const AI_SERVER_DEFAULT_PORT = 3100;
|
|
527
529
|
type HostAppRole = "ai-server" | "ui" | "backend" | "app" | "custom";
|
|
528
530
|
type HostAppSource = "default" | "env" | "package" | "ai" | "manual";
|
|
529
|
-
type HostEnvMap = {
|
|
530
|
-
key: string;
|
|
531
|
-
sourceAppId: string;
|
|
532
|
-
};
|
|
533
531
|
type HostApp = {
|
|
534
532
|
id: string;
|
|
535
533
|
name: string;
|
|
@@ -538,9 +536,8 @@ type HostApp = {
|
|
|
538
536
|
startCommand?: string | null;
|
|
539
537
|
source: HostAppSource;
|
|
540
538
|
locked?: boolean;
|
|
541
|
-
/** Share URL
|
|
539
|
+
/** Share URL — the page the browser opens. */
|
|
542
540
|
host?: boolean;
|
|
543
|
-
envMaps?: HostEnvMap[];
|
|
544
541
|
};
|
|
545
542
|
type HostAppsResolveInput = {
|
|
546
543
|
workspaceDir: string;
|
|
@@ -600,7 +597,6 @@ declare function hostAppsCachePath(folder: string, extra?: {
|
|
|
600
597
|
}): string;
|
|
601
598
|
declare function defaultAiServerApp(port?: number): HostApp;
|
|
602
599
|
declare function normalizeHostApp(raw: unknown): HostApp | null;
|
|
603
|
-
declare function normalizeEnvMaps(raw: unknown): HostEnvMap[];
|
|
604
600
|
declare function ensureSingleHost(apps: HostApp[]): HostApp[];
|
|
605
601
|
declare function normalizeHostApps(raw: unknown): HostApp[];
|
|
606
602
|
declare function ensureAiServerApp(apps: HostApp[], preferredPort?: number): HostApp[];
|
|
@@ -649,4 +645,4 @@ declare function proposeHostAppsFromConfig(input: ProposeHostAppsInput): Promise
|
|
|
649
645
|
*/
|
|
650
646
|
declare function resolveHostApps(input: HostAppsResolveInput): Promise<HostAppsResolveResult>;
|
|
651
647
|
|
|
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
|
|
648
|
+
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 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, 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.js
CHANGED
|
@@ -50,9 +50,13 @@ function formatClientContext(context) {
|
|
|
50
50
|
if (!context) return "";
|
|
51
51
|
const lines = [
|
|
52
52
|
"Client context (live UI snapshot):",
|
|
53
|
-
|
|
54
|
-
`- Page title: ${context.pageTitle}`
|
|
53
|
+
"The user currently has this page open. Prefer changing this screen unless they clearly mean another."
|
|
55
54
|
];
|
|
55
|
+
if (context.pageUrl) {
|
|
56
|
+
lines.push(`- Page URL: ${context.pageUrl}`);
|
|
57
|
+
}
|
|
58
|
+
lines.push(`- Route: ${context.route}`);
|
|
59
|
+
lines.push(`- Page title: ${context.pageTitle}`);
|
|
56
60
|
if (context.visiblePanels?.length) {
|
|
57
61
|
lines.push(`- Visible panels: ${context.visiblePanels.join(", ")}`);
|
|
58
62
|
}
|
|
@@ -531,7 +535,7 @@ Only use those runtime tools for live state. Never invent runtime tools.` : "";
|
|
|
531
535
|
- Never touch paths that match this ignore list (relative to the workspace):
|
|
532
536
|
${(input.ignorePaths ?? []).filter((p) => !p.startsWith("!")).length ? (input.ignorePaths ?? []).filter((p) => !p.startsWith("!")).map((p) => `- ${p}`).join("\n") : "- (none beyond staying inside the workspace)"}
|
|
533
537
|
- If a request requires something outside the workspace or on the ignore list, refuse that part and explain you can only change allowed project files.` : "";
|
|
534
|
-
return `You are a helpful product assistant for an app the user is looking at right now.
|
|
538
|
+
return `You are a helpful product assistant for an app the user is looking at right now. The live UI snapshot (page URL / route) is the screen they have open \u2014 start there when they ask for a change.
|
|
535
539
|
|
|
536
540
|
${input.productDescription}
|
|
537
541
|
|
|
@@ -2791,26 +2795,9 @@ function normalizeHostApp(raw) {
|
|
|
2791
2795
|
row.source
|
|
2792
2796
|
) ? row.source : "manual",
|
|
2793
2797
|
locked: row.locked === true || id === AI_SERVER_APP_ID || role === "ai-server",
|
|
2794
|
-
host: role !== "ai-server" && id !== AI_SERVER_APP_ID && row.host === true
|
|
2795
|
-
envMaps: normalizeEnvMaps(row.envMaps)
|
|
2798
|
+
host: role !== "ai-server" && id !== AI_SERVER_APP_ID && row.host === true
|
|
2796
2799
|
};
|
|
2797
2800
|
}
|
|
2798
|
-
function normalizeEnvMaps(raw) {
|
|
2799
|
-
if (!Array.isArray(raw)) return [];
|
|
2800
|
-
const seen = /* @__PURE__ */ new Set();
|
|
2801
|
-
const out = [];
|
|
2802
|
-
for (const item of raw) {
|
|
2803
|
-
if (!item || typeof item !== "object") continue;
|
|
2804
|
-
const row = item;
|
|
2805
|
-
const key = String(row.key || "").trim();
|
|
2806
|
-
const sourceAppId = String(row.sourceAppId || "").trim().slice(0, 64);
|
|
2807
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || key.length > 80) continue;
|
|
2808
|
-
if (!sourceAppId || seen.has(key)) continue;
|
|
2809
|
-
seen.add(key);
|
|
2810
|
-
out.push({ key, sourceAppId });
|
|
2811
|
-
}
|
|
2812
|
-
return out.slice(0, 30);
|
|
2813
|
-
}
|
|
2814
2801
|
function ensureSingleHost(apps) {
|
|
2815
2802
|
const next = apps.map((app) => ({
|
|
2816
2803
|
...app,
|
|
@@ -3088,8 +3075,7 @@ function mergeDesiredHostApps(desired, detected) {
|
|
|
3088
3075
|
...app,
|
|
3089
3076
|
startCommand: app.startCommand || local?.startCommand || null,
|
|
3090
3077
|
locked: app.locked || app.id === AI_SERVER_APP_ID || app.role === "ai-server",
|
|
3091
|
-
host: app.role === "ai-server" || app.id === AI_SERVER_APP_ID ? false : app.host === true || app.host !== false && local?.host === true
|
|
3092
|
-
envMaps: app.envMaps && app.envMaps.length ? app.envMaps : local?.envMaps || []
|
|
3078
|
+
host: app.role === "ai-server" || app.id === AI_SERVER_APP_ID ? false : app.host === true || app.host !== false && local?.host === true
|
|
3093
3079
|
};
|
|
3094
3080
|
});
|
|
3095
3081
|
return ensureAiServerApp(merged);
|
|
@@ -3421,7 +3407,6 @@ export {
|
|
|
3421
3407
|
isPathAllowed,
|
|
3422
3408
|
maintainerProHome,
|
|
3423
3409
|
mergeDesiredHostApps,
|
|
3424
|
-
normalizeEnvMaps,
|
|
3425
3410
|
normalizeHostApp,
|
|
3426
3411
|
normalizeHostApps,
|
|
3427
3412
|
normalizeIgnorePaths,
|