Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/actions/prune-repository/prune_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def test_sibling_or_website_job_does_not_add_brunch_extras(self) -> None:
self.assertEqual(extra_paths_for_requested({TRANSPORT}), [])
self.assertEqual(extra_paths_for_requested({WEBSITE}), [])

def test_transitive_core_in_the_closure_does_not_add_the_app(self) -> None:
def test_core_in_the_dependency_closure_does_not_add_the_app(self) -> None:
dependencies = {
WEBSITE: frozenset({TRANSPORT}),
TRANSPORT: frozenset({CORE}),
WEBSITE: frozenset({CORE, TRANSPORT}),
TRANSPORT: frozenset(),
CORE: frozenset(),
}
expanded = fixpoint_expand({WEBSITE}, dependencies)
Expand Down
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ approvedGitRepositories: []

defaultSemverRangePrefix: ""

enableConstraintsChecks: true
Comment thread
indietyp marked this conversation as resolved.

enableScripts: false

enableTransparentWorkspaces: false
Expand Down
1 change: 1 addition & 0 deletions apps/petrinaut-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
},
"dependencies": {
"@ai-sdk/openai": "3.0.63",
"@hashintel/brunch-agent": "workspace:*",
"@hashintel/brunch-agent-transport-aisdk": "workspace:*",
"@hashintel/ds-components": "workspace:*",
"@hashintel/ds-helpers": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
type BrunchAskOutput,
parseBrunchAskInput,
parseBrunchAskOutput,
} from "@hashintel/brunch-agent-transport-aisdk/client-tools";
} from "@hashintel/brunch-agent/client-tools";
import { css } from "@hashintel/ds-helpers/css";
import {
definePetrinautAiInteractiveTool,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
BrunchAskInput,
BrunchAskOutput,
} from "@hashintel/brunch-agent-transport-aisdk/client-tools";
} from "@hashintel/brunch-agent/client-tools";

export const brunchAskFromComposerText = ({
text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SWEEP_TOOL_NAME } from "@hashintel/brunch-agent-transport-aisdk/client-tools";
import { SWEEP_TOOL_NAME } from "@hashintel/brunch-agent/client-tools";

import { sweepOutputSchema } from "../brunch-sweep-output";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from "vitest";

import { ASK_TOOL_NAME } from "@hashintel/brunch-agent-transport-aisdk/client-tools";
import { ASK_TOOL_NAME } from "@hashintel/brunch-agent/client-tools";

import {
hashCanonicalSpeechText,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ASK_TOOL_NAME,
parseBrunchAskInput,
} from "@hashintel/brunch-agent-transport-aisdk/client-tools";
} from "@hashintel/brunch-agent/client-tools";

import { hashCanonicalSpeechText } from "../../../canonical-speech-fingerprint";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from "vitest";

import { SWEEP_TOOL_NAME } from "@hashintel/brunch-agent-transport-aisdk/client-tools";
import { SWEEP_TOOL_NAME } from "@hashintel/brunch-agent/client-tools";

import { selectInterviewCoverage } from "./interview-coverage";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SWEEP_TOOL_NAME } from "@hashintel/brunch-agent-transport-aisdk/client-tools";
import { SWEEP_TOOL_NAME } from "@hashintel/brunch-agent/client-tools";

import { sweepOutputSchema } from "../brunch-sweep-output";

Expand Down
21 changes: 19 additions & 2 deletions libs/@hashintel/brunch-agent/packages/core/src/client-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,22 @@
* Browser-safe source contracts for Brunch tools rendered by a host UI.
*/

export { AskInput, AskSubmission } from "./ask-tool-contract";
export { toolName, type ToolName } from "./naming";
import * as v from "valibot";

import { AskInput, AskSubmission } from "./ask-tool-contract";
import { toolName } from "./naming";

export { AskInput, AskSubmission, toolName };
export type { ToolName } from "./naming";

export const ASK_TOOL_NAME = toolName("ask");
export const SWEEP_TOOL_NAME = toolName("sweep");

export type BrunchAskInput = v.InferOutput<typeof AskInput>;
export type BrunchAskOutput = v.InferOutput<typeof AskSubmission>;

export const parseBrunchAskInput = (input: unknown): BrunchAskInput =>
v.parse(AskInput, input);

