ruicode 0.72.0 → 0.74.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.
- package/README.md +105 -19
- package/dist/client.d.ts +16 -34
- package/dist/client.js +195 -82
- package/dist/index.d.ts +1 -1
- package/dist/sessions.d.ts +1 -0
- package/dist/settings-kinds.d.ts +107 -0
- package/dist/settings-kinds.js +108 -0
- package/dist/settings.d.ts +17 -0
- package/dist/settings.js +39 -0
- package/dist/transport.d.ts +1 -1
- package/dist/transport.js +1 -1
- package/dist/wire.d.ts +201 -96
- package/package.json +4 -4
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export declare const SETTINGS_KINDS: {
|
|
2
|
+
readonly fields: {
|
|
3
|
+
readonly store: {
|
|
4
|
+
readonly fields: {
|
|
5
|
+
readonly sqlite: {
|
|
6
|
+
readonly fields: {
|
|
7
|
+
readonly dir: {
|
|
8
|
+
readonly kind: "bytes";
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
readonly mysql: {
|
|
13
|
+
readonly fields: {
|
|
14
|
+
readonly url: {
|
|
15
|
+
readonly kind: "secret";
|
|
16
|
+
readonly fields: {
|
|
17
|
+
readonly env: {
|
|
18
|
+
readonly kind: "bytes";
|
|
19
|
+
};
|
|
20
|
+
readonly file: {
|
|
21
|
+
readonly kind: "bytes";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
readonly providers: {
|
|
30
|
+
readonly fields: {
|
|
31
|
+
readonly codex: {
|
|
32
|
+
readonly fields: {
|
|
33
|
+
readonly credentialFile: {
|
|
34
|
+
readonly kind: "bytes";
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly openai: {
|
|
39
|
+
readonly fields: {
|
|
40
|
+
readonly key: {
|
|
41
|
+
readonly kind: "secret";
|
|
42
|
+
readonly fields: {
|
|
43
|
+
readonly env: {
|
|
44
|
+
readonly kind: "bytes";
|
|
45
|
+
};
|
|
46
|
+
readonly file: {
|
|
47
|
+
readonly kind: "bytes";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly chatgpt: {
|
|
54
|
+
readonly fields: {
|
|
55
|
+
readonly credentialFile: {
|
|
56
|
+
readonly kind: "bytes";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly network: {
|
|
63
|
+
readonly fields: {
|
|
64
|
+
readonly caFile: {
|
|
65
|
+
readonly kind: "bytes";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
readonly tools: {
|
|
70
|
+
readonly fields: {
|
|
71
|
+
readonly bash: {
|
|
72
|
+
readonly fields: {
|
|
73
|
+
readonly path: {
|
|
74
|
+
readonly kind: "bytes";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
readonly mcp: {
|
|
79
|
+
readonly fields: {
|
|
80
|
+
readonly "*": {
|
|
81
|
+
readonly fields: {
|
|
82
|
+
readonly bearerToken: {
|
|
83
|
+
readonly kind: "secret";
|
|
84
|
+
readonly fields: {
|
|
85
|
+
readonly env: {
|
|
86
|
+
readonly kind: "bytes";
|
|
87
|
+
};
|
|
88
|
+
readonly file: {
|
|
89
|
+
readonly kind: "bytes";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
readonly interface: {
|
|
100
|
+
readonly fields: {
|
|
101
|
+
readonly dir: {
|
|
102
|
+
readonly kind: "bytes";
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// Generated from openapi.json by scripts/generate-settings.mjs. Do not edit.
|
|
2
|
+
export const SETTINGS_KINDS = {
|
|
3
|
+
"fields": {
|
|
4
|
+
"store": {
|
|
5
|
+
"fields": {
|
|
6
|
+
"sqlite": {
|
|
7
|
+
"fields": {
|
|
8
|
+
"dir": {
|
|
9
|
+
"kind": "bytes"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"mysql": {
|
|
14
|
+
"fields": {
|
|
15
|
+
"url": {
|
|
16
|
+
"kind": "secret",
|
|
17
|
+
"fields": {
|
|
18
|
+
"env": {
|
|
19
|
+
"kind": "bytes"
|
|
20
|
+
},
|
|
21
|
+
"file": {
|
|
22
|
+
"kind": "bytes"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"providers": {
|
|
31
|
+
"fields": {
|
|
32
|
+
"codex": {
|
|
33
|
+
"fields": {
|
|
34
|
+
"credentialFile": {
|
|
35
|
+
"kind": "bytes"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"openai": {
|
|
40
|
+
"fields": {
|
|
41
|
+
"key": {
|
|
42
|
+
"kind": "secret",
|
|
43
|
+
"fields": {
|
|
44
|
+
"env": {
|
|
45
|
+
"kind": "bytes"
|
|
46
|
+
},
|
|
47
|
+
"file": {
|
|
48
|
+
"kind": "bytes"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"chatgpt": {
|
|
55
|
+
"fields": {
|
|
56
|
+
"credentialFile": {
|
|
57
|
+
"kind": "bytes"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"network": {
|
|
64
|
+
"fields": {
|
|
65
|
+
"caFile": {
|
|
66
|
+
"kind": "bytes"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"tools": {
|
|
71
|
+
"fields": {
|
|
72
|
+
"bash": {
|
|
73
|
+
"fields": {
|
|
74
|
+
"path": {
|
|
75
|
+
"kind": "bytes"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"mcp": {
|
|
80
|
+
"fields": {
|
|
81
|
+
"*": {
|
|
82
|
+
"fields": {
|
|
83
|
+
"bearerToken": {
|
|
84
|
+
"kind": "secret",
|
|
85
|
+
"fields": {
|
|
86
|
+
"env": {
|
|
87
|
+
"kind": "bytes"
|
|
88
|
+
},
|
|
89
|
+
"file": {
|
|
90
|
+
"kind": "bytes"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"interface": {
|
|
101
|
+
"fields": {
|
|
102
|
+
"dir": {
|
|
103
|
+
"kind": "bytes"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentSpec } from "./sessions.ts";
|
|
2
|
+
import type { components } from "./wire.ts";
|
|
3
|
+
type Input<T> = T extends {
|
|
4
|
+
value: string;
|
|
5
|
+
} ? T | string : T extends {
|
|
6
|
+
hex: string;
|
|
7
|
+
} ? T | Uint8Array : T extends readonly (infer Item)[] ? readonly Input<Item>[] : T extends object ? {
|
|
8
|
+
[Key in keyof T]: Input<T[Key]>;
|
|
9
|
+
} : T;
|
|
10
|
+
/** The generated Host document, with pipe-only secret strings and byte-array paths. */
|
|
11
|
+
export type HostSettings = Omit<Input<components["schemas"]["HostSettings"]>, "presets"> & {
|
|
12
|
+
/** Uses the same friendly Session spec and writer as sessions.create. */
|
|
13
|
+
presets?: Record<string, AgentSpec>;
|
|
14
|
+
};
|
|
15
|
+
/** Normalize only generated schema leaves. Arbitrary preset JSON is not interpreted. */
|
|
16
|
+
export declare function pipeSettings(value: HostSettings, environmentSource?: (name: unknown, path: string) => void): components["schemas"]["HostSettings"];
|
|
17
|
+
export {};
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Friendly inputs are mechanically derived from the generated document type.
|
|
2
|
+
// Runtime codecs come from annotations on that same schema, never a field list.
|
|
3
|
+
import { SETTINGS_KINDS } from "./settings-kinds.js";
|
|
4
|
+
/** Normalize only generated schema leaves. Arbitrary preset JSON is not interpreted. */
|
|
5
|
+
export function pipeSettings(value, environmentSource) {
|
|
6
|
+
function visit(value, codec, path) {
|
|
7
|
+
if (codec?.kind === "secret" && typeof value === "string")
|
|
8
|
+
return { value };
|
|
9
|
+
if (codec?.kind === "bytes") {
|
|
10
|
+
if (value instanceof Uint8Array)
|
|
11
|
+
return { hex: Buffer.from(value.buffer, value.byteOffset, value.byteLength).toString("hex") };
|
|
12
|
+
if (value !== null && typeof value === "object") {
|
|
13
|
+
// Project only this byte leaf once, preserving toJSON(key) and omitted-field semantics.
|
|
14
|
+
const key = path.slice(path.lastIndexOf(".") + 1);
|
|
15
|
+
const projected = JSON.parse(JSON.stringify({ [key]: value }));
|
|
16
|
+
return Object.hasOwn(projected, key) ? projected[key] : undefined;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
if (!codec?.fields || value === null || typeof value !== "object")
|
|
21
|
+
return value;
|
|
22
|
+
if (Array.isArray(value)) {
|
|
23
|
+
// Invalid record arrays retain their shape, without species, iterators or serializers.
|
|
24
|
+
const elements = new Array(value.length);
|
|
25
|
+
Object.setPrototypeOf(elements, null);
|
|
26
|
+
for (let index = 0; index < value.length; index++) {
|
|
27
|
+
if (Object.hasOwn(value, index))
|
|
28
|
+
elements[index] = value[index];
|
|
29
|
+
}
|
|
30
|
+
return elements;
|
|
31
|
+
}
|
|
32
|
+
// Metadata-owned records are own data; callable fields cannot rewrite later decisions.
|
|
33
|
+
const normalized = Object.fromEntries(Object.entries(value).filter(([, field]) => typeof field !== "function").map(([name, field]) => [name, visit(field, codec.fields && Object.hasOwn(codec.fields, name) ? codec.fields[name] : codec.fields?.["*"], path ? `${path}.${name}` : name)]));
|
|
34
|
+
if (codec.kind === "secret" && Object.hasOwn(normalized, "env"))
|
|
35
|
+
environmentSource?.(normalized.env, `${path}.env`);
|
|
36
|
+
return normalized;
|
|
37
|
+
}
|
|
38
|
+
return visit(value, SETTINGS_KINDS, "");
|
|
39
|
+
}
|
package/dist/transport.d.ts
CHANGED
package/dist/transport.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { request } from "node:http";
|
|
5
5
|
import { RuiRequestError } from "./errors.js";
|
|
6
6
|
/** The wire version openapi.json describes. A test keeps the two equal. */
|
|
7
|
-
export const WIRE_VERSION = "
|
|
7
|
+
export const WIRE_VERSION = "17";
|
|
8
8
|
/** The largest reply body read. The Host's own replies stay far below it. */
|
|
9
9
|
const MAX_REPLY_BYTES = 64 * 1024 * 1024;
|
|
10
10
|
/** After the request is sent, the longest the Host may stay silent before its first reply byte. */
|