@caplets/opencode 0.3.0 → 0.4.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/README.md CHANGED
@@ -4,6 +4,8 @@ Native OpenCode plugin for Caplets.
4
4
 
5
5
  This package exposes configured Caplets as native OpenCode tools named `caplets_<id>`. It does not start the Caplets MCP server and does not edit `opencode.json`; prompt guidance is injected through OpenCode plugin hooks.
6
6
 
7
+ MCP-backed Caplets advertise resource, prompt, template, and completion operations in their generated schema; OpenAPI, GraphQL, HTTP, CLI, and Caplet-set backends remain tool/action-only.
8
+
7
9
  ```jsonc
8
10
  {
9
11
  "plugin": ["@caplets/opencode"],
package/dist/index.js CHANGED
@@ -2,14 +2,28 @@ import { createNativeCapletsService, nativeCapletsSystemGuidance, registerNative
2
2
  import { tool } from "@opencode-ai/plugin";
3
3
  import { operations } from "@caplets/core/generated-tool-input-schema";
4
4
  //#region src/schema.ts
5
- function capletsOpenCodeArgs() {
5
+ function capletsOpenCodeArgs(operationNames = [...operations]) {
6
+ const enumValues = operationNames.length > 0 ? operationNames : [...operations];
6
7
  return {
7
- operation: tool.schema.enum(operations),
8
+ operation: tool.schema.enum(enumValues),
8
9
  query: tool.schema.string().optional(),
9
10
  limit: tool.schema.number().int().positive().optional(),
10
11
  tool: tool.schema.string().optional(),
11
12
  arguments: tool.schema.record(tool.schema.string(), tool.schema.unknown()).optional(),
12
- fields: tool.schema.array(tool.schema.string().min(1)).min(1).optional()
13
+ fields: tool.schema.array(tool.schema.string().min(1)).min(1).optional(),
14
+ uri: tool.schema.string().optional(),
15
+ prompt: tool.schema.string().optional(),
16
+ ref: tool.schema.union([tool.schema.object({
17
+ type: tool.schema.literal("prompt"),
18
+ name: tool.schema.string().min(1)
19
+ }).strict(), tool.schema.object({
20
+ type: tool.schema.literal("resourceTemplate"),
21
+ uri: tool.schema.string().min(1)
22
+ }).strict()]).optional(),
23
+ argument: tool.schema.object({
24
+ name: tool.schema.string().min(1),
25
+ value: tool.schema.string()
26
+ }).strict().optional()
13
27
  };
14
28
  }
15
29
  //#endregion
@@ -20,7 +34,7 @@ async function createCapletsOpenCodeHooks(service) {
20
34
  return {
21
35
  tool: Object.fromEntries(capletTools.map((caplet) => [caplet.toolName, tool({
22
36
  description: caplet.description,
23
- args: capletsOpenCodeArgs(),
37
+ args: capletsOpenCodeArgs(caplet.operationNames ?? void 0),
24
38
  async execute(args) {
25
39
  return compactOpenCodeResult(await service.execute(caplet.caplet, args));
26
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caplets/opencode",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Native OpenCode plugin for Caplets.",
5
5
  "homepage": "https://github.com/spiritledsoftware/caplets#readme",
6
6
  "bugs": {
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@caplets/core": "0.17.0"
29
+ "@caplets/core": "0.18.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/node": "^25.9.0",