@atolis-hq/wake 0.3.16 → 0.3.18
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/README.md +1 -0
- package/dist/src/bootstrap/composition-root.js +1 -0
- package/dist/src/bootstrap/version.js +1 -1
- package/dist/src/control-plane/domain/schedule-policy.js +27 -25
- package/dist/src/integrations/github/application/agent-run-comment.js +4 -1
- package/dist/src/integrations/github/application/outbound-translator.js +2 -1
- package/dist/src/integrations/github/provider.js +6 -1
- package/dist/src/surfaces/contracts/config.js +15 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -173,6 +173,7 @@ any time for the full command list, or see
|
|
|
173
173
|
- [docs/workflows.md](docs/workflows.md) - how stages, prompts, and runner routes are configured.
|
|
174
174
|
- [docs/prompts.md](docs/prompts.md) - how prompt templates map to workflow stages.
|
|
175
175
|
- [docs/configuration.md](docs/configuration.md) - `config.yaml`/`config.workflows.yaml` options and the operator correlation escape hatch.
|
|
176
|
+
- [docs/public-ui-access.md](docs/public-ui-access.md) - expose the operator UI through ngrok or another secured ingress.
|
|
176
177
|
- [docs/development.md](docs/development.md) - source-checkout dev setup (`wake-dev`), npm scripts, formatting, self-update, GitHub polling.
|
|
177
178
|
- [docs/runner-comparison.md](docs/runner-comparison.md) - capability differences between supported runners.
|
|
178
179
|
|
|
@@ -204,6 +204,7 @@ async function composeIntegrationRuntime(input) {
|
|
|
204
204
|
registry.register(fakeProviderDefinition);
|
|
205
205
|
registry.register(gitHubProviderDefinition);
|
|
206
206
|
const { instances, failures: providerFailures } = registry.compose(await hydrateFakeProviderEvidence(input.wakeRoot, input.config.integrations), {
|
|
207
|
+
publicUiUrl: input.config.surfaces.web.publicUrl,
|
|
207
208
|
work: input.work,
|
|
208
209
|
resources: input.resources,
|
|
209
210
|
resourceLookup: input.lookup,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CronExpressionParser } from 'cron-parser';
|
|
1
2
|
export class SchedulePolicy {
|
|
2
3
|
elapsedSlots(config, now, checkpoint) {
|
|
3
4
|
const end = minute(new Date(now));
|
|
@@ -7,13 +8,22 @@ export class SchedulePolicy {
|
|
|
7
8
|
const fields = config.cron.trim().split(/\s+/);
|
|
8
9
|
if (fields.length !== 5)
|
|
9
10
|
throw new Error(`Schedule ${config.id} must use a five-field cron expression`);
|
|
11
|
+
if (fields.some(hasUnsupportedSyntax))
|
|
12
|
+
throw new Error(`Schedule ${config.id} uses unsupported cron syntax`);
|
|
13
|
+
const expression = CronExpressionParser.parse(config.cron, {
|
|
14
|
+
currentDate: new Date(start - 1),
|
|
15
|
+
endDate: new Date(end),
|
|
16
|
+
tz: 'UTC',
|
|
17
|
+
});
|
|
18
|
+
const dayOfMonth = fieldExpression(fields, 2, 4);
|
|
19
|
+
const dayOfWeek = fieldExpression(fields, 4, 2);
|
|
10
20
|
const slots = [];
|
|
11
|
-
|
|
12
|
-
const date =
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
21
|
+
while (expression.hasNext()) {
|
|
22
|
+
const date = expression.next().toDate();
|
|
23
|
+
if (!matchesDays(date, dayOfMonth, dayOfWeek))
|
|
24
|
+
continue;
|
|
25
|
+
const at = date.toISOString();
|
|
26
|
+
slots.push({ identity: `schedule:${config.id}:${at}`, at });
|
|
17
27
|
}
|
|
18
28
|
return slots;
|
|
19
29
|
}
|
|
@@ -23,24 +33,16 @@ function minute(value) {
|
|
|
23
33
|
throw new Error('Schedule timestamps must be valid dates');
|
|
24
34
|
return Math.floor(value.getTime() / 60_000) * 60_000;
|
|
25
35
|
}
|
|
26
|
-
function
|
|
27
|
-
return (
|
|
28
|
-
matchesField(fields[1], date.getUTCHours(), 0, 23) &&
|
|
29
|
-
matchesField(fields[2], date.getUTCDate(), 1, 31) &&
|
|
30
|
-
matchesField(fields[3], date.getUTCMonth() + 1, 1, 12) &&
|
|
31
|
-
matchesField(fields[4], date.getUTCDay(), 0, 6));
|
|
36
|
+
function hasUnsupportedSyntax(field) {
|
|
37
|
+
return /[?#]|(^|[,*/-])H(?=$|[,*/-])|(^|[,*/-])L(?=$|[,*/-])|\dL\b/i.test(field);
|
|
32
38
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (!Number.isInteger(number) || number < minimum || number > maximum)
|
|
43
|
-
throw new Error(`Invalid cron field: ${part}`);
|
|
44
|
-
return value === number;
|
|
45
|
-
});
|
|
39
|
+
function fieldExpression(fields, index, wildcardIndex) {
|
|
40
|
+
if (fields[index] === '*')
|
|
41
|
+
return null;
|
|
42
|
+
const constrained = [...fields];
|
|
43
|
+
constrained[wildcardIndex] = '*';
|
|
44
|
+
return CronExpressionParser.parse(constrained.join(' '), { tz: 'UTC' });
|
|
45
|
+
}
|
|
46
|
+
function matchesDays(date, dayOfMonth, dayOfWeek) {
|
|
47
|
+
return (dayOfMonth?.includesDate(date) ?? true) && (dayOfWeek?.includesDate(date) ?? true);
|
|
46
48
|
}
|
|
@@ -3,7 +3,7 @@ export function formatAgentRunComment(value) {
|
|
|
3
3
|
const sections = [
|
|
4
4
|
'<!-- wake:agent -->',
|
|
5
5
|
`<!-- wake:delivery:${value.idempotencyKey} -->`,
|
|
6
|
-
|
|
6
|
+
`**${wakeHeading(value.publicUiUrl)}** _(Wake${details ? ` - ${details}` : ''})_`,
|
|
7
7
|
`**Outcome:** ${value.awaitingApproval === true ? '⏳ Awaiting approval' : outcome(value.outcome)}`,
|
|
8
8
|
value.displayBody.trim() || fallback(value.outcome),
|
|
9
9
|
];
|
|
@@ -19,6 +19,9 @@ export function formatAgentRunComment(value) {
|
|
|
19
19
|
sections.push(marker);
|
|
20
20
|
return sections.join('\n\n');
|
|
21
21
|
}
|
|
22
|
+
function wakeHeading(publicUiUrl) {
|
|
23
|
+
return publicUiUrl === undefined ? 'Wake' : `[Wake](${publicUiUrl})`;
|
|
24
|
+
}
|
|
22
25
|
function watchGateMarkerSection(value) {
|
|
23
26
|
if (value.watchGateVerdict === undefined)
|
|
24
27
|
return undefined;
|
|
@@ -3,7 +3,7 @@ import { DeliveryIntentKind } from '../../delivery/contracts/vocabulary.js';
|
|
|
3
3
|
import { parseGitHubResourceKey } from '../contracts/external-key.js';
|
|
4
4
|
import { GitHubAdapter, GitHubOutboundAction, } from '../contracts/vocabulary.js';
|
|
5
5
|
import { formatAgentRunComment } from './agent-run-comment.js';
|
|
6
|
-
export function translateGitHubOutbound(resource, intent) {
|
|
6
|
+
export function translateGitHubOutbound(resource, intent, options = {}) {
|
|
7
7
|
if (resource.externalKey.adapter !== GitHubAdapter)
|
|
8
8
|
throw new Error('Resource is not a GitHub resource');
|
|
9
9
|
const { owner, repo, number } = parseGitHubResourceKey(resource.externalKey.key);
|
|
@@ -20,6 +20,7 @@ export function translateGitHubOutbound(resource, intent) {
|
|
|
20
20
|
body: formatAgentRunComment({
|
|
21
21
|
idempotencyKey: intent.intentEventId,
|
|
22
22
|
...intent.payload.report,
|
|
23
|
+
publicUiUrl: options.publicUiUrl,
|
|
23
24
|
}),
|
|
24
25
|
}
|
|
25
26
|
: 'body' in intent.payload
|
|
@@ -35,7 +35,12 @@ export const gitHubProviderDefinition = {
|
|
|
35
35
|
const resource = await services.resources.get(resourceId(intent.resourceId));
|
|
36
36
|
if (resource === null)
|
|
37
37
|
throw new Error(`GitHub resource ${intent.resourceId} is unavailable`);
|
|
38
|
-
return client.deliver({
|
|
38
|
+
return client.deliver({
|
|
39
|
+
...translateGitHubOutbound(resource, intent, {
|
|
40
|
+
publicUiUrl: services.publicUiUrl,
|
|
41
|
+
}),
|
|
42
|
+
idempotencyKey,
|
|
43
|
+
});
|
|
39
44
|
}, async (intent) => {
|
|
40
45
|
if (intent.kind !== BuiltInActivityName.IssueComplete)
|
|
41
46
|
return null;
|
|
@@ -10,7 +10,17 @@ export const surfacesConfigSchema = z
|
|
|
10
10
|
.strict()
|
|
11
11
|
.default({ enabled: false, host: '127.0.0.1', port: 4317 }),
|
|
12
12
|
web: z
|
|
13
|
-
.object({
|
|
13
|
+
.object({
|
|
14
|
+
enabled: z.boolean().default(false),
|
|
15
|
+
publicUrl: z
|
|
16
|
+
.string()
|
|
17
|
+
.trim()
|
|
18
|
+
.url()
|
|
19
|
+
.refine((value) => new URL(value).protocol === 'https:', {
|
|
20
|
+
message: 'Web public URL must use HTTPS',
|
|
21
|
+
})
|
|
22
|
+
.optional(),
|
|
23
|
+
})
|
|
14
24
|
.strict()
|
|
15
25
|
.default({ enabled: false }),
|
|
16
26
|
})
|
|
@@ -30,5 +40,8 @@ export const surfacesConfigSchema = z
|
|
|
30
40
|
host: value.api.host ?? '127.0.0.1',
|
|
31
41
|
port: value.api.port ?? 4317,
|
|
32
42
|
},
|
|
33
|
-
web: {
|
|
43
|
+
web: {
|
|
44
|
+
enabled: value.web.enabled ?? false,
|
|
45
|
+
...(value.web.publicUrl === undefined ? {} : { publicUrl: value.web.publicUrl }),
|
|
46
|
+
},
|
|
34
47
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atolis-hq/wake",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "Local autonomous agent control plane for software development",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@octokit/rest": "^22.0.0",
|
|
69
|
+
"cron-parser": "^5.10.0",
|
|
69
70
|
"execa": "^10.0.1",
|
|
70
71
|
"handlebars": "^4.7.9",
|
|
71
72
|
"ulid": "^3.0.2",
|