@pptb/types 1.2.4-beta.6 → 1.2.4
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 +37 -9
- package/dataverseAPI.d.ts +6 -0
- package/package.json +1 -1
- package/powerplatformAPI.d.ts +8 -1
- package/pptbConfig.d.ts +35 -9
- package/toolboxAPI.d.ts +32 -7
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ TypeScript type definitions for Power Platform ToolBox APIs, plus a built-in CLI
|
|
|
21
21
|
- [Inter-Tool Invocation](#inter-tool-invocation)
|
|
22
22
|
- [Caller: launching another tool with prefill data](#caller-launching-another-tool-with-prefill-data)
|
|
23
23
|
- [Caller: tag-based capability discovery](#caller-tag-based-capability-discovery)
|
|
24
|
+
- [Caller: tag-based capability discovery](#caller-tag-based-capability-discovery-1)
|
|
24
25
|
- [Callee: reading prefill data and returning a result](#callee-reading-prefill-data-and-returning-a-result)
|
|
25
26
|
- [Declaring your invocation contract](#declaring-your-invocation-contract)
|
|
26
27
|
- [Dataverse API Examples](#dataverse-api-examples)
|
|
@@ -128,21 +129,26 @@ The validator checks every field that the official review pipeline inspects:
|
|
|
128
129
|
|
|
129
130
|
In addition to `package.json`, the validator automatically checks a `pptb.config.json` file if one is present in the same directory. This file declares tool-to-tool communication contracts and other PPTB-specific metadata.
|
|
130
131
|
|
|
131
|
-
| Field | Required | Rules
|
|
132
|
-
| ----------------------------------- | -------- |
|
|
133
|
-
| `invocation.version` | ✅\*\* | Must be a valid **semantic version** string (e.g. `"1.0.0"`). Tool developers own this version and bump it when the invocation contract changes.
|
|
134
|
-
| `invocation.capabilities` | ❌ | Array of non-empty string tags (e.g. `["entity-picker"]`). Used by callers to discover this tool via `findToolsByCapability`.
|
|
135
|
-
| `invocation.prefill` | ❌ | JSON-schema-style object describing data callers can pre-populate
|
|
136
|
-
| `invocation.prefill.properties` | ❌ | Map of property names to `{ type?, enum?, items? }` descriptors
|
|
137
|
-
| `invocation.returnTopic` | ❌ | JSON-schema-style object describing the data this tool returns to its caller
|
|
138
|
-
| `invocation.returnTopic.properties` | ❌ | Map of property names to `{ type?, enum?, items? }` descriptors
|
|
132
|
+
| Field | Required | Rules |
|
|
133
|
+
| ----------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
134
|
+
| `invocation.version` | ✅\*\* | Must be a valid **semantic version** string (e.g. `"1.0.0"`). Tool developers own this version and bump it when the invocation contract changes. |
|
|
135
|
+
| `invocation.capabilities` | ❌ | Array of non-empty string tags (e.g. `["entity-picker"]`). Used by callers to discover this tool via `findToolsByCapability`. |
|
|
136
|
+
| `invocation.prefill` | ❌ | JSON-schema-style object describing data callers can pre-populate |
|
|
137
|
+
| `invocation.prefill.properties` | ❌ | Map of property names to `{ type?, enum?, items? }` descriptors |
|
|
138
|
+
| `invocation.returnTopic` | ❌ | JSON-schema-style object describing the data this tool returns to its caller |
|
|
139
|
+
| `invocation.returnTopic.properties` | ❌ | Map of property names to `{ type?, enum?, items? }` descriptors |
|
|
140
|
+
| `agents` | ❌ | Top-level agent contract for external automation; when present, must include `version` and may include `invokable`, `modes`, `defaultMode`, and `timeoutMS` |
|
|
141
|
+
| `agents.version` | ✅ | Must be a valid semantic version string (e.g. `1.0.0`) |
|
|
142
|
+
| `agents.invokable` | ❌ | Boolean indicating whether an external (non-PPTB) automation agent may launch this tool programmatically |
|
|
143
|
+
| `agents.modes` | ❌ | Array of supported invocation modes (`"one-way"`, `"two-way"`) |
|
|
144
|
+
| `agents.defaultMode` | ❌ | Default mode when the agent does not request one explicitly |
|
|
145
|
+
| `agents.timeoutMS` | ❌ | Optional timeout hint in milliseconds for two-way calls |
|
|
139
146
|
|
|
140
147
|
> \*\* Required only when the `invocation` object is present.
|
|
141
148
|
|
|
142
149
|
**Example `pptb.config.json`:**
|
|
143
150
|
|
|
144
151
|
```json
|
|
145
|
-
{
|
|
146
152
|
"invocation": {
|
|
147
153
|
"version": "1.0.0",
|
|
148
154
|
"capabilities": ["entity-picker"],
|
|
@@ -159,6 +165,13 @@ In addition to `package.json`, the validator automatically checks a `pptb.config
|
|
|
159
165
|
"error": { "type": "string" }
|
|
160
166
|
}
|
|
161
167
|
}
|
|
168
|
+
},
|
|
169
|
+
"agents": {
|
|
170
|
+
"version": "1.0.0",
|
|
171
|
+
"invokable": true,
|
|
172
|
+
"modes": ["one-way", "two-way"],
|
|
173
|
+
"defaultMode": "two-way",
|
|
174
|
+
"timeoutMS": 12000
|
|
162
175
|
}
|
|
163
176
|
}
|
|
164
177
|
```
|
|
@@ -329,6 +342,21 @@ if (result !== null) {
|
|
|
329
342
|
|
|
330
343
|
#### Caller: tag-based capability discovery
|
|
331
344
|
|
|
345
|
+
```typescript
|
|
346
|
+
// Find all installed tools that declare the "entity-picker" capability
|
|
347
|
+
const pickers = await toolboxAPI.invocation.findToolsByCapability("entity-picker");
|
|
348
|
+
if (pickers.length > 0) {
|
|
349
|
+
const picker = pickers[0] as { id: string };
|
|
350
|
+
const result = await toolboxAPI.invocation.launchTool(picker.id, { entityName: "account" });
|
|
351
|
+
} else {
|
|
352
|
+
// User dismissed the picker (closed window or clicked "Return to Caller" banner)
|
|
353
|
+
}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
> **One-at-a-time**: only one active callee per caller is supported. A second `launchTool` call while a callee is open throws `"A callee invocation is already in progress"`.
|
|
357
|
+
|
|
358
|
+
#### Caller: tag-based capability discovery
|
|
359
|
+
|
|
332
360
|
```typescript
|
|
333
361
|
// Find all installed tools that declare the "entity-picker" capability
|
|
334
362
|
const pickers = await toolboxAPI.invocation.findToolsByCapability("entity-picker");
|
package/dataverseAPI.d.ts
CHANGED
|
@@ -1544,6 +1544,12 @@ declare global {
|
|
|
1544
1544
|
*/
|
|
1545
1545
|
dataverseAPI: DataverseAPI.API;
|
|
1546
1546
|
}
|
|
1547
|
+
interface GlobalThis {
|
|
1548
|
+
/**
|
|
1549
|
+
* Dataverse Web API accessible to headless tools via globalThis
|
|
1550
|
+
*/
|
|
1551
|
+
dataverseAPI: DataverseAPI.API;
|
|
1552
|
+
}
|
|
1547
1553
|
}
|
|
1548
1554
|
|
|
1549
1555
|
export = DataverseAPI;
|
package/package.json
CHANGED
package/powerplatformAPI.d.ts
CHANGED
|
@@ -185,6 +185,13 @@ declare namespace PowerPlatformAPI {
|
|
|
185
185
|
* Global window interface extension for Power Platform API
|
|
186
186
|
*/
|
|
187
187
|
declare global {
|
|
188
|
+
interface GlobalThis {
|
|
189
|
+
/**
|
|
190
|
+
* Power Platform Admin API accessible to headless tools
|
|
191
|
+
*/
|
|
192
|
+
powerplatformAPI: PowerPlatformAPI.API;
|
|
193
|
+
}
|
|
194
|
+
|
|
188
195
|
interface Window {
|
|
189
196
|
/**
|
|
190
197
|
* Power Platform Admin API accessible to tools
|
|
@@ -197,4 +204,4 @@ declare global {
|
|
|
197
204
|
}
|
|
198
205
|
|
|
199
206
|
export = PowerPlatformAPI;
|
|
200
|
-
export as namespace PowerPlatformAPI;
|
|
207
|
+
export as namespace PowerPlatformAPI;
|
package/pptbConfig.d.ts
CHANGED
|
@@ -25,6 +25,13 @@
|
|
|
25
25
|
* "error": { "type": "string" }
|
|
26
26
|
* }
|
|
27
27
|
* }
|
|
28
|
+
* },
|
|
29
|
+
* "agents": {
|
|
30
|
+
* "version": "1.0.0",
|
|
31
|
+
* "invokable": true,
|
|
32
|
+
* "modes": ["one-way", "two-way"],
|
|
33
|
+
* "defaultMode": "two-way",
|
|
34
|
+
* "timeoutMS": 12000
|
|
28
35
|
* }
|
|
29
36
|
* }
|
|
30
37
|
* ```
|
|
@@ -49,14 +56,7 @@
|
|
|
49
56
|
* | `plugin-inspector` | Inspect or manage plugins and assemblies |
|
|
50
57
|
* | `pcf-control-builder`| Build or scaffold PCF controls |
|
|
51
58
|
*/
|
|
52
|
-
export type KnownCapabilityTag =
|
|
53
|
-
| "fetchxml"
|
|
54
|
-
| "entity-picker"
|
|
55
|
-
| "record-selector"
|
|
56
|
-
| "solution-selector"
|
|
57
|
-
| "webresource-editor"
|
|
58
|
-
| "plugin-inspector"
|
|
59
|
-
| "pcf-control-builder";
|
|
59
|
+
export type KnownCapabilityTag = "fetchxml" | "entity-picker" | "record-selector" | "solution-selector" | "webresource-editor" | "plugin-inspector" | "pcf-control-builder";
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* A capability tag string accepted by `invocation.capabilities` and
|
|
@@ -72,7 +72,7 @@ export type KnownCapabilityTag =
|
|
|
72
72
|
* { "invocation": { "version": "1.0.0", "capabilities": ["fetchxml", "entity-picker"] } }
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
|
-
export type CapabilityTag = KnownCapabilityTag |
|
|
75
|
+
export type CapabilityTag = KnownCapabilityTag | string;
|
|
76
76
|
|
|
77
77
|
/** A JSON-schema-style property descriptor used inside invocation definitions. */
|
|
78
78
|
export interface JsonSchemaProperty {
|
|
@@ -101,6 +101,30 @@ export interface JsonSchemaObject {
|
|
|
101
101
|
* - `returnTopic` describes the data this tool will resolve back to its caller
|
|
102
102
|
* when it finishes.
|
|
103
103
|
*/
|
|
104
|
+
export type AgentInvocationMode = "one-way" | "two-way";
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Agent-specific launch contract for external automation callers.
|
|
108
|
+
*
|
|
109
|
+
* - `version`: semantic version for the agent-facing contract.
|
|
110
|
+
* - `invokable`: opt-in flag that exposes the tool to the MCP server.
|
|
111
|
+
* - `modes`: supported MCP invocation modes for this tool.
|
|
112
|
+
* - `defaultMode`: fallback mode when the caller does not specify one.
|
|
113
|
+
* - `timeoutMS`: optional timeout hint, in milliseconds, for two-way calls.
|
|
114
|
+
*/
|
|
115
|
+
export interface AgentsConfig {
|
|
116
|
+
/** Semantic version of this agent contract. */
|
|
117
|
+
version: string;
|
|
118
|
+
/** Whether the tool may be invoked by an external agent. */
|
|
119
|
+
invokable?: boolean;
|
|
120
|
+
/** Invocation modes supported by the tool when called by an agent. */
|
|
121
|
+
modes?: AgentInvocationMode[];
|
|
122
|
+
/** Default mode used when an agent does not request a mode explicitly. */
|
|
123
|
+
defaultMode?: AgentInvocationMode;
|
|
124
|
+
/** Optional timeout hint, in milliseconds, for agent-driven two-way calls. */
|
|
125
|
+
timeoutMS?: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
104
128
|
export interface InvocationConfig {
|
|
105
129
|
/**
|
|
106
130
|
* Semantic version of this invocation contract (e.g. "1.0.0").
|
|
@@ -142,4 +166,6 @@ export interface InvocationConfig {
|
|
|
142
166
|
export interface PPTBConfig {
|
|
143
167
|
/** Invocation contract – how this tool can be called by other tools. */
|
|
144
168
|
invocation?: InvocationConfig;
|
|
169
|
+
/** Agent contract – how this tool can be called by external automation. */
|
|
170
|
+
agents?: AgentsConfig;
|
|
145
171
|
}
|
package/toolboxAPI.d.ts
CHANGED
|
@@ -16,6 +16,18 @@ declare namespace ToolBoxAPI {
|
|
|
16
16
|
connectionId?: string | null;
|
|
17
17
|
secondaryConnectionUrl?: string | null;
|
|
18
18
|
secondaryConnectionId?: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Invocation metadata injected by PPTB when the tool is launched by another
|
|
21
|
+
* tool or by the MCP server. Tools should treat this as optional and
|
|
22
|
+
* branch on `source`/`mode` rather than assuming it is always present.
|
|
23
|
+
*/
|
|
24
|
+
invocationContext?: {
|
|
25
|
+
source?: "tool" | "mcp";
|
|
26
|
+
mode?: "one-way" | "two-way";
|
|
27
|
+
correlationId?: string;
|
|
28
|
+
timeoutMs?: number;
|
|
29
|
+
expectsResponse?: boolean;
|
|
30
|
+
};
|
|
19
31
|
}
|
|
20
32
|
|
|
21
33
|
/**
|
|
@@ -86,6 +98,7 @@ declare namespace ToolBoxAPI {
|
|
|
86
98
|
environmentColor?: string;
|
|
87
99
|
categoryColor?: string;
|
|
88
100
|
enabledForPowerPlatformAPI?: boolean;
|
|
101
|
+
scopesForPowerPlatformAPI?: string[];
|
|
89
102
|
createdAt?: string;
|
|
90
103
|
lastUsedAt?: string;
|
|
91
104
|
/**
|
|
@@ -461,16 +474,15 @@ declare namespace ToolBoxAPI {
|
|
|
461
474
|
getLaunchContext: () => Promise<Record<string, unknown> | null>;
|
|
462
475
|
|
|
463
476
|
/**
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
* The value resolves the `Promise` returned by the caller's
|
|
467
|
-
* `invocation.launchTool()` call. **After calling `returnData`, PPTB
|
|
468
|
-
* automatically closes the callee window** — the callee does not need to
|
|
469
|
-
* close itself.
|
|
477
|
+
* Return data back to the tool that launched this one. If the tool was not
|
|
478
|
+
* launched by another tool, this is a no-op.
|
|
470
479
|
*
|
|
471
|
-
*
|
|
480
|
+
* For MCP launches, one-way mode may omit a payload entirely from the
|
|
481
|
+
* caller's response lifecycle, but the tool can still call `returnData()` to
|
|
482
|
+
* complete a local flow if it wants to.
|
|
472
483
|
*
|
|
473
484
|
* @param returnData The data to pass back to the caller
|
|
485
|
+
* @returns Promise that resolves when the data has been handed off
|
|
474
486
|
*/
|
|
475
487
|
returnData: (returnData: Record<string, unknown>) => Promise<void>;
|
|
476
488
|
|
|
@@ -557,6 +569,19 @@ declare namespace ToolBoxAPI {
|
|
|
557
569
|
* Global window interface extension for ToolBox tools
|
|
558
570
|
*/
|
|
559
571
|
declare global {
|
|
572
|
+
interface GlobalThis {
|
|
573
|
+
/**
|
|
574
|
+
* The organized ToolBox API for headless tools.
|
|
575
|
+
* Windowed tools should continue to use window.toolboxAPI.
|
|
576
|
+
*/
|
|
577
|
+
toolboxAPI: ToolBoxAPI.API;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Tool context available at startup
|
|
581
|
+
*/
|
|
582
|
+
TOOLBOX_CONTEXT?: ToolBoxAPI.ToolContext;
|
|
583
|
+
}
|
|
584
|
+
|
|
560
585
|
interface Window {
|
|
561
586
|
/**
|
|
562
587
|
* The organized ToolBox API for tools
|