codexuse-cli 3.6.6 → 3.7.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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/server/index.mjs +330 -74
- package/package.json +1 -1
package/dist/server/index.mjs
CHANGED
|
@@ -16916,7 +16916,7 @@ function fixPath() {
|
|
|
16916
16916
|
if (result) process.env.PATH = result;
|
|
16917
16917
|
} catch {}
|
|
16918
16918
|
}
|
|
16919
|
-
const expandHomePath = fn(function* (input) {
|
|
16919
|
+
const expandHomePath$1 = fn(function* (input) {
|
|
16920
16920
|
const { join } = yield* Path$1;
|
|
16921
16921
|
if (input === "~") return OS.homedir();
|
|
16922
16922
|
if (input.startsWith("~/") || input.startsWith("~\\")) return join(OS.homedir(), input.slice(2));
|
|
@@ -16925,7 +16925,7 @@ const expandHomePath = fn(function* (input) {
|
|
|
16925
16925
|
const resolveStateDir = fn(function* (raw) {
|
|
16926
16926
|
const { join, resolve } = yield* Path$1;
|
|
16927
16927
|
if (!raw || raw.trim().length === 0) return join(OS.homedir(), ".t3", "userdata");
|
|
16928
|
-
return resolve(yield* expandHomePath(raw.trim()));
|
|
16928
|
+
return resolve(yield* expandHomePath$1(raw.trim()));
|
|
16929
16929
|
});
|
|
16930
16930
|
//#endregion
|
|
16931
16931
|
//#region ../../packages/t3-contracts/src/baseSchemas.ts
|
|
@@ -17115,6 +17115,8 @@ const MODEL_SLUG_ALIASES_BY_PROVIDER = { codex: {
|
|
|
17115
17115
|
const ORCHESTRATION_WS_METHODS = {
|
|
17116
17116
|
getSnapshot: "orchestration.getSnapshot",
|
|
17117
17117
|
getThreadSnapshot: "orchestration.getThreadSnapshot",
|
|
17118
|
+
subscribeShell: "orchestration.subscribeShell",
|
|
17119
|
+
subscribeThread: "orchestration.subscribeThread",
|
|
17118
17120
|
syncExternalThreads: "orchestration.syncExternalThreads",
|
|
17119
17121
|
dispatchCommand: "orchestration.dispatchCommand",
|
|
17120
17122
|
getTurnDiff: "orchestration.getTurnDiff",
|
|
@@ -17361,7 +17363,8 @@ const ProjectMetaUpdateCommand = Struct({
|
|
|
17361
17363
|
const ProjectDeleteCommand = Struct({
|
|
17362
17364
|
type: Literal("project.delete"),
|
|
17363
17365
|
commandId: CommandId,
|
|
17364
|
-
projectId: ProjectId
|
|
17366
|
+
projectId: ProjectId,
|
|
17367
|
+
force: optional$2(Literal(true))
|
|
17365
17368
|
});
|
|
17366
17369
|
const ThreadCreateCommand = Struct({
|
|
17367
17370
|
type: Literal("thread.create"),
|
|
@@ -19028,6 +19031,7 @@ const STATIC_KEYBINDING_COMMANDS = [
|
|
|
19028
19031
|
"terminal.new",
|
|
19029
19032
|
"terminal.close",
|
|
19030
19033
|
"diff.toggle",
|
|
19034
|
+
"commandPalette.toggle",
|
|
19031
19035
|
"chat.new",
|
|
19032
19036
|
"chat.newLocal",
|
|
19033
19037
|
"editor.openFavorite",
|
|
@@ -19117,6 +19121,21 @@ const ProjectWriteFileInput = Struct({
|
|
|
19117
19121
|
});
|
|
19118
19122
|
const ProjectWriteFileResult = Struct({ relativePath: TrimmedNonEmptyString });
|
|
19119
19123
|
//#endregion
|
|
19124
|
+
//#region ../../packages/t3-contracts/src/filesystem.ts
|
|
19125
|
+
const FILESYSTEM_PATH_MAX_LENGTH = 512;
|
|
19126
|
+
const FilesystemBrowseInput = Struct({
|
|
19127
|
+
partialPath: TrimmedNonEmptyString.check(isMaxLength(FILESYSTEM_PATH_MAX_LENGTH)),
|
|
19128
|
+
cwd: optional$2(TrimmedNonEmptyString.check(isMaxLength(FILESYSTEM_PATH_MAX_LENGTH)))
|
|
19129
|
+
});
|
|
19130
|
+
const FilesystemBrowseEntry = Struct({
|
|
19131
|
+
name: TrimmedNonEmptyString,
|
|
19132
|
+
fullPath: TrimmedNonEmptyString
|
|
19133
|
+
});
|
|
19134
|
+
const FilesystemBrowseResult = Struct({
|
|
19135
|
+
parentPath: TrimmedNonEmptyString,
|
|
19136
|
+
entries: Array$1(FilesystemBrowseEntry)
|
|
19137
|
+
});
|
|
19138
|
+
//#endregion
|
|
19120
19139
|
//#region ../../packages/t3-contracts/src/editor.ts
|
|
19121
19140
|
const EDITORS = [
|
|
19122
19141
|
{
|
|
@@ -19168,6 +19187,14 @@ const OpenInEditorInput = Struct({
|
|
|
19168
19187
|
editor: EditorId
|
|
19169
19188
|
});
|
|
19170
19189
|
//#endregion
|
|
19190
|
+
//#region ../../packages/t3-contracts/src/generalChat.ts
|
|
19191
|
+
const GeneralChatConfig = Struct({ workspaceRoot: TrimmedNonEmptyString });
|
|
19192
|
+
const GeneralChatEnsureResult = Struct({
|
|
19193
|
+
projectId: ProjectId,
|
|
19194
|
+
workspaceRoot: TrimmedNonEmptyString,
|
|
19195
|
+
created: Boolean$2
|
|
19196
|
+
});
|
|
19197
|
+
//#endregion
|
|
19171
19198
|
//#region ../../packages/t3-contracts/src/server.ts
|
|
19172
19199
|
const KeybindingsMalformedConfigIssue = Struct({
|
|
19173
19200
|
kind: Literal("keybindings.malformed-config"),
|
|
@@ -19211,7 +19238,8 @@ const ServerConfig = Struct({
|
|
|
19211
19238
|
issues: ServerConfigIssues,
|
|
19212
19239
|
providers: ServerProviderStatuses,
|
|
19213
19240
|
availableEditors: Array$1(EditorId),
|
|
19214
|
-
projectPolicy: ServerProjectPolicy
|
|
19241
|
+
projectPolicy: ServerProjectPolicy,
|
|
19242
|
+
generalChat: GeneralChatConfig
|
|
19215
19243
|
});
|
|
19216
19244
|
const ServerUpsertKeybindingResult = Struct({
|
|
19217
19245
|
keybindings: ResolvedKeybindingsConfig,
|
|
@@ -19221,7 +19249,8 @@ const ServerConfigUpdatedPayload = Struct({
|
|
|
19221
19249
|
reason: Literals(["keybindings", "projectPolicy"]),
|
|
19222
19250
|
issues: ServerConfigIssues,
|
|
19223
19251
|
providers: ServerProviderStatuses,
|
|
19224
|
-
projectPolicy: ServerProjectPolicy
|
|
19252
|
+
projectPolicy: ServerProjectPolicy,
|
|
19253
|
+
generalChat: GeneralChatConfig
|
|
19225
19254
|
});
|
|
19226
19255
|
const ServerProviderUpdatedPayload = Struct({ providers: ServerProviderStatuses });
|
|
19227
19256
|
//#endregion
|
|
@@ -19233,6 +19262,8 @@ const WS_METHODS = {
|
|
|
19233
19262
|
projectsEnsure: "projects.ensure",
|
|
19234
19263
|
projectsSearchEntries: "projects.searchEntries",
|
|
19235
19264
|
projectsWriteFile: "projects.writeFile",
|
|
19265
|
+
generalChatEnsure: "generalChat.ensure",
|
|
19266
|
+
filesystemBrowse: "filesystem.browse",
|
|
19236
19267
|
shellOpenInEditor: "shell.openInEditor",
|
|
19237
19268
|
gitPull: "git.pull",
|
|
19238
19269
|
gitStatus: "git.status",
|
|
@@ -19332,6 +19363,8 @@ const WebSocketRequestBody = Union([
|
|
|
19332
19363
|
tagRequestBody(WS_METHODS.projectsEnsure, ProjectEnsureInput),
|
|
19333
19364
|
tagRequestBody(WS_METHODS.projectsSearchEntries, ProjectSearchEntriesInput),
|
|
19334
19365
|
tagRequestBody(WS_METHODS.projectsWriteFile, ProjectWriteFileInput),
|
|
19366
|
+
tagRequestBody(WS_METHODS.generalChatEnsure, Struct({})),
|
|
19367
|
+
tagRequestBody(WS_METHODS.filesystemBrowse, FilesystemBrowseInput),
|
|
19335
19368
|
tagRequestBody(WS_METHODS.shellOpenInEditor, OpenInEditorInput),
|
|
19336
19369
|
tagRequestBody(WS_METHODS.gitPull, GitPullInput),
|
|
19337
19370
|
tagRequestBody(WS_METHODS.gitStatus, GitStatusInput),
|
|
@@ -20433,6 +20466,20 @@ const normalizePersistedJsonColumns = gen(function* () {
|
|
|
20433
20466
|
//#region src/persistence/Migrations/020_NormalizePersistedJsonColumns.ts
|
|
20434
20467
|
var _020_NormalizePersistedJsonColumns_default = normalizePersistedJsonColumns;
|
|
20435
20468
|
//#endregion
|
|
20469
|
+
//#region src/persistence/Migrations/021_CleanupInvalidProjectionPendingApprovals.ts
|
|
20470
|
+
var _021_CleanupInvalidProjectionPendingApprovals_default = gen(function* () {
|
|
20471
|
+
yield* (yield* SqlClient)`
|
|
20472
|
+
DELETE FROM projection_pending_approvals
|
|
20473
|
+
WHERE request_id NOT IN (
|
|
20474
|
+
SELECT DISTINCT json_extract(payload_json, '$.requestId')
|
|
20475
|
+
FROM projection_thread_activities
|
|
20476
|
+
WHERE kind = 'approval.requested'
|
|
20477
|
+
AND json_valid(payload_json) = 1
|
|
20478
|
+
AND json_extract(payload_json, '$.requestId') IS NOT NULL
|
|
20479
|
+
)
|
|
20480
|
+
`;
|
|
20481
|
+
});
|
|
20482
|
+
//#endregion
|
|
20436
20483
|
//#region src/persistence/Migrations.ts
|
|
20437
20484
|
/**
|
|
20438
20485
|
* Migrations - Migration runner with inline loader
|
|
@@ -20473,7 +20520,8 @@ const loader = fromRecord({
|
|
|
20473
20520
|
"17_ProjectionThreadsArchivedAt": _017_ProjectionThreadsArchivedAt_default,
|
|
20474
20521
|
"18_CanonicalizeModelSelections": _018_CanonicalizeModelSelections_default,
|
|
20475
20522
|
"19_NormalizeProjectionModelSelectionJson": _019_NormalizeProjectionModelSelectionJson_default,
|
|
20476
|
-
"20_NormalizePersistedJsonColumns": _020_NormalizePersistedJsonColumns_default
|
|
20523
|
+
"20_NormalizePersistedJsonColumns": _020_NormalizePersistedJsonColumns_default,
|
|
20524
|
+
"21_CleanupInvalidProjectionPendingApprovals": _021_CleanupInvalidProjectionPendingApprovals_default
|
|
20477
20525
|
});
|
|
20478
20526
|
/**
|
|
20479
20527
|
* Migrator run function - no schema dumping needed
|
|
@@ -23124,7 +23172,25 @@ const decideOrchestrationCommand = fn("decideOrchestrationCommand")(function* ({
|
|
|
23124
23172
|
projectId: command.projectId
|
|
23125
23173
|
});
|
|
23126
23174
|
const occurredAt = nowIso$2();
|
|
23127
|
-
|
|
23175
|
+
const activeProjectThreads = readModel.threads.filter((thread) => thread.projectId === command.projectId && thread.deletedAt === null);
|
|
23176
|
+
if (activeProjectThreads.length > 0 && command.force !== true) return yield* fail$1(new OrchestrationCommandInvariantError({
|
|
23177
|
+
commandType: command.type,
|
|
23178
|
+
detail: `Project '${command.projectId}' has ${activeProjectThreads.length} thread(s).`
|
|
23179
|
+
}));
|
|
23180
|
+
const threadDeletedEvents = activeProjectThreads.map((thread) => ({
|
|
23181
|
+
...withEventBase({
|
|
23182
|
+
aggregateKind: "thread",
|
|
23183
|
+
aggregateId: thread.id,
|
|
23184
|
+
occurredAt,
|
|
23185
|
+
commandId: command.commandId
|
|
23186
|
+
}),
|
|
23187
|
+
type: "thread.deleted",
|
|
23188
|
+
payload: {
|
|
23189
|
+
threadId: thread.id,
|
|
23190
|
+
deletedAt: occurredAt
|
|
23191
|
+
}
|
|
23192
|
+
}));
|
|
23193
|
+
const projectDeletedEvent = {
|
|
23128
23194
|
...withEventBase({
|
|
23129
23195
|
aggregateKind: "project",
|
|
23130
23196
|
aggregateId: command.projectId,
|
|
@@ -23137,6 +23203,7 @@ const decideOrchestrationCommand = fn("decideOrchestrationCommand")(function* ({
|
|
|
23137
23203
|
deletedAt: occurredAt
|
|
23138
23204
|
}
|
|
23139
23205
|
};
|
|
23206
|
+
return [...threadDeletedEvents, projectDeletedEvent];
|
|
23140
23207
|
}
|
|
23141
23208
|
case "thread.create":
|
|
23142
23209
|
yield* requireProject({
|
|
@@ -24711,6 +24778,20 @@ const IGNORED_DIRECTORY_NAMES = new Set([
|
|
|
24711
24778
|
"out",
|
|
24712
24779
|
".cache"
|
|
24713
24780
|
]);
|
|
24781
|
+
function expandHomePath(input) {
|
|
24782
|
+
if (input === "~") return os.homedir();
|
|
24783
|
+
if (input.startsWith("~/") || input.startsWith("~\\")) return path.join(os.homedir(), input.slice(2));
|
|
24784
|
+
return input;
|
|
24785
|
+
}
|
|
24786
|
+
function isWindowsAbsolutePath(input) {
|
|
24787
|
+
return /^[a-zA-Z]:[\\/]/.test(input) || /^\\\\[^\\]+\\[^\\]+/.test(input);
|
|
24788
|
+
}
|
|
24789
|
+
function resolveBrowseTarget(input) {
|
|
24790
|
+
if (process.platform !== "win32" && isWindowsAbsolutePath(input.partialPath)) throw new Error("Windows-style paths are only supported on Windows.");
|
|
24791
|
+
const expanded = expandHomePath(input.partialPath);
|
|
24792
|
+
if (path.isAbsolute(expanded) || input.partialPath.startsWith("~")) return path.resolve(expanded);
|
|
24793
|
+
return input.cwd ? path.resolve(expandHomePath(input.cwd), expanded) : path.resolve(expanded);
|
|
24794
|
+
}
|
|
24714
24795
|
const workspaceIndexCache = /* @__PURE__ */ new Map();
|
|
24715
24796
|
const inFlightWorkspaceIndexBuilds = /* @__PURE__ */ new Map();
|
|
24716
24797
|
function toPosixPath(input) {
|
|
@@ -25029,6 +25110,22 @@ async function searchWorkspaceEntries(input) {
|
|
|
25029
25110
|
truncated: index.truncated || matchedEntryCount > limit
|
|
25030
25111
|
};
|
|
25031
25112
|
}
|
|
25113
|
+
async function browseFilesystemEntries(input) {
|
|
25114
|
+
const resolvedInputPath = resolveBrowseTarget(input);
|
|
25115
|
+
const endsWithSeparator = /[\\/]$/.test(input.partialPath) || input.partialPath === "~";
|
|
25116
|
+
const parentPath = endsWithSeparator ? resolvedInputPath : path.dirname(resolvedInputPath);
|
|
25117
|
+
const prefix = endsWithSeparator ? "" : path.basename(resolvedInputPath);
|
|
25118
|
+
const dirents = await fs$1.readdir(parentPath, { withFileTypes: true });
|
|
25119
|
+
const showHidden = endsWithSeparator || prefix.startsWith(".");
|
|
25120
|
+
const lowerPrefix = prefix.toLowerCase();
|
|
25121
|
+
return {
|
|
25122
|
+
parentPath,
|
|
25123
|
+
entries: dirents.filter((dirent) => dirent.isDirectory() && dirent.name.toLowerCase().startsWith(lowerPrefix) && (showHidden || !dirent.name.startsWith("."))).map((dirent) => ({
|
|
25124
|
+
name: dirent.name,
|
|
25125
|
+
fullPath: path.join(parentPath, dirent.name)
|
|
25126
|
+
})).sort((left, right) => left.name.localeCompare(right.name))
|
|
25127
|
+
};
|
|
25128
|
+
}
|
|
25032
25129
|
//#endregion
|
|
25033
25130
|
//#region src/provider/Services/ProviderService.ts
|
|
25034
25131
|
/**
|
|
@@ -25586,15 +25683,49 @@ var ProviderCommandReactor = class extends Service()("t3/orchestration/Services/
|
|
|
25586
25683
|
*/
|
|
25587
25684
|
var ProviderRuntimeIngestionService = class extends Service()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {};
|
|
25588
25685
|
//#endregion
|
|
25686
|
+
//#region src/terminal/Services/Manager.ts
|
|
25687
|
+
var TerminalError = class extends TaggedErrorClass()("TerminalError", {
|
|
25688
|
+
message: String$1,
|
|
25689
|
+
cause: optional$2(Defect)
|
|
25690
|
+
}) {};
|
|
25691
|
+
/**
|
|
25692
|
+
* TerminalManager - Service tag for terminal session orchestration.
|
|
25693
|
+
*/
|
|
25694
|
+
var TerminalManager = class extends Service()("t3/terminal/Services/Manager/TerminalManager") {};
|
|
25695
|
+
//#endregion
|
|
25589
25696
|
//#region src/orchestration/Layers/OrchestrationReactor.ts
|
|
25590
25697
|
const makeOrchestrationReactor = gen(function* () {
|
|
25698
|
+
const orchestrationEngine = yield* OrchestrationEngineService;
|
|
25591
25699
|
const providerRuntimeIngestion = yield* ProviderRuntimeIngestionService;
|
|
25592
25700
|
const providerCommandReactor = yield* ProviderCommandReactor;
|
|
25593
25701
|
const checkpointReactor = yield* CheckpointReactor;
|
|
25702
|
+
const providerService = yield* ProviderService;
|
|
25703
|
+
const terminalManager = yield* TerminalManager;
|
|
25704
|
+
const startThreadDeletionCleanup = forkScoped(runForEach(orchestrationEngine.streamDomainEvents, (event) => {
|
|
25705
|
+
if (event.type !== "thread.deleted") return void_$1;
|
|
25706
|
+
const threadId = event.payload.threadId;
|
|
25707
|
+
return all([providerService.stopSession({ threadId }).pipe(catchCause((cause) => {
|
|
25708
|
+
if (hasInterruptsOnly(cause)) return failCause(cause);
|
|
25709
|
+
return logWarning$1("failed to stop provider session for deleted thread", {
|
|
25710
|
+
threadId,
|
|
25711
|
+
cause: pretty(cause)
|
|
25712
|
+
});
|
|
25713
|
+
})), terminalManager.close({
|
|
25714
|
+
threadId,
|
|
25715
|
+
deleteHistory: true
|
|
25716
|
+
}).pipe(catchCause((cause) => {
|
|
25717
|
+
if (hasInterruptsOnly(cause)) return failCause(cause);
|
|
25718
|
+
return logWarning$1("failed to close terminals for deleted thread", {
|
|
25719
|
+
threadId,
|
|
25720
|
+
cause: pretty(cause)
|
|
25721
|
+
});
|
|
25722
|
+
}))], { concurrency: "unbounded" }).pipe(asVoid);
|
|
25723
|
+
})).pipe(asVoid);
|
|
25594
25724
|
return { start: gen(function* () {
|
|
25595
25725
|
yield* providerRuntimeIngestion.start;
|
|
25596
25726
|
yield* providerCommandReactor.start;
|
|
25597
25727
|
yield* checkpointReactor.start;
|
|
25728
|
+
yield* startThreadDeletionCleanup;
|
|
25598
25729
|
}) };
|
|
25599
25730
|
});
|
|
25600
25731
|
const OrchestrationReactorLive = effect(OrchestrationReactor, makeOrchestrationReactor);
|
|
@@ -25878,11 +26009,11 @@ const make$5 = gen(function* () {
|
|
|
25878
26009
|
},
|
|
25879
26010
|
createdAt
|
|
25880
26011
|
});
|
|
25881
|
-
const
|
|
26012
|
+
const activeSession = yield* resolveActiveSession(threadId);
|
|
26013
|
+
const existingSessionThreadId = thread.session && thread.session.status !== "stopped" && activeSession ? thread.id : null;
|
|
25882
26014
|
if (existingSessionThreadId) {
|
|
25883
26015
|
const runtimeModeChanged = thread.runtimeMode !== thread.session?.runtimeMode;
|
|
25884
26016
|
const providerChanged = requestedModelSelection !== void 0 && requestedModelSelection.provider !== currentProvider;
|
|
25885
|
-
const activeSession = yield* resolveActiveSession(existingSessionThreadId);
|
|
25886
26017
|
const sessionModelSwitch = currentProvider === void 0 ? "in-session" : (yield* providerService.getCapabilities(currentProvider)).sessionModelSwitch;
|
|
25887
26018
|
const modelChanged = requestedModelSelection !== void 0 && requestedModelSelection.model !== activeSession?.model;
|
|
25888
26019
|
const shouldRestartForModelChange = modelChanged && sessionModelSwitch === "restart-session";
|
|
@@ -28429,6 +28560,7 @@ const makeOrchestrationProjectionPipeline = gen(function* () {
|
|
|
28429
28560
|
return;
|
|
28430
28561
|
}
|
|
28431
28562
|
if (isSome(existingRow) && existingRow.value.status === "resolved") return;
|
|
28563
|
+
if (event.payload.activity.kind !== "approval.requested") return;
|
|
28432
28564
|
yield* projectionPendingApprovalRepository.upsert({
|
|
28433
28565
|
requestId,
|
|
28434
28566
|
threadId: event.payload.threadId,
|
|
@@ -28520,43 +28652,6 @@ const makeOrchestrationProjectionPipeline = gen(function* () {
|
|
|
28520
28652
|
});
|
|
28521
28653
|
const OrchestrationProjectionPipelineLive = effect(OrchestrationProjectionPipeline, makeOrchestrationProjectionPipeline).pipe(provideMerge(layer$2), provideMerge(ProjectionProjectRepositoryLive), provideMerge(ProjectionThreadRepositoryLive), provideMerge(ProjectionThreadMessageRepositoryLive), provideMerge(ProjectionThreadProposedPlanRepositoryLive), provideMerge(ProjectionThreadActivityRepositoryLive), provideMerge(ProjectionThreadSessionRepositoryLive), provideMerge(ProjectionTurnRepositoryLive), provideMerge(ProjectionCheckpointRepositoryLive), provideMerge(ProjectionPendingApprovalRepositoryLive), provideMerge(ProjectionStateRepositoryLive));
|
|
28522
28654
|
//#endregion
|
|
28523
|
-
//#region ../../packages/contracts/src/settings/auto-roll.ts
|
|
28524
|
-
const DEFAULT_AUTO_ROLL_ENABLED = false;
|
|
28525
|
-
const DEFAULT_AUTO_ROLL_WARNING_THRESHOLD = 85;
|
|
28526
|
-
const DEFAULT_AUTO_ROLL_SWITCH_THRESHOLD = 95;
|
|
28527
|
-
const AUTO_ROLL_WARNING_MIN = 50;
|
|
28528
|
-
const AUTO_ROLL_WARNING_MAX = 99;
|
|
28529
|
-
const AUTO_ROLL_SWITCH_MAX = 100;
|
|
28530
|
-
function clampNumber(value, min, max) {
|
|
28531
|
-
return Math.min(max, Math.max(min, value));
|
|
28532
|
-
}
|
|
28533
|
-
function resolveFiniteNumber(value, fallback) {
|
|
28534
|
-
return Number.isFinite(value) ? value : fallback;
|
|
28535
|
-
}
|
|
28536
|
-
function sanitizeAutoRollWarningThreshold(value) {
|
|
28537
|
-
return clampNumber(resolveFiniteNumber(value, 85), 50, AUTO_ROLL_WARNING_MAX);
|
|
28538
|
-
}
|
|
28539
|
-
function sanitizeAutoRollSwitchThreshold(value, warningThreshold) {
|
|
28540
|
-
const sanitizedWarning = sanitizeAutoRollWarningThreshold(warningThreshold);
|
|
28541
|
-
return clampNumber(resolveFiniteNumber(value, 95), sanitizedWarning + 1, AUTO_ROLL_SWITCH_MAX);
|
|
28542
|
-
}
|
|
28543
|
-
function sanitizeAutoRollThresholds(warningThreshold, switchThreshold) {
|
|
28544
|
-
const sanitizedWarning = sanitizeAutoRollWarningThreshold(warningThreshold);
|
|
28545
|
-
return {
|
|
28546
|
-
warningThreshold: sanitizedWarning,
|
|
28547
|
-
switchThreshold: sanitizeAutoRollSwitchThreshold(switchThreshold, sanitizedWarning)
|
|
28548
|
-
};
|
|
28549
|
-
}
|
|
28550
|
-
function normalizeAutoRollSettings(raw) {
|
|
28551
|
-
const enabled = typeof raw?.enabled === "boolean" ? raw.enabled : false;
|
|
28552
|
-
const { warningThreshold: normalizedWarning, switchThreshold: normalizedSwitch } = sanitizeAutoRollThresholds(resolveFiniteNumber(typeof raw?.warningThreshold === "number" ? raw.warningThreshold : NaN, 85), resolveFiniteNumber(typeof raw?.switchThreshold === "number" ? raw.switchThreshold : NaN, 95));
|
|
28553
|
-
return {
|
|
28554
|
-
enabled,
|
|
28555
|
-
warningThreshold: normalizedWarning,
|
|
28556
|
-
switchThreshold: normalizedSwitch
|
|
28557
|
-
};
|
|
28558
|
-
}
|
|
28559
|
-
//#endregion
|
|
28560
28655
|
//#region ../../packages/contracts/src/settings/chat-scrollback.ts
|
|
28561
28656
|
const CHAT_SCROLLBACK_DEFAULT = 200;
|
|
28562
28657
|
const CHAT_SCROLLBACK_MIN = 50;
|
|
@@ -29120,6 +29215,81 @@ async function patchAppState(patch) {
|
|
|
29120
29215
|
});
|
|
29121
29216
|
}
|
|
29122
29217
|
//#endregion
|
|
29218
|
+
//#region ../../packages/runtime-app-state/src/app/generalChatWorkspace.ts
|
|
29219
|
+
const GENERAL_CHAT_WORKSPACE_DIRNAME = "general-chat-workspace";
|
|
29220
|
+
const GENERAL_CHAT_PROJECT_TITLE = "General Chat";
|
|
29221
|
+
const GENERAL_CHAT_ANALYTICS_BUCKET = "General Chat";
|
|
29222
|
+
const GENERAL_CHAT_AGENTS_FILENAME = "AGENTS.md";
|
|
29223
|
+
const IS_CASE_INSENSITIVE_PLATFORM$1 = process.platform === "darwin" || process.platform === "win32";
|
|
29224
|
+
function stripTrailingSeparators$1(input) {
|
|
29225
|
+
const trimmed = input.trim();
|
|
29226
|
+
if (trimmed.length === 0) return trimmed;
|
|
29227
|
+
const root = path.parse(trimmed).root;
|
|
29228
|
+
let next = trimmed;
|
|
29229
|
+
while (next.length > root.length && /[\\/]+$/.test(next)) next = next.slice(0, -1);
|
|
29230
|
+
return next;
|
|
29231
|
+
}
|
|
29232
|
+
function canonicalizeWorkspaceRoot(input) {
|
|
29233
|
+
const resolved = path.resolve(input.trim());
|
|
29234
|
+
return stripTrailingSeparators$1((() => {
|
|
29235
|
+
try {
|
|
29236
|
+
return realpathSync.native(resolved);
|
|
29237
|
+
} catch {
|
|
29238
|
+
return resolved;
|
|
29239
|
+
}
|
|
29240
|
+
})());
|
|
29241
|
+
}
|
|
29242
|
+
function workspaceRootKey(input) {
|
|
29243
|
+
const canonical = canonicalizeWorkspaceRoot(input).replaceAll("\\", "/");
|
|
29244
|
+
return IS_CASE_INSENSITIVE_PLATFORM$1 ? canonical.toLowerCase() : canonical;
|
|
29245
|
+
}
|
|
29246
|
+
function resolveGeneralChatWorkspaceRoot() {
|
|
29247
|
+
return canonicalizeWorkspaceRoot(path.join(getUserDataDir(), GENERAL_CHAT_WORKSPACE_DIRNAME));
|
|
29248
|
+
}
|
|
29249
|
+
function resolveGeneralChatAgentsPath() {
|
|
29250
|
+
return path.join(resolveGeneralChatWorkspaceRoot(), GENERAL_CHAT_AGENTS_FILENAME);
|
|
29251
|
+
}
|
|
29252
|
+
function isGeneralChatWorkspaceRoot(workspaceRoot) {
|
|
29253
|
+
return workspaceRootKey(workspaceRoot) === workspaceRootKey(resolveGeneralChatWorkspaceRoot());
|
|
29254
|
+
}
|
|
29255
|
+
//#endregion
|
|
29256
|
+
//#region ../../packages/contracts/src/settings/auto-roll.ts
|
|
29257
|
+
const DEFAULT_AUTO_ROLL_ENABLED = false;
|
|
29258
|
+
const DEFAULT_AUTO_ROLL_WARNING_THRESHOLD = 85;
|
|
29259
|
+
const DEFAULT_AUTO_ROLL_SWITCH_THRESHOLD = 95;
|
|
29260
|
+
const AUTO_ROLL_WARNING_MIN = 50;
|
|
29261
|
+
const AUTO_ROLL_WARNING_MAX = 99;
|
|
29262
|
+
const AUTO_ROLL_SWITCH_MAX = 100;
|
|
29263
|
+
function clampNumber(value, min, max) {
|
|
29264
|
+
return Math.min(max, Math.max(min, value));
|
|
29265
|
+
}
|
|
29266
|
+
function resolveFiniteNumber(value, fallback) {
|
|
29267
|
+
return Number.isFinite(value) ? value : fallback;
|
|
29268
|
+
}
|
|
29269
|
+
function sanitizeAutoRollWarningThreshold(value) {
|
|
29270
|
+
return clampNumber(resolveFiniteNumber(value, 85), 50, AUTO_ROLL_WARNING_MAX);
|
|
29271
|
+
}
|
|
29272
|
+
function sanitizeAutoRollSwitchThreshold(value, warningThreshold) {
|
|
29273
|
+
const sanitizedWarning = sanitizeAutoRollWarningThreshold(warningThreshold);
|
|
29274
|
+
return clampNumber(resolveFiniteNumber(value, 95), sanitizedWarning + 1, AUTO_ROLL_SWITCH_MAX);
|
|
29275
|
+
}
|
|
29276
|
+
function sanitizeAutoRollThresholds(warningThreshold, switchThreshold) {
|
|
29277
|
+
const sanitizedWarning = sanitizeAutoRollWarningThreshold(warningThreshold);
|
|
29278
|
+
return {
|
|
29279
|
+
warningThreshold: sanitizedWarning,
|
|
29280
|
+
switchThreshold: sanitizeAutoRollSwitchThreshold(switchThreshold, sanitizedWarning)
|
|
29281
|
+
};
|
|
29282
|
+
}
|
|
29283
|
+
function normalizeAutoRollSettings(raw) {
|
|
29284
|
+
const enabled = typeof raw?.enabled === "boolean" ? raw.enabled : false;
|
|
29285
|
+
const { warningThreshold: normalizedWarning, switchThreshold: normalizedSwitch } = sanitizeAutoRollThresholds(resolveFiniteNumber(typeof raw?.warningThreshold === "number" ? raw.warningThreshold : NaN, 85), resolveFiniteNumber(typeof raw?.switchThreshold === "number" ? raw.switchThreshold : NaN, 95));
|
|
29286
|
+
return {
|
|
29287
|
+
enabled,
|
|
29288
|
+
warningThreshold: normalizedWarning,
|
|
29289
|
+
switchThreshold: normalizedSwitch
|
|
29290
|
+
};
|
|
29291
|
+
}
|
|
29292
|
+
//#endregion
|
|
29123
29293
|
//#region ../../packages/runtime-codex/src/codex/settings.ts
|
|
29124
29294
|
function asString$7(value) {
|
|
29125
29295
|
if (typeof value !== "string") return null;
|
|
@@ -29654,7 +29824,7 @@ function findActiveProjectByCanonicalRoot(projects, workspaceRoot) {
|
|
|
29654
29824
|
function countActiveUniqueProjects(projects) {
|
|
29655
29825
|
const seen = /* @__PURE__ */ new Set();
|
|
29656
29826
|
for (const project of projects) {
|
|
29657
|
-
if (project.deletedAt !== null) continue;
|
|
29827
|
+
if (project.deletedAt !== null || isGeneralChatWorkspaceRoot(project.workspaceRoot)) continue;
|
|
29658
29828
|
seen.add(projectRootKey(project.workspaceRoot));
|
|
29659
29829
|
}
|
|
29660
29830
|
return seen.size;
|
|
@@ -32779,7 +32949,7 @@ const runExternalCodexThreadSync = gen(function* () {
|
|
|
32779
32949
|
}
|
|
32780
32950
|
const syncTargets = [];
|
|
32781
32951
|
for (const project of readModel.projects) {
|
|
32782
|
-
if (project.deletedAt !== null) continue;
|
|
32952
|
+
if (project.deletedAt !== null || isGeneralChatWorkspaceRoot(project.workspaceRoot)) continue;
|
|
32783
32953
|
const workspaceRoot = project.workspaceRoot;
|
|
32784
32954
|
const rootKey = projectRootKey(workspaceRoot);
|
|
32785
32955
|
if (projectIdByRootKey.has(rootKey)) continue;
|
|
@@ -36651,7 +36821,12 @@ const makeProviderService = (options) => gen(function* () {
|
|
|
36651
36821
|
allowRecovery: false
|
|
36652
36822
|
});
|
|
36653
36823
|
if (routed.isActive) yield* routed.adapter.stopSession(routed.threadId);
|
|
36654
|
-
yield* directory.
|
|
36824
|
+
const existingBinding = yield* directory.getBinding(input.threadId);
|
|
36825
|
+
if (isSome(existingBinding)) yield* directory.upsert({
|
|
36826
|
+
...existingBinding.value,
|
|
36827
|
+
status: "stopped",
|
|
36828
|
+
runtimePayload: { activeTurnId: null }
|
|
36829
|
+
});
|
|
36655
36830
|
});
|
|
36656
36831
|
const listSessions = () => gen(function* () {
|
|
36657
36832
|
const activeSessions = (yield* forEach(adapters, (adapter) => adapter.listSessions())).flatMap((sessions) => sessions);
|
|
@@ -36892,16 +37067,6 @@ var PtySpawnError = class extends TaggedErrorClass()("PtySpawnError", {
|
|
|
36892
37067
|
*/
|
|
36893
37068
|
var PtyAdapter = class extends Service()("t3/terminal/Services/PTY/PtyAdapter") {};
|
|
36894
37069
|
//#endregion
|
|
36895
|
-
//#region src/terminal/Services/Manager.ts
|
|
36896
|
-
var TerminalError = class extends TaggedErrorClass()("TerminalError", {
|
|
36897
|
-
message: String$1,
|
|
36898
|
-
cause: optional$2(Defect)
|
|
36899
|
-
}) {};
|
|
36900
|
-
/**
|
|
36901
|
-
* TerminalManager - Service tag for terminal session orchestration.
|
|
36902
|
-
*/
|
|
36903
|
-
var TerminalManager = class extends Service()("t3/terminal/Services/Manager/TerminalManager") {};
|
|
36904
|
-
//#endregion
|
|
36905
37070
|
//#region src/terminal/Layers/Manager.ts
|
|
36906
37071
|
const DEFAULT_HISTORY_LINE_LIMIT = 5e3;
|
|
36907
37072
|
const DEFAULT_PERSIST_DEBOUNCE_MS = 40;
|
|
@@ -37857,6 +38022,10 @@ const DEFAULT_KEYBINDINGS = [
|
|
|
37857
38022
|
command: "diff.toggle",
|
|
37858
38023
|
when: "!terminalFocus"
|
|
37859
38024
|
},
|
|
38025
|
+
{
|
|
38026
|
+
key: "mod+k",
|
|
38027
|
+
command: "commandPalette.toggle"
|
|
38028
|
+
},
|
|
37860
38029
|
{
|
|
37861
38030
|
key: "mod+n",
|
|
37862
38031
|
command: "chat.new",
|
|
@@ -40719,9 +40888,8 @@ function makeServerRuntimeServicesLayer() {
|
|
|
40719
40888
|
const runtimeIngestionLayer = ProviderRuntimeIngestionLive.pipe(provideMerge(runtimeServicesLayer));
|
|
40720
40889
|
const providerCommandReactorLayer = ProviderCommandReactorLive.pipe(provideMerge(runtimeServicesLayer), provideMerge(gitCoreLayer), provideMerge(textGenerationLayer));
|
|
40721
40890
|
const checkpointReactorLayer = CheckpointReactorLive.pipe(provideMerge(runtimeServicesLayer));
|
|
40722
|
-
const orchestrationReactorLayer = OrchestrationReactorLive.pipe(provideMerge(runtimeIngestionLayer), provideMerge(providerCommandReactorLayer), provideMerge(checkpointReactorLayer));
|
|
40723
40891
|
const terminalLayer = TerminalManagerLive.pipe(provide$1(typeof Bun !== "undefined" && process.platform !== "win32" ? BunPtyAdapterLive : NodePtyAdapterLive));
|
|
40724
|
-
return mergeAll(
|
|
40892
|
+
return mergeAll(OrchestrationReactorLive.pipe(provideMerge(runtimeIngestionLayer), provideMerge(providerCommandReactorLayer), provideMerge(checkpointReactorLayer), provideMerge(terminalLayer)), gitCoreLayer, GitManagerLive.pipe(provideMerge(gitCoreLayer), provideMerge(GitHubCliLive), provideMerge(textGenerationLayer)), terminalLayer, KeybindingsLive).pipe(provideMerge(layer$2));
|
|
40725
40893
|
}
|
|
40726
40894
|
//#endregion
|
|
40727
40895
|
//#region src/provider/Services/ProviderHealth.ts
|
|
@@ -49437,7 +49605,8 @@ function limitModelUsage(data, maxModels = MAX_MODELS) {
|
|
|
49437
49605
|
function buildProjectBreakdown(metrics) {
|
|
49438
49606
|
const projectMap = /* @__PURE__ */ new Map();
|
|
49439
49607
|
for (const metric of metrics) {
|
|
49440
|
-
const
|
|
49608
|
+
const rawProjectPath = metric.projectPath?.trim() || null;
|
|
49609
|
+
const key = rawProjectPath && isGeneralChatWorkspaceRoot(rawProjectPath) ? GENERAL_CHAT_ANALYTICS_BUCKET : rawProjectPath || "Unknown";
|
|
49441
49610
|
const entry = projectMap.get(key) ?? {
|
|
49442
49611
|
sessions: 0,
|
|
49443
49612
|
cost: 0,
|
|
@@ -50573,6 +50742,36 @@ async function inspectCodexRuntime(input) {
|
|
|
50573
50742
|
};
|
|
50574
50743
|
}
|
|
50575
50744
|
//#endregion
|
|
50745
|
+
//#region src/generalChat.ts
|
|
50746
|
+
const GENERAL_CHAT_AGENTS_CONTENT = `# AGENTS.md — General Chat
|
|
50747
|
+
|
|
50748
|
+
You are the assistant for CodexUse's General Chat surface.
|
|
50749
|
+
|
|
50750
|
+
Default behavior:
|
|
50751
|
+
- Talk like a normal general-purpose assistant.
|
|
50752
|
+
- Prefer direct answers, discussion, brainstorming, explanations, and everyday help.
|
|
50753
|
+
- Treat this workspace as internal app scaffolding, not as a user project.
|
|
50754
|
+
- For this General Chat workspace, treat this local AGENTS.md as the primary instruction source for behavior and tone.
|
|
50755
|
+
- Ignore or de-prioritize global CODEX_HOME AGENTS.md guidance that is mainly about coding workflows, repository work, file inspection, shell commands, patches, tests, PRs, or other project-task behavior, unless the user explicitly asks to switch into that kind of work.
|
|
50756
|
+
- Do not let coding-oriented global instructions push the conversation into repo/tooling behavior when the user is just using General Chat as a normal assistant.
|
|
50757
|
+
- Do not inspect files, run shell commands, modify the workspace, or take project actions unless the user clearly asks for that kind of help.
|
|
50758
|
+
- If the user explicitly switches into coding or workspace work, proceed deliberately and explain that you are leaving the default general-chat mode.
|
|
50759
|
+
`;
|
|
50760
|
+
function getGeneralChatConfig() {
|
|
50761
|
+
return { workspaceRoot: resolveGeneralChatWorkspaceRoot() };
|
|
50762
|
+
}
|
|
50763
|
+
async function ensureGeneralChatWorkspaceArtifacts() {
|
|
50764
|
+
const workspaceRoot = resolveGeneralChatWorkspaceRoot();
|
|
50765
|
+
const agentsPath = resolveGeneralChatAgentsPath();
|
|
50766
|
+
await promises.mkdir(workspaceRoot, { recursive: true });
|
|
50767
|
+
try {
|
|
50768
|
+
await promises.access(agentsPath);
|
|
50769
|
+
} catch {
|
|
50770
|
+
await promises.writeFile(agentsPath, GENERAL_CHAT_AGENTS_CONTENT, "utf8");
|
|
50771
|
+
}
|
|
50772
|
+
return workspaceRoot;
|
|
50773
|
+
}
|
|
50774
|
+
//#endregion
|
|
50576
50775
|
//#region src/telegram/bridge.ts
|
|
50577
50776
|
var TelegramApiRequestError = class extends Error {
|
|
50578
50777
|
constructor(message) {
|
|
@@ -52581,6 +52780,7 @@ const createServer = fn(function* () {
|
|
|
52581
52780
|
clients,
|
|
52582
52781
|
logOutgoingPush
|
|
52583
52782
|
});
|
|
52783
|
+
const generalChatConfig = getGeneralChatConfig();
|
|
52584
52784
|
yield* readiness.markPushBusReady;
|
|
52585
52785
|
yield* keybindingsManager.start.pipe(mapError((cause) => new ServerLifecycleError({
|
|
52586
52786
|
operation: "keybindingsRuntimeStart",
|
|
@@ -52588,7 +52788,7 @@ const createServer = fn(function* () {
|
|
|
52588
52788
|
})));
|
|
52589
52789
|
yield* readiness.markKeybindingsReady;
|
|
52590
52790
|
const normalizeProjectWorkspaceRoot = fnUntraced(function* (workspaceRoot) {
|
|
52591
|
-
const normalizedWorkspaceRoot = path.resolve(yield* expandHomePath(workspaceRoot.trim()));
|
|
52791
|
+
const normalizedWorkspaceRoot = path.resolve(yield* expandHomePath$1(workspaceRoot.trim()));
|
|
52592
52792
|
const workspaceStat = yield* fileSystem.stat(normalizedWorkspaceRoot).pipe(catch_(() => succeed(null)));
|
|
52593
52793
|
if (!workspaceStat) return yield* new RouteRequestError({ message: `Project directory does not exist: ${normalizedWorkspaceRoot}` });
|
|
52594
52794
|
if (workspaceStat.type !== "Directory") return yield* new RouteRequestError({ message: `Project path is not a directory: ${normalizedWorkspaceRoot}` });
|
|
@@ -52970,7 +53170,8 @@ const createServer = fn(function* () {
|
|
|
52970
53170
|
reason: "projectPolicy",
|
|
52971
53171
|
issues: [],
|
|
52972
53172
|
providers: providerStatuses,
|
|
52973
|
-
projectPolicy
|
|
53173
|
+
projectPolicy,
|
|
53174
|
+
generalChat: generalChatConfig
|
|
52974
53175
|
});
|
|
52975
53176
|
})).pipe(forkIn(subscriptionsScope));
|
|
52976
53177
|
yield* runForEach(keybindingsManager.streamChanges, (event) => gen(function* () {
|
|
@@ -52981,7 +53182,8 @@ const createServer = fn(function* () {
|
|
|
52981
53182
|
reason: "keybindings",
|
|
52982
53183
|
issues: event.issues,
|
|
52983
53184
|
providers: providerStatuses,
|
|
52984
|
-
projectPolicy
|
|
53185
|
+
projectPolicy,
|
|
53186
|
+
generalChat: generalChatConfig
|
|
52985
53187
|
});
|
|
52986
53188
|
})).pipe(forkIn(subscriptionsScope));
|
|
52987
53189
|
yield* provide$2(orchestrationReactor.start, subscriptionsScope);
|
|
@@ -53146,7 +53348,7 @@ const createServer = fn(function* () {
|
|
|
53146
53348
|
watchedGitStatusCwdsByClient.delete(client);
|
|
53147
53349
|
for (const cwd of watchedCwds) removeGitStatusWatcherSubscriber(client, cwd);
|
|
53148
53350
|
};
|
|
53149
|
-
yield* addFinalizer$1(sync(() => {
|
|
53351
|
+
yield* addFinalizer$1(() => sync(() => {
|
|
53150
53352
|
for (const watcher of watchedGitStatusesByCwd.values()) clearInterval(watcher.intervalId);
|
|
53151
53353
|
watchedGitStatusesByCwd.clear();
|
|
53152
53354
|
}));
|
|
@@ -53161,9 +53363,14 @@ const createServer = fn(function* () {
|
|
|
53161
53363
|
writeSettings: (settings) => writeAppSettings(settings),
|
|
53162
53364
|
isProEnabled: async () => (await licenseService.getStatus()).isPro
|
|
53163
53365
|
});
|
|
53164
|
-
|
|
53165
|
-
|
|
53166
|
-
|
|
53366
|
+
let telegramRuntimeSettingsQueue = Promise.resolve();
|
|
53367
|
+
const queueTelegramRuntimeSettingsApply = (settings) => {
|
|
53368
|
+
const applyTask = telegramRuntimeSettingsQueue.catch(() => void 0).then(async () => {
|
|
53369
|
+
await telegramBridge.applyRuntimeSettings(settings);
|
|
53370
|
+
});
|
|
53371
|
+
telegramRuntimeSettingsQueue = applyTask.catch(() => void 0);
|
|
53372
|
+
return applyTask;
|
|
53373
|
+
};
|
|
53167
53374
|
yield* addFinalizer$1(() => promise(() => telegramBridge.dispose()));
|
|
53168
53375
|
const refreshTray = () => {
|
|
53169
53376
|
sendDesktopParentMessage$1({ type: "t3-server:refresh-tray" });
|
|
@@ -53241,6 +53448,9 @@ const createServer = fn(function* () {
|
|
|
53241
53448
|
});
|
|
53242
53449
|
});
|
|
53243
53450
|
yield* readiness.markHttpListening;
|
|
53451
|
+
readResolvedTelegramRuntimeSettings().then((settings) => queueTelegramRuntimeSettingsApply(settings)).catch((error) => {
|
|
53452
|
+
logger.warn("Failed to apply Telegram runtime settings during startup", { error: error instanceof Error ? error.message : String(error) });
|
|
53453
|
+
});
|
|
53244
53454
|
yield* addFinalizer$1(() => all([
|
|
53245
53455
|
closeAllClients,
|
|
53246
53456
|
closeWebSocketServer.pipe(ignoreCause({ log: true })),
|
|
@@ -53269,6 +53479,13 @@ const createServer = fn(function* () {
|
|
|
53269
53479
|
catch: (cause) => new RouteRequestError({ message: `Failed to search workspace entries: ${String(cause)}` })
|
|
53270
53480
|
});
|
|
53271
53481
|
}
|
|
53482
|
+
case WS_METHODS.filesystemBrowse: {
|
|
53483
|
+
const body = stripRequestTag(request.body);
|
|
53484
|
+
return yield* tryPromise({
|
|
53485
|
+
try: () => browseFilesystemEntries(body),
|
|
53486
|
+
catch: (cause) => new RouteRequestError({ message: `Failed to browse filesystem entries: ${cause instanceof Error ? cause.message : String(cause)}` })
|
|
53487
|
+
});
|
|
53488
|
+
}
|
|
53272
53489
|
case WS_METHODS.projectsEnsure: {
|
|
53273
53490
|
const body = stripRequestTag(request.body);
|
|
53274
53491
|
const workspaceRoot = yield* normalizeProjectWorkspaceRoot(body.cwd);
|
|
@@ -53308,6 +53525,37 @@ const createServer = fn(function* () {
|
|
|
53308
53525
|
created: true
|
|
53309
53526
|
};
|
|
53310
53527
|
}
|
|
53528
|
+
case WS_METHODS.generalChatEnsure: {
|
|
53529
|
+
const workspaceRoot = yield* tryPromise({
|
|
53530
|
+
try: () => ensureGeneralChatWorkspaceArtifacts(),
|
|
53531
|
+
catch: (cause) => new RouteRequestError({ message: `Failed to prepare General Chat workspace: ${String(cause)}` })
|
|
53532
|
+
});
|
|
53533
|
+
const existingProject = findActiveProjectByCanonicalRoot((yield* projectionReadModelQuery.getSnapshot()).projects, workspaceRoot);
|
|
53534
|
+
if (existingProject) return {
|
|
53535
|
+
projectId: existingProject.id,
|
|
53536
|
+
workspaceRoot: existingProject.workspaceRoot,
|
|
53537
|
+
created: false
|
|
53538
|
+
};
|
|
53539
|
+
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
53540
|
+
const projectId = ProjectId.makeUnsafe(crypto.randomUUID());
|
|
53541
|
+
yield* orchestrationEngine.dispatch({
|
|
53542
|
+
type: "project.create",
|
|
53543
|
+
commandId: CommandId.makeUnsafe(crypto.randomUUID()),
|
|
53544
|
+
projectId,
|
|
53545
|
+
title: GENERAL_CHAT_PROJECT_TITLE,
|
|
53546
|
+
workspaceRoot,
|
|
53547
|
+
defaultModelSelection: {
|
|
53548
|
+
provider: "codex",
|
|
53549
|
+
model: DEFAULT_MODEL_BY_PROVIDER.codex
|
|
53550
|
+
},
|
|
53551
|
+
createdAt
|
|
53552
|
+
});
|
|
53553
|
+
return {
|
|
53554
|
+
projectId,
|
|
53555
|
+
workspaceRoot,
|
|
53556
|
+
created: true
|
|
53557
|
+
};
|
|
53558
|
+
}
|
|
53311
53559
|
case WS_METHODS.projectsWriteFile: {
|
|
53312
53560
|
const body = stripRequestTag(request.body);
|
|
53313
53561
|
const target = yield* resolveWorkspaceWritePath({
|
|
@@ -53361,7 +53609,10 @@ const createServer = fn(function* () {
|
|
|
53361
53609
|
}
|
|
53362
53610
|
case WS_METHODS.gitCreateWorktree: {
|
|
53363
53611
|
const body = stripRequestTag(request.body);
|
|
53364
|
-
|
|
53612
|
+
const result = yield* git.createWorktree(body);
|
|
53613
|
+
yield* promise(() => scheduleWatchedGitStatusRefresh(body.cwd));
|
|
53614
|
+
yield* promise(() => scheduleWatchedGitStatusRefresh(result.worktree.path));
|
|
53615
|
+
return result;
|
|
53365
53616
|
}
|
|
53366
53617
|
case WS_METHODS.gitRemoveWorktree: {
|
|
53367
53618
|
const body = stripRequestTag(request.body);
|
|
@@ -53369,11 +53620,15 @@ const createServer = fn(function* () {
|
|
|
53369
53620
|
}
|
|
53370
53621
|
case WS_METHODS.gitCreateBranch: {
|
|
53371
53622
|
const body = stripRequestTag(request.body);
|
|
53372
|
-
|
|
53623
|
+
const result = yield* git.createBranch(body);
|
|
53624
|
+
yield* promise(() => scheduleWatchedGitStatusRefresh(body.cwd));
|
|
53625
|
+
return result;
|
|
53373
53626
|
}
|
|
53374
53627
|
case WS_METHODS.gitCheckout: {
|
|
53375
53628
|
const body = stripRequestTag(request.body);
|
|
53376
|
-
|
|
53629
|
+
const result = yield* scoped(git.checkoutBranch(body));
|
|
53630
|
+
yield* promise(() => scheduleWatchedGitStatusRefresh(body.cwd));
|
|
53631
|
+
return result;
|
|
53377
53632
|
}
|
|
53378
53633
|
case WS_METHODS.gitInit: {
|
|
53379
53634
|
const body = stripRequestTag(request.body);
|
|
@@ -53414,7 +53669,8 @@ const createServer = fn(function* () {
|
|
|
53414
53669
|
issues: keybindingsConfig.issues,
|
|
53415
53670
|
providers,
|
|
53416
53671
|
availableEditors,
|
|
53417
|
-
projectPolicy
|
|
53672
|
+
projectPolicy,
|
|
53673
|
+
generalChat: generalChatConfig
|
|
53418
53674
|
};
|
|
53419
53675
|
}
|
|
53420
53676
|
case WS_METHODS.serverRefreshProviders: {
|
|
@@ -53446,7 +53702,7 @@ const createServer = fn(function* () {
|
|
|
53446
53702
|
const body = stripRequestTag(request.body);
|
|
53447
53703
|
return yield* promise(async () => {
|
|
53448
53704
|
return await writeAppSettings(await sanitizeAccountPoolSettingsForLicense(body.settings), async (updatedSettings) => {
|
|
53449
|
-
await
|
|
53705
|
+
await queueTelegramRuntimeSettingsApply(resolveTelegramRuntimeSettings(updatedSettings));
|
|
53450
53706
|
});
|
|
53451
53707
|
});
|
|
53452
53708
|
}
|