@ampcode/plugin 0.0.0-20261007001957-g339d9e8 → 0.0.0-20261008001818-g5d841b4

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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/index.d.ts +33 -6
  3. 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 a decision model (currently TypeSafe's Jev)
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
- /** Probability of the most likely level. */
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
- /** Probability of `choice`. */
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 decision model that answered, such as `jev-1.13.0`. Amp picks the model; record it when
852
- * you tune thresholds so a model change is visible.
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
- * Amp chooses the underlying model (currently TypeSafe's Jev) and may change it;
914
- * {@link DecisionResult.model} reports which one answered.
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampcode/plugin",
3
- "version": "0.0.0-20261007001957-g339d9e8",
3
+ "version": "0.0.0-20261008001818-g5d841b4",
4
4
  "description": "Amp Plugin API",
5
5
  "homepage": "https://ampcode.com/docs/plugin-api",
6
6
  "author": {