modaic 0.1.0
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/FUNCTIONS.md +87 -0
- package/LICENSE +21 -0
- package/README.md +533 -0
- package/RUNTIMES.md +48 -0
- package/USAGE.md +19 -0
- package/esm/api/client.d.ts +48 -0
- package/esm/api/client.d.ts.map +1 -0
- package/esm/api/client.js +131 -0
- package/esm/api/client.js.map +1 -0
- package/esm/arbiter/arbiter.d.ts +100 -0
- package/esm/arbiter/arbiter.d.ts.map +1 -0
- package/esm/arbiter/arbiter.js +160 -0
- package/esm/arbiter/arbiter.js.map +1 -0
- package/esm/config.d.ts +22 -0
- package/esm/config.d.ts.map +1 -0
- package/esm/config.js +42 -0
- package/esm/config.js.map +1 -0
- package/esm/core.d.ts +10 -0
- package/esm/core.d.ts.map +1 -0
- package/esm/core.js +13 -0
- package/esm/core.js.map +1 -0
- package/esm/exceptions.d.ts +25 -0
- package/esm/exceptions.d.ts.map +1 -0
- package/esm/exceptions.js +37 -0
- package/esm/exceptions.js.map +1 -0
- package/esm/funcs/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.d.ts +20 -0
- package/esm/funcs/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.d.ts.map +1 -0
- package/esm/funcs/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.js +92 -0
- package/esm/funcs/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.js.map +1 -0
- package/esm/funcs/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.d.ts +18 -0
- package/esm/funcs/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.d.ts.map +1 -0
- package/esm/funcs/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.js +90 -0
- package/esm/funcs/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.js.map +1 -0
- package/esm/funcs/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.d.ts +23 -0
- package/esm/funcs/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.d.ts.map +1 -0
- package/esm/funcs/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.js +95 -0
- package/esm/funcs/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.js.map +1 -0
- package/esm/funcs/check-email-api-v1-user-check-email-get.d.ts +18 -0
- package/esm/funcs/check-email-api-v1-user-check-email-get.d.ts.map +1 -0
- package/esm/funcs/check-email-api-v1-user-check-email-get.js +82 -0
- package/esm/funcs/check-email-api-v1-user-check-email-get.js.map +1 -0
- package/esm/funcs/check-username-api-v1-user-check-username-username-get.d.ts +18 -0
- package/esm/funcs/check-username-api-v1-user-check-username-username-get.d.ts.map +1 -0
- package/esm/funcs/check-username-api-v1-user-check-username-username-get.js +85 -0
- package/esm/funcs/check-username-api-v1-user-check-username-username-get.js.map +1 -0
- package/esm/funcs/create-chat-completion-api-v1-arbiters-chat-completions-post.d.ts +15 -0
- package/esm/funcs/create-chat-completion-api-v1-arbiters-chat-completions-post.d.ts.map +1 -0
- package/esm/funcs/create-chat-completion-api-v1-arbiters-chat-completions-post.js +81 -0
- package/esm/funcs/create-chat-completion-api-v1-arbiters-chat-completions-post.js.map +1 -0
- package/esm/funcs/create-chat-completion-api-v1-chat-completions-post.d.ts +14 -0
- package/esm/funcs/create-chat-completion-api-v1-chat-completions-post.d.ts.map +1 -0
- package/esm/funcs/create-chat-completion-api-v1-chat-completions-post.js +70 -0
- package/esm/funcs/create-chat-completion-api-v1-chat-completions-post.js.map +1 -0
- package/esm/funcs/create-prediction-api-v1-arbiters-predictions-post.d.ts +15 -0
- package/esm/funcs/create-prediction-api-v1-arbiters-predictions-post.d.ts.map +1 -0
- package/esm/funcs/create-prediction-api-v1-arbiters-predictions-post.js +81 -0
- package/esm/funcs/create-prediction-api-v1-arbiters-predictions-post.js.map +1 -0
- package/esm/funcs/create-prediction-api-v2-arbiters-predictions-post.d.ts +23 -0
- package/esm/funcs/create-prediction-api-v2-arbiters-predictions-post.d.ts.map +1 -0
- package/esm/funcs/create-prediction-api-v2-arbiters-predictions-post.js +89 -0
- package/esm/funcs/create-prediction-api-v2-arbiters-predictions-post.js.map +1 -0
- package/esm/funcs/delete-examples-api-v1-examples-delete.d.ts +18 -0
- package/esm/funcs/delete-examples-api-v1-examples-delete.d.ts.map +1 -0
- package/esm/funcs/delete-examples-api-v1-examples-delete.js +84 -0
- package/esm/funcs/delete-examples-api-v1-examples-delete.js.map +1 -0
- package/esm/funcs/dispatch-prediction-api-v1-arbiters-predictions-dispatch-post.d.ts +15 -0
- package/esm/funcs/dispatch-prediction-api-v1-arbiters-predictions-dispatch-post.d.ts.map +1 -0
- package/esm/funcs/dispatch-prediction-api-v1-arbiters-predictions-dispatch-post.js +81 -0
- package/esm/funcs/dispatch-prediction-api-v1-arbiters-predictions-dispatch-post.js.map +1 -0
- package/esm/funcs/download-export-api-v1-examples-export-download-get.d.ts +18 -0
- package/esm/funcs/download-export-api-v1-examples-export-download-get.d.ts.map +1 -0
- package/esm/funcs/download-export-api-v1-examples-export-download-get.js +89 -0
- package/esm/funcs/download-export-api-v1-examples-export-download-get.js.map +1 -0
- package/esm/funcs/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.d.ts +23 -0
- package/esm/funcs/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.d.ts.map +1 -0
- package/esm/funcs/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.js +95 -0
- package/esm/funcs/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.js.map +1 -0
- package/esm/funcs/export-examples-api-v1-examples-export-post.d.ts +18 -0
- package/esm/funcs/export-examples-api-v1-examples-export-post.d.ts.map +1 -0
- package/esm/funcs/export-examples-api-v1-examples-export-post.js +84 -0
- package/esm/funcs/export-examples-api-v1-examples-export-post.js.map +1 -0
- package/esm/funcs/get-arbiter-api-v1-arbiters-get.d.ts +15 -0
- package/esm/funcs/get-arbiter-api-v1-arbiters-get.d.ts.map +1 -0
- package/esm/funcs/get-arbiter-api-v1-arbiters-get.js +84 -0
- package/esm/funcs/get-arbiter-api-v1-arbiters-get.js.map +1 -0
- package/esm/funcs/get-arbiter-schema-output-api-v1-arbiters-schema-get.d.ts +15 -0
- package/esm/funcs/get-arbiter-schema-output-api-v1-arbiters-schema-get.d.ts.map +1 -0
- package/esm/funcs/get-arbiter-schema-output-api-v1-arbiters-schema-get.js +85 -0
- package/esm/funcs/get-arbiter-schema-output-api-v1-arbiters-schema-get.js.map +1 -0
- package/esm/funcs/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.d.ts +29 -0
- package/esm/funcs/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.d.ts.map +1 -0
- package/esm/funcs/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.js +101 -0
- package/esm/funcs/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.js.map +1 -0
- package/esm/funcs/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.d.ts +18 -0
- package/esm/funcs/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.d.ts.map +1 -0
- package/esm/funcs/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.js +90 -0
- package/esm/funcs/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.js.map +1 -0
- package/esm/funcs/get-distinct-hashes-api-v1-examples-distinct-hashes-get.d.ts +18 -0
- package/esm/funcs/get-distinct-hashes-api-v1-examples-distinct-hashes-get.d.ts.map +1 -0
- package/esm/funcs/get-distinct-hashes-api-v1-examples-distinct-hashes-get.js +90 -0
- package/esm/funcs/get-distinct-hashes-api-v1-examples-distinct-hashes-get.js.map +1 -0
- package/esm/funcs/get-example-by-id-api-v1-examples-example-id-get.d.ts +16 -0
- package/esm/funcs/get-example-by-id-api-v1-examples-example-id-get.d.ts.map +1 -0
- package/esm/funcs/get-example-by-id-api-v1-examples-example-id-get.js +88 -0
- package/esm/funcs/get-example-by-id-api-v1-examples-example-id-get.js.map +1 -0
- package/esm/funcs/get-graded-count-api-v1-examples-graded-count-get.d.ts +20 -0
- package/esm/funcs/get-graded-count-api-v1-examples-graded-count-get.d.ts.map +1 -0
- package/esm/funcs/get-graded-count-api-v1-examples-graded-count-get.js +89 -0
- package/esm/funcs/get-graded-count-api-v1-examples-graded-count-get.js.map +1 -0
- package/esm/funcs/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.d.ts +21 -0
- package/esm/funcs/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.d.ts.map +1 -0
- package/esm/funcs/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.js +93 -0
- package/esm/funcs/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.js.map +1 -0
- package/esm/funcs/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.d.ts +25 -0
- package/esm/funcs/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.d.ts.map +1 -0
- package/esm/funcs/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.js +97 -0
- package/esm/funcs/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.js.map +1 -0
- package/esm/funcs/get-prediction-confidence-api-v1-arbiters-predictions-confidence-post.d.ts +24 -0
- package/esm/funcs/get-prediction-confidence-api-v1-arbiters-predictions-confidence-post.d.ts.map +1 -0
- package/esm/funcs/get-prediction-confidence-api-v1-arbiters-predictions-confidence-post.js +90 -0
- package/esm/funcs/get-prediction-confidence-api-v1-arbiters-predictions-confidence-post.js.map +1 -0
- package/esm/funcs/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.d.ts +22 -0
- package/esm/funcs/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.d.ts.map +1 -0
- package/esm/funcs/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.js +94 -0
- package/esm/funcs/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.js.map +1 -0
- package/esm/funcs/get-supported-models-api-v1-arbiters-supported-models-get.d.ts +13 -0
- package/esm/funcs/get-supported-models-api-v1-arbiters-supported-models-get.d.ts.map +1 -0
- package/esm/funcs/get-supported-models-api-v1-arbiters-supported-models-get.js +66 -0
- package/esm/funcs/get-supported-models-api-v1-arbiters-supported-models-get.js.map +1 -0
- package/esm/funcs/get-user-by-id-api-v1-user-user-id-get.d.ts +15 -0
- package/esm/funcs/get-user-by-id-api-v1-user-user-id-get.d.ts.map +1 -0
- package/esm/funcs/get-user-by-id-api-v1-user-user-id-get.js +81 -0
- package/esm/funcs/get-user-by-id-api-v1-user-user-id-get.js.map +1 -0
- package/esm/funcs/get-user-by-id-api-v2-users-id-user-id-get.d.ts +15 -0
- package/esm/funcs/get-user-by-id-api-v2-users-id-user-id-get.d.ts.map +1 -0
- package/esm/funcs/get-user-by-id-api-v2-users-id-user-id-get.js +81 -0
- package/esm/funcs/get-user-by-id-api-v2-users-id-user-id-get.js.map +1 -0
- package/esm/funcs/get-user-by-username-api-v1-user-username-username-get.d.ts +15 -0
- package/esm/funcs/get-user-by-username-api-v1-user-username-username-get.d.ts.map +1 -0
- package/esm/funcs/get-user-by-username-api-v1-user-username-username-get.js +82 -0
- package/esm/funcs/get-user-by-username-api-v1-user-username-username-get.js.map +1 -0
- package/esm/funcs/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.d.ts +20 -0
- package/esm/funcs/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.d.ts.map +1 -0
- package/esm/funcs/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.js +89 -0
- package/esm/funcs/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.js.map +1 -0
- package/esm/funcs/health-check-health-get.d.ts +13 -0
- package/esm/funcs/health-check-health-get.d.ts.map +1 -0
- package/esm/funcs/health-check-health-get.js +61 -0
- package/esm/funcs/health-check-health-get.js.map +1 -0
- package/esm/funcs/ingest-examples-api-v1-examples-post.d.ts +14 -0
- package/esm/funcs/ingest-examples-api-v1-examples-post.d.ts.map +1 -0
- package/esm/funcs/ingest-examples-api-v1-examples-post.js +70 -0
- package/esm/funcs/ingest-examples-api-v1-examples-post.js.map +1 -0
- package/esm/funcs/init-arbiter-api-v1-arbiters-post.d.ts +15 -0
- package/esm/funcs/init-arbiter-api-v1-arbiters-post.d.ts.map +1 -0
- package/esm/funcs/init-arbiter-api-v1-arbiters-post.js +81 -0
- package/esm/funcs/init-arbiter-api-v1-arbiters-post.js.map +1 -0
- package/esm/funcs/join-waitlist-api-v2-waitlist-post.d.ts +15 -0
- package/esm/funcs/join-waitlist-api-v2-waitlist-post.d.ts.map +1 -0
- package/esm/funcs/join-waitlist-api-v2-waitlist-post.js +76 -0
- package/esm/funcs/join-waitlist-api-v2-waitlist-post.js.map +1 -0
- package/esm/funcs/list-examples-api-v1-examples-get.d.ts +19 -0
- package/esm/funcs/list-examples-api-v1-examples-get.d.ts.map +1 -0
- package/esm/funcs/list-examples-api-v1-examples-get.js +100 -0
- package/esm/funcs/list-examples-api-v1-examples-get.js.map +1 -0
- package/esm/funcs/login-api-v1-auth-login-post.d.ts +21 -0
- package/esm/funcs/login-api-v1-auth-login-post.d.ts.map +1 -0
- package/esm/funcs/login-api-v1-auth-login-post.js +82 -0
- package/esm/funcs/login-api-v1-auth-login-post.js.map +1 -0
- package/esm/funcs/mfa-verify-api-v1-auth-mfa-verify-post.d.ts +22 -0
- package/esm/funcs/mfa-verify-api-v1-auth-mfa-verify-post.d.ts.map +1 -0
- package/esm/funcs/mfa-verify-api-v1-auth-mfa-verify-post.js +83 -0
- package/esm/funcs/mfa-verify-api-v1-auth-mfa-verify-post.js.map +1 -0
- package/esm/funcs/oauth-callback-api-v1-auth-callback-post.d.ts +21 -0
- package/esm/funcs/oauth-callback-api-v1-auth-callback-post.d.ts.map +1 -0
- package/esm/funcs/oauth-callback-api-v1-auth-callback-post.js +82 -0
- package/esm/funcs/oauth-callback-api-v1-auth-callback-post.js.map +1 -0
- package/esm/funcs/patch-example-api-v1-examples-example-id-annotation-patch.d.ts +18 -0
- package/esm/funcs/patch-example-api-v1-examples-example-id-annotation-patch.d.ts.map +1 -0
- package/esm/funcs/patch-example-api-v1-examples-example-id-annotation-patch.js +91 -0
- package/esm/funcs/patch-example-api-v1-examples-example-id-annotation-patch.js.map +1 -0
- package/esm/funcs/read-badge-badge-get.d.ts +21 -0
- package/esm/funcs/read-badge-badge-get.d.ts.map +1 -0
- package/esm/funcs/read-badge-badge-get.js +85 -0
- package/esm/funcs/read-badge-badge-get.js.map +1 -0
- package/esm/funcs/refresh-token-api-v1-auth-token-refresh-post.d.ts +16 -0
- package/esm/funcs/refresh-token-api-v1-auth-token-refresh-post.d.ts.map +1 -0
- package/esm/funcs/refresh-token-api-v1-auth-token-refresh-post.js +64 -0
- package/esm/funcs/refresh-token-api-v1-auth-token-refresh-post.js.map +1 -0
- package/esm/funcs/register-api-v1-auth-register-post.d.ts +21 -0
- package/esm/funcs/register-api-v1-auth-register-post.d.ts.map +1 -0
- package/esm/funcs/register-api-v1-auth-register-post.js +82 -0
- package/esm/funcs/register-api-v1-auth-register-post.js.map +1 -0
- package/esm/funcs/root-get.d.ts +13 -0
- package/esm/funcs/root-get.d.ts.map +1 -0
- package/esm/funcs/root-get.js +61 -0
- package/esm/funcs/root-get.js.map +1 -0
- package/esm/funcs/slack-callback-api-v1-notifications-slack-callback-get.d.ts +15 -0
- package/esm/funcs/slack-callback-api-v1-notifications-slack-callback-get.d.ts.map +1 -0
- package/esm/funcs/slack-callback-api-v1-notifications-slack-callback-get.js +82 -0
- package/esm/funcs/slack-callback-api-v1-notifications-slack-callback-get.js.map +1 -0
- package/esm/funcs/slack-interactions-api-v1-notifications-slack-interactions-post.d.ts +16 -0
- package/esm/funcs/slack-interactions-api-v1-notifications-slack-interactions-post.d.ts.map +1 -0
- package/esm/funcs/slack-interactions-api-v1-notifications-slack-interactions-post.js +64 -0
- package/esm/funcs/slack-interactions-api-v1-notifications-slack-interactions-post.js.map +1 -0
- package/esm/funcs/start-batch-predictions-job-api-v1-jobs-batch-predictions-post.d.ts +35 -0
- package/esm/funcs/start-batch-predictions-job-api-v1-jobs-batch-predictions-post.d.ts.map +1 -0
- package/esm/funcs/start-batch-predictions-job-api-v1-jobs-batch-predictions-post.js +101 -0
- package/esm/funcs/start-batch-predictions-job-api-v1-jobs-batch-predictions-post.js.map +1 -0
- package/esm/funcs/start-confidence-score-job-api-v1-jobs-confidence-scores-post.d.ts +19 -0
- package/esm/funcs/start-confidence-score-job-api-v1-jobs-confidence-scores-post.d.ts.map +1 -0
- package/esm/funcs/start-confidence-score-job-api-v1-jobs-confidence-scores-post.js +85 -0
- package/esm/funcs/start-confidence-score-job-api-v1-jobs-confidence-scores-post.js.map +1 -0
- package/esm/funcs/start-optimization-job-api-v1-jobs-gepa-post.d.ts +23 -0
- package/esm/funcs/start-optimization-job-api-v1-jobs-gepa-post.d.ts.map +1 -0
- package/esm/funcs/start-optimization-job-api-v1-jobs-gepa-post.js +89 -0
- package/esm/funcs/start-optimization-job-api-v1-jobs-gepa-post.js.map +1 -0
- package/esm/funcs/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.d.ts +32 -0
- package/esm/funcs/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.d.ts.map +1 -0
- package/esm/funcs/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.js +104 -0
- package/esm/funcs/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.js.map +1 -0
- package/esm/funcs/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.d.ts +18 -0
- package/esm/funcs/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.d.ts.map +1 -0
- package/esm/funcs/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.js +90 -0
- package/esm/funcs/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.js.map +1 -0
- package/esm/funcs/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.d.ts +29 -0
- package/esm/funcs/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.d.ts.map +1 -0
- package/esm/funcs/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.js +101 -0
- package/esm/funcs/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.js.map +1 -0
- package/esm/funcs/update-arbiter-metadata-api-v1-arbiters-metadata-patch.d.ts +18 -0
- package/esm/funcs/update-arbiter-metadata-api-v1-arbiters-metadata-patch.d.ts.map +1 -0
- package/esm/funcs/update-arbiter-metadata-api-v1-arbiters-metadata-patch.js +84 -0
- package/esm/funcs/update-arbiter-metadata-api-v1-arbiters-metadata-patch.js.map +1 -0
- package/esm/funcs/validate-invite-code-api-v1-auth-validate-invite-code-post.d.ts +18 -0
- package/esm/funcs/validate-invite-code-api-v1-auth-validate-invite-code-post.d.ts.map +1 -0
- package/esm/funcs/validate-invite-code-api-v1-auth-validate-invite-code-post.js +79 -0
- package/esm/funcs/validate-invite-code-api-v1-auth-validate-invite-code-post.js.map +1 -0
- package/esm/funcs/webhooks-stripe-webhook-api-v1-payments-webhooks-stripe-post.d.ts +13 -0
- package/esm/funcs/webhooks-stripe-webhook-api-v1-payments-webhooks-stripe-post.d.ts.map +1 -0
- package/esm/funcs/webhooks-stripe-webhook-api-v1-payments-webhooks-stripe-post.js +61 -0
- package/esm/funcs/webhooks-stripe-webhook-api-v1-payments-webhooks-stripe-post.js.map +1 -0
- package/esm/git/push.d.ts +37 -0
- package/esm/git/push.d.ts.map +1 -0
- package/esm/git/push.js +113 -0
- package/esm/git/push.js.map +1 -0
- package/esm/hooks/hooks.d.ts +25 -0
- package/esm/hooks/hooks.d.ts.map +1 -0
- package/esm/hooks/hooks.js +80 -0
- package/esm/hooks/hooks.js.map +1 -0
- package/esm/hooks/index.d.ts +3 -0
- package/esm/hooks/index.d.ts.map +1 -0
- package/esm/hooks/index.js +6 -0
- package/esm/hooks/index.js.map +1 -0
- package/esm/hooks/types.d.ts +76 -0
- package/esm/hooks/types.d.ts.map +1 -0
- package/esm/hooks/types.js +5 -0
- package/esm/hooks/types.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +24 -0
- package/esm/index.js.map +1 -0
- package/esm/lib/base64.d.ts +10 -0
- package/esm/lib/base64.d.ts.map +1 -0
- package/esm/lib/base64.js +31 -0
- package/esm/lib/base64.js.map +1 -0
- package/esm/lib/config.d.ts +38 -0
- package/esm/lib/config.d.ts.map +1 -0
- package/esm/lib/config.js +31 -0
- package/esm/lib/config.js.map +1 -0
- package/esm/lib/dlv.d.ts +14 -0
- package/esm/lib/dlv.d.ts.map +1 -0
- package/esm/lib/dlv.js +46 -0
- package/esm/lib/dlv.js.map +1 -0
- package/esm/lib/encodings.d.ts +54 -0
- package/esm/lib/encodings.d.ts.map +1 -0
- package/esm/lib/encodings.js +391 -0
- package/esm/lib/encodings.js.map +1 -0
- package/esm/lib/env.d.ts +15 -0
- package/esm/lib/env.d.ts.map +1 -0
- package/esm/lib/env.js +44 -0
- package/esm/lib/env.js.map +1 -0
- package/esm/lib/files.d.ts +26 -0
- package/esm/lib/files.d.ts.map +1 -0
- package/esm/lib/files.js +91 -0
- package/esm/lib/files.js.map +1 -0
- package/esm/lib/http.d.ts +67 -0
- package/esm/lib/http.d.ts.map +1 -0
- package/esm/lib/http.js +209 -0
- package/esm/lib/http.js.map +1 -0
- package/esm/lib/is-plain-object.d.ts +2 -0
- package/esm/lib/is-plain-object.d.ts.map +1 -0
- package/esm/lib/is-plain-object.js +38 -0
- package/esm/lib/is-plain-object.js.map +1 -0
- package/esm/lib/logger.d.ts +6 -0
- package/esm/lib/logger.d.ts.map +1 -0
- package/esm/lib/logger.js +5 -0
- package/esm/lib/logger.js.map +1 -0
- package/esm/lib/matchers.d.ts +59 -0
- package/esm/lib/matchers.d.ts.map +1 -0
- package/esm/lib/matchers.js +202 -0
- package/esm/lib/matchers.js.map +1 -0
- package/esm/lib/primitives.d.ts +26 -0
- package/esm/lib/primitives.d.ts.map +1 -0
- package/esm/lib/primitives.js +103 -0
- package/esm/lib/primitives.js.map +1 -0
- package/esm/lib/retries.d.ts +38 -0
- package/esm/lib/retries.d.ts.map +1 -0
- package/esm/lib/retries.js +150 -0
- package/esm/lib/retries.js.map +1 -0
- package/esm/lib/schemas.d.ts +21 -0
- package/esm/lib/schemas.d.ts.map +1 -0
- package/esm/lib/schemas.js +57 -0
- package/esm/lib/schemas.js.map +1 -0
- package/esm/lib/sdks.d.ts +63 -0
- package/esm/lib/sdks.d.ts.map +1 -0
- package/esm/lib/sdks.js +260 -0
- package/esm/lib/sdks.js.map +1 -0
- package/esm/lib/security.d.ts +83 -0
- package/esm/lib/security.d.ts.map +1 -0
- package/esm/lib/security.js +149 -0
- package/esm/lib/security.js.map +1 -0
- package/esm/lib/url.d.ts +5 -0
- package/esm/lib/url.d.ts.map +1 -0
- package/esm/lib/url.js +24 -0
- package/esm/lib/url.js.map +1 -0
- package/esm/main.d.ts +3 -0
- package/esm/main.d.ts.map +1 -0
- package/esm/main.js +20 -0
- package/esm/main.js.map +1 -0
- package/esm/modaic/api.d.ts +48 -0
- package/esm/modaic/api.d.ts.map +1 -0
- package/esm/modaic/api.js +131 -0
- package/esm/modaic/api.js.map +1 -0
- package/esm/modaic/arbiter.d.ts +101 -0
- package/esm/modaic/arbiter.d.ts.map +1 -0
- package/esm/modaic/arbiter.js +161 -0
- package/esm/modaic/arbiter.js.map +1 -0
- package/esm/modaic/git.d.ts +59 -0
- package/esm/modaic/git.d.ts.map +1 -0
- package/esm/modaic/git.js +193 -0
- package/esm/modaic/git.js.map +1 -0
- package/esm/modaic/index.d.ts +19 -0
- package/esm/modaic/index.d.ts.map +1 -0
- package/esm/modaic/index.js +19 -0
- package/esm/modaic/index.js.map +1 -0
- package/esm/modaic/runtime.d.ts +51 -0
- package/esm/modaic/runtime.d.ts.map +1 -0
- package/esm/modaic/runtime.js +88 -0
- package/esm/modaic/runtime.js.map +1 -0
- package/esm/modaic/serialization.d.ts +197 -0
- package/esm/modaic/serialization.d.ts.map +1 -0
- package/esm/modaic/serialization.js +389 -0
- package/esm/modaic/serialization.js.map +1 -0
- package/esm/modaic/signatures.d.ts +135 -0
- package/esm/modaic/signatures.d.ts.map +1 -0
- package/esm/modaic/signatures.js +290 -0
- package/esm/modaic/signatures.js.map +1 -0
- package/esm/models/annotate-example-request.d.ts +16 -0
- package/esm/models/annotate-example-request.d.ts.map +1 -0
- package/esm/models/annotate-example-request.js +13 -0
- package/esm/models/annotate-example-request.js.map +1 -0
- package/esm/models/arbiter-request.d.ts +18 -0
- package/esm/models/arbiter-request.d.ts.map +1 -0
- package/esm/models/arbiter-request.js +23 -0
- package/esm/models/arbiter-request.js.map +1 -0
- package/esm/models/batch-arbiter.d.ts +14 -0
- package/esm/models/batch-arbiter.d.ts.map +1 -0
- package/esm/models/batch-arbiter.js +19 -0
- package/esm/models/batch-arbiter.js.map +1 -0
- package/esm/models/batch-example.d.ts +51 -0
- package/esm/models/batch-example.d.ts.map +1 -0
- package/esm/models/batch-example.js +30 -0
- package/esm/models/batch-example.js.map +1 -0
- package/esm/models/batch-predictions-job-request.d.ts +30 -0
- package/esm/models/batch-predictions-job-request.d.ts.map +1 -0
- package/esm/models/batch-predictions-job-request.js +23 -0
- package/esm/models/batch-predictions-job-request.js.map +1 -0
- package/esm/models/chat-completion-choice.d.ts +13 -0
- package/esm/models/chat-completion-choice.d.ts.map +1 -0
- package/esm/models/chat-completion-choice.js +22 -0
- package/esm/models/chat-completion-choice.js.map +1 -0
- package/esm/models/chat-completion-request.d.ts +45 -0
- package/esm/models/chat-completion-request.d.ts.map +1 -0
- package/esm/models/chat-completion-request.js +39 -0
- package/esm/models/chat-completion-request.js.map +1 -0
- package/esm/models/chat-completion-response.d.ts +18 -0
- package/esm/models/chat-completion-response.d.ts.map +1 -0
- package/esm/models/chat-completion-response.js +27 -0
- package/esm/models/chat-completion-response.js.map +1 -0
- package/esm/models/chat-message.d.ts +27 -0
- package/esm/models/chat-message.d.ts.map +1 -0
- package/esm/models/chat-message.js +37 -0
- package/esm/models/chat-message.js.map +1 -0
- package/esm/models/completion-usage.d.ts +12 -0
- package/esm/models/completion-usage.d.ts.map +1 -0
- package/esm/models/completion-usage.js +23 -0
- package/esm/models/completion-usage.js.map +1 -0
- package/esm/models/confidence-score-job-request.d.ts +12 -0
- package/esm/models/confidence-score-job-request.d.ts.map +1 -0
- package/esm/models/confidence-score-job-request.js +17 -0
- package/esm/models/confidence-score-job-request.js.map +1 -0
- package/esm/models/confidence-status-response.d.ts +22 -0
- package/esm/models/confidence-status-response.d.ts.map +1 -0
- package/esm/models/confidence-status-response.js +30 -0
- package/esm/models/confidence-status-response.js.map +1 -0
- package/esm/models/delete-examples-request.d.ts +17 -0
- package/esm/models/delete-examples-request.d.ts.map +1 -0
- package/esm/models/delete-examples-request.js +19 -0
- package/esm/models/delete-examples-request.js.map +1 -0
- package/esm/models/dispatch-prediction-request.d.ts +33 -0
- package/esm/models/dispatch-prediction-request.d.ts.map +1 -0
- package/esm/models/dispatch-prediction-request.js +21 -0
- package/esm/models/dispatch-prediction-request.js.map +1 -0
- package/esm/models/errors/http-client-errors.d.ts +44 -0
- package/esm/models/errors/http-client-errors.d.ts.map +1 -0
- package/esm/models/errors/http-client-errors.js +56 -0
- package/esm/models/errors/http-client-errors.js.map +1 -0
- package/esm/models/errors/http-validation-error.d.ts +19 -0
- package/esm/models/errors/http-validation-error.d.ts.map +1 -0
- package/esm/models/errors/http-validation-error.js +36 -0
- package/esm/models/errors/http-validation-error.js.map +1 -0
- package/esm/models/errors/index.d.ts +7 -0
- package/esm/models/errors/index.d.ts.map +1 -0
- package/esm/models/errors/index.js +10 -0
- package/esm/models/errors/index.js.map +1 -0
- package/esm/models/errors/modaic-client-default-error.d.ts +10 -0
- package/esm/models/errors/modaic-client-default-error.d.ts.map +1 -0
- package/esm/models/errors/modaic-client-default-error.js +30 -0
- package/esm/models/errors/modaic-client-default-error.js.map +1 -0
- package/esm/models/errors/modaic-client-error.d.ts +19 -0
- package/esm/models/errors/modaic-client-error.d.ts.map +1 -0
- package/esm/models/errors/modaic-client-error.js +26 -0
- package/esm/models/errors/modaic-client-error.js.map +1 -0
- package/esm/models/errors/modaic-default-error.d.ts +10 -0
- package/esm/models/errors/modaic-default-error.d.ts.map +1 -0
- package/esm/models/errors/modaic-default-error.js +30 -0
- package/esm/models/errors/modaic-default-error.js.map +1 -0
- package/esm/models/errors/modaic-error.d.ts +19 -0
- package/esm/models/errors/modaic-error.d.ts.map +1 -0
- package/esm/models/errors/modaic-error.js +26 -0
- package/esm/models/errors/modaic-error.js.map +1 -0
- package/esm/models/errors/response-validation-error.d.ts +26 -0
- package/esm/models/errors/response-validation-error.d.ts.map +1 -0
- package/esm/models/errors/response-validation-error.js +37 -0
- package/esm/models/errors/response-validation-error.js.map +1 -0
- package/esm/models/errors/sdk-validation-error.d.ts +21 -0
- package/esm/models/errors/sdk-validation-error.d.ts.map +1 -0
- package/esm/models/errors/sdk-validation-error.js +52 -0
- package/esm/models/errors/sdk-validation-error.js.map +1 -0
- package/esm/models/export-examples-request.d.ts +15 -0
- package/esm/models/export-examples-request.d.ts.map +1 -0
- package/esm/models/export-examples-request.js +17 -0
- package/esm/models/export-examples-request.js.map +1 -0
- package/esm/models/export-examples-response.d.ts +17 -0
- package/esm/models/export-examples-response.d.ts.map +1 -0
- package/esm/models/export-examples-response.js +27 -0
- package/esm/models/export-examples-response.js.map +1 -0
- package/esm/models/field-schema.d.ts +26 -0
- package/esm/models/field-schema.d.ts.map +1 -0
- package/esm/models/field-schema.js +23 -0
- package/esm/models/field-schema.js.map +1 -0
- package/esm/models/gepa-job-request.d.ts +21 -0
- package/esm/models/gepa-job-request.d.ts.map +1 -0
- package/esm/models/gepa-job-request.js +26 -0
- package/esm/models/gepa-job-request.js.map +1 -0
- package/esm/models/gepa-job-response.d.ts +37 -0
- package/esm/models/gepa-job-response.d.ts.map +1 -0
- package/esm/models/gepa-job-response.js +44 -0
- package/esm/models/gepa-job-response.js.map +1 -0
- package/esm/models/gepa-kwargs.d.ts +64 -0
- package/esm/models/gepa-kwargs.d.ts.map +1 -0
- package/esm/models/gepa-kwargs.js +59 -0
- package/esm/models/gepa-kwargs.js.map +1 -0
- package/esm/models/get-confidence-request.d.ts +20 -0
- package/esm/models/get-confidence-request.d.ts.map +1 -0
- package/esm/models/get-confidence-request.js +20 -0
- package/esm/models/get-confidence-request.js.map +1 -0
- package/esm/models/index.d.ts +33 -0
- package/esm/models/index.d.ts.map +1 -0
- package/esm/models/index.js +36 -0
- package/esm/models/index.js.map +1 -0
- package/esm/models/init-arbiter-request.d.ts +23 -0
- package/esm/models/init-arbiter-request.d.ts.map +1 -0
- package/esm/models/init-arbiter-request.js +23 -0
- package/esm/models/init-arbiter-request.js.map +1 -0
- package/esm/models/lm.d.ts +18 -0
- package/esm/models/lm.d.ts.map +1 -0
- package/esm/models/lm.js +13 -0
- package/esm/models/lm.js.map +1 -0
- package/esm/models/login-request.d.ts +16 -0
- package/esm/models/login-request.d.ts.map +1 -0
- package/esm/models/login-request.js +14 -0
- package/esm/models/login-request.js.map +1 -0
- package/esm/models/mfa-verify-request.d.ts +16 -0
- package/esm/models/mfa-verify-request.d.ts.map +1 -0
- package/esm/models/mfa-verify-request.js +20 -0
- package/esm/models/mfa-verify-request.js.map +1 -0
- package/esm/models/o-auth-callback-request.d.ts +16 -0
- package/esm/models/o-auth-callback-request.d.ts.map +1 -0
- package/esm/models/o-auth-callback-request.js +21 -0
- package/esm/models/o-auth-callback-request.js.map +1 -0
- package/esm/models/operations/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.d.ts +12 -0
- package/esm/models/operations/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.d.ts.map +1 -0
- package/esm/models/operations/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.js +18 -0
- package/esm/models/operations/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.js.map +1 -0
- package/esm/models/operations/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.d.ts +12 -0
- package/esm/models/operations/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.d.ts.map +1 -0
- package/esm/models/operations/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.js +18 -0
- package/esm/models/operations/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.js.map +1 -0
- package/esm/models/operations/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.d.ts +12 -0
- package/esm/models/operations/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.d.ts.map +1 -0
- package/esm/models/operations/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.js +17 -0
- package/esm/models/operations/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.js.map +1 -0
- package/esm/models/operations/check-email-api-v1-user-check-email-get.d.ts +12 -0
- package/esm/models/operations/check-email-api-v1-user-check-email-get.d.ts.map +1 -0
- package/esm/models/operations/check-email-api-v1-user-check-email-get.js +12 -0
- package/esm/models/operations/check-email-api-v1-user-check-email-get.js.map +1 -0
- package/esm/models/operations/check-username-api-v1-user-check-username-username-get.d.ts +12 -0
- package/esm/models/operations/check-username-api-v1-user-check-username-username-get.d.ts.map +1 -0
- package/esm/models/operations/check-username-api-v1-user-check-username-username-get.js +12 -0
- package/esm/models/operations/check-username-api-v1-user-check-username-username-get.js.map +1 -0
- package/esm/models/operations/download-export-api-v1-examples-export-download-get.d.ts +14 -0
- package/esm/models/operations/download-export-api-v1-examples-export-download-get.d.ts.map +1 -0
- package/esm/models/operations/download-export-api-v1-examples-export-download-get.js +19 -0
- package/esm/models/operations/download-export-api-v1-examples-export-download-get.js.map +1 -0
- package/esm/models/operations/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.d.ts +12 -0
- package/esm/models/operations/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.d.ts.map +1 -0
- package/esm/models/operations/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.js +18 -0
- package/esm/models/operations/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.js.map +1 -0
- package/esm/models/operations/get-arbiter-api-v1-arbiters-get.d.ts +12 -0
- package/esm/models/operations/get-arbiter-api-v1-arbiters-get.d.ts.map +1 -0
- package/esm/models/operations/get-arbiter-api-v1-arbiters-get.js +12 -0
- package/esm/models/operations/get-arbiter-api-v1-arbiters-get.js.map +1 -0
- package/esm/models/operations/get-arbiter-schema-output-api-v1-arbiters-schema-get.d.ts +12 -0
- package/esm/models/operations/get-arbiter-schema-output-api-v1-arbiters-schema-get.d.ts.map +1 -0
- package/esm/models/operations/get-arbiter-schema-output-api-v1-arbiters-schema-get.js +12 -0
- package/esm/models/operations/get-arbiter-schema-output-api-v1-arbiters-schema-get.js.map +1 -0
- package/esm/models/operations/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.d.ts +12 -0
- package/esm/models/operations/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.d.ts.map +1 -0
- package/esm/models/operations/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.js +18 -0
- package/esm/models/operations/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.js.map +1 -0
- package/esm/models/operations/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.d.ts +12 -0
- package/esm/models/operations/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.d.ts.map +1 -0
- package/esm/models/operations/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.js +18 -0
- package/esm/models/operations/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.js.map +1 -0
- package/esm/models/operations/get-distinct-hashes-api-v1-examples-distinct-hashes-get.d.ts +14 -0
- package/esm/models/operations/get-distinct-hashes-api-v1-examples-distinct-hashes-get.d.ts.map +1 -0
- package/esm/models/operations/get-distinct-hashes-api-v1-examples-distinct-hashes-get.js +13 -0
- package/esm/models/operations/get-distinct-hashes-api-v1-examples-distinct-hashes-get.js.map +1 -0
- package/esm/models/operations/get-example-by-id-api-v1-examples-example-id-get.d.ts +15 -0
- package/esm/models/operations/get-example-by-id-api-v1-examples-example-id-get.d.ts.map +1 -0
- package/esm/models/operations/get-example-by-id-api-v1-examples-example-id-get.js +17 -0
- package/esm/models/operations/get-example-by-id-api-v1-examples-example-id-get.js.map +1 -0
- package/esm/models/operations/get-graded-count-api-v1-examples-graded-count-get.d.ts +14 -0
- package/esm/models/operations/get-graded-count-api-v1-examples-graded-count-get.d.ts.map +1 -0
- package/esm/models/operations/get-graded-count-api-v1-examples-graded-count-get.js +13 -0
- package/esm/models/operations/get-graded-count-api-v1-examples-graded-count-get.js.map +1 -0
- package/esm/models/operations/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.d.ts +12 -0
- package/esm/models/operations/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.d.ts.map +1 -0
- package/esm/models/operations/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.js +17 -0
- package/esm/models/operations/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.js.map +1 -0
- package/esm/models/operations/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.d.ts +12 -0
- package/esm/models/operations/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.d.ts.map +1 -0
- package/esm/models/operations/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.js +17 -0
- package/esm/models/operations/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.js.map +1 -0
- package/esm/models/operations/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.d.ts +12 -0
- package/esm/models/operations/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.d.ts.map +1 -0
- package/esm/models/operations/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.js +18 -0
- package/esm/models/operations/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.js.map +1 -0
- package/esm/models/operations/get-user-by-id-api-v1-user-user-id-get.d.ts +12 -0
- package/esm/models/operations/get-user-by-id-api-v1-user-user-id-get.d.ts.map +1 -0
- package/esm/models/operations/get-user-by-id-api-v1-user-user-id-get.js +12 -0
- package/esm/models/operations/get-user-by-id-api-v1-user-user-id-get.js.map +1 -0
- package/esm/models/operations/get-user-by-id-api-v2-users-id-user-id-get.d.ts +12 -0
- package/esm/models/operations/get-user-by-id-api-v2-users-id-user-id-get.d.ts.map +1 -0
- package/esm/models/operations/get-user-by-id-api-v2-users-id-user-id-get.js +17 -0
- package/esm/models/operations/get-user-by-id-api-v2-users-id-user-id-get.js.map +1 -0
- package/esm/models/operations/get-user-by-username-api-v1-user-username-username-get.d.ts +12 -0
- package/esm/models/operations/get-user-by-username-api-v1-user-username-username-get.d.ts.map +1 -0
- package/esm/models/operations/get-user-by-username-api-v1-user-username-username-get.js +12 -0
- package/esm/models/operations/get-user-by-username-api-v1-user-username-username-get.js.map +1 -0
- package/esm/models/operations/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.d.ts +14 -0
- package/esm/models/operations/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.d.ts.map +1 -0
- package/esm/models/operations/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.js +14 -0
- package/esm/models/operations/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.js.map +1 -0
- package/esm/models/operations/index.d.ts +22 -0
- package/esm/models/operations/index.d.ts.map +1 -0
- package/esm/models/operations/index.js +25 -0
- package/esm/models/operations/index.js.map +1 -0
- package/esm/models/operations/list-examples-api-v1-examples-get.d.ts +71 -0
- package/esm/models/operations/list-examples-api-v1-examples-get.d.ts.map +1 -0
- package/esm/models/operations/list-examples-api-v1-examples-get.js +46 -0
- package/esm/models/operations/list-examples-api-v1-examples-get.js.map +1 -0
- package/esm/models/operations/patch-example-api-v1-examples-example-id-annotation-patch.d.ts +18 -0
- package/esm/models/operations/patch-example-api-v1-examples-example-id-annotation-patch.d.ts.map +1 -0
- package/esm/models/operations/patch-example-api-v1-examples-example-id-annotation-patch.js +20 -0
- package/esm/models/operations/patch-example-api-v1-examples-example-id-annotation-patch.js.map +1 -0
- package/esm/models/operations/read-badge-badge-get.d.ts +14 -0
- package/esm/models/operations/read-badge-badge-get.d.ts.map +1 -0
- package/esm/models/operations/read-badge-badge-get.js +13 -0
- package/esm/models/operations/read-badge-badge-get.js.map +1 -0
- package/esm/models/operations/slack-callback-api-v1-notifications-slack-callback-get.d.ts +16 -0
- package/esm/models/operations/slack-callback-api-v1-notifications-slack-callback-get.d.ts.map +1 -0
- package/esm/models/operations/slack-callback-api-v1-notifications-slack-callback-get.js +14 -0
- package/esm/models/operations/slack-callback-api-v1-notifications-slack-callback-get.js.map +1 -0
- package/esm/models/operations/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.d.ts +12 -0
- package/esm/models/operations/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.d.ts.map +1 -0
- package/esm/models/operations/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.js +18 -0
- package/esm/models/operations/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.js.map +1 -0
- package/esm/models/operations/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.d.ts +12 -0
- package/esm/models/operations/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.d.ts.map +1 -0
- package/esm/models/operations/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.js +18 -0
- package/esm/models/operations/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.js.map +1 -0
- package/esm/models/operations/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.d.ts +12 -0
- package/esm/models/operations/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.d.ts.map +1 -0
- package/esm/models/operations/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.js +18 -0
- package/esm/models/operations/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.js.map +1 -0
- package/esm/models/paginated-page.d.ts +16 -0
- package/esm/models/paginated-page.d.ts.map +1 -0
- package/esm/models/paginated-page.js +27 -0
- package/esm/models/paginated-page.js.map +1 -0
- package/esm/models/predict-example-response.d.ts +18 -0
- package/esm/models/predict-example-response.d.ts.map +1 -0
- package/esm/models/predict-example-response.js +24 -0
- package/esm/models/predict-example-response.js.map +1 -0
- package/esm/models/predicted-example.d.ts +58 -0
- package/esm/models/predicted-example.d.ts.map +1 -0
- package/esm/models/predicted-example.js +56 -0
- package/esm/models/predicted-example.js.map +1 -0
- package/esm/models/prediction-annotation.d.ts +19 -0
- package/esm/models/prediction-annotation.d.ts.map +1 -0
- package/esm/models/prediction-annotation.js +21 -0
- package/esm/models/prediction-annotation.js.map +1 -0
- package/esm/models/register-request.d.ts +22 -0
- package/esm/models/register-request.d.ts.map +1 -0
- package/esm/models/register-request.js +17 -0
- package/esm/models/register-request.js.map +1 -0
- package/esm/models/security.d.ts +12 -0
- package/esm/models/security.d.ts.map +1 -0
- package/esm/models/security.js +12 -0
- package/esm/models/security.js.map +1 -0
- package/esm/models/src-api-v1-arbiters-schemas-predict-example-request.d.ts +21 -0
- package/esm/models/src-api-v1-arbiters-schemas-predict-example-request.d.ts.map +1 -0
- package/esm/models/src-api-v1-arbiters-schemas-predict-example-request.js +20 -0
- package/esm/models/src-api-v1-arbiters-schemas-predict-example-request.js.map +1 -0
- package/esm/models/src-api-v2-arbiters-schemas-predict-example-request.d.ts +41 -0
- package/esm/models/src-api-v2-arbiters-schemas-predict-example-request.d.ts.map +1 -0
- package/esm/models/src-api-v2-arbiters-schemas-predict-example-request.js +28 -0
- package/esm/models/src-api-v2-arbiters-schemas-predict-example-request.js.map +1 -0
- package/esm/models/update-arbiter-metadata-request.d.ts +18 -0
- package/esm/models/update-arbiter-metadata-request.d.ts.map +1 -0
- package/esm/models/update-arbiter-metadata-request.js +13 -0
- package/esm/models/update-arbiter-metadata-request.js.map +1 -0
- package/esm/models/validate-invite-code-request.d.ts +12 -0
- package/esm/models/validate-invite-code-request.d.ts.map +1 -0
- package/esm/models/validate-invite-code-request.js +12 -0
- package/esm/models/validate-invite-code-request.js.map +1 -0
- package/esm/models/validation-error.d.ts +22 -0
- package/esm/models/validation-error.d.ts.map +1 -0
- package/esm/models/validation-error.js +32 -0
- package/esm/models/validation-error.js.map +1 -0
- package/esm/models/waitlist-request.d.ts +16 -0
- package/esm/models/waitlist-request.d.ts.map +1 -0
- package/esm/models/waitlist-request.js +14 -0
- package/esm/models/waitlist-request.js.map +1 -0
- package/esm/primitives/module.d.ts +44 -0
- package/esm/primitives/module.d.ts.map +1 -0
- package/esm/primitives/module.js +117 -0
- package/esm/primitives/module.js.map +1 -0
- package/esm/programs/predict.d.ts +65 -0
- package/esm/programs/predict.d.ts.map +1 -0
- package/esm/programs/predict.js +73 -0
- package/esm/programs/predict.js.map +1 -0
- package/esm/sdk/index.d.ts +2 -0
- package/esm/sdk/index.d.ts.map +1 -0
- package/esm/sdk/index.js +5 -0
- package/esm/sdk/index.js.map +1 -0
- package/esm/sdk/sdk.d.ts +325 -0
- package/esm/sdk/sdk.d.ts.map +1 -0
- package/esm/sdk/sdk.js +431 -0
- package/esm/sdk/sdk.js.map +1 -0
- package/esm/sdk/webhooks.d.ts +8 -0
- package/esm/sdk/webhooks.d.ts.map +1 -0
- package/esm/sdk/webhooks.js +15 -0
- package/esm/sdk/webhooks.js.map +1 -0
- package/esm/serialization/config.d.ts +79 -0
- package/esm/serialization/config.d.ts.map +1 -0
- package/esm/serialization/config.js +57 -0
- package/esm/serialization/config.js.map +1 -0
- package/esm/serialization/naming.d.ts +14 -0
- package/esm/serialization/naming.d.ts.map +1 -0
- package/esm/serialization/naming.js +21 -0
- package/esm/serialization/naming.js.map +1 -0
- package/esm/serialization/program.d.ts +45 -0
- package/esm/serialization/program.d.ts.map +1 -0
- package/esm/serialization/program.js +30 -0
- package/esm/serialization/program.js.map +1 -0
- package/esm/serialization/zod_schema.d.ts +33 -0
- package/esm/serialization/zod_schema.d.ts.map +1 -0
- package/esm/serialization/zod_schema.js +269 -0
- package/esm/serialization/zod_schema.js.map +1 -0
- package/esm/signatures/signature.d.ts +68 -0
- package/esm/signatures/signature.d.ts.map +1 -0
- package/esm/signatures/signature.js +222 -0
- package/esm/signatures/signature.js.map +1 -0
- package/esm/signatures/types.d.ts +69 -0
- package/esm/signatures/types.d.ts.map +1 -0
- package/esm/signatures/types.js +68 -0
- package/esm/signatures/types.js.map +1 -0
- package/esm/types/async.d.ts +23 -0
- package/esm/types/async.d.ts.map +1 -0
- package/esm/types/async.js +28 -0
- package/esm/types/async.js.map +1 -0
- package/esm/types/blobs.d.ts +4 -0
- package/esm/types/blobs.d.ts.map +1 -0
- package/esm/types/blobs.js +25 -0
- package/esm/types/blobs.js.map +1 -0
- package/esm/types/const-date-time.d.ts +3 -0
- package/esm/types/const-date-time.d.ts.map +1 -0
- package/esm/types/const-date-time.js +10 -0
- package/esm/types/const-date-time.js.map +1 -0
- package/esm/types/default-to-zero-value.d.ts +12 -0
- package/esm/types/default-to-zero-value.d.ts.map +1 -0
- package/esm/types/default-to-zero-value.js +31 -0
- package/esm/types/default-to-zero-value.js.map +1 -0
- package/esm/types/enums.d.ts +9 -0
- package/esm/types/enums.d.ts.map +1 -0
- package/esm/types/enums.js +27 -0
- package/esm/types/enums.js.map +1 -0
- package/esm/types/fp.d.ts +31 -0
- package/esm/types/fp.d.ts.map +1 -0
- package/esm/types/fp.js +31 -0
- package/esm/types/fp.js.map +1 -0
- package/esm/types/index.d.ts +10 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +10 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/operations.d.ts +27 -0
- package/esm/types/operations.d.ts.map +1 -0
- package/esm/types/operations.js +77 -0
- package/esm/types/operations.js.map +1 -0
- package/esm/types/primitives.d.ts +9 -0
- package/esm/types/primitives.d.ts.map +1 -0
- package/esm/types/primitives.js +109 -0
- package/esm/types/primitives.js.map +1 -0
- package/esm/types/rfcdate.d.ts +21 -0
- package/esm/types/rfcdate.d.ts.map +1 -0
- package/esm/types/rfcdate.js +43 -0
- package/esm/types/rfcdate.js.map +1 -0
- package/esm/types/smart-union.d.ts +7 -0
- package/esm/types/smart-union.d.ts.map +1 -0
- package/esm/types/smart-union.js +117 -0
- package/esm/types/smart-union.js.map +1 -0
- package/esm/types/streams.d.ts +2 -0
- package/esm/types/streams.d.ts.map +1 -0
- package/esm/types/streams.js +15 -0
- package/esm/types/streams.js.map +1 -0
- package/esm/types/unrecognized.d.ts +16 -0
- package/esm/types/unrecognized.d.ts.map +1 -0
- package/esm/types/unrecognized.js +31 -0
- package/esm/types/unrecognized.js.map +1 -0
- package/jsr.json +27 -0
- package/package.json +77 -0
- package/src/core.ts +13 -0
- package/src/funcs/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.ts +189 -0
- package/src/funcs/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.ts +187 -0
- package/src/funcs/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.ts +187 -0
- package/src/funcs/create-chat-completion-api-v1-arbiters-chat-completions-post.ts +169 -0
- package/src/funcs/create-chat-completion-api-v1-chat-completions-post.ts +150 -0
- package/src/funcs/create-prediction-api-v1-arbiters-predictions-post.ts +173 -0
- package/src/funcs/create-prediction-api-v2-arbiters-predictions-post.ts +181 -0
- package/src/funcs/delete-examples-api-v1-examples-delete.ts +172 -0
- package/src/funcs/dispatch-prediction-api-v1-arbiters-predictions-dispatch-post.ts +170 -0
- package/src/funcs/download-export-api-v1-examples-export-download-get.ts +182 -0
- package/src/funcs/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.ts +192 -0
- package/src/funcs/export-examples-api-v1-examples-export-post.ts +172 -0
- package/src/funcs/get-arbiter-api-v1-arbiters-get.ts +177 -0
- package/src/funcs/get-arbiter-schema-output-api-v1-arbiters-schema-get.ts +178 -0
- package/src/funcs/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.ts +198 -0
- package/src/funcs/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.ts +187 -0
- package/src/funcs/get-distinct-hashes-api-v1-examples-distinct-hashes-get.ts +183 -0
- package/src/funcs/get-example-by-id-api-v1-examples-example-id-get.ts +180 -0
- package/src/funcs/get-graded-count-api-v1-examples-graded-count-get.ts +182 -0
- package/src/funcs/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.ts +185 -0
- package/src/funcs/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.ts +189 -0
- package/src/funcs/get-prediction-confidence-api-v1-arbiters-predictions-confidence-post.ts +179 -0
- package/src/funcs/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.ts +191 -0
- package/src/funcs/get-supported-models-api-v1-arbiters-supported-models-get.ts +141 -0
- package/src/funcs/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.ts +185 -0
- package/src/funcs/ingest-examples-api-v1-examples-post.ts +150 -0
- package/src/funcs/init-arbiter-api-v1-arbiters-post.ts +169 -0
- package/src/funcs/list-examples-api-v1-examples-get.ts +193 -0
- package/src/funcs/patch-example-api-v1-examples-example-id-annotation-patch.ts +185 -0
- package/src/funcs/start-batch-predictions-job-api-v1-jobs-batch-predictions-post.ts +190 -0
- package/src/funcs/start-confidence-score-job-api-v1-jobs-confidence-scores-post.ts +174 -0
- package/src/funcs/start-optimization-job-api-v1-jobs-gepa-post.ts +177 -0
- package/src/funcs/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.ts +201 -0
- package/src/funcs/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.ts +187 -0
- package/src/funcs/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.ts +198 -0
- package/src/funcs/update-arbiter-metadata-api-v1-arbiters-metadata-patch.ts +173 -0
- package/src/hooks/hooks.ts +129 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/types.ts +107 -0
- package/src/index.ts +26 -0
- package/src/lib/base64.ts +39 -0
- package/src/lib/config.ts +64 -0
- package/src/lib/dlv.ts +53 -0
- package/src/lib/encodings.ts +529 -0
- package/src/lib/env.ts +57 -0
- package/src/lib/files.ts +104 -0
- package/src/lib/http.ts +323 -0
- package/src/lib/is-plain-object.ts +43 -0
- package/src/lib/logger.ts +9 -0
- package/src/lib/matchers.ts +356 -0
- package/src/lib/primitives.ts +150 -0
- package/src/lib/retries.ts +218 -0
- package/src/lib/schemas.ts +94 -0
- package/src/lib/sdks.ts +405 -0
- package/src/lib/security.ts +275 -0
- package/src/lib/url.ts +35 -0
- package/src/modaic/arbiter.ts +252 -0
- package/src/modaic/git.ts +267 -0
- package/src/modaic/index.ts +61 -0
- package/src/modaic/runtime.ts +107 -0
- package/src/modaic/serialization.ts +592 -0
- package/src/modaic/signatures.ts +398 -0
- package/src/models/annotate-example-request.ts +38 -0
- package/src/models/arbiter-request.ts +46 -0
- package/src/models/batch-arbiter.ts +38 -0
- package/src/models/batch-example.ts +75 -0
- package/src/models/batch-predictions-job-request.ts +68 -0
- package/src/models/chat-completion-choice.ts +44 -0
- package/src/models/chat-completion-request.ts +94 -0
- package/src/models/chat-completion-response.ts +59 -0
- package/src/models/chat-message.ts +73 -0
- package/src/models/completion-usage.ts +45 -0
- package/src/models/confidence-score-job-request.ts +38 -0
- package/src/models/confidence-status-response.ts +62 -0
- package/src/models/delete-examples-request.ts +45 -0
- package/src/models/dispatch-prediction-request.ts +58 -0
- package/src/models/errors/http-client-errors.ts +62 -0
- package/src/models/errors/http-validation-error.ts +53 -0
- package/src/models/errors/index.ts +10 -0
- package/src/models/errors/modaic-client-default-error.ts +40 -0
- package/src/models/errors/modaic-client-error.ts +35 -0
- package/src/models/errors/response-validation-error.ts +50 -0
- package/src/models/errors/sdk-validation-error.ts +54 -0
- package/src/models/export-examples-request.ts +41 -0
- package/src/models/export-examples-response.ts +54 -0
- package/src/models/field-schema.ts +50 -0
- package/src/models/gepa-job-request.ts +55 -0
- package/src/models/gepa-job-response.ts +79 -0
- package/src/models/gepa-kwargs.ts +122 -0
- package/src/models/get-confidence-request.ts +45 -0
- package/src/models/index.ts +36 -0
- package/src/models/init-arbiter-request.ts +58 -0
- package/src/models/lm.ts +26 -0
- package/src/models/operations/cancel-batch-predictions-job-api-v1-jobs-batch-predictions-job-id-delete.ts +45 -0
- package/src/models/operations/cancel-confidence-score-job-api-v1-jobs-confidence-scores-job-id-delete.ts +45 -0
- package/src/models/operations/cancel-optimization-job-api-v1-jobs-gepa-job-id-delete.ts +42 -0
- package/src/models/operations/download-export-api-v1-examples-export-download-get.ts +46 -0
- package/src/models/operations/enqueue-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-post.ts +45 -0
- package/src/models/operations/get-arbiter-api-v1-arbiters-get.ts +32 -0
- package/src/models/operations/get-arbiter-schema-output-api-v1-arbiters-schema-get.ts +34 -0
- package/src/models/operations/get-batch-predictions-job-status-api-v1-jobs-batch-predictions-job-id-get.ts +45 -0
- package/src/models/operations/get-confidence-score-job-status-api-v1-jobs-confidence-scores-job-id-get.ts +45 -0
- package/src/models/operations/get-distinct-hashes-api-v1-examples-distinct-hashes-get.ts +37 -0
- package/src/models/operations/get-example-by-id-api-v1-examples-example-id-get.ts +45 -0
- package/src/models/operations/get-graded-count-api-v1-examples-graded-count-get.ts +37 -0
- package/src/models/operations/get-optimization-job-logs-api-v1-jobs-gepa-job-id-logs-get.ts +42 -0
- package/src/models/operations/get-optimization-job-status-api-v1-jobs-gepa-job-id-get.ts +42 -0
- package/src/models/operations/get-prediction-confidence-status-api-v1-arbiters-predictions-prediction-id-confidence-get.ts +45 -0
- package/src/models/operations/has-uncalibrated-predictions-api-v1-examples-has-uncalibrated-get.ts +37 -0
- package/src/models/operations/index.ts +25 -0
- package/src/models/operations/list-examples-api-v1-examples-get.ts +121 -0
- package/src/models/operations/patch-example-api-v1-examples-example-id-annotation-patch.ts +49 -0
- package/src/models/operations/stream-batch-predictions-events-api-v1-jobs-batch-predictions-job-id-events-get.ts +45 -0
- package/src/models/operations/stream-batch-predictions-results-api-v1-jobs-batch-predictions-job-id-results-get.ts +45 -0
- package/src/models/operations/stream-prediction-confidence-api-v1-arbiters-predictions-prediction-id-confidence-stream-get.ts +45 -0
- package/src/models/paginated-page.ts +55 -0
- package/src/models/predict-example-response.ts +48 -0
- package/src/models/predicted-example.ts +124 -0
- package/src/models/prediction-annotation.ts +49 -0
- package/src/models/security.ts +26 -0
- package/src/models/src-api-v1-arbiters-schemas-predict-example-request.ts +53 -0
- package/src/models/src-api-v2-arbiters-schemas-predict-example-request.ts +74 -0
- package/src/models/update-arbiter-metadata-request.ts +35 -0
- package/src/models/validation-error.ts +75 -0
- package/src/sdk/index.ts +5 -0
- package/src/sdk/sdk.ts +750 -0
- package/src/types/async.ts +69 -0
- package/src/types/blobs.ts +33 -0
- package/src/types/const-date-time.ts +15 -0
- package/src/types/default-to-zero-value.ts +33 -0
- package/src/types/enums.ts +45 -0
- package/src/types/fp.ts +50 -0
- package/src/types/index.ts +13 -0
- package/src/types/operations.ts +105 -0
- package/src/types/primitives.ts +140 -0
- package/src/types/rfcdate.ts +54 -0
- package/src/types/smart-union.ts +153 -0
- package/src/types/streams.ts +21 -0
- package/src/types/unrecognized.ts +35 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { getApiUrl, getGitUrl } from "./runtime.js";
|
|
2
|
+
import { AuthenticationError, ModaicError, RepositoryExistsError, } from "./runtime.js";
|
|
3
|
+
/** Headers for the git host / repo-management endpoints (`Authorization: token <tok>`). */
|
|
4
|
+
function gitHeaders(token) {
|
|
5
|
+
return {
|
|
6
|
+
Authorization: `token ${token}`,
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
Accept: "application/json",
|
|
9
|
+
"User-Agent": "ModaicTS/0.1",
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** Headers for the Modaic REST API (`Authorization: Bearer <tok>`). */
|
|
13
|
+
function bearerHeaders(token) {
|
|
14
|
+
return {
|
|
15
|
+
Authorization: `Bearer ${token}`,
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function errorBody(res) {
|
|
20
|
+
try {
|
|
21
|
+
// FastAPI surfaces errors under `detail`; some endpoints use `message`.
|
|
22
|
+
// Read both so server errors aren't collapsed to a bare "HTTP 500".
|
|
23
|
+
const data = (await res.json());
|
|
24
|
+
const detail = typeof data.detail === "string"
|
|
25
|
+
? data.detail
|
|
26
|
+
: data.detail != null
|
|
27
|
+
? JSON.stringify(data.detail)
|
|
28
|
+
: undefined;
|
|
29
|
+
return detail ?? data.message ?? `HTTP ${res.status}`;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return `HTTP ${res.status}`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fetch the user info for an access token. Used to build the authenticated git
|
|
37
|
+
* remote URL and to set the commit identity.
|
|
38
|
+
*/
|
|
39
|
+
export async function getUserInfo(token) {
|
|
40
|
+
const url = `${getGitUrl()}/api/v1/user`;
|
|
41
|
+
const res = await fetch(url, { headers: gitHeaders(token) });
|
|
42
|
+
if (res.status === 401) {
|
|
43
|
+
throw new AuthenticationError("Invalid access token or authentication failed");
|
|
44
|
+
}
|
|
45
|
+
if (!res.ok) {
|
|
46
|
+
throw new ModaicError(`Failed to fetch user info: ${await errorBody(res)}`);
|
|
47
|
+
}
|
|
48
|
+
const data = (await res.json());
|
|
49
|
+
return { login: data.login, email: data.email, name: data.full_name };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Create a repo on the hub. Returns true if created, false if it already existed
|
|
53
|
+
* (when `existOk`). Mirrors `ModaicClient.create_repo`.
|
|
54
|
+
*/
|
|
55
|
+
export async function createRepo(repo, opts) {
|
|
56
|
+
const [username, name] = repo.split("/", 2);
|
|
57
|
+
if (!username || !name) {
|
|
58
|
+
throw new ModaicError(`Invalid repo path '${repo}'. Expected 'owner/name'.`);
|
|
59
|
+
}
|
|
60
|
+
const payload = {
|
|
61
|
+
username,
|
|
62
|
+
name,
|
|
63
|
+
description: "",
|
|
64
|
+
private: opts.private,
|
|
65
|
+
auto_init: true,
|
|
66
|
+
default_branch: "main",
|
|
67
|
+
trust_model: "default",
|
|
68
|
+
};
|
|
69
|
+
const res = await fetch(`${getApiUrl()}/api/v2/repos`, {
|
|
70
|
+
method: "POST",
|
|
71
|
+
headers: gitHeaders(opts.token),
|
|
72
|
+
body: JSON.stringify(payload),
|
|
73
|
+
});
|
|
74
|
+
if (res.ok)
|
|
75
|
+
return true;
|
|
76
|
+
const message = await errorBody(res);
|
|
77
|
+
if (res.status === 409 || res.status === 422 || message.toLowerCase().includes("already exists")) {
|
|
78
|
+
if (opts.existOk)
|
|
79
|
+
return false;
|
|
80
|
+
throw new RepositoryExistsError(`Repository '${repo}' already exists`);
|
|
81
|
+
}
|
|
82
|
+
if (res.status === 401) {
|
|
83
|
+
throw new AuthenticationError("Invalid access token or authentication failed");
|
|
84
|
+
}
|
|
85
|
+
if (res.status === 403) {
|
|
86
|
+
throw new AuthenticationError("Access denied - insufficient permissions");
|
|
87
|
+
}
|
|
88
|
+
throw new ModaicError(`Failed to create repository: ${message}`);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Run a deployed Arbiter against a single input via the Modaic API.
|
|
92
|
+
* The server runs the LLM; this is a pure HTTP call. Mirrors
|
|
93
|
+
* `POST /api/v2/arbiters/predictions`.
|
|
94
|
+
*/
|
|
95
|
+
export async function predict(args) {
|
|
96
|
+
const controller = new AbortController();
|
|
97
|
+
const timeout = setTimeout(() => controller.abort(), 300000);
|
|
98
|
+
try {
|
|
99
|
+
const res = await fetch(`${getApiUrl()}/api/v2/arbiters/predictions`, {
|
|
100
|
+
method: "POST",
|
|
101
|
+
headers: bearerHeaders(args.token),
|
|
102
|
+
body: JSON.stringify({
|
|
103
|
+
input: args.input,
|
|
104
|
+
arbiter_repo: args.arbiterRepo,
|
|
105
|
+
arbiter_revision: args.arbiterRevision,
|
|
106
|
+
ground_truth: args.groundTruth ?? null,
|
|
107
|
+
ground_reasoning: args.groundReasoning ?? "",
|
|
108
|
+
compute_confidence: args.computeConfidence ?? false,
|
|
109
|
+
}),
|
|
110
|
+
signal: controller.signal,
|
|
111
|
+
});
|
|
112
|
+
if (res.status === 401) {
|
|
113
|
+
throw new AuthenticationError("Invalid access token or authentication failed");
|
|
114
|
+
}
|
|
115
|
+
if (!res.ok) {
|
|
116
|
+
throw new ModaicError(`Prediction failed: ${await errorBody(res)}`);
|
|
117
|
+
}
|
|
118
|
+
const data = (await res.json());
|
|
119
|
+
return {
|
|
120
|
+
exampleId: data.example_id,
|
|
121
|
+
predictionId: data.prediction_id,
|
|
122
|
+
output: data.output,
|
|
123
|
+
reasoning: data.reasoning,
|
|
124
|
+
messages: data.messages ?? [],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
clearTimeout(timeout);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/modaic/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAwBtB,2FAA2F;AAC3F,SAAS,UAAU,CAAC,KAAa,EAA0B;IACzD,OAAO;QACL,aAAa,EAAE,SAA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,CAAC,iBAAiB,IAAI,KAAK;aACpD,CAAC;YACF,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACvB,MAAM,IAAI,mBAAmB,CAAC,+CAA+C,CAAC,CAAC;QACjF,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,WAAW,CAAC,sBAAsB,MAAM,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAM7B,CAAC;QACF,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,YAAY,EAAE,IAAI,CAAC,aAAa;YAChC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;SAC9B,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;AAAA,CACF"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Signature } from "./signatures.js";
|
|
3
|
+
import { type Commit } from "./git.js";
|
|
4
|
+
import type { PredictExampleResponse } from "../models/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Return a Signature guaranteed to have a `reasoning` output field — the TS analog
|
|
7
|
+
* of Python `make_arbiter`. Arbiters must expose a plain `reasoning: string` output
|
|
8
|
+
* because the server reads `prediction.reasoning` on every prediction; without it,
|
|
9
|
+
* predictions fail server-side.
|
|
10
|
+
*
|
|
11
|
+
* Mirrors `make_arbiter`'s `signature.insert(-2, "reasoning", …)`: reasoning is
|
|
12
|
+
* inserted within the output section just before the last output field (so a
|
|
13
|
+
* single-output judge gets reasoning first). Idempotent — if a `reasoning` output
|
|
14
|
+
* already exists, the signature is returned unchanged.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensure_reasoning_field(signature: Signature): Signature<z.ZodObject<any>, z.ZodObject<any>>;
|
|
17
|
+
/** Options for constructing an Arbiter handle to an existing repo. */
|
|
18
|
+
export interface ArbiterOptions {
|
|
19
|
+
/** Git branch used for create/update operations. Default "main". */
|
|
20
|
+
branch?: string;
|
|
21
|
+
/** Revision (branch/tag/commit) used when running predictions. Default = branch. */
|
|
22
|
+
rev?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Options for `Arbiter.create`. */
|
|
25
|
+
export interface CreateOptions {
|
|
26
|
+
repo: string;
|
|
27
|
+
signature: Signature;
|
|
28
|
+
/**
|
|
29
|
+
* The LiteLLM model string the server runs this judge with, e.g.
|
|
30
|
+
* "gpt-oss-120b" or "openai/gpt-4o". Required — an arbiter with no model is
|
|
31
|
+
* not runnable: `predict()` would fail server-side.
|
|
32
|
+
*/
|
|
33
|
+
model: string;
|
|
34
|
+
branch?: string;
|
|
35
|
+
tag?: string;
|
|
36
|
+
access_token?: string;
|
|
37
|
+
commit_message?: string;
|
|
38
|
+
private?: boolean;
|
|
39
|
+
metadata?: Record<string, unknown> | null;
|
|
40
|
+
extra_files?: string[] | null;
|
|
41
|
+
}
|
|
42
|
+
/** Options for `arbiter.update`. */
|
|
43
|
+
export interface UpdateOptions {
|
|
44
|
+
/** Optional new signature; when provided, config.json and program.json are rewritten. */
|
|
45
|
+
signature?: Signature;
|
|
46
|
+
/**
|
|
47
|
+
* LiteLLM model string. Required when `signature` is provided, since rewriting
|
|
48
|
+
* `program.json` needs the model written into its `lm` block.
|
|
49
|
+
*/
|
|
50
|
+
model?: string;
|
|
51
|
+
metadata?: Record<string, unknown> | null;
|
|
52
|
+
extra_files?: string[] | null;
|
|
53
|
+
commit_message?: string;
|
|
54
|
+
tag?: string;
|
|
55
|
+
access_token?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Options for `arbiter.predict`. */
|
|
58
|
+
export interface PredictOptions {
|
|
59
|
+
ground_truth?: Record<string, unknown> | null;
|
|
60
|
+
ground_reasoning?: string;
|
|
61
|
+
compute_confidence?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A handle to a Modaic Arbiter (an LLM judge) stored on Modaic Hub.
|
|
65
|
+
*
|
|
66
|
+
* Like `modaic_client.Arbiter`, this is a thin wrapper over the Modaic REST API
|
|
67
|
+
* and git — it never runs an LLM locally. `predict()` calls the API; `create()`
|
|
68
|
+
* and `update()` write the judge's `config.json` / `program.json` and push them
|
|
69
|
+
* to the hub via git, mirroring `modaic.Predict.push_to_hub`.
|
|
70
|
+
*/
|
|
71
|
+
export declare class Arbiter {
|
|
72
|
+
repo: string;
|
|
73
|
+
branch: string;
|
|
74
|
+
rev: string;
|
|
75
|
+
constructor(repo: string, opts?: ArbiterOptions);
|
|
76
|
+
/**
|
|
77
|
+
* Create a new Arbiter repo on the hub and push its signature.
|
|
78
|
+
*
|
|
79
|
+
* Builds `config.json` (signature schema) and `program.json` (stored prompt)
|
|
80
|
+
* the same way the Python SDK does, creates the remote repo (private by
|
|
81
|
+
* default), then commits & pushes on `branch`.
|
|
82
|
+
*/
|
|
83
|
+
static create(opts: CreateOptions): Promise<Arbiter>;
|
|
84
|
+
/**
|
|
85
|
+
* Pull the latest commit of this Arbiter's branch, write whatever is provided
|
|
86
|
+
* (a new signature rewrites config.json + program.json; metadata updates the
|
|
87
|
+
* README; extra_files are copied in), then commit & push.
|
|
88
|
+
*/
|
|
89
|
+
update(opts?: UpdateOptions): Promise<Commit>;
|
|
90
|
+
/**
|
|
91
|
+
* Run this Arbiter against a single input via the Modaic API. The server runs
|
|
92
|
+
* the LLM; this is a pure HTTP call through the generated SDK
|
|
93
|
+
* (`POST /api/v2/arbiters/predictions`).
|
|
94
|
+
*/
|
|
95
|
+
predict(input: Record<string, unknown>, opts?: PredictOptions): Promise<PredictExampleResponse>;
|
|
96
|
+
/**
|
|
97
|
+
* Alias for {@link predict}. (Python's `__call__` is not idiomatic in TS.)
|
|
98
|
+
*/
|
|
99
|
+
call(input: Record<string, unknown>, opts?: PredictOptions): Promise<PredictExampleResponse>;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=arbiter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbiter.d.ts","sourceRoot":"","sources":["../../src/modaic/arbiter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO5C,OAAO,EAGL,KAAK,MAAM,EAEZ,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAUjE;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,SAAS,GACnB,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAkC/C;AAED,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,oCAAoC;AACpC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,WAAW,CAAC,EA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AI,GAAE,cAAmB,GACxB,OAAO,CAAC,sBAAsB,CAAC,CAEjC;CACF"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Signature } from "./signatures.js";
|
|
3
|
+
import { serializeSignatureToConfig, buildProgramJson, repoNameToTitle, } from "./serialization.js";
|
|
4
|
+
import { resolveToken, getApiUrl } from "./runtime.js";
|
|
5
|
+
import { syncAndPush, createRepo, } from "./git.js";
|
|
6
|
+
import { ModaicClient } from "../sdk/sdk.js";
|
|
7
|
+
/**
|
|
8
|
+
* The fixed description given to an Arbiter's injected `reasoning` output field.
|
|
9
|
+
* Matches the Python SDK (`make_arbiter`) verbatim — original wording included —
|
|
10
|
+
* so judges authored here stay byte-compatible with Python ones.
|
|
11
|
+
*/
|
|
12
|
+
const REASONING_DESC = "Your reasoning for your answer. Inlude any uncertainties about your answer or ambiguity in the task.";
|
|
13
|
+
/**
|
|
14
|
+
* Return a Signature guaranteed to have a `reasoning` output field — the TS analog
|
|
15
|
+
* of Python `make_arbiter`. Arbiters must expose a plain `reasoning: string` output
|
|
16
|
+
* because the server reads `prediction.reasoning` on every prediction; without it,
|
|
17
|
+
* predictions fail server-side.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors `make_arbiter`'s `signature.insert(-2, "reasoning", …)`: reasoning is
|
|
20
|
+
* inserted within the output section just before the last output field (so a
|
|
21
|
+
* single-output judge gets reasoning first). Idempotent — if a `reasoning` output
|
|
22
|
+
* already exists, the signature is returned unchanged.
|
|
23
|
+
*/
|
|
24
|
+
export function ensure_reasoning_field(signature) {
|
|
25
|
+
const outShape = signature.output.shape;
|
|
26
|
+
if ("reasoning" in outShape) {
|
|
27
|
+
return new Signature({
|
|
28
|
+
instructions: signature.instructions,
|
|
29
|
+
input: signature.input,
|
|
30
|
+
output: signature.output,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// A plain string field. Set the description on both `.describe()` and `.meta()`
|
|
34
|
+
// so it surfaces in program.json (dump_state) and config.json (serializeField).
|
|
35
|
+
let reasoningField = z.string().describe(REASONING_DESC);
|
|
36
|
+
if (typeof reasoningField.meta === "function") {
|
|
37
|
+
reasoningField = reasoningField.meta({
|
|
38
|
+
description: REASONING_DESC,
|
|
39
|
+
desc: REASONING_DESC,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const entries = Object.entries(outShape);
|
|
43
|
+
const insertIdx = Math.max(0, entries.length - 1);
|
|
44
|
+
const newShape = {};
|
|
45
|
+
entries.forEach(([k, field], i) => {
|
|
46
|
+
if (i === insertIdx)
|
|
47
|
+
newShape["reasoning"] = reasoningField;
|
|
48
|
+
newShape[k] = field;
|
|
49
|
+
});
|
|
50
|
+
if (entries.length === 0)
|
|
51
|
+
newShape["reasoning"] = reasoningField;
|
|
52
|
+
return new Signature({
|
|
53
|
+
instructions: signature.instructions,
|
|
54
|
+
input: signature.input,
|
|
55
|
+
output: z.object(newShape),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A handle to a Modaic Arbiter (an LLM judge) stored on Modaic Hub.
|
|
60
|
+
*
|
|
61
|
+
* Like `modaic_client.Arbiter`, this is a thin wrapper over the Modaic REST API
|
|
62
|
+
* and git — it never runs an LLM locally. `predict()` calls the API; `create()`
|
|
63
|
+
* and `update()` write the judge's `config.json` / `program.json` and push them
|
|
64
|
+
* to the hub via git, mirroring `modaic.Predict.push_to_hub`.
|
|
65
|
+
*/
|
|
66
|
+
export class Arbiter {
|
|
67
|
+
repo;
|
|
68
|
+
branch;
|
|
69
|
+
rev;
|
|
70
|
+
constructor(repo, opts = {}) {
|
|
71
|
+
this.repo = repo;
|
|
72
|
+
this.branch = opts.branch ?? "main";
|
|
73
|
+
this.rev = opts.rev ?? this.branch;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Create a new Arbiter repo on the hub and push its signature.
|
|
77
|
+
*
|
|
78
|
+
* Builds `config.json` (signature schema) and `program.json` (stored prompt)
|
|
79
|
+
* the same way the Python SDK does, creates the remote repo (private by
|
|
80
|
+
* default), then commits & pushes on `branch`.
|
|
81
|
+
*/
|
|
82
|
+
static async create(opts) {
|
|
83
|
+
const branch = opts.branch ?? "main";
|
|
84
|
+
const token = resolveToken(opts.access_token);
|
|
85
|
+
// Build files first so a bad signature fails before we create a repo.
|
|
86
|
+
// Inject the `reasoning` output field so the judge is a valid Arbiter.
|
|
87
|
+
const signature = ensure_reasoning_field(opts.signature);
|
|
88
|
+
const config = serializeSignatureToConfig(signature, repoNameToTitle(opts.repo));
|
|
89
|
+
const program = buildProgramJson(signature, opts.model);
|
|
90
|
+
await createRepo(opts.repo, {
|
|
91
|
+
private: opts.private ?? true,
|
|
92
|
+
existOk: true,
|
|
93
|
+
token,
|
|
94
|
+
});
|
|
95
|
+
await syncAndPush({
|
|
96
|
+
repo: opts.repo,
|
|
97
|
+
branch,
|
|
98
|
+
token,
|
|
99
|
+
files: { config, program },
|
|
100
|
+
metadata: opts.metadata ?? null,
|
|
101
|
+
extraFiles: opts.extra_files ?? null,
|
|
102
|
+
commitMessage: opts.commit_message ?? "(no commit message)",
|
|
103
|
+
tag: opts.tag,
|
|
104
|
+
});
|
|
105
|
+
return new Arbiter(opts.repo, { branch, rev: opts.tag ?? branch });
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Pull the latest commit of this Arbiter's branch, write whatever is provided
|
|
109
|
+
* (a new signature rewrites config.json + program.json; metadata updates the
|
|
110
|
+
* README; extra_files are copied in), then commit & push.
|
|
111
|
+
*/
|
|
112
|
+
async update(opts = {}) {
|
|
113
|
+
const token = resolveToken(opts.access_token);
|
|
114
|
+
const files = {};
|
|
115
|
+
if (opts.signature) {
|
|
116
|
+
if (!opts.model) {
|
|
117
|
+
throw new Error("update() requires `model` when `signature` is provided, so the " +
|
|
118
|
+
"rewritten program.json records the inference model.");
|
|
119
|
+
}
|
|
120
|
+
const signature = ensure_reasoning_field(opts.signature);
|
|
121
|
+
files.config = serializeSignatureToConfig(signature, repoNameToTitle(this.repo));
|
|
122
|
+
files.program = buildProgramJson(signature, opts.model);
|
|
123
|
+
}
|
|
124
|
+
return syncAndPush({
|
|
125
|
+
repo: this.repo,
|
|
126
|
+
branch: this.branch,
|
|
127
|
+
token,
|
|
128
|
+
files,
|
|
129
|
+
metadata: opts.metadata ?? null,
|
|
130
|
+
extraFiles: opts.extra_files ?? null,
|
|
131
|
+
commitMessage: opts.commit_message ?? "(no commit message)",
|
|
132
|
+
tag: opts.tag,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Run this Arbiter against a single input via the Modaic API. The server runs
|
|
137
|
+
* the LLM; this is a pure HTTP call through the generated SDK
|
|
138
|
+
* (`POST /api/v2/arbiters/predictions`).
|
|
139
|
+
*/
|
|
140
|
+
async predict(input, opts = {}) {
|
|
141
|
+
// Resolve the token up front so a missing token throws AuthenticationError
|
|
142
|
+
// before any client is constructed.
|
|
143
|
+
const token = resolveToken();
|
|
144
|
+
const client = new ModaicClient({ token, serverURL: getApiUrl() });
|
|
145
|
+
return client.createPredictionApiV2ArbitersPredictionsPost({
|
|
146
|
+
input,
|
|
147
|
+
arbiterRepo: this.repo,
|
|
148
|
+
arbiterRevision: this.rev,
|
|
149
|
+
groundTruth: opts.ground_truth ?? null,
|
|
150
|
+
groundReasoning: opts.ground_reasoning ?? "",
|
|
151
|
+
computeConfidence: opts.compute_confidence ?? false,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Alias for {@link predict}. (Python's `__call__` is not idiomatic in TS.)
|
|
156
|
+
*/
|
|
157
|
+
call(input, opts = {}) {
|
|
158
|
+
return this.predict(input, opts);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=arbiter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arbiter.js","sourceRoot":"","sources":["../../src/modaic/arbiter.ts"],"names":[],"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|
1
|
+
/** User identity returned by the git host's `/api/v1/user` endpoint. */
|
|
2
|
+
export interface UserInfo {
|
|
3
|
+
login: string;
|
|
4
|
+
email: string;
|
|
5
|
+
name: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fetch the user info for an access token. Used to build the authenticated git
|
|
9
|
+
* remote URL and to set the commit identity. Hits the git host (`git.modaic.dev`),
|
|
10
|
+
* which is a separate service from the Modaic REST API.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getUserInfo(token: string): Promise<UserInfo>;
|
|
13
|
+
/**
|
|
14
|
+
* Create a repo on the hub. Returns true if created, false if it already existed
|
|
15
|
+
* (when `existOk`). Mirrors `ModaicClient.create_repo`. Not part of the documented
|
|
16
|
+
* SDK surface, so it stays a hand-written call.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createRepo(repo: string, opts: {
|
|
19
|
+
private: boolean;
|
|
20
|
+
existOk: boolean;
|
|
21
|
+
token: string;
|
|
22
|
+
}): Promise<boolean>;
|
|
23
|
+
/** Files to (re)write into the repo before committing. */
|
|
24
|
+
export interface PushFiles {
|
|
25
|
+
/** Parsed `config.json` content. Omit to leave the existing file untouched. */
|
|
26
|
+
config?: object;
|
|
27
|
+
/** Parsed `program.json` content. Omit to leave the existing file untouched. */
|
|
28
|
+
program?: object;
|
|
29
|
+
}
|
|
30
|
+
export interface SyncAndPushOptions {
|
|
31
|
+
/** "owner/name". */
|
|
32
|
+
repo: string;
|
|
33
|
+
/** Branch to commit and push to. */
|
|
34
|
+
branch: string;
|
|
35
|
+
/** Resolved access token. */
|
|
36
|
+
token: string;
|
|
37
|
+
/** Files to write. */
|
|
38
|
+
files: PushFiles;
|
|
39
|
+
/** Optional metadata written to README.md YAML frontmatter. */
|
|
40
|
+
metadata?: Record<string, unknown> | null;
|
|
41
|
+
/** Optional local file paths copied to the repo root. */
|
|
42
|
+
extraFiles?: string[] | null;
|
|
43
|
+
/** Commit message. */
|
|
44
|
+
commitMessage: string;
|
|
45
|
+
/** Optional tag to create and push. */
|
|
46
|
+
tag?: string | undefined;
|
|
47
|
+
}
|
|
48
|
+
/** The commit produced by a push. */
|
|
49
|
+
export interface Commit {
|
|
50
|
+
repo: string;
|
|
51
|
+
sha: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Simpler version of the Python SDK's `sync_and_push`: pull the latest commit of
|
|
55
|
+
* the target branch, write the program/config/metadata/extra files, commit, and
|
|
56
|
+
* push using a token-authenticated remote. Assumes the remote repo already exists.
|
|
57
|
+
*/
|
|
58
|
+
export declare function syncAndPush(opts: SyncAndPushOptions): Promise<Commit>;
|
|
59
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/modaic/git.ts"],"names":[],"mappings":"AAsBA,wEAAwE;AACxE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AA6BD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAelE;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC1D,OAAO,CAAC,OAAO,CAAC,CAiClB;AAMD,0DAA0D;AAC1D,MAAM,WAAW,SAAS;IACxB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,sBAAsB;IACtB,KAAK,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC1C,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC7B,sBAAsB;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,qCAAqC;AACrC,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAwCD;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiE3E"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import matter from "gray-matter";
|
|
4
|
+
import { simpleGit } from "simple-git";
|
|
5
|
+
import { getApiUrl, getGitUrl, stagingDir, ModaicError, AuthenticationError, RepositoryExistsError, } from "./runtime.js";
|
|
6
|
+
/** Headers for the git host / repo-management endpoints (`Authorization: token <tok>`). */
|
|
7
|
+
function gitHeaders(token) {
|
|
8
|
+
return {
|
|
9
|
+
Authorization: `token ${token}`,
|
|
10
|
+
"Content-Type": "application/json",
|
|
11
|
+
Accept: "application/json",
|
|
12
|
+
"User-Agent": "ModaicTS/0.1",
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
async function errorBody(res) {
|
|
16
|
+
try {
|
|
17
|
+
// FastAPI surfaces errors under `detail`; some endpoints use `message`.
|
|
18
|
+
// Read both so server errors aren't collapsed to a bare "HTTP 500".
|
|
19
|
+
const data = (await res.json());
|
|
20
|
+
const detail = typeof data.detail === "string"
|
|
21
|
+
? data.detail
|
|
22
|
+
: data.detail != null
|
|
23
|
+
? JSON.stringify(data.detail)
|
|
24
|
+
: undefined;
|
|
25
|
+
return detail ?? data.message ?? `HTTP ${res.status}`;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return `HTTP ${res.status}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Fetch the user info for an access token. Used to build the authenticated git
|
|
33
|
+
* remote URL and to set the commit identity. Hits the git host (`git.modaic.dev`),
|
|
34
|
+
* which is a separate service from the Modaic REST API.
|
|
35
|
+
*/
|
|
36
|
+
export async function getUserInfo(token) {
|
|
37
|
+
const url = `${getGitUrl()}/api/v1/user`;
|
|
38
|
+
const res = await fetch(url, { headers: gitHeaders(token) });
|
|
39
|
+
if (res.status === 401) {
|
|
40
|
+
throw new AuthenticationError("Invalid access token or authentication failed");
|
|
41
|
+
}
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
throw new ModaicError(`Failed to fetch user info: ${await errorBody(res)}`);
|
|
44
|
+
}
|
|
45
|
+
const data = (await res.json());
|
|
46
|
+
return { login: data.login, email: data.email, name: data.full_name };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a repo on the hub. Returns true if created, false if it already existed
|
|
50
|
+
* (when `existOk`). Mirrors `ModaicClient.create_repo`. Not part of the documented
|
|
51
|
+
* SDK surface, so it stays a hand-written call.
|
|
52
|
+
*/
|
|
53
|
+
export async function createRepo(repo, opts) {
|
|
54
|
+
const [username, name] = repo.split("/", 2);
|
|
55
|
+
if (!username || !name) {
|
|
56
|
+
throw new ModaicError(`Invalid repo path '${repo}'. Expected 'owner/name'.`);
|
|
57
|
+
}
|
|
58
|
+
const payload = {
|
|
59
|
+
username,
|
|
60
|
+
name,
|
|
61
|
+
description: "",
|
|
62
|
+
private: opts.private,
|
|
63
|
+
auto_init: true,
|
|
64
|
+
default_branch: "main",
|
|
65
|
+
trust_model: "default",
|
|
66
|
+
};
|
|
67
|
+
const res = await fetch(`${getApiUrl()}/api/v2/repos`, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: gitHeaders(opts.token),
|
|
70
|
+
body: JSON.stringify(payload),
|
|
71
|
+
});
|
|
72
|
+
if (res.ok)
|
|
73
|
+
return true;
|
|
74
|
+
const message = await errorBody(res);
|
|
75
|
+
if (res.status === 409 || res.status === 422 || message.toLowerCase().includes("already exists")) {
|
|
76
|
+
if (opts.existOk)
|
|
77
|
+
return false;
|
|
78
|
+
throw new RepositoryExistsError(`Repository '${repo}' already exists`);
|
|
79
|
+
}
|
|
80
|
+
if (res.status === 401) {
|
|
81
|
+
throw new AuthenticationError("Invalid access token or authentication failed");
|
|
82
|
+
}
|
|
83
|
+
if (res.status === 403) {
|
|
84
|
+
throw new AuthenticationError("Access denied - insufficient permissions");
|
|
85
|
+
}
|
|
86
|
+
throw new ModaicError(`Failed to create repository: ${message}`);
|
|
87
|
+
}
|
|
88
|
+
function makeGitUrl(repo, token, login) {
|
|
89
|
+
const gitUrl = getGitUrl();
|
|
90
|
+
const protocol = gitUrl.startsWith("https://") ? "https://" : "http://";
|
|
91
|
+
const host = gitUrl.replace(/^https?:\/\//, "");
|
|
92
|
+
return `${protocol}${login}:${token}@${host}/${repo}.git`;
|
|
93
|
+
}
|
|
94
|
+
function writeJson(filePath, obj) {
|
|
95
|
+
// Match Python's json.dump(..., indent=2): 2-space indent, no trailing newline.
|
|
96
|
+
fs.writeFileSync(filePath, JSON.stringify(obj, null, 2));
|
|
97
|
+
}
|
|
98
|
+
/** Create or replace the README's YAML frontmatter, preserving the body. */
|
|
99
|
+
function writeReadmeFrontmatter(filePath, metadata) {
|
|
100
|
+
let body = "";
|
|
101
|
+
if (fs.existsSync(filePath)) {
|
|
102
|
+
body = matter(fs.readFileSync(filePath, "utf-8")).content;
|
|
103
|
+
}
|
|
104
|
+
fs.writeFileSync(filePath, matter.stringify(body, metadata));
|
|
105
|
+
}
|
|
106
|
+
/** Check out `branch`, tracking origin/branch, falling back to origin/main, then a fresh branch. */
|
|
107
|
+
async function checkoutBranch(git, branch) {
|
|
108
|
+
try {
|
|
109
|
+
await git.checkout(["-B", branch, `origin/${branch}`]);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
/* branch does not exist on origin yet */
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
await git.checkout(["-B", branch, "origin/main"]);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
/* main does not exist either (brand new repo with no commits) */
|
|
121
|
+
}
|
|
122
|
+
await git.checkout(["-B", branch]);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Simpler version of the Python SDK's `sync_and_push`: pull the latest commit of
|
|
126
|
+
* the target branch, write the program/config/metadata/extra files, commit, and
|
|
127
|
+
* push using a token-authenticated remote. Assumes the remote repo already exists.
|
|
128
|
+
*/
|
|
129
|
+
export async function syncAndPush(opts) {
|
|
130
|
+
const dir = stagingDir(opts.repo);
|
|
131
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
132
|
+
const git = simpleGit(dir);
|
|
133
|
+
if (!fs.existsSync(path.join(dir, ".git"))) {
|
|
134
|
+
await git.init();
|
|
135
|
+
}
|
|
136
|
+
const user = await getUserInfo(opts.token);
|
|
137
|
+
const remoteUrl = makeGitUrl(opts.repo, opts.token, user.login);
|
|
138
|
+
const remotes = await git.getRemotes();
|
|
139
|
+
if (remotes.some((r) => r.name === "origin")) {
|
|
140
|
+
await git.remote(["set-url", "origin", remoteUrl]);
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
await git.addRemote("origin", remoteUrl);
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
await git.fetch("origin");
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
const msg = String(e).toLowerCase();
|
|
150
|
+
if (msg.includes("not found") || msg.includes("repository")) {
|
|
151
|
+
throw new ModaicError(`Repository '${opts.repo}' does not exist`);
|
|
152
|
+
}
|
|
153
|
+
throw new ModaicError(`Git fetch failed: ${e}`);
|
|
154
|
+
}
|
|
155
|
+
await checkoutBranch(git, opts.branch);
|
|
156
|
+
// Write the desired repo contents.
|
|
157
|
+
if (opts.files.config)
|
|
158
|
+
writeJson(path.join(dir, "config.json"), opts.files.config);
|
|
159
|
+
if (opts.files.program)
|
|
160
|
+
writeJson(path.join(dir, "program.json"), opts.files.program);
|
|
161
|
+
if (opts.metadata)
|
|
162
|
+
writeReadmeFrontmatter(path.join(dir, "README.md"), opts.metadata);
|
|
163
|
+
if (opts.extraFiles) {
|
|
164
|
+
for (const file of opts.extraFiles) {
|
|
165
|
+
fs.copyFileSync(file, path.join(dir, path.basename(file)));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
await git.add(["-A"]);
|
|
169
|
+
await git.addConfig("user.email", user.email);
|
|
170
|
+
await git.addConfig("user.name", user.name);
|
|
171
|
+
try {
|
|
172
|
+
await git.commit(opts.commitMessage);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
if (String(e).toLowerCase().includes("nothing to commit")) {
|
|
176
|
+
throw new ModaicError("Nothing to commit");
|
|
177
|
+
}
|
|
178
|
+
throw new ModaicError(`Git commit failed: ${e}`);
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
await git.push("origin", opts.branch);
|
|
182
|
+
if (opts.tag) {
|
|
183
|
+
await git.addTag(opts.tag);
|
|
184
|
+
await git.raw(["push", "origin", opts.tag]);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
throw new ModaicError(`Git push failed: ${e}`);
|
|
189
|
+
}
|
|
190
|
+
const sha = (await git.revparse(["HEAD"])).trim();
|
|
191
|
+
return { repo: opts.repo, sha };
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=git.js.map
|