@amistio/cli 0.1.53 → 0.1.55
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.js +42 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3622,6 +3622,7 @@ function createDurableResultFinalizationEntry(input, now = (/* @__PURE__ */ new
|
|
|
3622
3622
|
});
|
|
3623
3623
|
}
|
|
3624
3624
|
function createImplementationFinalizationEntry(input, now = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
3625
|
+
const telemetry = normalizeImplementationFinalizationTelemetry(input.telemetry);
|
|
3625
3626
|
return implementationFinalizationEntrySchema.parse({
|
|
3626
3627
|
schemaVersion: 1,
|
|
3627
3628
|
kind: "implementationFinalization",
|
|
@@ -3635,7 +3636,7 @@ function createImplementationFinalizationEntry(input, now = (/* @__PURE__ */ new
|
|
|
3635
3636
|
attempt: input.attempt,
|
|
3636
3637
|
idempotencyKey: input.idempotencyKey,
|
|
3637
3638
|
finalStatus: input.finalStatus,
|
|
3638
|
-
telemetry
|
|
3639
|
+
telemetry,
|
|
3639
3640
|
retryCount: 0,
|
|
3640
3641
|
createdAt: now,
|
|
3641
3642
|
updatedAt: now
|
|
@@ -3830,6 +3831,18 @@ function implementationFinalizationEntryKey(entry) {
|
|
|
3830
3831
|
const hash = createHash2("sha256").update([entry.accountId, entry.projectId, entry.repositoryLinkId, entry.runnerId, entry.workItemId, String(entry.attempt), entry.idempotencyKey].join("\0")).digest("hex").slice(0, 32);
|
|
3831
3832
|
return `implementation-finalization-${hash}`;
|
|
3832
3833
|
}
|
|
3834
|
+
function normalizeImplementationFinalizationTelemetry(telemetry) {
|
|
3835
|
+
const { repositoryLockId, ...rest } = telemetry;
|
|
3836
|
+
const boundedRepositoryLockId = boundTelemetryIdentifier(repositoryLockId, 200);
|
|
3837
|
+
return { ...rest, ...boundedRepositoryLockId ? { repositoryLockId: boundedRepositoryLockId } : {} };
|
|
3838
|
+
}
|
|
3839
|
+
function boundTelemetryIdentifier(value, maxLength) {
|
|
3840
|
+
const trimmed = value?.trim();
|
|
3841
|
+
if (!trimmed) return void 0;
|
|
3842
|
+
if (trimmed.length <= maxLength) return trimmed;
|
|
3843
|
+
const hash = createHash2("sha256").update(trimmed).digest("hex").slice(0, 32);
|
|
3844
|
+
return `sha256:${hash}:length:${trimmed.length}`;
|
|
3845
|
+
}
|
|
3833
3846
|
function truncateLocalError(error) {
|
|
3834
3847
|
const trimmed = error.trim();
|
|
3835
3848
|
return trimmed.length > 600 ? `${trimmed.slice(0, 600)}...` : trimmed;
|
|
@@ -10814,6 +10827,12 @@ var AMISTIO_HARNESS_ID = "amistio";
|
|
|
10814
10827
|
function harnessMutationPolicyForWorkKind(workKind) {
|
|
10815
10828
|
return workKind === "implementation" || workKind === "promptBatch" ? "mutating" : "readOnly";
|
|
10816
10829
|
}
|
|
10830
|
+
function harnessMutationPolicyForWorkItem(workItem) {
|
|
10831
|
+
if (workItem.implementationExpectedOutcome === "analysisOnly" || workItem.implementationExpectedOutcome === "verificationOnly") {
|
|
10832
|
+
return "readOnly";
|
|
10833
|
+
}
|
|
10834
|
+
return harnessMutationPolicyForWorkKind(workItem.workKind);
|
|
10835
|
+
}
|
|
10817
10836
|
function createHarnessConcurrencyMetadata(executionPolicy, preview) {
|
|
10818
10837
|
const serializedResourceKeys = /* @__PURE__ */ new Set([
|
|
10819
10838
|
`claim-lane:${executionPolicy.claimLaneId}`,
|
|
@@ -12105,7 +12124,7 @@ async function runNextWorkItem({
|
|
|
12105
12124
|
...resolvedModelConfig,
|
|
12106
12125
|
executionPolicy: {
|
|
12107
12126
|
executionRoot,
|
|
12108
|
-
mutationPolicy:
|
|
12127
|
+
mutationPolicy: harnessMutationPolicyForWorkItem(result.workItem),
|
|
12109
12128
|
claimLaneId
|
|
12110
12129
|
}
|
|
12111
12130
|
});
|
|
@@ -12517,7 +12536,15 @@ async function runNextWorkItem({
|
|
|
12517
12536
|
...finalError ? { error: finalError } : {}
|
|
12518
12537
|
};
|
|
12519
12538
|
try {
|
|
12520
|
-
const implementationFinalization = await
|
|
12539
|
+
const implementationFinalization = isNonMutatingImplementationOutcome(result.workItem) ? await submitNonMutatingImplementationCompletion(apiClient, {
|
|
12540
|
+
attempt: result.workItem.attempt,
|
|
12541
|
+
finalStatus,
|
|
12542
|
+
idempotencyKey: finalizationIdempotencyKey,
|
|
12543
|
+
projectId,
|
|
12544
|
+
runnerId,
|
|
12545
|
+
telemetry: finalizationTelemetry,
|
|
12546
|
+
workItemId: result.workItem.workItemId
|
|
12547
|
+
}) : await submitStagedImplementationFinalization(apiClient, {
|
|
12521
12548
|
accountId: commandContext.accountId,
|
|
12522
12549
|
attempt: result.workItem.attempt,
|
|
12523
12550
|
finalStatus,
|
|
@@ -12598,6 +12625,9 @@ function isImplementationHandoffWork(workItem) {
|
|
|
12598
12625
|
if (workItem.implementationExpectedOutcome === "analysisOnly" || workItem.implementationExpectedOutcome === "verificationOnly") return false;
|
|
12599
12626
|
return workKind === "implementation" || workKind === "promptBatch";
|
|
12600
12627
|
}
|
|
12628
|
+
function isNonMutatingImplementationOutcome(workItem) {
|
|
12629
|
+
return workItem.implementationExpectedOutcome === "analysisOnly" || workItem.implementationExpectedOutcome === "verificationOnly";
|
|
12630
|
+
}
|
|
12601
12631
|
async function loadWorkItemRepositoryLink(apiClient, projectId, repositoryLinkId) {
|
|
12602
12632
|
const { repositoryLinks } = await apiClient.listRepositoryLinks(projectId);
|
|
12603
12633
|
return repositoryLinks.find((link) => link.repositoryLinkId === repositoryLinkId && link.status !== "revoked");
|
|
@@ -13312,6 +13342,15 @@ async function submitStagedImplementationFinalization(apiClient, input) {
|
|
|
13312
13342
|
await upsertImplementationFinalizationEntry(entry);
|
|
13313
13343
|
return submitImplementationFinalizationEntry(apiClient, entry);
|
|
13314
13344
|
}
|
|
13345
|
+
async function submitNonMutatingImplementationCompletion(apiClient, input) {
|
|
13346
|
+
try {
|
|
13347
|
+
const response = await apiClient.updateWorkStatus(input.projectId, input.workItemId, input.finalStatus, input.idempotencyKey, input.runnerId, input.telemetry);
|
|
13348
|
+
return { status: "completed", workItem: response.workItem };
|
|
13349
|
+
} catch (error) {
|
|
13350
|
+
const detail = truncateLogExcerpt(errorMessage7(error));
|
|
13351
|
+
return { status: "failed", message: `Non-mutating implementation completion ${input.workItemId} could not be recorded for attempt ${input.attempt}: ${detail}`, retryable: isRetryableApiError(error) };
|
|
13352
|
+
}
|
|
13353
|
+
}
|
|
13315
13354
|
function implementationFinalizationTelemetry(telemetry) {
|
|
13316
13355
|
const isolationMode = telemetry.isolationMode === "none" || telemetry.isolationMode === "gitWorktree" ? telemetry.isolationMode : void 0;
|
|
13317
13356
|
return {
|