@moxt-ai/mobius 0.0.77 → 0.0.78
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/acp/codex/agent.d.ts.map +1 -1
- package/dist/acp/codex/agent.js +111 -4
- package/dist/acp/codex/agent.js.map +1 -1
- package/dist/acp/codex/app-server-client.d.ts.map +1 -1
- package/dist/acp/codex/app-server-client.js +4 -1
- package/dist/acp/codex/app-server-client.js.map +1 -1
- package/dist/acp/codex/app-server-protocol.d.ts +11 -0
- package/dist/acp/codex/app-server-protocol.d.ts.map +1 -1
- package/dist/acp/codex/app-server-protocol.js +13 -0
- package/dist/acp/codex/app-server-protocol.js.map +1 -1
- package/dist/cli.js +120 -5
- package/dist/cli.js.map +2 -2
- package/dist/index.js +119 -4
- package/dist/index.js.map +2 -2
- package/dist/runtime.js +119 -4
- package/dist/runtime.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34968,6 +34968,14 @@ var modelListResponseSchema = external_exports.object({
|
|
|
34968
34968
|
data: external_exports.array(modelSchema).max(1e3),
|
|
34969
34969
|
nextCursor: boundedText(1024).nullish()
|
|
34970
34970
|
});
|
|
34971
|
+
var threadSettingsUpdatedSchema = external_exports.object({
|
|
34972
|
+
threadId: boundedText(256),
|
|
34973
|
+
threadSettings: external_exports.object({
|
|
34974
|
+
collaborationMode: external_exports.object({
|
|
34975
|
+
mode: external_exports.enum(["default", "plan"])
|
|
34976
|
+
}).nullish()
|
|
34977
|
+
})
|
|
34978
|
+
});
|
|
34971
34979
|
|
|
34972
34980
|
// src/acp/codex/app-server-client.ts
|
|
34973
34981
|
var INITIALIZE_TIMEOUT_MILLISECONDS = 3e4;
|
|
@@ -35152,7 +35160,10 @@ var CodexAppServerClient = class {
|
|
|
35152
35160
|
initialize = async (signal) => {
|
|
35153
35161
|
await this.request(
|
|
35154
35162
|
"initialize",
|
|
35155
|
-
{
|
|
35163
|
+
{
|
|
35164
|
+
capabilities: { experimentalApi: true },
|
|
35165
|
+
clientInfo: { name: "mobius", version: "1.0.0" }
|
|
35166
|
+
},
|
|
35156
35167
|
AbortSignal.any([signal, AbortSignal.timeout(INITIALIZE_TIMEOUT_MILLISECONDS)])
|
|
35157
35168
|
);
|
|
35158
35169
|
this.notify("initialized", void 0);
|
|
@@ -35312,6 +35323,7 @@ var MODEL_SETTING_ID = "model";
|
|
|
35312
35323
|
var REASONING_EFFORT_SETTING_ID = "reasoning_effort";
|
|
35313
35324
|
var MODE_SETTING_ID = "mode";
|
|
35314
35325
|
var FAST_MODE_SETTING_ID = "fast-mode";
|
|
35326
|
+
var COLLABORATION_MODE_SETTING_ID = "collaboration_mode";
|
|
35315
35327
|
var MODEL_CATALOG_LIMIT = 1e3;
|
|
35316
35328
|
var FAST_TIER = "fast";
|
|
35317
35329
|
var SERVICE_TIER_FAST = "priority";
|
|
@@ -35441,6 +35453,22 @@ function modeSetting(currentValue) {
|
|
|
35441
35453
|
type: "select"
|
|
35442
35454
|
};
|
|
35443
35455
|
}
|
|
35456
|
+
var COLLABORATION_MODES = Object.freeze([
|
|
35457
|
+
{ description: "Codex answers and makes changes directly", name: "Build", value: "default" },
|
|
35458
|
+
{ description: "Codex plans before making changes", name: "Plan", value: "plan" }
|
|
35459
|
+
]);
|
|
35460
|
+
function collaborationModeSetting(currentValue) {
|
|
35461
|
+
const current = COLLABORATION_MODES.some((mode) => mode.value === currentValue) ? currentValue : COLLABORATION_MODES[0]?.value ?? "default";
|
|
35462
|
+
return {
|
|
35463
|
+
category: "collaboration_mode",
|
|
35464
|
+
currentValue: current,
|
|
35465
|
+
description: "How Codex collaborates for subsequent turns",
|
|
35466
|
+
id: COLLABORATION_MODE_SETTING_ID,
|
|
35467
|
+
name: "Collaboration mode",
|
|
35468
|
+
options: [...COLLABORATION_MODES],
|
|
35469
|
+
type: "select"
|
|
35470
|
+
};
|
|
35471
|
+
}
|
|
35444
35472
|
function fastModeSetting(model, enabled) {
|
|
35445
35473
|
if (model?.additionalSpeedTiers?.includes(FAST_TIER) !== true) {
|
|
35446
35474
|
return null;
|
|
@@ -35502,11 +35530,19 @@ var CodexAcpAgent = class {
|
|
|
35502
35530
|
// Whether the current turn must carry a policy at all. Until the user picks a mode, Codex's own
|
|
35503
35531
|
// configuration decides, so `turn/start` omits the fields and inherits what the host set up.
|
|
35504
35532
|
#policySelected = false;
|
|
35533
|
+
// Whether a collaboration mode choice has been made in this session. A restored thread keeps
|
|
35534
|
+
// the mode Codex already persisted, so the first turn does not reset it to Build.
|
|
35535
|
+
#collaborationModeSelected = false;
|
|
35536
|
+
// Whether the app-server accepts collaboration mode on `turn/start`, probed once per
|
|
35537
|
+
// app-server. An older Codex rejects the experimental field, and the setting must disappear
|
|
35538
|
+
// rather than break every turn.
|
|
35539
|
+
#collaborationModeSupported = null;
|
|
35505
35540
|
#selection;
|
|
35506
35541
|
#turn = null;
|
|
35507
35542
|
#updateTail = Promise.resolve();
|
|
35508
35543
|
constructor(options) {
|
|
35509
35544
|
this.#selection = {
|
|
35545
|
+
collaborationMode: "default",
|
|
35510
35546
|
effort: "",
|
|
35511
35547
|
fastMode: false,
|
|
35512
35548
|
mode: initialMode(options.environment),
|
|
@@ -35547,9 +35583,12 @@ var CodexAcpAgent = class {
|
|
|
35547
35583
|
this.#nativeSessionId = created.thread.id;
|
|
35548
35584
|
this.#selection = {
|
|
35549
35585
|
...this.#selection,
|
|
35586
|
+
collaborationMode: "default",
|
|
35550
35587
|
effort: created.reasoningEffort ?? "",
|
|
35551
35588
|
model: created.model ?? ""
|
|
35552
35589
|
};
|
|
35590
|
+
this.#collaborationModeSelected = false;
|
|
35591
|
+
await this.#probeCollaborationMode(context.signal);
|
|
35553
35592
|
return { configOptions: this.#configOptions(), sessionId: created.thread.id };
|
|
35554
35593
|
}).onRequest(methods4.agent.session.setConfigOption, async (context) => {
|
|
35555
35594
|
this.#applySelection(context.params.configId, context.params.value);
|
|
@@ -35566,8 +35605,9 @@ var CodexAcpAgent = class {
|
|
|
35566
35605
|
)
|
|
35567
35606
|
);
|
|
35568
35607
|
this.#selectRestoredThread(resumed);
|
|
35608
|
+
await this.#probeCollaborationMode(context.signal);
|
|
35569
35609
|
await this.#replayHistory(resumed.turns);
|
|
35570
|
-
return {};
|
|
35610
|
+
return { configOptions: this.#configOptions() };
|
|
35571
35611
|
}).onRequest(methods4.agent.session.fork, async (context) => {
|
|
35572
35612
|
const forked = threadForkResponseSchema.parse(
|
|
35573
35613
|
await this.#appServer.request(
|
|
@@ -35581,8 +35621,9 @@ var CodexAcpAgent = class {
|
|
|
35581
35621
|
)
|
|
35582
35622
|
);
|
|
35583
35623
|
this.#selectRestoredThread(forked);
|
|
35624
|
+
await this.#probeCollaborationMode(context.signal);
|
|
35584
35625
|
await this.#replayHistory(forked.turns);
|
|
35585
|
-
return { sessionId: forked.thread.id };
|
|
35626
|
+
return { configOptions: this.#configOptions(), sessionId: forked.thread.id };
|
|
35586
35627
|
}).onRequest(methods4.agent.session.resume, async (context) => {
|
|
35587
35628
|
const resumed = threadResumeResponseSchema.parse(
|
|
35588
35629
|
await this.#appServer.request(
|
|
@@ -35592,7 +35633,8 @@ var CodexAcpAgent = class {
|
|
|
35592
35633
|
)
|
|
35593
35634
|
);
|
|
35594
35635
|
this.#selectRestoredThread(resumed);
|
|
35595
|
-
|
|
35636
|
+
await this.#probeCollaborationMode(context.signal);
|
|
35637
|
+
return { configOptions: this.#configOptions() };
|
|
35596
35638
|
}).onRequest(methods4.agent.session.prompt, async (context) => {
|
|
35597
35639
|
return await this.#runTurn(promptInput(context.params.prompt), context.signal);
|
|
35598
35640
|
}).onRequest(methods4.agent.session.list, async (context) => {
|
|
@@ -35664,6 +35706,27 @@ var CodexAcpAgent = class {
|
|
|
35664
35706
|
this.#models = Object.freeze(models.slice(0, MODEL_CATALOG_LIMIT));
|
|
35665
35707
|
};
|
|
35666
35708
|
#model = (id) => this.#models.find((model) => model.id === id);
|
|
35709
|
+
/**
|
|
35710
|
+
* Learns, once per app-server, whether collaboration mode can be applied. An empty settings
|
|
35711
|
+
* update is a no-op on a supporting Codex; an older Codex answers an error, which costs the
|
|
35712
|
+
* Build/Plan selector alone without changing a restored thread's persisted mode.
|
|
35713
|
+
*/
|
|
35714
|
+
#probeCollaborationMode = async (signal) => {
|
|
35715
|
+
if (this.#collaborationModeSupported !== null) {
|
|
35716
|
+
return;
|
|
35717
|
+
}
|
|
35718
|
+
try {
|
|
35719
|
+
await this.#appServer.request(
|
|
35720
|
+
"thread/settings/update",
|
|
35721
|
+
{ threadId: this.#nativeSessionId },
|
|
35722
|
+
AbortSignal.any([signal, AbortSignal.timeout(APPROVAL_TIMEOUT_MILLISECONDS)])
|
|
35723
|
+
);
|
|
35724
|
+
this.#collaborationModeSupported = true;
|
|
35725
|
+
} catch {
|
|
35726
|
+
signal.throwIfAborted();
|
|
35727
|
+
this.#collaborationModeSupported = false;
|
|
35728
|
+
}
|
|
35729
|
+
};
|
|
35667
35730
|
/** The ACP settings Mobius discovers and renders in Run settings. */
|
|
35668
35731
|
#configOptions = () => {
|
|
35669
35732
|
const options = [];
|
|
@@ -35679,6 +35742,9 @@ var CodexAcpAgent = class {
|
|
|
35679
35742
|
if (fastMode !== null) {
|
|
35680
35743
|
options.push(fastMode);
|
|
35681
35744
|
}
|
|
35745
|
+
if (this.#collaborationModeSupported === true) {
|
|
35746
|
+
options.push(collaborationModeSetting(this.#selection.collaborationMode));
|
|
35747
|
+
}
|
|
35682
35748
|
options.push(modeSetting(this.#selection.mode));
|
|
35683
35749
|
return options;
|
|
35684
35750
|
};
|
|
@@ -35771,6 +35837,18 @@ var CodexAcpAgent = class {
|
|
|
35771
35837
|
this.#policySelected = true;
|
|
35772
35838
|
return;
|
|
35773
35839
|
}
|
|
35840
|
+
if (configId === COLLABORATION_MODE_SETTING_ID) {
|
|
35841
|
+
if (!COLLABORATION_MODES.some((mode) => mode.value === value)) {
|
|
35842
|
+
throw new AcpExecutionError(
|
|
35843
|
+
"The requested Codex collaboration mode is unavailable",
|
|
35844
|
+
{},
|
|
35845
|
+
"invalid_session_configuration"
|
|
35846
|
+
);
|
|
35847
|
+
}
|
|
35848
|
+
this.#selection = { ...this.#selection, collaborationMode: value };
|
|
35849
|
+
this.#collaborationModeSelected = true;
|
|
35850
|
+
return;
|
|
35851
|
+
}
|
|
35774
35852
|
if (configId === MODEL_SETTING_ID) {
|
|
35775
35853
|
if (value === this.#selection.model) {
|
|
35776
35854
|
return;
|
|
@@ -35819,6 +35897,17 @@ var CodexAcpAgent = class {
|
|
|
35819
35897
|
update
|
|
35820
35898
|
});
|
|
35821
35899
|
};
|
|
35900
|
+
/** Pushes the current settings so a mode change Codex applied reaches the Run settings panel. */
|
|
35901
|
+
#emitConfigOptionsUpdate = async () => {
|
|
35902
|
+
const connection = this.#connection;
|
|
35903
|
+
if (connection === null || this.#nativeSessionId.length === 0) {
|
|
35904
|
+
return;
|
|
35905
|
+
}
|
|
35906
|
+
await connection.client.notify(methods4.client.session.update, {
|
|
35907
|
+
sessionId: this.#nativeSessionId,
|
|
35908
|
+
update: { configOptions: this.#configOptions(), sessionUpdate: "config_option_update" }
|
|
35909
|
+
});
|
|
35910
|
+
};
|
|
35822
35911
|
// Notifications are serialized so two app-server items cannot interleave into one ACP update
|
|
35823
35912
|
// stream, and the caller awaits the result: `turn/completed` must not resolve the prompt before
|
|
35824
35913
|
// the updates it precedes have reached the client.
|
|
@@ -35851,6 +35940,19 @@ var CodexAcpAgent = class {
|
|
|
35851
35940
|
}
|
|
35852
35941
|
return;
|
|
35853
35942
|
}
|
|
35943
|
+
if (method === "thread/settings/updated") {
|
|
35944
|
+
const decoded = threadSettingsUpdatedSchema.safeParse(params);
|
|
35945
|
+
if (decoded.success && decoded.data.threadId === this.#nativeSessionId) {
|
|
35946
|
+
const mode = decoded.data.threadSettings.collaborationMode?.mode;
|
|
35947
|
+
if (mode !== void 0 && mode !== this.#selection.collaborationMode) {
|
|
35948
|
+
this.#selection = { ...this.#selection, collaborationMode: mode };
|
|
35949
|
+
await this.#enqueue(async () => {
|
|
35950
|
+
await this.#emitConfigOptionsUpdate();
|
|
35951
|
+
});
|
|
35952
|
+
}
|
|
35953
|
+
}
|
|
35954
|
+
return;
|
|
35955
|
+
}
|
|
35854
35956
|
if (method === "turn/plan/updated") {
|
|
35855
35957
|
const plan = params.plan;
|
|
35856
35958
|
if (Array.isArray(plan) && params.threadId === this.#nativeSessionId) {
|
|
@@ -36029,6 +36131,19 @@ var CodexAcpAgent = class {
|
|
|
36029
36131
|
approvalsReviewer: mode.approvalsReviewer,
|
|
36030
36132
|
sandboxPolicy: mode.sandboxPolicy
|
|
36031
36133
|
} : {},
|
|
36134
|
+
// The collaboration mode rides on the turn: Codex applies it to the
|
|
36135
|
+
// thread, where it persists until changed. "Build" is Codex's `default`
|
|
36136
|
+
// mode, so it is only sent once a choice exists to apply.
|
|
36137
|
+
...this.#collaborationModeSupported && (selection.collaborationMode !== "default" || this.#collaborationModeSelected) ? {
|
|
36138
|
+
collaborationMode: {
|
|
36139
|
+
mode: selection.collaborationMode,
|
|
36140
|
+
settings: {
|
|
36141
|
+
developer_instructions: null,
|
|
36142
|
+
model: selection.model,
|
|
36143
|
+
reasoning_effort: selection.effort.length === 0 ? null : selection.effort
|
|
36144
|
+
}
|
|
36145
|
+
}
|
|
36146
|
+
} : {},
|
|
36032
36147
|
...selection.effort.length === 0 ? {} : { effort: selection.effort },
|
|
36033
36148
|
input: input2,
|
|
36034
36149
|
...selection.model.length === 0 ? {} : { model: selection.model },
|