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", "extends": "@code/config/tsconfig.base.json",
"compilerOptions": { "types": ["bun"] }, "compilerOptions": { "allowImportingTsExtensions": true, "types": ["bun"] },
"include": ["src/**/*.ts"], "include": ["src/**/*.ts"],
"exclude": ["dist"] "exclude": ["dist"]
} }

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import { Effect, Schema } from "effect"; import { Effect, Schema } from "effect";
import type { AttemptOutcome } from "./resolver"; import type { AttemptOutcome } from "./resolver.ts";
const Text = Schema.String.check( const Text = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, { 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. // oxlint-disable-next-line no-barrel-file -- The package root intentionally exposes its public modules.
export * from "./agent-os"; export * from "./agent-os.ts";
export * from "./execution-runtime"; export * from "./execution-runtime.ts";
export * from "./git"; export * from "./git.ts";
export * from "./git-local-runtime"; export * from "./git-local-runtime.ts";
export * from "./git-remote-runtime"; export * from "./git-remote-runtime.ts";
export * from "./project"; export * from "./project.ts";
export * from "./project-issue"; export * from "./project-issue.ts";
export * from "./project-workspace"; export * from "./project-workspace.ts";
export * from "./project-work"; export * from "./project-work.ts";
export * from "./signal"; export * from "./signal.ts";
export * from "./smoke"; export * from "./smoke.ts";
export * from "./work"; export * from "./work.ts";
export * from "./work-artifact"; export * from "./work-artifact.ts";
export * from "./work-definition"; export * from "./work-definition.ts";
export * from "./work-design"; export * from "./work-design.ts";
export * from "./work-lifecycle"; export * from "./work-lifecycle.ts";
export * from "./resolver"; export * from "./resolver.ts";
export * from "./harness-runtime"; 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. */ /* eslint-disable max-classes-per-file -- each domain failure has a distinct tagged reason. */
import { Effect, Schema } from "effect"; import { Effect, Schema } from "effect";
import { ProblemStatement, ProjectId, SignalId } from "./signal.js"; import { ProblemStatement, ProjectId, SignalId } from "./signal.ts";
const MeaningfulString = Schema.String.check( const MeaningfulString = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, { 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 = [ export const PROJECT_ISSUE_STATUSES = [
"open", "open",

View File

@@ -1,9 +1,9 @@
/* eslint-disable max-classes-per-file -- workspace errors stay next to their contracts. */ /* eslint-disable max-classes-per-file -- workspace errors stay next to their contracts. */
import { Effect, Schema } from "effect"; 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( const MeaningfulString = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, { 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 */ /* 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 { 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 // Domain constants
@@ -649,19 +649,21 @@ export class ProjectApplication extends Context.Service<
const store = yield* ProjectStore; const store = yield* ProjectStore;
return ProjectApplication.of({ return ProjectApplication.of({
getProject: Effect.fn("ProjectApplication.getProject")(function* getProject({ getProject: Effect.fn("ProjectApplication.getProject")(
userId, function* getProject({
projectId, userId,
}: { projectId,
readonly userId: string; }: {
readonly projectId: ProjectId; readonly userId: string;
}) { readonly projectId: ProjectId;
return yield* store }) {
.getProject(userId, projectId) return yield* store
.pipe(Effect.mapError(mapStoreError)); .getProject(userId, projectId)
}), .pipe(Effect.mapError(mapStoreError));
}
),
importPublicGit: Effect.fn("ProjectApplication.importPublicGit")( importPublicGit: Effect.fn("ProjectApplication.importPublicGit")(
function* importPublicGit({ function* importPublicGit({
userId, userId,
repositoryUrl, repositoryUrl,
}: { }: {
@@ -686,7 +688,7 @@ export class ProjectApplication extends Context.Service<
} }
), ),
importPublicText: Effect.fn("ProjectApplication.importPublicText")( importPublicText: Effect.fn("ProjectApplication.importPublicText")(
function* importPublicText({ function* importPublicText({
userId, userId,
projectId, projectId,
kind, kind,
@@ -724,38 +726,38 @@ export class ProjectApplication extends Context.Service<
.pipe(Effect.mapError(mapStoreError)); .pipe(Effect.mapError(mapStoreError));
} }
), ),
listProjects: Effect.fn("ProjectApplication.listProjects")(function* listProjects({ listProjects: Effect.fn("ProjectApplication.listProjects")(
userId, function* listProjects({ userId }: { readonly userId: string }) {
}: { return yield* store
readonly userId: string; .listProjects(userId)
}) { .pipe(Effect.mapError(mapStoreError));
return yield* store }
.listProjects(userId) ),
.pipe(Effect.mapError(mapStoreError)); putContext: Effect.fn("ProjectApplication.putContext")(
}), function* putContext({
putContext: Effect.fn("ProjectApplication.putContext")(function* putContext({ userId,
userId, projectId,
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,
kind, kind,
content,
origin, origin,
}; }: {
return yield* store readonly userId: string;
.putContext({ projectId, userId, write }) readonly projectId: ProjectId;
.pipe(Effect.mapError(mapStoreError)); 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 { Schema } from "effect";
import type { WorkStatus } from "./work-lifecycle"; import type { WorkStatus } from "./work-lifecycle.ts";
const Text = Schema.String.check( const Text = Schema.String.check(
Schema.makeFilter((value) => value.trim().length > 0, { Schema.makeFilter((value) => value.trim().length > 0, {

View File

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

View File

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