@ampcode/plugin 0.0.0-20261007001957-g339d9e8 → 0.0.0-20261009001947-g229e998
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 +2 -1
- package/index.d.ts +60 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,8 @@ Plugins can:
|
|
|
15
15
|
reasoning unless `{ reasoningEffort }` is set
|
|
16
16
|
- **Decide fast** — `amp.ai.decide(...)`, `amp.ai.choice(...)`, `amp.ai.noul(...)`, and
|
|
17
17
|
`amp.ai.score(...)` for typed decisions with calibrated probabilities and no generated text,
|
|
18
|
-
answered by
|
|
18
|
+
answered by TypeSafe's Jev, or by OpenAI's Decisions API when you pass
|
|
19
|
+
`{ model: 'openai/gpt-6-luna' }`
|
|
19
20
|
- **Label threads** — `ctx.thread.labels()`, `ctx.thread.addLabels(...)`, and
|
|
20
21
|
`ctx.thread.setLabels(...)` to read and change the current thread's labels
|
|
21
22
|
- **Upload attachments** — `amp.attachments.upload(...)` to upload image bytes and get back a URL
|
package/index.d.ts
CHANGED
|
@@ -806,7 +806,10 @@ declare module '@ampcode/plugin' {
|
|
|
806
806
|
legend: Record<string, string>
|
|
807
807
|
/** Probability of each level index. */
|
|
808
808
|
probabilities: Record<string, number>
|
|
809
|
-
/**
|
|
809
|
+
/**
|
|
810
|
+
* The model's confidence in the score, from 0 to 1. Each model defines it; it is not always
|
|
811
|
+
* the probability of the most likely level.
|
|
812
|
+
*/
|
|
810
813
|
confidence: number
|
|
811
814
|
}
|
|
812
815
|
|
|
@@ -815,7 +818,10 @@ declare module '@ampcode/plugin' {
|
|
|
815
818
|
choice: Option
|
|
816
819
|
/** Probability of each option. */
|
|
817
820
|
probabilities: Record<Option, number>
|
|
818
|
-
/**
|
|
821
|
+
/**
|
|
822
|
+
* The model's confidence in `choice`, from 0 to 1. Each model defines it; it is not always
|
|
823
|
+
* the probability of `choice`.
|
|
824
|
+
*/
|
|
819
825
|
confidence: number
|
|
820
826
|
}
|
|
821
827
|
|
|
@@ -829,10 +835,28 @@ declare module '@ampcode/plugin' {
|
|
|
829
835
|
? ScoreAnswer
|
|
830
836
|
: NoulAnswer
|
|
831
837
|
|
|
838
|
+
/**
|
|
839
|
+
* A decision model, written as `provider/model`. `typesafe/jev` is TypeSafe's Jev.
|
|
840
|
+
* `openai/gpt-6-luna` is OpenAI's Decisions API. A workspace can disable a provider, so a model
|
|
841
|
+
* that exists here can still be unavailable in a thread.
|
|
842
|
+
*
|
|
843
|
+
* The models answer the same questions but are calibrated differently, so a threshold tuned on
|
|
844
|
+
* one does not carry over to the other. With `openai/gpt-6-luna`, JSON in `state`,
|
|
845
|
+
* `instructions`, and `criteria` is sent as its JSON text, the criteria of a `noul` question are
|
|
846
|
+
* appended to its instructions, and the call rejects if OpenAI declines to answer a question.
|
|
847
|
+
*/
|
|
848
|
+
export type DecisionModel = 'typesafe/jev' | 'openai/gpt-6-luna'
|
|
849
|
+
|
|
832
850
|
/** The state every decision is judged against, and the thread that routes the request. */
|
|
833
851
|
export interface DecisionOptions {
|
|
834
852
|
/** Thread to route the request through. Required outside a thread-bound handler. */
|
|
835
853
|
threadID?: ThreadID
|
|
854
|
+
/**
|
|
855
|
+
* The decision model to ask. Defaults to `typesafe/jev`. The call fails if the thread's
|
|
856
|
+
* workspace has disabled that model; Amp never asks another model in its place, so name
|
|
857
|
+
* `openai/gpt-6-luna` for a workspace that allows only OpenAI.
|
|
858
|
+
*/
|
|
859
|
+
model?: DecisionModel
|
|
836
860
|
/** The situation to judge: text, or JSON the model reads as-is. Up to 50,000 characters of text. */
|
|
837
861
|
state: DecisionInput
|
|
838
862
|
}
|
|
@@ -848,8 +872,9 @@ declare module '@ampcode/plugin' {
|
|
|
848
872
|
Q extends Record<string, DecisionQuestion> = Record<string, DecisionQuestion>,
|
|
849
873
|
> {
|
|
850
874
|
/**
|
|
851
|
-
* The
|
|
852
|
-
*
|
|
875
|
+
* The exact model version that answered, as its provider reports it, such as `jev-1.13.0` or
|
|
876
|
+
* `gpt-6-luna`.
|
|
877
|
+
* Record it when you tune thresholds so a model change is visible.
|
|
853
878
|
*/
|
|
854
879
|
model: string
|
|
855
880
|
answers: { [K in keyof Q]: DecisionAnswerFor<Q[K]> }
|
|
@@ -910,8 +935,10 @@ declare module '@ampcode/plugin' {
|
|
|
910
935
|
* is typed as the option names you passed. The typed shape is guaranteed; the answer can
|
|
911
936
|
* still be wrong, and adversarial text inside `state` can move it.
|
|
912
937
|
*
|
|
913
|
-
*
|
|
914
|
-
* {@link DecisionResult.model} reports
|
|
938
|
+
* TypeSafe's Jev answers unless you pass {@link DecisionOptions.model}, and
|
|
939
|
+
* {@link DecisionResult.model} reports the version that answered. The call rejects when the
|
|
940
|
+
* thread's workspace has disabled the model, so handle the error where a decision is
|
|
941
|
+
* optional.
|
|
915
942
|
*
|
|
916
943
|
* Calls are routed through the current thread. Pass `threadID` when calling outside a
|
|
917
944
|
* thread-bound handler.
|
|
@@ -1462,13 +1489,23 @@ declare module '@ampcode/plugin' {
|
|
|
1462
1489
|
* Require a human response rather than an agent response. The thread owner can answer these
|
|
1463
1490
|
* dialogs. While multiplayer is active, human contributors can also answer interactive
|
|
1464
1491
|
* selections, confirmations, and non-secret inputs, including dialogs with `requireHuman: true`.
|
|
1465
|
-
* Secret inputs (`secret: true`)
|
|
1492
|
+
* Secret inputs (`secret: true`) and confirmations with a secret field remain owner-only and
|
|
1493
|
+
* always require a human. Dialogs targeted
|
|
1466
1494
|
* to a specific connection are not shared with contributors.
|
|
1467
1495
|
*
|
|
1468
1496
|
* Use this for approval and permission prompts. It does not grant agents access to dialogs
|
|
1469
1497
|
* or enable them to answer on the owner's behalf.
|
|
1470
1498
|
*/
|
|
1471
1499
|
requireHuman?: boolean
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* Do not show the dialog when nobody who can answer it has the thread open, for example in
|
|
1503
|
+
* a scheduled or Slack-started thread nobody is watching. The dialog then resolves at once
|
|
1504
|
+
* as dismissed (`undefined`) instead of waiting and marking the thread as needing action.
|
|
1505
|
+
* Use this for prompts that are useful only while someone is watching. In the terminal
|
|
1506
|
+
* app the user is always present, so the dialog is always shown.
|
|
1507
|
+
*/
|
|
1508
|
+
skipIfUnwatched?: boolean
|
|
1472
1509
|
}
|
|
1473
1510
|
|
|
1474
1511
|
/**
|
|
@@ -1487,6 +1524,9 @@ declare module '@ampcode/plugin' {
|
|
|
1487
1524
|
/** Text for the submit button (default: "Submit") */
|
|
1488
1525
|
submitButtonText?: string
|
|
1489
1526
|
|
|
1527
|
+
/** Placeholder shown in the empty input field */
|
|
1528
|
+
placeholder?: string
|
|
1529
|
+
|
|
1490
1530
|
/**
|
|
1491
1531
|
* Treat the entered text as a secret such as an API key or password. Clients present the
|
|
1492
1532
|
* text as sensitive (the TUI masks it; the web dialog lets the user hide it), and the value
|
|
@@ -1526,6 +1566,9 @@ declare module '@ampcode/plugin' {
|
|
|
1526
1566
|
* browser, for example an approval page in another app; the dialog stays open so the user
|
|
1527
1567
|
* can still confirm or cancel afterwards. Image and link fields are omitted from the
|
|
1528
1568
|
* returned values. Defaults to `text`.
|
|
1569
|
+
*
|
|
1570
|
+
* When a link field comes before a text field, clients show the fields as numbered steps:
|
|
1571
|
+
* for example "open the sign-in page", then "paste the URL it ends on".
|
|
1529
1572
|
*/
|
|
1530
1573
|
type?: 'text' | 'image' | 'link'
|
|
1531
1574
|
|
|
@@ -1543,6 +1586,16 @@ declare module '@ampcode/plugin' {
|
|
|
1543
1586
|
|
|
1544
1587
|
/** Allow a text field to be left empty. Text fields are required unless this is set. */
|
|
1545
1588
|
optional?: boolean
|
|
1589
|
+
|
|
1590
|
+
/** Placeholder shown in an empty text field */
|
|
1591
|
+
placeholder?: string
|
|
1592
|
+
|
|
1593
|
+
/**
|
|
1594
|
+
* Treat a text field's value as a secret, as `secret` does for `ui.input`: clients let the
|
|
1595
|
+
* user hide it, only the thread owner can answer the dialog, and the answer is returned only
|
|
1596
|
+
* to the requester. A secret field is single-line.
|
|
1597
|
+
*/
|
|
1598
|
+
secret?: boolean
|
|
1546
1599
|
}
|
|
1547
1600
|
|
|
1548
1601
|
/** Options for a confirmation dialog that returns edited field values. */
|