lody 0.66.0 → 0.67.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.
@@ -0,0 +1,283 @@
1
+ import { createRequire } from "module";
2
+ createRequire(import.meta.url);
3
+ var MODE_CONFIG_ID = "mode";
4
+ var AgentMode = class _AgentMode {
5
+ id;
6
+ name;
7
+ description;
8
+ approvalPolicy;
9
+ sandboxPolicy;
10
+ sandboxMode;
11
+ constructor(id, name, description, approval, sandbox, sandboxMode) {
12
+ this.id = id;
13
+ this.name = name;
14
+ this.description = description;
15
+ this.approvalPolicy = approval;
16
+ this.sandboxPolicy = sandbox;
17
+ this.sandboxMode = sandboxMode;
18
+ }
19
+ static ReadOnly = new _AgentMode(
20
+ "read-only",
21
+ "Read-only",
22
+ "Requires approval to edit files and run commands.",
23
+ "on-request",
24
+ {
25
+ "type": "readOnly",
26
+ "networkAccess": false
27
+ },
28
+ "read-only"
29
+ );
30
+ static Agent = new _AgentMode(
31
+ "agent",
32
+ "Agent",
33
+ "Read and edit files, and run commands.",
34
+ "on-request",
35
+ {
36
+ type: "workspaceWrite",
37
+ writableRoots: [],
38
+ networkAccess: false,
39
+ excludeTmpdirEnvVar: false,
40
+ excludeSlashTmp: false
41
+ },
42
+ "workspace-write"
43
+ );
44
+ static AgentFullAccess = new _AgentMode(
45
+ "agent-full-access",
46
+ "Agent (full access)",
47
+ "Codex can edit files outside this workspace and run commands with network access. Exercise caution when using.",
48
+ "never",
49
+ { "type": "dangerFullAccess" },
50
+ "danger-full-access"
51
+ );
52
+ static DEFAULT_AGENT_MODE = _AgentMode.Agent;
53
+ toSessionMode() {
54
+ return {
55
+ id: this.id,
56
+ name: this.name,
57
+ description: this.description
58
+ };
59
+ }
60
+ toSessionModeState() {
61
+ return {
62
+ availableModes: _AgentMode.all().map((mode) => mode.toSessionMode()),
63
+ currentModeId: this.id
64
+ };
65
+ }
66
+ toConfigOption() {
67
+ return {
68
+ id: MODE_CONFIG_ID,
69
+ name: "Mode",
70
+ description: "Approval and sandboxing preset for the session",
71
+ category: "mode",
72
+ type: "select",
73
+ currentValue: this.id,
74
+ options: _AgentMode.all().map((mode) => ({
75
+ value: mode.id,
76
+ name: mode.name,
77
+ description: mode.description
78
+ }))
79
+ };
80
+ }
81
+ static all() {
82
+ return [_AgentMode.ReadOnly, _AgentMode.Agent, _AgentMode.AgentFullAccess];
83
+ }
84
+ static find(modeId) {
85
+ const match = _AgentMode.all().find((m) => m.id === modeId);
86
+ return match ?? null;
87
+ }
88
+ static getInitialAgentMode() {
89
+ const predefinedAgentMode = process.env["INITIAL_AGENT_MODE"];
90
+ if (predefinedAgentMode) {
91
+ return _AgentMode.find(predefinedAgentMode) ?? _AgentMode.DEFAULT_AGENT_MODE;
92
+ } else {
93
+ return _AgentMode.DEFAULT_AGENT_MODE;
94
+ }
95
+ }
96
+ };
97
+ var FAST_MODE_CONFIG_ID = "fast-mode";
98
+ var FAST_MODE_ON = "on";
99
+ var FAST_MODE_OFF = "off";
100
+ var FAST_MODE_DESCRIPTION = "1.5x speed, increased usage";
101
+ function createFastModeConfigOption(fastModeEnabled) {
102
+ return {
103
+ id: FAST_MODE_CONFIG_ID,
104
+ name: "Fast mode",
105
+ description: FAST_MODE_DESCRIPTION,
106
+ category: FAST_MODE_CONFIG_ID,
107
+ type: "select",
108
+ currentValue: fastModeEnabled ? FAST_MODE_ON : FAST_MODE_OFF,
109
+ options: [
110
+ {
111
+ value: FAST_MODE_OFF,
112
+ name: "Off",
113
+ description: "Default speed, normal usage"
114
+ },
115
+ {
116
+ value: FAST_MODE_ON,
117
+ name: "On",
118
+ description: FAST_MODE_DESCRIPTION
119
+ }
120
+ ]
121
+ };
122
+ }
123
+ var MODEL_CONFIG_ID = "model";
124
+ var REASONING_EFFORT_CONFIG_ID = "reasoning_effort";
125
+ function createModelConfigOption(availableModels, currentBaseModelId) {
126
+ return {
127
+ id: MODEL_CONFIG_ID,
128
+ name: "Model",
129
+ description: "Model Codex uses for the session",
130
+ category: "model",
131
+ type: "select",
132
+ currentValue: currentBaseModelId,
133
+ options: availableModels.map((model) => ({
134
+ value: model.id,
135
+ name: model.displayName,
136
+ description: model.description
137
+ }))
138
+ };
139
+ }
140
+ function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEffort) {
141
+ return {
142
+ id: REASONING_EFFORT_CONFIG_ID,
143
+ name: "Reasoning effort",
144
+ description: "How much reasoning effort the model should use",
145
+ category: "thought_level",
146
+ type: "select",
147
+ currentValue: currentEffort,
148
+ options: supportedReasoningEfforts.map((option) => ({
149
+ value: option.reasoningEffort,
150
+ name: option.reasoningEffort,
151
+ description: option.description
152
+ }))
153
+ };
154
+ }
155
+ var PLAN_MODE_CONFIG_ID = "plan-mode";
156
+ var PLAN_MODE_ON = "on";
157
+ var PLAN_MODE_OFF = "off";
158
+ var PLAN_MODE_DESCRIPTION = "Plan without modifying files; switch off to implement the approved plan";
159
+ function createPlanModeConfigOption(planModeEnabled) {
160
+ return {
161
+ id: PLAN_MODE_CONFIG_ID,
162
+ name: "Plan mode",
163
+ description: PLAN_MODE_DESCRIPTION,
164
+ category: PLAN_MODE_CONFIG_ID,
165
+ type: "select",
166
+ currentValue: planModeEnabled ? PLAN_MODE_ON : PLAN_MODE_OFF,
167
+ options: [
168
+ {
169
+ value: PLAN_MODE_OFF,
170
+ name: "Off",
171
+ description: "Implement changes normally"
172
+ },
173
+ {
174
+ value: PLAN_MODE_ON,
175
+ name: "On",
176
+ description: PLAN_MODE_DESCRIPTION
177
+ }
178
+ ]
179
+ };
180
+ }
181
+ var BASELINE_REASONING_EFFORTS = [
182
+ { reasoningEffort: "low", description: "Fastest responses" },
183
+ { reasoningEffort: "medium", description: "Balanced reasoning" },
184
+ { reasoningEffort: "high", description: "More reasoning for difficult tasks" },
185
+ { reasoningEffort: "xhigh", description: "Extra reasoning for complex tasks" }
186
+ ];
187
+ var BASELINE_MODELS = [
188
+ {
189
+ id: "gpt-5.5",
190
+ model: "gpt-5.5",
191
+ upgrade: null,
192
+ upgradeInfo: null,
193
+ availabilityNux: null,
194
+ displayName: "gpt-5.5",
195
+ description: "Latest frontier Codex model",
196
+ hidden: false,
197
+ supportedReasoningEfforts: BASELINE_REASONING_EFFORTS,
198
+ defaultReasoningEffort: "medium",
199
+ inputModalities: ["text", "image"],
200
+ supportsPersonality: false,
201
+ additionalSpeedTiers: ["fast"],
202
+ serviceTiers: [],
203
+ defaultServiceTier: null,
204
+ isDefault: true
205
+ },
206
+ {
207
+ id: "gpt-5.4",
208
+ model: "gpt-5.4",
209
+ upgrade: null,
210
+ upgradeInfo: null,
211
+ availabilityNux: null,
212
+ displayName: "gpt-5.4",
213
+ description: "Frontier Codex model",
214
+ hidden: false,
215
+ supportedReasoningEfforts: BASELINE_REASONING_EFFORTS,
216
+ defaultReasoningEffort: "medium",
217
+ inputModalities: ["text", "image"],
218
+ supportsPersonality: false,
219
+ additionalSpeedTiers: ["fast"],
220
+ serviceTiers: [],
221
+ defaultServiceTier: null,
222
+ isDefault: false
223
+ },
224
+ {
225
+ id: "gpt-5.4-mini",
226
+ model: "gpt-5.4-mini",
227
+ upgrade: null,
228
+ upgradeInfo: null,
229
+ availabilityNux: null,
230
+ displayName: "gpt-5.4-mini",
231
+ description: "Smaller, faster Codex model",
232
+ hidden: false,
233
+ supportedReasoningEfforts: BASELINE_REASONING_EFFORTS,
234
+ defaultReasoningEffort: "medium",
235
+ inputModalities: ["text", "image"],
236
+ supportsPersonality: false,
237
+ additionalSpeedTiers: ["fast"],
238
+ serviceTiers: [],
239
+ defaultServiceTier: null,
240
+ isDefault: false
241
+ }
242
+ ];
243
+ function getDefaultBaselineModel() {
244
+ const model = BASELINE_MODELS.find((candidate) => candidate.isDefault) ?? BASELINE_MODELS[0];
245
+ if (!model) {
246
+ throw new Error("Codex baseline config requires at least one model");
247
+ }
248
+ return model;
249
+ }
250
+ function getCodexBaselineConfig() {
251
+ const defaultModel = getDefaultBaselineModel();
252
+ return {
253
+ modes: AgentMode.all().map((mode) => {
254
+ const sessionMode = mode.toSessionMode();
255
+ const result = {
256
+ id: sessionMode.id,
257
+ name: sessionMode.name
258
+ };
259
+ if (sessionMode.description !== null && sessionMode.description !== void 0) {
260
+ result.description = sessionMode.description;
261
+ }
262
+ return result;
263
+ }),
264
+ models: BASELINE_MODELS.map((model) => ({
265
+ modelId: model.id,
266
+ name: model.displayName,
267
+ description: model.description
268
+ })),
269
+ configOptions: [
270
+ AgentMode.DEFAULT_AGENT_MODE.toConfigOption(),
271
+ createModelConfigOption(BASELINE_MODELS, defaultModel.id),
272
+ createReasoningEffortConfigOption(
273
+ defaultModel.supportedReasoningEfforts,
274
+ defaultModel.defaultReasoningEffort
275
+ ),
276
+ createFastModeConfigOption(false),
277
+ createPlanModeConfigOption(false)
278
+ ]
279
+ };
280
+ }
281
+ export {
282
+ getCodexBaselineConfig
283
+ };
@@ -0,0 +1,245 @@
1
+ const CLAUDE_BASELINE_MODEL_INFOS = [
2
+ {
3
+ value: "default",
4
+ displayName: "Default",
5
+ description: "Claude Code default model",
6
+ supportsEffort: true,
7
+ supportedEffortLevels: ["low", "medium", "high"],
8
+ supportsAutoMode: true
9
+ },
10
+ {
11
+ value: "opus",
12
+ displayName: "Opus",
13
+ description: "Claude Opus",
14
+ supportsEffort: true,
15
+ supportedEffortLevels: ["low", "medium", "high"],
16
+ supportsAutoMode: true
17
+ },
18
+ {
19
+ value: "sonnet",
20
+ displayName: "Sonnet",
21
+ description: "Claude Sonnet",
22
+ supportsEffort: true,
23
+ supportedEffortLevels: ["low", "medium", "high"],
24
+ supportsAutoMode: true,
25
+ supportsFastMode: true
26
+ },
27
+ {
28
+ value: "haiku",
29
+ displayName: "Haiku",
30
+ description: "Claude Haiku",
31
+ supportsEffort: true,
32
+ supportedEffortLevels: ["low", "medium", "high"],
33
+ supportsFastMode: true
34
+ }
35
+ ];
36
+ const BUILTIN_AGENT_NAMES = /* @__PURE__ */ new Set([
37
+ "claude",
38
+ "general-purpose",
39
+ "Explore",
40
+ "Plan",
41
+ "statusline-setup"
42
+ ]);
43
+ const DEFAULT_AGENT_ID = "default";
44
+ const MODE_CONFIG_ID = "mode";
45
+ const MODEL_CONFIG_ID = "model";
46
+ const EFFORT_CONFIG_ID = "effort";
47
+ const AGENT_CONFIG_ID = "agent";
48
+ const FAST_MODE_CONFIG_ID = "fast";
49
+ const FAST_MODE_ON = "on";
50
+ const FAST_MODE_OFF = "off";
51
+ const FAST_MODE_DESCRIPTION = "Faster responses on supported models";
52
+ function buildAvailableModes(modelInfo, options = {}) {
53
+ const modes = [];
54
+ if (modelInfo?.supportsAutoMode === true) {
55
+ modes.push({
56
+ id: "auto",
57
+ name: "Auto",
58
+ description: "Use a model classifier to approve/deny permission prompts"
59
+ });
60
+ }
61
+ modes.push({
62
+ id: "default",
63
+ name: "Default",
64
+ description: "Standard behavior, prompts for dangerous operations"
65
+ }, {
66
+ id: "acceptEdits",
67
+ name: "Accept Edits",
68
+ description: "Auto-accept file edit operations"
69
+ }, {
70
+ id: "plan",
71
+ name: "Plan Mode",
72
+ description: "Planning mode, no actual tool execution"
73
+ }, {
74
+ id: "dontAsk",
75
+ name: "Don't Ask",
76
+ description: "Don't prompt for permissions, deny if not pre-approved"
77
+ });
78
+ if (options.allowBypass === true) {
79
+ modes.push({
80
+ id: "bypassPermissions",
81
+ name: "Bypass Permissions",
82
+ description: "Bypass all permission checks"
83
+ });
84
+ }
85
+ return modes;
86
+ }
87
+ function fastModeStateEnabled(state) {
88
+ return state !== "off";
89
+ }
90
+ function clientSupportsBooleanConfigOptions(clientCapabilities) {
91
+ return clientCapabilities?.session?.configOptions?.boolean != null;
92
+ }
93
+ function createFastModeConfigOption(enabled, useBooleanOption) {
94
+ const base = {
95
+ id: FAST_MODE_CONFIG_ID,
96
+ name: "Fast mode",
97
+ description: FAST_MODE_DESCRIPTION,
98
+ category: "model_config"
99
+ };
100
+ if (useBooleanOption) {
101
+ return { ...base, type: "boolean", currentValue: enabled };
102
+ }
103
+ return {
104
+ ...base,
105
+ type: "select",
106
+ currentValue: enabled ? FAST_MODE_ON : FAST_MODE_OFF,
107
+ options: [
108
+ { value: FAST_MODE_ON, name: "On" },
109
+ { value: FAST_MODE_OFF, name: "Off" }
110
+ ]
111
+ };
112
+ }
113
+ function resolveFastModeEnabled(params) {
114
+ const value = params.value;
115
+ if (typeof value === "boolean") {
116
+ return value;
117
+ }
118
+ if (value === FAST_MODE_ON) {
119
+ return true;
120
+ }
121
+ if (value === FAST_MODE_OFF) {
122
+ return false;
123
+ }
124
+ throw new Error(`Invalid value for config option ${FAST_MODE_CONFIG_ID}: ${value}`);
125
+ }
126
+ function buildConfigOptions(modes, models, modelInfos, currentEffortLevel, agents = [], currentAgent = DEFAULT_AGENT_ID, fastMode) {
127
+ const options = [
128
+ {
129
+ id: MODE_CONFIG_ID,
130
+ name: "Mode",
131
+ description: "Session permission mode",
132
+ category: "mode",
133
+ type: "select",
134
+ currentValue: modes.currentModeId,
135
+ options: modes.availableModes.map((mode) => ({
136
+ value: mode.id,
137
+ name: mode.name,
138
+ description: mode.description
139
+ }))
140
+ },
141
+ {
142
+ id: MODEL_CONFIG_ID,
143
+ name: "Model",
144
+ description: "AI model to use",
145
+ category: "model",
146
+ type: "select",
147
+ currentValue: models.currentModelId,
148
+ options: models.availableModels.map((model) => ({
149
+ value: model.modelId,
150
+ name: model.name,
151
+ description: model.description ?? void 0
152
+ }))
153
+ }
154
+ ];
155
+ const currentModelInfo = modelInfos.find((model) => model.value === models.currentModelId);
156
+ const supportedLevels = currentModelInfo?.supportsEffort ? currentModelInfo.supportedEffortLevels ?? [] : [];
157
+ if (supportedLevels.length > 0) {
158
+ const effortOptions = [
159
+ { value: "default", name: "Default" },
160
+ ...supportedLevels.map((level) => ({
161
+ value: level,
162
+ name: level.split(/[_-]/).map((part) => part ? part.charAt(0).toUpperCase() + part.slice(1) : part).join(" ")
163
+ }))
164
+ ];
165
+ const includes = (level) => level === "default" || supportedLevels.includes(level);
166
+ const validEffort = currentEffortLevel && includes(currentEffortLevel) ? currentEffortLevel : "default";
167
+ options.push({
168
+ id: EFFORT_CONFIG_ID,
169
+ name: "Effort",
170
+ description: "Available effort levels for this model",
171
+ category: "thought_level",
172
+ type: "select",
173
+ currentValue: validEffort,
174
+ options: effortOptions
175
+ });
176
+ }
177
+ if (fastMode?.supported) {
178
+ options.push(createFastModeConfigOption(fastMode.enabled, fastMode.useBooleanOption));
179
+ }
180
+ if (agents.length > 0) {
181
+ options.push({
182
+ id: AGENT_CONFIG_ID,
183
+ name: "Agent",
184
+ description: "Main-thread agent persona",
185
+ type: "select",
186
+ currentValue: currentAgent,
187
+ options: [
188
+ { value: DEFAULT_AGENT_ID, name: "Default", description: "Standard Claude Code agent" },
189
+ ...agents.map((agent) => ({
190
+ value: agent.name,
191
+ name: agent.name,
192
+ description: agent.description || void 0
193
+ }))
194
+ ]
195
+ });
196
+ }
197
+ return options;
198
+ }
199
+ function getClaudeBaselineConfig() {
200
+ const currentModelId = "default";
201
+ const currentModelInfo = CLAUDE_BASELINE_MODEL_INFOS.find((model) => model.value === currentModelId);
202
+ const modes = {
203
+ currentModeId: "default",
204
+ availableModes: buildAvailableModes(currentModelInfo)
205
+ };
206
+ const models = {
207
+ currentModelId,
208
+ availableModels: CLAUDE_BASELINE_MODEL_INFOS.map((model) => ({
209
+ modelId: model.value,
210
+ name: model.displayName,
211
+ description: model.description
212
+ }))
213
+ };
214
+ return {
215
+ modes: modes.availableModes.map((mode) => ({
216
+ id: mode.id,
217
+ name: mode.name,
218
+ description: mode.description ?? void 0
219
+ })),
220
+ models: models.availableModels.map((model) => ({
221
+ modelId: model.modelId,
222
+ name: model.name,
223
+ description: model.description
224
+ })),
225
+ configOptions: buildConfigOptions(modes, models, CLAUDE_BASELINE_MODEL_INFOS, void 0, [], "default", void 0)
226
+ };
227
+ }
228
+ export {
229
+ AGENT_CONFIG_ID,
230
+ BUILTIN_AGENT_NAMES,
231
+ DEFAULT_AGENT_ID,
232
+ EFFORT_CONFIG_ID,
233
+ FAST_MODE_CONFIG_ID,
234
+ FAST_MODE_OFF,
235
+ FAST_MODE_ON,
236
+ MODEL_CONFIG_ID,
237
+ MODE_CONFIG_ID,
238
+ buildAvailableModes,
239
+ buildConfigOptions,
240
+ clientSupportsBooleanConfigOptions,
241
+ createFastModeConfigOption,
242
+ fastModeStateEnabled,
243
+ getClaudeBaselineConfig,
244
+ resolveFastModeEnabled
245
+ };