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
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ Repository-wide rules. `apps/*` have their own AGENTS.md with the rules for that

## Boundaries

- Interchange is stock. Code lives in `apps/*`, `packages/*`, and `workflows/*`.
- Interchange is stock. Code lives in `apps/*` and `packages/*`.
- `vendor/intx` holds hand-copied fallbacks for capabilities not yet published to npm, tracked with kill dates in [VENDORED.md](VENDORED.md); the upstream repository is never modified.

## Architecture

- **Stock first.** Before writing logic, look for an Interchange route or primitive that already does it (see the reference below). Never reimplement credential resolution, agent launch, session orchestration, inference, ID generation, or the workflow runtime — consume `@intx/*` as published packages.
- **Hub mounts only stock + Corbits libraries.** The hub mounts stock `@intx/hub-api` routes plus one Corbits mount block (`@corbits/mailbox`, `@corbits/memory`, `@corbits/artifacts`, `@corbits/webhooks`, `@corbits/cron`, `@corbits/mcp`, `@corbits/agent-token`, and OAuth login/refresh on `@corbits/oauth-core`); any other hub mount is cutover debt with a Linear issue, never a pattern to extend.
- **A workbench is a plain Interchange tenant, nothing more.** The web client converges its own tenant, workflow deployments, credentials, and grants over stock routes on start; the hub never seeds data on a client's behalf.
- **Apps stay generic; packages own the domain.** A product rule inside `apps/*` belongs in a package. `workflows/*` are plain npm-shaped packages, deployable to any stock Interchange hub through the stock deploy route — this repo does not publish them to npm.
- **Apps stay generic; packages own the domain.** A product rule inside `apps/*` belongs in a package.
- **`packages/worker` is the default harness** — the one definition package a bench's worker, and any agent Workbench creates, deploys on; it is trim (`index.ts` + `system-prompt.ts`) with no hub-calling code.
- **Ancestor-walkable except grants.** Credentials, tools, and definitions inherit down the tenant tree; grants never do.
- **Custom DB tables live on their own Postgres schema**, with foreign keys back to Interchange's tenant/principal tables. Each package ships one idempotent migration, which the hub applies itself at boot. A custom table that gets deleted is hard-removed: delete the schema code, no drop migration. Cutovers are breaking; reset the database.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Thanks for your interest in Corbits Workbench.
- Contributions are accepted under the terms of the
[Contributor License Agreement](CLA.md) and the project license: the
application ([GPLv2 with AI Exception](LICENSE.md)), or LGPL-2.1 for
contributions to a library under `packages/` or `workflows/`.
contributions to a library under `packages/`.
- [docs/local-dev.md](docs/local-dev.md) covers running the stack locally.
- [AGENTS.md](AGENTS.md), and the `AGENTS.md` files under `apps/`, hold the
architecture and code rules every change follows, whether a person or a
Expand Down
5 changes: 2 additions & 3 deletions VENDORED.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ Local deltas are restated in each package's own `VENDORED-FROM` file.

- [ ] Delete `vendor/intx/` and remove it from the root `package.json`
workspaces.
- [ ] Restore the `@intx/*` dependencies in `apps/*`, `packages/*`, and
`workflows/*` to the published npm version, and drop the root
`overrides` pins.
- [ ] Restore the `@intx/*` dependencies in `apps/*` and `packages/*` to
the published npm version, and drop the root `overrides` pins.
- [ ] Delete the `vendor/intx/*` ledger rows above.
- [ ] `bun install`
- [ ] `bun run check`
40 changes: 0 additions & 40 deletions apps/hub/src/library-kind-segments.ts

This file was deleted.

7 changes: 0 additions & 7 deletions apps/hub/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ import {
mountWorkflowArtifacts,
type WorkflowArtifactEnv,
} from "@corbits/artifacts";
import { artifactMatchesLibraryKindSegment, LIBRARY_KIND_SEGMENTS } from "./library-kind-segments";
import { workflowRun } from "@intx/db/schema";
import path from "node:path";
import { migrateHub } from "./migrate";
Expand Down Expand Up @@ -652,12 +651,6 @@ export async function createHubServer({
db,
contentStore: artifactContentStore,
requireGrant: createRequireGrant({ grantStore, conditionRegistry: grantConditionRegistry }),
countSegments: Object.fromEntries(
LIBRARY_KIND_SEGMENTS.map((segment) => [
segment,
(row: { kind: string; title: string }) => artifactMatchesLibraryKindSegment(row, segment),
]),
),
});
app.route(TENANT_PREFIX, artifactsApi);
}
Expand Down
12 changes: 0 additions & 12 deletions apps/web/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ export const ArtifactUploadResponseSchema = type({
artifacts: ArtifactRowSchema.array(),
});

// GET /api/tenants/:id/artifacts/counts — honest per-kind-segment counts
// over the tenant's full artifact list, computed by the hub so the Library
// nav never shows a number the page itself couldn't otherwise prove.
export const ArtifactCountsSchema = type({
all: "number",
document: "number",
sheet: "number",
pdf: "number",
routine: "number",
});

