@opengeni/api-router 3.0.1-canary.0 → 3.0.1-canary.1

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/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  createOpenGeniSlackBotInteractionClient,
8
8
  startSlackInteractionPump,
9
9
  startTemporalScheduleCleanupPump
10
- } from "./chunk-XZGTKYOA.js";
10
+ } from "./chunk-TY7H4H37.js";
11
11
 
12
12
  // src/index.ts
13
13
  import { scheduledTaskKnowledgeSource } from "@opengeni/contracts";
@@ -1,5 +1,5 @@
1
- import { ClientSessionEvent, SteerSessionMessageRequest, type SessionStatus, type WorkClaimSubjectFilter, type SessionGoalRevision, type SessionAuthorizationOperation } from "@opengeni/contracts";
2
- import { type SessionDiscoveryCursor } from "@opengeni/db";
1
+ import { ClientSessionEvent, SessionScopeSubjectId, SteerSessionMessageRequest, type SessionStatus, type WorkClaimSubjectFilter, type SessionGoalRevision, type SessionAuthorizationOperation } from "@opengeni/contracts";
2
+ import { decodeSessionListCursor, type SessionDiscoveryCursor } from "@opengeni/db";
3
3
  import type { Context, Hono } from "hono";
4
4
  import type { ApiRouteDeps } from "@opengeni/core";
5
5
  import { type ViewerServices } from "../sandbox/viewer.js";
