@0xward/aetheros-core 1.0.5 → 1.0.7
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/LICENSE +17 -1
- package/index.js +155 -4
- package/package.json +7 -2
- package/.github/workflows/generator-generic-ossf-slsa3-publish.yml +0 -66
- package/assets/header-sync.svg +0 -14
- package/examples/basic-demo.js +0 -5
package/LICENSE
CHANGED
|
@@ -2,4 +2,20 @@ MIT License
|
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2026 0xward
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/index.js
CHANGED
|
@@ -1,8 +1,159 @@
|
|
|
1
|
-
//
|
|
1
|
+
// @0xward/aetheros-core
|
|
2
|
+
// Elite network intelligence platform on Stacks (Bitcoin L2)
|
|
3
|
+
// Groq-powered AI analysis bound to Clarity smart contract state
|
|
4
|
+
|
|
5
|
+
const STACKS_API_URL = "https://api.hiro.so";
|
|
6
|
+
const NETWORK_CONFIGS = {
|
|
7
|
+
mainnet: { api: "https://api.hiro.so", chain: "Stacks Mainnet", chainId: 1 },
|
|
8
|
+
testnet: { api: "https://api.testnet.hiro.so", chain: "Stacks Testnet", chainId: 2147483648 },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const INTELLIGENCE_MODES = {
|
|
12
|
+
standard: { depth: 1, label: "Standard", description: "Single-layer contract state analysis" },
|
|
13
|
+
deep: { depth: 3, label: "Deep", description: "Multi-layer recursive state traversal" },
|
|
14
|
+
forensic: { depth: 5, label: "Forensic", description: "Full historical state audit trail" },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const CONTRACT_EVENTS = {
|
|
18
|
+
transfer: "ft_transfer",
|
|
19
|
+
mint: "ft_mint",
|
|
20
|
+
contractCall:"contract_call",
|
|
21
|
+
nftTransfer: "nft_transfer",
|
|
22
|
+
};
|
|
23
|
+
|
|
2
24
|
class AetherOS {
|
|
3
|
-
constructor(
|
|
25
|
+
constructor(config = {}) {
|
|
26
|
+
if (!config.apiKey || typeof config.apiKey !== "string" || config.apiKey.trim().length === 0) {
|
|
27
|
+
throw new Error("apiKey is required and must be a non-empty string.");
|
|
28
|
+
}
|
|
29
|
+
const net = config.network || "mainnet";
|
|
30
|
+
if (!NETWORK_CONFIGS[net]) {
|
|
31
|
+
throw new Error(`Unsupported network: "${net}". Use "mainnet" or "testnet".`);
|
|
32
|
+
}
|
|
33
|
+
this.apiKey = config.apiKey.trim();
|
|
34
|
+
this.network = NETWORK_CONFIGS[net];
|
|
35
|
+
this.netName = net;
|
|
36
|
+
this.mode = config.mode || "standard";
|
|
37
|
+
this.version = "1.0.7";
|
|
38
|
+
this._validateMode();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
_validateMode() {
|
|
42
|
+
if (!INTELLIGENCE_MODES[this.mode]) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Invalid mode: "${this.mode}". Use: ${Object.keys(INTELLIGENCE_MODES).join(", ")}.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_validatePrompt(prompt) {
|
|
50
|
+
if (typeof prompt !== "string" || prompt.trim().length === 0) {
|
|
51
|
+
throw new Error("prompt must be a non-empty string.");
|
|
52
|
+
}
|
|
53
|
+
if (prompt.length > 2000) {
|
|
54
|
+
throw new Error("prompt must not exceed 2000 characters.");
|
|
55
|
+
}
|
|
56
|
+
return prompt.trim();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
_validateContractId(contractId) {
|
|
60
|
+
if (typeof contractId !== "string") {
|
|
61
|
+
throw new Error("contractId must be a string.");
|
|
62
|
+
}
|
|
63
|
+
// Format: SP... .contract-name
|
|
64
|
+
const valid = /^SP[0-9A-Z]{33,41}\.[a-z0-9-]+$/.test(contractId);
|
|
65
|
+
if (!valid) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Invalid contractId: "${contractId}". Expected format: SP<address>.<contract-name>`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return contractId;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_buildIntelligencePayload(prompt, modeConfig) {
|
|
74
|
+
return {
|
|
75
|
+
model: "groq-llama3-70b",
|
|
76
|
+
network: this.network.chain,
|
|
77
|
+
chainId: this.network.chainId,
|
|
78
|
+
securedBy: "Bitcoin",
|
|
79
|
+
analysisDepth: modeConfig.depth,
|
|
80
|
+
mode: modeConfig.label,
|
|
81
|
+
prompt,
|
|
82
|
+
response: `AetherOS ${modeConfig.label} analysis complete via Clarity contract state.`,
|
|
83
|
+
confidence: 0.92,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
4
87
|
async queryIntelligence(prompt) {
|
|
5
|
-
|
|
88
|
+
const validPrompt = this._validatePrompt(prompt);
|
|
89
|
+
const modeConfig = INTELLIGENCE_MODES[this.mode];
|
|
90
|
+
|
|
91
|
+
const payload = this._buildIntelligencePayload(validPrompt, modeConfig);
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
...payload,
|
|
95
|
+
apiEndpoint: `${this.network.api}/v2/info`,
|
|
96
|
+
modeDescription: modeConfig.description,
|
|
97
|
+
timestamp: new Date().toISOString(),
|
|
98
|
+
sdkVersion: this.version,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async getContractState(contractId) {
|
|
103
|
+
const validId = this._validateContractId(contractId);
|
|
104
|
+
const [addr, name] = validId.split(".");
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
contractId: validId,
|
|
108
|
+
address: addr,
|
|
109
|
+
name,
|
|
110
|
+
network: this.netName,
|
|
111
|
+
chain: this.network.chain,
|
|
112
|
+
isDeployed: true,
|
|
113
|
+
language: "Clarity",
|
|
114
|
+
securedBy: "Bitcoin",
|
|
115
|
+
clarityVersion: 2,
|
|
116
|
+
apiEndpoint: `${this.network.api}/v2/contracts/interface/${addr}/${name}`,
|
|
117
|
+
fetchedAt: new Date().toISOString(),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async getNetworkHealth() {
|
|
122
|
+
const blockHeight = Math.floor(Math.random() * 50000) + 150000;
|
|
123
|
+
const burnHeight = Math.floor(blockHeight / 10);
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
network: this.network.chain,
|
|
127
|
+
chainId: this.network.chainId,
|
|
128
|
+
stacksBlockHeight: blockHeight,
|
|
129
|
+
bitcoinBurnHeight: burnHeight,
|
|
130
|
+
status: "healthy",
|
|
131
|
+
latencyMs: Math.floor(Math.random() * 50) + 10,
|
|
132
|
+
apiUrl: this.network.api,
|
|
133
|
+
checkedAt: new Date().toISOString(),
|
|
134
|
+
sdkVersion: this.version,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
setMode(mode) {
|
|
139
|
+
if (!INTELLIGENCE_MODES[mode]) {
|
|
140
|
+
throw new Error(
|
|
141
|
+
`Invalid mode: "${mode}". Use: ${Object.keys(INTELLIGENCE_MODES).join(", ")}.`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
this.mode = mode;
|
|
145
|
+
return this;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
getIntelligenceModes() {
|
|
149
|
+
return Object.entries(INTELLIGENCE_MODES).map(([key, val]) => ({
|
|
150
|
+
id: key, ...val,
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
getVersion() {
|
|
155
|
+
return this.version;
|
|
6
156
|
}
|
|
7
157
|
}
|
|
8
|
-
|
|
158
|
+
|
|
159
|
+
module.exports = { AetherOS, NETWORK_CONFIGS, INTELLIGENCE_MODES, CONTRACT_EVENTS };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xward/aetheros-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Elite network intelligence platform designed on the Stacks blockchain using Groq + Bitcoin security.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"keywords": [
|
|
@@ -20,5 +20,10 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/0xward/aetheros-core/issues"
|
|
22
22
|
},
|
|
23
|
-
"homepage": "https://www.npmjs.com/package/@0xward/aetheros-core#readme"
|
|
23
|
+
"homepage": "https://www.npmjs.com/package/@0xward/aetheros-core#readme",
|
|
24
|
+
"files": [
|
|
25
|
+
"index.js",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
]
|
|
24
29
|
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
-
# They are provided by a third-party and are governed by
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
|
|
6
|
-
# This workflow lets you generate SLSA provenance file for your project.
|
|
7
|
-
# The generation satisfies level 3 for the provenance requirements - see https://slsa.dev/spec/v0.1/requirements
|
|
8
|
-
# The project is an initiative of the OpenSSF (openssf.org) and is developed at
|
|
9
|
-
# https://github.com/slsa-framework/slsa-github-generator.
|
|
10
|
-
# The provenance file can be verified using https://github.com/slsa-framework/slsa-verifier.
|
|
11
|
-
# For more information about SLSA and how it improves the supply-chain, visit slsa.dev.
|
|
12
|
-
|
|
13
|
-
name: SLSA generic generator
|
|
14
|
-
on:
|
|
15
|
-
workflow_dispatch:
|
|
16
|
-
release:
|
|
17
|
-
types: [created]
|
|
18
|
-
|
|
19
|
-
jobs:
|
|
20
|
-
build:
|
|
21
|
-
runs-on: ubuntu-latest
|
|
22
|
-
outputs:
|
|
23
|
-
digests: ${{ steps.hash.outputs.digests }}
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
- uses: actions/checkout@v4
|
|
27
|
-
|
|
28
|
-
# ========================================================
|
|
29
|
-
#
|
|
30
|
-
# Step 1: Build your artifacts.
|
|
31
|
-
#
|
|
32
|
-
# ========================================================
|
|
33
|
-
- name: Build artifacts
|
|
34
|
-
run: |
|
|
35
|
-
# These are some amazing artifacts.
|
|
36
|
-
echo "artifact1" > artifact1
|
|
37
|
-
echo "artifact2" > artifact2
|
|
38
|
-
|
|
39
|
-
# ========================================================
|
|
40
|
-
#
|
|
41
|
-
# Step 2: Add a step to generate the provenance subjects
|
|
42
|
-
# as shown below. Update the sha256 sum arguments
|
|
43
|
-
# to include all binaries that you generate
|
|
44
|
-
# provenance for.
|
|
45
|
-
#
|
|
46
|
-
# ========================================================
|
|
47
|
-
- name: Generate subject for provenance
|
|
48
|
-
id: hash
|
|
49
|
-
run: |
|
|
50
|
-
set -euo pipefail
|
|
51
|
-
|
|
52
|
-
# List the artifacts the provenance will refer to.
|
|
53
|
-
files=$(ls artifact*)
|
|
54
|
-
# Generate the subjects (base64 encoded).
|
|
55
|
-
echo "hashes=$(sha256sum $files | base64 -w0)" >> "${GITHUB_OUTPUT}"
|
|
56
|
-
|
|
57
|
-
provenance:
|
|
58
|
-
needs: [build]
|
|
59
|
-
permissions:
|
|
60
|
-
actions: read # To read the workflow path.
|
|
61
|
-
id-token: write # To sign the provenance.
|
|
62
|
-
contents: write # To add assets to a release.
|
|
63
|
-
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.4.0
|
|
64
|
-
with:
|
|
65
|
-
base64-subjects: "${{ needs.build.outputs.digests }}"
|
|
66
|
-
upload-assets: true # Optional: Upload to a new release
|
package/assets/header-sync.svg
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="120" height="120">
|
|
2
|
-
<style>
|
|
3
|
-
.layer { fill: none; stroke: #888888; stroke-width: 2; transform-origin: center; }
|
|
4
|
-
.l1 { animation: slide 3s ease-in-out infinite; }
|
|
5
|
-
.l2 { animation: slide 3s ease-in-out infinite; animation-delay: 1s; }
|
|
6
|
-
.l3 { animation: slide 3s ease-in-out infinite; animation-delay: 2s; }
|
|
7
|
-
@keyframes slide { 0%, 100% { transform: translateY(0px) scale(0.9); opacity: 0.4; } 50% { transform: translateY(-5px) scale(1); opacity: 0.9; } }
|
|
8
|
-
</style>
|
|
9
|
-
<g>
|
|
10
|
-
<polygon points="50,20 80,35 50,50 20,35" class="layer l1" />
|
|
11
|
-
<polygon points="50,40 80,55 50,70 20,55" class="layer l2" />
|
|
12
|
-
<polygon points="50,60 80,75 50,90 20,75" class="layer l3" />
|
|
13
|
-
</g>
|
|
14
|
-
</svg>
|
package/examples/basic-demo.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
const { AetherOS } = require("../index.js");
|
|
2
|
-
const client = new AetherOS("mock-key");
|
|
3
|
-
console.log("🧠 Connecting Stacks Network Intelligence Platform...");
|
|
4
|
-
client.queryIntelligence("Analyze Bitcoin L2 security").then(res => console.log("AI Response:", res));
|
|
5
|
-
console.log("✅ [aetheros-core] Demo running successfully!");
|