@yodaos-pkg/aix 0.2.1 → 0.3.1
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 +124 -25
- package/index.d.ts +2 -2
- package/index.js +11 -3
- package/jsr.json +1 -1
- package/package.json +3 -6
- package/pkg/README.md +124 -25
- package/pkg/aix_web.js +3 -0
- package/pkg/aix_web_bg.wasm +0 -0
- package/pkg/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,50 +1,149 @@
|
|
|
1
|
-
# @yodaos-
|
|
1
|
+
# @yodaos-pkg/aix
|
|
2
2
|
|
|
3
|
-
`@yodaos-
|
|
3
|
+
`@yodaos-pkg/aix` is a library for reading and managing **.aix** (AI eXecutable) packages in the web environment using WASM. The `.aix` format is an extension of the [Open Agent Format (OAF)](https://openagentformat.com/spec.html), designed to package AI agents with rich UI/UX capabilities powered by Ink Mini Programs.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @yodaos-pkg/aix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
Here is a quick example of how to load an `.aix` package:
|
|
8
14
|
|
|
9
15
|
```typescript
|
|
10
|
-
import { AIX } from '@yodaos-
|
|
16
|
+
import { AIX } from '@yodaos-pkg/aix';
|
|
17
|
+
|
|
18
|
+
// Option 1: Load from a URL
|
|
19
|
+
async function fromUrl() {
|
|
20
|
+
const response = await fetch('https://example.com/my-agent.aix');
|
|
21
|
+
const buffer = await response.arrayBuffer();
|
|
22
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
23
|
+
console.log('App Title:', aix.getTitle());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Option 2: Load from a File object (e.g., from an <input type="file">)
|
|
27
|
+
async function fromFile(file: File) {
|
|
28
|
+
const aix = await AIX.From(file);
|
|
29
|
+
console.log('App Title:', aix.getTitle());
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### `AIX` Class
|
|
36
|
+
|
|
37
|
+
The main class to interact with an AIX package.
|
|
11
38
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
40
|
+
Initializes the WASM module and creates an AIX instance from the given `.aix` file content. It supports both `Uint8Array` and the standard Web `File` object.
|
|
41
|
+
```typescript
|
|
42
|
+
// From Uint8Array
|
|
43
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
16
44
|
|
|
17
|
-
//
|
|
18
|
-
const aix = await AIX.
|
|
45
|
+
// From File (Web API)
|
|
46
|
+
const aix = await AIX.From(file);
|
|
47
|
+
```
|
|
19
48
|
|
|
20
|
-
|
|
49
|
+
#### `list(): AixEntry[]`
|
|
50
|
+
Lists all files in the AIX package.
|
|
51
|
+
```typescript
|
|
21
52
|
const files = aix.list();
|
|
22
|
-
|
|
53
|
+
// [{ name: "app.json", size: 123, compressed_size: 45 }, ...]
|
|
54
|
+
```
|
|
23
55
|
|
|
24
|
-
|
|
56
|
+
#### `readFile(name: string): Uint8Array`
|
|
57
|
+
Reads the raw content of a specific file from the package.
|
|
58
|
+
```typescript
|
|
59
|
+
const content = aix.readFile('app.json');
|
|
60
|
+
const text = new TextDecoder().decode(content);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### `getVersion(): string | undefined`
|
|
64
|
+
Returns the version metadata from the `VERSION` file in the package.
|
|
65
|
+
```typescript
|
|
25
66
|
const version = aix.getVersion();
|
|
26
|
-
|
|
67
|
+
```
|
|
27
68
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
69
|
+
#### `getTitle(): string | undefined`
|
|
70
|
+
Extracts the navigation bar title from the `app.json`.
|
|
71
|
+
```typescript
|
|
72
|
+
const title = aix.getTitle();
|
|
32
73
|
```
|
|
33
74
|
|
|
34
|
-
|
|
75
|
+
#### `getPages(): PageInfo[]`
|
|
76
|
+
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
77
|
+
```typescript
|
|
78
|
+
const pages = aix.getPages();
|
|
79
|
+
/*
|
|
80
|
+
[{
|
|
81
|
+
name: "pages/index/index",
|
|
82
|
+
title: "Home",
|
|
83
|
+
data_schema: { ... }
|
|
84
|
+
}]
|
|
85
|
+
*/
|
|
86
|
+
```
|
|
35
87
|
|
|
36
|
-
|
|
37
|
-
|
|
88
|
+
#### `getTools(): Tool[]`
|
|
89
|
+
Generates a list of OpenAI-compatible tool definitions based on the pages and their schemas.
|
|
90
|
+
```typescript
|
|
91
|
+
const tools = aix.getTools();
|
|
92
|
+
/*
|
|
93
|
+
[{
|
|
94
|
+
type: "function",
|
|
95
|
+
function: {
|
|
96
|
+
name: "pages_index_index",
|
|
97
|
+
description: "Home",
|
|
98
|
+
parameters: { ... }
|
|
99
|
+
}
|
|
100
|
+
}]
|
|
101
|
+
*/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Data Types
|
|
105
|
+
|
|
106
|
+
### `AixEntry`
|
|
107
|
+
```typescript
|
|
108
|
+
interface AixEntry {
|
|
109
|
+
name: string;
|
|
110
|
+
size: number;
|
|
111
|
+
compressed_size: number;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `PageInfo`
|
|
116
|
+
```typescript
|
|
117
|
+
interface PageInfo {
|
|
118
|
+
name: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
data_schema: any;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `Tool`
|
|
125
|
+
OpenAI compatible tool format.
|
|
126
|
+
```typescript
|
|
127
|
+
interface Tool {
|
|
128
|
+
type: string;
|
|
129
|
+
function: {
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
parameters: any;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
38
135
|
```
|
|
39
136
|
|
|
40
137
|
## Build
|
|
41
138
|
|
|
42
|
-
To build the
|
|
139
|
+
To build the library for distribution:
|
|
43
140
|
|
|
44
141
|
```bash
|
|
45
142
|
npm run build
|
|
46
143
|
```
|
|
47
144
|
|
|
48
|
-
|
|
145
|
+
The output will be generated in the `dist` directory, including WASM binaries and TypeScript definitions.
|
|
146
|
+
|
|
147
|
+
## License
|
|
49
148
|
|
|
50
|
-
|
|
149
|
+
MIT
|
package/index.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ export declare class AIX {
|
|
|
21
21
|
private constructor();
|
|
22
22
|
/**
|
|
23
23
|
* Initialize the WASM module and create an AIX instance from the given data.
|
|
24
|
-
* @param data The .aix file content as Uint8Array
|
|
24
|
+
* @param data The .aix file content as Uint8Array or File
|
|
25
25
|
*/
|
|
26
|
-
static
|
|
26
|
+
static From(data: Uint8Array | File): Promise<AIX>;
|
|
27
27
|
/**
|
|
28
28
|
* List all files in the AIX package.
|
|
29
29
|
*/
|
package/index.js
CHANGED
|
@@ -5,11 +5,19 @@ export class AIX {
|
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Initialize the WASM module and create an AIX instance from the given data.
|
|
8
|
-
* @param data The .aix file content as Uint8Array
|
|
8
|
+
* @param data The .aix file content as Uint8Array or File
|
|
9
9
|
*/
|
|
10
|
-
static async
|
|
10
|
+
static async From(data) {
|
|
11
11
|
await init();
|
|
12
|
-
|
|
12
|
+
let buffer;
|
|
13
|
+
if (data instanceof Uint8Array) {
|
|
14
|
+
buffer = data;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
const arrayBuffer = await data.arrayBuffer();
|
|
18
|
+
buffer = new Uint8Array(arrayBuffer);
|
|
19
|
+
}
|
|
20
|
+
const reader = new AixReaderWasm(buffer);
|
|
13
21
|
return new AIX(reader);
|
|
14
22
|
}
|
|
15
23
|
/**
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yodaos-pkg/aix",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Ink AIX Package Reader",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"files": [
|
|
8
8
|
"*"
|
|
9
9
|
],
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"react": "^18.2.0",
|
|
12
|
-
"react-dom": "^18.2.0"
|
|
13
|
-
},
|
|
10
|
+
"dependencies": {},
|
|
14
11
|
"publishConfig": {
|
|
15
12
|
"access": "public",
|
|
16
|
-
"registry": "https://registry.npmjs.
|
|
13
|
+
"registry": "https://registry.npmjs.com/"
|
|
17
14
|
}
|
|
18
15
|
}
|
package/pkg/README.md
CHANGED
|
@@ -1,50 +1,149 @@
|
|
|
1
|
-
# @yodaos-
|
|
1
|
+
# @yodaos-pkg/aix
|
|
2
2
|
|
|
3
|
-
`@yodaos-
|
|
3
|
+
`@yodaos-pkg/aix` is a library for reading and managing **.aix** (AI eXecutable) packages in the web environment using WASM. The `.aix` format is an extension of the [Open Agent Format (OAF)](https://openagentformat.com/spec.html), designed to package AI agents with rich UI/UX capabilities powered by Ink Mini Programs.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @yodaos-pkg/aix
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
Here is a quick example of how to load an `.aix` package:
|
|
8
14
|
|
|
9
15
|
```typescript
|
|
10
|
-
import { AIX } from '@yodaos-
|
|
16
|
+
import { AIX } from '@yodaos-pkg/aix';
|
|
17
|
+
|
|
18
|
+
// Option 1: Load from a URL
|
|
19
|
+
async function fromUrl() {
|
|
20
|
+
const response = await fetch('https://example.com/my-agent.aix');
|
|
21
|
+
const buffer = await response.arrayBuffer();
|
|
22
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
23
|
+
console.log('App Title:', aix.getTitle());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Option 2: Load from a File object (e.g., from an <input type="file">)
|
|
27
|
+
async function fromFile(file: File) {
|
|
28
|
+
const aix = await AIX.From(file);
|
|
29
|
+
console.log('App Title:', aix.getTitle());
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API Reference
|
|
34
|
+
|
|
35
|
+
### `AIX` Class
|
|
36
|
+
|
|
37
|
+
The main class to interact with an AIX package.
|
|
11
38
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
#### `static async From(data: Uint8Array | File): Promise<AIX>`
|
|
40
|
+
Initializes the WASM module and creates an AIX instance from the given `.aix` file content. It supports both `Uint8Array` and the standard Web `File` object.
|
|
41
|
+
```typescript
|
|
42
|
+
// From Uint8Array
|
|
43
|
+
const aix = await AIX.From(new Uint8Array(buffer));
|
|
16
44
|
|
|
17
|
-
//
|
|
18
|
-
const aix = await AIX.
|
|
45
|
+
// From File (Web API)
|
|
46
|
+
const aix = await AIX.From(file);
|
|
47
|
+
```
|
|
19
48
|
|
|
20
|
-
|
|
49
|
+
#### `list(): AixEntry[]`
|
|
50
|
+
Lists all files in the AIX package.
|
|
51
|
+
```typescript
|
|
21
52
|
const files = aix.list();
|
|
22
|
-
|
|
53
|
+
// [{ name: "app.json", size: 123, compressed_size: 45 }, ...]
|
|
54
|
+
```
|
|
23
55
|
|
|
24
|
-
|
|
56
|
+
#### `readFile(name: string): Uint8Array`
|
|
57
|
+
Reads the raw content of a specific file from the package.
|
|
58
|
+
```typescript
|
|
59
|
+
const content = aix.readFile('app.json');
|
|
60
|
+
const text = new TextDecoder().decode(content);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### `getVersion(): string | undefined`
|
|
64
|
+
Returns the version metadata from the `VERSION` file in the package.
|
|
65
|
+
```typescript
|
|
25
66
|
const version = aix.getVersion();
|
|
26
|
-
|
|
67
|
+
```
|
|
27
68
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
69
|
+
#### `getTitle(): string | undefined`
|
|
70
|
+
Extracts the navigation bar title from the `app.json`.
|
|
71
|
+
```typescript
|
|
72
|
+
const title = aix.getTitle();
|
|
32
73
|
```
|
|
33
74
|
|
|
34
|
-
|
|
75
|
+
#### `getPages(): PageInfo[]`
|
|
76
|
+
Returns information about all pages defined in the package, including their paths, titles, and data schemas.
|
|
77
|
+
```typescript
|
|
78
|
+
const pages = aix.getPages();
|
|
79
|
+
/*
|
|
80
|
+
[{
|
|
81
|
+
name: "pages/index/index",
|
|
82
|
+
title: "Home",
|
|
83
|
+
data_schema: { ... }
|
|
84
|
+
}]
|
|
85
|
+
*/
|
|
86
|
+
```
|
|
35
87
|
|
|
36
|
-
|
|
37
|
-
|
|
88
|
+
#### `getTools(): Tool[]`
|
|
89
|
+
Generates a list of OpenAI-compatible tool definitions based on the pages and their schemas.
|
|
90
|
+
```typescript
|
|
91
|
+
const tools = aix.getTools();
|
|
92
|
+
/*
|
|
93
|
+
[{
|
|
94
|
+
type: "function",
|
|
95
|
+
function: {
|
|
96
|
+
name: "pages_index_index",
|
|
97
|
+
description: "Home",
|
|
98
|
+
parameters: { ... }
|
|
99
|
+
}
|
|
100
|
+
}]
|
|
101
|
+
*/
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Data Types
|
|
105
|
+
|
|
106
|
+
### `AixEntry`
|
|
107
|
+
```typescript
|
|
108
|
+
interface AixEntry {
|
|
109
|
+
name: string;
|
|
110
|
+
size: number;
|
|
111
|
+
compressed_size: number;
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `PageInfo`
|
|
116
|
+
```typescript
|
|
117
|
+
interface PageInfo {
|
|
118
|
+
name: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
data_schema: any;
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `Tool`
|
|
125
|
+
OpenAI compatible tool format.
|
|
126
|
+
```typescript
|
|
127
|
+
interface Tool {
|
|
128
|
+
type: string;
|
|
129
|
+
function: {
|
|
130
|
+
name: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
parameters: any;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
38
135
|
```
|
|
39
136
|
|
|
40
137
|
## Build
|
|
41
138
|
|
|
42
|
-
To build the
|
|
139
|
+
To build the library for distribution:
|
|
43
140
|
|
|
44
141
|
```bash
|
|
45
142
|
npm run build
|
|
46
143
|
```
|
|
47
144
|
|
|
48
|
-
|
|
145
|
+
The output will be generated in the `dist` directory, including WASM binaries and TypeScript definitions.
|
|
146
|
+
|
|
147
|
+
## License
|
|
49
148
|
|
|
50
|
-
|
|
149
|
+
MIT
|
package/pkg/aix_web.js
CHANGED
|
@@ -140,6 +140,9 @@ function __wbg_get_imports() {
|
|
|
140
140
|
__wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {
|
|
141
141
|
arg0[arg1 >>> 0] = arg2;
|
|
142
142
|
},
|
|
143
|
+
__wbg_warn_cf65167dc0d7a3d1: function(arg0, arg1) {
|
|
144
|
+
console.warn(getStringFromWasm0(arg0, arg1));
|
|
145
|
+
},
|
|
143
146
|
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
144
147
|
// Cast intrinsic for `F64 -> Externref`.
|
|
145
148
|
const ret = arg0;
|
package/pkg/aix_web_bg.wasm
CHANGED
|
Binary file
|