@atolis-hq/wake 0.4.38 → 0.4.40

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.
Files changed (36) hide show
  1. package/dist/src/activities/agent/agent-result.d.ts +2 -0
  2. package/dist/src/activities/agent/agent-result.js +8 -0
  3. package/dist/src/bootstrap/surface-api-applications.js +13 -0
  4. package/dist/src/bootstrap/version.js +1 -1
  5. package/dist/src/integrations/contracts/provider.d.ts +14 -2
  6. package/dist/src/integrations/contracts/provider.js +4 -0
  7. package/dist/src/integrations/github/infrastructure/comment-source.js +7 -4
  8. package/dist/src/integrations/github/infrastructure/poll-watermark.d.ts +24 -0
  9. package/dist/src/integrations/github/infrastructure/poll-watermark.js +37 -1
  10. package/dist/src/integrations/github/infrastructure/pr-evidence.d.ts +18 -0
  11. package/dist/src/integrations/github/infrastructure/pr-evidence.js +32 -0
  12. package/dist/src/integrations/github/infrastructure/pr-source.d.ts +6 -2
  13. package/dist/src/integrations/github/infrastructure/pr-source.js +27 -38
  14. package/dist/src/integrations/github/infrastructure/source.js +33 -25
  15. package/dist/src/integrations/github/infrastructure/webhook.js +11 -2
  16. package/dist/src/integrations/github/provider.d.ts +1 -1
  17. package/dist/src/integrations/github/provider.js +10 -1
  18. package/dist/src/orchestration/application/advance-workflow.d.ts +1 -0
  19. package/dist/src/orchestration/application/advance-workflow.js +7 -1
  20. package/dist/src/orchestration/application/conversation-command-reactor.js +5 -2
  21. package/dist/src/orchestration/application/orchestration-service.d.ts +1 -0
  22. package/dist/src/orchestration/application/orchestration-service.js +3 -0
  23. package/dist/src/orchestration/domain/interpreter.d.ts +1 -1
  24. package/dist/src/orchestration/domain/interpreter.js +1 -1
  25. package/dist/src/orchestration/domain/operator-retry-policy.d.ts +2 -0
  26. package/dist/src/orchestration/domain/operator-retry-policy.js +15 -9
  27. package/dist/src/surfaces/api/contracts/system.d.ts +18 -1
  28. package/dist/src/surfaces/api/contracts/system.js +4 -1
  29. package/dist/src/surfaces/api/routes/applications.d.ts +2 -1
  30. package/dist/src/surfaces/api/routes/read.js +4 -0
  31. package/dist/src/surfaces/api/routes/system.d.ts +1 -1
  32. package/dist/src/surfaces/api/routes/system.js +1 -0
  33. package/dist/src/surfaces/web-assets/assets/index-DkmZZW60.js +1179 -0
  34. package/dist/src/surfaces/web-assets/index.html +1 -1
  35. package/package.json +1 -1
  36. package/dist/src/surfaces/web-assets/assets/index-aL1g5gVQ.js +0 -1179
