Skip to content

feat: native hosting sdk - #48

Draft
rkdud007 wants to merge 8 commits into
mainfrom
rkdud007/native-hosting-sdk
Draft

feat: native hosting sdk#48
rkdud007 wants to merge 8 commits into
mainfrom
rkdud007/native-hosting-sdk

Conversation

@rkdud007

Copy link
Copy Markdown
Collaborator

No description provided.

Callers can now configure hosting when they create a repository,
change it later, and drive deployments end to end: createRepo accepts
a deployment block, updateRepo patches the default branch or the
deployment settings, and Repo gains createDeployment,
listDeployments, and getDeployment.

Deployment lifecycle routes are canonical and unversioned, so the
fetcher learns an apiRoot mode and PATCH support. Nullable build
settings (framework, root/build/install/output directory, serverless
function region) preserve omitted-versus-null patch semantics,
environment variable names are sent verbatim, and region codes are
validated to at most four characters. Minted tokens add
deployment:write only when env changes are present; lifecycle calls
use deployment:write or deployment:read. Create responses surface the
idempotency key, the replay flag, and the Location header.
Callers can now configure hosting when they create a repository,
change it later, and drive deployments end to end: create_repo
accepts a deployment dict, update_repo patches the default branch or
the deployment settings, and Repo gains create_deployment,
list_deployments, and get_deployment.

Deployment lifecycle routes are canonical and unversioned, and both
path segments are percent-encoded. Nullable build settings preserve
omitted-versus-None patch semantics, environment variable names are
sent verbatim, and region codes are validated to at most four
characters. Minted tokens add deployment:write only when env changes
are present; lifecycle calls use deployment:write or deployment:read.
Create responses surface the idempotency key, the replay flag, and
the Location header.

Also fix two strict-mypy errors in repo.py: parameterize the
AbstractAsyncContextManager annotation and drop a stale type-ignore.
Callers can now configure hosting when they create a repository,
change it later, and drive deployments end to end: CreateRepo accepts
DeploymentSettings, UpdateRepo patches the default branch or the
deployment settings, and Repo gains CreateDeployment,
ListDeployments, and GetDeployment.

DeploymentStringSetting keeps the three patch states apart: an unset
field is omitted, SetDeploymentString sends a value, and
ResetDeploymentString sends an explicit null. Deployment lifecycle
routes are canonical and unversioned, so the fetcher learns an
apiRoot mode and PATCH support. Environment variable names are sent
verbatim, and region codes are validated to at most four characters.
Minted tokens add deployment:write only when env changes are present;
lifecycle calls use deployment:write or deployment:read. Create
responses surface the idempotency key, the replay flag, and the
Location header.
Add the deployment:read and deployment:write scopes, the PATCH /repo
route, the repository deployment settings object, and the deployment
lifecycle endpoints to the code-storage agent skill.

Lifecycle routes live under the API origin as canonical /api/repos
paths rather than the versioned /api/v1 base, so the skill gains a
CODE_STORAGE_API_ORIGIN variable and curl examples covering
idempotent creation, pagination, and percent-encoded repo names.
createDeployment returns a receipt while the build runs in the
background, so every caller hand-rolls a getDeployment loop to learn
the outcome. waitForDeployment wraps that polling: it resolves with
the deployment once the status is ready, throws DeploymentFailedError
carrying status/errorCode/errorMessage when the deployment ends in
error or canceled, and stops with a timeout error after a
configurable deadline (2s interval, 10m timeout by default).
CreateDeployment returns a receipt while the build runs in the
background, so every caller hand-rolls a GetDeployment loop to learn
the outcome. WaitForDeployment wraps that polling: it returns the
deployment once the status is ready, fails with a typed
DeploymentFailedError carrying Status/ErrorCode/ErrorMessage when the
deployment ends in error or canceled, and stops with a timeout error
after a configurable deadline (2s interval, 10m timeout by default).
Caller context cancellation propagates.
create_deployment returns a receipt while the build runs in the
background, so every caller hand-rolls a get_deployment loop to learn
the outcome. wait_for_deployment wraps that polling: it returns the
deployment once the status is ready, raises DeploymentFailedError
carrying status/error_code/error_message when the deployment ends in
error or canceled, and raises TimeoutError naming the last observed
status after a configurable deadline (2s interval, 10m timeout by
default).
Show the new polling helper in each SDK README's deployment section
and note it in the code-storage skill's deployment lifecycle chapter.

Also align the custom repo id example across the three READMEs:
the deployment settings snippets now use my-custom-repo like the
existing custom-id examples, instead of owner/site, which read as if
the id carried owner/repo structure. The id is one opaque string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant