openpond-sdk 0.12.25 → 0.12.26
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/LEARNING.md +5 -7
- package/OPENTELEMETRY.md +1 -1
- package/PRODUCT_INTEGRATION.md +5 -10
- package/README.md +3 -4
- package/SERVERLESS_SERVING.md +37 -0
- package/TASKSETS.md +1 -2
- package/TASK_INGESTION.md +3 -4
- package/TRAINING_PROTOCOL.md +1 -1
- package/TRAINING_WORKFLOWS.md +11 -6
- package/dist/advanced-refiner-evaluations.js +9 -8
- package/dist/ai-sdk.js +2 -1
- package/dist/ai-sdk.js.map +1 -1
- package/dist/candidate-evaluations.js +7 -6
- package/dist/{chunk-ZQFROKKS.js → chunk-2U6BQ5C4.js} +3 -3
- package/dist/{chunk-DDCR4KB5.js → chunk-3BILL33A.js} +4 -4
- package/dist/{chunk-3B5KSH3V.js → chunk-456F3BXD.js} +5 -2
- package/dist/chunk-456F3BXD.js.map +1 -0
- package/dist/{chunk-RTLJV4OS.js → chunk-4A4FNG4R.js} +2 -2
- package/dist/{chunk-EZME7DV4.js → chunk-4CDLPMJK.js} +2 -2
- package/dist/{chunk-XBFOFTK3.js → chunk-4CRLQMJ2.js} +5 -5
- package/dist/{chunk-QOX57Y27.js → chunk-4PEK3YOW.js} +6 -3
- package/dist/chunk-4PEK3YOW.js.map +1 -0
- package/dist/{chunk-GS5HEE4M.js → chunk-4REK5TTE.js} +2 -2
- package/dist/{chunk-YS7DF76T.js → chunk-57ROW3XF.js} +3 -3
- package/dist/{chunk-47THZRUM.js → chunk-6LVLWRBJ.js} +8 -5
- package/dist/chunk-6LVLWRBJ.js.map +1 -0
- package/dist/{chunk-3VUF5H3B.js → chunk-AMZ2SWHR.js} +2 -2
- package/dist/{chunk-GV6DEDBU.js → chunk-AQV7RQZH.js} +2 -2
- package/dist/{chunk-BJMENXR4.js → chunk-C7I4ZG6Q.js} +3 -3
- package/dist/{chunk-JMFYNIYZ.js → chunk-CAOMKM55.js} +6 -3
- package/dist/chunk-CAOMKM55.js.map +1 -0
- package/dist/{chunk-QNOCM5JX.js → chunk-D26RJQU7.js} +2 -2
- package/dist/{chunk-T67LNKAK.js → chunk-EL6KZO43.js} +3 -3
- package/dist/{chunk-MVAEE5EI.js → chunk-H5KHLBC5.js} +5 -2
- package/dist/chunk-H5KHLBC5.js.map +1 -0
- package/dist/{chunk-3MWFN7BA.js → chunk-HCUZYGUK.js} +8 -5
- package/dist/chunk-HCUZYGUK.js.map +1 -0
- package/dist/{chunk-JOMZJXGC.js → chunk-JINWKUKR.js} +3 -3
- package/dist/{chunk-626JLH4D.js → chunk-JWEIAEQ6.js} +2 -2
- package/dist/{chunk-DH6O4JFB.js → chunk-KJTX4A27.js} +5 -2
- package/dist/chunk-KJTX4A27.js.map +1 -0
- package/dist/{chunk-QRYEXPG7.js → chunk-MN4FE52A.js} +13 -10
- package/dist/chunk-MN4FE52A.js.map +1 -0
- package/dist/{chunk-2OVNKPBZ.js → chunk-MUG4OQKL.js} +5 -2
- package/dist/chunk-MUG4OQKL.js.map +1 -0
- package/dist/{chunk-C3TS766N.js → chunk-N6LGT7NT.js} +5 -2
- package/dist/chunk-N6LGT7NT.js.map +1 -0
- package/dist/{chunk-3G3HUA32.js → chunk-P56JWQYV.js} +3 -3
- package/dist/{chunk-GX6KMHW2.js → chunk-QKLZZOZD.js} +5 -2
- package/dist/chunk-QKLZZOZD.js.map +1 -0
- package/dist/chunk-QYWPNNP3.js +9 -0
- package/dist/chunk-QYWPNNP3.js.map +1 -0
- package/dist/{chunk-IXFUYPGV.js → chunk-UZAVG2WK.js} +5 -5
- package/dist/chunk-UZAVG2WK.js.map +1 -0
- package/dist/{chunk-Z252BNAZ.js → chunk-VE5JD5FN.js} +6 -2
- package/dist/chunk-VE5JD5FN.js.map +1 -0
- package/dist/{chunk-7F43U2NC.js → chunk-WZKKQNYY.js} +3 -3
- package/dist/{chunk-RN5MK7NH.js → chunk-X5AT253K.js} +3 -3
- package/dist/{chunk-ZRTNR4U7.js → chunk-XWUTYFOU.js} +3 -3
- package/dist/{chunk-Z5APNTZE.js → chunk-XYK3MAIC.js} +2 -2
- package/dist/{chunk-BRP3EBCR.js → chunk-ZG4HVCJB.js} +7 -4
- package/dist/chunk-ZG4HVCJB.js.map +1 -0
- package/dist/connected-evidence.js +9 -8
- package/dist/dataset-commerce.js +4 -1
- package/dist/dataset-commerce.js.map +1 -1
- package/dist/dataset-marketplace.js +4 -1
- package/dist/dataset-marketplace.js.map +1 -1
- package/dist/dataset-workspaces.js +18 -15
- package/dist/dataset-workspaces.js.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/experiment-evaluation-schedules.js +18 -17
- package/dist/experiment-improvements.js +8 -7
- package/dist/experiments.js +16 -15
- package/dist/human-review.js +2 -1
- package/dist/index.js +32 -28
- package/dist/index.js.map +1 -1
- package/dist/learning.js +6 -3
- package/dist/learning.js.map +1 -1
- package/dist/model-projects.js +2 -1
- package/dist/model-starter-attempts.js +3 -2
- package/dist/model-starter-catalog.js +7 -4
- package/dist/model-starter-catalog.js.map +1 -1
- package/dist/model-starters.js +4 -3
- package/dist/model-taskset-runs.js +7 -4
- package/dist/model-taskset-runs.js.map +1 -1
- package/dist/post-training.js +7 -6
- package/dist/taskset-catalog.js +2 -1
- package/dist/taskset-drafts.js +11 -8
- package/dist/taskset-drafts.js.map +1 -1
- package/dist/taskset-packages.js +10 -9
- package/dist/tool-learning.js +4 -1
- package/dist/tool-learning.js.map +1 -1
- package/dist/training-bundle.js +11 -10
- package/dist/training-bundle.js.map +1 -1
- package/dist/training-hardware.js +3 -2
- package/dist/training-projects.js +4 -1
- package/dist/training-projects.js.map +1 -1
- package/dist/training.js +2677 -2574
- package/dist/training.js.map +1 -1
- package/dist/types/packages/sdk/src/connected-evidence-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/connected-evidence-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/connected-sync.d.ts +1 -1
- package/dist/types/packages/sdk/src/connected-sync.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-commerce.d.ts +1 -1
- package/dist/types/packages/sdk/src/dataset-commerce.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-marketplace.d.ts +1 -1
- package/dist/types/packages/sdk/src/dataset-marketplace.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-population.d.ts +1 -1
- package/dist/types/packages/sdk/src/dataset-population.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-preparation-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/dataset-preparation-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-task-ingestion.d.ts +1 -1
- package/dist/types/packages/sdk/src/dataset-task-ingestion.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/dataset-workspace-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/dataset-workspace-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/endpoints.d.ts +4 -0
- package/dist/types/packages/sdk/src/endpoints.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/evaluation-coordination-http.d.ts +1 -1
- package/dist/types/packages/sdk/src/evaluation-coordination-http.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiment-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/experiment-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiment-improvement-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/experiment-improvement-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/experiment-inspection.d.ts +1 -1
- package/dist/types/packages/sdk/src/experiment-inspection.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/grader-inspection.d.ts +1 -1
- package/dist/types/packages/sdk/src/grader-inspection.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/human-review-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/human-review-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/learning-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/learning-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/learning-correction-metrics.d.ts +1 -1
- package/dist/types/packages/sdk/src/learning-correction-metrics.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-projects.d.ts +1 -1
- package/dist/types/packages/sdk/src/model-projects.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-starter-attempts.d.ts +1 -1
- package/dist/types/packages/sdk/src/model-starter-attempts.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-starter-catalog.d.ts +1 -1
- package/dist/types/packages/sdk/src/model-starter-catalog.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/model-taskset-runs.d.ts +1 -1
- package/dist/types/packages/sdk/src/model-taskset-runs.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/product-models.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/profile-evaluation-discovery.d.ts +1 -1
- package/dist/types/packages/sdk/src/profile-evaluation-discovery.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/serverless-serving.d.ts +157 -0
- package/dist/types/packages/sdk/src/serverless-serving.d.ts.map +1 -0
- package/dist/types/packages/sdk/src/steering-model-serving.d.ts +276 -0
- package/dist/types/packages/sdk/src/steering-model-serving.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-catalog.d.ts +1 -1
- package/dist/types/packages/sdk/src/taskset-catalog.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-draft-client.d.ts +121 -121
- package/dist/types/packages/sdk/src/taskset-draft-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/taskset-package-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/taskset-package-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/tool-learning-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/tool-learning-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-learning-batch.d.ts +40 -40
- package/dist/types/packages/sdk/src/training-model-serving-control.d.ts +232 -0
- package/dist/types/packages/sdk/src/training-model-serving-control.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-model-serving.d.ts +552 -0
- package/dist/types/packages/sdk/src/training-model-serving.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-project-client.d.ts +1 -1
- package/dist/types/packages/sdk/src/training-project-client.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training-qualification-preparation.d.ts +25 -25
- package/dist/types/packages/sdk/src/training-transport.d.ts +1 -1
- package/dist/types/packages/sdk/src/training-transport.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/training.d.ts +1336 -1021
- package/dist/types/packages/sdk/src/training.d.ts.map +1 -1
- package/dist/types/packages/sdk/src/types.d.ts +2 -2
- package/dist/types/packages/sdk/src/types.d.ts.map +1 -1
- package/examples/learning/submit.py +1 -1
- package/examples/learning/submit.ts +2 -2
- package/examples/training/continual.ts +4 -4
- package/examples/training/manual.ts +1 -3
- package/fixtures/python-foundation/schemas.json +4830 -4483
- package/package.json +2 -1
- package/dist/chunk-2OVNKPBZ.js.map +0 -1
- package/dist/chunk-3B5KSH3V.js.map +0 -1
- package/dist/chunk-3MWFN7BA.js.map +0 -1
- package/dist/chunk-47THZRUM.js.map +0 -1
- package/dist/chunk-BRP3EBCR.js.map +0 -1
- package/dist/chunk-C3TS766N.js.map +0 -1
- package/dist/chunk-DH6O4JFB.js.map +0 -1
- package/dist/chunk-GX6KMHW2.js.map +0 -1
- package/dist/chunk-IXFUYPGV.js.map +0 -1
- package/dist/chunk-JMFYNIYZ.js.map +0 -1
- package/dist/chunk-MVAEE5EI.js.map +0 -1
- package/dist/chunk-QOX57Y27.js.map +0 -1
- package/dist/chunk-QRYEXPG7.js.map +0 -1
- package/dist/chunk-Z252BNAZ.js.map +0 -1
- /package/dist/{chunk-ZQFROKKS.js.map → chunk-2U6BQ5C4.js.map} +0 -0
- /package/dist/{chunk-DDCR4KB5.js.map → chunk-3BILL33A.js.map} +0 -0
- /package/dist/{chunk-RTLJV4OS.js.map → chunk-4A4FNG4R.js.map} +0 -0
- /package/dist/{chunk-EZME7DV4.js.map → chunk-4CDLPMJK.js.map} +0 -0
- /package/dist/{chunk-XBFOFTK3.js.map → chunk-4CRLQMJ2.js.map} +0 -0
- /package/dist/{chunk-GS5HEE4M.js.map → chunk-4REK5TTE.js.map} +0 -0
- /package/dist/{chunk-YS7DF76T.js.map → chunk-57ROW3XF.js.map} +0 -0
- /package/dist/{chunk-3VUF5H3B.js.map → chunk-AMZ2SWHR.js.map} +0 -0
- /package/dist/{chunk-GV6DEDBU.js.map → chunk-AQV7RQZH.js.map} +0 -0
- /package/dist/{chunk-BJMENXR4.js.map → chunk-C7I4ZG6Q.js.map} +0 -0
- /package/dist/{chunk-QNOCM5JX.js.map → chunk-D26RJQU7.js.map} +0 -0
- /package/dist/{chunk-T67LNKAK.js.map → chunk-EL6KZO43.js.map} +0 -0
- /package/dist/{chunk-JOMZJXGC.js.map → chunk-JINWKUKR.js.map} +0 -0
- /package/dist/{chunk-626JLH4D.js.map → chunk-JWEIAEQ6.js.map} +0 -0
- /package/dist/{chunk-3G3HUA32.js.map → chunk-P56JWQYV.js.map} +0 -0
- /package/dist/{chunk-7F43U2NC.js.map → chunk-WZKKQNYY.js.map} +0 -0
- /package/dist/{chunk-RN5MK7NH.js.map → chunk-X5AT253K.js.map} +0 -0
- /package/dist/{chunk-ZRTNR4U7.js.map → chunk-XWUTYFOU.js.map} +0 -0
- /package/dist/{chunk-Z5APNTZE.js.map → chunk-XYK3MAIC.js.map} +0 -0
package/LEARNING.md
CHANGED
|
@@ -11,7 +11,7 @@ formats first. The sample uses an input object with `question` and an output
|
|
|
11
11
|
object with `answer`; adapt the record to your published format. The scripts read
|
|
12
12
|
the source's exact task-definition reference from the server.
|
|
13
13
|
|
|
14
|
-
Set `OPENPOND_API_KEY
|
|
14
|
+
Set `OPENPOND_API_KEY` and `OPENPOND_LEARNING_SCOPE` in your
|
|
15
15
|
shell, then run one of:
|
|
16
16
|
|
|
17
17
|
```sh
|
|
@@ -19,12 +19,10 @@ node --experimental-strip-types submit.ts SOURCE_ID example.json
|
|
|
19
19
|
python3 submit.py SOURCE_ID example.json
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
the local server uses the profile scope in the request body. These variables are example configuration, not arguments
|
|
27
|
-
that should be committed with credentials.
|
|
22
|
+
The SDK connects to OpenPond automatically. The server authorizes the requested
|
|
23
|
+
workspace scope. The SDK and Python example send that scope in
|
|
24
|
+
`X-OpenPond-Team-Id`. Keep credentials in your application's secret configuration.
|
|
25
|
+
Do not commit their values.
|
|
28
26
|
|
|
29
27
|
Assign stable example/attempt identities and preserve `idempotencyKey`, timestamp
|
|
30
28
|
and content on retries. A different record must use a different key. Submission
|
package/OPENTELEMETRY.md
CHANGED
|
@@ -19,7 +19,7 @@ import { OpenPondClient } from "openpond-sdk";
|
|
|
19
19
|
import { OpenPondSpanExporter } from "openpond-sdk/opentelemetry";
|
|
20
20
|
import { BatchSpanProcessor, TracerProvider } from "@opentelemetry/sdk-trace";
|
|
21
21
|
|
|
22
|
-
const client = new OpenPondClient({
|
|
22
|
+
const client = new OpenPondClient({ apiKey, teamId });
|
|
23
23
|
const exporter = new OpenPondSpanExporter({
|
|
24
24
|
client,
|
|
25
25
|
datasetId,
|
package/PRODUCT_INTEGRATION.md
CHANGED
|
@@ -15,10 +15,6 @@ export const openpond = createOpenPondClient({
|
|
|
15
15
|
apiKey: process.env.OPENPOND_API_KEY!,
|
|
16
16
|
teamId: process.env.OPENPOND_TEAM_ID!,
|
|
17
17
|
datasetId: process.env.OPENPOND_DATASET_ID!,
|
|
18
|
-
serving: {
|
|
19
|
-
baseUrl: process.env.OPENPOND_SERVING_BASE_URL!,
|
|
20
|
-
apiKey: process.env.OPENPOND_SERVING_API_KEY!,
|
|
21
|
-
},
|
|
22
18
|
models: { support: process.env.OPENPOND_MODEL_ID! },
|
|
23
19
|
});
|
|
24
20
|
|
|
@@ -26,10 +22,10 @@ const answer = await openpond.models.support.generate({ prompt: "How do I rotate
|
|
|
26
22
|
console.log(answer.text, answer.requestId, answer.usage);
|
|
27
23
|
```
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
The SDK connects to OpenPond with your API key for task submission and personalized
|
|
26
|
+
inference. Use a key authorized for the selected Dataset and Model. A Dataset-only
|
|
27
|
+
producer key cannot invoke inference. Bind the exact callable Model ID; no
|
|
28
|
+
catalogue default or substitute Model is selected. Naming a Model never activates serving, approves a
|
|
33
29
|
candidate, starts training, or automatically captures inference as a task.
|
|
34
30
|
Decision scorers use their separate typed scoring APIs.
|
|
35
31
|
|
|
@@ -66,9 +62,8 @@ the delivery error or pretending the answer failed. See [task ingestion](TASK_IN
|
|
|
66
62
|
from ponder_sdk import AsyncClient
|
|
67
63
|
|
|
68
64
|
async with AsyncClient(
|
|
69
|
-
|
|
65
|
+
api_key=api_key, team_id=team_id,
|
|
70
66
|
dataset_id=dataset_id,
|
|
71
|
-
serving_base_url=serving_base_url, serving_api_key=serving_api_key,
|
|
72
67
|
model_aliases={"support": model_id},
|
|
73
68
|
) as openpond:
|
|
74
69
|
answer = await openpond.models.support.generate(prompt="How do I rotate a token?")
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Node.js 22.14 or newer is required. This package is server-only: never expose an
|
|
|
20
20
|
|
|
21
21
|
`OpenPondExperimentsClient` from `openpond-sdk/experiments` admits one run and its
|
|
22
22
|
immutable configuration with `run(configuration)`. It is also available as
|
|
23
|
-
`createOpenPondClient({ apiKey
|
|
23
|
+
`createOpenPondClient({ apiKey }).experiments(teamId)`. The request includes
|
|
24
24
|
one stable operation ID (also on its nested request), dataset/population,
|
|
25
25
|
target/settings, selected graders and spending cap. Reuse the same operation ID
|
|
26
26
|
after a transport failure; it returns the same Experiment without duplicate work.
|
|
@@ -67,7 +67,6 @@ export const maxDuration = 800;
|
|
|
67
67
|
|
|
68
68
|
const openpond = createOpenPondClient({
|
|
69
69
|
apiKey: process.env.OPENPOND_API_KEY!,
|
|
70
|
-
baseUrl: process.env.OPENPOND_API_URL,
|
|
71
70
|
});
|
|
72
71
|
|
|
73
72
|
export async function POST(request: Request) {
|
|
@@ -392,7 +391,7 @@ not implicitly share a spending cap.
|
|
|
392
391
|
|
|
393
392
|
## Add production tasks
|
|
394
393
|
|
|
395
|
-
|
|
394
|
+
Configure `datasetId` once and await `client.addTask({ id: sourceEventId, name, input })`. Use `client.dataset(otherDatasetId).addTask(task)` for another destination. See [task ingestion](TASK_INGESTION.md) for TypeScript/Python examples, receipt semantics and duplicate-safe retries. Task uploads do not enable training.
|
|
396
395
|
|
|
397
396
|
Dataset workspace HTTP failures throw `DatasetWorkspaceRequestError` from
|
|
398
397
|
`openpond-sdk/dataset-workspaces`, with `status`, an allowlisted `code`,
|
|
@@ -403,4 +402,4 @@ bytes, recover its receipt with `operationResult`, or retry the identical reques
|
|
|
403
402
|
|
|
404
403
|
## Add OpenPond to a product
|
|
405
404
|
|
|
406
|
-
Configure named personalized Model handles with `models` and
|
|
405
|
+
Configure named personalized Model handles with `models` and your API key, then call `client.models.support.generate({ prompt })` or iterate `stream({ prompt })`. See [product integration](PRODUCT_INTEGRATION.md) for TypeScript, Python, React/backend and optional Vercel AI SDK 7 examples. Inference never activates serving or automatically captures tasks.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Usage-based saved Model serving
|
|
2
|
+
|
|
3
|
+
A saved trained Model can be activated when the service returns a compatible
|
|
4
|
+
Serverless price review. Model availability and GPU residency are separate:
|
|
5
|
+
the Model stays callable while unused workers scale down. Cold requests can wait
|
|
6
|
+
for model loading; no fixed cold-start latency is promised.
|
|
7
|
+
|
|
8
|
+
Read `training.modelServing(modelProjectId, { teamId, versionHash })` for the
|
|
9
|
+
exact saved version. When `serverlessReview` is available, use
|
|
10
|
+
`createServerlessServingApproval(serverlessReview, spendingLimit)` from
|
|
11
|
+
`openpond-sdk/training` and include the result as `serverlessApproval` in the
|
|
12
|
+
normal `training.controlModelServing` activation request. Retain the original
|
|
13
|
+
operation ID and exact request for recovery. The request's idle setting must
|
|
14
|
+
match the review's `workerIdleTimeoutSeconds`.
|
|
15
|
+
|
|
16
|
+
Activation creates callable configuration. Each inference reserves a finite
|
|
17
|
+
amount of workspace credit before dispatch and settles observed allocated
|
|
18
|
+
execution time. Compatible requests can share a worker; their quantities divide
|
|
19
|
+
the same interval rather than each receiving a full GPU clock. Startup, queue
|
|
20
|
+
and idle time have no separate customer charge. Token usage is still reported,
|
|
21
|
+
with no additional token charge for the same Serverless request.
|
|
22
|
+
|
|
23
|
+
The optional spending limit bounds the accepted activation's cumulative usage.
|
|
24
|
+
An omitted limit uses available workspace credit. Pending requests retain their
|
|
25
|
+
credit holds until execution release is confirmed. Stop closes new admission
|
|
26
|
+
and requests cancellation while preserving outstanding settlement and cleanup.
|
|
27
|
+
Delayed supplier records do not increase an accepted customer price.
|
|
28
|
+
|
|
29
|
+
Current usage is returned in `control.serverless`: `chargedUsd`, `reservedUsd`,
|
|
30
|
+
`quantityMicros` and the retained review. Supplier-cost status is separate from
|
|
31
|
+
the customer debit. An unavailable review does not qualify another model or
|
|
32
|
+
modification method automatically.
|
|
33
|
+
|
|
34
|
+
Python consumers use the same generated request/response contracts and can
|
|
35
|
+
import `create_serverless_serving_approval` from `ponder_sdk.serverless_serving`.
|
|
36
|
+
The official CLI's `hosted-model-serving` and `hosted-control-model-serving`
|
|
37
|
+
operations use these same Model contracts.
|
package/TASKSETS.md
CHANGED
|
@@ -8,7 +8,6 @@ optional Model Project attachment filtering before returning records.
|
|
|
8
8
|
import { OpenPondTasksetCatalogClient } from "openpond-sdk/taskset-catalog";
|
|
9
9
|
|
|
10
10
|
const tasksets = new OpenPondTasksetCatalogClient({
|
|
11
|
-
baseUrl: "https://api.openpond.ai",
|
|
12
11
|
apiKey,
|
|
13
12
|
teamId,
|
|
14
13
|
});
|
|
@@ -262,7 +261,7 @@ Imported source still requires explicit source review before publication.
|
|
|
262
261
|
|
|
263
262
|
`OpenPondTasksetDraftClient` from `openpond-sdk/taskset-drafts` defines the
|
|
264
263
|
scoped `/v1/models/:modelId/taskset-drafts` protocol. Construct it in server code
|
|
265
|
-
with `
|
|
264
|
+
with `apiKey` and `teamId`. It supports source inspection,
|
|
266
265
|
initialization, listing, document/file reads and edits, explicit Model refresh,
|
|
267
266
|
validation, publication and deletion. Hosting these endpoints requires a server
|
|
268
267
|
implementation; exporting this client alone does not make them available.
|
package/TASK_INGESTION.md
CHANGED
|
@@ -26,9 +26,8 @@ const receipt = await openpond.addTask({
|
|
|
26
26
|
console.log(receipt.taskId, receipt.receivedAt);
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
explicit alternate Dataset:
|
|
29
|
+
The client connects to OpenPond automatically and keeps its own credentials;
|
|
30
|
+
no mutable global account is used. For an explicit alternate Dataset:
|
|
32
31
|
|
|
33
32
|
```ts
|
|
34
33
|
await openpond.dataset(otherDatasetId).addTask({
|
|
@@ -94,7 +93,7 @@ owned connection pool:
|
|
|
94
93
|
```python
|
|
95
94
|
from ponder_sdk import Client
|
|
96
95
|
|
|
97
|
-
with Client(
|
|
96
|
+
with Client(api_key=api_key, team_id=team_id,
|
|
98
97
|
dataset_id=dataset_id) as openpond:
|
|
99
98
|
receipt = openpond.add_task({
|
|
100
99
|
"id": source_event_id,
|
package/TRAINING_PROTOCOL.md
CHANGED
|
@@ -205,7 +205,7 @@ and an in-memory asset map without creating a training job or acquiring compute.
|
|
|
205
205
|
|
|
206
206
|
The compiler verifies selected release identities and private verifier bytes,
|
|
207
207
|
checks training/evaluation isolation, and rejects missing or unexpected Work
|
|
208
|
-
assets. Callers retain responsibility for authorizing the inputs and
|
|
208
|
+
assets. Callers retain responsibility for authorizing the inputs and preparing the
|
|
209
209
|
result through the training artifact API before job admission. Filesystem cache
|
|
210
210
|
materialization remains a Desktop concern.
|
|
211
211
|
|
package/TRAINING_WORKFLOWS.md
CHANGED
|
@@ -9,8 +9,8 @@ the actual host/account before preparing work.
|
|
|
9
9
|
|
|
10
10
|
## Authentication and lifecycle
|
|
11
11
|
|
|
12
|
-
Training and Model clients
|
|
13
|
-
supplier) and an injectable `fetch`. Use
|
|
12
|
+
Training and Model clients connect to OpenPond automatically. They accept
|
|
13
|
+
`headers` (including an async token supplier) and an injectable `fetch`. Use your API key as the Bearer credential and
|
|
14
14
|
`X-OpenPond-Team-Id`; retain server authorization and owner checks. Learning,
|
|
15
15
|
Dataset and taskset-run clients accept their existing `apiKey` and workspace
|
|
16
16
|
scope. Never put credentials in URLs, request identities, fixtures or receipts.
|
|
@@ -204,8 +204,7 @@ the job controls and keep its identity.
|
|
|
204
204
|
explicit `recordCandidateDecision` with its exact artifact reference and CAS.
|
|
205
205
|
`cancel` reconciles the current job version before sending remote cancellation.
|
|
206
206
|
|
|
207
|
-
The examples require `
|
|
208
|
-
`OPENPOND_TEAM_ID` from the caller's normal configured account. They use only
|
|
207
|
+
The examples require `OPENPOND_API_KEY` and `OPENPOND_TEAM_ID` from the caller's normal configured account. They use only
|
|
209
208
|
public SDK imports, bound each invocation to two minutes and write new receipt
|
|
210
209
|
files exclusively with mode0600. They do not poll indefinitely or automatically
|
|
211
210
|
retry an uncertain paid start. Keep the original receipt for future reconciliation.
|
|
@@ -495,9 +494,9 @@ of `neuron_steering` and `inspect_activations`. `draftSchema` describes the form
|
|
|
495
494
|
not permission to write or execute.
|
|
496
495
|
|
|
497
496
|
Each capability observation retains `validationLevel`: `null` when execution is
|
|
498
|
-
unavailable, `source_validated` for an experimental
|
|
497
|
+
unavailable, `source_validated` for an experimental runtime, or
|
|
499
498
|
`gpu_qualified` after a retained exact-model/runtime GPU run. Source validation
|
|
500
|
-
describes a runtime reviewed for an experimental
|
|
499
|
+
describes a runtime reviewed for an experimental trial; it is not
|
|
501
500
|
evidence that training or inference has already succeeded. Read the runtime's retained evidence; neither level
|
|
502
501
|
reserves compute, approves a charge or establishes model quality. Engram,
|
|
503
502
|
Decision, AlphaEdit and neuron-training capabilities use the same distinction.
|
|
@@ -669,3 +668,9 @@ optimizer creation and exports a cumulative patch with parent, initial and
|
|
|
669
668
|
final state hashes. A runtime must explicitly advertise this mode before
|
|
670
669
|
admission; source packaging alone does not establish native qualification or
|
|
671
670
|
old/new held-out retention.
|
|
671
|
+
|
|
672
|
+
### Managed GRPO sampling support
|
|
673
|
+
|
|
674
|
+
Use `topP: 1` for managed GRPO. The current qualified trainer replays temperature and the retained required-tool grammar; it cannot replay an independent nucleus filter or separate JSON response grammar. Unsupported generation settings are rejected during preparation, before allocation. Structured Work output uses its supported required-tool path. Existing saved requests retain their explicit settings and are never silently rewritten.
|
|
675
|
+
|
|
676
|
+
The current managed runtime admits at least two optimizer iterations. A single iteration is not inherently invalid GRPO, but needs explicit support from the selected runtime before it can be prepared. Each iteration accumulates the entire trajectory group before stepping; `gradientAccumulationSteps` does not define separate optimizer windows for GRPO. SFT uses its own true batch accumulation and exact model/image limits. Held-out SFT evaluation does not select optimizer updates.
|
|
@@ -12,19 +12,20 @@ import {
|
|
|
12
12
|
sealAdvancedRefinerEvaluationPin,
|
|
13
13
|
sealAdvancedRefinerReviewReceipt,
|
|
14
14
|
verifyAdvancedRefinerEvaluationPin
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-X5AT253K.js";
|
|
16
|
+
import "./chunk-D26RJQU7.js";
|
|
17
|
+
import "./chunk-456F3BXD.js";
|
|
18
|
+
import "./chunk-JWEIAEQ6.js";
|
|
19
19
|
import "./chunk-O6FKHAWN.js";
|
|
20
20
|
import "./chunk-H3367ISL.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-4REK5TTE.js";
|
|
22
|
+
import "./chunk-XWUTYFOU.js";
|
|
23
|
+
import "./chunk-CAOMKM55.js";
|
|
24
|
+
import "./chunk-H5KHLBC5.js";
|
|
25
25
|
import "./chunk-CL3IOOVL.js";
|
|
26
26
|
import "./chunk-B3ZHJ2KK.js";
|
|
27
27
|
import "./chunk-H3JZ3P5T.js";
|
|
28
|
+
import "./chunk-QYWPNNP3.js";
|
|
28
29
|
import "./chunk-YLJ4XMA6.js";
|
|
29
30
|
export {
|
|
30
31
|
AdvancedRefinerEvaluationAccountingSchema,
|
package/dist/ai-sdk.js
CHANGED
package/dist/ai-sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ai-sdk.ts","../src/product-model-response.ts"],"sourcesContent":["/** Optional integration: AI SDK 7 / @ai-sdk/openai-compatible 3 (LanguageModelV4). */\nimport {\n createOpenAICompatible,\n type OpenAICompatibleChatLanguageModel,\n} from \"@ai-sdk/openai-compatible\";\nimport { z } from \"zod\";\nimport { boundProductModelResponse } from \"./product-model-response.js\";\nimport { ProductModel, ProductModelError, productModelEndpoint } from \"./product-models.js\";\n\nconst Evidence = z.object({ openpond: z.record(z.string(), z.json()) }).passthrough();\nfunction metadata(raw: unknown) {\n const value = Evidence.safeParse(raw);\n return value.success ? { openpond: value.data.openpond } : undefined;\n}\n\n/** Use generateText/streamText with maxRetries: 0; paid inference is never safely replayable implicitly. */\nexport function toAIModel(\n model: ProductModel,\n): Pick<\n OpenAICompatibleChatLanguageModel,\n \"specificationVersion\" | \"provider\" | \"modelId\" | \"supportedUrls\" | \"doGenerate\" | \"doStream\"\n> {\n const connection = model.providerConnection();\n const provider = createOpenAICompatible({\n name: \"openpond\",\n baseURL: productModelEndpoint(connection.baseUrl!),\n apiKey: connection.apiKey,\n // The personalized gateway always supplies terminal usage and rejects\n // OpenAI's optional stream_options field.\n includeUsage: false,\n headers: connection.teamId ? { \"X-OpenPond-Team-Id\": connection.teamId } : undefined,\n transformRequestBody: (raw) => {\n const body = JSON.parse(JSON.stringify(raw)) as Record<string, unknown>;\n if (body.model !== model.id)\n throw new ProductModelError(\"model_override_forbidden\", 0, false);\n const allowed = new Set([\n \"model\",\n \"messages\",\n \"stream\",\n \"max_tokens\",\n \"temperature\",\n \"top_p\",\n \"seed\",\n \"stop\",\n \"tools\",\n \"tool_choice\",\n ]);\n if (Object.keys(body).some((key) => !allowed.has(key)))\n throw new ProductModelError(\"parameter_unsupported\", 0, false);\n return body;\n },\n metadataExtractor: {\n async extractMetadata({ parsedBody }) {\n return metadata(parsedBody);\n },\n createStreamExtractor() {\n let evidence: ReturnType<typeof metadata>;\n return {\n processChunk(chunk) {\n evidence = metadata(chunk) ?? evidence;\n },\n buildMetadata() {\n return evidence;\n },\n };\n },\n },\n supportsStructuredOutputs: model.capabilities.structuredOutput,\n fetch: async (url, init) => {\n const timeout = AbortSignal.timeout(connection.timeoutMs ?? 60_000);\n const headers = new Headers(init?.headers);\n headers.set(\"Authorization\", `Bearer ${connection.apiKey}`);\n if (connection.teamId) headers.set(\"X-OpenPond-Team-Id\", connection.teamId);\n return boundProductModelResponse(\n await (connection.fetch ?? fetch)(url, {\n ...init,\n redirect: \"error\",\n headers,\n signal: init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout,\n }),\n );\n },\n }).chatModel(model.id);\n const check = (options: Parameters<typeof provider.doGenerate>[0]) => {\n const rawOptions = options.providerOptions?.openpond;\n if (rawOptions && [\"stream\", \"stream_options\"].some((key) => key in rawOptions))\n throw new ProductModelError(\"transport_override_forbidden\", 0, false);\n if (options.tools?.length && !model.capabilities.tools)\n throw new ProductModelError(\"tools_unsupported\", 0, false);\n if (options.responseFormat?.type === \"json\")\n throw new ProductModelError(\"structured_output_unsupported\", 0, false);\n if (\n options.prompt.some(\n (message) =>\n (message.role === \"tool\" && !model.capabilities.tools) ||\n (message.role !== \"system\" &&\n message.content.some(\n (part) =>\n part.type !== \"text\" &&\n !(model.capabilities.tools && [\"tool-call\", \"tool-result\"].includes(part.type)),\n )),\n )\n )\n throw new ProductModelError(\"input_capability_unsupported\", 0, false);\n };\n // Convert retryable transport errors to a terminal SDK error: AI SDK's default\n // automatic retries must not accidentally duplicate a billed generation.\n const normalizeError = (error: unknown): ProductModelError => {\n if (error instanceof ProductModelError) return error;\n if (\n error &&\n typeof error === \"object\" &&\n \"cause\" in error &&\n error.cause instanceof ProductModelError\n )\n return error.cause;\n const status =\n error &&\n typeof error === \"object\" &&\n \"statusCode\" in error &&\n typeof error.statusCode === \"number\"\n ? error.statusCode\n : 0;\n const unknown =\n status === 0 || status === 408 || status >= 500 || (status >= 200 && status < 300);\n return new ProductModelError(\n status >= 400 ? \"model_request_rejected\" : \"model_outcome_unknown\",\n status,\n unknown,\n );\n };\n return {\n specificationVersion: provider.specificationVersion,\n provider: provider.provider,\n modelId: provider.modelId,\n supportedUrls: provider.supportedUrls,\n async doGenerate(options: Parameters<typeof provider.doGenerate>[0]) {\n check(options);\n try {\n return await provider.doGenerate(options);\n } catch (error) {\n throw normalizeError(error);\n }\n },\n async doStream(options: Parameters<typeof provider.doStream>[0]) {\n check(options);\n if (!model.capabilities.streaming)\n throw new ProductModelError(\"streaming_unsupported\", 0, false);\n try {\n const result = await provider.doStream(options);\n const reader = result.stream.getReader();\n return {\n ...result,\n stream: new ReadableStream({\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n controller.close();\n reader.releaseLock();\n } else\n controller.enqueue(\n value.type === \"error\"\n ? { ...value, error: normalizeError(value.error) }\n : value,\n );\n } catch (error) {\n controller.error(normalizeError(error));\n }\n },\n async cancel(reason) {\n await reader.cancel(reason);\n },\n }),\n };\n } catch (error) {\n throw normalizeError(error);\n }\n },\n };\n}\n","import { ProductModelError } from \"./product-models.js\";\n\n/** Bound the optional provider's otherwise unbounded parser and require the\n * personalized gateway's terminal marker before treating EOF as completion. */\nexport function boundProductModelResponse(response: Response): Response {\n if (!response.body) return response;\n const streaming = response.headers.get(\"content-type\")?.includes(\"text/event-stream\") ?? false;\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let total = 0,\n pending = \"\",\n terminal = false;\n let identity: { id: string; model: string } | undefined;\n const fail = () =>\n new ProductModelError(\n streaming ? \"model_stream_interrupted\" : \"model_response_invalid\",\n response.status,\n true,\n response.headers.get(\"x-openpond-request-id\") ??\n response.headers.get(\"x-request-id\") ??\n undefined,\n );\n const body = new ReadableStream<Uint8Array>({\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n if (streaming && !terminal) throw fail();\n controller.close();\n reader.releaseLock();\n return;\n }\n total += value.byteLength;\n if (total > 8 * 1024 * 1024) throw fail();\n if (streaming) {\n pending = (pending + decoder.decode(value, { stream: true })).replace(/\\r\\n/g, \"\\n\");\n let boundary: number;\n while ((boundary = pending.indexOf(\"\\n\\n\")) >= 0) {\n const frame = pending.slice(0, boundary);\n pending = pending.slice(boundary + 2);\n if (new TextEncoder().encode(frame).length > 1024 * 1024) throw fail();\n const data = frame\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.slice(5).trimStart())\n .join(\"\\n\");\n if (data === \"[DONE]\") terminal = true;\n else if (data) {\n const chunk = JSON.parse(data);\n if (typeof chunk.id === \"string\" && typeof chunk.model === \"string\") {\n if (identity && (chunk.id !== identity.id || chunk.model !== identity.model))\n throw fail();\n identity = { id: chunk.id, model: chunk.model };\n }\n }\n }\n if (new TextEncoder().encode(pending).length > 1024 * 1024) throw fail();\n }\n controller.enqueue(value);\n } catch {\n await reader.cancel().catch(() => {});\n controller.error(fail());\n }\n },\n async cancel(reason) {\n await reader.cancel(reason);\n },\n });\n return new Response(body, {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n}\n"],"mappings":";;;;;;;;AACA;AAAA,EACE;AAAA,OAEK;AACP,SAAS,SAAS;;;ACDX,SAAS,0BAA0B,UAA8B;AACtE,MAAI,CAAC,SAAS,KAAM,QAAO;AAC3B,QAAM,YAAY,SAAS,QAAQ,IAAI,cAAc,GAAG,SAAS,mBAAmB,KAAK;AACzF,Q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AI;AACF,eAAO,MAAM,SAAS,WAAW,OAAO;AAAA,MAC1C,SAAS,OAAO;AACd,cAAM,eAAe,KAAK;AAAA,MAC5B;AAAA,IACF;AAAA,IACA,MAAM,SAAS,SAAkD;AAC/D,YAAM,OAAO;AACb,UAAI,CAAC,MAAM,aAAa;AACtB,cAAM,IAAI,kBAAkB,yBAAyB,GAAG,KAAK;AAC/D,UAAI;AACF,cAAM,SAAS,MAAM,SAAS,SAAS,OAAO;AAC9C,cAAM,SAAS,OAAO,OAAO,UAAU;AACvC,eAAO;AAAA,UACL,GAAG;AAAA,UACH,QAAQ,IAAI,eAAe;AAAA,YACzB,MAAM,KAAK,YAAY;AACrB,kBAAI;AACF,sBAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,oBAAI,MAAM;AACR,6BAAW,MAAM;AACjB,yBAAO,YAAY;AAAA,gBACrB;AACE,6BAAW;AAAA,oBACT,MAAM,SAAS,UACX,EAAE,GAAG,OAAO,OAAO,eAAe,MAAM,KAAK,EAAE,IAC/C;AAAA,kBACN;AAAA,cACJ,SAAS,OAAO;AACd,2BAAW,MAAM,eAAe,KAAK,CAAC;AAAA,cACxC;AAAA,YACF;AAAA,YACA,MAAM,OAAO,QAAQ;AACnB,oBAAM,OAAO,OAAO,MAAM;AAAA,YAC5B;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,SAAS,OAAO;AACd,cAAM,eAAe,KAAK;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/ai-sdk.ts","../src/product-model-response.ts"],"sourcesContent":["/** Optional integration: AI SDK 7 / @ai-sdk/openai-compatible 3 (LanguageModelV4). */\nimport {\n createOpenAICompatible,\n type OpenAICompatibleChatLanguageModel,\n} from \"@ai-sdk/openai-compatible\";\nimport { z } from \"zod\";\nimport { boundProductModelResponse } from \"./product-model-response.js\";\nimport { ProductModel, ProductModelError, productModelEndpoint } from \"./product-models.js\";\n\nconst Evidence = z.object({ openpond: z.record(z.string(), z.json()) }).passthrough();\nfunction metadata(raw: unknown) {\n const value = Evidence.safeParse(raw);\n return value.success ? { openpond: value.data.openpond } : undefined;\n}\n\n/** Use generateText/streamText with maxRetries: 0; paid inference is never safely replayable implicitly. */\nexport function toAIModel(\n model: ProductModel,\n): Pick<\n OpenAICompatibleChatLanguageModel,\n \"specificationVersion\" | \"provider\" | \"modelId\" | \"supportedUrls\" | \"doGenerate\" | \"doStream\"\n> {\n const connection = model.providerConnection();\n const provider = createOpenAICompatible({\n name: \"openpond\",\n baseURL: productModelEndpoint(connection.baseUrl!),\n apiKey: connection.apiKey,\n // The personalized gateway always supplies terminal usage and rejects\n // OpenAI's optional stream_options field.\n includeUsage: false,\n headers: connection.teamId ? { \"X-OpenPond-Team-Id\": connection.teamId } : undefined,\n transformRequestBody: (raw) => {\n const body = JSON.parse(JSON.stringify(raw)) as Record<string, unknown>;\n if (body.model !== model.id)\n throw new ProductModelError(\"model_override_forbidden\", 0, false);\n const allowed = new Set([\n \"model\",\n \"messages\",\n \"stream\",\n \"max_tokens\",\n \"temperature\",\n \"top_p\",\n \"seed\",\n \"stop\",\n \"tools\",\n \"tool_choice\",\n ]);\n if (Object.keys(body).some((key) => !allowed.has(key)))\n throw new ProductModelError(\"parameter_unsupported\", 0, false);\n return body;\n },\n metadataExtractor: {\n async extractMetadata({ parsedBody }) {\n return metadata(parsedBody);\n },\n createStreamExtractor() {\n let evidence: ReturnType<typeof metadata>;\n return {\n processChunk(chunk) {\n evidence = metadata(chunk) ?? evidence;\n },\n buildMetadata() {\n return evidence;\n },\n };\n },\n },\n supportsStructuredOutputs: model.capabilities.structuredOutput,\n fetch: async (url, init) => {\n const timeout = AbortSignal.timeout(connection.timeoutMs ?? 60_000);\n const headers = new Headers(init?.headers);\n headers.set(\"Authorization\", `Bearer ${connection.apiKey}`);\n if (connection.teamId) headers.set(\"X-OpenPond-Team-Id\", connection.teamId);\n return boundProductModelResponse(\n await (connection.fetch ?? fetch)(url, {\n ...init,\n redirect: \"error\",\n headers,\n signal: init?.signal ? AbortSignal.any([init.signal, timeout]) : timeout,\n }),\n );\n },\n }).chatModel(model.id);\n const check = (options: Parameters<typeof provider.doGenerate>[0]) => {\n const rawOptions = options.providerOptions?.openpond;\n if (rawOptions && [\"stream\", \"stream_options\"].some((key) => key in rawOptions))\n throw new ProductModelError(\"transport_override_forbidden\", 0, false);\n if (options.tools?.length && !model.capabilities.tools)\n throw new ProductModelError(\"tools_unsupported\", 0, false);\n if (options.responseFormat?.type === \"json\")\n throw new ProductModelError(\"structured_output_unsupported\", 0, false);\n if (\n options.prompt.some(\n (message) =>\n (message.role === \"tool\" && !model.capabilities.tools) ||\n (message.role !== \"system\" &&\n message.content.some(\n (part) =>\n part.type !== \"text\" &&\n !(model.capabilities.tools && [\"tool-call\", \"tool-result\"].includes(part.type)),\n )),\n )\n )\n throw new ProductModelError(\"input_capability_unsupported\", 0, false);\n };\n // Convert retryable transport errors to a terminal SDK error: AI SDK's default\n // automatic retries must not accidentally duplicate a billed generation.\n const normalizeError = (error: unknown): ProductModelError => {\n if (error instanceof ProductModelError) return error;\n if (\n error &&\n typeof error === \"object\" &&\n \"cause\" in error &&\n error.cause instanceof ProductModelError\n )\n return error.cause;\n const status =\n error &&\n typeof error === \"object\" &&\n \"statusCode\" in error &&\n typeof error.statusCode === \"number\"\n ? error.statusCode\n : 0;\n const unknown =\n status === 0 || status === 408 || status >= 500 || (status >= 200 && status < 300);\n return new ProductModelError(\n status >= 400 ? \"model_request_rejected\" : \"model_outcome_unknown\",\n status,\n unknown,\n );\n };\n return {\n specificationVersion: provider.specificationVersion,\n provider: provider.provider,\n modelId: provider.modelId,\n supportedUrls: provider.supportedUrls,\n async doGenerate(options: Parameters<typeof provider.doGenerate>[0]) {\n check(options);\n try {\n return await provider.doGenerate(options);\n } catch (error) {\n throw normalizeError(error);\n }\n },\n async doStream(options: Parameters<typeof provider.doStream>[0]) {\n check(options);\n if (!model.capabilities.streaming)\n throw new ProductModelError(\"streaming_unsupported\", 0, false);\n try {\n const result = await provider.doStream(options);\n const reader = result.stream.getReader();\n return {\n ...result,\n stream: new ReadableStream({\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n controller.close();\n reader.releaseLock();\n } else\n controller.enqueue(\n value.type === \"error\"\n ? { ...value, error: normalizeError(value.error) }\n : value,\n );\n } catch (error) {\n controller.error(normalizeError(error));\n }\n },\n async cancel(reason) {\n await reader.cancel(reason);\n },\n }),\n };\n } catch (error) {\n throw normalizeError(error);\n }\n },\n };\n}\n","import { ProductModelError } from \"./product-models.js\";\n\n/** Bound the optional provider's otherwise unbounded parser and require the\n * personalized gateway's terminal marker before treating EOF as completion. */\nexport function boundProductModelResponse(response: Response): Response {\n if (!response.body) return response;\n const streaming = response.headers.get(\"content-type\")?.includes(\"text/event-stream\") ?? false;\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let total = 0,\n pending = \"\",\n terminal = false;\n let identity: { id: string; model: string } | undefined;\n const fail = () =>\n new ProductModelError(\n streaming ? \"model_stream_interrupted\" : \"model_response_invalid\",\n response.status,\n true,\n response.headers.get(\"x-openpond-request-id\") ??\n response.headers.get(\"x-request-id\") ??\n undefined,\n );\n const body = new ReadableStream<Uint8Array>({\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n if (streaming && !terminal) throw fail();\n controller.close();\n reader.releaseLock();\n return;\n }\n total += value.byteLength;\n if (total > 8 * 1024 * 1024) throw fail();\n if (streaming) {\n pending = (pending + decoder.decode(value, { stream: true })).replace(/\\r\\n/g, \"\\n\");\n let boundary: number;\n while ((boundary = pending.indexOf(\"\\n\\n\")) >= 0) {\n const frame = pending.slice(0, boundary);\n pending = pending.slice(boundary + 2);\n if (new TextEncoder().encode(frame).length > 1024 * 1024) throw fail();\n const data = frame\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.slice(5).trimStart())\n .join(\"\\n\");\n if (data === \"[DONE]\") terminal = true;\n else if (data) {\n const chunk = JSON.parse(data);\n if (typeof chunk.id === \"string\" && typeof chunk.model === \"string\") {\n if (identity && (chunk.id !== identity.id || chunk.model !== identity.model))\n throw fail();\n identity = { id: chunk.id, model: chunk.model };\n }\n }\n }\n if (new TextEncoder().encode(pending).length > 1024 * 1024) throw fail();\n }\n controller.enqueue(value);\n } catch {\n await reader.cancel().catch(() => {});\n controller.error(fail());\n }\n },\n async cancel(reason) {\n await reader.cancel(reason);\n },\n });\n return new Response(body, {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n}\n"],"mappings":";;;;;;;;;AACA;AAAA,EACE;AAAA,OAEK;AACP,SAAS,SAAS;;;ACDX,SAAS,0BAA0B,UAA8B;AACtE,MAAI,CAAC,SAAS,KAAM,QAAO;AAC3B,QAAM,YAAY,SAAS,QAAQ,IAAI,cAAc,GAAG,SAAS,mBAAmB,KAAK;AACzF,QAAM,SAAS,SAAS,KAAK,UAAU;AACvC,QAAM,UAAU,IAAI,YAAY;AAChC,MAAI,QAAQ,GACV,UAAU,IACV,WAAW;AACb,MAAI;AACJ,QAAM,OAAO,MACX,IAAI;AAAA,IACF,YAAY,6BAA6B;AAAA,IACzC,SAAS;AAAA,IACT;AAAA,IACA,SAAS,QAAQ,IAAI,uBAAuB,KAC1C,SAAS,QAAQ,IAAI,cAAc,KACnC;AAAA,EACJ;AACF,QAAM,OAAO,IAAI,eAA2B;AAAA,IAC1C,MAAM,KAAK,YAAY;AACrB,UAAI;AACF,cAAM,EAAE,MAAM,MAAM,IAAI,MAAM,OAAO,KAAK;AAC1C,YAAI,MAAM;AACR,cAAI,aAAa,CAAC,SAAU,OAAM,KAAK;AACvC,qBAAW,MAAM;AACjB,iBAAO,YAAY;AACnB;AAAA,QACF;AACA,iBAAS,MAAM;AACf,YAAI,QAAQ,IAAI,OAAO,KAAM,OAAM,KAAK;AACxC,YAAI,WAAW;AACb,qBAAW,UAAU,QAAQ,OAAO,OAAO,EAAE,QAAQ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BACN;AAAA,cACJ,SAAS,OAAO;AACd,2BAAW,MAAM,eAAe,KAAK,CAAC;AAAA,cACxC;AAAA,YACF;AAAA,YACA,MAAM,OAAO,QAAQ;AACnB,oBAAM,OAAO,OAAO,MAAM;AAAA,YAC5B;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,SAAS,OAAO;AACd,cAAM,eAAe,KAAK;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -5,15 +5,16 @@ import {
|
|
|
5
5
|
CandidateEvaluationPreparationSchema,
|
|
6
6
|
CandidateEvaluationRequestSchema,
|
|
7
7
|
createCandidateEvaluationClient
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-AMZ2SWHR.js";
|
|
9
|
+
import "./chunk-2U6BQ5C4.js";
|
|
10
|
+
import "./chunk-4REK5TTE.js";
|
|
11
|
+
import "./chunk-XWUTYFOU.js";
|
|
12
|
+
import "./chunk-CAOMKM55.js";
|
|
13
|
+
import "./chunk-H5KHLBC5.js";
|
|
14
14
|
import "./chunk-CL3IOOVL.js";
|
|
15
15
|
import "./chunk-B3ZHJ2KK.js";
|
|
16
16
|
import "./chunk-H3JZ3P5T.js";
|
|
17
|
+
import "./chunk-QYWPNNP3.js";
|
|
17
18
|
import "./chunk-YLJ4XMA6.js";
|
|
18
19
|
export {
|
|
19
20
|
CandidateEvaluationControlSchema,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ExperimentGraderSelectionSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4REK5TTE.js";
|
|
4
4
|
import {
|
|
5
5
|
ModelTasksetRunRequestSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XWUTYFOU.js";
|
|
7
7
|
|
|
8
8
|
// src/experiment-run-contracts.ts
|
|
9
9
|
import { z } from "zod";
|
|
@@ -28,4 +28,4 @@ var RunExperimentSchema = z.object({
|
|
|
28
28
|
export {
|
|
29
29
|
RunExperimentSchema
|
|
30
30
|
};
|
|
31
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-2U6BQ5C4.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
publishTasksetDraft,
|
|
5
5
|
renderTasksetDraftManifests,
|
|
6
6
|
validateTasksetDraftWorkspace
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JINWKUKR.js";
|
|
8
8
|
import {
|
|
9
9
|
materializePortableTasksetRelease,
|
|
10
10
|
portableTasksetEnvironment,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
TasksetSchema,
|
|
15
15
|
computeTasksetHash
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4A4FNG4R.js";
|
|
17
17
|
import {
|
|
18
18
|
MAX_TASKSET_PACKAGE_BYTES,
|
|
19
19
|
ModelStarterExecutionSchema,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
resolveTasksetPackageInstructions,
|
|
33
33
|
structuredSamplingSchemaDeclaration,
|
|
34
34
|
validateTasksetPackage
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-AQV7RQZH.js";
|
|
36
36
|
import {
|
|
37
37
|
ModelTasksetAuthoringOwnerSchema,
|
|
38
38
|
ModelTasksetDraftPreparationSchema,
|
|
@@ -471,4 +471,4 @@ export {
|
|
|
471
471
|
compileTasksetDraftWorkspace,
|
|
472
472
|
compileModelTasksetDraftWorkspace
|
|
473
473
|
};
|
|
474
|
-
//# sourceMappingURL=chunk-
|
|
474
|
+
//# sourceMappingURL=chunk-3BILL33A.js.map
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
fetchConnectedJson
|
|
3
3
|
} from "./chunk-O6FKHAWN.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_API_BASE_URL
|
|
6
|
+
} from "./chunk-QYWPNNP3.js";
|
|
4
7
|
|
|
5
8
|
// src/evaluation-coordination-http.ts
|
|
6
9
|
import { z } from "zod";
|
|
7
10
|
var EvaluationCoordinationTransport = class {
|
|
8
11
|
constructor(access) {
|
|
9
12
|
this.access = access;
|
|
10
|
-
const url = new URL(access.baseUrl);
|
|
13
|
+
const url = new URL(access.baseUrl ?? DEFAULT_API_BASE_URL);
|
|
11
14
|
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash || !access.apiKey.trim() || !access.actorId.trim() || !access.teamId.trim()) throw new Error("Select the current evaluation owner and HTTP API origin.");
|
|
12
15
|
this.origin = url.toString().replace(/\/+$/, "");
|
|
13
16
|
}
|
|
@@ -34,4 +37,4 @@ var EvaluationCoordinationTransport = class {
|
|
|
34
37
|
export {
|
|
35
38
|
EvaluationCoordinationTransport
|
|
36
39
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-456F3BXD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/evaluation-coordination-http.ts"],"sourcesContent":["import { DEFAULT_API_BASE_URL } from \"./endpoints.js\";\nimport {z} from \"zod\";\nimport {fetchConnectedJson} from \"./connected-evidence-http.js\";\nexport type EvaluationCoordinationAccess={baseUrl?:string;apiKey:string;actorId:string;teamId:string;projectId:string|null;fetch?:typeof fetch};\n/** Bounded authenticated transport for the current evaluation owner. There is\n * no retry or operation allocation here; commands retain their reviewed IDs. */\nexport class EvaluationCoordinationTransport {\n readonly origin:string;\n constructor(readonly access:EvaluationCoordinationAccess){\n const url=new URL(access.baseUrl ?? DEFAULT_API_BASE_URL);\n if(![\"http:\",\"https:\"].includes(url.protocol)||url.username||url.password||url.search||url.hash||!access.apiKey.trim()||!access.actorId.trim()||!access.teamId.trim())throw new Error(\"Select the current evaluation owner and HTTP API origin.\");\n this.origin=url.toString().replace(/\\/+$/,\"\");\n }\n async post(path:\"experiment-evaluation-schedules\"|\"advanced-refiner-evaluations\",request:unknown,signal?:AbortSignal){\n const body=JSON.stringify({teamId:this.access.teamId,projectId:this.access.projectId,request});\n if(new TextEncoder().encode(body).byteLength>1_048_576)throw new Error(\"The reviewed evaluation command exceeds 1 MiB.\");\n const {response,value}=await fetchConnectedJson(this.access.fetch??fetch,`${this.origin}/v1/${path}`,{\n method:\"POST\",redirect:\"error\",headers:{Authorization:`Bearer ${this.access.apiKey}`,\"X-OpenPond-Team-Id\":this.access.teamId,\"Content-Type\":\"application/json\"},body,signal,\n },(status,code,message)=>Object.assign(new Error(message),{status,code}));\n if(!response.ok){const error=z.object({error:z.string().optional(),message:z.string().optional(),code:z.string().optional()}).passthrough().safeParse(value);throw Object.assign(new Error(error.success?error.data.error??error.data.message??\"Evaluation operation failed.\":\"Evaluation operation failed.\"),{status:response.status,code:error.success?error.data.code:undefined});}\n return value;\n }\n}\n"],"mappings":";;;;;;;;AACA,SAAQ,SAAQ;AAKT,IAAM,kCAAN,MAAsC;AAAA,EAE3C,YAAqB,QAAoC;AAApC;AACnB,UAAM,MAAI,IAAI,IAAI,OAAO,WAAW,oBAAoB;AACxD,QAAG,CAAC,CAAC,SAAQ,QAAQ,EAAE,SAAS,IAAI,QAAQ,KAAG,IAAI,YAAU,IAAI,YAAU,IAAI,UAAQ,IAAI,QAAM,CAAC,OAAO,OAAO,KAAK,KAAG,CAAC,OAAO,QAAQ,KAAK,KAAG,CAAC,OAAO,OAAO,KAAK,EAAE,OAAM,IAAI,MAAM,0DAA0D;AAChP,SAAK,SAAO,IAAI,SAAS,EAAE,QAAQ,QAAO,EAAE;AAAA,EAC9C;AAAA,EAJqB;AAAA,EADZ;AAAA,EAMT,MAAM,KAAK,MAAsE,SAAgB,QAAoB;AACnH,UAAM,OAAK,KAAK,UAAU,EAAC,QAAO,KAAK,OAAO,QAAO,WAAU,KAAK,OAAO,WAAU,QAAO,CAAC;AAC7F,QAAG,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE,aAAW,QAAU,OAAM,IAAI,MAAM,gDAAgD;AACvH,UAAM,EAAC,UAAS,MAAK,IAAE,MAAM,mBAAmB,KAAK,OAAO,SAAO,OAAM,GAAG,KAAK,MAAM,OAAO,IAAI,IAAG;AAAA,MACnG,QAAO;AAAA,MAAO,UAAS;AAAA,MAAQ,SAAQ,EAAC,eAAc,UAAU,KAAK,OAAO,MAAM,IAAG,sBAAqB,KAAK,OAAO,QAAO,gBAAe,mBAAkB;AAAA,MAAE;AAAA,MAAK;AAAA,IACvK,GAAE,CAAC,QAAO,MAAK,YAAU,OAAO,OAAO,IAAI,MAAM,OAAO,GAAE,EAAC,QAAO,KAAI,CAAC,CAAC;AACxE,QAAG,CAAC,SAAS,IAAG;AAAC,YAAM,QAAM,EAAE,OAAO,EAAC,OAAM,EAAE,OAAO,EAAE,SAAS,GAAE,SAAQ,EAAE,OAAO,EAAE,SAAS,GAAE,MAAK,EAAE,OAAO,EAAE,SAAS,EAAC,CAAC,EAAE,YAAY,EAAE,UAAU,KAAK;AAAE,YAAM,OAAO,OAAO,IAAI,MAAM,MAAM,UAAQ,MAAM,KAAK,SAAO,MAAM,KAAK,WAAS,iCAA+B,8BAA8B,GAAE,EAAC,QAAO,SAAS,QAAO,MAAK,MAAM,UAAQ,MAAM,KAAK,OAAK,OAAS,CAAC;AAAA,IAAE;AACrX,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
TasksetPreferenceComparisonBindingSchema,
|
|
12
12
|
TasksetPurposeSchema,
|
|
13
13
|
TasksetSourceRefSchema
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-AQV7RQZH.js";
|
|
15
15
|
import {
|
|
16
16
|
ModelTasksetDraftPreparationSchema
|
|
17
17
|
} from "./chunk-TK3DXH7A.js";
|
|
@@ -910,4 +910,4 @@ export {
|
|
|
910
910
|
computeTasksetHash,
|
|
911
911
|
validatePortability
|
|
912
912
|
};
|
|
913
|
-
//# sourceMappingURL=chunk-
|
|
913
|
+
//# sourceMappingURL=chunk-4A4FNG4R.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createTrainingRequest
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QKLZZOZD.js";
|
|
4
4
|
import {
|
|
5
5
|
OpenPondProtocolError
|
|
6
6
|
} from "./chunk-B3ZHJ2KK.js";
|
|
@@ -158,4 +158,4 @@ export {
|
|
|
158
158
|
createTrainingHardwareClient,
|
|
159
159
|
createHardwareObservationClient
|
|
160
160
|
};
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
161
|
+
//# sourceMappingURL=chunk-4CDLPMJK.js.map
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
} from "./chunk-GPQLBVQC.js";
|
|
10
10
|
import {
|
|
11
11
|
AuthoredTasksetFileInventorySchema
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3BILL33A.js";
|
|
13
13
|
import {
|
|
14
14
|
configuredTasksetDraftFiles,
|
|
15
15
|
createTasksetDraftWorkspace,
|
|
16
16
|
decodeTasksetDraftWorkspaceFile,
|
|
17
17
|
isManagedTasksetDraftFilePath
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-JINWKUKR.js";
|
|
19
19
|
import {
|
|
20
20
|
TasksetDraftSchema
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-4A4FNG4R.js";
|
|
22
22
|
import {
|
|
23
23
|
compileModelTasksetReward,
|
|
24
24
|
createTasksetPackage,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
resolveTasksetPackageExecution,
|
|
27
27
|
resolveTasksetPackageInstructions,
|
|
28
28
|
validateTasksetPackage
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-AQV7RQZH.js";
|
|
30
30
|
import {
|
|
31
31
|
ModelTasksetDraftPreparationSchema,
|
|
32
32
|
TasksetDraftFilePathSchema
|
|
@@ -698,4 +698,4 @@ export {
|
|
|
698
698
|
prepareTasksetDraftSource,
|
|
699
699
|
materializeTasksetDraftWorkspace
|
|
700
700
|
};
|
|
701
|
-
//# sourceMappingURL=chunk-
|
|
701
|
+
//# sourceMappingURL=chunk-4CRLQMJ2.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
ExperimentImprovementTestRecipeSchema,
|
|
11
11
|
verifyExperimentImprovementHumanOptions,
|
|
12
12
|
verifyExperimentImprovementState
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-D26RJQU7.js";
|
|
14
14
|
import {
|
|
15
15
|
fetchConnectedJson
|
|
16
16
|
} from "./chunk-O6FKHAWN.js";
|
|
@@ -19,6 +19,9 @@ import {
|
|
|
19
19
|
contentHash,
|
|
20
20
|
sha256
|
|
21
21
|
} from "./chunk-H3JZ3P5T.js";
|
|
22
|
+
import {
|
|
23
|
+
DEFAULT_API_BASE_URL
|
|
24
|
+
} from "./chunk-QYWPNNP3.js";
|
|
22
25
|
|
|
23
26
|
// src/experiment-improvement-client.ts
|
|
24
27
|
import { z as z2 } from "zod";
|
|
@@ -97,7 +100,7 @@ var HostedProfileCandidateCommandSchema = z.discriminatedUnion("operation", [
|
|
|
97
100
|
var ExperimentImprovementClient = class {
|
|
98
101
|
constructor(options) {
|
|
99
102
|
this.options = options;
|
|
100
|
-
const url = new URL(options.baseUrl);
|
|
103
|
+
const url = new URL(options.baseUrl ?? DEFAULT_API_BASE_URL);
|
|
101
104
|
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash || url.search || !options.apiKey.trim() || !options.teamId.trim() || !options.actorId.trim()) throw new Error("Select the authenticated Improve owner and API origin.");
|
|
102
105
|
this.origin = url.toString().replace(/\/+$/, "");
|
|
103
106
|
}
|
|
@@ -157,4 +160,4 @@ export {
|
|
|
157
160
|
HostedProfileCandidateCommandSchema,
|
|
158
161
|
ExperimentImprovementClient
|
|
159
162
|
};
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
163
|
+
//# sourceMappingURL=chunk-4PEK3YOW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/experiment-improvement-client.ts","../src/experiment-improvement-hosted-adoption.ts"],"sourcesContent":["import { DEFAULT_API_BASE_URL } from \"./endpoints.js\";\nimport {z} from \"zod\";\nimport {contentHash,sha256} from \"@openpond/harness\";\nimport {verifyExperimentImprovementHumanOptions,ExperimentImprovementListSchema,ExperimentImprovementOptionsSchema,ExperimentImprovementCommandSchema,verifyExperimentImprovementState,type ExperimentImprovementCommand} from \"./experiment-improvement-contracts.js\";\nimport {HostedProfileCandidateCommandSchema,verifyHostedProfileCandidateReceipt} from \"./experiment-improvement-hosted-adoption.js\";\nimport {fetchConnectedJson} from \"./connected-evidence-http.js\";\nexport class ExperimentImprovementClient {\n private readonly origin:string;\n constructor(private readonly options:{baseUrl?:string;apiKey:string;teamId:string;actorId:string;fetch?:typeof fetch}){const url=new URL(options.baseUrl ?? DEFAULT_API_BASE_URL);if(![\"http:\",\"https:\"].includes(url.protocol)||url.username||url.password||url.hash||url.search||!options.apiKey.trim()||!options.teamId.trim()||!options.actorId.trim())throw new Error(\"Select the authenticated Improve owner and API origin.\");this.origin=url.toString().replace(/\\/+$/,\"\");}\n async hostedCandidate(raw:import(\"zod\").input<typeof HostedProfileCandidateCommandSchema>,signal?:AbortSignal){const request=HostedProfileCandidateCommandSchema.parse(raw);if(request.operation===\"adopt\"&&(request.export.actorId!==this.options.actorId||request.export.teamId!==this.options.teamId))throw new Error(\"The hosted candidate export belongs to a different owner.\");const {response,value}=await fetchConnectedJson(this.options.fetch??fetch,`${this.origin}/v1/profile-candidate-adoptions`,{method:\"POST\",redirect:\"error\",headers:{Authorization:`Bearer ${this.options.apiKey}`,\"Content-Type\":\"application/json\",\"X-OpenPond-Team-Id\":this.options.teamId},body:JSON.stringify({teamId:this.options.teamId,command:request}),signal},(status,code,message)=>Object.assign(new Error(message),{status,code}));if(!response.ok){const error=z.object({code:z.string(),message:z.string().optional(),error:z.string().optional()}).passthrough().safeParse(value);throw Object.assign(new Error(error.success?error.data.message??error.data.error??error.data.code:\"Hosted candidate operation failed.\"),{status:response.status,code:error.success?error.data.code:undefined});}const receipt=verifyHostedProfileCandidateReceipt(value);if(receipt.actorId!==this.options.actorId||receipt.teamId!==this.options.teamId||receipt.operationId!==request.operationId||request.operation===\"adopt\"&&(receipt.exportHash!==request.export.contentHash||receipt.candidateId!==request.export.candidateId||receipt.testedCandidateRelease.contentHash!==request.export.policySource.harnessRelease.contentHash))throw new Error(\"Hosted candidate readback differs from the exact owner request.\");return receipt;}\n async command(raw:ExperimentImprovementCommand,signal?:AbortSignal){const request=ExperimentImprovementCommandSchema.parse(raw),{response,value}=await fetchConnectedJson(this.options.fetch??fetch,`${this.origin}/v1/experiment-improvements`,{method:\"POST\",redirect:\"error\",headers:{Authorization:`Bearer ${this.options.apiKey}`,\"Content-Type\":\"application/json\",\"X-OpenPond-Team-Id\":this.options.teamId},body:JSON.stringify({teamId:this.options.teamId,request}),signal},(status,code,message)=>Object.assign(new Error(message),{status,code}));\n if(!response.ok){const error=z.object({error:z.string(),code:z.string().optional()}).passthrough().safeParse(value);throw Object.assign(new Error(error.success?error.data.error:\"The Improve operation failed.\"),{status:response.status,code:error.success?error.data.code:undefined});}\n if(request.operation===\"options\"){const result=ExperimentImprovementOptionsSchema.parse(value);if(result.teamId!==this.options.teamId||contentHash(result.evidence)!==contentHash(request.evidence))throw new Error(\"The Improve choices changed their exact originating evidence.\");return result;}\n if(request.operation===\"humanComparisonOptions\"){const result=verifyExperimentImprovementHumanOptions(value);if(result.candidateId!==request.id||result.actorId!==this.options.actorId||result.teamId!==this.options.teamId)throw new Error(\"Human discovery belongs to another owner or candidate.\");return result;}\n if(request.operation===\"instructions\"){const result=z.object({candidateId:z.string(),candidateRevision:z.number().int().positive(),path:z.string(),text:z.string().max(250000),textHash:z.string().regex(/^[a-f0-9]{64}$/),contentHash:z.string().regex(/^[a-f0-9]{64}$/)}).strict().parse(value);if(result.candidateId!==request.id||sha256(result.text)!==result.textHash)throw new Error(\"The candidate instructions belong to a different revision.\");return result;}\n const page=request.operation===\"list\"?ExperimentImprovementListSchema.parse(value):null;if(request.operation===\"list\"&&page&&(page.states.length>request.limit||page.states.some((state,index)=>request.cursor&&state.id<=request.cursor||index>0&&state.id<=page.states[index-1]!.id)||page.nextCursor&&(request.cursor&&page.nextCursor<=request.cursor||page.states.some(state=>state.id>page.nextCursor!))))throw new Error(\"The retained candidate page changed its scan boundary.\");\n const states=page? page.states:[value];const parsed=states.map(item=>{const state=verifyExperimentImprovementState(item);if(state.actorId!==this.options.actorId||state.teamId!==this.options.teamId||\"id\" in request&&state.id!==request.id)throw new Error(\"The Improve response belongs to a different owner or candidate.\");if(request.operation===\"start\"&&state.requestHash!==contentHash(request.request))throw new Error(\"The Improve request identity changed.\");return state;});return page?{states:parsed,nextCursor:page.nextCursor}:parsed[0]!;\n }\n}\n","import {z} from \"zod\";\nimport {contentHash,ImmutableReleaseRefSchema,HarnessPolicySourcePackageSchema,validateHarnessPolicySourcePackage} from \"@openpond/harness\";\nimport {ExperimentImprovementTestRecipeSchema,ExperimentImprovementStateSchema} from \"./experiment-improvement-contracts.js\";\nconst Id=z.string().min(1).max(240),Hash=z.string().regex(/^[a-f0-9]{64}$/),Commit=z.string().regex(/^[a-f0-9]{40}$/);\n/** This export attests native owner execution. It never asserts a hosted run,\n * grants training eligibility, or authorizes automatic candidate adoption. */\nexport const HostedProfileCandidateExportSchema=z.object({schemaVersion:z.literal(\"openpond.hostedProfileCandidateExport.v1\"),\n actorId:Id,teamId:Id,candidateId:Id,candidateRevision:z.number().int().positive(),projectId:Id.nullable(),\n profileRef:z.object({source:z.literal(\"openpond_git\"),repositoryId:Id,profileId:Id}).strict(),expectedCommit:Commit,\n component:ExperimentImprovementStateSchema.shape.component,baseRelease:ImmutableReleaseRefSchema,\n frozenHash:Hash,executableSourceHash:Hash,protectedClosureHash:Hash,\n compiler:z.object({workspaceId:Id,name:z.string().max(500),repositoryId:Id}).strict(),\n sourceManifest:z.object({base64:z.string().max(2_800_000),contentHash:Hash,sizeBytes:z.number().int().positive().max(2_000_000)}).strict(),\n policySource:HarnessPolicySourcePackageSchema,\n qualification:z.object({kind:z.enum([\"owner_attested_local\",\"hosted_execution\"]),ownerActorId:Id,teamId:Id,originalEvidence:ImmutableReleaseRefSchema,\n baseline:ImmutableReleaseRefSchema,candidate:ImmutableReleaseRefSchema,comparisonHash:Hash,recipe:ExperimentImprovementTestRecipeSchema}).strict(),\n createdAt:z.string().datetime(),contentHash:Hash}).strict();\nexport type HostedProfileCandidateExport=z.infer<typeof HostedProfileCandidateExportSchema>;\nexport function verifyHostedProfileCandidateExport(raw:unknown){const value=HostedProfileCandidateExportSchema.parse(raw),{contentHash:hash,...body}=value;\n if(contentHash(body)!==hash||value.qualification.ownerActorId!==value.actorId||value.qualification.teamId!==value.teamId||value.qualification.recipe.externalDatasetBinding.profileId!==value.profileRef.profileId||value.qualification.recipe.externalDatasetBinding.protectedProfileClosureHash!==value.protectedClosureHash)throw new Error(\"Hosted candidate owner attestation identity differs.\");\n validateHarnessPolicySourcePackage(value.policySource);return value;\n}\nexport const HostedProfileCandidateReceiptSchema=z.object({schemaVersion:z.literal(\"openpond.hostedProfileCandidateAdoption.v1\"),id:Id,operationId:Id,actorId:Id,teamId:Id,\n candidateId:Id,exportHash:Hash,executionOrigin:z.enum([\"owner_attested_local\",\"hosted_execution\"]),qualification:HostedProfileCandidateExportSchema.shape.qualification,\n testedCandidateRelease:ImmutableReleaseRefSchema,activeRelease:ImmutableReleaseRefSchema,expectedCommit:Commit,committedProfileGit:Commit,\n executableSourceHash:Hash,protectedClosureHash:Hash,createdAt:z.string().datetime(),contentHash:Hash}).strict();\nexport type HostedProfileCandidateReceipt=z.infer<typeof HostedProfileCandidateReceiptSchema>;\nexport function verifyHostedProfileCandidateReceipt(raw:unknown){const value=HostedProfileCandidateReceiptSchema.parse(raw),{contentHash:hash,...body}=value;if(contentHash(body)!==hash||value.executionOrigin!==value.qualification.kind||value.qualification.ownerActorId!==value.actorId||value.qualification.teamId!==value.teamId)throw new Error(\"Hosted candidate receipt integrity differs.\");return value;}\nexport const HostedProfileCandidateCommandSchema=z.discriminatedUnion(\"operation\",[\n z.object({operation:z.literal(\"adopt\"),operationId:Id,export:HostedProfileCandidateExportSchema}).strict(),\n z.object({operation:z.enum([\"read\",\"rollback\"]),operationId:Id,adoptionOperationId:Id,profileRepositoryId:Id}).strict(),\n]);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAQ,KAAAA,UAAQ;;;ACDhB,SAAQ,SAAQ;AAGhB,IAAM,KAAG,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAlC,IAAoC,OAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB;AAA1E,IAA4E,SAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB;AAG7G,IAAM,qCAAmC,EAAE,OAAO;AAAA,EAAC,eAAc,EAAE,QAAQ,0CAA0C;AAAA,EAC1H,SAAQ;AAAA,EAAG,QAAO;AAAA,EAAG,aAAY;AAAA,EAAG,mBAAkB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS;AAAA,EAAE,WAAU,GAAG,SAAS;AAAA,EACxG,YAAW,EAAE,OAAO,EAAC,QAAO,EAAE,QAAQ,cAAc,GAAE,cAAa,IAAG,WAAU,GAAE,CAAC,EAAE,OAAO;AAAA,EAAE,gBAAe;AAAA,EAC7G,WAAU,iCAAiC,MAAM;AAAA,EAAU,aAAY;AAAA,EACvE,YAAW;AAAA,EAAK,sBAAqB;AAAA,EAAK,sBAAqB;AAAA,EAC/D,UAAS,EAAE,OAAO,EAAC,aAAY,IAAG,MAAK,EAAE,OAAO,EAAE,IAAI,GAAG,GAAE,c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QAAQ,GAAG,OAAM,IAAI,MAAM,iEAAiE;AAAE,UAAG,QAAQ,cAAY,WAAS,MAAM,gBAAc,YAAY,QAAQ,OAAO,EAAE,OAAM,IAAI,MAAM,uCAAuC;AAAE,aAAO;AAAA,IAAM,CAAC;AAAE,WAAO,OAAK,EAAC,QAAO,QAAO,YAAW,KAAK,WAAU,IAAE,OAAO,CAAC;AAAA,EAC3hB;AACF;","names":["z","z"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HarnessExperimentPolicySchema,
|
|
3
3
|
ModelTasksetRunRequestSchema
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XWUTYFOU.js";
|
|
5
5
|
import {
|
|
6
6
|
contentHash
|
|
7
7
|
} from "./chunk-H3JZ3P5T.js";
|
|
@@ -172,4 +172,4 @@ export {
|
|
|
172
172
|
verifyExperimentDefinition,
|
|
173
173
|
experimentDefinitionRef
|
|
174
174
|
};
|
|
175
|
-
//# sourceMappingURL=chunk-
|
|
175
|
+
//# sourceMappingURL=chunk-4REK5TTE.js.map
|