@trackunit/iris-app 2.16.5 → 2.16.6-alpha-2f5decf56c8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app",
3
- "version": "2.16.5",
3
+ "version": "2.16.6-alpha-2f5decf56c8.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "main": "src/index.js",
6
6
  "generators": "./generators.json",
@@ -10,7 +10,7 @@
10
10
  "node": ">=24.x"
11
11
  },
12
12
  "dependencies": {
13
- "@trackunit/css-classname-utils": "0.0.114",
13
+ "@trackunit/css-classname-utils": "0.0.115-alpha-2f5decf56c8.0",
14
14
  "@typescript-eslint/types": "8.71.2",
15
15
  "@typescript-eslint/typescript-estree": "8.71.2",
16
16
  "pacote": "^21.5.1",
@@ -26,10 +26,10 @@
26
26
  "@nx/react": "23.3.0",
27
27
  "@npmcli/arborist": "^9.1.9",
28
28
  "win-ca": "^3.5.1",
29
- "@trackunit/iris-app-build-utilities": "3.0.20",
30
- "@trackunit/react-graphql-tools": "1.23.37",
31
- "@trackunit/shared-utils": "1.22.33",
32
- "@trackunit/iris-app-api": "2.13.8",
29
+ "@trackunit/iris-app-build-utilities": "3.0.21-alpha-2f5decf56c8.0",
30
+ "@trackunit/react-graphql-tools": "1.23.38-alpha-2f5decf56c8.0",
31
+ "@trackunit/shared-utils": "1.22.34-alpha-2f5decf56c8.0",
32
+ "@trackunit/iris-app-api": "2.13.9-alpha-2f5decf56c8.0",
33
33
  "tslib": "^2.6.2",
34
34
  "@clack/prompts": "^1.8.1",
35
35
  "@nx/devkit": "23.3.0",
@@ -0,0 +1,9 @@
1
+ # Environment variables for local development
2
+ # Copy this file to .env and fill in your values
3
+ #
4
+ # These variables are read by getSecret() from @trackunit/serverside-utils
5
+ # The env var name must match the secretKey parameter exactly
6
+ #
7
+ # Example:
8
+ # const apiKey = await getSecret({ context: c, secretKey: "API_KEY" });
9
+ # API_KEY=your_api_key_here
@@ -0,0 +1,16 @@
1
+ import { AiToolsExtensionManifest } from '@trackunit/iris-app-api';
2
+ import { toManifestAiTools } from '@trackunit/serverside-ai-tools';
3
+ import { tools } from './src/tools';
4
+
5
+ const aiToolsExtensionManifest: AiToolsExtensionManifest = {
6
+ id: "<%= projectName %>",
7
+ type: "AI_TOOLS_EXTENSION",
8
+ runtime: "DENO",
9
+ sourceRoot: "dist/<%= projectRoot %>/",
10
+ dependencyDefinitionFile: "dist/<%= dependencyDefinitionFile %>",
11
+ name: "AI tools <%= projectName %>",
12
+ main: "index.js",
13
+ aiTools: toManifestAiTools(tools),
14
+ };
15
+
16
+ export default aiToolsExtensionManifest;
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "<%= importPath %>",
3
+ "type": "commonjs",
4
+ "dependencies": {
5
+ "@hono/node-server": "^1.19.17",
6
+ "dotenv": "16.3.1",
7
+ "hono": "^4.13.5",
8
+ "zod": "^3.25.76"
9
+ }
10
+ }
@@ -0,0 +1,9 @@
1
+ import { createAiToolsApp } from "@trackunit/serverside-ai-tools";
2
+ import { tools } from "./tools";
3
+
4
+ export default createAiToolsApp(tools, {
5
+ requiredScope: "account.view",
6
+ handlers: {
7
+ get_greeting: (_context, { name }) => ({ content: [{ type: "text", text: `Hello, ${name}!` }] }),
8
+ },
9
+ }).fetch;
@@ -0,0 +1,11 @@
1
+ // Auto-generated: mimics the production serverside runtime for local development.
2
+ // Do not edit — SDK updates may overwrite changes.
3
+ import "dotenv/config";
4
+
5
+ import { serve } from "@hono/node-server";
6
+
7
+ import handler from "./index";
8
+
9
+ const port = Number(process.env.PORT) || 8000;
10
+
11
+ serve({ fetch: handler, port });
@@ -0,0 +1,17 @@
1
+ import { defineAiTools } from "@trackunit/serverside-ai-tools";
2
+ import { z } from "zod";
3
+
4
+ // Definitions only: extension-manifest.ts imports this file at build time.
5
+ // AI clients see the tools as `<namespace>_<name>`. Pick a short namespace that names your app: it must be
6
+ // unique across Trackunit, and submit rejects a reserved or taken one.
7
+ export const tools = defineAiTools({
8
+ namespace: "<%= aiToolsNamespace %>",
9
+ tools: {
10
+ get_greeting: {
11
+ title: "Get greeting",
12
+ description: "Returns a greeting for the given name. Replace this example with your app's tools.",
13
+ inputSchema: { name: z.string().min(1).describe("Who to greet.") },
14
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
15
+ },
16
+ },
17
+ });
@@ -5,7 +5,7 @@ describe("extension manifest", () => {
5
5
  expect(extensionManifest).toMatchObject({
6
6
  id: "<%= projectName %>",
7
7
  type: "<%= type %>",
8
- sourceRoot: "<% if (type === 'SERVERSIDE_API_EXTENSION') { %>dist/<%= projectRoot %>/<% } else { %><%= sourceRoot %><% } %>",
8
+ sourceRoot: "<% if (type === 'SERVERSIDE_API_EXTENSION' || type === 'AI_TOOLS_EXTENSION') { %>dist/<%= projectRoot %>/<% } else { %><%= sourceRoot %><% } %>",
9
9
  });
10
10
  });