@@ -61,6 +61,7 @@ export declare class OrchestrationService {
61
61
  retryBlockedFailedStage(workflowInstanceId: WorkflowInstanceId, context: CommandContext): Promise<WorkflowInstanceView>;
62
62
  restartBlockedFailedStage(workflowInstanceId: WorkflowInstanceId, context: CommandContext): Promise<WorkflowInstanceView>;
63
63
  resumeBlockedStageForChanges(workflowInstanceId: WorkflowInstanceId, context: CommandContext): Promise<WorkflowInstanceView | null>;
64
+ resumeNeedsClarificationStage(workflowInstanceId: WorkflowInstanceId, context: CommandContext): Promise<WorkflowInstanceView | null>;
64
65
  extendBlockedGroupBudget(workflowInstanceId: WorkflowInstanceId, authority: {
65
66
  readonly kind: string;
66
67
  }, context: CommandContext): Promise<import("../contracts/views.js").GroupBudgetExhaustedView | WorkflowInstanceView>;
@@ -137,6 +137,9 @@ export class OrchestrationService {
137
137
  resumeBlockedStageForChanges(workflowInstanceId, context) {
138
138
  return this.transitionWatchChildren(context, () => this.advanceWorkflow.resumeBlockedStageForChanges(workflowInstanceId, context));
139
139
  }
140
+ resumeNeedsClarificationStage(workflowInstanceId, context) {
141
+ return this.transitionWatchChildren(context, () => this.advanceWorkflow.resumeNeedsClarificationStage(workflowInstanceId, context));
142
+ }
140
143
  async extendBlockedGroupBudget(workflowInstanceId, authority, context) {
141
144
  if (authority.kind !== ApprovalAuthorityKind.Human)
142
145
  throw new GroupBudgetExtensionIneligibleError('A group budget extension requires human authority');
@@ -7,7 +7,7 @@ export { acceptSignal, waitForSignal } from './signal-policy.js';
7
7
  export type { AcceptSignal } from './signal-policy.js';
8
8
  export { requestSupplementalActivity } from './supplemental-policy.js';
9
9
  export type { SupplementalActivityRequest } from './supplemental-policy.js';
10
- export { isChangesResumeEligible, isGroupBudgetExtensionEligible, isOperatorRetryEligible, requestChangesResume, requestFreshOperatorRetry, requestOperatorRetry, selectOperatorRetryTarget, } from './operator-retry-policy.js';
10
+ export { isChangesResumeEligible, isGroupBudgetExtensionEligible, isNeedsClarificationResumeEligible, isOperatorRetryEligible, requestChangesResume, requestFreshOperatorRetry, requestOperatorRetry, selectOperatorRetryTarget, } from './operator-retry-policy.js';
11
11
  export type { OperatorRetryRequest } from './operator-retry-policy.js';
12
12
  export { isRunnerQuotaRetryEligible, requestRunnerQuotaRetry, } from './runner-quota-retry-policy.js';
13
13
  export type { RunnerQuotaRetryRequest } from './runner-quota-retry-policy.js';
@@ -10,7 +10,7 @@ import { finishRoute } from './transition.js';
10
10
  export { startInstance } from './activation-policy.js';
11
11
  export { acceptSignal, waitForSignal } from './signal-policy.js';
12
12
  export { requestSupplementalActivity } from './supplemental-policy.js';
13
- export { isChangesResumeEligible, isGroupBudgetExtensionEligible, isOperatorRetryEligible, requestChangesResume, requestFreshOperatorRetry, requestOperatorRetry, selectOperatorRetryTarget, } from './operator-retry-policy.js';
13
+ export { isChangesResumeEligible, isGroupBudgetExtensionEligible, isNeedsClarificationResumeEligible, isOperatorRetryEligible, requestChangesResume, requestFreshOperatorRetry, requestOperatorRetry, selectOperatorRetryTarget, } from './operator-retry-policy.js';
14
14
  export { isRunnerQuotaRetryEligible, requestRunnerQuotaRetry, } from './runner-quota-retry-policy.js';
15
15
  export function acceptActivityOutcome(definition, state, input) {
16
16
  if (!isPendingOutcome(state, input))
@@ -7,6 +7,8 @@ export interface OperatorRetryRequest extends DecisionContext {
7
7
  export declare function isOperatorRetryEligible(view: WorkflowInstanceView): boolean;
8
8
  export declare function selectOperatorRetryTarget(workflows: readonly WorkflowInstanceView[]): WorkflowInstanceView | undefined;
9
9
  export declare function isChangesResumeEligible(view: WorkflowInstanceView): boolean;
10
+ /** A clarification reply may be supplied by any conversation participant. */
11
+ export declare function isNeedsClarificationResumeEligible(view: WorkflowInstanceView): boolean;
10
12
  export declare function isGroupBudgetExtensionEligible(view: WorkflowInstanceView): boolean;
11
13
  export declare function requestOperatorRetry(definition: CompiledWorkflow, state: WorkflowInstanceView, input: OperatorRetryRequest): OrchestrationDecision;
12
14
  /** Re-requests the failed stage while requiring a new runner session. */
@@ -1,4 +1,4 @@
1
- import { ActivityOutcomeKind, BuiltInActivityName } from '../../activities/index.js';
1
+ import { ActivityOutcomeKind, BuiltInActivityName, isNeedsClarificationAgentOutcome, } from '../../activities/index.js';
2
2
  import { OrchestrationEventType, WatchGateVerdictSignal } from '../contracts/events.js';
3
3
  import { signalName, stageName, watchId } from '../contracts/identifiers.js';
4
4
  import { ActivityActivationStatus, ApprovalAuthorityKind, WorkflowStatus, } from '../contracts/vocabulary.js';
@@ -49,20 +49,26 @@ export function selectOperatorRetryTarget(workflows) {
49
49
  isOperatorRetryEligible(workflow));
50
50
  }
51
51
  export function isChangesResumeEligible(view) {
52
- const pending = view.pendingActivation;
53
- const completedAgentStage = pending !== undefined &&
54
- pending.activity === BuiltInActivityName.Agent &&
55
- pending.status === ActivityActivationStatus.Completed &&
56
- pending.supplemental !== true &&
57
- pending.followOnIndex === undefined &&
58
- view.acceptedOutcomes.includes(pending.activationId);
59
- if (!completedAgentStage)
52
+ if (!isCompletedAgentStage(view))
60
53
  return false;
61
54
  return ((view.status === WorkflowStatus.Blocked &&
62
55
  view.blockReason === 'unconfigured outcome blocked' &&
63
56
  view.lastOutcome?.kind === ActivityOutcomeKind.Blocked) ||
64
57
  (view.status === WorkflowStatus.Waiting && view.waitingFor !== undefined));
65
58
  }
59
+ /** A clarification reply may be supplied by any conversation participant. */
60
+ export function isNeedsClarificationResumeEligible(view) {
61
+ return isChangesResumeEligible(view) && isNeedsClarificationAgentOutcome(view.lastOutcome);
62
+ }
63
+ function isCompletedAgentStage(view) {
64
+ const pending = view.pendingActivation;
65
+ return (pending !== undefined &&
66
+ pending.activity === BuiltInActivityName.Agent &&
67
+ pending.status === ActivityActivationStatus.Completed &&
68
+ pending.supplemental !== true &&
69
+ pending.followOnIndex === undefined &&
70
+ view.acceptedOutcomes.includes(pending.activationId));
71
+ }
66
72
  export function isGroupBudgetExtensionEligible(view) {
67
73
  return (view.status === WorkflowStatus.Blocked &&
68
74
  view.blockReason?.startsWith('watch group budget exhausted for ') === true &&
@@ -1,3 +1,8 @@
1
+ import { type ValueOf } from '../../../kernel/index.js';
2
+ export declare const ApiAdapterHealthStatus: {
3
+ readonly Unknown: "unknown";
4
+ };
5
+ export type ApiAdapterHealthStatus = 'ok' | 'degraded' | ValueOf<typeof ApiAdapterHealthStatus>;
1
6
  export interface HealthResponse {
2
7
  readonly status: 'ok' | 'degraded';
3
8
  readonly version: string;
@@ -12,7 +17,7 @@ export interface HealthResponse {
12
17
  readonly provider: string;
13
18
  readonly scope: string;
14
19
  readonly channel: string;
15
- readonly status: 'ok' | 'degraded';
20
+ readonly status: ApiAdapterHealthStatus;
16
21
  readonly detail?: string;
17
22
  readonly successCount: number;
18
23
  readonly failureCount: number;
@@ -30,3 +35,15 @@ export interface CommandsResponse {
30
35
  }[];
31
36
  }[];
32
37
  }
38
+ export interface WebhookSetupResponse {
39
+ readonly adapters: readonly {
40
+ readonly adapter: string;
41
+ readonly provider: string;
42
+ readonly hooks: readonly {
43
+ readonly scope: string;
44
+ readonly endpoint: string;
45
+ readonly events: readonly string[];
46
+ readonly secret: string;
47
+ }[];
48
+ }[];
49
+ }
@@ -1 +1,4 @@
1
- export {};
1
+ import { defineClosedVocabulary } from '../../../kernel/index.js';
2
+ export const ApiAdapterHealthStatus = defineClosedVocabulary({
3
+ Unknown: 'unknown',
4
+ });
@@ -1,5 +1,5 @@
1
1
  import type { RunStatus } from '../../../execution/index.js';
2
- import type { ApiCommandResult, AuditEventResponse, BoardCardResponse, BoardResponse, CommandsResponse, ConfigurationResponse, ControlPlaneStatusResponse, ConversationMessageRequest, HealthResponse, MetricsResponse, ResourceItemResponse, ResourceResponse, ResponseMeta, RunnerResponse, RunResponse, RunTranscriptResponse, StatusResponse, WorkDetailResponse, WorkflowDiagramsResponse, WorkflowInstanceResponse, WorkItemResponse, WorkItemTranscriptResponse } from '../contracts/index.js';
2
+ import type { ApiCommandResult, AuditEventResponse, BoardCardResponse, BoardResponse, CommandsResponse, ConfigurationResponse, ControlPlaneStatusResponse, ConversationMessageRequest, HealthResponse, MetricsResponse, ResourceItemResponse, ResourceResponse, ResponseMeta, RunnerResponse, RunResponse, RunTranscriptResponse, StatusResponse, WebhookSetupResponse, WorkDetailResponse, WorkflowDiagramsResponse, WorkflowInstanceResponse, WorkItemResponse, WorkItemTranscriptResponse } from '../contracts/index.js';
3
3
  export interface CollectionQuery {
4
4
  readonly cursor?: {
5
5
  readonly position: number;
@@ -34,6 +34,7 @@ export interface ApiSystemApplications {
34
34
  health(): Promise<ApiResourceResult<HealthResponse>>;
35
35
  configuration(): Promise<ApiResourceResult<ConfigurationResponse>>;
36
36
  commands(): Promise<ApiResourceResult<CommandsResponse>>;
37
+ webhooks?(): Promise<ApiResourceResult<WebhookSetupResponse>>;
37
38
  }
38
39
  export interface ApiApplications {
39
40
  readonly now: () => string;
@@ -38,6 +38,10 @@ async function readSingleton(applications, url) {
38
38
  return noQuery(url, async () => ok(await applications.system.configuration()));
39
39
  case '/api/v1/system/commands':
40
40
  return noQuery(url, async () => ok(await applications.system.commands()));
41
+ case '/api/v1/system/webhooks':
42
+ return applications.system.webhooks === undefined
43
+ ? unavailable('webhooks')
44
+ : noQuery(url, async () => ok(await applications.system.webhooks()));
41
45
  case '/api/v1/workflow-diagrams':
42
46
  return readWorkflowDiagrams(applications, url);
43
47
  default:
@@ -1 +1 @@
1
- export declare const systemRoutes: readonly ["/api/v1/system/health", "/api/v1/system/configuration", "/api/v1/system/commands"];
1
+ export declare const systemRoutes: readonly ["/api/v1/system/health", "/api/v1/system/configuration", "/api/v1/system/commands", "/api/v1/system/webhooks"];
@@ -2,4 +2,5 @@ export const systemRoutes = [
2
2
  '/api/v1/system/health',
3
3
  '/api/v1/system/configuration',
4
4
  '/api/v1/system/commands',
5
+ '/api/v1/system/webhooks',
5
6
  ];