@sl-testing/ac-pulumi
v0.1.31
Published
AgentCloud TypeScript SDK generated from the Pulumi provider schema
Downloads
6,159
Readme
Infra Pulumi Provider
Spec
- Export surface:
@sl-testing/ac-pulumi. - Purpose: own the custom Pulumi provider source, provider schema, generated Node SDK distribution, plugin packaging, and install-time plugin bootstrap.
- Owns:
core/infra-pulumi-provider/provider,core/infra-pulumi-provider/postinstall.js, generated SDK artifacts underdist, provider schema/codegen inputs, and release packaging logic for the published Pulumi package. - Does not own: Terraform env roots, platform API behavior, or product resource semantics beyond faithfully exposing the platform contract.
- Dependencies: resource semantics come from
core/api/AGENTS.mdand the owning domain moduleAGENTS.mdfiles. - Cross-module contract: consumers import provider resources only from the package root
@sl-testing/ac-pulumi. - Provider package contract:
- this module ships the
agentcloudPulumi resource provider plus the generated Node SDK published as@sl-testing/ac-pulumi - provider source-of-truth lives in
provider/*.go; checked-indistoutput is generated, not hand-edited - release packaging runs through
core/repo-tools/src/build-ac-pulumi-package.sh, injectsmain.providerVersion, runspulumi package gen-sdk, patches the generated Node wrapper, and bundles provider binaries pluspostinstall.js - published installs auto-attempt
pulumi plugin install resource agentcloud <version> --reinstallfrom the packaged binary, but do not hard-fail npm install if Pulumi or the plugin install step is unavailable - bundled plugin binaries currently target
darwin-arm64andlinux-x64
- this module ships the
- Provider scope and config:
- the provider manages project-owned resources inside one existing project at a time
- provider config keys are
agentcloud:apiUrlandagentcloud:projectId - resource
projectIdmay override provider config per resource; reads prefer explicitprojectId, then the compound import ID, then provider config agentcloud:apiUrlmay come from Pulumi config orAC_API_URL;projectIdmust come from Pulumi config or resource input, not an env fallback- previews synthesize placeholder canonical IDs with zero suffixes until the API returns the real resource ID
- project-owned import IDs use
<projectId>/<resource_type>/<resource_id> - the provider does not use workspace-era identifiers in the product contract
- Provider connectivity and auth:
agentcloud infra initpersistsagentcloud:projectIdandagentcloud:environment=prod, but notagentcloud:apiUrl- machine-side
agentcloud infra plan|apply|drift|destroyuses the canonical remote Pulumi backend for the target stack agentcloud infra applynever implicitly reuses a default saved plan file; saved-plan apply happens only with--plan-file- auth resolution order is
AC_BOOTSTRAP_TOKENexchange atPOST /v1/runtime-auth/exchange, thenAC_TOKEN, thenAC_TOKEN_FILE, thenAC_SESSION_COOKIE, thenAC_SESSION_FILE, then~/.agentcloud/session.cookie AC_TOKEN_FILEis bearer-token-only and rejects cookie-form valuesAC_SESSION_FILEis cookie-only and rejects bearer-token-only values
- Provider surface:
- managed resources are
Secret,ProjectRole,ProjectRoleRule,ProjectRoleBinding,Database,Image,Machine,AgentConfiguration,Job,Service,ServiceDeploymentResource, andSlackConnection- invoke helpers are
permissionCatalog,agentRuns,messages,jobRuns,serviceDeployments,imageVersions,imageVersionsByImage, andlogs - invoke helpers are project-scoped, read-only helpers; lifecycle ownership belongs to resources
- invoke helpers are
- Resource lifecycle contract:
Secret:keyis immutable; update re-puts the value; reads never fetch plaintext back from the API and preserve the Pulumi-encrypted last-known value in stateProjectRole:nameis immutable; update patchesdescriptiononlyProjectRoleRule: wraps role grants;roleIdandpermissionare immutable; updates replace rule scope/resource selectors by deleting the old rule and granting a new one; validated rule selectors are limited to canonical product resource typesProjectRoleBinding: bindssubjectType + subjectId + roleId; valid subject types areuser,agent_configuration,job,service, andpublic; create de-duplicates by looking up an existing binding on conflict; updates are delete-and-recreateDatabase: create/read/delete only;nameis immutable; state stays minimal withprojectId,name,databaseId, andstatus; no restore, endpoint metadata, credentials metadata, cluster identifiers, AWS ARNs, or size classes are exposedImage:nameandsourceTypeare immutable; updates patchdockerfilePath,contextPath, andregistryRef; registry-source reads preserve explicitregistryRefinput when needed; delete retries deterministic409conflicts briefly before surfacing failureMachine:nameis immutable; image version, size, and working directory update in place; reads treatdeletedstatus as absentAgentConfiguration: this is the durable configuration object, not the runtime agent;nameandproviderare immutable; image version, size, working dir, model, Codex thinking, instructions, and idle timeouts update in placeJob:nameis immutable; image version, command, input schema, timeout, and max parallel runs update in placeService:typeandnameare immutable;cpu,memoryMb,port, andhealthcheckPathupdate in place; reads expose livestatusandserviceUrlServiceDeploymentResource: models service deploy operations, not the service definition;projectIdandserviceIdreplace,imageVersionIdreplace, create/update callPOST /deployand wait up to 10 minutes for ahealthydeployment, and a matching current healthy deployment is treated as idempotent success; delete is intentionally a no-op and does not rollback
- There is no standalone Pulumi
Functionresource. Function services expose manifest-backed functions from the deployed image and are managed through theServiceplusServiceDeploymentResourcecontract. - Replace, import, and error semantics:
- default rule is dumb/simple mapping: safe scalar knobs update in place; ownership/identity fields replace
- canonical project-scoped import IDs exist for all managed resources; most resources can read/delete from the import ID alone, but
ProjectRoleRuleandProjectRoleBindingcurrently still rely on state-carried IDs on follow-up read/delete - surfaced provider errors preserve API
error_code 400maps toInvalidArgument401and403map toPermissionDenied404maps toNotFound409maps toFailedPrecondition- delete treats
NotFoundas success for managed resources - runtime agents are not Pulumi-managed resources
- Provider generality:
- the provider is product-level and project-agnostic
- it does not hardcode meta-project names, resource names, service names, or workflow assumptions
- it does not ship a
Projectresource and does not manageprojects.main_agent_configuration_idorprojects.main_agent_id - project main-agent pointers remain API-managed or userland-managed
Testing
- Fast proof:
npm run -w core/infra-pulumi-provider lint. - Provider proof:
(cd core/infra-pulumi-provider/provider && go test ./...). - SDK proof: rerun
bash core/repo-tools/src/build-ac-pulumi-package.sh --version <version>when schema/codegen, provider packaging, or plugin bootstrap changes. - Install proof: run
bash core/repo-tools/src/smoke-ac-pulumi-npm-install.sh [--version <version>]for the published package path.
Deployment
- Ships as the published Pulumi provider and generated SDK package, not as a long-running runtime.
- Any provider contract change must be regenerated and republished before meta-project stacks consume it.
- Keep
package.json, the Pulumi package metadata, and injected provider binary version aligned across release artifacts.
Monitoring
- Watch provider apply/import failures, auth resolution regressions, schema drift, postinstall/plugin install regressions, and generated SDK mismatches against the live API.
- After release, validate at least one representative Pulumi program still previews and applies.
Risks
- Provider drift breaks infrastructure reconciliation and meta-project deployment.
- Import/read drift is especially risky because Pulumi state adoption depends on canonical compound IDs working consistently.
- Never patch generated output without updating the underlying provider/schema pipeline.
