diff --git a/AGENTS.md b/AGENTS.md index f1408a3639..d2d96fd7c7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -22,6 +22,10 @@ grants); the hub never seeds data on a client's behalf. `apps/*` belongs in a package. `workflows/*` are plain npm-shaped packages, deployable to any stock Interchange hub through the stock deploy route — this repo does not publish them to npm. +- **Myra is the one default agent.** `agents/assistant` is the assistant + that uses Workbench on the person's behalf; every agent package under + `agents/*` is trim — `index.ts` (plus `system-prompt.ts` when the prompt + is large) — with no agent-owned artifact client/tool code of its own. - **No fallbacks.** Cut over cleanly — never leave a legacy path beside a new one. Config/manifest objects are explicit literals; the one exception is an optional key under `exactOptionalPropertyTypes` (see below), where diff --git a/agents/assistant/package.json b/agents/assistant/package.json index c529dc9cb5..6c0d43159a 100644 --- a/agents/assistant/package.json +++ b/agents/assistant/package.json @@ -16,7 +16,7 @@ "type": "module", "exports": { ".": "./src/index.ts", - "./prompt": "./src/prompt.ts" + "./prompt": "./src/system-prompt.ts" }, "publishConfig": { "access": "public" diff --git a/agents/assistant/src/index.ts b/agents/assistant/src/index.ts index acf4043675..773a825644 100644 --- a/agents/assistant/src/index.ts +++ b/agents/assistant/src/index.ts @@ -33,14 +33,14 @@ import { ASSISTANT_SYSTEM_PROMPT, ASSISTANT_TOOL_PACKAGE_PINS, ASSISTANT_WORKFLOW_ID, -} from "./prompt"; +} from "./system-prompt"; export { ASSISTANT_STEP_ID, ASSISTANT_SYSTEM_PROMPT, ASSISTANT_TOOL_PACKAGE_PINS, ASSISTANT_WORKFLOW_ID, -} from "./prompt"; +} from "./system-prompt"; /** * Everything the definition needs that is per-deployment data. The diff --git a/agents/assistant/src/prompt.ts b/agents/assistant/src/system-prompt.ts similarity index 100% rename from agents/assistant/src/prompt.ts rename to agents/assistant/src/system-prompt.ts diff --git a/agents/jimmy/LICENSE b/agents/jimmy/LICENSE deleted file mode 100644 index c6487f4fdf..0000000000 --- a/agents/jimmy/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ -GNU LESSER GENERAL PUBLIC LICENSE - -Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - -Preamble - -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - -This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. - -When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. - -To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. - -For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - -We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - -To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - -Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. - -Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. - -When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. - -We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. - -For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. - -In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. - -Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. - -The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - -GNU LESSER GENERAL PUBLIC LICENSE -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". - -A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - -The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) - -"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - -1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. - -(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - -Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. - -This option is useful when you wish to copy part of the code of the Library into a program that is not a library. - -4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. - -If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. - -5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - -However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. - -When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. - -If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) - -Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - -6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. - -You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: - - a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - - e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. - -For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - -7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. - - b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. - -8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. - -10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - -11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - -14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Libraries - -If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). - -To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - one line to give the library's name and an idea of what it does. - Copyright (C) year name of author - - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: - -Yoyodyne, Inc., hereby disclaims all copyright interest in -the library `Frob' (a library for tweaking knobs) written -by James Random Hacker. - -signature of Ty Coon, 1 April 1990 -Ty Coon, President of Vice -That's all there is to it! diff --git a/agents/jimmy/README.md b/agents/jimmy/README.md deleted file mode 100644 index f96cd3e869..0000000000 --- a/agents/jimmy/README.md +++ /dev/null @@ -1,54 +0,0 @@ -# @corbits/jimmy-agent - -Jimmy: a one-shot chat agent that searches Giphy and replies with a GIF. -Everything Jimmy needs — system prompt, tool declaration, and the Giphy -tool body — lives in this one package, per the portable-agent-package -convention (`defineAgent`'s "portable half," `corbitsdev/examples`). - -## What's ported (from `scout/packages/jimmy`) - -- The Giphy search HTTP client and response parsing (`gif-search-tool.ts`, - from `giphy-search.ts`). -- The system prompt and agent shape (`agent.ts`, from `index.ts`'s - `jimmyPackage`), trimmed to one tool call and one reply. - -## What's deferred - -- **Slack dispatch, block-kit rendering, and the `/gif` `/jimmy` slash - commands** — Slack-specific, out of scope for v0.1 per the owner. -- **The 4-up picker and the shuffle/cancel signal machine** - (`scout/workflows/jimmy`) — built for Slack's interactive buttons. - Workbench chat has no equivalent affordance yet, so Jimmy ships the - simple path only: one request, one GIF, no follow-up picker. -- **Wiring `gif_search`'s "giphy" credential handle to a real connector.** - This package resolves its credential through the same - `CredentialCapability.resolve("giphy")` seam every other tool package in - this repo uses (see `@corbits/web-search-tools`'s `tool.ts`), so once a - `giphy` connector exists it works with zero code changes here. As of - CL-6499, the "not connected" result also carries - `@corbits/connections`' `missing-credential-detail` wire shape - (`{kind: "missing-credential", connectorId: "giphy"}`), so the chat - orchestrator renders a real "Connect Giphy" card instead of a plain - error string — but clicking it still can't complete a connection: - `packages/connections/src/registry.ts`'s `CONNECTOR_REGISTRY` has no - `giphy` entry, and none of its three credential-provider plugins - (`http`, `http-raw-authorization`, `http-x-api-key`) put the secret on - the query string the way Giphy's `/v1/gifs/search` endpoint requires — - a fourth plugin (mirroring `http-x-api-key-provider.ts`, injecting into - the URL's search params instead of a header) is the missing piece, - along with the registry entry itself. Until both land, `gif_search` - always returns the "connect Giphy" message, by design — never a silent - failure, but not yet a completable connect flow either. -- **Installing Jimmy as a mentionable chat agent.** CL-6499 wired this: - Jimmy is not seeded through a workbench template (he is not a "kind of - workbench"), but `@corbits/chat-ui`'s `InviteAgentDialog` offers an - "Add Jimmy" quick-create row whenever the tenant hasn't created him - yet — one click mints his real agent-directory definition and invites - him into the open workbench. See `packages/chat-ui/src/api.ts`'s - `quickCreateJimmy` and `invite-agent-dialog.tsx`. - -## Test plan run - -`bun test` inside this package: a stubbed Giphy response produces a GIF -CDN URL, and an unbound/absent credential returns a "connect Giphy" -`isError` result rather than throwing or replying empty. diff --git a/agents/jimmy/package.json b/agents/jimmy/package.json deleted file mode 100644 index c0c85859e3..0000000000 --- a/agents/jimmy/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@corbits/jimmy-agent", - "version": "0.0.3", - "description": "Jimmy: a one-shot chat agent that searches Giphy and replies with a GIF", - "license": "LGPL-2.1-or-later", - "repository": { - "type": "git", - "url": "https://github.com/corbitsdev/workbench.git", - "directory": "agents/jimmy" - }, - "files": [ - "src", - "LICENSE", - "README.md" - ], - "type": "module", - "exports": { - ".": "./src/index.ts", - "./metadata": "./src/metadata.ts" - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "typecheck": "tsc --noEmit", - "test": "bun test" - }, - "dependencies": { - "arktype": "catalog:" - }, - "devDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - "@types/bun": "catalog:", - "typescript": "catalog:" - }, - "peerDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0" - }, - "interchange": { - "credentials": [ - { - "handle": "giphy" - } - ] - } -} diff --git a/agents/jimmy/src/agent.ts b/agents/jimmy/src/agent.ts deleted file mode 100644 index 63b63918da..0000000000 --- a/agents/jimmy/src/agent.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Jimmy's agent definition: the portable half described in -// `corbitsdev/examples`' agent-quickstart — a system prompt and a tool -// declaration, no credentials, no storage. A host binds this to a real -// Giphy credential and deploys it; this file only says what Jimmy *is*. -// -// Ported from `scout/packages/jimmy/src/index.ts`'s `jimmyPackage`: this -// keeps the one-shot "search Giphy, reply with a GIF" behavior and drops -// everything Slack-specific — the `/gif` slash command, the 4-up picker, -// and the shuffle/cancel signal machine (`scout/workflows/jimmy`). See -// this package's README for what that leaves deferred. -import type { AgentDefinition, InferencePreference } from "@intx/agent"; - -import { JIMMY_AGENT_ID, JIMMY_SYSTEM_PROMPT, JIMMY_TOOL_PACKAGE_PINS } from "./metadata"; - -export interface BuildJimmyAgentInput { - /** Provider/model preferences, in order; resolved at deploy time. */ - readonly inferencePreferences: readonly InferencePreference[]; -} - -/** Builds Jimmy's `AgentDefinition` — the shape every installable agent - * in this catalog authors against (see `@corbits/code-review-workflow`). */ -export function buildJimmyAgent(input: BuildJimmyAgentInput): AgentDefinition { - return { - id: JIMMY_AGENT_ID, - description: "Searches Giphy and replies with a GIF", - systemPrompt: JIMMY_SYSTEM_PROMPT, - toolFactories: [], - capabilities: [], - inference: { sources: input.inferencePreferences }, - toolPackagePins: JIMMY_TOOL_PACKAGE_PINS, - } satisfies AgentDefinition; -} diff --git a/agents/jimmy/src/gif-search-tool.test.ts b/agents/jimmy/src/gif-search-tool.test.ts deleted file mode 100644 index 96c976ec36..0000000000 --- a/agents/jimmy/src/gif-search-tool.test.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { expect, test } from "bun:test"; -import type { ToolCall } from "@intx/types/runtime"; -import type { CredentialCapability, MediatedCredential } from "@intx/types"; - -import { gifSearchTool } from "./gif-search-tool"; -import { GIF_SEARCH_TOOL } from "./metadata"; -import type { GifSearchEnv } from "./gif-search-tool"; - -const CALL: ToolCall = { - id: "call_1", - name: GIF_SEARCH_TOOL, - arguments: { query: "throw a party" }, -}; - -/** - * Fake `credentials` capability, mirroring `@corbits/web-search-tools`' - * `tool.test.ts`: a bound secret resolves to a mediated fetch that - * delegates to `globalThis.fetch`; an unbound handle rejects the same way - * the real gate does when no credential is bound. - */ -function fakeCredentials(secret: string | undefined): CredentialCapability { - return { - resolve(handle: string): Promise { - if (secret === undefined) { - return Promise.reject(new Error(`no credential is bound to handle "${handle}"`)); - } - return Promise.resolve({ - kind: "http", - fetch: (input, init) => fetch(input as string | URL, init), - dispose: () => {}, - }); - }, - }; -} - -function fakeEnv(credentials: CredentialCapability | undefined): GifSearchEnv { - return { credentials } as unknown as GifSearchEnv; -} - -const GIPHY_RESPONSE = { - data: [ - { - title: "party gif", - url: "https://giphy.com/gifs/party-abc123", - images: { - original: { url: "https://media.giphy.com/media/abc123/giphy.gif" }, - }, - }, - ], - meta: { status: 200, msg: "OK" }, -}; - -test("declares the gif_search tool", () => { - const bundle = gifSearchTool(fakeEnv(fakeCredentials("key"))); - expect(bundle.definitions.map((d) => d.name)).toEqual([GIF_SEARCH_TOOL]); -}); - -test("returns a gif CDN url for a stubbed Giphy search", async () => { - const originalFetch = globalThis.fetch; - globalThis.fetch = (async () => - new Response(JSON.stringify(GIPHY_RESPONSE), { - status: 200, - })) as unknown as typeof fetch; - try { - const bundle = gifSearchTool(fakeEnv(fakeCredentials("key"))); - const result = await bundle.run(CALL, new AbortController().signal); - expect(result.isError).toBeUndefined(); - expect(result.content).toContain("https://media.giphy.com/media/abc123/giphy.gif"); - } finally { - globalThis.fetch = originalFetch; - } -}); - -test("surfaces a connect prompt, never a silent no-op, when Giphy is not connected", async () => { - const bundle = gifSearchTool(fakeEnv(fakeCredentials(undefined))); - const result = await bundle.run(CALL, new AbortController().signal); - expect(result.isError).toBe(true); - expect(result.content).toMatch(/connect giphy/i); - // The `missing-credential-detail` contract (`@corbits/connections`): - // this is what lets the chat orchestrator render a real "Connect - // Giphy" button instead of just a plain error string. - expect(result.detail).toEqual({ - kind: "missing-credential", - connectorId: "giphy", - }); -}); - -test("surfaces the same connect prompt when the step carries no credentials capability at all", async () => { - const bundle = gifSearchTool(fakeEnv(undefined)); - const result = await bundle.run(CALL, new AbortController().signal); - expect(result.isError).toBe(true); - expect(result.content).toMatch(/connect giphy/i); - expect(result.detail).toEqual({ - kind: "missing-credential", - connectorId: "giphy", - }); -}); - -test("rejects a missing query without calling the network", async () => { - const originalFetch = globalThis.fetch; - let called = false; - globalThis.fetch = (async () => { - called = true; - return new Response("{}", { status: 200 }); - }) as unknown as typeof fetch; - try { - const bundle = gifSearchTool(fakeEnv(fakeCredentials("key"))); - const result = await bundle.run( - { id: "call_2", name: GIF_SEARCH_TOOL, arguments: {} }, - new AbortController().signal, - ); - expect(called).toBe(false); - expect(result.isError).toBe(true); - expect(result.content).toContain("query"); - } finally { - globalThis.fetch = originalFetch; - } -}); - -test("degrades to an error result (never throws) when Giphy rejects the key", async () => { - const originalFetch = globalThis.fetch; - globalThis.fetch = (async () => new Response("nope", { status: 401 })) as unknown as typeof fetch; - try { - const bundle = gifSearchTool(fakeEnv(fakeCredentials("key"))); - const result = await bundle.run(CALL, new AbortController().signal); - expect(result.isError).toBe(true); - } finally { - globalThis.fetch = originalFetch; - } -}); diff --git a/agents/jimmy/src/gif-search-tool.ts b/agents/jimmy/src/gif-search-tool.ts deleted file mode 100644 index 23b3482e2f..0000000000 --- a/agents/jimmy/src/gif-search-tool.ts +++ /dev/null @@ -1,285 +0,0 @@ -// The `gif_search` tool: Jimmy's one capability. Ported from -// `scout/packages/jimmy`'s `giphy-search.ts` — the Giphy HTTP client and -// response parsing are carried over near-verbatim; the Slack picker, -// shuffle/cancel signal machine, and block-kit rendering are NOT ported -// (see this package's README). A missing credential degrades to a -// "connect Giphy" error result, never a thrown error and never a silent -// empty reply — same contract as `@corbits/web-search-tools` and -// `@corbits/granola-tools`. -import { defineTool } from "@intx/agent"; -import type { BaseEnv } from "@intx/agent"; -import type { CredentialCapability } from "@intx/types"; -import type { ToolCall, ToolResult } from "@intx/types/runtime"; -import { type } from "arktype"; - -import { GIF_SEARCH_TOOL } from "./metadata"; - -/** `defineTool` requires a namespaced id; the agent-facing call name stays `gif_search`. */ -const GIF_SEARCH_TOOL_ID = "@corbits/jimmy-agent/gif-search"; - -/** The handle this package declares in `interchange.credentials`. */ -const GIPHY_CREDENTIAL_HANDLE = "giphy"; - -const GIPHY_API_HOST = "https://api.giphy.com"; -const DEFAULT_RATING = "pg-13"; -const DEFAULT_LANG = "en"; -const DEFAULT_LIMIT = 1; -const MIN_LIMIT = 1; -const MAX_LIMIT = 5; - -export interface GifResult { - title: string; - cdnUrl: string; - pageUrl?: string; -} - -/** Env this bundle needs beyond `BaseEnv`: the mediated-credential capability. */ -export interface GifSearchEnv extends BaseEnv { - readonly credentials?: CredentialCapability; -} - -/** The wire shape `@corbits/connections`' `missingCredentialDetail` defines - * (`{kind: "missing-credential", connectorId}`) — reproduced here rather - * than imported, per that module's own doc comment: any tool package can - * write this shape onto a `ToolResult` with no dependency on the - * `connections` package, since only the chat orchestrator's reader needs - * to parse it. `@corbits/github-tools`' `pull-request-tools.ts` follows - * the same convention. This is what turns the plain error message below - * into a real "Connect Giphy" button in chat instead of a dead end. */ -function missingCredentialDetail(connectorId: string) { - return { kind: "missing-credential", connectorId } as const; -} - -function notConnectedResult(callId: string): ToolResult { - return { - callId, - content: - "Connect Giphy to let Jimmy search for GIFs — this workspace has no Giphy credential yet.", - isError: true, - detail: missingCredentialDetail(GIPHY_CREDENTIAL_HANDLE), - }; -} - -/** - * Resolve this bundle's mediated Giphy credential, or `null` when it is - * not connected — an absent `env.credentials`, an unbound handle, or a - * denied grant all collapse to the same "not connected" signal. - */ -async function resolveGiphyCredential( - env: GifSearchEnv, -): Promise<{ fetchImpl: typeof fetch } | null> { - if (env.credentials === undefined) return null; - try { - const mediated = await env.credentials.resolve(GIPHY_CREDENTIAL_HANDLE); - return { fetchImpl: mediated.fetch as unknown as typeof fetch }; - } catch { - return null; - } -} - -function isAllowedGiphyHostURL(raw: string): boolean { - try { - const u = new URL(raw); - if (u.protocol !== "https:") return false; - return u.hostname === "giphy.com" || u.hostname.endsWith(".giphy.com"); - } catch { - return false; - } -} - -const MAX_TITLE_LENGTH = 120; - -/** Neutralize attacker-influenced titles before they reach a chat reply. */ -function sanitizeGifTitle(raw: string): string { - return raw - .replace(/[a-z][a-z0-9+.-]*:\/\/\S+/gi, "") - .replace(/\bwww\.\S+/gi, "") - .replace(/\s+/g, " ") - .trim() - .slice(0, MAX_TITLE_LENGTH) - .trim(); -} - -const GiphyRendition = type({ "url?": "string" }); - -const GiphyItem = type({ - "title?": "string", - "url?": "string", - "images?": { - "original?": GiphyRendition, - "downsized?": GiphyRendition, - "downsized_medium?": GiphyRendition, - "fixed_height?": GiphyRendition, - }, -}); -type GiphyItem = typeof GiphyItem.infer; - -const GiphyEnvelope = type({ - "data?": "unknown", - "meta?": { "status?": "number", "msg?": "string" }, -}); - -function pickCdnUrl(item: GiphyItem): string | undefined { - const renditions = [ - item.images?.original, - item.images?.downsized, - item.images?.downsized_medium, - item.images?.fixed_height, - ]; - for (const rendition of renditions) { - const url = rendition?.url?.trim(); - if (url !== undefined && url !== "" && isAllowedGiphyHostURL(url)) return url; - } - return undefined; -} - -function clampLimit(raw: number | undefined): number { - if (raw === undefined || !Number.isFinite(raw)) return DEFAULT_LIMIT; - const n = Math.floor(raw); - if (n < MIN_LIMIT) return MIN_LIMIT; - if (n > MAX_LIMIT) return MAX_LIMIT; - return n; -} - -/** - * Search Giphy through the mediated fetch bound to the "giphy" handle. - * The mediated fetch is responsible for authenticating the request (the - * tool never sees the raw key) — see this package's README for the one - * follow-up this depends on: a connector registration whose credential - * plugin can place the key on the query string Giphy's search endpoint - * requires. - */ -async function searchGiphy( - fetchImpl: typeof fetch, - query: string, - limit: number, -): Promise { - const url = new URL(`${GIPHY_API_HOST}/v1/gifs/search`); - url.searchParams.set("q", query); - url.searchParams.set("limit", String(limit)); - url.searchParams.set("rating", DEFAULT_RATING); - url.searchParams.set("lang", DEFAULT_LANG); - - const response = await fetchImpl(url.toString(), { - method: "GET", - headers: { Accept: "application/json" }, - }); - - if (!response.ok) { - throw new Error(`Giphy search failed: ${String(response.status)} ${response.statusText}`); - } - - const raw: unknown = await response.json(); - if (typeof raw !== "object" || raw === null || Array.isArray(raw)) { - throw new Error("Giphy search failed: unexpected response shape"); - } - const envelope = GiphyEnvelope(raw); - if (envelope instanceof type.errors) { - throw new Error(`Giphy search failed: ${envelope.summary}`); - } - const status = envelope.meta?.status; - if (status !== undefined && status !== 200) { - throw new Error(`Giphy rejected the request: ${envelope.meta?.msg ?? String(status)}`); - } - if (!Array.isArray(envelope.data)) { - throw new Error("Giphy search failed: response has no data array"); - } - - const mapped: GifResult[] = []; - for (const rawItem of envelope.data) { - if (mapped.length >= limit) break; - const item = GiphyItem(rawItem); - if (item instanceof type.errors) continue; - const cdnUrl = pickCdnUrl(item); - if (cdnUrl === undefined) continue; - const pageUrl = item.url?.trim(); - mapped.push({ - title: sanitizeGifTitle(item.title ?? ""), - cdnUrl, - ...(pageUrl !== undefined && pageUrl !== "" && isAllowedGiphyHostURL(pageUrl) - ? { pageUrl } - : {}), - }); - } - return mapped; -} - -function formatResults(results: GifResult[]): string { - if (results.length === 0) { - return "No GIFs found for that query. Try different search terms."; - } - return results - .map( - (r, i) => - `[${String(i + 1)}] ${r.title || "untitled"}\nCDN: ${r.cdnUrl}` + - (r.pageUrl !== undefined ? `\nPage: ${r.pageUrl}` : ""), - ) - .join("\n\n"); -} - -async function runGifSearch(env: GifSearchEnv, call: ToolCall): Promise { - const credential = await resolveGiphyCredential(env); - if (credential === null) { - return notConnectedResult(call.id); - } - const query = call.arguments["query"]; - if (typeof query !== "string" || query.trim() === "") { - return { - callId: call.id, - content: `${GIF_SEARCH_TOOL} requires a non-empty query argument`, - isError: true, - }; - } - const limit = clampLimit( - typeof call.arguments["limit"] === "number" ? (call.arguments["limit"] as number) : undefined, - ); - try { - const results = await searchGiphy(credential.fetchImpl, query.trim(), limit); - return { callId: call.id, content: formatResults(results) }; - } catch (err) { - return { - callId: call.id, - content: err instanceof Error ? err.message : String(err), - isError: true, - }; - } -} - -/** - * The `@corbits/jimmy-agent` package's one tool: search Giphy and return - * public CDN URLs. Never proxies media bytes; every GIF Jimmy surfaces - * carries "Powered by GIPHY" per Giphy's terms (rendered by the chat UI, - * not by this tool). - */ -export const gifSearchTool = defineTool({ - id: GIF_SEARCH_TOOL_ID, - requires: [], - definitions: [{ name: GIF_SEARCH_TOOL }], - factory: (env) => ({ - definitions: [ - { - name: GIF_SEARCH_TOOL, - description: - "Search Giphy for a GIF and return a public CDN URL. Call with " + - '{"query": "", "limit": 1} — query is required, ' + - "limit is optional (1-5, default 1). Reply with the returned " + - "CDN URL(s); never download or re-host the media.", - inputSchema: { - type: "object", - properties: { - query: { - type: "string", - description: "Search terms for the GIF.", - }, - limit: { - type: "number", - description: "How many GIF CDN URLs to return (1-5, default 1).", - }, - }, - required: ["query"], - }, - }, - ], - run: (call, _signal) => runGifSearch(env, call), - }), -}); diff --git a/agents/jimmy/src/index.ts b/agents/jimmy/src/index.ts deleted file mode 100644 index 010cf18636..0000000000 --- a/agents/jimmy/src/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -export { gifSearchTool, type GifResult, type GifSearchEnv } from "./gif-search-tool"; - -export { buildJimmyAgent, type BuildJimmyAgentInput } from "./agent"; - -export { - GIF_SEARCH_TOOL, - JIMMY_AGENT_ID, - JIMMY_DESCRIPTION, - JIMMY_DISPLAY_NAME, - JIMMY_SYSTEM_PROMPT, - JIMMY_TOOL_PACKAGE_PINS, -} from "./metadata"; diff --git a/agents/jimmy/src/metadata.ts b/agents/jimmy/src/metadata.ts deleted file mode 100644 index 1203ac50c9..0000000000 --- a/agents/jimmy/src/metadata.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Jimmy's plain-data identity: everything a caller needs to describe him -// without pulling his tool bodies in. The tool modules import `defineTool` -// from `@intx/agent`, whose module graph reaches `node:path`, so anything -// browser-reachable — the workbench template catalog among them — imports -// from here instead of from this package's index. -import type { ToolPackagePin } from "@intx/types/tool-packages"; - -export const JIMMY_AGENT_ID = "jimmy"; - -export const JIMMY_DISPLAY_NAME = "Jimmy"; - -export const JIMMY_DESCRIPTION = "Searches Giphy and replies with a GIF"; - -/** The agent-facing call name. `gif-search-tool.ts` gives it its namespaced id. */ -export const GIF_SEARCH_TOOL = "gif_search"; - -/** This definition pins itself: the package that carries `gif_search` is this one. */ -export const JIMMY_TOOL_PACKAGE_PINS: readonly ToolPackagePin[] = [ - { name: "@corbits/jimmy-agent", version: "0.0.3" }, -]; - -export const JIMMY_SYSTEM_PROMPT = - "You are Jimmy. Someone mentions you in chat with a request for a GIF " + - `— call \`${GIF_SEARCH_TOOL}\` with their words as the search query and ` + - "reply with the GIF it finds.\n" + - "\n" + - "Call the tool exactly once per request, with a short, literal query " + - "drawn from what they asked for — do not embellish or add unrelated " + - "terms. Reply with the CDN URL the tool returns so the chat renders " + - "the GIF; do not describe the GIF instead of showing it, and never " + - "download, re-host, or link anywhere other than the returned URL.\n" + - "\n" + - "If the tool comes back telling you Giphy is not connected, say that " + - "plainly in one sentence and stop — never invent a GIF, a URL, or a " + - "description in its place. If the search finds nothing, say so and " + - "suggest the requester try different words.\n" + - "\n" + - "You are a one-shot responder, not a conversation: one request, one " + - "reply, no follow-up picker."; diff --git a/agents/jimmy/tsconfig.json b/agents/jimmy/tsconfig.json deleted file mode 100644 index e125e90614..0000000000 --- a/agents/jimmy/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.src.json", - "compilerOptions": { - "composite": false, - "noEmit": true, - "disableSourceOfProjectReferenceRedirect": true, - "declaration": false, - "declarationMap": false, - "emitDeclarationOnly": false, - "tsBuildInfoFile": "tsconfig.tsbuildinfo", - "rootDir": "../.." - }, - "include": ["src"], - "exclude": [] -} diff --git a/agents/jimmy/tsconfig.src.json b/agents/jimmy/tsconfig.src.json deleted file mode 100644 index fc8724305f..0000000000 --- a/agents/jimmy/tsconfig.src.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src", "package.json", "src/**/*.json"], - "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"], - "compilerOptions": { - "types": ["bun"], - "composite": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" - } -} diff --git a/agents/scout/LICENSE b/agents/scout/LICENSE deleted file mode 100644 index c6487f4fdf..0000000000 --- a/agents/scout/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ -GNU LESSER GENERAL PUBLIC LICENSE - -Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - -Preamble - -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - -This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. - -When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. - -To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. - -For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - -We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - -To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - -Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. - -Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. - -When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. - -We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. - -For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. - -In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. - -Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. - -The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - -GNU LESSER GENERAL PUBLIC LICENSE -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". - -A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - -The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) - -"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - -1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. - -(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - -Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. - -This option is useful when you wish to copy part of the code of the Library into a program that is not a library. - -4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. - -If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. - -5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - -However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. - -When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. - -If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) - -Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - -6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. - -You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: - - a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - - e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. - -For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - -7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. - - b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. - -8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. - -10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - -11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - -14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Libraries - -If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). - -To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - one line to give the library's name and an idea of what it does. - Copyright (C) year name of author - - This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: - -Yoyodyne, Inc., hereby disclaims all copyright interest in -the library `Frob' (a library for tweaking knobs) written -by James Random Hacker. - -signature of Ty Coon, 1 April 1990 -Ty Coon, President of Vice -That's all there is to it! diff --git a/agents/scout/README.md b/agents/scout/README.md deleted file mode 100644 index 2cb84aebea..0000000000 --- a/agents/scout/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# @corbits/scout-agent - -Scout, ported from the standalone [scout](https://github.com/corbitsdev/scout) -repo (CL-6499): the system prompt, the tool declarations, and Scout's own -Library-artifact tool — everything one chat agent needs, in one package. - -## What's ported and how it's wired - -| Original tool | Status | Wired to | -| ------------------------ | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- | -| `knowledge-search` | ported as `memory_search` | `@corbits/memory-tools` (existing, unmodified) | -| `memory-add` | ported as `memory_add` | `@corbits/memory-tools` (existing, unmodified) | -| `memory-list` | ported as `memory_list` | `@corbits/memory-tools` (existing, unmodified) | -| `web-research` | ported as `web_search` | `@corbits/web-search-tools`, Exa-backed, credential handle `"exa"` (existing, unmodified) | -| `artifacts` | narrowed to save + list-recent | `./src/artifact-tool.ts` (new, this package), against `@corbits/artifacts-hub`'s workflow-artifacts HTTP surface | -| `launch-diligence-brief` | **deferred, dropped** | — | -| `launch-fact-check` | **deferred, dropped** | — | - -Scout's own tool bodies were never portable as-is: scout's -`docs/design/scout-core-purity.md` says the core/surface split that would -make them portable isn't built yet (CL-5143), and its own -`packages/scout/README.md` says its tools "compile into this repo's -sidecar rather than arriving as pinned, published packages" (CL-5179). -Only the declarations — the system prompt and the tool schemas — are -ported. Everything each tool calls is workbench's own existing -infrastructure. - -## Known gaps vs. the original Scout - -- **No diligence brief, no fact-check.** The two workflow-launching tools - are gone from both the tool list and the prompt (see - `./src/system-prompt.ts`'s header comment) — a ~2,600-line pipeline - (`workflows/diligence-brief/`, `workflows/diligence/`) that this port - does not carry. This Scout answers questions and remembers things; it - does not run a diligence pipeline. Someone who knows the Slack Scout - will notice this immediately — it's the biggest capability gap. -- **`artifacts` is narrower.** The original backed `artifact-search` (by - company/kind/query, with brief-freshness bands) and `artifact-read` - (paginated open-by-ref) against Scout's own hub API. - `@corbits/artifacts-hub`'s workflow-artifacts HTTP surface only offers - create and list-recent (no search-by-field, no read-by-id, no - pagination), so `save_artifact`/`list_recent_artifacts` is - what's actually available. -- **No per-principal attribution.** The original attributed every - read/write to the Slack-message's triggering principal - (`getTriggerPrincipal()`). This port's tools attribute to whatever - principal/tenant the deploying agent binds at runtime — the same model - every other tool package in this catalog (`@corbits/memory-tools`, - `@corbits/web-search-tools`) already uses, not a Scout-specific - regression. - -## Requires connecting - -`web_search` needs the Exa MCP preset connected (keyless — no API key, -just add it under Plugins). `save_artifact`/ -`list_recent_artifacts` need the Library/artifacts plane mounted -(already true wherever CL-5291 landed). A missing connection surfaces as -an honest `isError: true` tool result naming the gap — never a silent -failure or a fabricated answer. - -## Not done in this port - -Registering `SCOUT_AGENT_DEFINITION` into a live workbench (the -agent-directory create path, `packages/agent-directory`) is a follow-up, -not part of this package. This package is the portable definition only — -see `corbitsdev/examples`' `starter/agent-quickstart/README.md` for the -`defineAgent`/`createAgent` split this follows. diff --git a/agents/scout/package.json b/agents/scout/package.json deleted file mode 100644 index 150af8fd8a..0000000000 --- a/agents/scout/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@corbits/scout-agent", - "version": "0.0.6", - "description": "Scout, the research/due-diligence agent: a ported system prompt plus its firm-memory, web-research, and Library-artifact tool declarations for a workbench chat agent", - "license": "LGPL-2.1-or-later", - "repository": { - "type": "git", - "url": "https://github.com/corbitsdev/workbench.git", - "directory": "agents/scout" - }, - "files": [ - "src", - "LICENSE", - "README.md" - ], - "type": "module", - "exports": { - ".": "./src/index.ts", - "./definition": "./src/definition.ts" - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "typecheck": "tsc --noEmit", - "test": "bun test" - }, - "dependencies": { - "arktype": "catalog:" - }, - "devDependencies": { - "@corbits/memory": "github:corbitsdev/corbits-memory#9e6f213fa2c002b531d3f6af1aa0abd737b8afe3", - "@corbits/web-search-tools": "workspace:*", - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - "@types/bun": "catalog:", - "typescript": "catalog:" - }, - "peerDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0" - } -} diff --git a/agents/scout/src/artifact-client.test.ts b/agents/scout/src/artifact-client.test.ts deleted file mode 100644 index 27639daabe..0000000000 --- a/agents/scout/src/artifact-client.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { createScoutArtifact, listRecentScoutArtifacts } from "./artifact-client"; - -const CONFIG = { - hubArtifactsUrl: "https://hub.example", - sidecarToken: "sidecar-token", - runAddress: "run@example", -}; - -describe("createScoutArtifact", () => { - test("posts the input and returns the persisted id/version", async () => { - let capturedUrl = ""; - let capturedInit: RequestInit | undefined; - const fetchImpl = (async (url: string, init?: RequestInit) => { - capturedUrl = url; - capturedInit = init; - return new Response(JSON.stringify({ data: { id: "art_1", version: 1 } }), { - status: 201, - }); - }) as unknown as typeof fetch; - - const result = await createScoutArtifact( - { ...CONFIG, fetchImpl }, - { title: "Diligence note", kind: "text", content: "Body" }, - ); - - expect(result).toEqual({ id: "art_1", version: 1 }); - expect(capturedUrl).toBe("https://hub.example/api/workflow-artifacts/artifacts"); - expect(capturedInit?.method).toBe("POST"); - expect(JSON.parse(String(capturedInit?.body))).toEqual({ - title: "Diligence note", - kind: "text", - content: "Body", - }); - }); - - test("throws on a failed response", async () => { - const fetchImpl = (async () => - new Response("nope", { status: 500 })) as unknown as typeof fetch; - - await expect( - createScoutArtifact({ ...CONFIG, fetchImpl }, { title: "x", kind: "text", content: "y" }), - ).rejects.toThrow(/Scout artifact create failed/); - }); -}); - -describe("listRecentScoutArtifacts", () => { - test("returns the recent list", async () => { - const fetchImpl = (async () => - new Response( - JSON.stringify({ - data: [ - { - id: "art_1", - title: "Note", - kind: "text", - createdAt: "2026-08-01T00:00:00Z", - }, - ], - }), - { status: 200 }, - )) as unknown as typeof fetch; - - const items = await listRecentScoutArtifacts({ ...CONFIG, fetchImpl }); - expect(items).toEqual([ - { - id: "art_1", - title: "Note", - kind: "text", - createdAt: "2026-08-01T00:00:00Z", - }, - ]); - }); - - test("throws on a shape mismatch", async () => { - const fetchImpl = (async () => - new Response(JSON.stringify({ data: "not an array" }), { - status: 200, - })) as unknown as typeof fetch; - - await expect(listRecentScoutArtifacts({ ...CONFIG, fetchImpl })).rejects.toThrow( - /did not match the expected shape/, - ); - }); -}); diff --git a/agents/scout/src/artifact-client.ts b/agents/scout/src/artifact-client.ts deleted file mode 100644 index e78c027a6b..0000000000 --- a/agents/scout/src/artifact-client.ts +++ /dev/null @@ -1,104 +0,0 @@ -// A minimal client for the sanctioned workflow-artifacts HTTP surface -// (`@corbits/artifacts-hub`'s `createWorkflowArtifactRoutes`, CL-6000). -// Duplicated rather than imported, matching -// `workflows/last-30-days-research/src/artifact-client.ts`'s convention: -// this is Scout's own tool body, not a shared package, so it stays inside -// this package rather than adding a new cross-cutting dependency. -// Authenticates with the sidecar's own bearer token plus the run's own -// mailbox address (both already reach a workflow-process child's tool -// env), never a database handle. -import { type } from "arktype"; - -export interface ScoutArtifactClientConfig { - readonly hubArtifactsUrl: string; - readonly sidecarToken: string; - readonly runAddress: string; - /** Override for tests; defaults to the global `fetch`. */ - readonly fetchImpl?: typeof fetch; -} - -export type CreateScoutArtifactInput = { - readonly title: string; - readonly kind: string; - readonly content: string; -}; - -export type CreatedScoutArtifact = { - readonly id: string; - readonly version: number; -}; - -export type ScoutArtifactListItem = { - readonly id: string; - readonly title: string; - readonly kind: string; - readonly createdAt: string; -}; - -const CreatedScoutArtifactResponse = type({ - data: { id: "string", version: "number" }, -}); - -const ScoutArtifactListResponse = type({ - data: type({ - id: "string", - title: "string", - kind: "string", - createdAt: "string", - }).array(), -}); - -function authHeaders(config: ScoutArtifactClientConfig): Record { - return { - authorization: `Bearer ${config.sidecarToken}`, - "x-workflow-run-address": config.runAddress, - }; -} - -/** Persists one artifact. Throws on any transport, HTTP, or shape failure. */ -export async function createScoutArtifact( - config: ScoutArtifactClientConfig, - input: CreateScoutArtifactInput, -): Promise { - const doFetch = config.fetchImpl ?? fetch; - const response = await doFetch(`${config.hubArtifactsUrl}/api/workflow-artifacts/artifacts`, { - method: "POST", - headers: { ...authHeaders(config), "content-type": "application/json" }, - body: JSON.stringify(input), - }); - if (!response.ok) { - throw new Error(`Scout artifact create failed: ${response.status} ${response.statusText}`); - } - const body: unknown = await response.json(); - const parsed = CreatedScoutArtifactResponse(body); - if (parsed instanceof type.errors) { - throw new Error( - `Scout artifact create response did not match the expected shape: ${parsed.summary}`, - ); - } - return parsed.data; -} - -/** Lists the tenant's most recent artifacts. Throws on any transport, HTTP, or shape failure. */ -export async function listRecentScoutArtifacts( - config: ScoutArtifactClientConfig, - params: { readonly limit?: number } = {}, -): Promise { - const doFetch = config.fetchImpl ?? fetch; - const query = params.limit !== undefined ? `?limit=${String(params.limit)}` : ""; - const response = await doFetch( - `${config.hubArtifactsUrl}/api/workflow-artifacts/artifacts/recent${query}`, - { headers: authHeaders(config) }, - ); - if (!response.ok) { - throw new Error(`Scout artifact list failed: ${response.status} ${response.statusText}`); - } - const body: unknown = await response.json(); - const parsed = ScoutArtifactListResponse(body); - if (parsed instanceof type.errors) { - throw new Error( - `Scout artifact list response did not match the expected shape: ${parsed.summary}`, - ); - } - return parsed.data; -} diff --git a/agents/scout/src/artifact-tool.test.ts b/agents/scout/src/artifact-tool.test.ts deleted file mode 100644 index 03e8233538..0000000000 --- a/agents/scout/src/artifact-tool.test.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { - scoutArtifactTools, - SCOUT_ARTIFACT_SAVE_TOOL, - SCOUT_ARTIFACT_LIST_TOOL, - type ScoutArtifactEnv, -} from "./artifact-tool"; - -function testEnv(): ScoutArtifactEnv { - return { - hubArtifactsUrl: "https://hub.example", - sidecarToken: "token", - address: "run@example", - } as unknown as ScoutArtifactEnv; -} - -async function withMockFetch(response: () => Response, run: () => Promise): Promise { - const originalFetch = globalThis.fetch; - globalThis.fetch = (async () => response()) as unknown as typeof fetch; - try { - return await run(); - } finally { - globalThis.fetch = originalFetch; - } -} - -describe("scoutArtifactTools", () => { - test("declares the save tool with approval: ask", () => { - const saveDef = scoutArtifactTools.definitions.find((d) => d.name === SCOUT_ARTIFACT_SAVE_TOOL); - expect(saveDef?.approval).toBe("ask"); - }); - - test("save_artifact persists content and reports the artifact id", async () => { - const result = await withMockFetch( - () => - new Response(JSON.stringify({ data: { id: "art_9", version: 1 } }), { - status: 201, - }), - () => { - const bundle = scoutArtifactTools(testEnv()); - return bundle.run( - { - id: "call_1", - name: SCOUT_ARTIFACT_SAVE_TOOL, - arguments: { title: "Findings", content: "Full text" }, - }, - new AbortController().signal, - ); - }, - ); - - expect(result.isError).toBe(false); - expect(JSON.parse(String(result.content))).toEqual({ - id: "art_9", - version: 1, - title: "Findings", - persisted: true, - }); - }); - - test("save_artifact reports a failure honestly rather than fabricating success", async () => { - const result = await withMockFetch( - () => new Response("nope", { status: 500 }), - () => { - const bundle = scoutArtifactTools(testEnv()); - return bundle.run( - { - id: "call_2", - name: SCOUT_ARTIFACT_SAVE_TOOL, - arguments: { title: "Findings", content: "Full text" }, - }, - new AbortController().signal, - ); - }, - ); - - expect(result.isError).toBe(true); - expect(String(result.content)).toContain("Failed to persist"); - }); - - test("list_artifacts returns the recent items", async () => { - const result = await withMockFetch( - () => - new Response( - JSON.stringify({ - data: [ - { - id: "art_1", - title: "Note", - kind: "text", - createdAt: "2026-08-01T00:00:00Z", - }, - ], - }), - { status: 200 }, - ), - () => { - const bundle = scoutArtifactTools(testEnv()); - return bundle.run( - { id: "call_3", name: SCOUT_ARTIFACT_LIST_TOOL, arguments: {} }, - new AbortController().signal, - ); - }, - ); - - expect(result.isError).toBe(false); - expect(JSON.parse(String(result.content)).items).toHaveLength(1); - }); -}); diff --git a/agents/scout/src/artifact-tool.ts b/agents/scout/src/artifact-tool.ts deleted file mode 100644 index 6344dd2d00..0000000000 --- a/agents/scout/src/artifact-tool.ts +++ /dev/null @@ -1,154 +0,0 @@ -// Scout's artifact tools: `save_artifact` (persist, gated by human -// approval — every external side effect sits behind approval per -// AGENTS.md) and `list_recent_artifacts` (read-only recall). Kept -// inside this package rather than a shared tool package, matching -// `workflows/last-30-days-research/src/finalize-tool.ts`'s convention: -// this is Scout-specific logic, not a reusable integration on its own. -// -// This is narrower than the original Scout's `artifacts` tool, which -// backed `artifact-search`/`artifact-read` against its own hub API with -// company/kind filtering and pagination. The workbench workflow-artifacts -// HTTP surface (`@corbits/artifacts-hub`'s `createWorkflowArtifactRoutes`) -// only offers create and list-recent, so that's what these two tools do — -// see this package's README for the gap. -import { type } from "arktype"; -import { defineTool, type BaseEnv } from "@intx/agent"; -import { createScoutArtifact, listRecentScoutArtifacts } from "./artifact-client"; - -export const SCOUT_ARTIFACT_SAVE_TOOL = "save_artifact"; -export const SCOUT_ARTIFACT_LIST_TOOL = "list_artifacts"; - -const SaveArgs = type({ - title: "string > 0", - content: "string > 0", -}); - -export interface ScoutArtifactEnv extends BaseEnv { - readonly hubArtifactsUrl: string; - readonly sidecarToken: string; - readonly address: string; -} - -function clientConfig(env: ScoutArtifactEnv) { - return { - hubArtifactsUrl: env.hubArtifactsUrl, - sidecarToken: env.sidecarToken, - runAddress: env.address, - }; -} - -/** - * The `@corbits/scout-agent` artifact bundle: one write tool gated by - * human approval, one read-only recall tool. - */ -export const scoutArtifactTools = defineTool({ - id: "@corbits/scout-agent/artifacts", - requires: ["hubArtifactsUrl", "sidecarToken", "address"], - definitions: [ - { name: SCOUT_ARTIFACT_SAVE_TOOL, approval: "ask" }, - { name: SCOUT_ARTIFACT_LIST_TOOL }, - ], - factory: (env) => ({ - definitions: [ - { - name: SCOUT_ARTIFACT_SAVE_TOOL, - description: - "Persists a research write-up as a Library artifact, pending " + - "human approval. Use when the user asks for a write-up, brief, " + - "or summary worth keeping.", - approval: "ask", - inputSchema: { - type: "object", - properties: { - title: { type: "string", description: "A short title." }, - content: { - type: "string", - description: "The write-up's full content.", - }, - }, - required: ["title", "content"], - }, - }, - { - name: SCOUT_ARTIFACT_LIST_TOOL, - description: - "Lists the tenant's most recently saved Library artifacts, " + "most recent first.", - inputSchema: { - type: "object", - properties: { - limit: { - type: "number", - description: "Maximum number of artifacts to return.", - }, - }, - }, - }, - ], - run: async (call) => { - switch (call.name) { - case SCOUT_ARTIFACT_SAVE_TOOL: { - const parsed = SaveArgs(call.arguments); - if (parsed instanceof type.errors) { - return { - callId: call.id, - isError: true, - content: `Invalid arguments for ${SCOUT_ARTIFACT_SAVE_TOOL}: ${parsed.summary}`, - }; - } - try { - const created = await createScoutArtifact(clientConfig(env), { - title: parsed.title, - kind: "text", - content: parsed.content, - }); - return { - callId: call.id, - isError: false, - content: JSON.stringify({ - id: created.id, - version: created.version, - title: parsed.title, - persisted: true, - }), - }; - } catch (err) { - return { - callId: call.id, - isError: true, - content: `Failed to persist "${parsed.title}" as a Library artifact: ${ - err instanceof Error ? err.message : String(err) - }`, - }; - } - } - case SCOUT_ARTIFACT_LIST_TOOL: { - const limitArg = call.arguments["limit"]; - const limit = typeof limitArg === "number" ? limitArg : undefined; - try { - const items = await listRecentScoutArtifacts( - clientConfig(env), - limit !== undefined ? { limit } : {}, - ); - return { - callId: call.id, - isError: false, - content: JSON.stringify({ items }), - }; - } catch (err) { - return { - callId: call.id, - isError: true, - content: err instanceof Error ? err.message : String(err), - }; - } - } - default: - return { - callId: call.id, - isError: true, - content: `@corbits/scout-agent: unknown tool "${call.name}"`, - }; - } - }, - }), -}); diff --git a/agents/scout/src/definition.test.ts b/agents/scout/src/definition.test.ts deleted file mode 100644 index 100eab6350..0000000000 --- a/agents/scout/src/definition.test.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { describe, expect, test } from "bun:test"; -import { SCOUT_AGENT_DEFINITION, SCOUT_TOOL_PACKAGE_PINS } from "./definition"; - -describe("SCOUT_AGENT_DEFINITION", () => { - test("is plain, JSON-portable data", () => { - expect(() => JSON.stringify(SCOUT_AGENT_DEFINITION)).not.toThrow(); - expect(SCOUT_AGENT_DEFINITION.id).toBe("scout"); - expect(SCOUT_AGENT_DEFINITION.handle).toBe("scout"); - }); - - test("pins the tool packages Scout's prompt actually depends on", () => { - const names = SCOUT_TOOL_PACKAGE_PINS.map((pin) => pin.name); - expect(names).toContain("@corbits/memory"); - expect(names).toContain("@corbits/web-search-tools"); - expect(names).toContain("@corbits/scout-agent"); - }); - - test("never promises the deferred diligence-brief or fact-check tools", () => { - const prompt = SCOUT_AGENT_DEFINITION.systemPrompt; - // The tool names themselves must never appear — those tools don't exist. - expect(prompt).not.toMatch(/launch-diligence-brief/i); - expect(prompt).not.toMatch(/launch-fact-check/i); - // The prompt must disclaim the capability rather than staying silent - // and letting the model promise a brief it can't produce. - expect(prompt).toMatch(/cannot launch a multi-step diligence brief/i); - }); - - test("names every tool it actually declares", () => { - const prompt = SCOUT_AGENT_DEFINITION.systemPrompt; - for (const toolName of [ - "memory_search", - "memory_add", - "memory_list", - "web_search", - "save_artifact", - "list_artifacts", - ]) { - expect(prompt).toContain(toolName); - } - }); -}); diff --git a/agents/scout/src/definition.ts b/agents/scout/src/definition.ts deleted file mode 100644 index d4073add0f..0000000000 --- a/agents/scout/src/definition.ts +++ /dev/null @@ -1,57 +0,0 @@ -// Scout as installable data: an id/handle/displayName/description/ -// systemPrompt object plus the tool packages it needs — the same plain- -// data shape `@corbits/code-review`'s `ReviewerDefinition` establishes as -// "exactly what the agent-directory create path takes, so the same -// definition can be installed as an agent in a workbench." Scout adds one -// field that shape doesn't need: `toolPackagePins`, since Scout (unlike a -// pure-text reviewer) calls tools. -// -// Tools are never inlined here, matching every workflow definition in -// this catalog (see `workflows/attio-task-agent/src/index.ts`'s header -// comment): they arrive as pinned packages at deploy time, keeping this -// definition pure data. `@corbits/memory` (CL-8186) supplies firm -// memory (memory_search/memory_add/memory_list) directly — it is not a -// workbench-built tool package but a published dependency that declares -// its own `interchange.tools` surface, resolved the same way as any -// other pin. `@corbits/web-search-tools` gives web-research (Exa-backed, -// credential handle `"exa"`, satisfied by the keyless Exa MCP preset in -// `packages/connections/src/mcp-presets.ts`). The third, -// `@corbits/scout-agent` itself, supplies `./artifact-tool.ts`. -// -// `launch-diligence-brief` and `launch-fact-check` are not pinned here — -// see `./system-prompt.ts`'s header comment and this package's README for -// why they're deferred rather than wired to something that would fail. -import type { ToolPackagePin } from "@intx/types/tool-packages"; -import { SCOUT_SYSTEM_PROMPT } from "./system-prompt"; - -export const SCOUT_AGENT_ID = "scout"; -export const SCOUT_AGENT_HANDLE = "scout"; -export const SCOUT_AGENT_DISPLAY_NAME = "Scout"; -export const SCOUT_AGENT_DESCRIPTION = - "Research and due-diligence analyst: searches firm memory and the web, " + - "saves and recalls Library write-ups, and answers with sources."; - -export const SCOUT_TOOL_PACKAGE_PINS: readonly ToolPackagePin[] = [ - { name: "@corbits/memory", version: "0.1.2" }, - { name: "@corbits/web-search-tools", version: "0.0.4" }, - { name: "@corbits/scout-agent", version: "0.0.6" }, -]; - -/** The plain-data shape the agent-directory create path takes. */ -export interface ScoutAgentDefinition { - readonly id: string; - readonly handle: string; - readonly displayName: string; - readonly description: string; - readonly systemPrompt: string; - readonly toolPackagePins: readonly ToolPackagePin[]; -} - -export const SCOUT_AGENT_DEFINITION: ScoutAgentDefinition = { - id: SCOUT_AGENT_ID, - handle: SCOUT_AGENT_HANDLE, - displayName: SCOUT_AGENT_DISPLAY_NAME, - description: SCOUT_AGENT_DESCRIPTION, - systemPrompt: SCOUT_SYSTEM_PROMPT, - toolPackagePins: SCOUT_TOOL_PACKAGE_PINS, -}; diff --git a/agents/scout/src/index.ts b/agents/scout/src/index.ts deleted file mode 100644 index 75f6b4a1fc..0000000000 --- a/agents/scout/src/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -export { - SCOUT_AGENT_ID, - SCOUT_AGENT_HANDLE, - SCOUT_AGENT_DISPLAY_NAME, - SCOUT_AGENT_DESCRIPTION, - SCOUT_TOOL_PACKAGE_PINS, - SCOUT_AGENT_DEFINITION, - type ScoutAgentDefinition, -} from "./definition"; -export { SCOUT_SYSTEM_PROMPT } from "./system-prompt"; -export { - createScoutArtifact, - listRecentScoutArtifacts, - type ScoutArtifactClientConfig, - type CreateScoutArtifactInput, - type CreatedScoutArtifact, - type ScoutArtifactListItem, -} from "./artifact-client"; -export { - scoutArtifactTools, - SCOUT_ARTIFACT_SAVE_TOOL, - SCOUT_ARTIFACT_LIST_TOOL, - type ScoutArtifactEnv, -} from "./artifact-tool"; diff --git a/agents/scout/src/system-prompt.ts b/agents/scout/src/system-prompt.ts deleted file mode 100644 index b60ac93c3d..0000000000 --- a/agents/scout/src/system-prompt.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Scout's system prompt, ported from the original Slack-facing Scout -// (`workflows/scout/src/definition.ts` in the scout repo) and adapted for -// workbench chat with this port's actual tool surface. -// -// Two things changed on purpose, not just cosmetically: -// -// 1. Slack-specific mechanics are gone: the JSON-payload-with-priorTurns -// convention, mrkdwn formatting rules, and the ambient/NO_REPLY gate -// were all Slack-adapter concerns that don't exist in workbench chat. -// -// 2. `launch-diligence-brief` and `launch-fact-check` are gone, not -// reworded. The originals front ~2,600 lines of workflow (parse-brief, -// section-plan, actions) that this port does not carry — see this -// package's README. A prompt that still told Scout to "launch a -// diligence brief" would have it promise a PDF that never arrives, so -// every rule about those two tools, brief freshness bands, and -// company-name disambiguation before launching a brief is removed -// rather than patched. This Scout answers questions and remembers -// things; it does not run a diligence pipeline. -export const SCOUT_SYSTEM_PROMPT = [ - "You are Scout, the research and due-diligence analyst in this workbench. Direct, specific, zero filler. Never narrate your process — give the answer with its sources.", - "Rules:", - "- Check firm knowledge first (memory_search), then the web (web_search) for anything external. Cite sources by title and URL when you have one. Never invent sources or numbers. Found nothing? Say so in one line.", - "- When the user asks to save a note, leave a reminder, or remember something for later (for a person, deal, or topic), call memory_add with a short title and the full text. Do not refuse — you have this tool. Confirm what was saved in one line.", - "- Use memory_list when the user asks what notes were recently saved, or to skim recent firm memory without a specific search query.", - "- When the user asks for a write-up, brief, or summary worth keeping, call save_artifact with a short title and the full content — this persists it to the Library, pending human approval. Say plainly that it's pending approval; never claim it's saved before that approval completes.", - "- Use list_artifacts when the user asks what's recently been saved to the Library, or wants to pick up a prior write-up instead of starting fresh.", - "- Use tools ONLY via tool calls — never write tool names or call syntax in a reply.", - "- Keep answers direct and narrow. When you suggest a next step, suggest exactly ONE concrete action you can actually perform with your tools right now (search memory, search the web, save a note, save or recall an artifact) — never a menu of options, and never offer something you can't fulfill.", - "- You cannot launch a multi-step diligence brief or fact-check pipeline. If asked for one, say so plainly and offer to research the question directly with the tools you have instead of pretending to start a report that will never arrive.", - "- Reply in plain markdown: **bold**, _italic_, bullets, and `[Title](url)` links. Answer first, in the first line; a few short lines max.", -].join("\n\n"); diff --git a/agents/scout/test/web-research-integration.test.ts b/agents/scout/test/web-research-integration.test.ts deleted file mode 100644 index bf408fed92..0000000000 --- a/agents/scout/test/web-research-integration.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -// Proves the actual path Scout uses for web research: the real -// `@corbits/web-search-tools` bundle pinned by `SCOUT_TOOL_PACKAGE_PINS`, -// not a stand-in. This is the red/green pair the port was asked to -// demonstrate: a research question answered through the Exa-backed -// `web_search` tool with the search stubbed, and a missing credential -// surfacing an honest "not connected" result rather than failing -// silently or fabricating results. -import { describe, expect, test } from "bun:test"; -import { WEB_SEARCH_TOOL, webSearchTools } from "@corbits/web-search-tools"; -import type { WebSearchEnv } from "@corbits/web-search-tools"; -import { SCOUT_TOOL_PACKAGE_PINS } from "../src/definition"; - -describe("Scout's web-research path (@corbits/web-search-tools)", () => { - test("SCOUT_TOOL_PACKAGE_PINS pins the package this test exercises", () => { - expect(SCOUT_TOOL_PACKAGE_PINS).toContainEqual({ - name: "@corbits/web-search-tools", - version: "0.0.4", - }); - }); - - test("answers a research question when the Exa search is connected (stubbed)", async () => { - const stubbedFetch = (async () => - new Response( - JSON.stringify({ - results: [ - { - title: "Acme Corp raises Series B", - url: "https://example.com/acme-series-b", - publishedDate: "2026-08-01T00:00:00Z", - }, - ], - }), - )) as unknown as typeof fetch; - - const env: WebSearchEnv = { - credentials: { - resolve: async () => ({ kind: "http", fetch: stubbedFetch }), - }, - } as unknown as WebSearchEnv; - - const bundle = webSearchTools(env); - const result = await bundle.run( - { - id: "call_1", - name: WEB_SEARCH_TOOL, - arguments: { query: "Acme Corp funding" }, - }, - new AbortController().signal, - ); - - expect(result.isError).toBeFalsy(); - const parsed = JSON.parse(String(result.content)) as { - results: { title: string; url: string }[]; - }; - expect(parsed.results[0]?.title).toBe("Acme Corp raises Series B"); - }); - - test("surfaces a connect prompt instead of failing silently when Exa isn't connected", async () => { - const env: WebSearchEnv = { - credentials: undefined, - } as unknown as WebSearchEnv; - - const bundle = webSearchTools(env); - const result = await bundle.run( - { - id: "call_2", - name: WEB_SEARCH_TOOL, - arguments: { query: "Acme Corp funding" }, - }, - new AbortController().signal, - ); - - expect(result.isError).toBe(true); - expect(result.content).toBe("Web search is not connected for this user."); - }); -}); diff --git a/agents/scout/tsconfig.json b/agents/scout/tsconfig.json deleted file mode 100644 index a8c2b9966d..0000000000 --- a/agents/scout/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.src.json", - "compilerOptions": { - "composite": false, - "noEmit": true, - "disableSourceOfProjectReferenceRedirect": true, - "declaration": false, - "declarationMap": false, - "emitDeclarationOnly": false, - "tsBuildInfoFile": "tsconfig.tsbuildinfo", - "rootDir": "../.." - }, - "include": ["src", "test"], - "exclude": [] -} diff --git a/agents/scout/tsconfig.src.json b/agents/scout/tsconfig.src.json deleted file mode 100644 index fc8724305f..0000000000 --- a/agents/scout/tsconfig.src.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src", "package.json", "src/**/*.json"], - "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"], - "compilerOptions": { - "types": ["bun"], - "composite": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" - } -} diff --git a/apps/hub/package.json b/apps/hub/package.json index e7e617dcfa..aed984cf1d 100644 --- a/apps/hub/package.json +++ b/apps/hub/package.json @@ -24,7 +24,6 @@ "@corbits/connections": "workspace:*", "@corbits/credential-providers": "workspace:*", "@corbits/cron": "workspace:*", - "@corbits/diligence-brief-workflow": "workspace:*", "@corbits/docker-provisioner": "workspace:*", "@corbits/e2b-sandbox-sidecar": "workspace:*", "@corbits/echo-workflow": "workspace:*", diff --git a/apps/web/src/agents-api.ts b/apps/web/src/agents-api.ts index c8df8a03a4..7e402aef0f 100644 --- a/apps/web/src/agents-api.ts +++ b/apps/web/src/agents-api.ts @@ -187,8 +187,7 @@ export type CreateAgentDefinitionInput = { readonly model?: string; readonly skills?: readonly string[]; /** Tool packages to pin by name (no version — the create route - * resolves each to `*`). Used by a template-driven create - * (`instantiateWorkbenchTemplate`'s Scout/Jimmy requests), never by + * resolves each to `*`). Used by a template-driven create, never by * the hand-authored create form, which has no field for it. */ readonly toolPackagePins?: readonly string[]; }; diff --git a/bun.lock b/bun.lock index 9f4c4ae95e..bdeb06c584 100644 --- a/bun.lock +++ b/bun.lock @@ -50,42 +50,6 @@ "@intx/workflow": "0.3.0", }, }, - "agents/jimmy": { - "name": "@corbits/jimmy-agent", - "version": "0.0.3", - "dependencies": { - "arktype": "catalog:", - }, - "devDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - "@types/bun": "catalog:", - "typescript": "catalog:", - }, - "peerDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - }, - }, - "agents/scout": { - "name": "@corbits/scout-agent", - "version": "0.0.6", - "dependencies": { - "arktype": "catalog:", - }, - "devDependencies": { - "@corbits/memory": "github:corbitsdev/corbits-memory#9e6f213fa2c002b531d3f6af1aa0abd737b8afe3", - "@corbits/web-search-tools": "workspace:*", - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - "@types/bun": "catalog:", - "typescript": "catalog:", - }, - "peerDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - }, - }, "apps/hub": { "name": "@workbench/hub", "version": "0.0.1", @@ -102,7 +66,6 @@ "@corbits/connections": "workspace:*", "@corbits/credential-providers": "workspace:*", "@corbits/cron": "workspace:*", - "@corbits/diligence-brief-workflow": "workspace:*", "@corbits/docker-provisioner": "workspace:*", "@corbits/e2b-sandbox-sidecar": "workspace:*", "@corbits/echo-workflow": "workspace:*", @@ -420,7 +383,6 @@ "@corbits/error-sink": "workspace:*", "@corbits/icons": "workspace:*", "@corbits/inference-settings": "workspace:*", - "@corbits/jimmy-agent": "workspace:*", "@corbits/react-ui": "github:corbitsdev/react-ui#3b122812a307ccb35be31386f7696020c5a84635", "@tanstack/react-query": "catalog:", "arktype": "catalog:", @@ -1608,23 +1570,6 @@ "@intx/workflow": "0.3.0", }, }, - "workflows/diligence-brief": { - "name": "@corbits/diligence-brief-workflow", - "version": "0.0.1", - "dependencies": { - "@corbits/memory": "github:corbitsdev/corbits-memory#9e6f213fa2c002b531d3f6af1aa0abd737b8afe3", - "arktype": "catalog:", - }, - "devDependencies": { - "@types/bun": "catalog:", - "typescript": "catalog:", - }, - "peerDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - "@intx/workflow": "0.3.0", - }, - }, "workflows/echo": { "name": "@corbits/echo-workflow", "version": "0.0.1", @@ -1950,8 +1895,6 @@ "@corbits/cron": ["@corbits/cron@workspace:packages/cron"], - "@corbits/diligence-brief-workflow": ["@corbits/diligence-brief-workflow@workspace:workflows/diligence-brief"], - "@corbits/docker-provisioner": ["@corbits/docker-provisioner@workspace:packages/docker-provisioner"], "@corbits/e2b-sandbox-sidecar": ["@corbits/e2b-sandbox-sidecar@workspace:packages/e2b-sandbox-sidecar"], @@ -1986,8 +1929,6 @@ "@corbits/interaction-tools": ["@corbits/interaction-tools@workspace:tools/interaction"], - "@corbits/jimmy-agent": ["@corbits/jimmy-agent@workspace:agents/jimmy"], - "@corbits/last-30-days-research-workflow": ["@corbits/last-30-days-research-workflow@workspace:workflows/last-30-days-research"], "@corbits/linear-tools": ["@corbits/linear-tools@workspace:tools/linear"], @@ -2032,8 +1973,6 @@ "@corbits/sandbox-sidecar": ["@corbits/sandbox-sidecar@workspace:packages/sandbox-sidecar"], - "@corbits/scout-agent": ["@corbits/scout-agent@workspace:agents/scout"], - "@corbits/settings-ui": ["@corbits/settings-ui@workspace:packages/settings-ui"], "@corbits/shell-layout": ["@corbits/shell-layout@workspace:packages/shell-layout"], @@ -3236,10 +3175,14 @@ "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@corbits/assistant-workflow/@corbits/memory": ["@corbits/memory@github:corbitsdev/corbits-memory#9e6f213", { "dependencies": { "@intx/agent": "0.2.2", "@intx/authz": "0.2.2", "@intx/hub-api": "0.2.2", "@intx/log": "0.2.2", "@intx/workflow": "0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.1", "hono": "^4.9.0", "hono-openapi": "^1.3.1", "postgres": "^3.4.7" } }, "corbitsdev-corbits-memory-9e6f213", "sha512-utnM4ZT2zmslcPXYWAAqxlDNLcpGsXFiTOtj8h7+OXnhCP0Eaw8yl25+yCTyHpvt3jcdeG4h5uFsSj7ou0BZCA=="], + "@corbits/inbox/@corbits/mailbox": ["@corbits/mailbox@github:corbitsdev/corbits-mailbox#e85b81e", { "dependencies": { "@hono/standard-validator": "0.2.3", "@intx/crypto": "0.3.0", "@standard-community/standard-json": "0.3.5", "@standard-community/standard-openapi": "0.2.9", "arktype": "2.1.29", "hono-openapi": "1.3.1" }, "peerDependencies": { "@intx/log": "^0.2.2", "drizzle-orm": "^0.45.2", "hono": "^4.12.0", "postgres": "^3.4.0" } }, "corbitsdev-corbits-mailbox-e85b81e", "sha512-ATPP/pll1sYG1DLKV1HvtboK8q1tFkqayQqRXdUmRUIsFJx5wqzd8YA1XELjXzLu1P2f2uCMe2CjsJHGv6E90Q=="], "@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], + "@corbits/plugins-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + + "@corbits/settings-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], "@tailwindcss/oxide-wasm32-wasi/@emnapi/core": ["@emnapi/core@1.11.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.3", "tslib": "^2.4.0" }, "bundled": true }, "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg=="], @@ -3254,10 +3197,16 @@ "@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + "@workbench/hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#5309a15", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/hub-api": "^0.3.0", "@intx/types": "^0.3.0", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-5309a15", "sha512-zGHkq++juclUrOd0O8/Z5ziTldmJZ6gqyH/c9cs5S10UPU4gqn8CHwq174SiJXY0ujJ3cNpJXnrr+0fcqlfQ1w=="], + + "@workbench/hub/@corbits/mailbox": ["@corbits/mailbox@github:corbitsdev/corbits-mailbox#e85b81e", { "dependencies": { "@hono/standard-validator": "0.2.3", "@intx/crypto": "0.3.0", "@standard-community/standard-json": "0.3.5", "@standard-community/standard-openapi": "0.2.9", "arktype": "2.1.29", "hono-openapi": "1.3.1" }, "peerDependencies": { "@intx/log": "^0.2.2", "drizzle-orm": "^0.45.2", "hono": "^4.12.0", "postgres": "^3.4.0" } }, "corbitsdev-corbits-mailbox-e85b81e", "sha512-ATPP/pll1sYG1DLKV1HvtboK8q1tFkqayQqRXdUmRUIsFJx5wqzd8YA1XELjXzLu1P2f2uCMe2CjsJHGv6E90Q=="], + "@workbench/hub/@corbits/memory": ["@corbits/memory@github:corbitsdev/corbits-memory#e74da20", { "dependencies": { "@intx/agent": "0.2.2", "@intx/authz": "0.2.2", "@intx/hub-api": "0.2.2", "@intx/log": "0.2.2", "@intx/workflow": "0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.1", "hono": "^4.9.0", "hono-openapi": "^1.3.1", "postgres": "^3.4.7" } }, "corbitsdev-corbits-memory-e74da20", "sha512-/uA9xTcF7XwMXgnR8OZamierzkLG4g4mhw3u9Fl3Uj6ait8pH3wcoQ6V32on1nMdaqtPRdYVFnxof5O+4ZacGA=="], "@workbench/sidecar/@corbits/oauth-core": ["@corbits/oauth-core@github:corbitsdev/corbits-oauth-core#e1e69e6", { "dependencies": { "arktype": "2.2.3" } }, "corbitsdev-corbits-oauth-core-e1e69e6", "sha512-wUrD73iVyk/Dtb4yRn3hCh6N8syfsEvAkRz4XYqT0FIB3sYDSMYEWHcDMJx9nq64my/HBOeN1J6PHIOtpjhtPg=="], + "@workbench/web/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "better-call/@better-auth/utils": ["@better-auth/utils@0.5.0", "", { "dependencies": { "@noble/hashes": "^2.0.1" } }, "sha512-BL8W4EfIZFwlu0r54m3v1ztjDhu6dDe/amLTm0xybmbZaNgYUqhD3SjpAsnq0q8YD6/ki4iwIgxJNLP/N3TxiA=="], "body-parser/content-type": ["content-type@2.1.0", "", {}, "sha512-mj7UPXE0jaqaOsukNZRUEfEi2AcL7C/vwmwcHV0O97eO1E1pxBZuyjlZrx5seTaNBg1U6+o35wpa35Qfcc+7ag=="], @@ -3300,6 +3249,8 @@ "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], + "@corbits/inbox/@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], + "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.18.20", "", { "os": "android", "cpu": "arm" }, "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw=="], "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.18.20", "", { "os": "android", "cpu": "arm64" }, "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ=="], @@ -3344,6 +3295,8 @@ "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], + "@workbench/hub/@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], + "minipass-flush/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], "minipass-pipeline/minipass/yallist": ["yallist@4.0.0", "", {}, "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="], diff --git a/docs/AGENT_TEST.md b/docs/AGENT_TEST.md index 3b32d14f9f..4c36a57531 100644 --- a/docs/AGENT_TEST.md +++ b/docs/AGENT_TEST.md @@ -92,8 +92,7 @@ Agents extending what they can do. unconnected plugin, the agent recommends connecting it by name and the connect flow is one click away — credentials are collected BEFORE the capability is exercised, per the guided-join rule. -- [ ] Agent-declared slash commands register on join and vanish on leave - (`/gif`, `/jimmy`). +- [ ] Agent-declared slash commands register on join and vanish on leave. - [ ] **Auto-creating skills**: ask an agent to capture a working method as a skill; the skill exists, is versioned, pinned to the agent, and demonstrably changes behavior on next use. diff --git a/docs/seed-reconciliation.md b/docs/seed-reconciliation.md index 33af8368c5..314aba6fd7 100644 --- a/docs/seed-reconciliation.md +++ b/docs/seed-reconciliation.md @@ -67,8 +67,8 @@ nobody had asked for yet. Those three, plus every other `workflows/` source package that exports a builder (`code-review`, `granola-call`, `morning-brief`, `exa-topic-watch`, `process-granola-call`, `attio-task-agent`, `pain-point-collateral`, -`reddit-opportunity-scanner`, `collateral-generation`, -`diligence-brief`), now live in `CATALOG_WORKFLOWS`, same shape +`reddit-opportunity-scanner`, `collateral-generation`), now live in +`CATALOG_WORKFLOWS`, same shape (`DefinitionWithAgentSteps`-backed `DefaultWorkflow` entries) and deployable through the catalog instantiate route (CL-7073), but never automatically at signup. @@ -236,9 +236,9 @@ garbage-collect. ## Credential-bound catalog workflows (CL-7073) -Six `CATALOG_WORKFLOWS` entries — granola-call, morning-brief, -process-granola-call, pain-point-collateral, collateral-generation, -diligence-brief — declare `credentialBindings` in their definition. +Five `CATALOG_WORKFLOWS` entries — granola-call, morning-brief, +process-granola-call, pain-point-collateral, collateral-generation — +declare `credentialBindings` in their definition. `deployCodeSourcedWorkflow` (`vendor/intx/hub-sessions`) refuses to resolve those bindings without a `credentialCipher`, and the current Interchange pin's `POST /template-blocks/:assetName/deploy` front (the diff --git a/packages/agent-directory/src/validation.ts b/packages/agent-directory/src/validation.ts index 75c24a6d9b..442fb269d6 100644 --- a/packages/agent-directory/src/validation.ts +++ b/packages/agent-directory/src/validation.ts @@ -66,7 +66,7 @@ export const CreateAgentDefinitionInput = type({ // an agent through a form, which has no affordance for typing one; // callers that supply it install an agent whose tools ship as pinned // packages rather than inline capabilities (a native `workflows/*` - // agent-directory create, Scout, Jimmy). + // agent-directory create). "toolPackagePins?": ToolPackagePinArray, }); export type CreateAgentDefinitionInput = typeof CreateAgentDefinitionInput.infer; diff --git a/packages/chat-ui/package.json b/packages/chat-ui/package.json index b2d87d6d5c..dfb129ee97 100644 --- a/packages/chat-ui/package.json +++ b/packages/chat-ui/package.json @@ -30,7 +30,6 @@ "@corbits/error-sink": "workspace:*", "@corbits/icons": "workspace:*", "@corbits/inference-settings": "workspace:*", - "@corbits/jimmy-agent": "workspace:*", "@corbits/react-ui": "github:corbitsdev/react-ui#3b122812a307ccb35be31386f7696020c5a84635", "@tanstack/react-query": "catalog:", "arktype": "catalog:", diff --git a/packages/chat-ui/src/api.ts b/packages/chat-ui/src/api.ts index ccb09eb1db..7e179c1d3f 100644 --- a/packages/chat-ui/src/api.ts +++ b/packages/chat-ui/src/api.ts @@ -17,13 +17,6 @@ import type { ParticipantRecord } from "./wire/participants"; import type { WorkbenchOnboardingStep } from "./wire/blocks"; import { UnauthenticatedError } from "@corbits/api-query"; import { InferenceSettingsApiError } from "@corbits/inference-settings"; -import { - JIMMY_AGENT_ID, - JIMMY_DESCRIPTION, - JIMMY_DISPLAY_NAME, - JIMMY_SYSTEM_PROMPT, - JIMMY_TOOL_PACKAGE_PINS, -} from "@corbits/jimmy-agent/metadata"; import { CHAT_STRINGS } from "./strings"; export { @@ -602,37 +595,6 @@ export function postWorkbenchOnboardingStep( ); } -// Jimmy's own create-agent request shape — CL-6499 removed his workbench -// template (he is not a "kind of workbench"), so this dialog's own "Add -// Jimmy" quick-create row (see `invite-agent-dialog.tsx`) is his only -// create path left. Built straight off his own package's metadata -// (pure data, no tool bodies, no server-only imports — safe to reference -// from browser code) rather than an `AgentDefinition` builder: Jimmy has -// no handle or display name of his own outside this shape. `JIMMY_AGENT_ID` -// ("jimmy") is both his id and the handle a person types to reach him. -export const JIMMY_QUICK_CREATE = { - name: JIMMY_DISPLAY_NAME, - handle: JIMMY_AGENT_ID, - description: JIMMY_DESCRIPTION, - systemPrompt: JIMMY_SYSTEM_PROMPT, - toolPackagePins: JIMMY_TOOL_PACKAGE_PINS.map((pin) => pin.name), -}; - -const CreatedAgentDefinition = type({ id: "string" }); - -/** - * Creates Jimmy's agent-directory definition in one call — the same - * one-shot `POST /agent-definitions` a template-driven participant create - * goes through. Idempotency is the caller's job: only offer this when - * `JIMMY_QUICK_CREATE.handle` is absent from the tenant's invitable list. - */ -export function quickCreateJimmy(tenantId: string): Promise<{ readonly id: string }> { - return request(`/api/tenants/${tenantId}/agent-definitions`, CreatedAgentDefinition, { - method: "POST", - body: JSON.stringify(JIMMY_QUICK_CREATE), - }); -} - // `DELETE /workbenches/:id/participants/:address` (see // `packages/chat/src/routes.ts`): the removal counterpart to // `inviteAgent`/workbench creation's own join — drops the participant and, diff --git a/packages/chat-ui/src/invite-agent-dialog.tsx b/packages/chat-ui/src/invite-agent-dialog.tsx index 976e6bede2..30f2997d34 100644 --- a/packages/chat-ui/src/invite-agent-dialog.tsx +++ b/packages/chat-ui/src/invite-agent-dialog.tsx @@ -3,9 +3,7 @@ // host — the server-side list already excludes it), each with an // "Invite" action that launches it into the current workbench. The list // itself carries its own loading/empty/error states since it is fetched -// fresh every time the dialog opens. When Jimmy has never been created -// in this tenant, an extra "Add Jimmy" row offers to create and invite -// him in one click — see `quickCreateJimmy` in `./api`. +// fresh every time the dialog opens. import { Button, @@ -22,21 +20,10 @@ import { Users, WarningCircle } from "@corbits/icons"; import { useEffect, useState } from "react"; import { deriveDisplayName } from "./wire/display-name"; -import { - ChatApiError, - describeChatError, - JIMMY_QUICK_CREATE, - listInvitableDefinitions, - quickCreateJimmy, -} from "./api"; +import { ChatApiError, describeChatError, listInvitableDefinitions } from "./api"; import type { InvitableDefinition } from "./api"; import { CHAT_STRINGS } from "./strings"; -// A sentinel `invitingId` distinct from any real definition id — lets the -// "Add Jimmy" row show its own "Adding…" state while `quickCreateJimmy` -// runs, before a real definition id exists to key off of. -const JIMMY_QUICK_CREATE_MARKER = "jimmy-quick-create"; - type ListState = | { readonly kind: "loading" } | { readonly kind: "error"; readonly message: string } @@ -98,28 +85,6 @@ export function InviteAgentDialog({ } } - /** - * Jimmy is no longer seeded by a workbench template (CL-6499: he is not - * a "kind of workbench") — this row is his one remaining create path. - * Creating him mints a real, tenant-wide agent-directory definition, - * exactly like a template's participant create did; inviting him into - * this workbench reuses `handleInvite`'s own state and error handling. - */ - async function handleQuickCreateJimmy() { - setInvitingId(JIMMY_QUICK_CREATE_MARKER); - setInviteError(null); - try { - const created = await quickCreateJimmy(tenantId); - await handleInvite(created.id); - } catch { - setInviteError(CHAT_STRINGS.inviteAgentQuickCreateError); - setInvitingId(null); - } - } - - const jimmyMissing = - state.kind === "ready" && !state.items.some((item) => item.name === JIMMY_QUICK_CREATE.handle); - return ( @@ -141,7 +106,7 @@ export function InviteAgentDialog({ title={CHAT_STRINGS.inviteAgentLoadError} description={state.message} /> - ) : state.items.length === 0 && !jimmyMissing ? ( + ) : state.items.length === 0 ? ( } title={CHAT_STRINGS.inviteAgentEmptyTitle} @@ -182,31 +147,6 @@ export function InviteAgentDialog({ ); })} - {jimmyMissing && ( -
  • - - - {JIMMY_QUICK_CREATE.name} - - {CHAT_STRINGS.inviteAgentFirstPartyAttribution} - - - - {JIMMY_QUICK_CREATE.description} - - - -
  • - )} )} diff --git a/packages/chat-ui/src/strings.ts b/packages/chat-ui/src/strings.ts index 0303d2ed07..f826e665a9 100644 --- a/packages/chat-ui/src/strings.ts +++ b/packages/chat-ui/src/strings.ts @@ -117,10 +117,6 @@ export const CHAT_STRINGS = { inviteAgentInviting: "Inviting…", inviteAgentInviteError: "Couldn't invite that agent — try again.", inviteAgentConflictError: "This workbench already has its agent.", - inviteAgentQuickCreateAction: "Add", - inviteAgentQuickCreating: "Adding…", - inviteAgentQuickCreateError: "Couldn't add Jimmy — try again.", - inviteAgentFirstPartyAttribution: "by Corbits", forkThreadAction: "Fork", forkThreadError: "Couldn't fork that message into a thread — try again.", replyInThreadAction: "Reply in thread", diff --git a/packages/chat-ui/test/invite-agent-dialog.test.tsx b/packages/chat-ui/test/invite-agent-dialog.test.tsx index d9ca9656f6..64561b7c26 100644 --- a/packages/chat-ui/test/invite-agent-dialog.test.tsx +++ b/packages/chat-ui/test/invite-agent-dialog.test.tsx @@ -1,17 +1,9 @@ -// CL-6499: Jimmy is no longer seeded through a workbench template — his -// only create path left is this dialog's own "Add Jimmy" quick-create -// row (see `quickCreateJimmy` in `../src/api`). This proves the row -// appears only when Jimmy is genuinely absent from the tenant's -// invitable list, and that clicking it creates him and then invites him -// into the current workbench through the same `onInvite` seam every -// other row uses. import { afterEach, describe, expect, test } from "bun:test"; import { act } from "react"; import { createRoot } from "react-dom/client"; import type { Root } from "react-dom/client"; import { InviteAgentDialog } from "../src/invite-agent-dialog"; -import { JIMMY_QUICK_CREATE } from "../src/api"; const realFetch = globalThis.fetch; @@ -39,17 +31,12 @@ function stubFetch(routes: { name: string; description?: string; }[]; - createJimmy?: () => { id: string }; }) { globalThis.fetch = ((input: RequestInfo | URL, init?: RequestInit) => { const path = typeof input === "string" ? input : new URL(String(input)).pathname; if (path.endsWith("/invitable")) { return Promise.resolve(jsonResponse({ items: routes.invitable() })); } - if (init?.method === "POST" && path.endsWith("/agent-definitions")) { - const created = routes.createJimmy?.() ?? { id: "wfd_jimmy" }; - return Promise.resolve(jsonResponse(created, 201)); - } throw new Error(`unstubbed fetch: ${String(init?.method)} ${path}`); }) as typeof fetch; } @@ -86,81 +73,12 @@ async function mount(props: { return document.body; } -describe("InviteAgentDialog's Jimmy quick-create row", () => { - test("appears when the tenant's invitable list has no Jimmy yet", async () => { - const el = await mount({ - invitable: () => [{ id: "wfd_echo", name: "echo" }], - onInvite: async () => undefined, - onOpenChange: () => undefined, - }); - const row = el.querySelector('[data-testid="quick-create-jimmy"]'); - expect(row).not.toBeNull(); - expect(row?.textContent).toContain(JIMMY_QUICK_CREATE.description); - }); - - // CL-6649: the row used to render only `JIMMY_QUICK_CREATE.description` - // ("Searches Giphy and replies with a GIF") — Jimmy's own name never - // appeared at all. The name must lead, with the description as a - // secondary line and a first-party attribution alongside the name. - test("renders Jimmy's name prominently, attributed to Corbits, with the description as a secondary line", async () => { - const el = await mount({ - invitable: () => [{ id: "wfd_echo", name: "echo" }], - onInvite: async () => undefined, - onOpenChange: () => undefined, - }); - const row = el.querySelector('[data-testid="quick-create-jimmy"]'); - const name = row?.querySelector(".chat-invitable-item-name"); - const description = row?.querySelector(".chat-invitable-item-description"); - expect(name?.textContent).toContain(JIMMY_QUICK_CREATE.name); - expect(name?.textContent).toContain("by Corbits"); - expect(description?.textContent).toBe(JIMMY_QUICK_CREATE.description); - }); - - test("is absent once the tenant's invitable list already includes Jimmy", async () => { - const el = await mount({ - invitable: () => [{ id: "wfd_jimmy", name: JIMMY_QUICK_CREATE.handle }], - onInvite: async () => undefined, - onOpenChange: () => undefined, - }); - expect(el.querySelector('[data-testid="quick-create-jimmy"]')).toBeNull(); - }); - - test("clicking Add creates Jimmy and invites the created definition", async () => { - const invited: string[] = []; - let closed = false; - const el = await mount({ - invitable: () => [], - onInvite: async (definitionId) => { - invited.push(definitionId); - }, - onOpenChange: (open) => { - if (!open) closed = true; - }, - }); - - const button = el.querySelector( - '[data-testid="quick-create-jimmy"] button', - ) as HTMLButtonElement; - expect(button).not.toBeNull(); - - await act(async () => { - button.click(); - await Promise.resolve(); - await Promise.resolve(); - }); - - expect(invited).toEqual(["wfd_jimmy"]); - expect(closed).toBe(true); - }); -}); - describe("InviteAgentDialog definition rows (CL-6424)", () => { test("shows each definition's display name, never its raw slug", async () => { const el = await mount({ invitable: () => [ { id: "wfd_myra", name: "myra", description: "Myra" }, { id: "wfd_review", name: "code-review" }, - { id: "wfd_jimmy", name: JIMMY_QUICK_CREATE.handle }, ], onInvite: async () => undefined, onOpenChange: () => undefined, @@ -168,6 +86,6 @@ describe("InviteAgentDialog definition rows (CL-6424)", () => { const names = Array.from( el.querySelectorAll('[data-testid="invitable-definition"] .chat-invitable-item-name'), ).map((name) => name.textContent); - expect(names).toEqual(["Myra", "Code Review", "Jimmy"]); + expect(names).toEqual(["Myra", "Code Review"]); }); }); diff --git a/packages/gotenberg-render/README.md b/packages/gotenberg-render/README.md index 18296b53a6..59c15695b1 100644 --- a/packages/gotenberg-render/README.md +++ b/packages/gotenberg-render/README.md @@ -62,7 +62,7 @@ go artifact-in, PDF-artifact-out with no glue code: - The workflow-run artifact surface (`@corbits/artifacts-hub`'s `createWorkflowArtifactRoutes`, the one a - Scout run authenticates against) has `POST /` (create) and + workflow run authenticates against) has `POST /` (create) and `GET /recent` (list) but no `GET /:id` to fetch one artifact's content back — so a workflow run can't yet read the Markdown brief it just saved in order to hand it to this package. diff --git a/packages/settings-ui/src/connections-pinned-by.test.ts b/packages/settings-ui/src/connections-pinned-by.test.ts index fac81b936e..d7f0cb31e9 100644 --- a/packages/settings-ui/src/connections-pinned-by.test.ts +++ b/packages/settings-ui/src/connections-pinned-by.test.ts @@ -39,11 +39,7 @@ describe("connections pinned-by", () => { }); test("exa pins every web-search workflow", () => { - expect(CONNECTOR_PINNED_WORKFLOWS.exa).toEqual([ - "last-30-days-research", - "exa-topic-watch", - "diligence-brief", - ]); + expect(CONNECTOR_PINNED_WORKFLOWS.exa).toEqual(["last-30-days-research", "exa-topic-watch"]); }); test("attio pins the CRM task agent", () => { diff --git a/packages/settings-ui/src/connections-pinned-by.ts b/packages/settings-ui/src/connections-pinned-by.ts index 2906b56412..a57587711d 100644 --- a/packages/settings-ui/src/connections-pinned-by.ts +++ b/packages/settings-ui/src/connections-pinned-by.ts @@ -16,7 +16,7 @@ export const CONNECTOR_PINNED_WORKFLOWS: Readonly `@corbits/web-search-tools` (`web_search`, Exa-backed) -- Firm memory -> `@corbits/memory-tools` (`memory_search`) -- Artifact persistence -> `@corbits/artifacts-hub`'s workflow-artifacts - surface (`createWorkflowArtifact`, via this package's own - `finalize-tool.ts`/`artifact-client.ts` — duplicated rather than - imported, same convention every sibling workflow package uses). - That surface offers create + list-recent only, no search-by-field or - read-by-id — the same limit the sibling `@corbits/scout-agent` port - hit — so this workflow only ever writes one artifact per run; it - never reads a prior brief back by id. - -Scout's own artifact-read/knowledge-search tools (reading a founder deck -or prior source document by locator) have no workbench equivalent yet: -this port has no source-artifact input at all, so that gap is moot for -now rather than silently dropped. - -## What was trimmed, and why (read before comparing to scout's original) - -This is a materially narrower brief than scout's. Be blunt about this -with anyone who has used the original: - -- **No per-section parallel steps.** Scout drafts the brief as one - outline step plus one PARALLEL step per section (team, product, - revenue, capital, growth, market, risks), each well under a safe - output-token ceiling, then deterministically assembles them - (`assemble-brief`). This repo's execution host has never wired the - `action` primitive that parallel/assembled step graph assumes (the - same gap `last-30-days-research`'s own header documents). Folding - seven sections into seven _serial_ reasoning steps would multiply run - time and per-step timeout risk for a first port, so this port instead - follows `code-review`'s single-step shape: one agent, one turn, - everything — research, drafting, all five sections — in one pass. -- **Five sections, not seven.** `DILIGENCE_BRIEF_SECTIONS` folds scout's - separate Revenue & Business Model / Capital & Runway / Growth & - Traction sections into one "Traction & Funding" section, and Market & - Competition into "Product & Market" — a single-turn brief cannot - sustain three sections' worth of genuinely distinct evidence without - either padding or fabricating. -- **No scoring.** Scout scores seven weighted dimensions - (`SCORE_WEIGHTS`, `dims`/`dimensionReads`) and produces a structured - `DiligenceBrief` object. This port produces prose-only markdown, no - scores, no structured JSON. Scoring is real product value and cutting - it is a deliberate scope trim, not an oversight — restoring it is the - natural next step once the parallel-step machinery above lands here. -- **No source-artifact intake.** Scout's research step opens every - `sourceArtifactRefs` locator with artifact-read before searching the - web. This port has no equivalent trigger field, so research starts - from firm memory and the open web only. - -## Verified end to end - -`bun test` (package-scoped, stubbing every tool call — no live Exa, no -live inference) passes: the finalize tool persists a stubbed artifact -and returns `persisted: true` on success, returns an honest `isError: -true` naming the failure on a broken persist call rather than a -fabricated success or a silent empty brief, and rejects malformed -arguments without throwing. The definition itself is asserted to name -the exact approval-gated finalize tool, commit to always finalizing -(even on the no-data path), and survive the workflow-asset JSON -round-trip. `bun run typecheck` passes clean. - -## Registration - -Registered in `@corbits/workflows`'s `WORKFLOW_CATALOG` (asset -name `diligence-brief`) alongside this package's own `corbits.workflow` -block, so it shows up wherever that catalog is read: the seed step and -the web Routines picker. See [`workflows/README.md`](../README.md#status-note) -for what registration/automatable/seeded mean — this one is -`automatable: false` (gated behind a human-supplied company name per -run, same as `last-30-days-research`) and not seeded by default. - -## Usage - -```ts -import { - buildDiligenceBriefWorkflow, - serializeDiligenceBriefWorkflow, -} from "@corbits/diligence-brief-workflow"; - -const definition = buildDiligenceBriefWorkflow({ - triggerAddress: "diligence-brief@tenant.example", - inferencePreferences: [{ provider: "anthropic", model: "claude-sonnet-5" }], - turnTimeoutMs: 600_000, -}); - -const json = serializeDiligenceBriefWorkflow(definition); -``` - -Pin `@corbits/web-search-tools` (needs an Exa key, handle `exa`) and -`@corbits/memory-tools` on the deployment for research to reach real -data; without them the brief honestly reports both as unreachable and -finalizes a status-note instead of a real brief. - -### Trigger fields (`company`, `focus`) - -Every run is triggered by mail to the deployment's address -(`triggerAddress` above); the one reasoning step reads two fields off -the trigger payload: - -- `company` (required) — the company the brief is about. -- `focus` (optional) — narrows which angle to dig into (e.g. - "go-to-market" or "founder track record"). - -## Deploy from the npm registry - -Once published, deploy this workflow definition to a tenant by name and -version pin: - -``` -POST /api/tenants/:id/workflows/deployments -{ - "source": { "kind": "registry", "registry": "npm" }, - "entry": "./src/index.ts", - "pin": "@corbits/diligence-brief-workflow@0.0.1", - "sourceOfferingIds": ["", ...], - "defaultSourceOfferingId": "" -} -``` - -`entry` is the package's `interchange.workflow` module path; `pin` is -`"@corbits/diligence-brief-workflow@0.0.1"` or a semver range on the same name. The hub -installs, probes, gates, and freezes the definition from the registry -tarball before creating the deployment. diff --git a/workflows/diligence-brief/package.json b/workflows/diligence-brief/package.json deleted file mode 100644 index 20ddc9f7af..0000000000 --- a/workflows/diligence-brief/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@corbits/diligence-brief-workflow", - "version": "0.0.1", - "description": "Single-step, mail-triggered workflow that researches a company and writes a cited diligence brief, held for approval", - "license": "LGPL-2.1-or-later", - "repository": { - "type": "git", - "url": "https://github.com/corbitsdev/workbench.git", - "directory": "workflows/diligence-brief" - }, - "files": [ - "src", - "LICENSE", - "README.md" - ], - "type": "module", - "exports": { - ".": "./src/index.ts" - }, - "publishConfig": { - "access": "public" - }, - "scripts": { - "typecheck": "tsc --noEmit", - "test": "bun test" - }, - "dependencies": { - "@corbits/memory": "github:corbitsdev/corbits-memory#9e6f213fa2c002b531d3f6af1aa0abd737b8afe3", - "arktype": "catalog:" - }, - "devDependencies": { - "@types/bun": "catalog:", - "typescript": "catalog:" - }, - "peerDependencies": { - "@intx/agent": "0.3.0", - "@intx/types": "0.3.0", - "@intx/workflow": "0.3.0" - }, - "corbits": { - "workflow": { - "assetName": "diligence-brief", - "displayName": "Diligence brief", - "automatable": false - } - }, - "interchange": { - "workflow": "./src/index.ts" - } -} diff --git a/workflows/diligence-brief/src/artifact-client.test.ts b/workflows/diligence-brief/src/artifact-client.test.ts deleted file mode 100644 index 1e4d71c46e..0000000000 --- a/workflows/diligence-brief/src/artifact-client.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { expect, test } from "bun:test"; - -import { createWorkflowArtifact } from "./artifact-client"; - -const CONFIG = { - hubArtifactsUrl: "https://hub.example.com", - sidecarToken: "sc-token", - runAddress: "run_1@workflow", -}; - -test("posts to the workflow-artifacts endpoint and returns id/version", async () => { - const captured: { url: string; init: RequestInit | undefined } = { - url: "", - init: undefined, - }; - const fetchImpl = (async (input: URL | string, init?: RequestInit) => { - captured.url = String(input); - captured.init = init; - return new Response(JSON.stringify({ data: { id: "art_1", version: 1 } }), { - status: 201, - }); - }) as unknown as typeof fetch; - - const result = await createWorkflowArtifact( - { ...CONFIG, fetchImpl }, - { title: "Acme Corp", kind: "text", content: "# Diligence brief" }, - ); - - expect(result).toEqual({ id: "art_1", version: 1 }); - expect(captured.url).toBe("https://hub.example.com/api/workflow-artifacts/artifacts"); - const headers = captured.init?.headers as Record; - expect(headers["authorization"]).toBe("Bearer sc-token"); - expect(headers["x-workflow-run-address"]).toBe("run_1@workflow"); -}); - -test("throws on a non-ok HTTP response", async () => { - const fetchImpl = (async () => new Response("nope", { status: 500 })) as unknown as typeof fetch; - - await expect( - createWorkflowArtifact( - { ...CONFIG, fetchImpl }, - { title: "Acme Corp", kind: "text", content: "# Diligence brief" }, - ), - ).rejects.toThrow(/500/); -}); - -test("throws when the response doesn't match the expected shape", async () => { - const fetchImpl = (async () => - new Response(JSON.stringify({ data: {} }), { - status: 201, - })) as unknown as typeof fetch; - - await expect( - createWorkflowArtifact( - { ...CONFIG, fetchImpl }, - { title: "Acme Corp", kind: "text", content: "# Diligence brief" }, - ), - ).rejects.toThrow(/did not match the expected shape/); -}); diff --git a/workflows/diligence-brief/src/artifact-client.ts b/workflows/diligence-brief/src/artifact-client.ts deleted file mode 100644 index c73ba4dc59..0000000000 --- a/workflows/diligence-brief/src/artifact-client.ts +++ /dev/null @@ -1,63 +0,0 @@ -// A minimal client for the sanctioned workflow-artifacts HTTP surface -// (`@corbits/artifacts-hub`'s `createWorkflowArtifactRoutes`, CL-6000). -// Deliberately duplicated from `@corbits/artifact-tools`' `client.ts` -// (and from every sibling workflow package's own copy, e.g. -// `last-30-days-research`) rather than imported: this package ships as -// installable data on the native workflow contract (see `./index.ts`'s -// header comment and `test/boundary.test.ts`), so its shipped sources -// import only `@intx/*`, `arktype`, and relative specifiers — never -// another `@corbits/*` package. Authenticates with the sidecar's own -// bearer token plus the run's own mailbox address (both already reach a -// workflow-process child's tool env), never a database handle. -import { type } from "arktype"; - -export interface WorkflowArtifactClientConfig { - readonly hubArtifactsUrl: string; - readonly sidecarToken: string; - readonly runAddress: string; - /** Override for tests; defaults to the global `fetch`. */ - readonly fetchImpl?: typeof fetch; -} - -export type CreateWorkflowArtifactInput = { - readonly title: string; - readonly kind: string; - readonly content: string; -}; - -export type CreatedWorkflowArtifact = { - readonly id: string; - readonly version: number; -}; - -const CreatedWorkflowArtifactResponse = type({ - data: { id: "string", version: "number" }, -}); - -/** Persists one artifact. Throws on any transport, HTTP, or shape failure. */ -export async function createWorkflowArtifact( - config: WorkflowArtifactClientConfig, - input: CreateWorkflowArtifactInput, -): Promise { - const doFetch = config.fetchImpl ?? fetch; - const response = await doFetch(`${config.hubArtifactsUrl}/api/workflow-artifacts/artifacts`, { - method: "POST", - headers: { - authorization: `Bearer ${config.sidecarToken}`, - "x-workflow-run-address": config.runAddress, - "content-type": "application/json", - }, - body: JSON.stringify(input), - }); - if (!response.ok) { - throw new Error(`Workflow artifact create failed: ${response.status} ${response.statusText}`); - } - const body: unknown = await response.json(); - const parsed = CreatedWorkflowArtifactResponse(body); - if (parsed instanceof type.errors) { - throw new Error( - `Workflow artifact create response did not match the expected shape: ${parsed.summary}`, - ); - } - return parsed.data; -} diff --git a/workflows/diligence-brief/src/finalize-tool.test.ts b/workflows/diligence-brief/src/finalize-tool.test.ts deleted file mode 100644 index 70ed585ba2..0000000000 --- a/workflows/diligence-brief/src/finalize-tool.test.ts +++ /dev/null @@ -1,197 +0,0 @@ -import { expect, test } from "bun:test"; - -import { - DILIGENCE_BRIEF_FINALIZE_TOOL, - DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - buildArtifactPayload, - type WorkflowArtifactEnv, -} from "./finalize-tool"; - -test("the tool's definition marks itself approval-gated", () => { - expect(DILIGENCE_BRIEF_FINALIZE_TOOL.definitions).toEqual([ - { name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, approval: "ask" }, - ]); -}); - -test("the tool is namespaced under this workflow package, not a shared one", () => { - expect(DILIGENCE_BRIEF_FINALIZE_TOOL.id).toBe("@corbits/workflow-diligence-brief/finalize"); -}); - -test("requires the sanctioned workflow-artifacts env keys", () => { - expect(DILIGENCE_BRIEF_FINALIZE_TOOL.requires).toEqual([ - "hubArtifactsUrl", - "sidecarToken", - "address", - ]); -}); - -test("buildArtifactPayload marks a real brief as a text artifact", () => { - const payload = buildArtifactPayload({ - outcome: "brief", - title: "Diligence brief: Acme Corp", - content: "## Overview\n\nAcme Corp sells widgets", - }); - expect(payload).toEqual({ - title: "Diligence brief: Acme Corp", - kind: "text", - content: "## Overview\n\nAcme Corp sells widgets", - }); -}); - -test("buildArtifactPayload marks a no-data teaching payload as status-note, not text", () => { - const payload = buildArtifactPayload({ - outcome: "status-note", - title: "Diligence brief: Acme Corp — no results yet", - content: "`exa` is not connected yet.", - }); - expect(payload).toEqual({ - title: "Diligence brief: Acme Corp — no results yet", - kind: "status-note", - content: "`exa` is not connected yet.", - }); -}); - -function testEnv(): WorkflowArtifactEnv { - return { - hubArtifactsUrl: "https://hub.example.com", - sidecarToken: "sc-token", - address: "run_1@workflow", - } as unknown as WorkflowArtifactEnv; -} - -test("run persists the artifact on real invocation (i.e. after approval re-dispatches the call) and reports it persisted", async () => { - const originalFetch = globalThis.fetch; - globalThis.fetch = (async () => - new Response(JSON.stringify({ data: { id: "art_1", version: 1 } }), { - status: 201, - })) as unknown as typeof fetch; - - try { - const bundle = DILIGENCE_BRIEF_FINALIZE_TOOL(testEnv()); - const result = await bundle.run( - { - id: "call_1", - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - arguments: { - outcome: "brief", - title: "Diligence brief: Acme Corp", - content: "## Overview\n\nAcme Corp sells widgets", - }, - }, - new AbortController().signal, - ); - - expect(result.isError).toBe(false); - const parsed = JSON.parse(String(result.content)) as { - id: string; - version: number; - title: string; - kind: string; - persisted: boolean; - }; - expect(parsed).toEqual({ - id: "art_1", - version: 1, - title: "Diligence brief: Acme Corp", - kind: "text", - persisted: true, - }); - } finally { - globalThis.fetch = originalFetch; - } -}); - -test("run persists a teaching payload on the no-data path with a status-note kind, distinct from a real brief", async () => { - const originalFetch = globalThis.fetch; - globalThis.fetch = (async () => - new Response(JSON.stringify({ data: { id: "art_2", version: 1 } }), { - status: 201, - })) as unknown as typeof fetch; - - try { - const bundle = DILIGENCE_BRIEF_FINALIZE_TOOL(testEnv()); - const result = await bundle.run( - { - id: "call_2", - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - arguments: { - outcome: "status-note", - title: "Diligence brief: Acme Corp — no results yet", - content: - "This brief would have searched the web (`exa`) and firm " + - "memory for this company. `exa` is not connected yet — " + - "connect it in Settings to get a real brief next time.", - }, - }, - new AbortController().signal, - ); - - expect(result.isError).toBe(false); - const parsed = JSON.parse(String(result.content)) as { - persisted: boolean; - kind: string; - }; - expect(parsed.persisted).toBe(true); - expect(parsed.kind).toBe("status-note"); - } finally { - globalThis.fetch = originalFetch; - } -}); - -test("run returns an honest error result when persistence fails, never fabricating persisted: true", async () => { - const originalFetch = globalThis.fetch; - globalThis.fetch = (async () => new Response("nope", { status: 500 })) as unknown as typeof fetch; - - try { - const bundle = DILIGENCE_BRIEF_FINALIZE_TOOL(testEnv()); - const result = await bundle.run( - { - id: "call_1", - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - arguments: { - outcome: "brief", - title: "Diligence brief: Acme Corp", - content: "## Overview\n\nAcme Corp sells widgets", - }, - }, - new AbortController().signal, - ); - - expect(result.isError).toBe(true); - expect(result.content).toContain("Failed to persist"); - } finally { - globalThis.fetch = originalFetch; - } -}); - -test("run rejects malformed arguments without throwing", async () => { - const bundle = DILIGENCE_BRIEF_FINALIZE_TOOL(testEnv()); - const result = await bundle.run( - { - id: "call_1", - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - arguments: {}, - }, - new AbortController().signal, - ); - expect(result.isError).toBe(true); - expect(result.content).toContain("Invalid arguments"); -}); - -test("run rejects an outcome value outside the two structural kinds", async () => { - const bundle = DILIGENCE_BRIEF_FINALIZE_TOOL(testEnv()); - const result = await bundle.run( - { - id: "call_1", - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - arguments: { - outcome: "summary", - title: "Diligence brief: Acme Corp", - content: "## Overview\n\nAcme Corp sells widgets", - }, - }, - new AbortController().signal, - ); - expect(result.isError).toBe(true); - expect(result.content).toContain("Invalid arguments"); -}); diff --git a/workflows/diligence-brief/src/finalize-tool.ts b/workflows/diligence-brief/src/finalize-tool.ts deleted file mode 100644 index df7365be89..0000000000 --- a/workflows/diligence-brief/src/finalize-tool.ts +++ /dev/null @@ -1,160 +0,0 @@ -// The one piece of this workflow gated by human approval: finalizing the -// diligence brief. Kept inside the workflow package rather than a shared -// tool package — same "workflow-specific logic lives in the definition" -// convention `pain-point-collateral`'s `finalize-tool.ts` established — -// this is not a reusable integration on its own. -// -// Approval mechanics: identical to `pain-point-collateral`'s and -// `last-30-days-research`'s `finalize-tool.ts` — `definitions` marks -// this tool's one definition `approval: "ask"`, the platform's native -// tool-approval gate. Calling it suspends the run and creates a real -// `approval` row; only executes once a human approves it. -// -// Persistence: `run` below calls `createWorkflowArtifact` -// (`./artifact-client.ts`, duplicated from `@corbits/artifact-tools`' -// client rather than imported — see that file's header for why this -// installable-data package never imports another `@corbits/*` package) -// against the sanctioned workflow-artifacts HTTP surface — authenticated -// with the sidecar's own bearer token and this run's own mailbox -// address, both already present on `env`, never a database handle. The -// persisted artifact's content is markdown, so the sibling Gotenberg -// PDF-rendering lane can turn it into a document without this workflow -// needing to know anything about PDF generation. -// -// The finalized content is not always a "real" brief: when research -// turns up nothing usable (no wired source returns anything for the -// company) this workflow's system prompt (see `./index.ts`) still calls -// this same tool with a teaching payload — what it searched for and -// which connectors are missing — so a run always ends in a persisted, -// chip-visible artifact rather than silence. - -import { type } from "arktype"; -import { defineTool, type BaseEnv } from "@intx/agent"; -import { createWorkflowArtifact } from "./artifact-client"; - -export const DILIGENCE_BRIEF_FINALIZE_TOOL_NAME = "diligence_brief_finalize"; - -export const DILIGENCE_BRIEF_FINALIZE_DESCRIPTION = - "Finalizes the diligence brief, pending human approval, and persists it as a Library artifact."; - -const FinalizeArgs = type({ - /** - * Which of the two shapes this call is: `"brief"` for a real, populated - * brief; `"status-note"` for the no-data path's teaching payload. This - * is what fixes the persisted artifact's `kind` — the model names the - * outcome, but never supplies `kind` directly, so a run can never - * accidentally (or by prompt drift) mislabel a teaching payload as a - * real brief or vice versa. - */ - outcome: "'brief'|'status-note'", - /** Short, human-facing title — doubles as the inbox/approve-card headline. */ - title: "string > 0", - /** The finished brief's markdown body — a real brief, or an honest teaching payload on the no-data path. */ - content: "string > 0", -}); - -export type FinalizeArgs = typeof FinalizeArgs.infer; - -export type ArtifactPayload = { - title: string; - kind: "text" | "status-note"; - content: string; -}; - -/** - * The payload `createWorkflowArtifact` persists (`{ title, kind, - * content }`). Built here so the persist call is a straight pass-through - * of this object, not a payload assembled at the call site. `kind` comes - * from `args.outcome`, never from free-text the model could drift on. - */ -export function buildArtifactPayload(args: FinalizeArgs): ArtifactPayload { - return { - title: args.title, - kind: args.outcome === "status-note" ? "status-note" : "text", - content: args.content, - }; -} - -/** - * The env this tool needs beyond `BaseEnv`: the sanctioned - * workflow-artifacts credential trio, populated for every workflow step - * (`apps/sidecar/src/workflow-substrate-factory/step-env.ts`) — the same - * three keys `@corbits/artifact-tools`' read-side bundle declares. - */ -export interface WorkflowArtifactEnv extends BaseEnv { - readonly hubArtifactsUrl: string; - readonly sidecarToken: string; - readonly address: string; -} - -/** - * `defineTool`'s env-DI factory shape. Needs the sanctioned - * workflow-artifacts credential trio beyond `BaseEnv`. - */ -export const DILIGENCE_BRIEF_FINALIZE_TOOL = defineTool({ - id: "@corbits/workflow-diligence-brief/finalize", - requires: ["hubArtifactsUrl", "sidecarToken", "address"], - definitions: [ - { - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - approval: "ask", - }, - ], - factory: (env) => ({ - definitions: [ - { - name: DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - description: DILIGENCE_BRIEF_FINALIZE_DESCRIPTION, - inputSchema: { - type: "object", - properties: { - outcome: { type: "string", enum: ["brief", "status-note"] }, - title: { type: "string" }, - content: { type: "string" }, - }, - required: ["outcome", "title", "content"], - }, - }, - ], - run: async (call) => { - const parsed = FinalizeArgs(call.arguments); - if (parsed instanceof type.errors) { - return { - callId: call.id, - isError: true, - content: `Invalid arguments for ${DILIGENCE_BRIEF_FINALIZE_TOOL_NAME}: ${parsed.summary}`, - }; - } - const artifact = buildArtifactPayload(parsed); - try { - const created = await createWorkflowArtifact( - { - hubArtifactsUrl: env.hubArtifactsUrl, - sidecarToken: env.sidecarToken, - runAddress: env.address, - }, - artifact, - ); - return { - callId: call.id, - isError: false, - content: JSON.stringify({ - id: created.id, - version: created.version, - title: artifact.title, - kind: artifact.kind, - persisted: true, - }), - }; - } catch (err) { - return { - callId: call.id, - isError: true, - content: `Failed to persist "${artifact.title}" as a Library artifact: ${ - err instanceof Error ? err.message : String(err) - }`, - }; - } - }, - }), -}); diff --git a/workflows/diligence-brief/src/index.ts b/workflows/diligence-brief/src/index.ts deleted file mode 100644 index 3748cd5f13..0000000000 --- a/workflows/diligence-brief/src/index.ts +++ /dev/null @@ -1,291 +0,0 @@ -// The diligence-brief workflow (CL-6499): a single-step, mail-triggered -// definition that researches a company and writes a cited diligence -// brief as a markdown Library artifact, held for one human approval. -// -// ## Where this comes from -// -// Ported from scout's `workflows/diligence-brief` — a real multi-step -// pipeline there: an outline step plus one PARALLEL step per section -// (team, product, revenue, capital, growth, market, risks), each scored -// against seven weighted dimensions, deterministically assembled into a -// structured `DiligenceBrief` object by a pure-code `assemble-brief` -// action, then rendered. None of that machinery ports as-is: -// -// - Scout's tools (its own artifact/knowledge-search/web-research -// bundles from `@corbits/scout`) compile into scout's own sidecar and -// cannot be pinned here (`packages/scout/README.md`, CL-5179). Every -// tool call is rebound below to a workbench-published package instead: -// web research -> `@corbits/web-search-tools` (Exa-backed), firm -// memory -> `@corbits/memory-tools`. Nothing scout-specific is -// imported. -// - Scout's per-section parallel steps and pure-code assembler assume a -// deterministic `action` primitive this repo's execution host -// (`apps/sidecar`) has never wired (the same gap -// `last-30-days-research`'s header documents at length). Rather than -// fold seven parallel section steps into seven serial reasoning -// steps (which would multiply run time and per-step timeout risk for -// a first port), this port follows `code-review`'s and -// `collateral-generation`'s single-step shape: one agent, one -// reasoning turn, tools called inside it. -// - Scout's seven-dimension weighted scoring (`SCORE_WEIGHTS`, -// `dims`/`dimensionReads`) is cut entirely for this port. It is real -// product value scout's teammates rely on, and cutting it is an -// honest scope trim, not an oversight: a scored, per-dimension brief -// needs the parallel-section machinery above to stay within a single -// turn's output budget, and that machinery isn't proven on this -// host yet. This port ships a narrower, PROSE-ONLY brief across five -// fixed sections (see `DILIGENCE_BRIEF_SECTIONS` below) instead of a -// 500 on every run. -// -// ## What this port keeps faithful -// -// The evidence discipline scout's prompts commit to: ground every claim -// in a tool result, never invent a fact, and say "insufficient evidence" -// plainly rather than filling a section with prose that sounds -// confident but is not sourced. Firm memory is checked first (so a -// second brief on the same company builds on the first), then the web, -// exactly the order scout's own "tool policy" section commits to -// (`artifact refs first... then check knowledge-search... then -// webResearchTool`, minus the artifact-refs step this deployment has no -// equivalent trigger for yet). -// -// ## Delivery -// -// Persisting is gated by human approval, same as every other -// artifact-producing workflow in this catalog (AGENTS.md: "every -// external side effect sits behind human approval") — scout's own -// pipeline has no such gate (CL-6000 predates this repo's Library -// engine), so this is a deliberate policy addition, not a missing -// feature. The persisted artifact is markdown (`kind: "text"`), the -// same shape the sibling Gotenberg PDF-rendering lane already expects -// to render, so this workflow needs no PDF logic of its own. -// -// This package is installable data. It imports only published platform -// packages, and nothing imports it statically: a host publishes the -// serialized definition as a workflow asset and deploys it through the -// platform's deploy machinery; the execution host materializes it at -// runtime from the deploy alone. - -import type { AgentDefinition, InferencePreference } from "@intx/agent"; -import { defineWorkflow, step } from "@intx/workflow"; -import type { WorkflowDefinition } from "@intx/workflow"; -import type { CredentialBinding } from "@intx/types"; -import type { ToolPackagePin } from "@intx/types/tool-packages"; - -import { DILIGENCE_BRIEF_FINALIZE_TOOL_NAME } from "./finalize-tool"; - -export const DILIGENCE_BRIEF_WORKFLOW_ID = "wf_diligence_brief"; -export const DILIGENCE_BRIEF_STEP_ID = "diligence-brief"; - -/** - * The brief's fixed section outline (trimmed from scout's seven - * separately-scored sections — see this file's header comment). Team & - * Founders and Product & Market each keep their own heading since - * founder/product evidence rarely overlaps; Traction & Funding folds - * scout's separate revenue/capital-runway/growth-traction sections into - * one, since a single-turn brief cannot sustain three sections' worth of - * distinct evidence without either padding or fabricating. - */ -export const DILIGENCE_BRIEF_SECTIONS = [ - "Overview", - "Team & Founders", - "Product & Market", - "Traction & Funding", - "Risks & Open Questions", -] as const; - -export const DILIGENCE_BRIEF_WIRED_SOURCES = ["Web search", "Firm memory"] as const; - -/** - * Tool packages this definition pins (CL-5999 shape, matching - * `code-review`/`collateral-generation`/`assistant`'s precedent): - * `@corbits/web-search-tools` for live research, `@corbits/memory` - * (CL-8186) so a brief can check (and later inform) the tenant's firm - * memory — a published dependency, not a workbench-built tool package, - * resolved the same way through its own `interchange.tools` surface. - */ -export const DILIGENCE_BRIEF_TOOL_PACKAGE_PINS: readonly ToolPackagePin[] = [ - { name: "@corbits/web-search-tools", version: "0.0.4" }, - { name: "@corbits/memory", version: "0.1.2" }, -]; - -/** - * Binds the pinned web-search package's "exa" handle to the tenant's - * connection — `@corbits/memory` needs no credential binding of its - * own; its env keys (`memoryBaseUrl`/`memoryTenantId`/`memoryAuthToken`) - * are populated for every workflow step directly, the same as - * `@corbits/artifact-tools`' trio. - */ -export const DILIGENCE_BRIEF_CREDENTIAL_BINDINGS: readonly CredentialBinding[] = [ - { - package: "@corbits/web-search-tools", - handle: "exa", - provider: "exa", - locator: "tenant", - }, -]; - -const SECTION_LINES = DILIGENCE_BRIEF_SECTIONS.map( - (heading, index) => `${String(index + 1)}. ${heading}`, -).join("\n"); - -export const DILIGENCE_BRIEF_SYSTEM_PROMPT = - "You research a company and write one cited diligence brief for the " + - "sender's own review, then finalize it pending a human's approval.\n" + - "\n" + - "## Reading the request\n" + - "The triggering mail names a `company` (the subject of the brief) and " + - 'an optional `focus` narrowing which angle to dig into (e.g. "go-to-' + - 'market" or "founder track record"). If no company is named, say so ' + - "in one plain sentence and stop — never draft a brief with no subject.\n" + - "\n" + - "## Research order\n" + - "First call memory_search for the company name: firm memory may " + - "already hold notes from an earlier brief or conversation. Then call " + - "web_search (at least twice, with distinct queries — e.g. the company " + - 'name alone, and the company name plus "funding" or "founders") to ' + - "gather current, public information. A tool call that comes back as " + - "an error (missing credential, rate limit, failed request) means that " + - "source is not reachable right now — note it plainly and move on; " + - "never fail the whole run because one source is unavailable, and " + - "never invent results for a source you could not reach. If BOTH " + - "memory_search and every web_search call come back empty or " + - "unreachable, you have nothing to draft from.\n" + - "\n" + - "## Writing the brief\n" + - `Structure the brief under these five headings, in order:\n${SECTION_LINES}\n` + - "Ground every claim in a specific tool result — cite it inline (e.g. " + - '"per web_search: ...") rather than asserting facts with no source. ' + - "Where evidence is thin or absent for a section, say so plainly " + - '("insufficient evidence in the sources gathered") rather than ' + - "padding it with generic industry prose. Never fabricate a founder " + - "name, a funding round, a metric, or a competitor that no source " + - "actually named.\n" + - "\n" + - "## Finalizing\n" + - `Once you have written the brief, call \`${DILIGENCE_BRIEF_FINALIZE_TOOL_NAME}\` ` + - 'exactly once with outcome "brief", a short title (e.g. "Diligence ' + - 'brief: "), and the full markdown brief as content. This ' + - "call requires a human's approval before it completes. If research " + - "turned up nothing (the no-data case above), still call " + - `\`${DILIGENCE_BRIEF_FINALIZE_TOOL_NAME}\` once with outcome ` + - '"status-note", a teaching title (e.g. "Diligence brief: — ' + - 'no results yet"), and content that honestly explains what was ' + - "searched for, names the missing or unreachable connectors by id " + - "(`exa` for web search), and says what to do next. Never end a run " + - "without finalizing — a plain reply with no artifact is not an " + - "acceptable outcome, even on the no-data path.\n" + - "\n" + - "If the finalize call succeeds, present the finalized brief as your " + - "reply exactly as written, with no commentary about the approval " + - "mechanism itself. If the call is denied, reply with one calm, plain " + - "sentence that the brief was not approved and no action was taken; " + - "never present a denial as an error, and never apologize as if " + - "something broke."; - -/** - * Everything the definition needs that is per-deployment data. The - * trigger address names a specific deployment's inbox — for this - * workflow, the address a human messages with a company name to start - * a run — so a definition built here is per-deployment by construction. - */ -export interface DiligenceBriefWorkflowInput { - /** The deployment's mail address; each inbound mail is one run. */ - readonly triggerAddress: string; - /** Provider/model preferences, in order; resolved at deploy time. */ - readonly inferencePreferences: readonly InferencePreference[]; - /** Per-turn timeout in milliseconds, enforced on the single step. */ - readonly turnTimeoutMs: number; -} - -/** - * Builds the diligence-brief definition. Exactly one step, matching the - * shape every other definition in this catalog commits to (`code-review` - * is the closest reference). Tools are never inlined on the definition: - * they arrive as packages on the deploy, keeping the definition pure - * data. - */ -export function buildDiligenceBriefWorkflow( - input: DiligenceBriefWorkflowInput, -): WorkflowDefinition { - if (input.triggerAddress === "") { - throw new Error("buildDiligenceBriefWorkflow requires a non-empty triggerAddress"); - } - if (!Number.isInteger(input.turnTimeoutMs) || input.turnTimeoutMs <= 0) { - throw new Error("buildDiligenceBriefWorkflow requires turnTimeoutMs to be a positive integer"); - } - return defineWorkflow({ - id: DILIGENCE_BRIEF_WORKFLOW_ID, - trigger: { type: "mail", to: input.triggerAddress }, - credentialBindings: DILIGENCE_BRIEF_CREDENTIAL_BINDINGS, - steps: { - [DILIGENCE_BRIEF_STEP_ID]: step({ - agent: { - id: DILIGENCE_BRIEF_STEP_ID, - description: - "Researches a company and writes a cited diligence brief, " + - "finalized pending human approval", - systemPrompt: DILIGENCE_BRIEF_SYSTEM_PROMPT, - toolFactories: [], - capabilities: [], - inference: { sources: input.inferencePreferences }, - toolPackagePins: DILIGENCE_BRIEF_TOOL_PACKAGE_PINS, - } satisfies AgentDefinition, - timeout: input.turnTimeoutMs, - }), - }, - }); -} - -/** - * Serializes a definition to the JSON a workflow asset carries. The - * definition must survive the asset round-trip byte-faithfully, so - * anything JSON would silently drop or mangle — functions, undefined, - * symbols, bigints, non-finite numbers, class instances — is a loud - * error naming the offending path instead of a corrupted asset. - */ -export function serializeDiligenceBriefWorkflow(definition: WorkflowDefinition): string { - assertJsonPortable(definition, "definition"); - return JSON.stringify(definition); -} - -function assertJsonPortable(value: unknown, path: string): void { - if (value === null) return; - switch (typeof value) { - case "string": - case "boolean": - return; - case "number": - if (!Number.isFinite(value)) { - throw new Error(`${path} is a non-finite number; JSON drops it`); - } - return; - case "object": - break; - default: - throw new Error( - `${path} is a ${typeof value}, which does not survive JSON ` + "serialization", - ); - } - if (Array.isArray(value)) { - value.forEach((element, index) => { - assertJsonPortable(element, `${path}[${index}]`); - }); - return; - } - const proto: unknown = Object.getPrototypeOf(value); - if (proto !== Object.prototype && proto !== null) { - throw new Error(`${path} is a non-plain object; JSON would flatten it lossily`); - } - for (const [key, entry] of Object.entries(value)) { - assertJsonPortable(entry, `${path}.${key}`); - } -} - -export { - DILIGENCE_BRIEF_FINALIZE_TOOL, - DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - DILIGENCE_BRIEF_FINALIZE_DESCRIPTION, - buildArtifactPayload, -} from "./finalize-tool"; -export type { ArtifactPayload, FinalizeArgs } from "./finalize-tool"; diff --git a/workflows/diligence-brief/test/boundary.test.ts b/workflows/diligence-brief/test/boundary.test.ts deleted file mode 100644 index 0ccf8ceb1b..0000000000 --- a/workflows/diligence-brief/test/boundary.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -// This package is installable data on the native workflow contract: -// its shipped sources import only published platform packages, so the -// source tree plus the package manifest deploys on any Interchange -// instance without a wrapper contract. Tool packages this workflow -// expects at deploy time (@corbits/web-search-tools, @corbits/memory-tools) -// are pinned by the deployer, never imported here — see src/index.ts's -// header comment. - -import { readFile, readdir } from "node:fs/promises"; -import path from "node:path"; -import { expect, test } from "bun:test"; - -const ALLOWED_IMPORT_PREFIXES = ["@intx/", "arktype", "./", "../"]; - -async function listFiles(dir: string): Promise { - const entries = await readdir(dir, { withFileTypes: true }); - const files: string[] = []; - for (const entry of entries) { - const full = path.join(dir, entry.name); - if (entry.isDirectory()) { - files.push(...(await listFiles(full))); - } else { - files.push(full); - } - } - return files; -} - -async function shippedFiles(): Promise { - const packageRoot = path.join(import.meta.dir, ".."); - return [ - ...(await listFiles(path.join(packageRoot, "src"))), - path.join(packageRoot, "package.json"), - ]; -} - -test("shipped sources import only published platform packages", async () => { - const importPattern = /from\s+"([^"]+)"/g; - const violations: string[] = []; - for (const file of await shippedFiles()) { - if (!file.endsWith(".ts") || file.endsWith(".test.ts")) continue; - const content = await readFile(file, "utf8"); - for (const match of content.matchAll(importPattern)) { - const specifier = match[1] ?? ""; - const allowed = ALLOWED_IMPORT_PREFIXES.some((prefix) => specifier.startsWith(prefix)); - if (!allowed) { - violations.push(`${path.basename(file)}: ${specifier}`); - } - } - } - expect(violations).toEqual([]); -}); diff --git a/workflows/diligence-brief/test/definition.test.ts b/workflows/diligence-brief/test/definition.test.ts deleted file mode 100644 index 74d6e304d7..0000000000 --- a/workflows/diligence-brief/test/definition.test.ts +++ /dev/null @@ -1,148 +0,0 @@ -// Tests for this package's own contract: the shape our factory -// commits to, its serialization guarantees, and its boundary. The -// platform's own normalization and validation are its business, not -// re-proven here. - -import { expect, test } from "bun:test"; -import type { StepPrimitive, WorkflowDefinition } from "@intx/workflow"; - -import { - DILIGENCE_BRIEF_CREDENTIAL_BINDINGS, - DILIGENCE_BRIEF_FINALIZE_TOOL_NAME, - DILIGENCE_BRIEF_SECTIONS, - DILIGENCE_BRIEF_STEP_ID, - DILIGENCE_BRIEF_TOOL_PACKAGE_PINS, - DILIGENCE_BRIEF_WIRED_SOURCES, - DILIGENCE_BRIEF_WORKFLOW_ID, - buildDiligenceBriefWorkflow, - serializeDiligenceBriefWorkflow, -} from "../src/index"; - -const INPUT = { - triggerAddress: "diligence-brief@example.test", - inferencePreferences: [{ provider: "anthropic", model: "claude-test" }], - turnTimeoutMs: 600000, -} as const; - -function briefStep(definition: WorkflowDefinition): StepPrimitive { - const primitive = definition.steps[DILIGENCE_BRIEF_STEP_ID]; - if (primitive === undefined || primitive.kind !== "step") { - throw new Error(`definition has no step named ${DILIGENCE_BRIEF_STEP_ID}`); - } - return primitive; -} - -test("the definition is one mail-triggered step", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - expect(definition.id).toBe(DILIGENCE_BRIEF_WORKFLOW_ID); - expect(definition.stepOrder).toEqual([DILIGENCE_BRIEF_STEP_ID]); - expect(definition.triggers).toEqual([{ type: "mail", to: INPUT.triggerAddress }]); -}); - -test("the step pins web-search and memory tool packages and sets an explicit turn timeout", () => { - const primitive = briefStep(buildDiligenceBriefWorkflow(INPUT)); - expect(primitive.timeout).toBe(INPUT.turnTimeoutMs); - expect(primitive.agent.toolPackagePins).toEqual(DILIGENCE_BRIEF_TOOL_PACKAGE_PINS); - expect(DILIGENCE_BRIEF_TOOL_PACKAGE_PINS).toEqual([ - { name: "@corbits/web-search-tools", version: "0.0.4" }, - { name: "@corbits/memory", version: "0.1.2" }, - ]); - expect(primitive.agent.toolFactories).toEqual([]); -}); - -test("the definition binds the web-search package's exa handle to the tenant's connection", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - expect(definition.credentialBindings).toEqual(DILIGENCE_BRIEF_CREDENTIAL_BINDINGS); - expect(DILIGENCE_BRIEF_CREDENTIAL_BINDINGS).toEqual([ - { - package: "@corbits/web-search-tools", - handle: "exa", - provider: "exa", - locator: "tenant", - }, - ]); -}); - -test("the prompt names the fixed five-section outline, in order", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - const prompt = briefStep(definition).agent.systemPrompt; - expect(DILIGENCE_BRIEF_SECTIONS).toEqual([ - "Overview", - "Team & Founders", - "Product & Market", - "Traction & Funding", - "Risks & Open Questions", - ]); - let lastIndex = -1; - for (const heading of DILIGENCE_BRIEF_SECTIONS) { - const index = prompt.indexOf(heading); - expect(index).toBeGreaterThan(lastIndex); - lastIndex = index; - } -}); - -test("the prompt commits to checking memory before the web, and to the two wired sources", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - const prompt = briefStep(definition).agent.systemPrompt; - expect(DILIGENCE_BRIEF_WIRED_SOURCES).toEqual(["Web search", "Firm memory"]); - expect(prompt).toContain("memory_search"); - expect(prompt).toContain("web_search"); - expect(prompt.indexOf("memory_search")).toBeLessThan(prompt.indexOf("web_search")); - expect(prompt).toMatch(/never invent results/i); - expect(prompt).toMatch(/never fabricate/i); -}); - -test("the prompt names the exact approval-gated finalize tool and commits to always finalizing", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - const prompt = briefStep(definition).agent.systemPrompt; - expect(prompt).toContain(DILIGENCE_BRIEF_FINALIZE_TOOL_NAME); - expect(prompt).toMatch(/never end a run without finalizing/i); - expect(prompt).toContain("exa"); -}); - -test("the prompt commits to a calm terminal reply on denial, not an error", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - const prompt = briefStep(definition).agent.systemPrompt; - expect(prompt).toMatch(/not approved/i); - expect(prompt).toMatch(/never present a denial as an error/i); -}); - -test("the definition survives the workflow-asset round trip", () => { - const definition = buildDiligenceBriefWorkflow(INPUT); - const round = JSON.parse(serializeDiligenceBriefWorkflow(definition)) as WorkflowDefinition; - expect(round).toEqual(definition); -}); - -test("serialization fails loud on a function-valued field, naming its path", () => { - const poisoned = { - id: DILIGENCE_BRIEF_WORKFLOW_ID, - triggers: [{ type: "manual" }], - stepOrder: [DILIGENCE_BRIEF_STEP_ID], - steps: { - [DILIGENCE_BRIEF_STEP_ID]: { - kind: "step", - id: DILIGENCE_BRIEF_STEP_ID, - drainBehavior: "cancel", - agent: { - id: DILIGENCE_BRIEF_STEP_ID, - systemPrompt: "x", - toolFactories: [() => []], - capabilities: [], - inference: { sources: [] }, - }, - }, - }, - } as unknown as WorkflowDefinition; - expect(() => serializeDiligenceBriefWorkflow(poisoned)).toThrow( - new RegExp(`steps\\.${DILIGENCE_BRIEF_STEP_ID}\\.agent\\.toolFactories\\[0\\]`), - ); -}); - -test("a blank trigger address or a bad timeout is refused at build time", () => { - expect(() => buildDiligenceBriefWorkflow({ ...INPUT, triggerAddress: "" })).toThrow( - /triggerAddress/, - ); - expect(() => buildDiligenceBriefWorkflow({ ...INPUT, turnTimeoutMs: 0 })).toThrow( - /turnTimeoutMs/, - ); -}); diff --git a/workflows/diligence-brief/tsconfig.json b/workflows/diligence-brief/tsconfig.json deleted file mode 100644 index a8c2b9966d..0000000000 --- a/workflows/diligence-brief/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "./tsconfig.src.json", - "compilerOptions": { - "composite": false, - "noEmit": true, - "disableSourceOfProjectReferenceRedirect": true, - "declaration": false, - "declarationMap": false, - "emitDeclarationOnly": false, - "tsBuildInfoFile": "tsconfig.tsbuildinfo", - "rootDir": "../.." - }, - "include": ["src", "test"], - "exclude": [] -} diff --git a/workflows/diligence-brief/tsconfig.src.json b/workflows/diligence-brief/tsconfig.src.json deleted file mode 100644 index fc8724305f..0000000000 --- a/workflows/diligence-brief/tsconfig.src.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src", "package.json", "src/**/*.json"], - "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx"], - "compilerOptions": { - "types": ["bun"], - "composite": true, - "emitDeclarationOnly": true, - "outDir": "dist", - "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" - } -}