Skip to content

chore: Cleanup package exports and surface - #74

Open
danjoa wants to merge 1 commit into
mainfrom
cleanup-exports
Open

chore: Cleanup package exports and surface#74
danjoa wants to merge 1 commit into
mainfrom
cleanup-exports

Conversation

@danjoa

@danjoa danjoa commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Nobody should do any imports of @cap-js/agents, even less of any nested modules, should they?

@danjoa
danjoa requested review from a team as code owners September 2, 2026 08:26
@hyperspace-pr-bot

Copy link
Copy Markdown

👋 Hi — I'm PR Bot, your SAP code review assistant.

I'll automatically review your pull requests for code quality, security, and SAP compliance. Get an overview of what I do →

What I do

  • Summarize your pull request changes
  • Review code for quality, correctness, and reliability
  • Suggest fixes when a pipeline job fails

Key commands

Command Description
/review [--all] Trigger a code review. Add --all to include files excluded by excluded_paths.
/summarize Generate a PR summary
/ask <question> Ask about the current changes
/help See all available commands

*This introduction message will be shown to you only once, you will not see it in future PRs.

@hyperspace-pr-bot

Copy link
Copy Markdown

Summary

The following content is AI-generated and provides a summary of the pull request:


Cleanup Package Exports and Public Surface

This PR removes the public package exports and entry points from @cap-js/agents, reinforcing that consumers should not import directly from this package or any of its nested modules.

Changes include:

  • 🗑️ Removed index.js — the main entry point is dropped entirely
  • 📦 Cleaned up package.json:
    • Removed the exports map (., ./lib/models/*, ./srv/*, etc.)
    • Removed the main field pointing to index.js
    • Removed index.js and index.cds from the files list
    • Updated the agents service model reference from @cap-js/agents to @cap-js/agents/srv/entities.cds
  • 🔁 Renamed CDS model file: index.cdssrv/entities.cds to better reflect its location and avoid implying a public API
  • 🛠️ Updated internal test projects (bookshop, deep-agent, travel-agent) to import from ../../../../srv/entities instead of ../../../../index.cds

Have you...

  • Added relevant entry to the change log?

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.31.9

  • Correlation ID: 0d2fa9a0-a6a8-11f1-9fa1-68e4776597b3
  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.opened
  • Output Template: Repository PR Template
  • File Content Strategy: Full file content
  • Summary Prompt: Default Prompt

@danjoa danjoa changed the title Cleanup package exports and surface chore: Cleanup package exports and surface Sep 2, 2026

@schiwekM schiwekM left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

index.js is needed for eval to import JS helpers, but yes the remaining exports can be removed and are legacy artifacts when we did not have the build* hooks

@sjvans

sjvans commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

index.js is needed for eval to import JS helpers, but yes the remaining exports can be removed and are legacy artifacts when we did not have the build* hooks

can't we make cds-plugin.js the main?

@schiwekM

schiwekM commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Of cause, as long as we have one entrance JS file where JS helpers for eval can be exported it is fine

@Akatuoro Akatuoro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing ./lib/models/* leads to the error

Cannot find module '/home/runner/work/agents/agents/node_modules/@cap-js/agents/lib/models/aicore' imported from /home/runner/work/agents/agents/srv/handlers/index.js

due to the dynamic imports.

The minimal working exports is

  "exports": {
    "./cds-plugin": "./cds-plugin.js",  // loading the plugin
    "./lib/index.cjs": "./lib/index.cjs",  // protocol adapter
    "./lib/models/*": "./lib/models/*.js"  // model implementations
  },

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.

4 participants