export const parseBrunchAskOutput = (output: unknown): BrunchAskOutput =>
v.parse(AskSubmission, output);
9 changes: 9 additions & 0 deletions libs/@hashintel/brunch-agent/packages/core/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
},
"linear:graph": {
"cache": false
},
"test:unit": {
"inputs": [
"$TURBO_DEFAULT$",
"$TURBO_ROOT$/apps/brunch-agent/**",
Comment thread
lunelson marked this conversation as resolved.
"$TURBO_ROOT$/libs/@hashintel/brunch-agent/**",
"!$TURBO_ROOT$/apps/brunch-agent/**/{.flue,.turbo,dist,node_modules}/**",
"!$TURBO_ROOT$/libs/@hashintel/brunch-agent/**/{.flue,.turbo,dist,node_modules}/**"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
{
"name": "@hashintel/petrinaut",
"message": "Brunch libraries must not depend on Petrinaut implementations."
},
{
"name": "@hashintel/brunch-agent",
"message": "Brunch transports must remain independent of Brunch core."
}
],
"patterns": [
Expand All @@ -38,8 +42,8 @@
"message": "Brunch transports must remain substrate-independent."
},
{
"group": ["@hashintel/brunch-agent-*"],
"message": "A transport may depend inward on the harness, not on Brunch extensions."
"group": ["@hashintel/brunch-agent/*", "@hashintel/brunch-agent-*"],
"message": "Brunch transports must remain independent of Brunch core and extensions."
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
"types": "./src/index.ts",
"import": "./dist/index.js"
},
"./client-tools": {
"types": "./src/client-tools.ts",
"import": "./dist/client-tools.js"
},
"./headers": {
"types": "./src/headers.ts",
"import": "./dist/headers.js"
Expand All @@ -27,7 +23,6 @@
"test:unit": "vitest run"
},
"dependencies": {
"@hashintel/brunch-agent": "workspace:*",
"ai": "6.0.182",
"valibot": "1.4.2"
},
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,14 @@ export default defineConfig({
build: {
lib: {
entry: {
"client-tools": fileURLToPath(
new URL("src/client-tools.ts", import.meta.url),
),
headers: fileURLToPath(new URL("src/headers.ts", import.meta.url)),
index: fileURLToPath(new URL("src/index.ts", import.meta.url)),
},
fileName: (_format, entryName) => `${entryName}.js`,
formats: ["es"],
},
rolldownOptions: {
external: [/^@hashintel\/brunch-agent(?:\/.*)?$/u, "ai", "valibot"],
external: ["ai", "valibot"],
},
sourcemap: true,
},
Expand Down
29 changes: 29 additions & 0 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ const ignoredWorkspaces = [];

const allowedGitDependencies = [];

const brunchAgentCore = "@hashintel/brunch-agent";
const brunchAgentTransportPrefix = `${brunchAgentCore}-transport-`;
const brunchSubstrateScopes = ["@earendil-works/", "@flue/"];

/**
* Lifecycle scripts which Yarn runs as part of `yarn install`.
*/
Expand Down Expand Up @@ -319,12 +323,37 @@ function enforceNoInstallScripts({ Yarn }) {
}
}

/**
* Keeps transport packages independent of Brunch mechanism and substrates.
*
* @param {Context} context - The Yarn constraint context.
*/
function enforceBrunchTransportBoundary({ Yarn }) {
Comment thread
indietyp marked this conversation as resolved.
for (const dependency of Yarn.dependencies()) {
if (
!dependency.workspace.ident.startsWith(brunchAgentTransportPrefix) ||
(dependency.ident !== brunchAgentCore &&
!dependency.ident.startsWith(`${brunchAgentCore}-`) &&
!brunchSubstrateScopes.some((scope) =>
dependency.ident.startsWith(scope),
))
) {
continue;
}

dependency.error(
`${dependency.workspace.ident} is a transport and cannot depend on ${dependency.ident}`,
);
}
}

module.exports = defineConfig({
async constraints(context) {
enforceConsistentDependenciesAcrossTheProject(context);
enforceNoDualTypeDependencies(context);
enforceProtocols(context);
enforceDevDependenciesAreProperlyDeclared(context);
enforceNoInstallScripts(context);
enforceBrunchTransportBoundary(context);
},
});
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ __metadata:
dependencies:
"@ai-sdk/openai": "npm:3.0.63"
"@fast-check/vitest": "npm:0.4.1"
"@hashintel/brunch-agent": "workspace:*"
"@hashintel/brunch-agent-transport-aisdk": "workspace:*"
"@hashintel/ds-components": "workspace:*"
"@hashintel/ds-helpers": "workspace:*"
Expand Down Expand Up @@ -7437,7 +7438,6 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hashintel/brunch-agent-transport-aisdk@workspace:libs/@hashintel/brunch-agent/packages/transport-aisdk"
dependencies:
"@hashintel/brunch-agent": "workspace:*"
"@types/node": "npm:22.18.13"
"@typescript/native-preview": "npm:7.0.0-dev.20260511.1"
ai: "npm:6.0.182"
Expand Down
Loading