Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.3.1
8.4.0
6 changes: 3 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ use_repo(llvm, "llvm_toolchain")

register_toolchains("@llvm_toolchain//:all")

bazel_dep(name = "rules_cc", version = "0.2.13")
bazel_dep(name = "rules_cc", version = "0.2.14")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")

# Google API bindings
bazel_dep(name = "googleapis", version = "0.0.0-20251003-2193a2bf", repo_name = "com_google_googleapis")
bazel_dep(name = "googleapis", version = "0.0.0-20251111-659ea6e9", repo_name = "com_google_googleapis")

switched_rules = use_extension("@com_google_googleapis//:extensions.bzl", "switched_rules")
switched_rules.use_languages(
Expand All @@ -69,7 +69,7 @@ use_repo(
##########
# Go
##########
bazel_dep(name = "gazelle", version = "0.46.0", repo_name = "bazel_gazelle")
bazel_dep(name = "gazelle", version = "0.47.0", repo_name = "bazel_gazelle")

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
use_repo(
Expand Down
33 changes: 33 additions & 0 deletions data_assets/platform_http_server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Data assets: Frontend

## Step 0: Setup your organization and solution

Export some variables related to the organization in order to build and install your data asset.

```bash
export INTRINSIC_ORG=intrinsic@intrinsic-prod-us
export INTRINSIC_SOLUTION=9999ffff-9999-ffff-9999-ffff9999ffff_BRANCH
```

## Step 1: Build your HMI as a data asset

First, you use a build rule (e.g., in Bazel) to define your data asset, which packages your static files into a versioned bundle.
Then, you use `inctl data install` to publish this bundle to the catalog.


```bash
bazel build //data_assets/platform_http_server/frontend_{x}:{intrinsic_data_name}
```

For example, `bazel build //data_assets/platform_http_server/frontend_2:hello_world_data_2`

## Step 2: Install the data asset to your solution

Use `inctl data install` with the local bundle file to install the data asset into your running solution. This makes the files available on the local filesystem where the Generic HMI Service can access them.

```bash
inctl data install bazel-bin/data_assets/platform_http_server/frontend_x/{intrinsic_data_name}.bundle.tar --solution YOUR_SOLUTION_ID
```
For example, `inctl data install bazel-bin/data_assets/platform_http_server/frontend_2/hello_world_data_2.bundle.tar --solution 1a23456b-78c9-0123-4de5-6f7g89h01i23_BRANCH`

**NOTE**: There is an example of a service that uses those data assets. Follow the guide [here](../../services/platform_http_server/README.md).
14 changes: 14 additions & 0 deletions data_assets/platform_http_server/frontend_1/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@ai_intrinsic_sdks//intrinsic/assets/data/build_defs:data.bzl", "intrinsic_data")

intrinsic_data(
name = "hello_world_data",
data = [
"dist/hello_world.css",
"dist/hello_world.html",
"dist/hello_world.js",
],
manifest = "hello_world.textproto",
deps = [
"@ai_intrinsic_sdks//intrinsic/assets/data/proto/v1:referenced_data_struct_proto",
],
)
61 changes: 61 additions & 0 deletions data_assets/platform_http_server/frontend_1/dist/hello_world.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* General body styles */
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
sans-serif;
background-color: #f0f2f5;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
text-align: center;
}

/* Heading styles */
h1 {
color: #1c1e21;
font-size: 2.5rem;
margin-bottom: 1.5rem;
}

/* Container for the button */
div {
margin-bottom: 1.5rem;
}

/* Button styles */
#load-operation-id {
background-color: #1877f2;
color: white;
border: none;
border-radius: 6px;
font-size: 1rem;
font-weight: bold;
padding: 12px 24px;
cursor: pointer;
transition: background-color 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Button hover effect */
#load-operation-id:hover {
background-color: #166fe5;
}

/* Paragraph styles for displaying the result */
p {
font-size: 1.1rem;
color: #606770;
}

/* Style for the operation ID itself */
#operation-id {
color: #0d1117;
background-color: #e4e6eb;
padding: 4px 8px;
border-radius: 4px;
font-family: monospace;
}
23 changes: 23 additions & 0 deletions data_assets/platform_http_server/frontend_1/dist/hello_world.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="hello_world.css" />
<title>HMI before</title>
</head>
<body>
<h1>This is the HMI frontend.</h1>

<div>
<button id="load-operation-id">Load operation ID</button>
</div>

<p>
Latest operation ID:
<strong id="operation-id">(press button to load)</strong>
</p>

<script type="text/javascript" src="hello_world.js"></script>
</body>
</html>
41 changes: 41 additions & 0 deletions data_assets/platform_http_server/frontend_1/dist/hello_world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const loadOperationIdBtn = document.getElementById("load-operation-id");
const operationIdEl = document.getElementById("operation-id");

loadOperationIdBtn.addEventListener("click", async () => {
operationIdEl.textContent = await fetchLatestOperationId();
});

