fix: make primitives Node ESM compatible

This commit is contained in:
-Puter
2026-07-29 07:51:07 +05:30
parent fe0fd9b16c
commit d428a2492b
12 changed files with 77 additions and 74 deletions

View File

@@ -1,6 +1,6 @@
{
"extends": "@code/config/tsconfig.base.json",
"compilerOptions": { "types": ["bun"] },
"compilerOptions": { "allowImportingTsExtensions": true, "types": ["bun"] },
"include": ["src/**/*.ts"],
"exclude": ["dist"]
}

View File

@@ -4,7 +4,7 @@ import { agentOS as createAgentOsActor } from "@rivet-dev/agentos";
import type { AgentOSConfigInput } from "@rivet-dev/agentos";
import { Context, Effect, Layer, Schema } from "effect";
import { getExecutableGitSoftware } from "./agent-os-git-software";
import { getExecutableGitSoftware } from "./agent-os-git-software.ts";
const withGitSoftware = (
config: AgentOSConfigInput<undefined>

View File

@@ -4,7 +4,7 @@ import { promisify } from "node:util";
import { Context, Effect, Layer, Schema } from "effect";
import { GitBranchName } from "./git.js";
import { GitBranchName } from "./git.ts";
const execFileP = promisify(execFile);

View File

@@ -1,6 +1,6 @@
import { Effect, Schema } from "effect";
import type { AttemptOutcome } from "./resolver";
import type { AttemptOutcome } from "./resolver.ts";
const Text = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, {

View File

@@ -1,19 +1,19 @@
// oxlint-disable-next-line no-barrel-file -- The package root intentionally exposes its public modules.
export * from "./agent-os";
export * from "./execution-runtime";
export * from "./git";
export * from "./git-local-runtime";
export * from "./git-remote-runtime";
export * from "./project";
export * from "./project-issue";
export * from "./project-workspace";
export * from "./project-work";
export * from "./signal";
export * from "./smoke";
export * from "./work";
export * from "./work-artifact";
export * from "./work-definition";
export * from "./work-design";
export * from "./work-lifecycle";
export * from "./resolver";
export * from "./harness-runtime";
export * from "./agent-os.ts";
export * from "./execution-runtime.ts";
export * from "./git.ts";
export * from "./git-local-runtime.ts";
export * from "./git-remote-runtime.ts";
export * from "./project.ts";
export * from "./project-issue.ts";
export * from "./project-workspace.ts";
export * from "./project-work.ts";
export * from "./signal.ts";
export * from "./smoke.ts";
export * from "./work.ts";
export * from "./work-artifact.ts";
export * from "./work-definition.ts";
export * from "./work-design.ts";
export * from "./work-lifecycle.ts";
export * from "./resolver.ts";
export * from "./harness-runtime.ts";

View File

@@ -1,7 +1,7 @@
/* eslint-disable max-classes-per-file -- each domain failure has a distinct tagged reason. */
import { Effect, Schema } from "effect";
import { ProblemStatement, ProjectId, SignalId } from "./signal.js";
import { ProblemStatement, ProjectId, SignalId } from "./signal.ts";
const MeaningfulString = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, {

View File

@@ -1,4 +1,4 @@
import type { ProjectIssueStatus } from "./project-issue.js";
import type { ProjectIssueStatus } from "./project-issue.ts";
export const PROJECT_ISSUE_STATUSES = [
"open",

View File

@@ -1,9 +1,9 @@
/* eslint-disable max-classes-per-file -- workspace errors stay next to their contracts. */
import { Effect, Schema } from "effect";
import { CONTEXT_KINDS } from "./project.js";
import { CONTEXT_KINDS } from "./project.ts";
export type { ContextKind } from "./project.js";
export type { ContextKind } from "./project.ts";
const MeaningfulString = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, {

View File

@@ -1,9 +1,9 @@
/* eslint-disable max-classes-per-file -- deep Effect v4 domain module: branded schemas, tagged errors, and context services */
import { Context, Effect, Layer, Schema } from "effect";
import { OrganizationId, ProjectId, TimestampMs } from "./signal.js";
import { OrganizationId, ProjectId, TimestampMs } from "./signal.ts";
export type { OrganizationId, ProjectId } from "./signal.js";
export type { OrganizationId, ProjectId } from "./signal.ts";
// ---------------------------------------------------------------------------
// Domain constants
@@ -649,19 +649,21 @@ export class ProjectApplication extends Context.Service<
const store = yield* ProjectStore;
return ProjectApplication.of({
getProject: Effect.fn("ProjectApplication.getProject")(function* getProject({
userId,
projectId,
}: {
readonly userId: string;
readonly projectId: ProjectId;
}) {
return yield* store
.getProject(userId, projectId)
.pipe(Effect.mapError(mapStoreError));
}),
getProject: Effect.fn("ProjectApplication.getProject")(
function* getProject({
userId,
projectId,
}: {
readonly userId: string;
readonly projectId: ProjectId;
}) {
return yield* store
.getProject(userId, projectId)
.pipe(Effect.mapError(mapStoreError));
}
),
importPublicGit: Effect.fn("ProjectApplication.importPublicGit")(
function* importPublicGit({
function* importPublicGit({
userId,
repositoryUrl,
}: {
@@ -686,7 +688,7 @@ export class ProjectApplication extends Context.Service<
}
),
importPublicText: Effect.fn("ProjectApplication.importPublicText")(
function* importPublicText({
function* importPublicText({
userId,
projectId,
kind,
@@ -724,38 +726,38 @@ export class ProjectApplication extends Context.Service<
.pipe(Effect.mapError(mapStoreError));
}
),
listProjects: Effect.fn("ProjectApplication.listProjects")(function* listProjects({
userId,
}: {
readonly userId: string;
}) {
return yield* store
.listProjects(userId)
.pipe(Effect.mapError(mapStoreError));
}),
putContext: Effect.fn("ProjectApplication.putContext")(function* putContext({
userId,
projectId,
kind,
content,
origin,
}: {
readonly userId: string;
readonly projectId: ProjectId;
readonly kind: ContextKind;
readonly content: string;
readonly origin: "paste" | "upload";
}) {
const write: ContextWrite = {
_tag: "UserText",
content,
listProjects: Effect.fn("ProjectApplication.listProjects")(
function* listProjects({ userId }: { readonly userId: string }) {
return yield* store
.listProjects(userId)
.pipe(Effect.mapError(mapStoreError));
}
),
putContext: Effect.fn("ProjectApplication.putContext")(
function* putContext({
userId,
projectId,
kind,
content,
origin,
};
return yield* store
.putContext({ projectId, userId, write })
.pipe(Effect.mapError(mapStoreError));
}),
}: {
readonly userId: string;
readonly projectId: ProjectId;
readonly kind: ContextKind;
readonly content: string;
readonly origin: "paste" | "upload";
}) {
const write: ContextWrite = {
_tag: "UserText",
content,
kind,
origin,
};
return yield* store
.putContext({ projectId, userId, write })
.pipe(Effect.mapError(mapStoreError));
}
),
});
})
);

View File

@@ -1,6 +1,6 @@
import { Schema } from "effect";
import type { WorkStatus } from "./work-lifecycle";
import type { WorkStatus } from "./work-lifecycle.ts";
const Text = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, {

View File

@@ -1,7 +1,7 @@
import { Array as EffectArray, Effect, Order, Schema } from "effect";
export { WorkStatus } from "./work-lifecycle";
export type { WorkStatus as WorkLifecycleStatus } from "./work-lifecycle";
export { WorkStatus } from "./work-lifecycle.ts";
export type { WorkStatus as WorkLifecycleStatus } from "./work-lifecycle.ts";
const MeaningfulString = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, {

View File

@@ -1,5 +1,6 @@
{
"extends": "@code/config/tsconfig.base.json",
"compilerOptions": { "allowImportingTsExtensions": true },
"include": ["src/**/*.ts"],
"exclude": ["dist"]
}