@constal/sdk 4.0.1 → 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.0.1",
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.0.1",
3
+ "version": "4.2.0",
4
4
  "exports": [
5
5
  "AGENT_UI_DEFAULTS",
6
6
  "Action",
@@ -1749,6 +1749,7 @@ interface SandboxMutationResult {
1749
1749
  interface SandboxImage {
1750
1750
  readonly id: string;
1751
1751
  readonly pool: SandboxPool;
1752
+ /** The cache key the image was created or resolved with; null when it has none, or when a handle from `SandboxPool.image` does not know it. */
1752
1753
  readonly cacheKey: string | null;
1753
1754
  delete(opts?: InvokeOpts): Promise<void>;
1754
1755
  }
@@ -1792,7 +1793,11 @@ interface SandboxPool {
1792
1793
  createImage(sandbox: Sandbox, options?: CreateSandboxImageOptions, opts?: InvokeOpts): Promise<SandboxImage>;
1793
1794
  /** Resolve an Agent-owned prepared image by its immutable environment digest. */
1794
1795
  resolveImage(cacheKey: string, opts?: InvokeOpts): Promise<SandboxImage | null>;
1795
- /** Register a logical Agent/Session sandbox; provider compute is allocated by its first work operation. */
1796
+ /** Address a pool-owned image recorded earlier, e.g. in a Fact. No invocation. The handle does not know the image's
1797
+ * cache key (`cacheKey` is null) and its delete() removes a setup-cache image too, so address only images the Agent recorded. */
1798
+ image(id: string): SandboxImage;
1799
+ /** Register a logical Agent/Session sandbox; provider compute is allocated by its first work operation. The pool refuses
1800
+ * an `image` while the Session's sandbox is live: delete that sandbox first to recreate it from an image. */
1796
1801
  createSandbox(agent: CRN, session: string, options?: CreateSandboxOptions, opts?: InvokeOpts): Promise<Sandbox>;
1797
1802
  }
1798
1803
 
@@ -2363,6 +2368,8 @@ interface Cost {
2363
2368
  }
2364
2369
  interface Tool {
2365
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;
2366
2373
  version: string;
2367
2374
  description: string;
2368
2375
  schema: object;
@@ -3983,7 +3990,7 @@ interface CatalogTool extends Tool {
3983
3990
  op: string;
3984
3991
  };
3985
3992
  }
3986
- 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;
3987
3994
  declare function opTools(binding: string, ops?: string[]): CatalogTool[];
3988
3995
  /** Optional model-facing access to bindings already accepted by this Run.
3989
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 },