/**
* A dummy function that simulates fetching data.
* It returns a hardcoded operation ID after a short delay to mimic a network request.
*/
async function fetchLatestOperationId() {
operationIdEl.textContent = "Loading..."; // Provide immediate user feedback

// Simulate a network delay of 500 milliseconds.
await new Promise((resolve) => setTimeout(resolve, 500));

try {
// This is our hardcoded dummy data. In a real scenario, this would
// come from a fetch() call to a server.
const dummyData = {
operations: [
{ name: "dummy-op-id-1a2b3c-4d5e6f" },
{ name: "another-dummy-op" },
],
};

// Simulate a successful response.
if (
Array.isArray(dummyData.operations) &&
dummyData.operations.length > 0
) {
return dummyData.operations[0].name;
} else {
return "No operation ID found";
}
} catch (e) {
console.error("Dummy fetch failed (this shouldn't happen):", e);
return "(error, see console for details)";
}
}
41 changes: 41 additions & 0 deletions data_assets/platform_http_server/frontend_1/hello_world.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# proto-file: intrinsic/assets/data/proto/v1/data_manifest.proto
# proto-message: DataManifest

metadata {
id {
package: "ai.intrinsic"
name: "hello_world"
}
display_name: "hello_world"
vendor {
display_name: "Intrinsic"
}
}
data {
[type.googleapis.com/intrinsic_proto.data.v1.ReferencedDataStruct] {
fields {
key: "hello_world.html"
value {
referenced_data_value: {
reference: "dist/hello_world.html"
}
}
}
fields {
key: "hello_world.css"
value {
referenced_data_value: {
reference: "dist/hello_world.css"
}
}
}
fields {
key: "hello_world.js"
value {
referenced_data_value: {
reference: "dist/hello_world.js"
}
}
}
}
}
14 changes: 14 additions & 0 deletions data_assets/platform_http_server/frontend_2/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
load("@ai_intrinsic_sdks//intrinsic/assets/data/build_defs:data.bzl", "intrinsic_data")

intrinsic_data(
name = "hello_world_data_2",
data = [
"dist/hello_world.css",
"dist/hello_world.html",
"dist/hello_world.js",
],
manifest = "hello_world.textproto",
deps = [
"@ai_intrinsic_sdks//intrinsic/assets/data/proto/v1:referenced_data_struct_proto",
],
)
61 changes: 61 additions & 0 deletions data_assets/platform_http_server/frontend_2/dist/hello_world.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* General body styles */
body {
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
sans-serif;
background-color: #f0f2f5;
color: #333;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
text-align: center;
}

/* Heading styles */
h1 {
color: #1c1e21;
font-size: 2.5rem;
margin-bottom: 1.5rem;
}

/* Container for the button */
div {
margin-bottom: 1.5rem;
}

/* Button styles */
#load-operation-id {
background-color: #1877f2;
color: white;
border: none;
border-radius: 6px;
font-size: 1rem;
font-weight: bold;
padding: 12px 24px;
cursor: pointer;
transition: background-color 0.3s ease;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Button hover effect */
#load-operation-id:hover {
background-color: #166fe5;
}

/* Paragraph styles for displaying the result */
p {
font-size: 1.1rem;
color: #606770;
}

/* Style for the operation ID itself */
#operation-id {
color: #0d1117;
background-color: #e4e6eb;
padding: 4px 8px;
border-radius: 4px;
font-family: monospace;
}
23 changes: 23 additions & 0 deletions data_assets/platform_http_server/frontend_2/dist/hello_world.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="hello_world.css" />
<title>HMI after</title>
</head>
<body>
<h1>This is the HMI frontend hot reloaded.</h1>

<div>
<button id="load-operation-id">Load operation ID</button>
</div>

<p>
Latest operation ID:
<strong id="operation-id">(press button to load)</strong>
</p>

<script type="text/javascript" src="hello_world.js"></script>
</body>
</html>
41 changes: 41 additions & 0 deletions data_assets/platform_http_server/frontend_2/dist/hello_world.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const loadOperationIdBtn = document.getElementById("load-operation-id");
const operationIdEl = document.getElementById("operation-id");

loadOperationIdBtn.addEventListener("click", async () => {
operationIdEl.textContent = await fetchLatestOperationId();
});

/**
* A dummy function that simulates fetching data.
* It returns a hardcoded operation ID after a short delay to mimic a network request.
*/
async function fetchLatestOperationId() {
operationIdEl.textContent = "Loading..."; // Provide immediate user feedback

// Simulate a network delay of 500 milliseconds.
await new Promise((resolve) => setTimeout(resolve, 500));

try {
// This is our hardcoded dummy data. In a real scenario, this would
// come from a fetch() call to a server.
const dummyData = {
operations: [
{ name: "dummy2-op-id-7g8h9i-0j1k2l" },
{ name: "second-dummy-op" },
],
};

// Simulate a successful response.
if (
Array.isArray(dummyData.operations) &&
dummyData.operations.length > 0
) {
return dummyData.operations[0].name;
} else {
return "No operation ID found";
}
} catch (e) {
console.error("Dummy fetch failed (this shouldn't happen):", e);
return "(error, see console for details)";
}
}
Loading
Loading