feat: add filter params everywhere#164
Conversation
fix: swap peerId/workspaceId in getSessions()
## Walkthrough
This update introduces optional filter parameters to peer, session, and workspace retrieval methods in both Python and TypeScript SDKs, allowing filtered queries. Corresponding method signatures are updated to accept filter objects. Additionally, version numbers are incremented in the respective package files for both SDKs. The TypeScript SDK transitions from ESLint to Biome for linting and formatting. GitHub Actions workflows are extended to include TypeScript SDK testing.
## Changes
| Files/Paths | Change Summary |
|--------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| sdks/python/pyproject.toml, pyproject.toml, sdks/typescript/package.json | Incremented SDK version numbers; added Ruff linting config ignoring COM812 in Python SDK; replaced ESLint with Biome in TypeScript SDK. |
| sdks/python/src/honcho/async_client/client.py,<br>sdks/python/src/honcho/client.py,<br>sdks/typescript/src/client.ts | Updated `get_peers`/`getPeers`, `get_sessions`/`getSessions`, and `get_workspaces`/`getWorkspaces` methods to accept optional filter parameters. |
| sdks/python/src/honcho/async_client/peer.py,<br>sdks/python/src/honcho/peer.py,<br>sdks/typescript/src/peer.ts | Updated `get_sessions`/`getSessions` methods in peer classes to accept optional filter parameters. |
| sdks/typescript/__tests__/client.test.ts,<br>sdks/typescript/__tests__/peer.test.ts | Adjusted test mocks to expect filter parameter in API calls. |
| .github/workflows/unittest.yml | Renamed Python test job; added new TypeScript test job using Bun runtime to run TypeScript SDK tests. |
| sdks/typescript/biome.json | Added Biome configuration file for formatting, linting, and assist features in TypeScript SDK. |
| sdks/typescript/src/index.ts,<br>sdks/typescript/src/pagination.ts,<br>sdks/typescript/src/session.ts,<br>sdks/typescript/src/session_context.ts,<br>sdks/typescript/src/peer.ts | Applied stylistic and formatting improvements; removed trailing semicolons; reordered imports and exports; no logic changes. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant User
participant HonchoClient
participant API
User->>HonchoClient: getPeers(filter)
HonchoClient->>API: peers.list(filter)
API-->>HonchoClient: Paginated Peer Results
HonchoClient-->>User: AsyncPage/SyncPage of Peers
User->>HonchoClient: getSessions(filter)
HonchoClient->>API: sessions.list(filter)
API-->>HonchoClient: Paginated Session Results
HonchoClient-->>User: AsyncPage/SyncPage of Sessions
User->>HonchoClient: getWorkspaces(filter)
HonchoClient->>API: workspaces.list(filter)
API-->>HonchoClient: List of Workspace IDs
HonchoClient-->>User: List of Workspace IDsEstimated code review effort2 (~15 minutes) Possibly related PRs
Suggested reviewers
Poem
|
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (5)
sdks/python/src/honcho/client.py (2)
156-173: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
Static analysis suggests adding a trailing comma on line 169:
peers_page = self._client.workspaces.peers.list( - workspace_id=self.workspace_id, filter=filter + workspace_id=self.workspace_id, filter=filter, )
209-228: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
Static analysis suggests adding trailing commas on lines 210 and 223:
- def get_sessions( - self, filter: dict[str, object] | None = None - ) -> SyncPage[Session]: + def get_sessions( + self, filter: dict[str, object] | None = None, + ) -> SyncPage[Session]:sessions_page = self._client.workspaces.sessions.list( - workspace_id=self.workspace_id, filter=filter + workspace_id=self.workspace_id, filter=filter, )sdks/python/src/honcho/async_client/client.py (3)
172-191: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
Static analysis suggests adding trailing commas on lines 173 and 187:
- async def get_peers( - self, filter: dict[str, object] | None = None - ) -> AsyncPage[AsyncPeer]: + async def get_peers( + self, filter: dict[str, object] | None = None, + ) -> AsyncPage[AsyncPeer]:peers_page = await self._client.workspaces.peers.list( - workspace_id=self.workspace_id, filter=filter + workspace_id=self.workspace_id, filter=filter, )
231-250: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
Static analysis suggests adding trailing commas on lines 232 and 245:
- async def get_sessions( - self, filter: dict[str, object] | None = None - ) -> AsyncPage[AsyncSession]: + async def get_sessions( + self, filter: dict[str, object] | None = None, + ) -> AsyncPage[AsyncSession]:sessions_page = await self._client.workspaces.sessions.list( - workspace_id=self.workspace_id, filter=filter + workspace_id=self.workspace_id, filter=filter, )
284-301: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
Static analysis suggests adding a trailing comma on line 285:
- async def get_workspaces( - self, filter: dict[str, object] | None = None - ) -> list[str]: + async def get_workspaces( + self, filter: dict[str, object] | None = None, + ) -> list[str]:
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (8)
sdks/python/pyproject.toml(1 hunks)sdks/python/src/honcho/async_client/client.py(6 hunks)sdks/python/src/honcho/async_client/peer.py(2 hunks)sdks/python/src/honcho/client.py(6 hunks)sdks/python/src/honcho/peer.py(2 hunks)sdks/typescript/package.json(1 hunks)sdks/typescript/src/client.ts(3 hunks)sdks/typescript/src/peer.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (7)
sdks/python/pyproject.toml (1)
Learnt from: VVoruganti
PR: #115
File: README.md:393-396
Timestamp: 2025-05-29T16:27:13.808Z
Learning: CONTRIBUTING.md exists at the repository root in the Honcho project and contains a comprehensive contributing guide. Automated verification scripts can sometimes fail to detect existing files, so manual verification may be needed when users dispute automated findings.
sdks/typescript/package.json (1)
Learnt from: dr-frmr
PR: #160
File: sdks/typescript/package.json:21-22
Timestamp: 2025-07-16T21:28:04.503Z
Learning: The user dr-frmr prefers exact version pinning for dependencies in the TypeScript SDK package.json rather than using semver ranges, indicating they want explicit control over dependency updates.
sdks/typescript/src/peer.ts (1)
Learnt from: dr-frmr
PR: #131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The get_or_create_session function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
sdks/python/src/honcho/async_client/peer.py (1)
Learnt from: dr-frmr
PR: #131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The get_or_create_session function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
sdks/python/src/honcho/peer.py (1)
Learnt from: dr-frmr
PR: #131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The get_or_create_session function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
sdks/typescript/src/client.ts (1)
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
sdks/python/src/honcho/client.py (2)
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.893Z
Learning: Applies to src/models.py : Feature flags on workspace, peer, and session levels
🧬 Code Graph Analysis (2)
sdks/typescript/src/peer.ts (3)
sdks/typescript/src/pagination.ts (1)
Page(5-77)sdks/typescript/src/index.ts (2)
Page(8-8)Session(6-6)sdks/typescript/src/session.ts (1)
Session(21-283)
sdks/python/src/honcho/async_client/peer.py (5)
sdks/python/src/honcho/client.py (1)
get_sessions(209-228)sdks/python/src/honcho/peer.py (1)
get_sessions(115-138)sdks/python/src/honcho/async_client/client.py (1)
get_sessions(231-250)src/routers/sessions.py (1)
get_sessions(78-95)sdks/python/src/honcho/async_client/pagination.py (1)
AsyncPage(11-91)
🪛 Ruff (0.12.2)
sdks/python/src/honcho/async_client/peer.py
136-136: Trailing comma missing
Add trailing comma
(COM812)
sdks/python/src/honcho/peer.py
116-116: Trailing comma missing
Add trailing comma
(COM812)
sdks/python/src/honcho/async_client/client.py
173-173: Trailing comma missing
Add trailing comma
(COM812)
187-187: Trailing comma missing
Add trailing comma
(COM812)
232-232: Trailing comma missing
Add trailing comma
(COM812)
245-245: Trailing comma missing
Add trailing comma
(COM812)
285-285: Trailing comma missing
Add trailing comma
(COM812)
sdks/python/src/honcho/client.py
169-169: Trailing comma missing
Add trailing comma
(COM812)
210-210: Trailing comma missing
Add trailing comma
(COM812)
223-223: Trailing comma missing
Add trailing comma
(COM812)
🔇 Additional comments (12)
sdks/typescript/package.json (2)
3-3: LGTM! Version bump aligns with Python SDK.The version increment to 1.2.2 correctly reflects the addition of filtering capabilities across the SDK.
21-21: Verify and bump @honcho-ai/core to match SDK versionThe TypeScript SDK is at version 1.2.2 but still depends on
"@honcho-ai/core": "1.2.0"To keep versions aligned and ensure the core package includes the new filtering features, please:
- Confirm that
@honcho-ai/core@1.2.2has been published and includes the filtering updates.- Update
sdks/typescript/package.json:- "@honcho-ai/core": "1.2.0" + "@honcho-ai/core": "1.2.2"sdks/python/pyproject.toml (1)
3-3: LGTM! Version bump is consistent across SDKs.The increment to 1.2.2 properly reflects the filtering enhancements and aligns with the TypeScript SDK version.
sdks/typescript/src/peer.ts (1)
52-52: LGTM! Filter parameter addition enhances querying capabilities.The optional filter parameter allows for more targeted session retrieval while maintaining backward compatibility.
sdks/python/src/honcho/peer.py (2)
115-117: LGTM! Filter parameter enhances session querying.The optional filter parameter addition is well-implemented and maintains backward compatibility.
130-134: LGTM! API call properly passes filter parameter.The filter parameter is correctly passed to the underlying API call using named parameters.
sdks/python/src/honcho/async_client/peer.py (2)
135-137: LGTM! Consistent async implementation of filter parameter.The filter parameter addition mirrors the synchronous version and maintains API consistency across async/sync clients.
150-154: LGTM! API call correctly implements filtering.The async API call properly passes the filter parameter using named parameters, maintaining consistency with the synchronous implementation.
sdks/typescript/src/client.ts (3)
53-56: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
71-74: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
94-101: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
sdks/python/src/honcho/client.py (1)
262-274: Filter parameter addition looks good.The optional filter parameter is correctly typed and properly passed to the underlying API client. The implementation maintains backward compatibility while adding new filtering functionality.
Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat>
…honcho into ben/sdks-1.2.2-add-filters
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (2)
sdks/typescript/__tests__/client.test.ts (1)
110-149: Consider adding test coverage for actual filter functionality.The current tests only verify the default behavior where
filter: undefined. Consider adding tests that verify actual filter objects are properly passed to the API calls.Example test case to add:
it('should pass filter parameters to API call', async () => { const filterOptions = { status: 'active' }; mockClient.workspaces.peers.list.mockResolvedValue(mockPeersData); await honcho.getPeers(filterOptions); expect(mockClient.workspaces.peers.list).toHaveBeenCalledWith('test-workspace', { filter: filterOptions }); });Also applies to: 170-208
sdks/typescript/__tests__/peer.test.ts (1)
169-211: Consider adding test coverage for peer-specific filter functionality.Similar to the client tests, consider adding tests that verify actual filter objects are properly passed to the peer's
getSessions()method.Example test case:
it('should pass filter parameters for peer sessions', async () => { const filterOptions = { status: 'active', recent: true }; mockClient.workspaces.peers.sessions.list.mockResolvedValue(mockSessionsData); await peer.getSessions(filterOptions); expect(mockClient.workspaces.peers.sessions.list).toHaveBeenCalledWith( 'test-workspace', 'test-peer', { filter: filterOptions } ); });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
pyproject.toml(1 hunks)sdks/python/pyproject.toml(2 hunks)sdks/typescript/__tests__/client.test.ts(3 hunks)sdks/typescript/__tests__/peer.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
sdks/python/pyproject.toml (3)
Learnt from: VVoruganti
PR: #164
File: sdks/python/src/honcho/async_client/peer.py:136-136
Timestamp: 2025-07-21T15:53:20.954Z
Learning: The honcho repository should have COM812 (trailing comma missing) rule disabled in the root pyproject.toml Ruff configuration by adding it to the existing ignore list: ignore = ["E501", "B008", "COM812"]. The maintainers do not want trailing comma suggestions in code reviews.
Learnt from: VVoruganti
PR: #115
File: README.md:393-396
Timestamp: 2025-05-29T16:27:13.808Z
Learning: CONTRIBUTING.md exists at the repository root in the Honcho project and contains a comprehensive contributing guide. Automated verification scripts can sometimes fail to detect existing files, so manual verification may be needed when users dispute automated findings.
Learnt from: VVoruganti
PR: #164
File: sdks/python/src/honcho/async_client/peer.py:136-136
Timestamp: 2025-07-21T15:53:20.954Z
Learning: The honcho repository maintainers do not want trailing comma suggestions or complaints from static analysis tools like Ruff. The COM812 rule should be disabled in the Ruff configuration to avoid these suggestions in future reviews.
pyproject.toml (4)
Learnt from: VVoruganti
PR: #164
File: sdks/python/src/honcho/async_client/peer.py:136-136
Timestamp: 2025-07-21T15:53:20.954Z
Learning: The honcho repository should have COM812 (trailing comma missing) rule disabled in the root pyproject.toml Ruff configuration by adding it to the existing ignore list: ignore = ["E501", "B008", "COM812"]. The maintainers do not want trailing comma suggestions in code reviews.
Learnt from: VVoruganti
PR: #164
File: sdks/python/src/honcho/async_client/peer.py:136-136
Timestamp: 2025-07-21T15:53:20.954Z
Learning: The honcho repository maintainers do not want trailing comma suggestions or complaints from static analysis tools like Ruff. The COM812 rule should be disabled in the Ruff configuration to avoid these suggestions in future reviews.
Learnt from: Rajat-Ahuja1997
PR: #144
File: src/embeddings.py:217-224
Timestamp: 2025-06-26T18:33:10.167Z
Learning: In the plastic-labs/honcho project, the user's linter enforces spaces around colons in slice notation (e.g., encoded_tokens[i : i + max_tokens]), which conflicts with Flake8's E203 rule but is valid Python syntax and preferred by Black formatter.
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.893Z
Learning: Applies to src/**/*.py : Follow isort conventions with absolute imports preferred
sdks/typescript/__tests__/peer.test.ts (1)
Learnt from: dr-frmr
PR: #131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The get_or_create_session function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
🔇 Additional comments (6)
sdks/typescript/__tests__/client.test.ts (2)
126-126: LGTM! Filter parameter test updates are correct.The test correctly verifies that
getPeers()calls include the filter parameter withundefinedas the default value. This ensures the API signature change is properly tested.Also applies to: 141-141
186-186: LGTM! Consistent filter parameter testing.The test update correctly verifies that
getSessions()includes the filter parameter. This change is consistent with the other filter parameter additions in the client tests.sdks/typescript/__tests__/peer.test.ts (1)
186-189: LGTM! Parameter order appears correct after the fix.The test correctly verifies the three-parameter call: workspace ID, peer ID, and options object with filter. This appears to align with the PR objective of fixing the parameter order in
getSessions()- the current order (workspace first, peer second) seems logical and consistent.sdks/python/pyproject.toml (2)
3-3: Ensure version bump is reflected everywhere & changelog updated
version = "1.2.2"looks good, but please double-check that:
- The runtime package exposes the same string via
honcho/__init__.py(or equivalent) soimport honcho; honcho.__version__reports1.2.2.- The release notes / CHANGELOG mention the new optional-filter feature and the peerId/workspaceId swap fix.
41-43: 👍 Added COM812 to ignore list matches maintainer guidanceIncluding
COM812alongsideE501&B008aligns the SDK-level Ruff rules with the repo’s agreed style (no trailing-comma warnings).pyproject.toml (1)
61-61: Root Ruff ignore list now includes COM812 – good alignment
ignore = ["E501", "B008", "COM812"]mirrors the SDK config and enforces the no-trailing-comma rule consistently across the monorepo.
Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat>
Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat>
There was a problem hiding this comment.
Actionable comments posted: 9
♻️ Duplicate comments (1)
sdks/typescript/src/peer.ts (1)
64-76: LGTM! Parameter order is correct.The
getSessionsmethod correctly implements the expected API signature withworkspaceIdfirst, thenpeerId, followed by the options object containing the filter. This aligns with the API definition mentioned in previous reviews.Note: As mentioned in the previous review, ensure the test assertions in
sdks/typescript/__tests__/peer.test.tsmatch this parameter order.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
sdks/typescript/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
.github/workflows/unittest.yml(2 hunks)sdks/typescript/biome.json(1 hunks)sdks/typescript/package.json(3 hunks)sdks/typescript/src/client.ts(6 hunks)sdks/typescript/src/index.ts(1 hunks)sdks/typescript/src/pagination.ts(1 hunks)sdks/typescript/src/peer.ts(7 hunks)sdks/typescript/src/session.ts(4 hunks)sdks/typescript/src/session_context.ts(5 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: dr-frmr
PR: plastic-labs/honcho#160
File: sdks/typescript/package.json:21-22
Timestamp: 2025-07-16T21:28:04.503Z
Learning: The user dr-frmr prefers exact version pinning for dependencies in the TypeScript SDK package.json rather than using semver ranges, indicating they want explicit control over dependency updates.
sdks/typescript/src/peer.ts (1)
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
sdks/typescript/src/session.ts (2)
Learnt from: dr-frmr
PR: #131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The get_or_create_session function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
sdks/typescript/src/session_context.ts (2)
Learnt from: dr-frmr
PR: #131
File: src/routers/sessions.py:206-213
Timestamp: 2025-06-18T20:42:06.458Z
Learning: The get_or_create_session function in this codebase is designed to handle both session creation and adding peers to existing sessions. When called with peers, it will add those peers to an existing session rather than creating a duplicate session.
Learnt from: CR
PR: plastic-labs/honcho#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T14:51:09.893Z
Learning: Applies to src/utils/history.py : Session history summarization: short every 20 messages, long every 60
sdks/typescript/src/client.ts (1)
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
🧬 Code Graph Analysis (2)
sdks/typescript/src/pagination.ts (3)
sdks/python/src/honcho/async_client/pagination.py (2)
items(43-47)data(69-74)sdks/python/src/honcho/pagination.py (1)
data(61-65)sdks/typescript/src/index.ts (1)
Page(5-5)
sdks/typescript/src/session_context.ts (3)
sdks/typescript/src/peer.ts (2)
message(81-87)Peer(8-167)sdks/python/src/honcho/async_client/peer.py (1)
message(161-184)sdks/python/src/honcho/peer.py (2)
message(141-164)Peer(16-245)
🪛 Biome (1.9.4)
sdks/typescript/biome.json
[error] 9-9: Found an unknown key includes.
Known keys:
(deserialize)
[error] 47-47: Found an unknown key assist.
Known keys:
(deserialize)
sdks/typescript/src/session.ts
[error] 55-55: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
[error] 98-98: Reassigning a function parameter is confusing.
The parameter is declared here:
Use a local variable instead.
(lint/style/noParameterAssign)
🪛 GitHub Check: CodeQL
.github/workflows/unittest.yml
[warning] 64-85: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
🔇 Additional comments (6)
sdks/typescript/src/pagination.ts (1)
60-63: Avoid double traversal indata()
data()first resolvesitems, then maps again if a transform is present. Since the upstream may already return a new array, usingmapcreates a second copy. Minor, but for large payloads you can transform in-place:-const data = typeof items === 'function' ? await items() : items -return this._transformFunc ? data.map(this._transformFunc) : data +const data = typeof items === 'function' ? await items() : items +return this._transformFunc ? data.map(this._transformFunc) : [...data]Likely an incorrect or invalid review comment.
sdks/typescript/src/session_context.ts (1)
53-57: No change needed:peer_nameis the canonical field
The MessageCreate schema definespeer_nameas the actual property, withpeer_idonly serving as an alias when instantiating messages. Usingmessage.peer_namehere is correct, so no update topeerIdis required.Likely an incorrect or invalid review comment.
sdks/typescript/src/client.ts (3)
54-62: LGTM! Filter parameter implementation is consistent.The addition of the optional filter parameter to
getPeersfollows a consistent pattern and correctly passes the filter to the underlying API call.
77-88: LGTM! Consistent filter implementation.The
getSessionsmethod properly implements the optional filter parameter with the same pattern asgetPeers.
110-119: LGTM! Filter parameter added consistently.The
getWorkspacesmethod correctly implements the optional filter parameter, maintaining consistency across all list retrieval methods.sdks/typescript/src/index.ts (1)
4-8: Confirm re-export reordering won’t affect module side-effect order
export { X } from './module'causes each referenced module to be executed in the textual order they appear. By reordering these re-exports you implicitly change that evaluation sequence.
If any ofclient,pagination,peer,session, orsession_contextperforms side-effectful work during module initialisation (e.g., global polyfills, env checks, singleton registration), behaviour could subtly change.Please double-check that none of those modules rely on being evaluated before/after another, or keep the original order to stay risk-free.
| const items = this._originalPage.items || this._originalPage.data || [] | ||
| for (const item of items) { | ||
| yield this._transformFunc ? this._transformFunc(item) : item; | ||
| yield this._transformFunc ? this._transformFunc(item) : item | ||
| } |
There was a problem hiding this comment.
Async iterator ignores lazy items() functions
items may be a function (you handle this in data()), but the iterator treats it as a plain array, so lazily-loaded pages won’t work:
const items = this._originalPage.items || this._originalPage.data || []
for (const item of items) { … }Add the same callable check you already have in data():
-const items = this._originalPage.items || this._originalPage.data || []
-for (const item of items) {
+const raw = this._originalPage.items || this._originalPage.data || []
+const items = typeof raw === 'function' ? await raw() : raw
+for (const item of items) {🤖 Prompt for AI Agents
In sdks/typescript/src/pagination.ts around lines 22 to 25, the async iterator
treats this._originalPage.items as a plain array, but it may be a function that
returns the items lazily. To fix this, check if this._originalPage.items is a
function and call it to get the items array, similar to the existing check in
the data() method. Then iterate over the resulting array or fallback to
this._originalPage.data or an empty array.
There was a problem hiding this comment.
Actionable comments posted: 7
♻️ Duplicate comments (2)
sdks/typescript/package.json (2)
22-30: Caret ranges re-introduced—pin exact versions as per repo conventionPast PRs established strict version pinning for deterministic installs. Please drop the
^prefix on every dependency/devDependency (e.g."@types/node": "24.0.1","@biomejs/biome": "2.1.2", etc.).- "@types/node": "^24.0.1", + "@types/node": "24.0.1", ... - "@biomejs/biome": "^2.1.2", + "@biomejs/biome": "2.1.2",
14-16: Consolidate overlapping Biome scripts
lint:fixandformatboth runbiome … --write, mutating the same files in two passes. One entry-point is enough; keep eitherlint:fixorformatto avoid redundant CI work.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
.gitignore(1 hunks)docs/changelog/compatibility-guide.mdx(1 hunks)docs/changelog/introduction.mdx(2 hunks)sdks/python/CHANGELOG.md(1 hunks)sdks/typescript/CHANGELOG.md(1 hunks)sdks/typescript/package.json(3 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: dr-frmr
PR: plastic-labs/honcho#160
File: sdks/typescript/package.json:21-22
Timestamp: 2025-07-16T21:28:04.503Z
Learning: The user dr-frmr prefers exact version pinning for dependencies in the TypeScript SDK package.json rather than using semver ranges, indicating they want explicit control over dependency updates.
sdks/python/CHANGELOG.md (2)
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Learnt from: Rajat-Ahuja1997
PR: #131
File: migrations/versions/d429de0e5338_adopt_peer_paradigm.py:438-441
Timestamp: 2025-06-18T16:44:57.733Z
Learning: In the Honcho database schema, messages.app_id references workspaces.public_id (string nanoid), not workspaces.id (integer primary key). This means that during migrations when workspaces.public_id is renamed to workspaces.id, the foreign key relationship with messages.app_id remains valid.
sdks/typescript/CHANGELOG.md (2)
Learnt from: Rajat-Ahuja1997
PR: #131
File: src/crud.py:503-505
Timestamp: 2025-06-18T14:50:59.967Z
Learning: The Honcho project prefers upsert behavior for update operations across all resources (sessions, peers, workspaces). Update operations should create the resource if it doesn't exist rather than failing fast. This is an explicit design decision that differs from typical REST semantics but provides a more forgiving API experience.
Learnt from: Rajat-Ahuja1997
PR: #131
File: migrations/versions/d429de0e5338_adopt_peer_paradigm.py:438-441
Timestamp: 2025-06-18T16:44:57.733Z
Learning: In the Honcho database schema, messages.app_id references workspaces.public_id (string nanoid), not workspaces.id (integer primary key). This means that during migrations when workspaces.public_id is renamed to workspaces.id, the foreign key relationship with messages.app_id remains valid.
sdks/typescript/package.json (1)
Learnt from: dr-frmr
PR: #160
File: sdks/typescript/package.json:21-22
Timestamp: 2025-07-16T21:28:04.503Z
Learning: The user dr-frmr prefers exact version pinning for dependencies in the TypeScript SDK package.json rather than using semver ranges, indicating they want explicit control over dependency updates.
🪛 LanguageTool
sdks/python/CHANGELOG.md
[grammar] ~8-~8: Use correct spacing
Context: ...ing](http://semver.org/). ## [1.2.2] - 2025-07-21 ### Added - Filter parameter to various end...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~12-~12: Use correct spacing
Context: ...## Added - Filter parameter to various endpoints ## [1.2.1] - 2025-07-17 ### Fixed - honch...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~14-~14: Use correct spacing
Context: ...eter to various endpoints ## [1.2.1] - 2025-07-17 ### Fixed - honcho utils import path ## [1...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~18-~18: Use correct spacing
Context: ...07-17 ### Fixed - honcho utils import path ## [1.2.0] - 2025-07-16 ### Added - Get/p...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
sdks/typescript/CHANGELOG.md
[grammar] ~8-~8: Use correct spacing
Context: ...ing](http://semver.org/). ## [1.2.1] - 2025-07-21 ### Fixed - Order of parameters in `getSess...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~12-~12: Use correct spacing
Context: ... - Order of parameters in getSessions endpoint ### Added - Linting via biome - Adding filt...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
[grammar] ~17-~17: Use correct spacing
Context: ...me - Adding filter parameter to various endpoints ## [1.2.0] - 2025-07-16 ### Added - Get/p...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
docs/changelog/compatibility-guide.mdx
[grammar] ~34-~34: Use correct spacing
Context: ... ## Version Compatibility Table | Honcho API Version | TypeScript SDK | ...
(QB_NEW_EN_OTHER_ERROR_IDS_5)
🔇 Additional comments (1)
docs/changelog/compatibility-guide.mdx (1)
38-38: Double-check compatibility table accuracyThe row for
v2.1.0was updated, but the rows forv2.0.5/v2.0.4still show SDK v1.1.0.
If those older API versions are also compatible with the newly-released SDKs, the table should be updated; if not, consider adding a footnote explaining why.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/unittest.yml(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: dr-frmr
PR: plastic-labs/honcho#160
File: sdks/typescript/package.json:21-22
Timestamp: 2025-07-16T21:28:04.503Z
Learning: The user dr-frmr prefers exact version pinning for dependencies in the TypeScript SDK package.json rather than using semver ranges, indicating they want explicit control over dependency updates.
.github/workflows/unittest.yml (1)
Learnt from: VVoruganti
PR: #115
File: README.md:393-396
Timestamp: 2025-05-29T16:27:13.808Z
Learning: CONTRIBUTING.md exists at the repository root in the Honcho project and contains a comprehensive contributing guide. Automated verification scripts can sometimes fail to detect existing files, so manual verification may be needed when users dispute automated findings.
🔇 Additional comments (1)
.github/workflows/unittest.yml (1)
9-10: 👍 Globalpermissionsblock closes the CodeQL warningAdding a top-level
permissions: { contents: read }satisfies GitHub’s least-privilege recommendation and removes the earlier CodeQL alert.
No further action required here.
| test-typescript: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup bun | ||
| uses: oven-sh/setup-bun@v1 | ||
| with: | ||
| bun-version: latest | ||
|
|
||
| - name: Install TypeScript SDK dependencies | ||
| run: | | ||
| cd sdks/typescript | ||
| bun install | ||
|
|
||
| - name: Run TypeScript SDK tests | ||
| run: | | ||
| cd sdks/typescript | ||
| bun run test | ||
| env: | ||
| HONCHO_API_KEY: test-key | ||
| HONCHO_BASE_URL: http://localhost:8000 |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Add caching & working-directory to speed up the TypeScript job
bun install re-downloads dependencies on every run, which noticeably slows CI.
You can shave ~30-60 s off each build by caching Bun’s global store and the project’s node_modules.
Additionally, using working-directory avoids the repetitive cd lines.
- steps:
+ steps:
- uses: actions/checkout@v4
+ - name: Cache bun store
+ uses: actions/cache@v4
+ with:
+ path: ~/.bun/install/cache/
+ key: ${{ runner.os }}-bun-${{ hashFiles('sdks/typescript/bun.lockb') }}
+ restore-keys: |
+ ${{ runner.os }}-bun-
+
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install TypeScript SDK dependencies
- run: |
- cd sdks/typescript
- bun install
+ working-directory: sdks/typescript
+ run: bun install --frozen-lockfile
- name: Run TypeScript SDK tests
- run: |
- cd sdks/typescript
- bun run test
+ working-directory: sdks/typescript
+ run: bun run testThis keeps the workflow readable and materially reduces CI time.
📝 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.
| test-typescript: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Install TypeScript SDK dependencies | |
| run: | | |
| cd sdks/typescript | |
| bun install | |
| - name: Run TypeScript SDK tests | |
| run: | | |
| cd sdks/typescript | |
| bun run test | |
| env: | |
| HONCHO_API_KEY: test-key | |
| HONCHO_BASE_URL: http://localhost:8000 | |
| test-typescript: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache bun store | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache/ | |
| key: ${{ runner.os }}-bun-${{ hashFiles('sdks/typescript/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - name: Setup bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: latest | |
| - name: Install TypeScript SDK dependencies | |
| working-directory: sdks/typescript | |
| run: bun install --frozen-lockfile | |
| - name: Run TypeScript SDK tests | |
| working-directory: sdks/typescript | |
| run: bun run test | |
| env: | |
| HONCHO_API_KEY: test-key | |
| HONCHO_BASE_URL: http://localhost:8000 |
🤖 Prompt for AI Agents
In .github/workflows/unittest.yml between lines 66 and 88, the TypeScript job
currently runs `bun install` and tests by manually changing directories with
`cd`, and it does not cache dependencies, causing slower CI runs. To fix this,
add caching steps for Bun’s global store and the project's `node_modules` to
avoid re-downloading dependencies each time. Also, replace the `cd` commands by
setting the `working-directory` property on the relevant steps to simplify the
script and improve readability.
* feat: add filter params everywhere fix: swap peerId/workspaceId in getSessions() * chore: add eslint and prettier dev dependencies with scripts Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat> * fix: update tests, chore: ignore trailing commas * fix (sdks): Add Linting to Typescript SDK * feat: add TypeScript SDK tests to CI workflow Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat> * ci: remove postgres service and switch to bun for typescript tests Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat> * chore (docs): Update Changelog for SDKs * chore (sdk): Code Rabbit Nitpicks * chore (action): Fix Typescript SDK Test Action --------- Co-authored-by: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com> Co-authored-by: aider (groq/moonshotai/kimi-k2-instruct) <aider@aider.chat>
fix: swap peerId/workspaceId in getSessions()
Summary by CodeRabbit
New Features
Chores