@stage-labs/metro 0.1.0-beta.159 → 0.1.0-beta.160

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stage-labs/metro",
3
- "version": "0.1.0-beta.159",
3
+ "version": "0.1.0-beta.160",
4
4
  "description": "The metro command line. Sign in once per machine, then hand your MCP connector list to Claude Code without the credentials touching disk, argv or shell history.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro",
3
- "version": "0.1.0-beta.159",
3
+ "version": "0.1.0-beta.160",
4
4
  "description": "Metro for Claude Code, installed by the metro daemon on this machine: every connector the agent holds as its own MCP server relayed through the daemon, the orchestrator-only guard on the main thread, and the standing rules loaded at each session start. No vendor credential ever sits in a config file.",
5
5
  "author": {
6
6
  "name": "Bonustrack",
@@ -8,7 +8,24 @@ type Item = Record<string, unknown>;
8
8
  export const SIGNATURE_PREFIX = 'metro-gemini:';
9
9
  export const SKIP_SIGNATURE = 'skip_thought_signature_validator';
10
10
  const IMAGE_NOTE = '[an image was attached here; this model cannot see it]';
11
- const SCHEMA_DROP = new Set(['$schema', '$id', 'additionalProperties', 'examples', 'default', 'title']);
11
+ const SCHEMA_KEEP = new Set([
12
+ 'type',
13
+ 'description',
14
+ 'nullable',
15
+ 'enum',
16
+ 'required',
17
+ 'minItems',
18
+ 'maxItems',
19
+ 'minProperties',
20
+ 'maxProperties',
21
+ 'minLength',
22
+ 'maxLength',
23
+ 'pattern',
24
+ 'minimum',
25
+ 'maximum',
26
+ 'propertyOrdering',
27
+ ]);
28
+ const SCHEMA_LISTS = new Set(['anyOf', 'oneOf']);
12
29
  const SIGNATURES_MAX = 2000;
13
30
  const MAX_OUTPUT_TOKENS = 16384;
14
31
 
@@ -121,18 +138,29 @@ export function contentsOf(messages: unknown, names = new ToolNames()): Item[] {
121
138
  return out;
122
139
  }
123
140
 
124
- export function cleanSchema(schema: unknown): unknown {
125
- if (Array.isArray(schema)) return schema.map(cleanSchema);
126
- if (!isRecord(schema)) return schema;
127
- const out: Item = {};
128
- for (const [key, value] of Object.entries(schema)) {
129
- if (SCHEMA_DROP.has(key)) continue;
130
- if (key === 'const') {
131
- out.enum = [value];
132
- continue;
133
- }
134
- out[key] = cleanSchema(value);
141
+ function schemaType(value: unknown, out: Item): void {
142
+ if (!Array.isArray(value)) {
143
+ out.type = value;
144
+ return;
135
145
  }
146
+ const kinds = value.filter((k) => k !== 'null');
147
+ if (kinds.length !== value.length) out.nullable = true;
148
+ if (kinds.length > 0) out.type = kinds[0];
149
+ }
150
+
151
+ function schemaField(key: string, value: unknown, out: Item): void {
152
+ if (key === 'type') schemaType(value, out);
153
+ else if (key === 'const') out.enum = [value];
154
+ else if (key === 'items') out.items = cleanSchema(value);
155
+ else if (key === 'properties' && isRecord(value)) out.properties = Object.fromEntries(Object.entries(value).map(([name, v]) => [name, cleanSchema(v)]));
156
+ else if (SCHEMA_LISTS.has(key) && Array.isArray(value)) out.anyOf = value.map(cleanSchema);
157
+ else if (SCHEMA_KEEP.has(key)) out[key] = value;
158
+ }
159
+
160
+ export function cleanSchema(schema: unknown): Item {
161
+ if (!isRecord(schema)) return {};
162
+ const out: Item = {};
163
+ for (const [key, value] of Object.entries(schema)) schemaField(key, value, out);
136
164
  return out;
137
165
  }
138
166
 
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.1.0-beta.159"
2
+ "version": "0.1.0-beta.160"
3
3
  }