@constal/sdk 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constal/sdk",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Public TypeScript SDK for authoring Constal agents, integrations, policies, channels, and credential providers",
5
5
  "keywords": [
6
6
  "constal",
package/publish/api.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@constal/sdk",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "exports": [
5
5
  "AGENT_UI_DEFAULTS",
6
6
  "Action",
@@ -2368,6 +2368,8 @@ interface Cost {
2368
2368
  }
2369
2369
  interface Tool {
2370
2370
  name: string;
2371
+ /** One short line naming what the Tool does, shown to people who review, approve or browse Tools; never sent to the model. */
2372
+ title?: string;
2371
2373
  version: string;
2372
2374
  description: string;
2373
2375
  schema: object;
@@ -3988,7 +3990,7 @@ interface CatalogTool extends Tool {
3988
3990
  op: string;
3989
3991
  };
3990
3992
  }
3991
- declare function opTool(binding: string, op: string, override?: Partial<Pick<Tool, "name" | "description" | "schema" | "tier" | "once" | "guard" | "preview">>): CatalogTool;
3993
+ declare function opTool(binding: string, op: string, override?: Partial<Pick<Tool, "name" | "title" | "description" | "schema" | "tier" | "once" | "guard" | "preview">>): CatalogTool;
3992
3994
  declare function opTools(binding: string, ops?: string[]): CatalogTool[];
3993
3995
  /** Optional model-facing access to bindings already accepted by this Run.
3994
3996
  * Installation, binding changes, authorization, and retries keep their existing owners. */
package/publish/index.js CHANGED
@@ -1158,6 +1158,9 @@ function validateExecutable(value, path) {
1158
1158
  }
1159
1159
  function validateTool(tool, path = "tool") {
1160
1160
  requiredString(tool.name, `${path}.name`);
1161
+ if (tool.title !== void 0 && (typeof tool.title !== "string" || tool.title.trim() === "" || /[\n\v\f\r\u0085\u2028\u2029]/u.test(tool.title))) {
1162
+ throw new TypeError(`${path}.title must be a non-empty single line`);
1163
+ }
1161
1164
  requiredString(tool.version, `${path}.version`);
1162
1165
  if (!["read-only", "idempotent", "reconcilable", "non-idempotent"].includes(tool.maxEffect)) throw new TypeError(`${path}.maxEffect is invalid`);
1163
1166
  tool.needs?.forEach(resourceNeed);
@@ -2395,6 +2398,7 @@ function opTool(binding, op, override = {}) {
2395
2398
  const name = override.name ?? op.replaceAll(".", "_");
2396
2399
  return {
2397
2400
  name,
2401
+ ...override.title ? { title: override.title } : {},
2398
2402
  version: "catalog",
2399
2403
  description: override.description ?? `Invoke ${op} on the bound ${binding} resource.`,
2400
2404
  schema: override.schema ?? { type: "object", additionalProperties: false },