@codeworksh/harness 0.3.0-canary.30.1.gf08d05b0 → 0.3.0-canary.31.1.g9fbaa8dc

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/effect.d.mts CHANGED
@@ -1156,6 +1156,8 @@ interface Interface$16 {
1156
1156
  readonly get: (sessionId: ID$1) => Effect.Effect<Option.Option<SessionRow>>;
1157
1157
  /** The space a session attaches to — its env and absolute location. None when the session is unknown. */
1158
1158
  readonly space: (sessionId: ID$1) => Effect.Effect<Option.Option<schema_d_exports$7.SpaceSchema.Info>>;
1159
+ /** The project a session belongs to, through its space. None when the session is unknown. */
1160
+ readonly project: (sessionId: ID$1) => Effect.Effect<Option.Option<schema_d_exports$9.ProjectSchema.Info>>;
1159
1161
  /** Sessions newest first, across the whole database when no scope is given. */
1160
1162
  readonly list: (input?: ListInput$1) => Effect.Effect<SessionRow[]>;
1161
1163
  readonly entry: (entryId: string) => Effect.Effect<Option.Option<HydratedEntry>>;
@@ -4029,6 +4031,18 @@ interface Info$1 {
4029
4031
  */
4030
4032
  readonly hasHostLink: boolean;
4031
4033
  readonly sandbox?: Info$2;
4034
+ /** Absent only when the session's space or project row is missing. */
4035
+ readonly project?: {
4036
+ readonly id: schema_d_exports$9.ProjectSchema.ID;
4037
+ readonly name: string;
4038
+ };
4039
+ /** Last activity, epoch milliseconds: every appended entry moves it. */
4040
+ readonly updatedAt: number;
4041
+ /** The model chosen for this session over settings; absent when settings decide. */
4042
+ readonly model?: {
4043
+ readonly provider: string;
4044
+ readonly id: string;
4045
+ };
4032
4046
  }
4033
4047
  interface Handle {
4034
4048
  readonly id: ID$1;
@@ -4054,6 +4068,15 @@ declare const create$1: (input?: CreateInput | undefined) => Effect.Effect<{
4054
4068
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
4055
4069
  hasHostLink: boolean;
4056
4070
  sandbox?: instance_d_exports.SandboxInstance.Info;
4071
+ project?: {
4072
+ id: string & import("effect/Brand").Brand<"Project.ID">;
4073
+ name: string;
4074
+ };
4075
+ updatedAt: number;
4076
+ model?: {
4077
+ readonly provider: string;
4078
+ readonly id: string;
4079
+ };
4057
4080
  }, SessionNotFoundError, never>;
4058
4081
  prompt: (input: PromptInput) => Effect.Effect<Admitted, InvalidPromptError | PromptConflictError | SessionNotFoundError, never>;
4059
4082
  run: (input: PromptInput) => Effect.Effect<Admitted, InvalidPromptError | PromptConflictError | SessionNotFoundError, never>;
@@ -4082,6 +4105,15 @@ declare const link: (input: {
4082
4105
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
4083
4106
  hasHostLink: boolean;
4084
4107
  sandbox?: instance_d_exports.SandboxInstance.Info;
4108
+ project?: {
4109
+ id: string & import("effect/Brand").Brand<"Project.ID">;
4110
+ name: string;
4111
+ };
4112
+ updatedAt: number;
4113
+ model?: {
4114
+ readonly provider: string;
4115
+ readonly id: string;
4116
+ };
4085
4117
  }, SessionNotFoundError, never>;
4086
4118
  prompt: (input: PromptInput) => Effect.Effect<Admitted, InvalidPromptError | PromptConflictError | SessionNotFoundError, never>;
4087
4119
  run: (input: PromptInput) => Effect.Effect<Admitted, InvalidPromptError | PromptConflictError | SessionNotFoundError, never>;
@@ -4108,6 +4140,15 @@ declare const relink: (input: RelinkInput) => Effect.Effect<{
4108
4140
  hostDir?: string & import("effect/Brand").Brand<"AbsolutePath">;
4109
4141
  hasHostLink: boolean;
4110
4142
  sandbox?: instance_d_exports.SandboxInstance.Info;
4143
+ project?: {
4144
+ id: string & import("effect/Brand").Brand<"Project.ID">;
4145
+ name: string;
4146
+ };
4147
+ updatedAt: number;
4148
+ model?: {
4149
+ readonly provider: string;
4150
+ readonly id: string;
4151
+ };
4111
4152
  }, SessionNotFoundError, never>;
4112
4153
  prompt: (input: PromptInput) => Effect.Effect<Admitted, InvalidPromptError | PromptConflictError | SessionNotFoundError, never>;
4113
4154
  run: (input: PromptInput) => Effect.Effect<Admitted, InvalidPromptError | PromptConflictError | SessionNotFoundError, never>;
package/effect.mjs CHANGED
@@ -1665,6 +1665,16 @@ const layer$23 = Layer.effect(Service$14, Effect.gen(function* () {
1665
1665
  SELECT p.* FROM space p JOIN session s ON s.space_id = p.id WHERE s.id = ${sessionId}
1666
1666
  `
1667
1667
  });
1668
+ const findProject = SqlSchema.findOneOption({
1669
+ Request: Schema.String,
1670
+ Result: ProjectRow,
1671
+ execute: (sessionId) => sql`
1672
+ SELECT p.* FROM project p
1673
+ JOIN space sp ON sp.project_id = p.id
1674
+ JOIN session s ON s.space_id = sp.id
1675
+ WHERE s.id = ${sessionId}
1676
+ `
1677
+ });
1668
1678
  const findSpaceById = SqlSchema.findOneOption({
1669
1679
  Request: Schema.String,
1670
1680
  Result: SpaceRow,
@@ -1813,6 +1823,13 @@ const layer$23 = Layer.effect(Service$14, Effect.gen(function* () {
1813
1823
  const space = Effect.fn("Session.space")(function* (sessionId) {
1814
1824
  return Option.map(yield* findSpace(sessionId).pipe(Effect.orDie), fromRow$1);
1815
1825
  });
1826
+ const project = Effect.fn("Session.project")(function* (sessionId) {
1827
+ return Option.map(yield* findProject(sessionId).pipe(Effect.orDie), (row) => new schema_exports$6.ProjectSchema.Info({
1828
+ id: schema_exports$6.ProjectSchema.ID.make(row.id),
1829
+ name: row.name,
1830
+ status: row.status
1831
+ }));
1832
+ });
1816
1833
  const list = Effect.fn("Session.list")(function* (input) {
1817
1834
  return yield* (input === void 0 ? selectAll() : "spaceId" in input ? selectBySpace(input.spaceId) : selectByProject(input.projectId)).pipe(Effect.orDie);
1818
1835
  });
@@ -2315,6 +2332,7 @@ const layer$23 = Layer.effect(Service$14, Effect.gen(function* () {
2315
2332
  configure,
2316
2333
  get,
2317
2334
  space,
2335
+ project,
2318
2336
  list,
2319
2337
  entry,
2320
2338
  path,
@@ -11816,13 +11834,21 @@ const makeHandle = Effect.fn("Session.makeHandle")(function* (id) {
11816
11834
  const space = Option.getOrUndefined(yield* sessions.space(id));
11817
11835
  const sandbox = space === void 0 || space.env === instance_exports.SandboxInstance.ID.local ? void 0 : Option.getOrUndefined(yield* sandboxes.get(space.env));
11818
11836
  const hostDir = Option.getOrUndefined(row.hostDir);
11837
+ const project = Option.getOrUndefined(yield* sessions.project(id));
11838
+ const model = Option.getOrUndefined(row.config)?.model;
11819
11839
  return {
11820
11840
  id,
11821
11841
  title: row.title,
11822
11842
  directory: row.directory,
11823
11843
  ...hostDir === void 0 ? {} : { hostDir },
11824
11844
  hasHostLink: hostDir !== void 0,
11825
- ...sandbox === void 0 ? {} : { sandbox }
11845
+ ...sandbox === void 0 ? {} : { sandbox },
11846
+ ...project === void 0 ? {} : { project: {
11847
+ id: project.id,
11848
+ name: project.name
11849
+ } },
11850
+ updatedAt: DateTime.toEpochMillis(row.updatedAt),
11851
+ ...model === void 0 ? {} : { model }
11826
11852
  };
11827
11853
  }).pipe(Effect.withSpan("Session.info"));
11828
11854
  return {