@otto-code/protocol 0.7.5 → 0.7.6

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.
@@ -1,4 +1,9 @@
1
1
  import { z } from "zod";
2
+ export declare const OttoServicePortAllocationSchema: z.ZodObject<{
3
+ range: z.ZodOptional<z.ZodString>;
4
+ portScript: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strict>;
6
+ export type OttoServicePortAllocation = z.infer<typeof OttoServicePortAllocationSchema>;
2
7
  export declare function normalizeLifecycleCommands(commands: unknown): string[];
3
8
  export declare const OttoLifecycleCommandRawSchema: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
4
9
  export declare const OttoScriptEntryRawSchema: z.ZodObject<{
@@ -10,6 +15,10 @@ export declare const OttoWorktreeConfigRawSchema: z.ZodObject<{
10
15
  setup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
11
16
  teardown: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
12
17
  terminals: z.ZodOptional<z.ZodUnknown>;
18
+ servicePorts: z.ZodOptional<z.ZodObject<{
19
+ range: z.ZodOptional<z.ZodString>;
20
+ portScript: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strict>>;
13
22
  }, z.core.$loose>;
14
23
  export declare const OttoMetadataGenerationEntrySchema: z.ZodCatch<z.ZodObject<{
15
24
  instructions: z.ZodOptional<z.ZodString>;
@@ -42,6 +51,10 @@ export declare const OttoConfigRawSchema: z.ZodObject<{
42
51
  setup: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
43
52
  teardown: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
44
53
  terminals: z.ZodOptional<z.ZodUnknown>;
54
+ servicePorts: z.ZodOptional<z.ZodObject<{
55
+ range: z.ZodOptional<z.ZodString>;
56
+ portScript: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strict>>;
45
58
  }, z.core.$loose>>;
46
59
  scripts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
47
60
  type: z.ZodOptional<z.ZodUnknown>;
@@ -68,6 +81,10 @@ export declare const OttoConfigRawSchema: z.ZodObject<{
68
81
  }, z.core.$loose>;
69
82
  export declare const WorktreeConfigSchema: z.ZodCatch<z.ZodObject<{
70
83
  terminals: z.ZodOptional<z.ZodUnknown>;
84
+ servicePorts: z.ZodOptional<z.ZodObject<{
85
+ range: z.ZodOptional<z.ZodString>;
86
+ portScript: z.ZodOptional<z.ZodString>;
87
+ }, z.core.$strict>>;
71
88
  setup: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<string[], unknown>>;
72
89
  teardown: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<string[], unknown>>;
73
90
  }, z.core.$loose>>;
@@ -79,6 +96,10 @@ export declare const ScriptEntrySchema: z.ZodCatch<z.ZodObject<{
79
96
  export declare const OttoConfigSchema: z.ZodCatch<z.ZodObject<{
80
97
  worktree: z.ZodOptional<z.ZodCatch<z.ZodObject<{
81
98
  terminals: z.ZodOptional<z.ZodUnknown>;
99
+ servicePorts: z.ZodOptional<z.ZodObject<{
100
+ range: z.ZodOptional<z.ZodString>;
101
+ portScript: z.ZodOptional<z.ZodString>;
102
+ }, z.core.$strict>>;
82
103
  setup: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<string[], unknown>>;
83
104
  teardown: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<string[], unknown>>;
84
105
  }, z.core.$loose>>>;
@@ -1,5 +1,26 @@
1
1
  import { z } from "zod";
2
2
  import { GitHostingProviderIdSchema } from "./git-hosting.js";
3
+ const TCP_PORT_RANGE_PATTERN = /^(\d{1,5})-(\d{1,5})$/;
4
+ // Declared ahead of OttoWorktreeConfigRawSchema because that schema references
5
+ // it: a zod schema is a value, so a later `const` would be in its temporal dead
6
+ // zone at module-evaluation time.
7
+ export const OttoServicePortAllocationSchema = z
8
+ .object({
9
+ range: z.string().trim().regex(TCP_PORT_RANGE_PATTERN).optional(),
10
+ portScript: z.string().trim().min(1).optional(),
11
+ })
12
+ .strict()
13
+ .refine((value) => value.range !== undefined || value.portScript !== undefined, "Expected range or portScript")
14
+ .refine((value) => {
15
+ if (!value.range)
16
+ return true;
17
+ const match = TCP_PORT_RANGE_PATTERN.exec(value.range);
18
+ if (!match)
19
+ return false;
20
+ const start = Number(match[1]);
21
+ const end = Number(match[2]);
22
+ return start >= 1 && end <= 65535 && start <= end;
23
+ }, "Expected an inclusive TCP port range from 1-65535");
3
24
  export function normalizeLifecycleCommands(commands) {
4
25
  if (typeof commands === "string") {
5
26
  return commands.trim().length > 0 ? [commands] : [];
@@ -24,6 +45,7 @@ export const OttoWorktreeConfigRawSchema = z
24
45
  setup: OttoLifecycleCommandRawSchema.optional(),
25
46
  teardown: OttoLifecycleCommandRawSchema.optional(),
26
47
  terminals: z.unknown().optional(),
48
+ servicePorts: OttoServicePortAllocationSchema.optional(),
27
49
  })
28
50
  .passthrough();
29
51
  export const OttoMetadataGenerationEntrySchema = z
@@ -8,6 +8,7 @@ export interface AgentModeVisuals {
8
8
  }
9
9
  export type AgentProviderModeDefinition = Omit<AgentMode, "icon" | "colorTier"> & AgentModeVisuals & {
10
10
  isUnattended?: boolean;
11
+ selectsModel?: boolean;
11
12
  userSelectable?: boolean;
12
13
  };
13
14
  export interface AgentProviderDefinition {
@@ -23,6 +24,7 @@ export interface AgentProviderDefinition {
23
24
  defaultModel?: string;
24
25
  };
25
26
  }
27
+ export declare const OMP_MODES: AgentProviderModeDefinition[];
26
28
  export declare const AGENT_PROVIDER_DEFINITIONS: AgentProviderDefinition[];
27
29
  export declare const DEV_AGENT_PROVIDER_DEFINITIONS: AgentProviderDefinition[];
28
30
  export declare function getAgentProviderDefinition(provider: string, definitions?: AgentProviderDefinition[]): AgentProviderDefinition;
@@ -27,11 +27,15 @@ const CLAUDE_MODES = [
27
27
  description: "Uses a model classifier to review permission prompts automatically",
28
28
  icon: "LocalPolice",
29
29
  colorTier: "moderate",
30
+ // Auto also lets the CLI pick the model per turn. Codex's unrelated "auto"
31
+ // mode is a permission level only, which is exactly why this is a flag and
32
+ // not a check on the mode id.
33
+ selectsModel: true,
30
34
  },
31
35
  {
32
36
  id: "dontAsk",
33
37
  label: "Don't Ask",
34
- description: "Runs without prompting actions not pre-approved are denied",
38
+ description: "Runs without prompting; actions not pre-approved are denied",
35
39
  // Guarded unattended mode: more dangerous than acceptEdits (edits only) but
36
40
  // safer than bypass (deny-by-default vs. run-everything), so it sits at the
37
41
  // "moderate" tier alongside Auto.
@@ -127,7 +131,7 @@ const MOCK_LOAD_TEST_MODES = [
127
131
  {
128
132
  id: "dontAsk",
129
133
  label: "Don't Ask",
130
- description: "Runs without prompting actions not pre-approved are denied",
134
+ description: "Runs without prompting; actions not pre-approved are denied",
131
135
  icon: "ShieldCheck",
132
136
  colorTier: "moderate",
133
137
  // Dev-only mirror of Claude's guarded unattended mode so deterministic E2E
@@ -147,6 +151,30 @@ const MOCK_SLOW_MODES = [
147
151
  colorTier: "dangerous",
148
152
  },
149
153
  ];
154
+ export const OMP_MODES = [
155
+ {
156
+ id: "full",
157
+ label: "Full Access",
158
+ description: "Launches OMP with yolo approval mode so tools run without prompts.",
159
+ icon: "ShieldOff",
160
+ colorTier: "dangerous",
161
+ isUnattended: true,
162
+ },
163
+ {
164
+ id: "write",
165
+ label: "Write Approval",
166
+ description: "Launches OMP with write approval mode: reads are free, writes require approval.",
167
+ icon: "ShieldAlert",
168
+ colorTier: "moderate",
169
+ },
170
+ {
171
+ id: "ask",
172
+ label: "Always Ask",
173
+ description: "Launches OMP with always-ask approval mode for write and exec tools.",
174
+ icon: "ShieldCheck",
175
+ colorTier: "safe",
176
+ },
177
+ ];
150
178
  export const AGENT_PROVIDER_DEFINITIONS = [
151
179
  {
152
180
  id: "claude",
@@ -202,8 +230,8 @@ export const AGENT_PROVIDER_DEFINITIONS = [
202
230
  label: "OMP",
203
231
  description: "Pi-compatible coding agent distributed as Oh My Pi",
204
232
  enabledByDefault: false,
205
- defaultModeId: null,
206
- modes: [],
233
+ defaultModeId: "ask",
234
+ modes: OMP_MODES,
207
235
  },
208
236
  ];
209
237
  export const DEV_AGENT_PROVIDER_DEFINITIONS = [
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Convert an exact rolling interval to an equivalent five-field cron cadence.
3
+ * Returns null when cron's calendar boundaries would change the interval.
4
+ */
5
+ export declare function everyMsToFiveFieldCron(everyMs: number): string | null;
6
+ //# sourceMappingURL=cadence.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Convert an exact rolling interval to an equivalent five-field cron cadence.
3
+ * Returns null when cron's calendar boundaries would change the interval.
4
+ */
5
+ export function everyMsToFiveFieldCron(everyMs) {
6
+ const minutes = everyMs / 60000;
7
+ if (!Number.isInteger(minutes) || minutes <= 0) {
8
+ return null;
9
+ }
10
+ if (minutes < 60 && 60 % minutes === 0) {
11
+ return `*/${minutes} * * * *`;
12
+ }
13
+ if (minutes === 60) {
14
+ return "0 * * * *";
15
+ }
16
+ if (minutes % 60 !== 0) {
17
+ return null;
18
+ }
19
+ const hours = minutes / 60;
20
+ if (hours < 24 && 24 % hours === 0) {
21
+ return `0 */${hours} * * *`;
22
+ }
23
+ if (hours === 24) {
24
+ return "0 0 * * *";
25
+ }
26
+ return null;
27
+ }
28
+ //# sourceMappingURL=cadence.js.map