spawnfile 0.1.7 → 0.1.9

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.
@@ -3,6 +3,7 @@ import { SpawnfileError } from "../../shared/index.js";
3
3
  import { createAgentCapabilities, createDiagnostic, createDocumentFiles, createSkillFiles } from "../common.js";
4
4
  import { preparePicoClawRuntimeAuth } from "./runAuth.js";
5
5
  import { createPicoClawAgentScaffold } from "./scaffold.js";
6
+ import { createPicoClawCronStoreFile, createScheduleDiagnostics, scheduleOutcomeFor } from "./schedules.js";
6
7
  import { assertSupportedPicoClawSurfaces, buildPicoClawChannelConfig, buildPicoClawSurfaceEnvBindings } from "./surfaces.js";
7
8
  import { PICOCLAW_GATEWAY_BASE_PORT, PICOCLAW_INTERNAL_PICO_TOKEN } from "./pico.js";
8
9
  const formatModelName = (node) => {
@@ -89,6 +90,11 @@ const buildMcpServers = (servers) => {
89
90
  };
90
91
  const buildPicoClawToolsConfig = (node) => {
91
92
  const tools = {};
93
+ if (node.schedule?.kind === "cron") {
94
+ tools.cron = {
95
+ enabled: true
96
+ };
97
+ }
92
98
  if (node.surfaces?.moltnet) {
93
99
  tools.exec = {
94
100
  enabled: true
@@ -199,12 +205,18 @@ export const picoClawAdapter = {
199
205
  }
200
206
  },
201
207
  async compileAgent(node) {
208
+ const scheduleOutcome = scheduleOutcomeFor(node);
209
+ const cronStoreFile = createPicoClawCronStoreFile(node);
202
210
  return {
203
- capabilities: createAgentCapabilities(node),
204
- diagnostics: [],
211
+ capabilities: createAgentCapabilities(node, {
212
+ scheduleMessage: scheduleOutcome.message,
213
+ scheduleOutcome: scheduleOutcome.outcome
214
+ }),
215
+ diagnostics: createScheduleDiagnostics(node),
205
216
  files: [
206
217
  ...createDocumentFiles("workspace", node.docs),
207
218
  ...createSkillFiles("workspace/skills", node.skills),
219
+ ...(cronStoreFile ? [cronStoreFile] : []),
208
220
  {
209
221
  content: buildPicoClawConfig(node),
210
222
  path: "config.json"
@@ -0,0 +1,9 @@
1
+ import type { ResolvedAgentNode } from "../../compiler/types.js";
2
+ import type { CapabilityReport } from "../../report/index.js";
3
+ import type { EmittedFile } from "../types.js";
4
+ export declare const createPicoClawCronStoreFile: (node: ResolvedAgentNode) => EmittedFile | null;
5
+ export declare const scheduleOutcomeFor: (node: ResolvedAgentNode) => {
6
+ message?: string;
7
+ outcome?: CapabilityReport["outcome"];
8
+ };
9
+ export declare const createScheduleDiagnostics: (node: ResolvedAgentNode) => import("../../report/types.js").DiagnosticReport[];
@@ -0,0 +1,65 @@
1
+ import { createDiagnostic } from "../common.js";
2
+ const createPicoClawCronJob = (node) => {
3
+ if (!node.schedule || node.schedule.kind !== "cron") {
4
+ return null;
5
+ }
6
+ return {
7
+ createdAtMs: 0,
8
+ deleteAfterRun: false,
9
+ enabled: true,
10
+ id: `spawnfile-${node.name}`,
11
+ name: `spawnfile-${node.name}`,
12
+ payload: {
13
+ deliver: false,
14
+ kind: "agent_turn",
15
+ message: node.schedule.prompt ?? "Run the scheduled Spawnfile task."
16
+ },
17
+ schedule: {
18
+ expr: node.schedule.cron,
19
+ kind: "cron",
20
+ ...(node.schedule.timezone ? { tz: node.schedule.timezone } : {})
21
+ },
22
+ state: {},
23
+ updatedAtMs: 0
24
+ };
25
+ };
26
+ export const createPicoClawCronStoreFile = (node) => {
27
+ const job = createPicoClawCronJob(node);
28
+ if (!job) {
29
+ return null;
30
+ }
31
+ const store = {
32
+ jobs: [job],
33
+ version: 1
34
+ };
35
+ return {
36
+ content: `${JSON.stringify(store, null, 2)}\n`,
37
+ path: "workspace/cron/jobs.json"
38
+ };
39
+ };
40
+ export const scheduleOutcomeFor = (node) => {
41
+ if (!node.schedule) {
42
+ return {};
43
+ }
44
+ if (node.schedule.kind === "cron") {
45
+ return {
46
+ message: "PicoClaw native cron scheduler is emitted as workspace/cron/jobs.json",
47
+ outcome: "supported"
48
+ };
49
+ }
50
+ if (node.schedule.kind === "disabled") {
51
+ return {
52
+ message: "Disabled schedule emits no wake registration",
53
+ outcome: "supported"
54
+ };
55
+ }
56
+ return {
57
+ message: "PicoClaw native schedule lowering supports cron schedules in Spawnfile v0.1",
58
+ outcome: "degraded"
59
+ };
60
+ };
61
+ export const createScheduleDiagnostics = (node) => node.schedule?.kind === "every"
62
+ ? [
63
+ createDiagnostic("warn", "PicoClaw native schedule lowering supports cron schedules in Spawnfile v0.1; every schedules are degraded")
64
+ ]
65
+ : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spawnfile",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Canonical source compiler for autonomous agents and teams.",
5
5
  "license": "MIT",
6
6
  "type": "module",