@omercnet/paseo-context-mode 0.0.0
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/LICENSE +21 -0
- package/NOTICE +7 -0
- package/README.md +74 -0
- package/client/actions-section.tsx +621 -0
- package/client/analytics-dashboard.tsx +721 -0
- package/client/context-mode-pill.tsx +106 -0
- package/client/context-mode-surface.tsx +414 -0
- package/client/knowledge-section.tsx +780 -0
- package/client/settings-screen.tsx +226 -0
- package/index.client.tsx +43 -0
- package/index.server.ts +54 -0
- package/package.json +72 -0
- package/paseo-plugin.json +5 -0
- package/server/actions.ts +146 -0
- package/server/analytics.ts +424 -0
- package/server/binary.ts +182 -0
- package/server/context-mode-db.ts +481 -0
- package/server/handlers.ts +200 -0
- package/server/integration.ts +441 -0
- package/server/knowledge.ts +187 -0
- package/server/mcp-process.ts +357 -0
- package/server/storage-discovery.ts +225 -0
- package/shared/actions.ts +57 -0
- package/shared/analytics.ts +134 -0
- package/shared/contracts.ts +95 -0
- package/shared/index.ts +5 -0
- package/shared/knowledge.ts +150 -0
- package/shared/settings.ts +51 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { defineRpc } from "@getpaseo/plugin";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const CONTEXT_MODE_ANALYTICS_SCHEMA_VERSION = 1 as const;
|
|
5
|
+
export const SUPPORTED_CONTEXT_MODE_DATABASE_VERSION = "1.0.169" as const;
|
|
6
|
+
|
|
7
|
+
const nonNegativeInteger = z.number().int().nonnegative();
|
|
8
|
+
const nonNegativeNumber = z.number().finite().nonnegative();
|
|
9
|
+
|
|
10
|
+
export const AnalyticsByteAccountingSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
eventDataBytes: nonNegativeInteger,
|
|
13
|
+
avoidedBytes: nonNegativeInteger,
|
|
14
|
+
returnedBytes: nonNegativeInteger,
|
|
15
|
+
snapshotBytes: nonNegativeInteger,
|
|
16
|
+
indexedBytes: nonNegativeInteger,
|
|
17
|
+
savedBytes: nonNegativeInteger,
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
|
|
21
|
+
export const AnalyticsTotalsSchema = z
|
|
22
|
+
.object({
|
|
23
|
+
providers: nonNegativeInteger,
|
|
24
|
+
databases: nonNegativeInteger,
|
|
25
|
+
projects: nonNegativeInteger,
|
|
26
|
+
sessions: nonNegativeInteger,
|
|
27
|
+
events: nonNegativeInteger,
|
|
28
|
+
toolCalls: nonNegativeInteger,
|
|
29
|
+
indexedSources: nonNegativeInteger,
|
|
30
|
+
indexedChunks: nonNegativeInteger,
|
|
31
|
+
inputTokens: nonNegativeInteger,
|
|
32
|
+
outputTokens: nonNegativeInteger,
|
|
33
|
+
savedTokens: nonNegativeInteger,
|
|
34
|
+
savingsPercent: nonNegativeNumber.max(100),
|
|
35
|
+
byteAccounting: AnalyticsByteAccountingSchema,
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
|
|
39
|
+
export const ProviderAnalyticsSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
provider: z.string().min(1).max(128),
|
|
42
|
+
databases: nonNegativeInteger,
|
|
43
|
+
projects: nonNegativeInteger,
|
|
44
|
+
sessions: nonNegativeInteger,
|
|
45
|
+
events: nonNegativeInteger,
|
|
46
|
+
toolCalls: nonNegativeInteger,
|
|
47
|
+
indexedSources: nonNegativeInteger,
|
|
48
|
+
indexedChunks: nonNegativeInteger,
|
|
49
|
+
inputTokens: nonNegativeInteger,
|
|
50
|
+
outputTokens: nonNegativeInteger,
|
|
51
|
+
savedTokens: nonNegativeInteger,
|
|
52
|
+
savingsPercent: nonNegativeNumber.max(100),
|
|
53
|
+
byteAccounting: AnalyticsByteAccountingSchema,
|
|
54
|
+
})
|
|
55
|
+
.strict();
|
|
56
|
+
|
|
57
|
+
export const CategoryAnalyticsSchema = z
|
|
58
|
+
.object({
|
|
59
|
+
category: z.string().min(1).max(256),
|
|
60
|
+
count: nonNegativeInteger,
|
|
61
|
+
savedTokens: nonNegativeInteger,
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
|
|
65
|
+
export const DailyAnalyticsSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
68
|
+
calls: nonNegativeInteger,
|
|
69
|
+
savedTokens: nonNegativeInteger,
|
|
70
|
+
})
|
|
71
|
+
.strict();
|
|
72
|
+
|
|
73
|
+
export const IndexedSourceAnalyticsSchema = z
|
|
74
|
+
.object({
|
|
75
|
+
provider: z.string().min(1).max(128),
|
|
76
|
+
source: z.string().min(1).max(4_096),
|
|
77
|
+
chunks: nonNegativeInteger,
|
|
78
|
+
codeChunks: nonNegativeInteger,
|
|
79
|
+
indexedBytes: nonNegativeInteger,
|
|
80
|
+
indexedAt: z.string().nullable(),
|
|
81
|
+
state: z.enum(["ready", "empty", "unavailable"]),
|
|
82
|
+
detail: z.string().max(512).optional(),
|
|
83
|
+
})
|
|
84
|
+
.strict();
|
|
85
|
+
|
|
86
|
+
export const AnalyticsWarningSchema = z
|
|
87
|
+
.object({
|
|
88
|
+
code: z.enum([
|
|
89
|
+
"invalid-storage-root",
|
|
90
|
+
"storage-unavailable",
|
|
91
|
+
"not-regular-database",
|
|
92
|
+
"database-open-failed",
|
|
93
|
+
"unsupported-schema",
|
|
94
|
+
"database-query-failed",
|
|
95
|
+
"inconsistent-index",
|
|
96
|
+
"result-truncated",
|
|
97
|
+
"warning-limit",
|
|
98
|
+
]),
|
|
99
|
+
provider: z.string().min(1).max(128).optional(),
|
|
100
|
+
database: z.string().min(1).max(512).optional(),
|
|
101
|
+
message: z.string().min(1).max(512),
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
|
|
105
|
+
export const ContextModeAnalyticsDashboardSchema = z
|
|
106
|
+
.object({
|
|
107
|
+
schemaVersion: z.literal(CONTEXT_MODE_ANALYTICS_SCHEMA_VERSION),
|
|
108
|
+
contextModeVersion: z.literal(SUPPORTED_CONTEXT_MODE_DATABASE_VERSION),
|
|
109
|
+
completeness: z.enum(["complete", "partial", "unsupported"]),
|
|
110
|
+
warnings: z.array(AnalyticsWarningSchema).max(20),
|
|
111
|
+
totals: AnalyticsTotalsSchema,
|
|
112
|
+
byProvider: z.array(ProviderAnalyticsSchema).max(32),
|
|
113
|
+
byCategory: z.array(CategoryAnalyticsSchema).max(128),
|
|
114
|
+
byDay: z.array(DailyAnalyticsSchema).max(400),
|
|
115
|
+
sources: z.array(IndexedSourceAnalyticsSchema).max(2_000),
|
|
116
|
+
generatedAt: z.string().datetime(),
|
|
117
|
+
})
|
|
118
|
+
.strict();
|
|
119
|
+
|
|
120
|
+
export const getContextModeAnalyticsDashboard = defineRpc({
|
|
121
|
+
name: "context-mode.analytics-dashboard",
|
|
122
|
+
input: z.object({}).strict(),
|
|
123
|
+
output: ContextModeAnalyticsDashboardSchema,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export type AnalyticsByteAccounting = z.infer<typeof AnalyticsByteAccountingSchema>;
|
|
127
|
+
export type AnalyticsTotals = z.infer<typeof AnalyticsTotalsSchema>;
|
|
128
|
+
export type ProviderAnalytics = z.infer<typeof ProviderAnalyticsSchema>;
|
|
129
|
+
export type CategoryAnalytics = z.infer<typeof CategoryAnalyticsSchema>;
|
|
130
|
+
export type DailyAnalytics = z.infer<typeof DailyAnalyticsSchema>;
|
|
131
|
+
export type IndexedSourceAnalytics = z.infer<typeof IndexedSourceAnalyticsSchema>;
|
|
132
|
+
export type AnalyticsWarning = z.infer<typeof AnalyticsWarningSchema>;
|
|
133
|
+
export type ContextModeAnalyticsDashboard = z.infer<typeof ContextModeAnalyticsDashboardSchema>;
|
|
134
|
+
export type AnalyticsDashboard = ContextModeAnalyticsDashboard;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { defineRpc } from "@getpaseo/plugin";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
const refreshInput = z.object({ fresh: z.boolean().default(false) }).strict();
|
|
5
|
+
const binarySource = z.enum(["settings", "path", "bundled"]);
|
|
6
|
+
const failureCode = z.enum([
|
|
7
|
+
"not-installed",
|
|
8
|
+
"invalid-settings",
|
|
9
|
+
"timeout",
|
|
10
|
+
"output-limit",
|
|
11
|
+
"launch-failed",
|
|
12
|
+
"protocol-error",
|
|
13
|
+
"unsupported",
|
|
14
|
+
"command-failed",
|
|
15
|
+
]);
|
|
16
|
+
|
|
17
|
+
export const BinaryStatusSchema = z.discriminatedUnion("state", [
|
|
18
|
+
z.object({
|
|
19
|
+
state: z.literal("ready"),
|
|
20
|
+
binaryPath: z.string(),
|
|
21
|
+
source: binarySource,
|
|
22
|
+
version: z.string().nullable(),
|
|
23
|
+
supportsDoctor: z.boolean(),
|
|
24
|
+
supportsStats: z.boolean(),
|
|
25
|
+
checkedAt: z.string().datetime(),
|
|
26
|
+
}),
|
|
27
|
+
z.object({
|
|
28
|
+
state: z.literal("unavailable"),
|
|
29
|
+
code: failureCode,
|
|
30
|
+
message: z.string().max(4_096),
|
|
31
|
+
checkedAt: z.string().datetime(),
|
|
32
|
+
}),
|
|
33
|
+
]);
|
|
34
|
+
|
|
35
|
+
export const CommandReportSchema = z.discriminatedUnion("state", [
|
|
36
|
+
z.object({
|
|
37
|
+
state: z.literal("ready"),
|
|
38
|
+
binaryPath: z.string(),
|
|
39
|
+
output: z.string().max(196_608),
|
|
40
|
+
checkedAt: z.string().datetime(),
|
|
41
|
+
}),
|
|
42
|
+
z.object({
|
|
43
|
+
state: z.literal("unavailable"),
|
|
44
|
+
code: failureCode,
|
|
45
|
+
message: z.string().max(4_096),
|
|
46
|
+
checkedAt: z.string().datetime(),
|
|
47
|
+
}),
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
export const ProviderIntegrationSchema = z.object({
|
|
51
|
+
provider: z.string(),
|
|
52
|
+
platform: z.string(),
|
|
53
|
+
activation: z.enum(["native", "mcp", "disabled"]),
|
|
54
|
+
storageRoot: z.string(),
|
|
55
|
+
reusesExistingStorage: z.boolean(),
|
|
56
|
+
detail: z.string().max(4_096),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const IntegrationAuditSchema = z.object({
|
|
60
|
+
runtimePath: z.string(),
|
|
61
|
+
runtimeVersion: z.string().nullable(),
|
|
62
|
+
injectionEnabled: z.boolean(),
|
|
63
|
+
providers: z.array(ProviderIntegrationSchema),
|
|
64
|
+
checkedAt: z.string().datetime(),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const getContextModeStatus = defineRpc({
|
|
68
|
+
name: "context-mode.status",
|
|
69
|
+
input: refreshInput,
|
|
70
|
+
output: BinaryStatusSchema,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const getContextModeDoctor = defineRpc({
|
|
74
|
+
name: "context-mode.doctor",
|
|
75
|
+
input: refreshInput,
|
|
76
|
+
output: CommandReportSchema,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const getContextModeStats = defineRpc({
|
|
80
|
+
name: "context-mode.stats",
|
|
81
|
+
input: refreshInput,
|
|
82
|
+
output: CommandReportSchema,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
export const getContextModeIntegrationAudit = defineRpc({
|
|
86
|
+
name: "context-mode.integration-audit",
|
|
87
|
+
input: refreshInput,
|
|
88
|
+
output: IntegrationAuditSchema,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export type BinaryStatus = z.infer<typeof BinaryStatusSchema>;
|
|
92
|
+
export type CommandReport = z.infer<typeof CommandReportSchema>;
|
|
93
|
+
export type IntegrationAudit = z.infer<typeof IntegrationAuditSchema>;
|
|
94
|
+
export type ProviderIntegration = z.infer<typeof ProviderIntegrationSchema>;
|
|
95
|
+
export type ContextModeRefreshInput = z.infer<typeof refreshInput>;
|
package/shared/index.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { defineRpc } from "@getpaseo/plugin";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
const MAX_OUTPUT_LENGTH = 192 * 1_024;
|
|
5
|
+
const MAX_PATH_LENGTH = 4_096;
|
|
6
|
+
const MAX_LABEL_LENGTH = 512;
|
|
7
|
+
const MAX_QUERY_LENGTH = 1_024;
|
|
8
|
+
|
|
9
|
+
export const ContextModeProviderSchema = z.enum([
|
|
10
|
+
"claude",
|
|
11
|
+
"codex",
|
|
12
|
+
"copilot",
|
|
13
|
+
"cursor",
|
|
14
|
+
"opencode",
|
|
15
|
+
"pi",
|
|
16
|
+
"omp",
|
|
17
|
+
"omp-plugin",
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export const ContextModePlatformSchema = z.enum([
|
|
21
|
+
"claude-code",
|
|
22
|
+
"codex",
|
|
23
|
+
"copilot-cli",
|
|
24
|
+
"cursor",
|
|
25
|
+
"opencode",
|
|
26
|
+
"pi",
|
|
27
|
+
"omp",
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const boundedLabel = z.string().trim().min(1).max(MAX_LABEL_LENGTH);
|
|
31
|
+
const boundedPattern = z.string().trim().min(1).max(256);
|
|
32
|
+
const absoluteLocalPath = z
|
|
33
|
+
.string()
|
|
34
|
+
.trim()
|
|
35
|
+
.min(1)
|
|
36
|
+
.max(MAX_PATH_LENGTH)
|
|
37
|
+
.refine(
|
|
38
|
+
(value) =>
|
|
39
|
+
!value.includes("\0") &&
|
|
40
|
+
(value.startsWith("/") ||
|
|
41
|
+
/^[A-Za-z]:[\\/]/.test(value) ||
|
|
42
|
+
/^\\\\[^\\/]+[\\/][^\\/]+/.test(value)),
|
|
43
|
+
{ message: "path must be an absolute local path" },
|
|
44
|
+
);
|
|
45
|
+
const providerScope = z
|
|
46
|
+
.object({ provider: ContextModeProviderSchema, projectPath: absoluteLocalPath })
|
|
47
|
+
.strict();
|
|
48
|
+
const httpUrl = z
|
|
49
|
+
.string()
|
|
50
|
+
.trim()
|
|
51
|
+
.min(1)
|
|
52
|
+
.max(MAX_PATH_LENGTH)
|
|
53
|
+
.url()
|
|
54
|
+
.refine((value) => /^https?:\/\//i.test(value), "url must use HTTP or HTTPS");
|
|
55
|
+
|
|
56
|
+
export const KnowledgeToolResultSchema = z
|
|
57
|
+
.object({
|
|
58
|
+
provider: ContextModeProviderSchema,
|
|
59
|
+
output: z.string().max(MAX_OUTPUT_LENGTH),
|
|
60
|
+
completedAt: z.string().datetime(),
|
|
61
|
+
})
|
|
62
|
+
.strict();
|
|
63
|
+
|
|
64
|
+
export const SearchKnowledgeInputSchema = providerScope
|
|
65
|
+
.extend({
|
|
66
|
+
queries: z.array(z.string().trim().min(1).max(MAX_QUERY_LENGTH)).min(1).max(8),
|
|
67
|
+
limit: z.number().int().min(1).max(10).default(3),
|
|
68
|
+
source: boundedLabel.optional(),
|
|
69
|
+
contentType: z.enum(["code", "prose"]).optional(),
|
|
70
|
+
sort: z.enum(["relevance", "timeline"]).default("relevance"),
|
|
71
|
+
})
|
|
72
|
+
.strict();
|
|
73
|
+
|
|
74
|
+
export const IndexPathInputSchema = providerScope
|
|
75
|
+
.extend({
|
|
76
|
+
path: absoluteLocalPath,
|
|
77
|
+
source: boundedLabel.optional(),
|
|
78
|
+
include: z.array(boundedPattern).max(32).optional(),
|
|
79
|
+
exclude: z.array(boundedPattern).max(32).optional(),
|
|
80
|
+
maxDepth: z.number().int().min(0).max(20).optional(),
|
|
81
|
+
maxFiles: z.number().int().min(1).max(1_000).optional(),
|
|
82
|
+
extensions: z.array(boundedPattern).max(32).optional(),
|
|
83
|
+
respectGitignore: z.boolean().optional(),
|
|
84
|
+
followSymlinks: z.boolean().optional(),
|
|
85
|
+
})
|
|
86
|
+
.strict();
|
|
87
|
+
|
|
88
|
+
export const FetchAndIndexInputSchema = providerScope
|
|
89
|
+
.extend({
|
|
90
|
+
url: httpUrl,
|
|
91
|
+
source: boundedLabel.optional(),
|
|
92
|
+
force: z.boolean().default(false),
|
|
93
|
+
ttl: z.number().int().min(0).max(1_209_600_000).optional(),
|
|
94
|
+
})
|
|
95
|
+
.strict();
|
|
96
|
+
|
|
97
|
+
const projectPurge = z
|
|
98
|
+
.object({
|
|
99
|
+
provider: ContextModeProviderSchema,
|
|
100
|
+
projectPath: absoluteLocalPath,
|
|
101
|
+
confirm: z.literal(true),
|
|
102
|
+
scope: z.literal("project"),
|
|
103
|
+
})
|
|
104
|
+
.strict();
|
|
105
|
+
const sessionPurge = z
|
|
106
|
+
.object({
|
|
107
|
+
provider: ContextModeProviderSchema,
|
|
108
|
+
projectPath: absoluteLocalPath,
|
|
109
|
+
confirm: z.literal(true),
|
|
110
|
+
scope: z.literal("session"),
|
|
111
|
+
sessionId: z.string().trim().min(1).max(256),
|
|
112
|
+
})
|
|
113
|
+
.strict();
|
|
114
|
+
|
|
115
|
+
export const PurgeKnowledgeInputSchema = z.discriminatedUnion("scope", [
|
|
116
|
+
projectPurge,
|
|
117
|
+
sessionPurge,
|
|
118
|
+
]);
|
|
119
|
+
|
|
120
|
+
export const searchContextModeKnowledge = defineRpc({
|
|
121
|
+
name: "context-mode.knowledge.search",
|
|
122
|
+
input: SearchKnowledgeInputSchema,
|
|
123
|
+
output: KnowledgeToolResultSchema,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export const indexContextModePath = defineRpc({
|
|
127
|
+
name: "context-mode.knowledge.index-path",
|
|
128
|
+
input: IndexPathInputSchema,
|
|
129
|
+
output: KnowledgeToolResultSchema,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const fetchAndIndexContextMode = defineRpc({
|
|
133
|
+
name: "context-mode.knowledge.fetch-index",
|
|
134
|
+
input: FetchAndIndexInputSchema,
|
|
135
|
+
output: KnowledgeToolResultSchema,
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
export const purgeContextModeKnowledge = defineRpc({
|
|
139
|
+
name: "context-mode.knowledge.purge",
|
|
140
|
+
input: PurgeKnowledgeInputSchema,
|
|
141
|
+
output: KnowledgeToolResultSchema,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
export type ContextModeProvider = z.infer<typeof ContextModeProviderSchema>;
|
|
145
|
+
export type ContextModePlatform = z.infer<typeof ContextModePlatformSchema>;
|
|
146
|
+
export type KnowledgeToolResult = z.infer<typeof KnowledgeToolResultSchema>;
|
|
147
|
+
export type SearchKnowledgeInput = z.infer<typeof SearchKnowledgeInputSchema>;
|
|
148
|
+
export type IndexPathInput = z.infer<typeof IndexPathInputSchema>;
|
|
149
|
+
export type FetchAndIndexInput = z.infer<typeof FetchAndIndexInputSchema>;
|
|
150
|
+
export type PurgeKnowledgeInput = z.infer<typeof PurgeKnowledgeInputSchema>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineSettings } from "@getpaseo/plugin";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const REFRESH_INTERVALS = [5_000, 15_000, 30_000, 60_000] as const;
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_CONTEXT_MODE_SETTINGS = {
|
|
7
|
+
binaryMode: "path",
|
|
8
|
+
binaryPath: "",
|
|
9
|
+
refreshIntervalMs: 15_000,
|
|
10
|
+
showDoctorByDefault: false,
|
|
11
|
+
autoInject: true,
|
|
12
|
+
preferNativeIntegrations: true,
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
function isAbsolutePath(value: string): boolean {
|
|
16
|
+
return value.startsWith("/") || /^[A-Za-z]:[\\/]/.test(value);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const ContextModeSettingsSchema = z
|
|
20
|
+
.object({
|
|
21
|
+
binaryMode: z.enum(["path", "automatic"]).default(DEFAULT_CONTEXT_MODE_SETTINGS.binaryMode),
|
|
22
|
+
binaryPath: z.string().trim().max(4_096).default(DEFAULT_CONTEXT_MODE_SETTINGS.binaryPath),
|
|
23
|
+
refreshIntervalMs: z
|
|
24
|
+
.union([z.literal(5_000), z.literal(15_000), z.literal(30_000), z.literal(60_000)])
|
|
25
|
+
.default(DEFAULT_CONTEXT_MODE_SETTINGS.refreshIntervalMs),
|
|
26
|
+
showDoctorByDefault: z.boolean().default(DEFAULT_CONTEXT_MODE_SETTINGS.showDoctorByDefault),
|
|
27
|
+
autoInject: z.boolean().default(DEFAULT_CONTEXT_MODE_SETTINGS.autoInject),
|
|
28
|
+
preferNativeIntegrations: z
|
|
29
|
+
.boolean()
|
|
30
|
+
.default(DEFAULT_CONTEXT_MODE_SETTINGS.preferNativeIntegrations),
|
|
31
|
+
})
|
|
32
|
+
.strict()
|
|
33
|
+
.superRefine((settings, context) => {
|
|
34
|
+
if (settings.binaryMode !== "path" || settings.binaryPath.length === 0) return;
|
|
35
|
+
if (!isAbsolutePath(settings.binaryPath)) {
|
|
36
|
+
context.addIssue({
|
|
37
|
+
code: "custom",
|
|
38
|
+
path: ["binaryPath"],
|
|
39
|
+
message: "The Context Mode binary path must be absolute.",
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export type ContextModeSettings = z.infer<typeof ContextModeSettingsSchema>;
|
|
45
|
+
|
|
46
|
+
export const contextModeSettings = defineSettings({
|
|
47
|
+
id: "context-mode",
|
|
48
|
+
scope: "host",
|
|
49
|
+
version: 1,
|
|
50
|
+
schema: ContextModeSettingsSchema,
|
|
51
|
+
});
|