@zackbart/connecta 0.12.0 → 0.12.2
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/CHANGELOG.md +80 -0
- package/dist/apps-shell.d.ts +13 -11
- package/dist/apps-shell.d.ts.map +1 -1
- package/dist/apps-shell.js +221 -30
- package/dist/apps-shell.js.map +1 -1
- package/dist/execute.d.ts +12 -4
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +140 -20
- package/dist/execute.js.map +1 -1
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +9 -0
- package/dist/meta-tools.js.map +1 -1
- package/dist/skills.d.ts +2 -2
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +19 -14
- package/dist/skills.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/documentation/code-mode.md +38 -15
- package/documentation/mcp-ui-design.md +8 -8
- package/documentation/program-ui-read-calls.md +213 -0
- package/ethos.md +3 -1
- package/package.json +1 -1
- package/src/apps-shell.ts +221 -30
- package/src/execute.ts +207 -21
- package/src/meta-tools.ts +9 -0
- package/src/skills.ts +19 -14
- package/src/version.ts +1 -1
- package/templates/node/package.json +1 -1
package/src/meta-tools.ts
CHANGED
|
@@ -1484,6 +1484,7 @@ export function registerMetaTools(
|
|
|
1484
1484
|
description: describedFor(registry, SKILLS_DESC, "skills"),
|
|
1485
1485
|
inputSchema: z.object({ name: z.string().optional() }),
|
|
1486
1486
|
annotations: READ_ONLY_LOCAL,
|
|
1487
|
+
_meta: { ui: { visibility: ["model"] } },
|
|
1487
1488
|
},
|
|
1488
1489
|
async (args) => mt.skills(args as SkillArgs),
|
|
1489
1490
|
);
|
|
@@ -1508,6 +1509,7 @@ export function registerMetaTools(
|
|
|
1508
1509
|
includeSchemas: z.enum(["compact", "json"]).optional(),
|
|
1509
1510
|
}),
|
|
1510
1511
|
annotations: READ_ONLY_REMOTE,
|
|
1512
|
+
_meta: { ui: { visibility: ["model"] } },
|
|
1511
1513
|
},
|
|
1512
1514
|
async (args) => mt.searchTools(args as SearchArgs),
|
|
1513
1515
|
);
|
|
@@ -1520,6 +1522,10 @@ export function registerMetaTools(
|
|
|
1520
1522
|
// call_tool admits only tools that are themselves explicitly read-only;
|
|
1521
1523
|
// anything else is refused and routed to call_destructive_tool.
|
|
1522
1524
|
annotations: READ_ONLY_REMOTE,
|
|
1525
|
+
// The trusted program-view shell delegates bounded named reads here.
|
|
1526
|
+
// It is already one of the seven model tools; app visibility adds no
|
|
1527
|
+
// tool and this handler repeats ordinary fail-closed read admission.
|
|
1528
|
+
_meta: { ui: { visibility: ["model", "app"] } },
|
|
1523
1529
|
},
|
|
1524
1530
|
async (args) => mt.callTool(args as CallArgs),
|
|
1525
1531
|
);
|
|
@@ -1541,6 +1547,7 @@ export function registerMetaTools(
|
|
|
1541
1547
|
readOnlyHint: false,
|
|
1542
1548
|
openWorldHint: true,
|
|
1543
1549
|
},
|
|
1550
|
+
_meta: { ui: { visibility: ["model"] } },
|
|
1544
1551
|
},
|
|
1545
1552
|
async (args) => {
|
|
1546
1553
|
// `reason` is the host's to display and connecta's to keep out of the
|
|
@@ -1568,6 +1575,7 @@ export function registerMetaTools(
|
|
|
1568
1575
|
destructiveHint: false,
|
|
1569
1576
|
openWorldHint: true,
|
|
1570
1577
|
},
|
|
1578
|
+
_meta: { ui: { visibility: ["model"] } },
|
|
1571
1579
|
},
|
|
1572
1580
|
async (args) => mt.authorizeConnector(args as AuthorizeArgs),
|
|
1573
1581
|
);
|
|
@@ -1586,6 +1594,7 @@ export function registerMetaTools(
|
|
|
1586
1594
|
maxBytes: z.number().int().min(MIN_MAX_RESULT_BYTES).optional(),
|
|
1587
1595
|
}),
|
|
1588
1596
|
annotations: READ_ONLY_LOCAL,
|
|
1597
|
+
_meta: { ui: { visibility: ["model"] } },
|
|
1589
1598
|
},
|
|
1590
1599
|
async (args) => mt.getResult(args as GetResultArgs),
|
|
1591
1600
|
);
|
package/src/skills.ts
CHANGED
|
@@ -1,33 +1,38 @@
|
|
|
1
1
|
import type { Connector } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export const CONNECTA_INSTRUCTIONS =
|
|
4
|
-
'Connecta exposes
|
|
4
|
+
'Connecta exposes seven meta-tools. execute_code is primary: use connecta.search, describe, call, and batch for discovery, multiple or dependent calls, loops, joins, and result reduction. connecta.ui(html) is a guest function inside execute_code, never a connector address or search_tools result; pass one HTML string for display-only, or bind named read-only refresh/drill-down calls in its optional reads argument, and return the same initial summary data the HTML renders. For one read at an unknown address, search_tools with 2–4 distinctive action/object terms and includeSchemas="compact", then one call_tool — a lone cold call is cheaper direct than a program. Use call_destructive_tool individually for unannotated, write-capable, or destructive tools; authorize_connector follows auth_required; get_result follows truncation. If this routing is unfamiliar, fetch skills({ name: "usage" }).';
|
|
5
5
|
|
|
6
6
|
export const USAGE_SKILL = `# Connecta usage
|
|
7
7
|
|
|
8
8
|
## The surface
|
|
9
9
|
|
|
10
|
-
Seven tools: \`execute_code\`, \`search_tools\`, \`call_tool\`, \`call_destructive_tool\`, \`authorize_connector\`, \`get_result\`, \`skills\`. Broad discovery and multi-call work live
|
|
10
|
+
Seven tools: \`execute_code\`, \`search_tools\`, \`call_tool\`, \`call_destructive_tool\`, \`authorize_connector\`, \`get_result\`, \`skills\`. Broad discovery and multi-call work live in a program, not in top-level tools.
|
|
11
11
|
|
|
12
12
|
## Choose the smallest execution tool
|
|
13
13
|
|
|
14
|
-
Use exact addresses
|
|
14
|
+
Use exact addresses from discovery; never invent one. Search 2–4 distinctive action/object terms, not the whole request.
|
|
15
15
|
|
|
16
|
-
- One read at an unknown address: \`search_tools({ query, includeSchemas: "compact" })\`, then \`call_tool\` once
|
|
17
|
-
- Anything wider — two or more calls, dependent steps, loops, joins, branching,
|
|
18
|
-
- Any unannotated, write-capable, or destructive call: \`call_destructive_tool\`,
|
|
19
|
-
- Truncated result: retry with \`fields
|
|
20
|
-
- \`auth_required\`:
|
|
16
|
+
- One read at an unknown address: \`search_tools({ query, includeSchemas: "compact" })\`, then \`call_tool\` once — one cold call is cheaper direct than a program.
|
|
17
|
+
- Anything wider — two or more calls, dependent steps, loops, joins, branching, a whole-catalog browse, or a result to reduce: one \`execute_code\` run.
|
|
18
|
+
- Any unannotated, write-capable, or destructive call: \`call_destructive_tool\`, one at a time, after reviewing its schema and consequences.
|
|
19
|
+
- Truncated result: retry with \`fields\`, else page it with \`get_result\`.
|
|
20
|
+
- \`auth_required\`: \`authorize_connector\`, hand its recovery text to the operator, retry the call.
|
|
21
21
|
|
|
22
22
|
## Inside a program
|
|
23
23
|
|
|
24
|
-
One async arrow function. The only capabilities are one global per connector (\`<connectorId>.<toolName>(args)\`), the
|
|
24
|
+
One async arrow function. The only capabilities are one global per connector (\`<connectorId>.<toolName>(args)\`), the \`connecta\` functions, and \`console.log\`.
|
|
25
|
+
|
|
26
|
+
- \`connecta.search({})\` browses every catalog; \`safety: "readOnly"\` narrows to calls a program can execute, \`connector: "<id>"\` to one. This filters results, not authority; matches carry \`address\` and annotations.
|
|
27
|
+
- Exact schemas: \`connecta.describe({ address: "connector.tool" })\` for one, \`{ addresses: [...] }\` for many; \`format: "json"\` only for exact constraints.
|
|
28
|
+
- Two to ten independent calls: \`connecta.batch([...])\`. Each outcome is \`{ address, ok: true, data }\` or \`{ address, ok: false, error, errorDetails: { code, retryable } }\` — how a program tells a policy refusal from a transient failure.
|
|
29
|
+
- Search inside the run, not before it; return only the reduction the answer needs, never raw payloads.
|
|
30
|
+
- Only tools annotated \`readOnlyHint: true\` are reachable; the gate, credentials, and admission are enforced below the sandbox — nothing a program does widens its reach.
|
|
31
|
+
|
|
32
|
+
## Rendering a view
|
|
33
|
+
|
|
34
|
+
\`connecta.ui(html)\` renders a display-only view on success for the client, never for the model. Fetch first, check the shape in code. On a surprise — empty array, missing key — return a trimmed first record instead of rendering: the wrong view becomes the sample you needed. Otherwise render from the variables you return; the model reads the return value, not the view.
|
|
25
35
|
|
|
26
|
-
- What exists: \`connecta.search({})\` browses every catalog; add \`safety: "readOnly"\` for only calls the program can execute, and \`connector: "<id>"\` to browse one. This filters discovery results, not authority, and each match carries its \`address\` and annotations.
|
|
27
|
-
- Exact schemas for known addresses: \`connecta.describe({ address: "connector.tool" })\` for one or \`connecta.describe({ addresses: [...] })\` for many; \`format: "json"\` only for exact constraints.
|
|
28
|
-
- Two to ten independent calls: \`connecta.batch([...])\`. Each outcome is \`{ address, ok: true, data }\` or \`{ address, ok: false, error, errorDetails: { code, retryable } }\`, which is also how a program tells a policy refusal from a transient failure.
|
|
29
|
-
- Search inside the run rather than searching first, and return only the reduction the answer needs — never raw payloads.
|
|
30
|
-
- Only tools annotated \`readOnlyHint: true\` are reachable; the read-only gate, credentials, and admission are enforced below the sandbox, so nothing a program does widens what it can reach.
|
|
31
36
|
`;
|
|
32
37
|
|
|
33
38
|
/**
|
package/src/version.ts
CHANGED