@atolis-hq/wake 0.4.91 → 0.4.92
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/src/activities/agent/agent-activity.js +10 -1
- package/dist/src/activities/agent/agent-result.d.ts +5 -1
- package/dist/src/activities/agent/agent-result.js +5 -1
- package/dist/src/activities/contracts/vocabulary.d.ts +2 -0
- package/dist/src/activities/contracts/vocabulary.js +2 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/execution/infrastructure/agent-runner-adapter.js +4 -2
- package/dist/src/execution/infrastructure/runners/claude.js +12 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActivityFailureCode, ActivityOutcomeKind, ActivityRunnerTransportStatus, } from '../contracts/vocabulary.js';
|
|
1
|
+
import { ActivityFailureCode, ActivityOutcomeKind, ActivityRunnerTransportStatus, ClaudeAuthenticationFailureKind, } from '../contracts/vocabulary.js';
|
|
2
2
|
import { translateAgentResult } from './agent-result.js';
|
|
3
3
|
export function createAgentActivity(templates, contextReader) {
|
|
4
4
|
return {
|
|
@@ -185,6 +185,15 @@ function agentOutcome(result) {
|
|
|
185
185
|
kind: ActivityOutcomeKind.Blocked,
|
|
186
186
|
data: { reason: ActivityFailureCode.AmbiguousRunnerResult },
|
|
187
187
|
};
|
|
188
|
+
if (result.transport !== ActivityRunnerTransportStatus.Succeeded &&
|
|
189
|
+
result.failure?.kind === ClaudeAuthenticationFailureKind)
|
|
190
|
+
return {
|
|
191
|
+
kind: ActivityOutcomeKind.Blocked,
|
|
192
|
+
data: {
|
|
193
|
+
reason: ActivityFailureCode.RunnerAuthenticationRequired,
|
|
194
|
+
message: result.failure.message,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
188
197
|
if (result.transport !== ActivityRunnerTransportStatus.Succeeded)
|
|
189
198
|
return {
|
|
190
199
|
kind: ActivityOutcomeKind.Failed,
|
|
@@ -23,7 +23,11 @@ export declare const agentActivityOutcomeSchema: z.ZodUnion<readonly [z.ZodObjec
|
|
|
23
23
|
}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
24
24
|
status: z.ZodLiteral<"NEEDS_CLARIFICATION">;
|
|
25
25
|
}, z.core.$catchall<z.ZodUnknown>>, z.ZodObject<{
|
|
26
|
-
reason: z.
|
|
26
|
+
reason: z.ZodEnum<{
|
|
27
|
+
"ambiguous-runner-result": "ambiguous-runner-result";
|
|
28
|
+
"runner-authentication-required": "runner-authentication-required";
|
|
29
|
+
}>;
|
|
30
|
+
message: z.ZodOptional<z.ZodString>;
|
|
27
31
|
}, z.core.$strict>]>;
|
|
28
32
|
}, z.core.$strict>, z.ZodObject<{
|
|
29
33
|
kind: z.ZodLiteral<"failed">;
|
|
@@ -9,7 +9,11 @@ export const reportedArtifactSchema = z
|
|
|
9
9
|
const structuredResult = (status) => z.object({ status: z.literal(status) }).catchall(z.unknown());
|
|
10
10
|
const blockedReason = z
|
|
11
11
|
.object({
|
|
12
|
-
reason: z.
|
|
12
|
+
reason: z.enum([
|
|
13
|
+
ActivityFailureCode.AmbiguousRunnerResult,
|
|
14
|
+
ActivityFailureCode.RunnerAuthenticationRequired,
|
|
15
|
+
]),
|
|
16
|
+
message: z.string().optional(),
|
|
13
17
|
})
|
|
14
18
|
.strict();
|
|
15
19
|
const failedReason = z
|
|
@@ -36,6 +36,7 @@ export declare const ActivityFailureCode: {
|
|
|
36
36
|
readonly InvalidAgentResult: "invalid-agent-result";
|
|
37
37
|
readonly AmbiguousRunnerResult: "ambiguous-runner-result";
|
|
38
38
|
readonly RunnerFailed: "runner-failed";
|
|
39
|
+
readonly RunnerAuthenticationRequired: "runner-authentication-required";
|
|
39
40
|
readonly RunnerQuotaExceeded: "runner-quota-exceeded";
|
|
40
41
|
};
|
|
41
42
|
export type ActivityFailureCode = ValueOf<typeof ActivityFailureCode>;
|
|
@@ -75,3 +76,4 @@ export declare const AgentResultStatus: {
|
|
|
75
76
|
readonly Failed: "FAILED";
|
|
76
77
|
};
|
|
77
78
|
export type AgentResultStatus = ValueOf<typeof AgentResultStatus>;
|
|
79
|
+
export declare const ClaudeAuthenticationFailureKind = "claude-authentication-required";
|
|
@@ -31,6 +31,7 @@ export const ActivityFailureCode = defineClosedVocabulary({
|
|
|
31
31
|
InvalidAgentResult: 'invalid-agent-result',
|
|
32
32
|
AmbiguousRunnerResult: 'ambiguous-runner-result',
|
|
33
33
|
RunnerFailed: 'runner-failed',
|
|
34
|
+
RunnerAuthenticationRequired: 'runner-authentication-required',
|
|
34
35
|
RunnerQuotaExceeded: 'runner-quota-exceeded',
|
|
35
36
|
});
|
|
36
37
|
export const ActivityOutcomeKind = defineClosedVocabulary({
|
|
@@ -65,3 +66,4 @@ export const AgentResultStatus = {
|
|
|
65
66
|
NeedsClarification: 'NEEDS_CLARIFICATION',
|
|
66
67
|
Failed: 'FAILED',
|
|
67
68
|
};
|
|
69
|
+
export const ClaudeAuthenticationFailureKind = 'claude-authentication-required';
|
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.92";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentResultStatus, parseAgentStatusMarker, translateAgentResult, } from '../../activities/index.js';
|
|
1
|
+
import { AgentResultStatus, ClaudeAuthenticationFailureKind, parseAgentStatusMarker, translateAgentResult, } from '../../activities/index.js';
|
|
2
2
|
import { RunStatus } from '../contracts/vocabulary.js';
|
|
3
3
|
export function parseAgentRunnerResponse(result) {
|
|
4
4
|
const parsed = parseResult(result.output);
|
|
@@ -6,7 +6,9 @@ export function parseAgentRunnerResponse(result) {
|
|
|
6
6
|
? AgentResultStatus.Blocked
|
|
7
7
|
: result.transport === RunStatus.Succeeded
|
|
8
8
|
? parsed.outcome
|
|
9
|
-
:
|
|
9
|
+
: result.failure?.kind === ClaudeAuthenticationFailureKind
|
|
10
|
+
? AgentResultStatus.Blocked
|
|
11
|
+
: AgentResultStatus.Failed;
|
|
10
12
|
return {
|
|
11
13
|
outcome,
|
|
12
14
|
displayBody: result.transport === RunStatus.Succeeded && result.unverifiedCompletionReason === undefined
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalExecutionKind } from '../../../activities/index.js';
|
|
1
|
+
import { ClaudeAuthenticationFailureKind, ExternalExecutionKind, } from '../../../activities/index.js';
|
|
2
2
|
import { ProviderQuotaExceededFailureKind, WakeMcpServerName } from '../../contracts/runner.js';
|
|
3
3
|
import { ExecutionCancellationReason, RunStatus } from '../../contracts/vocabulary.js';
|
|
4
4
|
import { runProcess, } from '../process-execution.js';
|
|
@@ -29,10 +29,18 @@ export function parseClaudeOutput(stdout, _request) {
|
|
|
29
29
|
// key) are NOT included here — they are a different failure class and must
|
|
30
30
|
// not be paused-and-retried as if they were transient.
|
|
31
31
|
const claudeQuotaPattern = /rate limit|quota|credit balance|spend limit|usage limit|session limit|too many requests|\b429\b/i;
|
|
32
|
+
const claudeAuthenticationPattern = /authenticate|authentication|unauthorized|oauth.*(?:expired|refresh)|session expired|not logged in|please (?:log|sign) in|invalid api key/i;
|
|
32
33
|
export function classifyClaudeFailure(input) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const structured = parseRecord(input.stdout);
|
|
35
|
+
if (structured?.is_error === true && typeof structured.result === 'string') {
|
|
36
|
+
const message = structured.result.trim();
|
|
37
|
+
if (claudeAuthenticationPattern.test(message))
|
|
38
|
+
return { kind: ClaudeAuthenticationFailureKind, message };
|
|
39
|
+
if (claudeQuotaPattern.test(message))
|
|
40
|
+
return { kind: ProviderQuotaExceededFailureKind, message };
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
// Preserve plain CLI diagnostics, preferring stderr over stdout.
|
|
36
44
|
const text = input.stderr.trim().length > 0 ? input.stderr : input.stdout;
|
|
37
45
|
if (!claudeQuotaPattern.test(text))
|
|
38
46
|
return undefined;
|