@@ -13,6 +13,28 @@ export declare function goalProposalMatchesExpectedRevision(revision: Pick<Sessi
13
13
  */
14
14
  export declare function sessionAuthorizationOperationForHttp(method: string, pathname: string, sessionId: string): SessionAuthorizationOperation | null;
15
15
  export declare function sessionTenancyHttpError(error: unknown): Error;
16
+ export declare function sessionListQuery(query: Record<string, string>, allowCursor?: boolean): {
17
+ originSiteId: string | undefined;
18
+ limit: string | undefined;
19
+ parentSessionId: string | null | undefined;
20
+ cursor: ReturnType<typeof decodeSessionListCursor> | undefined;
21
+ search: string | undefined;
22
+ pinsOnly: boolean;
23
+ archivedOnly: boolean;
24
+ sortBy: "updatedAt" | "createdAt" | "name" | undefined;
25
+ archiveStatus: "active" | "archived" | "all" | undefined;
26
+ channelId: string | null | undefined;
27
+ createdBy: {
28
+ kind: "subject" | "service";
29
+ subjectId: string;
30
+ } | undefined;
31
+ updatedFrom: Date | undefined;
32
+ updatedBefore: Date | undefined;
33
+ createdFrom: Date | undefined;
34
+ createdBefore: Date | undefined;
35
+ scopeSubjectId: SessionScopeSubjectId | undefined;
36
+ hasPageFilters: boolean;
37
+ };
16
38
  export type AgentTopologyCursorEnvelope = {
17
39
  cursor: SessionDiscoveryCursor;
18
40
  parentSessionId: string | null | "all";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/api-router",
3
- "version": "3.0.1-canary.0",
3
+ "version": "3.0.1-canary.1",
4
4
  "description": "OpenGeni HTTP surface: the Hono adapter/router (createApp), routes, MCP HTTP transport, and HTTP access adapters over @opengeni/core. An engine-distribution surface — its runtime closure includes engine-internal packages.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,24 +43,24 @@
43
43
  "@hono/zod-validator": "^0.7.6",
44
44
  "@llamaindex/liteparse": "2.14.2",
45
45
  "@modelcontextprotocol/sdk": "^1.29.0",
46
- "@opengeni/agent-proto": "^0.6.0-canary.5",
47
- "@opengeni/artifact-tool": "^0.3.29-canary.0",
48
- "@opengeni/capabilities": "^0.3.4-canary.0",
49
- "@opengeni/codemode": "^0.5.9-canary.0",
50
- "@opengeni/codex": "^0.2.23-canary.2",
51
- "@opengeni/config": "^1.2.2-canary.0",
52
- "@opengeni/contracts": "^4.1.0-canary.0",
53
- "@opengeni/core": "^3.0.1-canary.0",
54
- "@opengeni/db": "^5.0.1-canary.0",
55
- "@opengeni/documents": "^0.8.30-canary.0",
56
- "@opengeni/events": "^0.4.28-canary.0",
57
- "@opengeni/github": "^0.7.13-canary.0",
58
- "@opengeni/network": "^0.3.1-canary.17",
59
- "@opengeni/observability": "^0.8.29-canary.0",
60
- "@opengeni/runtime": "^3.0.1-canary.0",
61
- "@opengeni/storage": "^0.2.130-canary.0",
62
- "@opengeni/tool-gateway": "^0.1.10-canary.0",
63
- "@opengeni/xai-subscription": "^0.1.4-canary.17",
46
+ "@opengeni/agent-proto": "^0.6.0-canary.6",
47
+ "@opengeni/artifact-tool": "^0.3.29-canary.1",
48
+ "@opengeni/capabilities": "^0.3.4-canary.1",
49
+ "@opengeni/codemode": "^0.5.9-canary.1",
50
+ "@opengeni/codex": "^0.2.23-canary.3",
51
+ "@opengeni/config": "^1.2.2-canary.1",
52
+ "@opengeni/contracts": "^4.1.0-canary.1",
53
+ "@opengeni/core": "^3.0.1-canary.1",
54
+ "@opengeni/db": "^5.0.1-canary.1",
55
+ "@opengeni/documents": "^0.8.30-canary.1",
56
+ "@opengeni/events": "^0.4.28-canary.1",
57
+ "@opengeni/github": "^0.7.13-canary.1",
58
+ "@opengeni/network": "^0.3.1-canary.18",
59
+ "@opengeni/observability": "^0.8.29-canary.1",
60
+ "@opengeni/runtime": "^3.0.1-canary.1",
61
+ "@opengeni/storage": "^0.2.130-canary.1",
62
+ "@opengeni/tool-gateway": "^0.1.10-canary.1",
63
+ "@opengeni/xai-subscription": "^0.1.4-canary.18",
64
64
  "@temporalio/client": "^1.17.0",
65
65
  "better-auth": "^1.6.14",
66
66
  "hono": "^4.12.18",
@@ -708,6 +708,8 @@ export function registerSessionRoutes(app: Hono, deps: SessionRouteDeps): void {
708
708
  ...(query.search ? { search: query.search } : {}),
709
709
  ...(query.pinsOnly ? { pinsOnly: true } : {}),
710
710
  ...(query.archivedOnly ? { archivedOnly: true } : {}),
711
+ ...(query.sortBy ? { sortBy: query.sortBy } : {}),
712
+ ...(query.archiveStatus ? { archiveStatus: query.archiveStatus } : {}),
711
713
  ...(query.parentSessionId !== undefined ? { parentSessionId: query.parentSessionId } : {}),
712
714
  ...(query.channelId !== undefined ? { channelId: query.channelId } : {}),
713
715
  ...(query.originSiteId ? { originSiteId: query.originSiteId } : {}),
@@ -4795,7 +4797,7 @@ function eventEnumList<T extends string>(
4795
4797
  });
4796
4798
  }
4797
4799
 
4798
- function sessionListQuery(
4800
+ export function sessionListQuery(
4799
4801
  query: Record<string, string>,
4800
4802
  allowCursor = true,
4801
4803
  ): {
@@ -4806,6 +4808,8 @@ function sessionListQuery(
4806
4808
  search: string | undefined;
4807
4809
  pinsOnly: boolean;
4808
4810
  archivedOnly: boolean;
4811
+ sortBy: "updatedAt" | "createdAt" | "name" | undefined;
4812
+ archiveStatus: "active" | "archived" | "all" | undefined;
4809
4813
  channelId: string | null | undefined;
4810
4814
  createdBy: { kind: "subject" | "service"; subjectId: string } | undefined;
4811
4815
  updatedFrom: Date | undefined;
@@ -4852,6 +4856,20 @@ function sessionListQuery(
4852
4856
  throw new HTTPException(400, { message: 'archivedOnly must be the literal "true"' });
4853
4857
  }
4854
4858
  const archivedOnly = query.archivedOnly === "true";
4859
+ const sortBy = z.enum(["updatedAt", "createdAt", "name"]).optional().safeParse(query.sortBy);
4860
+ const archiveStatus = z
4861
+ .enum(["active", "archived", "all"])
4862
+ .optional()
4863
+ .safeParse(query.archiveStatus);
4864
+ if (!sortBy.success || !archiveStatus.success) {
4865
+ throw new HTTPException(400, { message: "Invalid session sortBy or archiveStatus" });
4866
+ }
4867
+ if (archivedOnly && archiveStatus.data !== undefined && archiveStatus.data !== "archived") {
4868
+ throw new HTTPException(400, { message: "archivedOnly conflicts with archiveStatus" });
4869
+ }
4870
+ if (pinsOnly && archiveStatus.data === "archived") {
4871
+ throw new HTTPException(400, { message: "pinsOnly cannot be combined with archived status" });
4872
+ }
4855
4873
  const channelId = query.channelId;
4856
4874
  if (
4857
4875
  channelId !== undefined &&
@@ -4956,6 +4974,8 @@ function sessionListQuery(
4956
4974
  search: search || undefined,
4957
4975
  pinsOnly,
4958
4976
  archivedOnly,
4977
+ sortBy: sortBy.data,
4978
+ archiveStatus: archiveStatus.data,
4959
4979
  channelId: channelId === undefined ? undefined : channelId === "null" ? null : channelId,
4960
4980
  createdBy:
4961
4981
  createdByKind && createdBySubjectId