commons 0.2.0
commons 0.2.0 introduces three big features in addition to a number of minor improvements and big fixes.
New features
Interoperability
The commons() function was split into two, enabling users to use commons with other coding agents and to reuse trusted code across multiple projects. Calls to commons() previously looked like this:
commons <- commons(client, data_sources, semantic_layer, context_layer)The construction of the data structure that holds the data sources, semantic layer, and context layer and the construction of the agent harness that makes that information available to an LLM are now split into two pieces.
commons <- commons(data_sources = ..., semantic_layer = ..., context_layer = ...)
agent <- agent(client, commons = commons)We call that first data structure “the commons.” The commons can be used to invoke trusted code and search trusted context directly from R and is intended for use with other coding agents. See ?commons() and the new sharing vignette at vignette("sharing", package = "commons") to learn more. agent() returns what commons() used to return—a commons agent.
This transition was implemented backward-compatibly; existing calls to commons() will raise a deprecation warning with migration instructions.
Sharable documents
commons agents can now write self-contained, sharable reports as Quarto documents. When users mention writing reports or creating something sharable, the agent can load an agent skill and then stream document code directly into a chat drawer. Documents get their data by calling commons() methods in their code, and the agent revises them with a new edit_artifact tool.
Miscellaneous features and bug fixes
agent()(formerlycommons()) gains amodeargument. Withmode = "trusted only", the agent answers only with trusted calculations. It never writes its own SQL or R, and it tells the user when no trusted calculation answers a question. These answers carry no provenance markers.Citation and provenance markers keep their icons in conversations restored after commons is reinstalled or the app is redeployed. Conversations saved before this change still lose them.
-
A number of bug fixes in
data_source():-
data_source()errors when adictionaryfile has no top-leveltablesfield, rather than silently loading an empty dictionary (#473). -
data_source()imports Databricks metric views from Unity Catalog through ODBC. It previously listed them as plain views and could not read their definitions (#496). -
data_source()given a DBI connection and notablesselects the tables and views in the connection’s current schema. When that schema has too many tables to list in the system prompt, the agent finds them withsearch_cataloginstead, as for Snowflake and Databricks connections. ADBI::Idnaming only a schema, likeDBI::Id(schema = "marts"), selects every table and view in that schema. A data dictionary can name those tables relatively, likeordersformarts.orders, when the name matches only one selected table.
-
A number of fixes for Snowflake/Databricks semantic models (#439, #441, #446, #447, #486).
-
A number of bug fixes in
describle_table()the tool that the agent uses to grab table metadata and documentation:-
describe_tableworks on SQL Server, Oracle, and other databases whose SQL has noLIMITclause (#468). -
describe_tableshows at most 50 columns and reports how many additional columns it omits, keeping wide-table descriptions compact. Columns documented in the data dictionary are shown first. The system prompt no longer limits the agent to columns thatdescribe_tableorsearch_contextconfirmed (#475). -
describe_tabledescribes any table the connection can query, not only the data source’s tables, so it agrees withrun_sql. The result notes when a table is outside the data source. Agents inmode = "trusted only"still describe only the data source’s tables (#469). -
describe_tablereports table schemas and documentation without a sampled-row summary. DuckDB descriptions use database-native types. Snowflake and Databricks continue to use native metadata, while other DBI connections infer R column classes from five sampled rows, or zero rows in trusted-only mode (#319).
-
-
A number of security hardenings in
run_r():- The
run_rworker reads no R startup files, so variables set in a.Renvironfile, like API keys, stay out of reach of model-written code. - R code run by
run_rcan no longer send a signal to the application process’s ID or to its process group. On Linux, the programs it starts can also no longer leave its process group, so they all stop when the R session ends. - The
run_rworker has its own temporary folder, so model-written code can no longer read or write files in the application’s temporary directory (#463). -
run_rreturns plots as image data rather than file paths, so model-written code can no longer pass other files on the host to the model or the viewer (#515).
- The
trajectory_read()now returns auserfield with the originating Shiny session username supplied by Connect. Withlog = TRUE, authenticated session users are recorded with conversation trajectories; older logs and anonymous sessions returnNA_character_(#316).trajectory_review()has been removed. The coding-agent skill provides guidance for building interactive reviews and trust-over-time plots fromtrajectory_read()output.
