@simpleplatform/sdk 2.4.0 → 2.4.1
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 +57 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -308,6 +308,63 @@ yet; attach its handle through the workflow that owns the record.
|
|
|
308
308
|
|
|
309
309
|
## API Documentation
|
|
310
310
|
|
|
311
|
+
### Describing an Action
|
|
312
|
+
|
|
313
|
+
What an action is, and when to reach for it, is written where the code is — in
|
|
314
|
+
the JSDoc comment above the handler, the same comment that carries its
|
|
315
|
+
description:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
/**
|
|
319
|
+
* Close a duplicate lead and point it at the record that survives.
|
|
320
|
+
*
|
|
321
|
+
* The surviving lead keeps its activity; the duplicate is marked closed and
|
|
322
|
+
* linked to it, so a later report still reaches both records.
|
|
323
|
+
*
|
|
324
|
+
* @tool
|
|
325
|
+
* @shortdesc Close a duplicate lead, pointing it at the surviving record.
|
|
326
|
+
* @usewhen A lead is a duplicate of one already in the system.
|
|
327
|
+
* @usewhen Two leads share a contact and one should be retired.
|
|
328
|
+
*/
|
|
329
|
+
simple.Handle(async (request) => {
|
|
330
|
+
// ...
|
|
331
|
+
})
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
| Tag | Shape | What it says |
|
|
335
|
+
| --------------- | ----------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
336
|
+
| `@tool` | bare, no value | This action can be reached as a tool |
|
|
337
|
+
| `@shortdesc` | one line, up to 300 characters, written once | What this is, read in a listing of tools |
|
|
338
|
+
| `@usewhen` | one line, up to 100 characters, up to ten times | One occasion for reaching for this rather than something else |
|
|
339
|
+
| `@parallelsafe` | bare, no value, only alongside `@tool` | This tool changes no stored data and sends nothing, so it may run at the same time as the other parallel-safe calls next to it in a batch |
|
|
340
|
+
|
|
341
|
+
`@parallelsafe` is a claim you make about your own action; the platform does
|
|
342
|
+
not verify it. It changes only which calls of a batch may overlap — consecutive
|
|
343
|
+
parallel-safe calls may run at the same time, and every other call still runs
|
|
344
|
+
alone, in the order asked. It never changes whether a failed call is retried,
|
|
345
|
+
nor the platform's assumption that a failed call may have changed stored data.
|
|
346
|
+
The build refuses it without `@tool`, with a value, or written twice. Write it
|
|
347
|
+
only when the action is read-only:
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
/**
|
|
351
|
+
* Look up a lead's open activity.
|
|
352
|
+
*
|
|
353
|
+
* @tool
|
|
354
|
+
* @shortdesc Look up a lead's open activity.
|
|
355
|
+
* @usewhen A caller wants a lead's current open activity.
|
|
356
|
+
* @parallelsafe
|
|
357
|
+
*/
|
|
358
|
+
simple.Handle(async (request) => {
|
|
359
|
+
// reads only — no writes, no outbound calls
|
|
360
|
+
})
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
The prose above the tags is the full description, and stays exactly as
|
|
364
|
+
written. Each tag is declared in `tsdoc.json` (`{"tagName": "@parallelsafe",
|
|
365
|
+
"syntaxKind": "modifier"}` alongside `@tool`, `@shortdesc` and `@usewhen`), so
|
|
366
|
+
an editor with TSDoc support recognizes it instead of flagging it as unknown.
|
|
367
|
+
|
|
311
368
|
### AI Module
|
|
312
369
|
|
|
313
370
|
The AI module provides powerful capabilities for working with unstructured data.
|