@openagentpack/sdk 0.3.0-beta-fb9e73b-20260721 → 0.3.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/dist/index.d.ts +25 -1
- package/dist/index.js +171 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -206,6 +206,8 @@ interface DeploymentDecl {
|
|
|
206
206
|
description?: string;
|
|
207
207
|
provider?: ProviderName;
|
|
208
208
|
metadata?: Record<string, string>;
|
|
209
|
+
/** Qoder-only deployment-level variables copied into each created session. */
|
|
210
|
+
environment_variables?: string;
|
|
209
211
|
}
|
|
210
212
|
type DeploymentResourceDecl = DeploymentFileResource | DeploymentMemoryStoreResource | DeploymentGithubRepoResource;
|
|
211
213
|
interface DeploymentFileResource {
|
|
@@ -574,6 +576,20 @@ interface DeploymentInfo$1 {
|
|
|
574
576
|
};
|
|
575
577
|
attributes?: Record<string, unknown>;
|
|
576
578
|
}
|
|
579
|
+
interface DeploymentListFilter {
|
|
580
|
+
agent_id?: string;
|
|
581
|
+
status?: "active" | "paused";
|
|
582
|
+
include_archived?: boolean;
|
|
583
|
+
limit?: number;
|
|
584
|
+
page?: string;
|
|
585
|
+
created_at_gte?: string;
|
|
586
|
+
created_at_lte?: string;
|
|
587
|
+
}
|
|
588
|
+
interface DeploymentListResult {
|
|
589
|
+
deployments: DeploymentInfo$1[];
|
|
590
|
+
has_more: boolean;
|
|
591
|
+
next_page?: string;
|
|
592
|
+
}
|
|
577
593
|
interface ProviderAdapter {
|
|
578
594
|
readonly name: string;
|
|
579
595
|
/**
|
|
@@ -650,6 +666,9 @@ interface ProviderAdapter {
|
|
|
650
666
|
deleteDeployment(id: string): Promise<void>;
|
|
651
667
|
runDeployment(ctx: DeploymentContext): Promise<DeploymentRunResult$1>;
|
|
652
668
|
getDeployment(ctx: DeploymentContext): Promise<DeploymentInfo$1>;
|
|
669
|
+
listDeployments?(filter?: DeploymentListFilter): Promise<DeploymentListResult>;
|
|
670
|
+
pauseDeployment?(ctx: DeploymentContext): Promise<DeploymentInfo$1>;
|
|
671
|
+
unpauseDeployment?(ctx: DeploymentContext): Promise<DeploymentInfo$1>;
|
|
653
672
|
uploadFile(filePath: string, options?: {
|
|
654
673
|
name?: string;
|
|
655
674
|
purpose?: string;
|
|
@@ -956,6 +975,9 @@ declare function migrateConfig(opts: MigrateOptions): Promise<MigrateResult>;
|
|
|
956
975
|
interface DeploymentRunAdapter {
|
|
957
976
|
runDeployment(ctx: DeploymentContext): Promise<DeploymentRunResult$1>;
|
|
958
977
|
getDeployment(ctx: DeploymentContext): Promise<DeploymentInfo$1>;
|
|
978
|
+
listDeployments?(filter?: DeploymentListFilter): Promise<DeploymentListResult>;
|
|
979
|
+
pauseDeployment?(ctx: DeploymentContext): Promise<DeploymentInfo$1>;
|
|
980
|
+
unpauseDeployment?(ctx: DeploymentContext): Promise<DeploymentInfo$1>;
|
|
959
981
|
}
|
|
960
982
|
|
|
961
983
|
interface DeploymentSummary {
|
|
@@ -1006,9 +1028,11 @@ interface DeploymentRun {
|
|
|
1006
1028
|
provider: string;
|
|
1007
1029
|
result: DeploymentRunResult;
|
|
1008
1030
|
}
|
|
1031
|
+
declare function listRemoteDeploymentsForContext(ctx: ProjectRuntimeContext, provider: string, filter?: DeploymentListFilter): Promise<DeploymentListResult>;
|
|
1009
1032
|
declare function listDeploymentsForContext(ctx: ProjectRuntimeContext, providerFilter?: string): DeploymentSummary[];
|
|
1010
1033
|
declare function getDeploymentDetailsForContext(ctx: ProjectRuntimeContext, name: string, adapter?: Pick<DeploymentRunAdapter, "getDeployment">, resolvedProvider?: string): Promise<DeploymentDetail>;
|
|
1011
1034
|
declare function runDeploymentForContext(ctx: ProjectRuntimeContext, name: string, adapter?: Pick<DeploymentRunAdapter, "runDeployment">, resolvedProvider?: string): Promise<DeploymentRun>;
|
|
1035
|
+
declare function pauseDeploymentForContext(ctx: ProjectRuntimeContext, name: string, paused: boolean, resolvedProvider?: string): Promise<DeploymentInfo$1>;
|
|
1012
1036
|
declare function getDeploymentRuntimeProviderForContext(ctx: ProjectRuntimeContext, name: string, overrideProvider?: string): string;
|
|
1013
1037
|
|
|
1014
1038
|
type DestroyResourceStatus = "success" | "failed" | "blocked" | "skipped";
|
|
@@ -1408,4 +1432,4 @@ declare class LocalFileStateBackend implements StateBackend {
|
|
|
1408
1432
|
/** Normalize a skill zip and extract its entries to SkillFile[]. */
|
|
1409
1433
|
declare function extractSkillZipFiles(raw: Buffer): Promise<SkillFile[]>;
|
|
1410
1434
|
|
|
1411
|
-
export { AGENTS_CONFIG_PROVIDERS, AGENTS_PROVIDER_FIELDS, type AgentBuildInput, AgentDefinition, type AgentMcpBuildInput, type AgentSkillBuildInput, AgentSyncRun, AgentWithReadiness, type BackendRuntimeInput, type BatchCreateMemoryInput, type BatchCreateMemoryResult, CloudAgent, CloudEnvironment, CloudVault, type CollectedSessionEvents, type CreateMemoryInput, type CreateMemoryStoreInput, type DestroyResourceResult, type DestructivePolicy, Diagnostic, type IStateManager, type LoadedProjectConfig, LocalFileStateBackend, type MemoryInfo, type MemoryListItem, type MemoryListOptions, type MemoryPage, type MemoryPrefixInfo, type MemoryProviderCapabilities, type MemoryStoreInfo, type MemoryStoreListOptions, type MemoryVersionInfo, type MemoryVersionListOptions, type MigrateOptions, type MigrateResult, PlannedAction, type ProjectRuntimeContext, type ProviderConfig, type ProviderConfigProvider, ProviderFileInfo, ProviderSessionEvent, type ProviderSessionInfo, type ProviderSkillInfo, type ResolvedProjectConfig, type ResourceActionResult, ResourceAddress, type ResourceExecutionResult, type ResourcePlanResult, type ResourceRefreshResult, type ResourceRuntimeOptions, type ResourceState, type ResourceSyncRun, ResourceType, type RuntimeFeedbackEvent, type RuntimeFeedbackSink, type SecretPlaceholder, type SkillFile, StateManager, type StateScope, type SyncProjectOptions, type SyncProjectResult, type UpdateMemoryInput, type UpdateMemoryStoreInput, UserError, type ValidateProjectConfigOptions, applyProviderConfigToEnv, archiveCloudAgent, archiveMemoryStore, areRuntimeCredentialsReady, batchCreateMemories, bootstrapRuntimeCredentials, bootstrapRuntimeCredentialsSync, buildAgentDecl, collectConfigReferences, createCloudEnvironment, createCloudVault, createMemory, createMemoryStore, createProjectRuntime, createSessionForAgent, createSkillFromFileId, decideDestructive, deleteCloudEnvironment, deleteCloudVault, deleteFile, deleteMemory, deleteMemoryStore, deleteSession, deleteSkill, destroyPlannedProjectResources, executePlannedProject, extractSkillZipFiles, getAgent, getDeploymentDetailsForContext, getDeploymentRuntimeProviderForContext, getFileDownloadUrl, getFileInfo, getMemory, getMemoryProviderCapabilities, getMemoryStore, getMemoryVersion, getSession, getSkillInfo, importResource, isTerminalSessionStatus, listAgentsWithReadiness, listCloudAgents, listCloudEnvironments, listCloudVaults, listDeploymentsForContext, listFiles, listMemories, listMemoryStores, listMemoryVersions, listProviderModelsForContext, listProviderNames, listSessionEvents, listSessionSummaries, listSkills, loadDotEnv, loadProviderConfigIntoEnv, loadProviderConfigIntoEnvSync, migrateConfig, parseStateAddress, planDestroyProjectContext, planProjectContext, preparePromptForProvider, prependFileHint, providerConfigPath, readProjectRuntime, redactMemoryVersion, resolveActiveProvider, resolveProjectConfig, resolveProjectConfigFromObject, resolveProviderConfigFromEnv, resolveSessionProvider, resolveSyncProvider, rewriteFileMentions, runDeploymentForContext, sendSessionMessagePolling, sendSessionMessageStreaming, startSessionRun, startSessionRunPolling, streamSessionEvents, syncAgentResourcesWithStateBackend, syncProjectResourcesWithStateBackend, syncProviderResourcesFromContext, syncProviderResourcesFromEnv, updateMemory, updateMemoryStore, uploadFile, validateProjectConfig, writeProjectRuntime };
|
|
1435
|
+
export { AGENTS_CONFIG_PROVIDERS, AGENTS_PROVIDER_FIELDS, type AgentBuildInput, AgentDefinition, type AgentMcpBuildInput, type AgentSkillBuildInput, AgentSyncRun, AgentWithReadiness, type BackendRuntimeInput, type BatchCreateMemoryInput, type BatchCreateMemoryResult, CloudAgent, CloudEnvironment, CloudVault, type CollectedSessionEvents, type CreateMemoryInput, type CreateMemoryStoreInput, type DeploymentListFilter, type DeploymentListResult, type DestroyResourceResult, type DestructivePolicy, Diagnostic, type IStateManager, type LoadedProjectConfig, LocalFileStateBackend, type MemoryInfo, type MemoryListItem, type MemoryListOptions, type MemoryPage, type MemoryPrefixInfo, type MemoryProviderCapabilities, type MemoryStoreInfo, type MemoryStoreListOptions, type MemoryVersionInfo, type MemoryVersionListOptions, type MigrateOptions, type MigrateResult, PlannedAction, type ProjectRuntimeContext, type ProviderConfig, type ProviderConfigProvider, ProviderFileInfo, ProviderSessionEvent, type ProviderSessionInfo, type ProviderSkillInfo, type ResolvedProjectConfig, type ResourceActionResult, ResourceAddress, type ResourceExecutionResult, type ResourcePlanResult, type ResourceRefreshResult, type ResourceRuntimeOptions, type ResourceState, type ResourceSyncRun, ResourceType, type RuntimeFeedbackEvent, type RuntimeFeedbackSink, type SecretPlaceholder, type SkillFile, StateManager, type StateScope, type SyncProjectOptions, type SyncProjectResult, type UpdateMemoryInput, type UpdateMemoryStoreInput, UserError, type ValidateProjectConfigOptions, applyProviderConfigToEnv, archiveCloudAgent, archiveMemoryStore, areRuntimeCredentialsReady, batchCreateMemories, bootstrapRuntimeCredentials, bootstrapRuntimeCredentialsSync, buildAgentDecl, collectConfigReferences, createCloudEnvironment, createCloudVault, createMemory, createMemoryStore, createProjectRuntime, createSessionForAgent, createSkillFromFileId, decideDestructive, deleteCloudEnvironment, deleteCloudVault, deleteFile, deleteMemory, deleteMemoryStore, deleteSession, deleteSkill, destroyPlannedProjectResources, executePlannedProject, extractSkillZipFiles, getAgent, getDeploymentDetailsForContext, getDeploymentRuntimeProviderForContext, getFileDownloadUrl, getFileInfo, getMemory, getMemoryProviderCapabilities, getMemoryStore, getMemoryVersion, getSession, getSkillInfo, importResource, isTerminalSessionStatus, listAgentsWithReadiness, listCloudAgents, listCloudEnvironments, listCloudVaults, listDeploymentsForContext, listFiles, listMemories, listMemoryStores, listMemoryVersions, listProviderModelsForContext, listProviderNames, listRemoteDeploymentsForContext, listSessionEvents, listSessionSummaries, listSkills, loadDotEnv, loadProviderConfigIntoEnv, loadProviderConfigIntoEnvSync, migrateConfig, parseStateAddress, pauseDeploymentForContext, planDestroyProjectContext, planProjectContext, preparePromptForProvider, prependFileHint, providerConfigPath, readProjectRuntime, redactMemoryVersion, resolveActiveProvider, resolveProjectConfig, resolveProjectConfigFromObject, resolveProviderConfigFromEnv, resolveSessionProvider, resolveSyncProvider, rewriteFileMentions, runDeploymentForContext, sendSessionMessagePolling, sendSessionMessageStreaming, startSessionRun, startSessionRunPolling, streamSessionEvents, syncAgentResourcesWithStateBackend, syncProjectResourcesWithStateBackend, syncProviderResourcesFromContext, syncProviderResourcesFromEnv, updateMemory, updateMemoryStore, uploadFile, validateProjectConfig, writeProjectRuntime };
|
package/dist/index.js
CHANGED
|
@@ -1090,6 +1090,23 @@ function mapDeployment(name, decl, refs, projectName, uploadedFiles) {
|
|
|
1090
1090
|
}
|
|
1091
1091
|
return body;
|
|
1092
1092
|
}
|
|
1093
|
+
function mapDeploymentUpdate(name, decl, refs, projectName, uploadedFiles, existingMetadata) {
|
|
1094
|
+
const body = mapDeployment(name, decl, refs, projectName, uploadedFiles);
|
|
1095
|
+
body.vault_ids = refs.vault_ids;
|
|
1096
|
+
body.resources = mapDeploymentResources(decl, refs, uploadedFiles);
|
|
1097
|
+
if (decl.schedule) {
|
|
1098
|
+
body.schedule = { type: "cron", expression: decl.schedule.expression, timezone: decl.schedule.timezone };
|
|
1099
|
+
}
|
|
1100
|
+
body.description = decl.description ?? "";
|
|
1101
|
+
const desiredMetadata = projectName ? injectMetadata(decl.metadata, projectName, name) : decl.metadata ?? {};
|
|
1102
|
+
body.metadata = {
|
|
1103
|
+
...Object.fromEntries(
|
|
1104
|
+
Object.keys(existingMetadata ?? {}).filter((key) => !(key in desiredMetadata)).map((key) => [key, null])
|
|
1105
|
+
),
|
|
1106
|
+
...desiredMetadata
|
|
1107
|
+
};
|
|
1108
|
+
return body;
|
|
1109
|
+
}
|
|
1093
1110
|
function mapInitialEvents(events) {
|
|
1094
1111
|
return events.map((ev) => {
|
|
1095
1112
|
if (ev.type === "user.message" || ev.type === "system.message") {
|
|
@@ -1504,7 +1521,20 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1504
1521
|
}
|
|
1505
1522
|
async updateDeployment(id, name, decl, refs, basePath) {
|
|
1506
1523
|
const uploaded = await this.uploadDeploymentFiles(decl, basePath);
|
|
1507
|
-
const
|
|
1524
|
+
const current = await this.client.get(`/deployments/${id}`);
|
|
1525
|
+
if (current.schedule && !decl.schedule) {
|
|
1526
|
+
throw new UserError(
|
|
1527
|
+
`Deployment '${name}' cannot remove its schedule through the documented Claude update API; archive and recreate it as a manual deployment.`
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1530
|
+
const body = mapDeploymentUpdate(
|
|
1531
|
+
name,
|
|
1532
|
+
decl,
|
|
1533
|
+
refs,
|
|
1534
|
+
this.projectName,
|
|
1535
|
+
uploaded,
|
|
1536
|
+
current.metadata
|
|
1537
|
+
);
|
|
1508
1538
|
const res = await this.client.post(`/deployments/${id}`, body);
|
|
1509
1539
|
return toRemoteResource(res);
|
|
1510
1540
|
}
|
|
@@ -1556,6 +1586,36 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1556
1586
|
attributes: res
|
|
1557
1587
|
};
|
|
1558
1588
|
}
|
|
1589
|
+
async listDeployments(filter) {
|
|
1590
|
+
const params = new URLSearchParams();
|
|
1591
|
+
if (filter?.agent_id) params.set("agent_id", filter.agent_id);
|
|
1592
|
+
if (filter?.status) params.set("status", filter.status);
|
|
1593
|
+
if (filter?.include_archived) params.set("include_archived", "true");
|
|
1594
|
+
if (filter?.limit) params.set("limit", String(filter.limit));
|
|
1595
|
+
if (filter?.page) params.set("page", filter.page);
|
|
1596
|
+
if (filter?.created_at_gte) params.set("created_at[gte]", filter.created_at_gte);
|
|
1597
|
+
if (filter?.created_at_lte) params.set("created_at[lte]", filter.created_at_lte);
|
|
1598
|
+
const query2 = params.toString();
|
|
1599
|
+
const res = await this.client.get(`/deployments${query2 ? `?${query2}` : ""}`);
|
|
1600
|
+
const nextPage = res.next_page ?? void 0;
|
|
1601
|
+
return {
|
|
1602
|
+
deployments: (res.data ?? []).map(toDeploymentInfo),
|
|
1603
|
+
has_more: nextPage !== void 0,
|
|
1604
|
+
next_page: nextPage
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
async pauseDeployment(ctx) {
|
|
1608
|
+
return this.setDeploymentPaused(ctx, true);
|
|
1609
|
+
}
|
|
1610
|
+
async unpauseDeployment(ctx) {
|
|
1611
|
+
return this.setDeploymentPaused(ctx, false);
|
|
1612
|
+
}
|
|
1613
|
+
async setDeploymentPaused(ctx, paused) {
|
|
1614
|
+
if (!ctx.id) throw new UserError(`Deployment '${ctx.name}' has no remote id; run \`agents apply\` first.`);
|
|
1615
|
+
const action = paused ? "pause" : "unpause";
|
|
1616
|
+
const res = await this.client.post(`/deployments/${ctx.id}/${action}`, {});
|
|
1617
|
+
return toDeploymentInfo(res);
|
|
1618
|
+
}
|
|
1559
1619
|
async createSession(bindings) {
|
|
1560
1620
|
if (bindings.delivery === "forward") throw new UserError("Claude does not support Forward sessions.");
|
|
1561
1621
|
const body = mapSession(bindings);
|
|
@@ -1627,6 +1687,16 @@ var ClaudeAdapter = class _ClaudeAdapter {
|
|
|
1627
1687
|
await this.client.delete(`/files/${id}`);
|
|
1628
1688
|
}
|
|
1629
1689
|
};
|
|
1690
|
+
function toDeploymentInfo(res) {
|
|
1691
|
+
const sched = res.schedule;
|
|
1692
|
+
return {
|
|
1693
|
+
id: res.id ?? null,
|
|
1694
|
+
status: res.status ?? "unknown",
|
|
1695
|
+
paused_reason: res.paused_reason ?? void 0,
|
|
1696
|
+
schedule: sched ? { expression: sched.expression, timezone: sched.timezone } : void 0,
|
|
1697
|
+
attributes: res
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1630
1700
|
function toSessionInfo(res) {
|
|
1631
1701
|
return buildSessionInfo(
|
|
1632
1702
|
res,
|
|
@@ -1934,6 +2004,7 @@ function mapDeployment2(name, decl, refs, projectName, uploadedFiles) {
|
|
|
1934
2004
|
};
|
|
1935
2005
|
}
|
|
1936
2006
|
if (decl.description) body.description = decl.description;
|
|
2007
|
+
if (decl.environment_variables !== void 0) body.environment_variables = decl.environment_variables;
|
|
1937
2008
|
if (projectName) {
|
|
1938
2009
|
body.metadata = injectMetadata(decl.metadata, projectName, name);
|
|
1939
2010
|
} else if (decl.metadata) {
|
|
@@ -1941,6 +2012,24 @@ function mapDeployment2(name, decl, refs, projectName, uploadedFiles) {
|
|
|
1941
2012
|
}
|
|
1942
2013
|
return body;
|
|
1943
2014
|
}
|
|
2015
|
+
function mapDeploymentUpdate2(name, decl, refs, projectName, uploadedFiles, existingMetadata) {
|
|
2016
|
+
const body = mapDeployment2(name, decl, refs, projectName, uploadedFiles);
|
|
2017
|
+
body.vault_ids = refs.vault_ids;
|
|
2018
|
+
body.resources = mapDeploymentResources2(decl, refs, uploadedFiles);
|
|
2019
|
+
if (decl.schedule) {
|
|
2020
|
+
body.schedule = { type: "cron", expression: decl.schedule.expression, timezone: decl.schedule.timezone };
|
|
2021
|
+
}
|
|
2022
|
+
body.description = decl.description ?? "";
|
|
2023
|
+
body.environment_variables = decl.environment_variables ?? null;
|
|
2024
|
+
const desiredMetadata = projectName ? injectMetadata(decl.metadata, projectName, name) : decl.metadata ?? {};
|
|
2025
|
+
body.metadata = {
|
|
2026
|
+
...Object.fromEntries(
|
|
2027
|
+
Object.keys(existingMetadata ?? {}).filter((key) => !(key in desiredMetadata)).map((key) => [key, null])
|
|
2028
|
+
),
|
|
2029
|
+
...desiredMetadata
|
|
2030
|
+
};
|
|
2031
|
+
return body;
|
|
2032
|
+
}
|
|
1944
2033
|
function mapDeploymentInitialEvents(events) {
|
|
1945
2034
|
return events.map((ev) => {
|
|
1946
2035
|
if (ev.type === "user.message" || ev.type === "system.message") {
|
|
@@ -2234,6 +2323,16 @@ function deriveForwardGateway(cloudGateway) {
|
|
|
2234
2323
|
const trimmed = cloudGateway.replace(/\/$/, "");
|
|
2235
2324
|
return trimmed.endsWith("/cloud") ? `${trimmed.slice(0, -"/cloud".length)}/forward` : `${trimmed}/forward`;
|
|
2236
2325
|
}
|
|
2326
|
+
function toDeploymentInfo2(res) {
|
|
2327
|
+
const sched = res.schedule;
|
|
2328
|
+
return {
|
|
2329
|
+
id: res.id ?? null,
|
|
2330
|
+
status: res.status ?? "unknown",
|
|
2331
|
+
paused_reason: res.paused_reason ?? void 0,
|
|
2332
|
+
schedule: sched ? { expression: sched.expression, timezone: sched.timezone } : void 0,
|
|
2333
|
+
attributes: res
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2237
2336
|
var QoderAdapter = class _QoderAdapter {
|
|
2238
2337
|
name = "qoder";
|
|
2239
2338
|
eventResume = true;
|
|
@@ -2279,8 +2378,8 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2279
2378
|
vault: "/vaults",
|
|
2280
2379
|
skill: "/skills",
|
|
2281
2380
|
memory_store: "/memory_stores",
|
|
2282
|
-
file: "/files"
|
|
2283
|
-
|
|
2381
|
+
file: "/files",
|
|
2382
|
+
deployment: "/deployments"
|
|
2284
2383
|
};
|
|
2285
2384
|
async findResource(type, name, id) {
|
|
2286
2385
|
if (type === "template") {
|
|
@@ -2704,7 +2803,20 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2704
2803
|
}
|
|
2705
2804
|
async updateDeployment(id, name, decl, refs, basePath) {
|
|
2706
2805
|
const uploaded = await this.uploadDeploymentFiles(decl, basePath);
|
|
2707
|
-
const
|
|
2806
|
+
const current = await this.client.get(`/deployments/${id}`);
|
|
2807
|
+
if (current.schedule && !decl.schedule) {
|
|
2808
|
+
throw new UserError(
|
|
2809
|
+
`Deployment '${name}' cannot remove its schedule through the documented Qoder update API; archive and recreate it as a manual deployment.`
|
|
2810
|
+
);
|
|
2811
|
+
}
|
|
2812
|
+
const body = mapDeploymentUpdate2(
|
|
2813
|
+
name,
|
|
2814
|
+
decl,
|
|
2815
|
+
refs,
|
|
2816
|
+
this.projectName,
|
|
2817
|
+
uploaded,
|
|
2818
|
+
current.metadata
|
|
2819
|
+
);
|
|
2708
2820
|
const res = await this.client.post(`/deployments/${id}`, body);
|
|
2709
2821
|
return toRemoteResource(res);
|
|
2710
2822
|
}
|
|
@@ -2739,6 +2851,35 @@ var QoderAdapter = class _QoderAdapter {
|
|
|
2739
2851
|
attributes: res
|
|
2740
2852
|
};
|
|
2741
2853
|
}
|
|
2854
|
+
async listDeployments(filter) {
|
|
2855
|
+
const params = new URLSearchParams();
|
|
2856
|
+
if (filter?.agent_id) params.set("agent_id", filter.agent_id);
|
|
2857
|
+
if (filter?.status) params.set("status", filter.status);
|
|
2858
|
+
if (filter?.include_archived) params.set("include_archived", "true");
|
|
2859
|
+
if (filter?.limit) params.set("limit", String(filter.limit));
|
|
2860
|
+
if (filter?.page) params.set("page", filter.page);
|
|
2861
|
+
if (filter?.created_at_gte) params.set("created_at[gte]", filter.created_at_gte);
|
|
2862
|
+
if (filter?.created_at_lte) params.set("created_at[lte]", filter.created_at_lte);
|
|
2863
|
+
const query2 = params.toString();
|
|
2864
|
+
const res = await this.client.get(`/deployments${query2 ? `?${query2}` : ""}`);
|
|
2865
|
+
return {
|
|
2866
|
+
deployments: (res.data ?? []).map(toDeploymentInfo2),
|
|
2867
|
+
has_more: Boolean(res.has_more),
|
|
2868
|
+
next_page: res.next_page ?? void 0
|
|
2869
|
+
};
|
|
2870
|
+
}
|
|
2871
|
+
async pauseDeployment(ctx) {
|
|
2872
|
+
return this.setDeploymentPaused(ctx, true);
|
|
2873
|
+
}
|
|
2874
|
+
async unpauseDeployment(ctx) {
|
|
2875
|
+
return this.setDeploymentPaused(ctx, false);
|
|
2876
|
+
}
|
|
2877
|
+
async setDeploymentPaused(ctx, paused) {
|
|
2878
|
+
if (!ctx.id) throw new UserError(`Deployment '${ctx.name}' has no remote id; run \`agents apply\` first.`);
|
|
2879
|
+
const action = paused ? "pause" : "unpause";
|
|
2880
|
+
const res = await this.client.post(`/deployments/${ctx.id}/${action}`, {});
|
|
2881
|
+
return toDeploymentInfo2(res);
|
|
2882
|
+
}
|
|
2742
2883
|
async uploadDeploymentFiles(decl, basePath) {
|
|
2743
2884
|
const map = /* @__PURE__ */ new Map();
|
|
2744
2885
|
for (const r of decl.resources ?? []) {
|
|
@@ -5132,7 +5273,8 @@ var deploymentSchema = z5.object({
|
|
|
5132
5273
|
schedule: scheduleSchema.optional(),
|
|
5133
5274
|
description: z5.string().optional(),
|
|
5134
5275
|
provider: z5.string().optional(),
|
|
5135
|
-
metadata: z5.record(z5.string(), z5.string()).optional()
|
|
5276
|
+
metadata: z5.record(z5.string(), z5.string()).optional(),
|
|
5277
|
+
environment_variables: z5.string().optional()
|
|
5136
5278
|
});
|
|
5137
5279
|
var projectConfigSchema = z5.object({
|
|
5138
5280
|
version: z5.string(),
|
|
@@ -6536,6 +6678,14 @@ function collectProviderCapabilities(config, providers, diagnostics) {
|
|
|
6536
6678
|
}
|
|
6537
6679
|
}
|
|
6538
6680
|
for (const [name, deployment] of Object.entries(config.deployments ?? {})) {
|
|
6681
|
+
if (deployment.provider && deployment.provider !== providerName) continue;
|
|
6682
|
+
if (deployment.environment_variables !== void 0) {
|
|
6683
|
+
diagnostics.error(
|
|
6684
|
+
`${providerName}.deployment.environment_variables.unsupported`,
|
|
6685
|
+
`deployment.${name}: environment_variables is supported only by Qoder deployments; remove it or pin this deployment to the qoder provider.`,
|
|
6686
|
+
{ type: "deployment", name, provider: providerName }
|
|
6687
|
+
);
|
|
6688
|
+
}
|
|
6539
6689
|
if (deployment.tunnel && (!deployment.provider || deployment.provider === providerName)) {
|
|
6540
6690
|
diagnostics.error(
|
|
6541
6691
|
`${providerName}.deployment.tunnel.unsupported`,
|
|
@@ -7498,6 +7648,12 @@ async function readYaml(path) {
|
|
|
7498
7648
|
}
|
|
7499
7649
|
|
|
7500
7650
|
// src/internal/core/deployment-runtime.ts
|
|
7651
|
+
async function listRemoteDeploymentsForContext(ctx, provider, filter) {
|
|
7652
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
7653
|
+
if (!adapter2.listDeployments)
|
|
7654
|
+
throw new UserError(`Provider '${provider}' does not support remote deployment listing.`);
|
|
7655
|
+
return adapter2.listDeployments(filter);
|
|
7656
|
+
}
|
|
7501
7657
|
function listDeploymentsForContext(ctx, providerFilter) {
|
|
7502
7658
|
let rows = ctx.state.listResources().filter((resource) => resource.address.type === "deployment");
|
|
7503
7659
|
if (providerFilter) {
|
|
@@ -7542,6 +7698,14 @@ async function runDeploymentForContext(ctx, name, adapter2, resolvedProvider) {
|
|
|
7542
7698
|
result: await effectiveAdapter.runDeployment(depCtx)
|
|
7543
7699
|
};
|
|
7544
7700
|
}
|
|
7701
|
+
async function pauseDeploymentForContext(ctx, name, paused, resolvedProvider) {
|
|
7702
|
+
const provider = resolvedProvider ?? resolveDeploymentProvider(name, ctx.config);
|
|
7703
|
+
const adapter2 = getRuntimeProvider(ctx, provider);
|
|
7704
|
+
const operation = paused ? adapter2.pauseDeployment : adapter2.unpauseDeployment;
|
|
7705
|
+
if (!operation)
|
|
7706
|
+
throw new UserError(`Provider '${provider}' does not support ${paused ? "pausing" : "unpausing"} deployments.`);
|
|
7707
|
+
return operation.call(adapter2, buildDeploymentContext(ctx, name, provider));
|
|
7708
|
+
}
|
|
7545
7709
|
function getDeploymentRuntimeProviderForContext(ctx, name, overrideProvider) {
|
|
7546
7710
|
return resolveDeploymentProvider(name, ctx.config, overrideProvider);
|
|
7547
7711
|
}
|
|
@@ -9375,6 +9539,7 @@ export {
|
|
|
9375
9539
|
listMemoryVersions,
|
|
9376
9540
|
listProviderModelsForContext,
|
|
9377
9541
|
listProviderNames,
|
|
9542
|
+
listRemoteDeploymentsForContext,
|
|
9378
9543
|
listSessionEvents,
|
|
9379
9544
|
listSessionSummaries,
|
|
9380
9545
|
listSkills,
|
|
@@ -9383,6 +9548,7 @@ export {
|
|
|
9383
9548
|
loadProviderConfigIntoEnvSync,
|
|
9384
9549
|
migrateConfig,
|
|
9385
9550
|
parseStateAddress,
|
|
9551
|
+
pauseDeploymentForContext,
|
|
9386
9552
|
planDestroyProjectContext,
|
|
9387
9553
|
planProjectContext,
|
|
9388
9554
|
preparePromptForProvider,
|