oh-my-opencode-slim 0.9.10 → 0.9.11

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/cli/index.js CHANGED
@@ -208,7 +208,8 @@ var AgentOverrideConfigSchema = z2.object({
208
208
  temperature: z2.number().min(0).max(2).optional(),
209
209
  variant: z2.string().optional().catch(undefined),
210
210
  skills: z2.array(z2.string()).optional(),
211
- mcps: z2.array(z2.string()).optional()
211
+ mcps: z2.array(z2.string()).optional(),
212
+ options: z2.record(z2.string(), z2.unknown()).optional()
212
213
  });
213
214
  var MultiplexerTypeSchema = z2.enum(["auto", "tmux", "zellij", "none"]);
214
215
  var MultiplexerLayoutSchema = z2.enum([
@@ -59,6 +59,7 @@ export declare const AgentOverrideConfigSchema: z.ZodObject<{
59
59
  variant: z.ZodCatch<z.ZodOptional<z.ZodString>>;
60
60
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
61
61
  mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
62
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
62
63
  }, z.core.$strip>;
63
64
  export declare const MultiplexerTypeSchema: z.ZodEnum<{
64
65
  auto: "auto";
@@ -127,6 +128,7 @@ export declare const PresetSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
127
128
  variant: z.ZodCatch<z.ZodOptional<z.ZodString>>;
128
129
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
130
  mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
130
132
  }, z.core.$strip>>;
131
133
  export type Preset = z.infer<typeof PresetSchema>;
132
134
  export declare const WebsearchConfigSchema: z.ZodObject<{
@@ -231,6 +233,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
231
233
  variant: z.ZodCatch<z.ZodOptional<z.ZodString>>;
232
234
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
233
235
  mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
236
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
234
237
  }, z.core.$strip>>>>;
235
238
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
236
239
  model: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
@@ -241,6 +244,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
241
244
  variant: z.ZodCatch<z.ZodOptional<z.ZodString>>;
242
245
  skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
243
246
  mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
247
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
244
248
  }, z.core.$strip>>>;
245
249
  disabled_mcps: z.ZodOptional<z.ZodArray<z.ZodString>>;
246
250
  multiplexer: z.ZodOptional<z.ZodObject<{
@@ -11,6 +11,7 @@ export type PreparedFileState = {
11
11
  };
12
12
  export type PatchExecutionContext = {
13
13
  hunks: PatchHunk[];
14
+ pathsNormalized: boolean;
14
15
  staged: Map<string, PreparedFileState>;
15
16
  getPreparedFileState: (filePath: string, verb: 'update' | 'delete') => Promise<PreparedFileState>;
16
17
  assertPreparedPathMissing: (filePath: string, verb: 'add' | 'move') => Promise<void>;
@@ -20,7 +21,10 @@ export type ResolvedPreparedUpdate = {
20
21
  nextText: string;
21
22
  };
22
23
  export declare function isMissingPathError(error: unknown): boolean;
23
- export declare function parseValidatedPatch(patchText: string): PatchHunk[];
24
+ export declare function parseValidatedPatch(root: string, patchText: string, worktree?: string): Promise<{
25
+ hunks: PatchHunk[];
26
+ pathsNormalized: boolean;
27
+ }>;
24
28
  export declare function createPatchExecutionContext(root: string, patchText: string, worktree?: string): Promise<PatchExecutionContext>;
25
29
  export declare function resolvePreparedUpdate(filePath: string, currentText: string, hunk: UpdatePatchHunk, cfg: ApplyPatchRuntimeOptions): ResolvedPreparedUpdate;
26
30
  export declare function stageAddedText(contents: string): string;
package/dist/index.js CHANGED
@@ -502,7 +502,8 @@ var AgentOverrideConfigSchema = z2.object({
502
502
  temperature: z2.number().min(0).max(2).optional(),
503
503
  variant: z2.string().optional().catch(undefined),
504
504
  skills: z2.array(z2.string()).optional(),
505
- mcps: z2.array(z2.string()).optional()
505
+ mcps: z2.array(z2.string()).optional(),
506
+ options: z2.record(z2.string(), z2.unknown()).optional()
506
507
  });
507
508
  var MultiplexerTypeSchema = z2.enum(["auto", "tmux", "zellij", "none"]);
508
509
  var MultiplexerLayoutSchema = z2.enum([
@@ -1247,6 +1248,12 @@ function applyOverrides(agent, override) {
1247
1248
  agent.config.variant = override.variant;
1248
1249
  if (override.temperature !== undefined)
1249
1250
  agent.config.temperature = override.temperature;
1251
+ if (override.options) {
1252
+ agent.config.options = {
1253
+ ...agent.config.options,
1254
+ ...override.options
1255
+ };
1256
+ }
1250
1257
  }
1251
1258
  function applyDefaultPermissions(agent, configuredSkills) {
1252
1259
  const existing = agent.config.permission ?? {};
@@ -3909,6 +3916,52 @@ function validatePatchPaths(hunks) {
3909
3916
  }
3910
3917
  }
3911
3918
  }
3919
+ function toPortablePatchPath(filePath) {
3920
+ return filePath.split(path3.sep).join("/");
3921
+ }
3922
+ function toRelativePatchPath(root, target) {
3923
+ const relative = path3.relative(root, target);
3924
+ return toPortablePatchPath(relative.length === 0 ? path3.basename(target) : relative);
3925
+ }
3926
+ async function normalizeAbsolutePatchPath(root, worktree, value) {
3927
+ if (!path3.isAbsolute(value)) {
3928
+ return value;
3929
+ }
3930
+ const guardContext = createPathGuardContext(root, worktree);
3931
+ const target = path3.resolve(value);
3932
+ await guard(guardContext, target);
3933
+ const [rootReal, targetReal] = await Promise.all([
3934
+ guardContext.rootReal,
3935
+ realCached(guardContext, target)
3936
+ ]);
3937
+ if (!inside(rootReal, targetReal)) {
3938
+ throw createApplyPatchBlockedError(`patch contains path outside workspace root: ${target}`);
3939
+ }
3940
+ return toRelativePatchPath(root, target);
3941
+ }
3942
+ async function normalizeAbsolutePatchPaths(root, worktree, hunks) {
3943
+ const normalized = [];
3944
+ let changed = false;
3945
+ for (const hunk of hunks) {
3946
+ const normalizedPath = await normalizeAbsolutePatchPath(root, worktree, hunk.path);
3947
+ if (hunk.type !== "update") {
3948
+ changed ||= normalizedPath !== hunk.path;
3949
+ normalized.push(normalizedPath === hunk.path ? hunk : {
3950
+ ...hunk,
3951
+ path: normalizedPath
3952
+ });
3953
+ continue;
3954
+ }
3955
+ const normalizedMovePath = hunk.move_path ? await normalizeAbsolutePatchPath(root, worktree, hunk.move_path) : undefined;
3956
+ changed ||= normalizedPath !== hunk.path || normalizedMovePath !== hunk.move_path;
3957
+ normalized.push(normalizedPath === hunk.path && normalizedMovePath === hunk.move_path ? hunk : {
3958
+ ...hunk,
3959
+ path: normalizedPath,
3960
+ move_path: normalizedMovePath
3961
+ });
3962
+ }
3963
+ return { hunks: normalized, changed };
3964
+ }
3912
3965
  async function guardPatchTargets(root, worktree, targets) {
3913
3966
  const guardContext = createPathGuardContext(root, worktree);
3914
3967
  for (const target of targets) {
@@ -3916,7 +3969,7 @@ async function guardPatchTargets(root, worktree, targets) {
3916
3969
  }
3917
3970
  return targets.length;
3918
3971
  }
3919
- function parseValidatedPatch(patchText) {
3972
+ async function parseValidatedPatch(root, patchText, worktree) {
3920
3973
  let hunks;
3921
3974
  try {
3922
3975
  hunks = parsePatchStrict(patchText).hunks;
@@ -3933,8 +3986,12 @@ function parseValidatedPatch(patchText) {
3933
3986
  }
3934
3987
  throw createApplyPatchValidationError("no hunks found");
3935
3988
  }
3936
- validatePatchPaths(hunks);
3937
- return hunks;
3989
+ const normalizedPatch = await normalizeAbsolutePatchPaths(root, worktree, hunks);
3990
+ validatePatchPaths(normalizedPatch.hunks);
3991
+ return {
3992
+ hunks: normalizedPatch.hunks,
3993
+ pathsNormalized: normalizedPatch.changed
3994
+ };
3938
3995
  }
3939
3996
  async function readPreparedFileText(filePath, verb) {
3940
3997
  try {
@@ -3947,7 +4004,7 @@ async function readPreparedFileText(filePath, verb) {
3947
4004
  }
3948
4005
  }
3949
4006
  async function createPatchExecutionContext(root, patchText, worktree) {
3950
- const hunks = parseValidatedPatch(patchText);
4007
+ const { hunks, pathsNormalized } = await parseValidatedPatch(root, patchText, worktree);
3951
4008
  await guardPatchTargets(root, worktree, collectPatchTargets(root, hunks));
3952
4009
  const files = createFileCacheContext();
3953
4010
  const staged = new Map;
@@ -3987,6 +4044,7 @@ async function createPatchExecutionContext(root, patchText, worktree) {
3987
4044
  }
3988
4045
  return {
3989
4046
  hunks,
4047
+ pathsNormalized,
3990
4048
  staged,
3991
4049
  getPreparedFileState,
3992
4050
  assertPreparedPathMissing
@@ -4162,7 +4220,13 @@ async function rewritePatch(root, patchText, cfg, worktree) {
4162
4220
  let clearDependencyGroup = function(filePath) {
4163
4221
  dependencyGroups.delete(filePath);
4164
4222
  };
4165
- const { hunks, staged, getPreparedFileState, assertPreparedPathMissing } = await createPatchExecutionContext(root, patchText, worktree);
4223
+ const {
4224
+ hunks,
4225
+ pathsNormalized,
4226
+ staged,
4227
+ getPreparedFileState,
4228
+ assertPreparedPathMissing
4229
+ } = await createPatchExecutionContext(root, patchText, worktree);
4166
4230
  const normalizedPatchText = normalizePatchText(patchText);
4167
4231
  const rewritten = [];
4168
4232
  let changed = false;
@@ -4282,6 +4346,15 @@ async function rewritePatch(root, patchText, cfg, worktree) {
4282
4346
  }
4283
4347
  }
4284
4348
  if (!changed) {
4349
+ if (pathsNormalized) {
4350
+ return {
4351
+ patchText: formatPatch({ hunks }),
4352
+ changed: true,
4353
+ rewrittenChunks: 0,
4354
+ totalChunks,
4355
+ rewriteModes: ["normalize:patch-paths"]
4356
+ };
4357
+ }
4285
4358
  if (normalizedPatchText !== patchText) {
4286
4359
  return {
4287
4360
  patchText: normalizedPatchText,
@@ -258,6 +258,13 @@
258
258
  "items": {
259
259
  "type": "string"
260
260
  }
261
+ },
262
+ "options": {
263
+ "type": "object",
264
+ "propertyNames": {
265
+ "type": "string"
266
+ },
267
+ "additionalProperties": {}
261
268
  }
262
269
  }
263
270
  }
@@ -321,6 +328,13 @@
321
328
  "items": {
322
329
  "type": "string"
323
330
  }
331
+ },
332
+ "options": {
333
+ "type": "object",
334
+ "propertyNames": {
335
+ "type": "string"
336
+ },
337
+ "additionalProperties": {}
324
338
  }
325
339
  }
326
340
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode-slim",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "Lightweight agent orchestration plugin for OpenCode - a slimmed-down fork of oh-my-opencode",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",