export type Profile = typeof UserProfile.infer;
export type Principal = typeof PrincipalSummary.infer;
export type TenantDetail = typeof TenantResponse.infer;
Expand All @@ -77,7 +66,6 @@ export type AssetRow = typeof AssetWithOriginResponse.infer;
export type ArtifactListItem = typeof ArtifactListItemSchema.infer;
export type ArtifactListPage = typeof ArtifactListPageSchema.infer;
export type ArtifactDetail = typeof ArtifactRowSchema.infer;
export type ArtifactCounts = typeof ArtifactCountsSchema.infer;
// Stated structurally because the generic schema's inferred type rejects
// plain literals.
type Paginated<T> = { data: T[]; nextCursor: string | null };
Expand Down
8 changes: 0 additions & 8 deletions apps/web/src/query-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ export const tenantKeys = {
visibleAgents: (tenantId: string) => ["tenant", tenantId, "agents", "visible"] as const,
assets: (tenantId: string) => ["tenant", tenantId, "assets"] as const,
artifacts: (tenantId: string) => ["tenant", tenantId, "artifacts"] as const,
// Nested under `artifacts` (not a sibling key) so one
// `invalidateQueries({ queryKey: tenantKeys.artifacts(tenantId) })` after
// an upload covers both the list and the kind-nav counts.
artifactCounts: (tenantId: string) => ["tenant", tenantId, "artifacts", "counts"] as const,
credentials: (tenantId: string) => ["tenant", tenantId, "credentials"] as const,
principals: (tenantId: string) => ["tenant", tenantId, "principals"] as const,
roles: (tenantId: string) => ["tenant", tenantId, "roles"] as const,
Expand Down Expand Up @@ -129,10 +125,6 @@ export function pathToQueryKey(path: string): readonly unknown[] {
}
const assets = /^\/api\/tenants\/([^/]+)\/assets$/.exec(path);
if (assets?.[1] !== undefined) return tenantKeys.assets(assets[1]);
const artifactCounts = /^\/api\/tenants\/([^/]+)\/artifacts\/counts$/.exec(path);
if (artifactCounts?.[1] !== undefined) {
return tenantKeys.artifactCounts(artifactCounts[1]);
}
const artifacts = /^\/api\/tenants\/([^/]+)\/artifacts(?:\?(.*))?$/.exec(path);
if (artifacts?.[1] !== undefined) {
return [...tenantKeys.artifacts(artifacts[1]), artifacts[2] ?? ""] as const;
Expand Down
5 changes: 0 additions & 5 deletions apps/web/src/shell/library-artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ export function mapArtifactListToSummaries(rows: readonly ArtifactListRow[]): Ar
return rows.map(artifactListRowToSummary);
}

/** `GET /api/tenants/:id/artifacts/counts` — the Library kind nav's counts. */
export function artifactCountsPath(tenantId: string): string {
return `/api/tenants/${tenantId}/artifacts/counts`;
}

// Throws with status on non-2xx so the page can surface an honest failure.
export async function uploadArtifactFiles(
tenantId: string,
Expand Down
6 changes: 3 additions & 3 deletions docs/GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ paths keep the platform's own names.

## Package naming

`@corbits/*` is the default scope for every package under `packages/`,
`tools/`, `agents/`, `skills/`, and `workflows/` — with a kebab-case kind
suffix where a package is one of a family (`-agent`, `-tools`).
`@corbits/*` is the default scope for every package under `packages/` —
with a kebab-case kind suffix where a package is one of a family
(`-agent`, `-tools`).
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
"workspaces": [
"apps/*",
"packages/*",
"vendor/intx/*",
"workflows/*"
"vendor/intx/*"
],
"scripts": {
"check": "bun run typecheck && bun run lint && bun run fmt:check && bun run test",
"typecheck": "bun run scripts/typecheck.ts",
"lint": "oxlint apps packages workflows scripts e2e",
"fmt": "oxfmt apps packages workflows scripts e2e",
"fmt:check": "oxfmt --check apps packages workflows scripts e2e",
"lint": "oxlint apps packages scripts e2e",
"fmt": "oxfmt apps packages scripts e2e",
"fmt:check": "oxfmt --check apps packages scripts e2e",
"build": "bun run scripts/run-all.ts build",
"test": "bun run scripts/run-all.ts test",
"test:e2e": "bun test e2e",
Expand Down
1 change: 0 additions & 1 deletion scripts/run-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const WORKSPACE_ROOTS = [
"apps/*/package.json",
"packages/*/package.json",
"skills/*/package.json",
"workflows/*/package.json",
"vendor/intx/*/package.json",
];

Expand Down
1 change: 0 additions & 1 deletion scripts/typecheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { resolveConcurrency } from "./concurrency.ts";
const PROJECT_GLOBS = [
"apps/*/tsconfig.json",
"packages/*/tsconfig.json",
"workflows/*/tsconfig.json",
"vendor/intx/*/tsconfig.json",
];

Expand Down
8 changes: 0 additions & 8 deletions workflows/README.md

This file was deleted.

Loading