11
11
  });
@@ -10,6 +10,11 @@ type ServersideGraphqlOptions = {
10
10
  * Adds public-schema codegen and a typed Hono example to a generated serverside extension.
11
11
  */
12
12
  export declare const addServersideGraphql: (tree: Tree, options: ServersideGraphqlOptions) => Promise<void>;
13
+ /**
14
+ * A valid aiTools namespace from the project name: kebab-case, starting with a letter, short enough that
15
+ * `<namespace>_<tool>` stays within the 60 characters AI clients allow.
16
+ */
17
+ export declare const toAiToolsNamespace: (projectName: string) => string;
13
18
  /**
14
19
  * Iris App Extension Generator.
15
20
  *
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IrisAppExtensionGenerator = exports.addServersideGraphql = void 0;
3
+ exports.IrisAppExtensionGenerator = exports.toAiToolsNamespace = exports.addServersideGraphql = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const eslint_1 = require("@nx/eslint");
@@ -55,6 +55,19 @@ const addServersideGraphql = async (tree, options) => {
55
55
  });
56
56
  };
57
57
  exports.addServersideGraphql = addServersideGraphql;
58
+ /**
59
+ * A valid aiTools namespace from the project name: kebab-case, starting with a letter, short enough that
60
+ * `<namespace>_<tool>` stays within the 60 characters AI clients allow.
61
+ */
62
+ const toAiToolsNamespace = (projectName) => {
63
+ const kebab = projectName
64
+ .toLowerCase()
65
+ .replace(/[^a-z0-9]+/g, "-")
66
+ .replace(/^-+|-+$/g, "");
67
+ const namespace = /^[a-z]/.test(kebab) ? kebab : `app-${kebab}`;
68
+ return namespace.slice(0, 30).replace(/-+$/, "");
69
+ };
70
+ exports.toAiToolsNamespace = toAiToolsNamespace;
58
71
  const getPackageVersion = async (packageName) => (await (0, get_package_manifest_1.getPackageManifest)(packageName)).version;
59
72
  function normalizeOptions(tree, options) {
60
73
  const name = (0, devkit_1.names)(options.name).fileName;
@@ -95,6 +108,7 @@ const IrisAppExtensionGenerator = async function (tree, options) {
95
108
  ...normalizedOptions,
96
109
  ...(0, devkit_1.names)(normalizedOptions.name),
97
110
  offsetFromRoot: (0, devkit_1.offsetFromRoot)(normalizedOptions.projectRoot),
111
+ aiToolsNamespace: (0, exports.toAiToolsNamespace)(normalizedOptions.projectName),
98
112
  template: "",
99
113
  };
100
114
  const irisAppExtensionType = normalizedOptions.type;
@@ -230,6 +244,20 @@ const IrisAppExtensionGenerator = async function (tree, options) {
230
244
  return projectJson;
231
245
  });
232
246
  }
247
+ if (irisAppExtensionType === "AI_TOOLS_EXTENSION") {
248
+ const serversideAiToolsVersion = await getPackageVersion("@trackunit/serverside-ai-tools");
249
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(normalizedOptions.projectRoot, "package.json"), packageJson => {
250
+ packageJson.dependencies = {
251
+ ...packageJson.dependencies,
252
+ "@trackunit/serverside-ai-tools": serversideAiToolsVersion,
253
+ };
254
+ return packageJson;
255
+ });
256
+ if (normalizedOptions.updatePackageJson) {
257
+ // The extension manifest imports the package at build time, from the workspace.
258
+ (0, devkit_1.addDependenciesToPackageJson)(tree, { "@trackunit/serverside-ai-tools": serversideAiToolsVersion }, {});
259
+ }
260
+ }
233
261
  if (normalizedOptions.graphql) {
234
262
  await (0, exports.addServersideGraphql)(tree, {
235
263
  projectName: normalizedOptions.projectName,
@@ -14,6 +14,7 @@ export interface IrisAppExtensionGeneratorSchema {
14
14
  | "ASSET_HOME_EXTENSION"
15
15
  | "ASSET_EVENTS_ACTIONS_EXTENSION"
16
16
  | "LIFECYCLE_EXTENSION"
17
- | "SERVERSIDE_API_EXTENSION";
17
+ | "SERVERSIDE_API_EXTENSION"
18
+ | "AI_TOOLS_EXTENSION";
18
19
  graphql?: boolean;
19
20
  }
@@ -56,7 +56,8 @@
56
56
  "CUSTOMER_HOME_EXTENSION",
57
57
  "IRIS_APP_SETTINGS_EXTENSION",
58
58
  "LIFECYCLE_EXTENSION",
59
- "SERVERSIDE_API_EXTENSION"
59
+ "SERVERSIDE_API_EXTENSION",
60
+ "AI_TOOLS_EXTENSION"
60
61
  ]
61
62
  }
62
63
  },