@oasisomniverse/web6-api 1.0.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 +177 -0
- package/docs/README.md +24 -0
- package/docs/modules/Completion.md +124 -0
- package/docs/modules/HolonicBraid.md +137 -0
- package/docs/modules/HolonicMemory.md +268 -0
- package/docs/modules/Images.md +77 -0
- package/docs/modules/Orchestrator.md +173 -0
- package/docs/modules/ReasoningNetwork.md +254 -0
- package/index.d.ts +52 -0
- package/index.js +3 -0
- package/index.mjs +4 -0
- package/package.json +112 -0
- package/src/core/httpClient.js +110 -0
- package/src/core/routeHelper.js +85 -0
- package/src/core/tokenStore.js +52 -0
- package/src/core/types.d.ts +18 -0
- package/src/index.js +45 -0
- package/src/modules/Completion.d.ts +12 -0
- package/src/modules/Completion.js +25 -0
- package/src/modules/HolonicBraid.d.ts +12 -0
- package/src/modules/HolonicBraid.js +25 -0
- package/src/modules/HolonicMemory.d.ts +21 -0
- package/src/modules/HolonicMemory.js +31 -0
- package/src/modules/Images.d.ts +9 -0
- package/src/modules/Images.js +23 -0
- package/src/modules/Orchestrator.d.ts +15 -0
- package/src/modules/Orchestrator.js +27 -0
- package/src/modules/ReasoningNetwork.d.ts +18 -0
- package/src/modules/ReasoningNetwork.js +29 -0
- package/src/modules/index.js +25 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { HttpClient, DEFAULT_BASE_URL } = require('./core/httpClient');
|
|
4
|
+
const { TokenStore } = require('./core/tokenStore');
|
|
5
|
+
const { attachGeneratedModules } = require('./modules/index');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Main SDK entry point. Works in Node 18+ and any modern browser.
|
|
9
|
+
*
|
|
10
|
+
* const { Web6Client } = require('@oasisomniverse/web6-api');
|
|
11
|
+
* const web6 = new Web6Client({ baseUrl: 'https://api.web6.oasisomniverse.one' });
|
|
12
|
+
* web6.setToken(jwtToken); // reuse a WEB4 OASIS JWT - WEB6 has no auth of its own
|
|
13
|
+
* const { result } = await web6.completion.complete({ avatarId, messages: [...] });
|
|
14
|
+
*
|
|
15
|
+
* Every controller on the WEB6 AI Layer WebAPI is reachable as a lowerCamel
|
|
16
|
+
* property (web6.completion, web6.images, web6.holonicMemory, web6.holonicBraid,
|
|
17
|
+
* web6.orchestrator, web6.reasoningNetwork). Generated methods take a single
|
|
18
|
+
* args object; route template tokens (e.g. {taskType}) are consumed from it
|
|
19
|
+
* automatically, remaining keys become the query string (GET/DELETE) or JSON
|
|
20
|
+
* body (POST/PUT).
|
|
21
|
+
*/
|
|
22
|
+
class Web6Client {
|
|
23
|
+
constructor({ baseUrl = DEFAULT_BASE_URL, persistSession, fetchImpl } = {}) {
|
|
24
|
+
this.tokenStore = new TokenStore({ persist: persistSession });
|
|
25
|
+
this.http = new HttpClient({ baseUrl, tokenStore: this.tokenStore, fetchImpl });
|
|
26
|
+
|
|
27
|
+
attachGeneratedModules(this, this.http);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setBaseUrl(baseUrl) {
|
|
31
|
+
this.http.setBaseUrl(baseUrl);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* WEB6 is an internal AI layer sitting behind the same OASIS identity as
|
|
36
|
+
* WEB4/WEB5 - it has no avatar/auth endpoints of its own. Reuse a JWT you
|
|
37
|
+
* already obtained from the WEB4 OASIS API (or your own backend) here.
|
|
38
|
+
*/
|
|
39
|
+
setToken(jwtToken, sessionExtras = {}) {
|
|
40
|
+
this.tokenStore.setSession({ ...sessionExtras, jwtToken });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { Web6Client, HttpClient, TokenStore, DEFAULT_BASE_URL };
|
|
45
|
+
module.exports.default = Web6Client;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-types.js - do not hand-edit.
|
|
2
|
+
import type { OASISResponse } from '../core/types';
|
|
3
|
+
|
|
4
|
+
export declare class CompletionModule {
|
|
5
|
+
constructor(http: unknown);
|
|
6
|
+
|
|
7
|
+
/** POST v1/complete */
|
|
8
|
+
complete(args?: Record<string, any>): Promise<OASISResponse>;
|
|
9
|
+
|
|
10
|
+
/** GET v1/openserv/models */
|
|
11
|
+
openServModels(args?: Record<string, any>): Promise<OASISResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js from endpoints.json - do not hand-edit.
|
|
4
|
+
// Regenerate with: node scripts/generate-modules.js
|
|
5
|
+
|
|
6
|
+
const { makeOperation } = require('../core/routeHelper');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated wrapper for v1 (source: WEB6 AI Layer WebAPI CompletionController.cs).
|
|
10
|
+
* Every method takes a single args object: path-template tokens (e.g. {id})
|
|
11
|
+
* are consumed from it automatically; any remaining keys are sent as the
|
|
12
|
+
* query string (GET/DELETE) or JSON body (POST/PUT).
|
|
13
|
+
*/
|
|
14
|
+
class CompletionModule {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this._http = http;
|
|
17
|
+
|
|
18
|
+
// POST v1/complete
|
|
19
|
+
this.complete = makeOperation(http, "v1", "POST", "complete");
|
|
20
|
+
// GET v1/openserv/models
|
|
21
|
+
this.openServModels = makeOperation(http, "v1", "GET", "openserv/models");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { CompletionModule };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-types.js - do not hand-edit.
|
|
2
|
+
import type { OASISResponse } from '../core/types';
|
|
3
|
+
|
|
4
|
+
export declare class HolonicBraidModule {
|
|
5
|
+
constructor(http: unknown);
|
|
6
|
+
|
|
7
|
+
/** GET v1/holonic-braid/graph/{taskType} */
|
|
8
|
+
getGraph(args?: Record<string, any>): Promise<OASISResponse>;
|
|
9
|
+
|
|
10
|
+
/** POST v1/holonic-braid/graph/{taskType} */
|
|
11
|
+
saveGraph(args?: Record<string, any>): Promise<OASISResponse>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js from endpoints.json - do not hand-edit.
|
|
4
|
+
// Regenerate with: node scripts/generate-modules.js
|
|
5
|
+
|
|
6
|
+
const { makeOperation } = require('../core/routeHelper');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated wrapper for v1/holonic-braid (source: WEB6 AI Layer WebAPI HolonicBraidController.cs).
|
|
10
|
+
* Every method takes a single args object: path-template tokens (e.g. {id})
|
|
11
|
+
* are consumed from it automatically; any remaining keys are sent as the
|
|
12
|
+
* query string (GET/DELETE) or JSON body (POST/PUT).
|
|
13
|
+
*/
|
|
14
|
+
class HolonicBraidModule {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this._http = http;
|
|
17
|
+
|
|
18
|
+
// GET v1/holonic-braid/graph/{taskType}
|
|
19
|
+
this.getGraph = makeOperation(http, "v1/holonic-braid", "GET", "graph/{taskType}");
|
|
20
|
+
// POST v1/holonic-braid/graph/{taskType}
|
|
21
|
+
this.saveGraph = makeOperation(http, "v1/holonic-braid", "POST", "graph/{taskType}");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { HolonicBraidModule };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-types.js - do not hand-edit.
|
|
2
|
+
import type { OASISResponse } from '../core/types';
|
|
3
|
+
|
|
4
|
+
export declare class HolonicMemoryModule {
|
|
5
|
+
constructor(http: unknown);
|
|
6
|
+
|
|
7
|
+
/** GET v1/holonic-memory/earth */
|
|
8
|
+
getEarthHolon(args?: Record<string, any>): Promise<OASISResponse>;
|
|
9
|
+
|
|
10
|
+
/** POST v1/holonic-memory/holons (query: level, name, parentHolonId) */
|
|
11
|
+
getOrCreateHolon(args?: Record<string, any>): Promise<OASISResponse>;
|
|
12
|
+
|
|
13
|
+
/** POST v1/holonic-memory/holons/{childHolonId}/propagate */
|
|
14
|
+
propagate(args?: Record<string, any>): Promise<OASISResponse>;
|
|
15
|
+
|
|
16
|
+
/** POST v1/holonic-memory/holons/{holonId}/memory */
|
|
17
|
+
recordMemory(args?: Record<string, any>): Promise<OASISResponse>;
|
|
18
|
+
|
|
19
|
+
/** PUT v1/holonic-memory/holons/{holonId}/membrane-rule */
|
|
20
|
+
setMembraneRule(args?: Record<string, any>): Promise<OASISResponse>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js from endpoints.json - do not hand-edit.
|
|
4
|
+
// Regenerate with: node scripts/generate-modules.js
|
|
5
|
+
|
|
6
|
+
const { makeOperation } = require('../core/routeHelper');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated wrapper for v1/holonic-memory (source: WEB6 AI Layer WebAPI HolonicMemoryController.cs).
|
|
10
|
+
* Every method takes a single args object: path-template tokens (e.g. {id})
|
|
11
|
+
* are consumed from it automatically; any remaining keys are sent as the
|
|
12
|
+
* query string (GET/DELETE) or JSON body (POST/PUT).
|
|
13
|
+
*/
|
|
14
|
+
class HolonicMemoryModule {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this._http = http;
|
|
17
|
+
|
|
18
|
+
// GET v1/holonic-memory/earth
|
|
19
|
+
this.getEarthHolon = makeOperation(http, "v1/holonic-memory", "GET", "earth");
|
|
20
|
+
// POST v1/holonic-memory/holons (query: level, name, parentHolonId)
|
|
21
|
+
this.getOrCreateHolon = makeOperation(http, "v1/holonic-memory", "POST", "holons", {"query":["level","name","parentHolonId"]});
|
|
22
|
+
// POST v1/holonic-memory/holons/{childHolonId}/propagate
|
|
23
|
+
this.propagate = makeOperation(http, "v1/holonic-memory", "POST", "holons/{childHolonId}/propagate");
|
|
24
|
+
// POST v1/holonic-memory/holons/{holonId}/memory
|
|
25
|
+
this.recordMemory = makeOperation(http, "v1/holonic-memory", "POST", "holons/{holonId}/memory");
|
|
26
|
+
// PUT v1/holonic-memory/holons/{holonId}/membrane-rule
|
|
27
|
+
this.setMembraneRule = makeOperation(http, "v1/holonic-memory", "PUT", "holons/{holonId}/membrane-rule");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = { HolonicMemoryModule };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-types.js - do not hand-edit.
|
|
2
|
+
import type { OASISResponse } from '../core/types';
|
|
3
|
+
|
|
4
|
+
export declare class ImagesModule {
|
|
5
|
+
constructor(http: unknown);
|
|
6
|
+
|
|
7
|
+
/** POST v1/images/generate */
|
|
8
|
+
generate(args?: Record<string, any>): Promise<OASISResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js from endpoints.json - do not hand-edit.
|
|
4
|
+
// Regenerate with: node scripts/generate-modules.js
|
|
5
|
+
|
|
6
|
+
const { makeOperation } = require('../core/routeHelper');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated wrapper for v1/images (source: WEB6 AI Layer WebAPI ImagesController.cs).
|
|
10
|
+
* Every method takes a single args object: path-template tokens (e.g. {id})
|
|
11
|
+
* are consumed from it automatically; any remaining keys are sent as the
|
|
12
|
+
* query string (GET/DELETE) or JSON body (POST/PUT).
|
|
13
|
+
*/
|
|
14
|
+
class ImagesModule {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this._http = http;
|
|
17
|
+
|
|
18
|
+
// POST v1/images/generate
|
|
19
|
+
this.generate = makeOperation(http, "v1/images", "POST", "generate");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = { ImagesModule };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-types.js - do not hand-edit.
|
|
2
|
+
import type { OASISResponse } from '../core/types';
|
|
3
|
+
|
|
4
|
+
export declare class OrchestratorModule {
|
|
5
|
+
constructor(http: unknown);
|
|
6
|
+
|
|
7
|
+
/** GET v1/orchestrators/ */
|
|
8
|
+
getAdapters(args?: Record<string, any>): Promise<OASISResponse>;
|
|
9
|
+
|
|
10
|
+
/** POST v1/orchestrators/invoke */
|
|
11
|
+
invoke(args?: Record<string, any>): Promise<OASISResponse>;
|
|
12
|
+
|
|
13
|
+
/** POST v1/orchestrators/ */
|
|
14
|
+
registerAdapter(args?: Record<string, any>): Promise<OASISResponse>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js from endpoints.json - do not hand-edit.
|
|
4
|
+
// Regenerate with: node scripts/generate-modules.js
|
|
5
|
+
|
|
6
|
+
const { makeOperation } = require('../core/routeHelper');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated wrapper for v1/orchestrators (source: WEB6 AI Layer WebAPI OrchestratorController.cs).
|
|
10
|
+
* Every method takes a single args object: path-template tokens (e.g. {id})
|
|
11
|
+
* are consumed from it automatically; any remaining keys are sent as the
|
|
12
|
+
* query string (GET/DELETE) or JSON body (POST/PUT).
|
|
13
|
+
*/
|
|
14
|
+
class OrchestratorModule {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this._http = http;
|
|
17
|
+
|
|
18
|
+
// GET v1/orchestrators/
|
|
19
|
+
this.getAdapters = makeOperation(http, "v1/orchestrators", "GET", "");
|
|
20
|
+
// POST v1/orchestrators/invoke
|
|
21
|
+
this.invoke = makeOperation(http, "v1/orchestrators", "POST", "invoke");
|
|
22
|
+
// POST v1/orchestrators/
|
|
23
|
+
this.registerAdapter = makeOperation(http, "v1/orchestrators", "POST", "");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = { OrchestratorModule };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/generate-types.js - do not hand-edit.
|
|
2
|
+
import type { OASISResponse } from '../core/types';
|
|
3
|
+
|
|
4
|
+
export declare class ReasoningNetworkModule {
|
|
5
|
+
constructor(http: unknown);
|
|
6
|
+
|
|
7
|
+
/** POST v1/reasoning-network/dispatch */
|
|
8
|
+
dispatch(args?: Record<string, any>): Promise<OASISResponse>;
|
|
9
|
+
|
|
10
|
+
/** GET v1/reasoning-network/agents */
|
|
11
|
+
getAgents(args?: Record<string, any>): Promise<OASISResponse>;
|
|
12
|
+
|
|
13
|
+
/** POST v1/reasoning-network/agents */
|
|
14
|
+
registerAgent(args?: Record<string, any>): Promise<OASISResponse>;
|
|
15
|
+
|
|
16
|
+
/** POST v1/reasoning-network/agents/seed-openserv */
|
|
17
|
+
seedOpenServAgents(args?: Record<string, any>): Promise<OASISResponse>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js from endpoints.json - do not hand-edit.
|
|
4
|
+
// Regenerate with: node scripts/generate-modules.js
|
|
5
|
+
|
|
6
|
+
const { makeOperation } = require('../core/routeHelper');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generated wrapper for v1/reasoning-network (source: WEB6 AI Layer WebAPI ReasoningNetworkController.cs).
|
|
10
|
+
* Every method takes a single args object: path-template tokens (e.g. {id})
|
|
11
|
+
* are consumed from it automatically; any remaining keys are sent as the
|
|
12
|
+
* query string (GET/DELETE) or JSON body (POST/PUT).
|
|
13
|
+
*/
|
|
14
|
+
class ReasoningNetworkModule {
|
|
15
|
+
constructor(http) {
|
|
16
|
+
this._http = http;
|
|
17
|
+
|
|
18
|
+
// POST v1/reasoning-network/dispatch
|
|
19
|
+
this.dispatch = makeOperation(http, "v1/reasoning-network", "POST", "dispatch");
|
|
20
|
+
// GET v1/reasoning-network/agents
|
|
21
|
+
this.getAgents = makeOperation(http, "v1/reasoning-network", "GET", "agents");
|
|
22
|
+
// POST v1/reasoning-network/agents
|
|
23
|
+
this.registerAgent = makeOperation(http, "v1/reasoning-network", "POST", "agents");
|
|
24
|
+
// POST v1/reasoning-network/agents/seed-openserv
|
|
25
|
+
this.seedOpenServAgents = makeOperation(http, "v1/reasoning-network", "POST", "agents/seed-openserv");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { ReasoningNetworkModule };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// AUTO-GENERATED by scripts/generate-modules.js - do not hand-edit.
|
|
4
|
+
const { CompletionModule } = require('./Completion');
|
|
5
|
+
const { HolonicBraidModule } = require('./HolonicBraid');
|
|
6
|
+
const { HolonicMemoryModule } = require('./HolonicMemory');
|
|
7
|
+
const { ImagesModule } = require('./Images');
|
|
8
|
+
const { OrchestratorModule } = require('./Orchestrator');
|
|
9
|
+
const { ReasoningNetworkModule } = require('./ReasoningNetwork');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Attaches every generated module to the client under its lowerCamel controller
|
|
13
|
+
* name (e.g. client.completion, client.images, client.holonicMemory).
|
|
14
|
+
*/
|
|
15
|
+
function attachGeneratedModules(client, http) {
|
|
16
|
+
client.completion = client.completion || new CompletionModule(http);
|
|
17
|
+
client.holonicBraid = client.holonicBraid || new HolonicBraidModule(http);
|
|
18
|
+
client.holonicMemory = client.holonicMemory || new HolonicMemoryModule(http);
|
|
19
|
+
client.images = client.images || new ImagesModule(http);
|
|
20
|
+
client.orchestrator = client.orchestrator || new OrchestratorModule(http);
|
|
21
|
+
client.reasoningNetwork = client.reasoningNetwork || new ReasoningNetworkModule(http);
|
|
22
|
+
return client;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = { attachGeneratedModules };
|