feat(frontend): @agenta/sessions, the headless session-list package - #5769
feat(frontend): @agenta/sessions, the headless session-list package#5769ardaerzin wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds the ChangesSession orchestration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SessionList
participant PendingInteractions
participant SessionQuery
participant SessionAPI
SessionList->>PendingInteractions: poll actionable interactions
SessionList->>SessionQuery: build filtered paginated query
SessionQuery->>SessionAPI: request session page
SessionAPI-->>SessionQuery: return session rows
SessionQuery-->>SessionList: return grouped and mapped rows
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Railway Preview Environment
Updated at 2026-08-09T16:56:39.002Z |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
web/packages/agenta-entities/src/session/api/api.ts (1)
330-346: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winNarrow the type assertion so the known request fields stay checked.
The
asassertion covers the whole object literal. It also disables excess-property and type checking forreferences,include_ended,include_archived, andwindowing. A future typo in those fields will not fail the build. Assert only the unsupported extension instead. Also update the TODO text: it omitsoriginandexclude_origin, which are part of the same widening.♻️ Proposed refactor to keep the generated fields type-checked
- { - references, - include_ended: includeEnded, - include_archived: includeArchived, - windowing, - // TODO(fern-regen): `search`/`flags`/`session_ids`/`exclude_session_ids` aren't in - // the generated SessionQueryRequest yet (regen out of scope) — widen the type - // until the client picks them up. - search, - flags, - session_ids: sessionIds, - exclude_session_ids: excludeSessionIds, - origin, - exclude_origin: excludeOrigin, - } as AgentaApi.SessionQueryRequest & { - search?: string - flags?: QuerySessionsParams["flags"] - session_ids?: string[] - exclude_session_ids?: string[] - origin?: string - exclude_origin?: string - }, + { + ...({ + references, + include_ended: includeEnded, + include_archived: includeArchived, + windowing, + } satisfies AgentaApi.SessionQueryRequest), + // TODO(fern-regen): `search`, `flags`, `session_ids`, `exclude_session_ids`, + // `origin` and `exclude_origin` aren't in the generated SessionQueryRequest yet + // (regen out of scope) — widen the type until the client picks them up. + search, + flags, + session_ids: sessionIds, + exclude_session_ids: excludeSessionIds, + origin, + exclude_origin: excludeOrigin, + } as AgentaApi.SessionQueryRequest,As per coding guidelines: "For workspace packages, respect the hierarchy ... avoid
anyand legacy compatibility shims".Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bc46def3-60c0-48e9-8061-42ee14807040
⛔ Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (29)
.gitignoreweb/oss/next.config.tsweb/oss/package.jsonweb/packages/agenta-entities/src/session/api/api.tsweb/packages/agenta-entities/src/session/core/rowStatus.tsweb/packages/agenta-entities/src/session/core/schema.tsweb/packages/agenta-entities/src/session/index.tsweb/packages/agenta-entities/src/session/state/listOptions.tsweb/packages/agenta-sessions/eslint.config.mjsweb/packages/agenta-sessions/package.jsonweb/packages/agenta-sessions/src/index.tsweb/packages/agenta-sessions/src/row/index.tsweb/packages/agenta-sessions/src/row/sessionPreview.tsweb/packages/agenta-sessions/src/row/sessionRowStatus.tsweb/packages/agenta-sessions/src/row/sessionRowTitle.tsweb/packages/agenta-sessions/src/row/sessionTrigger.tsweb/packages/agenta-sessions/src/row/viewModel.tsweb/packages/agenta-sessions/src/state/filters.tsweb/packages/agenta-sessions/src/state/index.tsweb/packages/agenta-sessions/src/state/pins.tsweb/packages/agenta-sessions/src/state/useSessionCardList.tsweb/packages/agenta-sessions/src/state/useSessionList.tsweb/packages/agenta-sessions/src/state/useSessionsList.tsweb/packages/agenta-sessions/tests/unit/sessionPreview.test.tsweb/packages/agenta-sessions/tests/unit/sessionRowStatus.test.tsweb/packages/agenta-sessions/tests/unit/sessionRowTitle.test.tsweb/packages/agenta-sessions/tsconfig.jsonweb/packages/agenta-sessions/vitest.config.tsweb/turbo.json
| * Cadence mirrors mobile: 15s while anything is pending (a running turn is what mints new gates), | ||
| * stopped when idle, re-checked on focus. | ||
| */ | ||
| export const useActionableInteractions = (projectId: string) => | ||
| useQuery<SessionInteraction[] | null>({ | ||
| queryKey: ["sessions-page", "actionable-interactions", projectId], | ||
| queryFn: ({signal}) => | ||
| queryInteractions({projectId, actionableOnly: true, abortSignal: signal}), | ||
| enabled: Boolean(projectId), | ||
| staleTime: 10_000, | ||
| refetchInterval: (query) => ((query.state.data?.length ?? 0) > 0 ? 15_000 : 30_000), |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
The comment contradicts the polling cadence.
The comment states the poll is "stopped when idle". refetchInterval returns 30_000 when no interaction is pending, so the poll continues at 30s. Correct the comment, or return false if a full stop is intended.
📝 Proposed comment correction
- * Cadence mirrors mobile: 15s while anything is pending (a running turn is what mints new gates),
- * stopped when idle, re-checked on focus.
+ * Cadence mirrors mobile: 15s while anything is pending (a running turn is what mints new gates),
+ * 30s when idle, re-checked on focus.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * Cadence mirrors mobile: 15s while anything is pending (a running turn is what mints new gates), | |
| * stopped when idle, re-checked on focus. | |
| */ | |
| export const useActionableInteractions = (projectId: string) => | |
| useQuery<SessionInteraction[] | null>({ | |
| queryKey: ["sessions-page", "actionable-interactions", projectId], | |
| queryFn: ({signal}) => | |
| queryInteractions({projectId, actionableOnly: true, abortSignal: signal}), | |
| enabled: Boolean(projectId), | |
| staleTime: 10_000, | |
| refetchInterval: (query) => ((query.state.data?.length ?? 0) > 0 ? 15_000 : 30_000), | |
| * Cadence mirrors mobile: 15s while anything is pending (a running turn is what mints new gates), | |
| * 30s when idle, re-checked on focus. | |
| */ | |
| export const useActionableInteractions = (projectId: string) => | |
| useQuery<SessionInteraction[] | null>({ | |
| queryKey: ["sessions-page", "actionable-interactions", projectId], | |
| queryFn: ({signal}) => | |
| queryInteractions({projectId, actionableOnly: true, abortSignal: signal}), | |
| enabled: Boolean(projectId), | |
| staleTime: 10_000, | |
| refetchInterval: (query) => ((query.state.data?.length ?? 0) > 0 ? 15_000 : 30_000), |
| const shared = { | ||
| search, | ||
| agentId, | ||
| status, | ||
| includeArchived, | ||
| showTriggered, | ||
| waitingSessionIds: waitingIds, | ||
| } | ||
| const pinnedQuery = useSessionList({ | ||
| ...shared, | ||
| sessionIds: pinnedIds, | ||
| enabled: pinnedIds.length > 0, | ||
| }) | ||
| const listQuery = useSessionList({ | ||
| ...shared, | ||
| origin: showTriggered ? "trigger" : undefined, | ||
| excludeSessionIds: pinnedIds, | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate files =="
fd -a 'useSessionsList.ts|useSessionCardList.ts|useSessionList.ts|listOptions.ts|api.ts' web/packages 2>/dev/null | sed 's#^\./##' | head -80
echo
echo "== target snippets =="
if [ -f web/packages/agenta-sessions/src/state/useSessionsList.ts ]; then
echo "--- useSessionsList.ts lines 1-150 ---"
nl -ba web/packages/agenta-sessions/src/state/useSessionsList.ts | sed -n '1,150p'
fi
if [ -f web/packages/agenta-sessionssrc/state/useSessionCardList.ts ]; then
echo "--- useSessionCardList.ts lines 1-150 ---"
nl -ba web/packages/agenta-sessions/src/state/useSessionCardList.ts | sed -n '1,150p'
fi
echo
echo "== useSessionList/listOptions/api predicates =="
for f in \
web/packages/agenta-sessions/src/state/useSessionList.ts \
web/packages/agenta-sessions/src/state/listOptions.ts \
web/packages/agenta-entities/src/session/api/api.ts
do
if [ -f "$f" ]; then
echo "--- $f lines 1-180/200/total ---"
case "$f" in
web/packages/agenta-entities/src/session/api/api.ts) wc -l "$f"; nl -ba "$f" | sed -n '1,220p';;
*) wc -l "$f"; nl -ba "$f" | sed -n '1,180p';;
esac
fi
doneRepository: Agenta-AI/agenta
Length of output: 1684
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== target snippets =="
for f in \
web/packages/agenta-sessions/src/state/useSessionsList.ts \
web/packages/agenta-sessions/src/state/useSessionCardList.ts \
web/packages/agenta-sessions/src/state/useSessionList.ts \
web/packages/agenta-entities/src/session/state/listOptions.ts \
web/packages/agenta-entities/src/session/api/api.ts
do
if [ -f "$f" ]; then
lines=$(wc -l < "$f")
echo "--- $f (lines=$lines) ---"
awk '{printf "%6d\t%s\n", NR, $0}' "$f" | sed -n '1,180p'
fi
done
echo
echo "== search excludeOrigin/showTriggered/usages =="
rg -n "excludeOrigin|showTriggered|sessionIds|excludeSessionIds|pin" web/packages/agenta-sessions web/packages/agenta-entities/src/session -S | sed -n '1,220p'Repository: Agenta-AI/agenta
Length of output: 50374
🌐 Web query:
Fern generated querySessions exclude_origin request parameter origin documentation
💡 Result:
There is no documented exclude_origin request parameter for a querySessions endpoint within the Fern API definition ecosystem [1][2][3][4][5]. The term exclude_origin appears to be a specific configuration parameter associated with Cloudflare's Cache Rules (often used in Terraform configurations to define cache keys) [6][7][8][9], rather than a standard parameter for API session queries. If you are encountering this parameter in a project using Fern, it is likely that: 1. It is a custom parameter defined in your own OpenAPI specification for your querySessions endpoint [10]. 2. It is being confused with Cloudflare's cache configuration, which is frequently documented with that specific name [7][8][11]. Fern provides tools for documenting and generating SDKs for APIs [5], but it does not inherently add exclude_origin parameters to querySessions endpoints unless they are explicitly present in your source OpenAPI definition or schema [10]. To verify if this is defined in your specific API, you should check your OpenAPI specification file directly.
Citations:
- 1: https://docs.galileo.ai/api-reference/trace/query-sessions
- 2: https://tesseral.docs.buildwithfern.com/docs/backend-api-reference/api-reference/sessions/list-sessions.mdx
- 3: https://buildwithfern.com/learn/docs/ai-features/ask-fern/api-reference/query/get-recent-queries
- 4: https://emotiv.gitbook.io/cortex-api/session/querysessions
- 5: https://buildwithfern.com/learn/docs/api-references/overview
- 6: https://developers.cloudflare.com/cache/how-to/cache-rules/terraform-example/
- 7: https://registry.terraform.io/providers/cloudflare/cloudflare/5.14.0/docs/resources/ruleset
- 8: https://github.com/cloudflare/terraform-provider-cloudflare/blob/v5.8.4/docs/resources/ruleset.md
- 9: https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/data-sources/ruleset
- 10: https://buildwithfern.com/learn/api-definitions/llms.txt
- 11: Set the default value for the cache_key.exclude_origin setting to false cloudflare/terraform-provider-cloudflare#2623
🌐 Web query:
"querySessions" "sessions" "query_sessions" "exclude_origin"
💡 Result:
The terms "querySessions", "query_sessions", and "exclude_origin" do not refer to a single, unified technical standard. Instead, they appear in different contexts, primarily relating to API operations, web services, and configuration settings. 1. querySessions / query_sessions: These terms are commonly used as names for API methods or tools intended to retrieve a collection of session data [1][2][3][4]. - API Reference: Various platforms and services define methods like querySessions or query_sessions to search, filter, and list active or historical sessions based on provided parameters (such as time windows, user identifiers, or metadata) [1][2][4]. - SDKs: In game development environments like Unity's Multiplayer Services, QuerySessionsOptions is a class used to configure how sessions are queried, including sorting, pagination, and filtering [5][6]. - Backend Logic: Frameworks may distinguish between high-level listing methods (like GetSessions) and more intensive search methods (like QuerySessions) that perform full-text or advanced filtering [7]. 2. exclude_origin: This term is used as a configuration flag or a query parameter in specific applications to filter or exclude requests/entries based on their originating source [8][9]. - Web Services: In projects like webrings, exclude_origin is a boolean query parameter used to remove the site currently requesting data from the returned list of entries [8][9]. - Configuration Settings: In infrastructure as code (specifically Cloudflare's Terraform provider), exclude_origin appears within cache key settings to control whether the Origin header is included in the cache key calculation [10][11]. This helps manage cache behavior by ensuring that variations in the origin header do not unnecessarily bifurcate or invalidate cache entries [12]. There is no standard protocol that combines these terms as a single command or API specification; they are implementation-specific identifiers used within their respective technical domains [1][5][8][10].
Citations:
- 1: https://github.com/launchdarkly/ai-tooling/blob/main/skills/observability/investigate/sessions.md
- 2: https://developers.cogitocorp.com/reference/getsessions
- 3: https://www.cisco.com/c/en/us/td/docs/net_mgmt/prime/access_registrar/9-3/reference/guide/reference.pdf
- 4: https://docs.galileo.ai/api-reference/trace/query-sessions
- 5: https://docs.unity3d.com/Packages/com.unity.services.multiplayer%402.0/api/Unity.Services.Multiplayer.QuerySessionsOptions.html
- 6: https://docs.unity3d.com/Packages/com.unity.services.multiplayer%400.5/api/Unity.Services.Multiplayer.QuerySessionsOptions.html
- 7: https://docs.duendesoftware.com/identityserver/ui/server-side-sessions/
- 8: https://github.com/le717/webring
- 9: https://explore.market.dev/ecosystems/discord/projects/webring
- 10: Problem with cloudflare_ruleset custom cache key with exclude_origin true - block count changed from 1 to 0 cloudflare/terraform-provider-cloudflare#2800
- 11: cloudflare_ruleset/cache rules: error when exclude_origin is not set cloudflare/terraform-provider-cloudflare#2612
- 12: https://developers.cloudflare.com/cache/llms-full.txt
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== api endpoint around querySessions and request parameters =="
file="web/packages/agenta-entities/src/session/api/api.ts"
lines=$(wc -l < "$file")
echo "--- $file (lines=$lines) ---"
awk '{printf "%6d\t%s\n", NR, $0}' "$file" | sed -n '250,360p'
echo
echo "== repository definition/name files that might declare the endpoint =="
find web -maxdepth 4 \( -name "*.yaml" -o -name "*.yml" -o -name "*.json" -o -name "*.fern" -o -name "types.ts" -o -name "resources.ts" \) -path '*/agenta-entities/*' -print 2>/dev/null | head -80
rg -n "querySessions|query.sessions|query_sessions|query sessions|sessions" web/packages/agenta-entities/foundation web/packages/agenta-entities/src -g '*.yaml' -g '*.yml' -g '*.json' -g '*.ts' 2>/dev/null | head -160
echo
echo "== deterministic option derivation from source text =="
python3 - <<'PY'
from pathlib import Path
p = Path("web/packages/agenta-sessions/src/state/useSessionList.ts")
text = p.read_text()
checks = {
"pinned_query_spreads_showTriggered": "...shared,\n sessionIds: pinnedIds," in Path("web/packages/agenta-sessions/src/state/useSessionsList.ts").read_text(),
"card_pinned_query_no_showTriggered": "const pinnedQuery = useSessionList({agentId, origin, sessionIds: pinnedIds, enabled: usePins})" in Path("web/packages/agenta-sessions/src/state/useSessionCardList.ts").read_text(),
"use_session_list_default_showTriggered_false": "showTriggered = false" in text,
"exclude_origin_logic": "excludeOrigin: origin || showTriggered ? undefined : \"trigger\"" in text,
}
for k, v in checks.items():
print(f"{k}: {v}")
PYRepository: Agenta-AI/agenta
Length of output: 11742
Prevent the pinned query from excluding trigger-origin rows.
When the main list shows non-trigger runs, the pinned query inherits showTriggered: false, so it sends excludeOrigin: "trigger". A pinned trigger-origin session is then omitted from its own group.
web/packages/agenta-sessions/src/state/useSessionsList.ts#L91-94: passshowTriggered: trueto the pinned query.web/packages/agenta-sessions/src/state/useSessionCardList.ts#L77-78: passshowTriggered: Boolean(origin)ortruehere too, depending on whether pins must show across card scopes.
📍 Affects 2 files
web/packages/agenta-sessions/src/state/useSessionsList.ts#L83-L100(this comment)web/packages/agenta-sessions/src/state/useSessionCardList.ts#L77-L78
f800d4a to
96f9e4b
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
web/packages/agenta-sessions/src/state/pins.ts (1)
5-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the narrative comments.
web/packages/agenta-sessions/src/state/pins.ts#L5-L15: Keep one short comment that states that pins are local and project-scoped. Move future server-reconciliation rationale to package documentation.web/packages/agenta-sessions/src/state/filters.ts#L14-L15: Reduce this to one short comment that states that trigger-origin sessions are hidden by default.As per coding guidelines, keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.
Source: Coding guidelines
web/packages/agenta-entities/src/session/core/rowStatus.ts (1)
10-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winShorten the
deriveSessionRowStatusdocumentation.The block spans six lines. Keep this declaration comment to one short line. Move the
pendingCountloading-state details to package documentation if callers need them.Proposed change
-/** - * One definition of a session's list status, shared by every surface that lists sessions. - * - * `pendingCount` comes from the project-wide actionable-interactions query; pass `undefined` while - * it is unresolved, which reads the same as zero here but lets callers hold off on a "waiting" - * filter until they actually know. - */ +/** Derives the canonical session-list status. */As per coding guidelines, keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 252725d9-3a55-4084-a6c1-df5adbda25f7
⛔ Files ignored due to path filters (1)
web/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (29)
.gitignoreweb/oss/next.config.tsweb/oss/package.jsonweb/packages/agenta-entities/src/session/api/api.tsweb/packages/agenta-entities/src/session/core/rowStatus.tsweb/packages/agenta-entities/src/session/core/schema.tsweb/packages/agenta-entities/src/session/index.tsweb/packages/agenta-entities/src/session/state/listOptions.tsweb/packages/agenta-sessions/eslint.config.mjsweb/packages/agenta-sessions/package.jsonweb/packages/agenta-sessions/src/index.tsweb/packages/agenta-sessions/src/row/index.tsweb/packages/agenta-sessions/src/row/sessionPreview.tsweb/packages/agenta-sessions/src/row/sessionRowStatus.tsweb/packages/agenta-sessions/src/row/sessionRowTitle.tsweb/packages/agenta-sessions/src/row/sessionTrigger.tsweb/packages/agenta-sessions/src/row/viewModel.tsweb/packages/agenta-sessions/src/state/filters.tsweb/packages/agenta-sessions/src/state/index.tsweb/packages/agenta-sessions/src/state/pins.tsweb/packages/agenta-sessions/src/state/useSessionCardList.tsweb/packages/agenta-sessions/src/state/useSessionList.tsweb/packages/agenta-sessions/src/state/useSessionsList.tsweb/packages/agenta-sessions/tests/unit/sessionPreview.test.tsweb/packages/agenta-sessions/tests/unit/sessionRowStatus.test.tsweb/packages/agenta-sessions/tests/unit/sessionRowTitle.test.tsweb/packages/agenta-sessions/tsconfig.jsonweb/packages/agenta-sessions/vitest.config.tsweb/turbo.json
🚧 Files skipped from review as they are similar to previous changes (26)
- web/packages/agenta-entities/src/session/index.ts
- web/packages/agenta-entities/src/session/core/schema.ts
- web/packages/agenta-sessions/tests/unit/sessionRowTitle.test.ts
- web/packages/agenta-sessions/package.json
- web/packages/agenta-sessions/src/index.ts
- web/packages/agenta-sessions/tsconfig.json
- web/oss/package.json
- web/packages/agenta-sessions/eslint.config.mjs
- web/packages/agenta-sessions/tests/unit/sessionPreview.test.ts
- web/packages/agenta-sessions/src/row/index.ts
- .gitignore
- web/oss/next.config.ts
- web/packages/agenta-sessions/vitest.config.ts
- web/packages/agenta-sessions/tests/unit/sessionRowStatus.test.ts
- web/packages/agenta-sessions/src/state/index.ts
- web/packages/agenta-sessions/src/row/sessionPreview.ts
- web/packages/agenta-sessions/src/row/viewModel.ts
- web/packages/agenta-sessions/src/row/sessionRowStatus.ts
- web/packages/agenta-entities/src/session/state/listOptions.ts
- web/packages/agenta-sessions/src/row/sessionRowTitle.ts
- web/packages/agenta-entities/src/session/api/api.ts
- web/packages/agenta-sessions/src/state/useSessionsList.ts
- web/packages/agenta-sessions/src/state/useSessionList.ts
- web/packages/agenta-sessions/src/row/sessionTrigger.ts
- web/packages/agenta-sessions/src/state/useSessionCardList.ts
- web/turbo.json
Filters (mode/include semantics), pins, the infinite list query, row helpers (title, status, preview, trigger), the SessionRowVm view-model, and the grouping hooks useSessionsList/useSessionCardList move into a headless package with zero UI imports (eslint-enforced). The session entity keeps what it owns: schema, listOptions, rowStatus and the query itself in @agenta/entities/session.
96f9e4b to
3ff33cb
Compare
|
Landed in |
Context
Second lane of the sessions/agents UX stack. The session list's rules (filter semantics, grouping, row derivation, pins) lived inside
SessionsPage, so every surface that shows sessions (Home, overview, the sidebar, and later mobile) re-derived its own. The test this package is held to: changing a rule, like "automations replace the set rather than adding to it", must be one edit that every surface inherits.Changes
New headless package
@agenta/sessions(hooks and atoms only, zero UI imports, enforced by eslint):state/: the filter atoms with their semantics (show-triggered is a mode that replaces the set; show-archived widens it), per-project pins, the infinite list query with cursor handling and thewaitingSessionIdspushdown, and the grouping hooksuseSessionsList/useSessionCardListthat return render-ready groups plus paging state.row/: title, status, preview and trigger helpers plusSessionRowVm, so a row reaches the UI with nothing left to decide.The session entity keeps what it owns in
@agenta/entities/session: the zod schema,listOptions,rowStatusand the query itself.web/.gitignorelearns about the package's vitest junit output.Tests / notes
tests/unit(title, status, preview) pass; package builds under turbo.grep 'from "antd"' srcis empty;@agenta/osstsc is clean on this lane.