impel-cli 0.20.2-beta.0 → 0.20.2
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/package.json +1 -1
- package/src/nativeAgentTransport.js +26 -7
package/package.json
CHANGED
|
@@ -47,6 +47,8 @@ const DEFAULT_ADMISSION_LEASE_MS = 10_000;
|
|
|
47
47
|
const STATE_COMMIT_LEASE_MARGIN_MS = 5_000;
|
|
48
48
|
const CIBI_START_IN_PROGRESS_CODE = "eve_run_drain_start_in_progress";
|
|
49
49
|
const CIBI_START_IN_PROGRESS_MESSAGE = "The durable Eve drain workflow is still being enqueued; retry this idempotent start.";
|
|
50
|
+
const CTOS_START_TIMEOUT_MESSAGE = `MCP tool call failed for ${NATIVE_AGENT_START_TOOL}: The operation was aborted due to timeout: mcp tool call failed`;
|
|
51
|
+
const MCP_TOOL_RESULT_ERROR = Symbol("native-agent MCP tool result error");
|
|
50
52
|
const TERMINAL_STATUSES = new Set(["succeeded", "failed", "cancelled", "canceled"]);
|
|
51
53
|
|
|
52
54
|
function stableValue(value) {
|
|
@@ -538,7 +540,9 @@ function toolPayload(message) {
|
|
|
538
540
|
const result = message.result;
|
|
539
541
|
const text = result?.content?.find((item) => item?.type === "text" && typeof item.text === "string")?.text;
|
|
540
542
|
if (result?.isError) {
|
|
541
|
-
|
|
543
|
+
const error = new NativeAgentUpstreamError(redactSecretText(text || "native-agent MCP tool failed"));
|
|
544
|
+
error[MCP_TOOL_RESULT_ERROR] = true;
|
|
545
|
+
throw error;
|
|
542
546
|
}
|
|
543
547
|
if (result?.structuredContent && typeof result.structuredContent === "object") {
|
|
544
548
|
return result.structuredContent;
|
|
@@ -664,7 +668,9 @@ export class NativeAgentUpstreamSession {
|
|
|
664
668
|
&& (error.incompleteResponse
|
|
665
669
|
|| error.code === CIBI_START_IN_PROGRESS_CODE
|
|
666
670
|
|| error.data?.code === CIBI_START_IN_PROGRESS_CODE
|
|
667
|
-
|| error.message === CIBI_START_IN_PROGRESS_MESSAGE
|
|
671
|
+
|| error.message === CIBI_START_IN_PROGRESS_MESSAGE
|
|
672
|
+
|| (error[MCP_TOOL_RESULT_ERROR] === true
|
|
673
|
+
&& error.message === CTOS_START_TIMEOUT_MESSAGE))) {
|
|
668
674
|
error.ambiguous = true;
|
|
669
675
|
}
|
|
670
676
|
throw error;
|
|
@@ -1822,6 +1828,11 @@ export class NativeAgentCompositeTransport {
|
|
|
1822
1828
|
throwIfAborted(signal);
|
|
1823
1829
|
if (!state.upstreamRunId) {
|
|
1824
1830
|
let started = null;
|
|
1831
|
+
// startAttempts is durably incremented before each outbound call. A
|
|
1832
|
+
// pre-existing attempt may have reached the upstream even when this
|
|
1833
|
+
// process did not observe an ambiguous response (for example, after a
|
|
1834
|
+
// crash), so later definitive failures cannot prove that no run exists.
|
|
1835
|
+
let startOutcomeUncertain = state.startAttempts > 0;
|
|
1825
1836
|
for (let attempt = 0; attempt < 2; attempt += 1) {
|
|
1826
1837
|
state.startAttempts += 1;
|
|
1827
1838
|
state.updatedAt = new Date(this.now()).toISOString();
|
|
@@ -1832,12 +1843,20 @@ export class NativeAgentCompositeTransport {
|
|
|
1832
1843
|
} catch (error) {
|
|
1833
1844
|
if (error?.name === "AbortError") throw error;
|
|
1834
1845
|
if (!error?.ambiguous) {
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1846
|
+
if (startOutcomeUncertain) {
|
|
1847
|
+
this.persistDiagnostic(state, error, lock);
|
|
1848
|
+
return handleForState(state);
|
|
1849
|
+
}
|
|
1850
|
+
this.compactTerminalFailure(
|
|
1851
|
+
state,
|
|
1852
|
+
state,
|
|
1853
|
+
"LOCAL_START_REJECTED",
|
|
1854
|
+
"The native-agent start request was definitively rejected by the upstream service.",
|
|
1855
|
+
lock,
|
|
1856
|
+
);
|
|
1857
|
+
return resultForState(state);
|
|
1840
1858
|
}
|
|
1859
|
+
startOutcomeUncertain = true;
|
|
1841
1860
|
this.persistDiagnostic(state, error, lock);
|
|
1842
1861
|
}
|
|
1843
1862
|
}
|