Skip to content

Comments

update inkeep pull to use ts-morph#2077

Open
dimaMachina wants to merge 657 commits intoprd-5628-2from
prd-5628
Open

update inkeep pull to use ts-morph#2077
dimaMachina wants to merge 657 commits intoprd-5628-2from
prd-5628

Conversation

@dimaMachina
Copy link
Collaborator

No description provided.

@vercel
Copy link

vercel bot commented Feb 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agents-api Ready Ready Preview, Comment Feb 21, 2026 6:25am
agents-docs Ready Ready Preview, Comment Feb 21, 2026 6:25am
agents-manage-ui Ready Ready Preview, Comment Feb 21, 2026 6:25am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: d92af71

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@inkeep/agents-core Major
@inkeep/agents-cli Major
@inkeep/agents-api Major
@inkeep/agents-manage-ui Major
@inkeep/agents-sdk Major
@inkeep/agents-work-apps Major
@inkeep/ai-sdk-provider Major
@inkeep/create-agents Major
@inkeep/agents-mcp Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

tim-inkeep and others added 23 commits February 20, 2026 00:44
…1974)

* updated test

* added changeset

* added tests

* updated

* tupecheck

* few fixes for GenericPromptEditor/GenericJsonEditor (#1904)

* few fixes for GenericPromptEditor/GenericJsonEditor

* Add changeset for GenericPromptEditor/GenericJsonEditor layout fixes

Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>

* Update generic-prompt-editor.tsx

---------

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>

* local time for traces, end date only when agent is done running in traces (#1903)

* local time for traces, end date when agent is done running

* changeset

* lint and claude comment

* remove unneeded state

* updated tests

* updated

* updated tests

* made a single transaction

* renamed function

* updated

* updated tool results to have the tool call id

* added changeset

* address spicedb comments

* reverted bad changes

* removed

---------

Co-authored-by: Dimitri POSTOLOV <dmytropostolov@gmail.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Dimitri POSTOLOV <undefined@users.noreply.github.com>
Co-authored-by: shagun-singh-inkeep <shagun.singh@inkeep.com>
Co-authored-by: omar-inkeep <omar@inkeep.com>
* docs: linking types

* docs: Enhance AutoTypeTable with typeLinks for better navigation

* docs: Enhance AutoTypeTable with typeLinks for better navigation

* docs: Enhance AutoTypeTable with typeLinks for better navigation

* docs: Enhance AutoTypeTable with typeLinks for better navigation

* docs: Enhance AutoTypeTable with typeLinks for better navigation

* style: auto-format with biome

* style: add primary color to type links for better visibility

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: inkeep[bot] <257615677+inkeep[bot]@users.noreply.github.com>
* fix channel api pagination

* update default pagination limit

* let api routes handle errors

* handle channel fetch error
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* remove retry policy

* fix tests

* changeset
…1997)

The thinking/acknowledgement message ("is preparing a response..." or
"is reading this thread...") could get stuck permanently in Slack in
certain error scenarios:

1. In streaming.ts, non-abort fetch errors (DNS failure, connection
   refused, etc.) threw without deleting the thinking message first.
   Now this path deletes the message and returns a StreamResult
   consistent with all other error paths.

2. In app-mention.ts, the catch block had no reference to the thinking
   message timestamp because it was scoped inside the try block. Hoisted
   thinkingMessageTs so the catch block can delete it as a safety net.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* trace view filtered for agent

* trace view filtered for agent

* fix
…tion fails (#1999)

* fix: suppress spurious timeout error in Slack when streaming finalization fails

When a Slack chatStream response was fully delivered but `streamer.stop()`
timed out (>10s), the error handler would post a "Request timed out" message
to the user even though they already received the agent's full response.

Two fixes:
- Wrap `streamer.stop()` finalization in its own try/catch so a timeout there
  doesn't trigger user-facing error messaging when content was already delivered
- Add Slack event retry deduplication by checking `X-Slack-Retry-Num` header
  to prevent duplicate agent invocations from Slack's retry mechanism

Co-authored-by: Cursor <cursoragent@cursor.com>

* address PR feedback: add tests, tracing, and shorter cleanup timeout

- Add 3 tests for Slack retry deduplication (routes.test.ts):
  acknowledge retries, handle missing reason, process normally without headers
- Add 3 tests for contentAlreadyDelivered suppression (streaming.test.ts):
  suppress error after content streamed, post error when no content,
  handle streamer.stop() finalization timeout gracefully
- Wrap retry dedup in tracing span with outcome/retry attributes
- Add STREAM_FINALIZATION_FAILED and CONTENT_ALREADY_DELIVERED span keys
- Use 3s CLEANUP_TIMEOUT_MS for best-effort streamer.stop() in error paths
  (down from 10s) to bound total error handling time

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
…m immediately (#2004)

The Slack streaming code waited for the HTTP connection to close before
finalizing the chatStream and deleting the "preparing a response" message.
However, the API keeps the connection open for cleanup operations
(session teardown, telemetry flush) after the agent completes, causing
the Slack message to appear stuck for up to 2 minutes.

Now detects the `completion` data-operation event in the SSE stream and
breaks out of the read loop immediately, so streamer.stop() and the
thinking message deletion run as soon as the agent finishes.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…2006)

* fix: flush OTEL spans after Slack webhook fire-and-forget handlers

The Slack webhook handler returns { ok: true } immediately and processes
work (app_mention, modal submissions, etc.) in fire-and-forget background
handlers. The existing per-request flush middleware in createApp runs before
these background handlers complete, so their spans are never force-flushed.
On Vercel/serverless the function can freeze before the next scheduled batch
flush, causing spans to be lost entirely.

Add flushTraces() to agents-core that safely force-flushes the global
TracerProvider, and call it via .finally() on every fire-and-forget chain
in the Slack events route.

Co-authored-by: Cursor <cursoragent@cursor.com>

* address pr review: add unit tests and warning logging for flushTraces

- Add 5 unit tests covering all code paths in flushTraces():
  delegate via getDelegate, direct forceFlush, no forceFlush method,
  forceFlush rejection, and getTracerProvider failure
- Add logger.warn in catch block to match flushBatchProcessor() pattern

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
…ons (#2010)

Routes in workspaces.ts and github.ts used :paramName (Hono/Express
syntax) in createRoute path strings instead of {paramName} (OpenAPI
standard). The colon-to-brace conversion only happens at the parent
app.route() mount level, so these params were emitted as-is in the
generated OpenAPI spec, causing 21 validation errors.

Co-authored-by: Cursor <cursoragent@cursor.com>
)

* Draft 1 of slack app page polish, add search, refactor, fix dates

* Address claude changes, layout fixes

* Fix table header hover

* Tweak for dark mode
Regenerated API reference docs to use OpenAPI brace syntax ({param})
instead of colon syntax (:param) for path parameters. Also reorders
bulk channel operations in the table of contents.

Co-authored-by: Cursor <cursoragent@cursor.com>
* Add image handling support (without persistence to conversation history)

---------

Co-authored-by: Michael Rashkovsky <mike@Rashkovs-MacBook-Pro.local>
Co-authored-by: Andrew Mikofalvy <5668128+amikofalvy@users.noreply.github.com>
#2015)

* Refactor slack app config page to use toasts instead of notifications banner

* Fix knip error
…get chains (#2014)

* [WU-001] feat(agents-core): add shared getWaitUntil utility with unit tests

Add a lazy-cached singleton utility for Vercel's waitUntil function.
Consolidates 3 duplicate implementations into one shared location.

- getWaitUntil(): returns waitUntil fn on Vercel, undefined elsewhere
- Graceful degradation if @vercel/functions import fails
- 6 unit tests covering all paths including edge cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [WU-002] refactor(agents-api): replace duplicate getWaitUntil with shared utility

Remove local getWaitUntil() implementations from TriggerService.ts,
scheduledTriggers.ts, and createApp.ts. All now import from @inkeep/agents-core.

Behavior is identical: waitUntil on Vercel, await fallback otherwise.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* [WU-003] fix(work-apps): add waitUntil to all 7 Slack fire-and-forget chains

Wrap all fire-and-forget promise chains in the Slack events handler with
Vercel's waitUntil to prevent serverless function freeze from killing
background work after the HTTP 200 is sent.

Chains wrapped: handleAppMention, handleOpenAgentSelectorModal,
modal_project_select IIFE, handleOpenFollowUpModal, handleMessageShortcut,
handleModalSubmission, handleFollowUpSubmission.

waitUntil is resolved once per request at the top of the handler.
When unavailable (non-Vercel), fire-and-forget works naturally.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(agents-core): add ambient type declaration for @vercel/functions

The shared getWaitUntil utility uses dynamic import('@vercel/functions')
which resolves at runtime from the host app's node_modules. This type
declaration provides TypeScript resolution without adding a direct
dependency, following the existing @napi-rs/keyring pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: add changeset for agents-core waitUntil utility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: remove extra blank lines from duplicate removal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback - commands waitUntil + race condition

- Fix race condition in getWaitUntil by using promise-based singleton
  pattern (concurrent callers now share the same import promise)
- Add waitUntil + flushTraces to both fire-and-forget chains in
  /commands route (handleQuestionCommand, handleRunCommand)
- Ensures slash command agent execution completes on Vercel serverless

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(agents-api): ignore @vercel/functions in knip unused dep check

The package is dynamically imported by agents-core's getWaitUntil()
at runtime. It must remain a dependency of agents-api so the import
resolves, but knip can't trace the dynamic import through the
dependency chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(agents-core): ignore @vercel/functions in knip unlisted dep check

The dynamic import resolves at runtime from the host app (agents-api).
Adding a knip config to agents-core to ignore this known pattern,
matching the same approach used in agents-api/knip.config.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* Fix CLI port mismatch: centralize local dev URLs via LOCAL_REMOTE

- init.ts: replace 4 hardcoded localhost URLs with LOCAL_REMOTE imports
  (fixes manageUi using wrong port 3001 instead of 3000)
- profile.ts: split 'profile add' into Cloud/Local/Custom paths with
  audience-appropriate defaults; add credential !== 'none' guard
- config.ts: use LOCAL_REMOTE.api instead of hardcoded fallback URL
- profile-config.ts: import LOCAL_REMOTE for fallback defaults
- profiles/types.ts: remove dead DEFAULT_LOCAL_PROFILE constant

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update init tests and add profile add tests

- init.test.ts: use LOCAL_REMOTE constants consistently for all mock
  return values and assertions (api + manageUi)
- profile.test.ts: add 9 tests covering Cloud, Local, and Custom paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Update docs: fix stale references, add CLI troubleshooting

- cli-reference.mdx: fix profile YAML example, add login/logout sections,
  update push options/env vars
- workspace-configuration.mdx: fix CLI flags, env vars, code examples
- setup-profile.mdx: describe Cloud/Local/Custom profile options
- troubleshooting.mdx: add CLI issues section

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review: clarify Local hint, docs credential step, --local manageUi

- profile.ts: add "no auth" to Local option hint
- setup-profile.mdx: add credential reference as step 3
- cli-reference.mdx: mention Manage UI default in --local description

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add changeset for CLI port mismatch fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Andrew Mikofalvy <5668128+amikofalvy@users.noreply.github.com>
claude[bot]

This comment was marked as off-topic.

claude[bot]

This comment was marked as off-topic.

Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
claude[bot]

This comment was marked as off-topic.

claude[bot]

This comment was marked as off-topic.

@dimaMachina
Copy link
Collaborator Author

@claude add a changeset based on changes in this PR

Refactor pull command to use ts-morph for improved code generation and smart merging

- Migrates from string-based code generation to AST-based manipulation using ts-morph
- Adds intelligent merge mode that preserves user customizations when pulling updates
- Improves handling of imports, comments, and custom code during regeneration
- Adds comprehensive test coverage for the new pull command implementation
@github-actions github-actions bot deleted a comment from claude bot Feb 21, 2026
Copy link
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review Summary

(0) Total Issues | Risk: Low

✅ Pending Recommendation Resolved

The 2 commits since the last review add the missing changesets that were flagged as a Major pending recommendation:

  1. .changeset/five-plants-hang.md@inkeep/agents-cli: minor

    • "Refactor pull command to use ts-morph for improved code generation and smart merging"
    • Documents the 4 key changes: AST-based manipulation, merge mode, import/comment handling, and test coverage
    • ✅ Correctly uses minor bump (significant feature enhancement with new merge capability)
    • ✅ Message follows good changelog style (action verb, specific, consumer-focused)
  2. .changeset/chatty-ties-smell.md@inkeep/agents-core: patch

    • "Restrict stopWhen schema for sub-agents to only allow stepCountIs field"
    • Documents a schema restriction change
    • ✅ Correctly uses patch bump (schema refinement, non-breaking)

🕐 Pending Recommendations (3)

These items from the initial review remain unaddressed and should be considered before merging:

  • 🟠 scope writeMode option not exposed to CLI users — consider adding --overwrite flag for users who don't want merge behavior
  • 🟠 module-merge.ts Critical merging logic (825 lines) has no direct unit tests — edge cases in AST merging are untested
  • 🟠 introspect-generator.ts:164-166 Unsupported components silently skipped without user notification — tools/externalAgents not surfaced to users

✅ APPROVE

Summary: The missing changeset—which was a Major pending recommendation—has been addressed with a well-written, appropriately-scoped changeset for @inkeep/agents-cli. The CLI changeset correctly uses minor bump (this is a significant feature enhancement) and clearly documents what changed for consumers. The @inkeep/agents-core schema restriction is also properly documented. The 3 remaining pending recommendations are suggestions for follow-up work but do not block this PR. 🎉

Reviewers (1)
Reviewer Returned Main Findings Consider While You're Here Inline Comments Pending Recs Discarded
orchestrator (delta) 2 0 0 0 0 3 0
Total 2 0 0 0 0 3 0

Note: This is a delta re-review. The 2 new files (changesets) directly address the prior Major recommendation about missing changesets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.