@yodaos-pkg/aix 0.1.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.
Files changed (4) hide show
  1. package/index.d.ts +52 -0
  2. package/index.js +52 -0
  3. package/jsr.json +5 -0
  4. package/package.json +18 -0
package/index.d.ts ADDED
@@ -0,0 +1,52 @@
1
+ export interface AixEntry {
2
+ name: string;
3
+ size: number;
4
+ compressed_size: number;
5
+ }
6
+ export interface PageInfo {
7
+ name: string;
8
+ title?: string;
9
+ data_schema: any;
10
+ }
11
+ export interface Tool {
12
+ type: string;
13
+ function: {
14
+ name: string;
15
+ description?: string;
16
+ parameters: any;
17
+ };
18
+ }
19
+ export declare class AIX {
20
+ private reader;
21
+ private constructor();
22
+ /**
23
+ * Initialize the WASM module and create an AIX instance from the given data.
24
+ * @param data The .aix file content as Uint8Array
25
+ */
26
+ static from(data: Uint8Array): Promise<AIX>;
27
+ /**
28
+ * List all files in the AIX package.
29
+ */
30
+ list(): AixEntry[];
31
+ /**
32
+ * Read the content of a file from the AIX package.
33
+ * @param name The name of the file
34
+ */
35
+ readFile(name: string): Uint8Array;
36
+ /**
37
+ * Get the version metadata from the AIX package.
38
+ */
39
+ getVersion(): string | undefined;
40
+ /**
41
+ * Get the title from app.json.
42
+ */
43
+ getTitle(): string | undefined;
44
+ /**
45
+ * Get all pages from app.json and pages/*.json.
46
+ */
47
+ getPages(): PageInfo[];
48
+ /**
49
+ * Get all tools from app.json and pages/*.json in OpenAI format.
50
+ */
51
+ getTools(): Tool[];
52
+ }
package/index.js ADDED
@@ -0,0 +1,52 @@
1
+ import init, { AixReaderWasm } from './pkg/aix_web';
2
+ export class AIX {
3
+ constructor(reader) {
4
+ this.reader = reader;
5
+ }
6
+ /**
7
+ * Initialize the WASM module and create an AIX instance from the given data.
8
+ * @param data The .aix file content as Uint8Array
9
+ */
10
+ static async from(data) {
11
+ await init();
12
+ const reader = new AixReaderWasm(data);
13
+ return new AIX(reader);
14
+ }
15
+ /**
16
+ * List all files in the AIX package.
17
+ */
18
+ list() {
19
+ return this.reader.list();
20
+ }
21
+ /**
22
+ * Read the content of a file from the AIX package.
23
+ * @param name The name of the file
24
+ */
25
+ readFile(name) {
26
+ return this.reader.read_file(name);
27
+ }
28
+ /**
29
+ * Get the version metadata from the AIX package.
30
+ */
31
+ getVersion() {
32
+ return this.reader.get_version();
33
+ }
34
+ /**
35
+ * Get the title from app.json.
36
+ */
37
+ getTitle() {
38
+ return this.reader.get_title();
39
+ }
40
+ /**
41
+ * Get all pages from app.json and pages/*.json.
42
+ */
43
+ getPages() {
44
+ return this.reader.get_pages();
45
+ }
46
+ /**
47
+ * Get all tools from app.json and pages/*.json in OpenAI format.
48
+ */
49
+ getTools() {
50
+ return this.reader.get_tools();
51
+ }
52
+ }
package/jsr.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@yodaos-pkg/aix",
3
+ "version": "0.1.0",
4
+ "exports": "./index.js"
5
+ }
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@yodaos-pkg/aix",
3
+ "version": "0.1.0",
4
+ "description": "Ink AIX Package Reader",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "files": [
8
+ "*"
9
+ ],
10
+ "dependencies": {
11
+ "react": "^18.2.0",
12
+ "react-dom": "^18.2.0"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public",
16
+ "registry": "https://registry.npmjs.org/"
17
+ }
18
+ }