@jcheesepkg/nanobot 0.6.6 → 0.6.7

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.
@@ -30,6 +30,10 @@ declare class CronTool extends Tool {
30
30
  type: string;
31
31
  description: string;
32
32
  };
33
+ timezone: {
34
+ type: string;
35
+ description: string;
36
+ };
33
37
  at: {
34
38
  type: string;
35
39
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"cron.d.mts","names":[],"sources":["../../../src/agent/tools/cron.ts"],"mappings":";;;;cAGa,QAAA,SAAiB,IAAA;EAAA,SACnB,IAAA;EAAA,SACA,WAAA;EAAA,SAEA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAuCD,OAAA;EAAA,QACA,MAAA;EAGA;EAAA,QAAA,SAAA;;UAEA,MAAA;;EASoB;EAA5B,UAAA,CAAW,OAAA,UAAiB,MAAA;EAKtB,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;EAAA,QAkBhC,MAAA;EAAA,QAwDA,QAAA;EAAA,QAyBA,SAAA;AAAA"}
1
+ {"version":3,"file":"cron.d.mts","names":[],"sources":["../../../src/agent/tools/cron.ts"],"mappings":";;;;cAGa,QAAA,SAAiB,IAAA;EAAA,SACnB,IAAA;EAAA,SACA,WAAA;EAAA,SAEA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA6CD,OAAA;EAAA,QACA,MAAA;EAKA;EAAA,QAFA,SAAA;EAWR;EAAA,QATQ,MAAA;;EAcF;EALN,UAAA,CAAW,OAAA,UAAiB,MAAA;EAKtB,OAAA,CAAQ,IAAA,EAAM,MAAA,oBAA0B,OAAA;EAAA,QAkBhC,MAAA;EAAA,QA0DA,QAAA;EAAA,QAyBA,SAAA;AAAA"}
@@ -32,7 +32,11 @@ var CronTool = class extends Tool {
32
32
  },
33
33
  cron_expr: {
34
34
  type: "string",
35
- description: "Cron expression like '0 9 * * *' (for scheduled tasks)"
35
+ description: "Cron expression in the USER's LOCAL time (e.g. '0 8 * * *' for 8am local). The server converts to UTC automatically."
36
+ },
37
+ timezone: {
38
+ type: "string",
39
+ description: "IANA timezone of the user (e.g. 'Asia/Tokyo'). Required with cron_expr. Read from USER.md or system prompt."
36
40
  },
37
41
  at: {
38
42
  type: "string",
@@ -76,6 +80,7 @@ var CronTool = class extends Tool {
76
80
  const kind = args.kind === "task" ? "task" : "direct";
77
81
  const everySeconds = args.every_seconds ? Number(args.every_seconds) : null;
78
82
  const cronExpr = args.cron_expr ? String(args.cron_expr) : null;
83
+ const timezone = args.timezone ? String(args.timezone) : null;
79
84
  const atRaw = args.at ? String(args.at) : null;
80
85
  if (!message) return "Error: message is required for add";
81
86
  if (!this.channel || !this.chatId) return "Error: no session context (channel/chatId)";
@@ -100,7 +105,8 @@ var CronTool = class extends Tool {
100
105
  kind,
101
106
  deliver: true,
102
107
  channel: this.channel,
103
- chatId: this.chatId
108
+ chatId: this.chatId,
109
+ ...timezone && cronExpr ? { timezone } : {}
104
110
  }),
105
111
  signal: AbortSignal.timeout(1e4)
106
112
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cron.mjs","names":[],"sources":["../../../src/agent/tools/cron.ts"],"sourcesContent":["import { Tool } from \"./base.js\";\n\n/** Tool to schedule reminders and recurring tasks via the DO scheduler. */\nexport class CronTool extends Tool {\n readonly name = \"cron\";\n readonly description =\n \"Schedule one-off or recurring tasks. Actions: add, list, remove.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n enum: [\"add\", \"list\", \"remove\"],\n description: \"Action to perform\",\n },\n message: {\n type: \"string\",\n description: \"Reminder message or task prompt (for add)\",\n },\n kind: {\n type: \"string\",\n enum: [\"direct\", \"task\"],\n description:\n \"direct: send message verbatim to user (default, for reminders). task: run message through the agent and deliver result.\",\n },\n every_seconds: {\n type: \"integer\",\n description: \"Interval in seconds (for recurring tasks)\",\n },\n cron_expr: {\n type: \"string\",\n description: \"Cron expression like '0 9 * * *' (for scheduled tasks)\",\n },\n at: {\n type: \"string\",\n description:\n \"Run once at a specific time. ISO 8601 string (e.g. '2025-03-01T09:00:00Z')\",\n },\n job_id: {\n type: \"string\",\n description: \"Job ID (for remove)\",\n },\n },\n required: [\"action\"],\n };\n\n private channel = \"\";\n private chatId = \"\";\n\n /** Worker URL for DO scheduling. */\n private workerUrl: string;\n /** User ID for DO scheduling. */\n private userId: string;\n\n constructor() {\n super();\n this.workerUrl = process.env.WORKER_URL ?? \"\";\n this.userId = process.env.NANOBOT_USER_ID ?? \"\";\n }\n\n /** Set the current session context for delivery. */\n setContext(channel: string, chatId: string): void {\n this.channel = channel;\n this.chatId = chatId;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n if (!this.workerUrl || !this.userId) {\n return \"Error: cron scheduling requires WORKER_URL and NANOBOT_USER_ID\";\n }\n\n const action = String(args.action);\n switch (action) {\n case \"add\":\n return this.addJob(args);\n case \"list\":\n return this.listJobs();\n case \"remove\":\n return this.removeJob(args);\n default:\n return `Unknown action: ${action}`;\n }\n }\n\n private async addJob(args: Record<string, unknown>): Promise<string> {\n const message = args.message ? String(args.message) : \"\";\n const kind = args.kind === \"task\" ? \"task\" : \"direct\"; // default: direct\n const everySeconds = args.every_seconds\n ? Number(args.every_seconds)\n : null;\n const cronExpr = args.cron_expr ? String(args.cron_expr) : null;\n const atRaw = args.at ? String(args.at) : null;\n\n if (!message) return \"Error: message is required for add\";\n if (!this.channel || !this.chatId)\n return \"Error: no session context (channel/chatId)\";\n\n let schedule: string | number;\n if (atRaw) {\n const atMs = Date.parse(atRaw);\n if (isNaN(atMs)) return `Error: could not parse time '${atRaw}' — use ISO 8601 format`;\n if (atMs <= Date.now()) return \"Error: scheduled time is in the past\";\n\n schedule = atRaw;\n } else if (everySeconds) {\n // For recurring by interval, use seconds\n schedule = everySeconds;\n } else if (cronExpr) {\n schedule = cronExpr;\n } else {\n return \"Error: one of 'at', 'every_seconds', or 'cron_expr' is required\";\n }\n\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n name: message,\n type: everySeconds ? \"every\" : cronExpr ? \"cron\" : \"scheduled\",\n schedule,\n message,\n kind,\n deliver: true,\n channel: this.channel,\n chatId: this.chatId,\n }),\n signal: AbortSignal.timeout(10_000),\n },\n );\n const data = await res.json() as { id?: string; error?: string };\n if (!res.ok) return `Error: ${data.error ?? res.statusText}`;\n return `Created ${kind} job (id: ${data.id})`;\n } catch (err) {\n return `Error scheduling job: ${err instanceof Error ? err.message : err}`;\n }\n }\n\n private async listJobs(): Promise<string> {\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron`,\n { signal: AbortSignal.timeout(10_000) },\n );\n const data = await res.json() as {\n crons: Array<{\n id: string;\n type: string;\n name: string;\n message: string;\n nextRunAt: number;\n }>;\n };\n if (data.crons.length === 0) return \"No scheduled jobs.\";\n const lines = data.crons.map(\n (c) => `- ${c.name} (id: ${c.id}, ${c.type}, next: ${new Date(c.nextRunAt).toISOString()})`,\n );\n return \"Scheduled jobs:\\n\" + lines.join(\"\\n\");\n } catch (err) {\n return `Error listing jobs: ${err instanceof Error ? err.message : err}`;\n }\n }\n\n private async removeJob(args: Record<string, unknown>): Promise<string> {\n const jobId = args.job_id ? String(args.job_id) : null;\n if (!jobId) return \"Error: job_id is required for remove\";\n\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron/${jobId}`,\n {\n method: \"DELETE\",\n signal: AbortSignal.timeout(10_000),\n },\n );\n const data = await res.json() as { ok: boolean };\n return data.ok ? `Removed job ${jobId}` : `Job ${jobId} not found`;\n } catch (err) {\n return `Error removing job: ${err instanceof Error ? err.message : err}`;\n }\n }\n}\n"],"mappings":";;;;AAGA,IAAa,WAAb,cAA8B,KAAK;CACjC,AAAS,OAAO;CAChB,AAAS,cACP;CACF,AAAS,aAAa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vE,MAAc,UAAU,MAAgD;EACtE,MAAM,QAAQ,KAAK,SAAS,OAAO,KAAK,OAAO,GAAG;AAClD,MAAI,CAAC,MAAO,QAAO;AAEnB,MAAI;AASF,WADa,OAPD,MAAM,MAChB,GAAG,KAAK,UAAU,aAAa,KAAK,OAAO,QAAQ,SACnD;IACE,QAAQ;IACR,QAAQ,YAAY,QAAQ,IAAO;IACpC,CACF,EACsB,MAAM,EACjB,KAAK,eAAe,UAAU,OAAO,MAAM;WAChD,KAAK;AACZ,UAAO,uBAAuB,eAAe,QAAQ,IAAI,UAAU"}
1
+ {"version":3,"file":"cron.mjs","names":[],"sources":["../../../src/agent/tools/cron.ts"],"sourcesContent":["import { Tool } from \"./base.js\";\n\n/** Tool to schedule reminders and recurring tasks via the DO scheduler. */\nexport class CronTool extends Tool {\n readonly name = \"cron\";\n readonly description =\n \"Schedule one-off or recurring tasks. Actions: add, list, remove.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n action: {\n type: \"string\",\n enum: [\"add\", \"list\", \"remove\"],\n description: \"Action to perform\",\n },\n message: {\n type: \"string\",\n description: \"Reminder message or task prompt (for add)\",\n },\n kind: {\n type: \"string\",\n enum: [\"direct\", \"task\"],\n description:\n \"direct: send message verbatim to user (default, for reminders). task: run message through the agent and deliver result.\",\n },\n every_seconds: {\n type: \"integer\",\n description: \"Interval in seconds (for recurring tasks)\",\n },\n cron_expr: {\n type: \"string\",\n description:\n \"Cron expression in the USER's LOCAL time (e.g. '0 8 * * *' for 8am local). The server converts to UTC automatically.\",\n },\n timezone: {\n type: \"string\",\n description:\n \"IANA timezone of the user (e.g. 'Asia/Tokyo'). Required with cron_expr. Read from USER.md or system prompt.\",\n },\n at: {\n type: \"string\",\n description:\n \"Run once at a specific time. ISO 8601 string (e.g. '2025-03-01T09:00:00Z')\",\n },\n job_id: {\n type: \"string\",\n description: \"Job ID (for remove)\",\n },\n },\n required: [\"action\"],\n };\n\n private channel = \"\";\n private chatId = \"\";\n\n /** Worker URL for DO scheduling. */\n private workerUrl: string;\n /** User ID for DO scheduling. */\n private userId: string;\n\n constructor() {\n super();\n this.workerUrl = process.env.WORKER_URL ?? \"\";\n this.userId = process.env.NANOBOT_USER_ID ?? \"\";\n }\n\n /** Set the current session context for delivery. */\n setContext(channel: string, chatId: string): void {\n this.channel = channel;\n this.chatId = chatId;\n }\n\n async execute(args: Record<string, unknown>): Promise<string> {\n if (!this.workerUrl || !this.userId) {\n return \"Error: cron scheduling requires WORKER_URL and NANOBOT_USER_ID\";\n }\n\n const action = String(args.action);\n switch (action) {\n case \"add\":\n return this.addJob(args);\n case \"list\":\n return this.listJobs();\n case \"remove\":\n return this.removeJob(args);\n default:\n return `Unknown action: ${action}`;\n }\n }\n\n private async addJob(args: Record<string, unknown>): Promise<string> {\n const message = args.message ? String(args.message) : \"\";\n const kind = args.kind === \"task\" ? \"task\" : \"direct\"; // default: direct\n const everySeconds = args.every_seconds\n ? Number(args.every_seconds)\n : null;\n const cronExpr = args.cron_expr ? String(args.cron_expr) : null;\n const timezone = args.timezone ? String(args.timezone) : null;\n const atRaw = args.at ? String(args.at) : null;\n\n if (!message) return \"Error: message is required for add\";\n if (!this.channel || !this.chatId)\n return \"Error: no session context (channel/chatId)\";\n\n let schedule: string | number;\n if (atRaw) {\n const atMs = Date.parse(atRaw);\n if (isNaN(atMs)) return `Error: could not parse time '${atRaw}' — use ISO 8601 format`;\n if (atMs <= Date.now()) return \"Error: scheduled time is in the past\";\n\n schedule = atRaw;\n } else if (everySeconds) {\n // For recurring by interval, use seconds\n schedule = everySeconds;\n } else if (cronExpr) {\n schedule = cronExpr;\n } else {\n return \"Error: one of 'at', 'every_seconds', or 'cron_expr' is required\";\n }\n\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron`,\n {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n name: message,\n type: everySeconds ? \"every\" : cronExpr ? \"cron\" : \"scheduled\",\n schedule,\n message,\n kind,\n deliver: true,\n channel: this.channel,\n chatId: this.chatId,\n ...(timezone && cronExpr ? { timezone } : {}),\n }),\n signal: AbortSignal.timeout(10_000),\n },\n );\n const data = await res.json() as { id?: string; error?: string };\n if (!res.ok) return `Error: ${data.error ?? res.statusText}`;\n return `Created ${kind} job (id: ${data.id})`;\n } catch (err) {\n return `Error scheduling job: ${err instanceof Error ? err.message : err}`;\n }\n }\n\n private async listJobs(): Promise<string> {\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron`,\n { signal: AbortSignal.timeout(10_000) },\n );\n const data = await res.json() as {\n crons: Array<{\n id: string;\n type: string;\n name: string;\n message: string;\n nextRunAt: number;\n }>;\n };\n if (data.crons.length === 0) return \"No scheduled jobs.\";\n const lines = data.crons.map(\n (c) => `- ${c.name} (id: ${c.id}, ${c.type}, next: ${new Date(c.nextRunAt).toISOString()})`,\n );\n return \"Scheduled jobs:\\n\" + lines.join(\"\\n\");\n } catch (err) {\n return `Error listing jobs: ${err instanceof Error ? err.message : err}`;\n }\n }\n\n private async removeJob(args: Record<string, unknown>): Promise<string> {\n const jobId = args.job_id ? String(args.job_id) : null;\n if (!jobId) return \"Error: job_id is required for remove\";\n\n try {\n const res = await fetch(\n `${this.workerUrl}/api/users/${this.userId}/cron/${jobId}`,\n {\n method: \"DELETE\",\n signal: AbortSignal.timeout(10_000),\n },\n );\n const data = await res.json() as { ok: boolean };\n return data.ok ? `Removed job ${jobId}` : `Job ${jobId} not found`;\n } catch (err) {\n return `Error removing job: ${err instanceof Error ? err.message : err}`;\n }\n }\n}\n"],"mappings":";;;;AAGA,IAAa,WAAb,cAA8B,KAAK;CACjC,AAAS,OAAO;CAChB,AAAS,cACP;CACF,AAAS,aAAa;EACpB,MAAM;EACN,YAAY;GACV,QAAQ;IACN,MAAM;IACN,MAAM;KAAC;KAAO;KAAQ;KAAS;IAC/B,aAAa;IACd;GACD,SAAS;IACP,MAAM;IACN,aAAa;IACd;GACD,MAAM;IACJ,MAAM;IACN,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,MAAM,QAAQ,KAAK,SAAS,OAAO,KAAK,OAAO,GAAG;AAClD,MAAI,CAAC,MAAO,QAAO;AAEnB,MAAI;AASF,WADa,OAPD,MAAM,MAChB,GAAG,KAAK,UAAU,aAAa,KAAK,OAAO,QAAQ,SACnD;IACE,QAAQ;IACR,QAAQ,YAAY,QAAQ,IAAO;IACpC,CACF,EACsB,MAAM,EACjB,KAAK,eAAe,UAAU,OAAO,MAAM;WAChD,KAAK;AACZ,UAAO,uBAAuB,eAAe,QAAQ,IAAI,UAAU"}
@@ -70,31 +70,31 @@ declare const ChannelsConfigSchema: z.ZodObject<{
70
70
  channelAccessToken?: string | undefined;
71
71
  }>>;
72
72
  }, "strip", z.ZodTypeAny, {
73
- line: {
74
- enabled: boolean;
75
- allowFrom: string[];
76
- channelSecret: string;
77
- channelAccessToken: string;
78
- };
79
73
  telegram: {
80
74
  enabled: boolean;
81
75
  token: string;
82
76
  allowFrom: string[];
83
77
  proxy?: string | null | undefined;
84
78
  };
79
+ line: {
80
+ enabled: boolean;
81
+ allowFrom: string[];
82
+ channelSecret: string;
83
+ channelAccessToken: string;
84
+ };
85
85
  }, {
86
- line?: {
87
- enabled?: boolean | undefined;
88
- allowFrom?: string[] | undefined;
89
- channelSecret?: string | undefined;
90
- channelAccessToken?: string | undefined;
91
- } | undefined;
92
86
  telegram?: {
93
87
  enabled?: boolean | undefined;
94
88
  token?: string | undefined;
95
89
  allowFrom?: string[] | undefined;
96
90
  proxy?: string | null | undefined;
97
91
  } | undefined;
92
+ line?: {
93
+ enabled?: boolean | undefined;
94
+ allowFrom?: string[] | undefined;
95
+ channelSecret?: string | undefined;
96
+ channelAccessToken?: string | undefined;
97
+ } | undefined;
98
98
  }>;
99
99
  type ChannelsConfig = z.infer<typeof ChannelsConfigSchema>;
100
100
  declare const AgentDefaultsSchema: z.ZodObject<{
@@ -539,15 +539,15 @@ declare const ToolsConfigSchema: z.ZodObject<{
539
539
  export?: string | undefined;
540
540
  }>, "many">>;
541
541
  }, "strip", z.ZodTypeAny, {
542
+ exec: {
543
+ timeout: number;
544
+ };
542
545
  web: {
543
546
  search: {
544
547
  apiKey: string;
545
548
  maxResults: number;
546
549
  };
547
550
  };
548
- exec: {
549
- timeout: number;
550
- };
551
551
  restrictToWorkspace: boolean;
552
552
  enabled?: string[] | undefined;
553
553
  disabled?: string[] | undefined;
@@ -557,6 +557,9 @@ declare const ToolsConfigSchema: z.ZodObject<{
557
557
  export?: string | undefined;
558
558
  }[] | undefined;
559
559
  }, {
560
+ exec?: {
561
+ timeout?: number | undefined;
562
+ } | undefined;
560
563
  enabled?: string[] | undefined;
561
564
  web?: {
562
565
  search?: {
@@ -564,9 +567,6 @@ declare const ToolsConfigSchema: z.ZodObject<{
564
567
  maxResults?: number | undefined;
565
568
  } | undefined;
566
569
  } | undefined;
567
- exec?: {
568
- timeout?: number | undefined;
569
- } | undefined;
570
570
  restrictToWorkspace?: boolean | undefined;
571
571
  disabled?: string[] | undefined;
572
572
  custom?: {
@@ -648,31 +648,31 @@ declare const ConfigSchema: z.ZodObject<{
648
648
  channelAccessToken?: string | undefined;
649
649
  }>>;
650
650
  }, "strip", z.ZodTypeAny, {
651
- line: {
652
- enabled: boolean;
653
- allowFrom: string[];
654
- channelSecret: string;
655
- channelAccessToken: string;
656
- };
657
651
  telegram: {
658
652
  enabled: boolean;
659
653
  token: string;
660
654
  allowFrom: string[];
661
655
  proxy?: string | null | undefined;
662
656
  };
657
+ line: {
658
+ enabled: boolean;
659
+ allowFrom: string[];
660
+ channelSecret: string;
661
+ channelAccessToken: string;
662
+ };
663
663
  }, {
664
- line?: {
665
- enabled?: boolean | undefined;
666
- allowFrom?: string[] | undefined;
667
- channelSecret?: string | undefined;
668
- channelAccessToken?: string | undefined;
669
- } | undefined;
670
664
  telegram?: {
671
665
  enabled?: boolean | undefined;
672
666
  token?: string | undefined;
673
667
  allowFrom?: string[] | undefined;
674
668
  proxy?: string | null | undefined;
675
669
  } | undefined;
670
+ line?: {
671
+ enabled?: boolean | undefined;
672
+ allowFrom?: string[] | undefined;
673
+ channelSecret?: string | undefined;
674
+ channelAccessToken?: string | undefined;
675
+ } | undefined;
676
676
  }>>;
677
677
  providers: z.ZodDefault<z.ZodObject<{
678
678
  anthropic: z.ZodDefault<z.ZodObject<{
@@ -988,15 +988,15 @@ declare const ConfigSchema: z.ZodObject<{
988
988
  export?: string | undefined;
989
989
  }>, "many">>;
990
990
  }, "strip", z.ZodTypeAny, {
991
+ exec: {
992
+ timeout: number;
993
+ };
991
994
  web: {
992
995
  search: {
993
996
  apiKey: string;
994
997
  maxResults: number;
995
998
  };
996
999
  };
997
- exec: {
998
- timeout: number;
999
- };
1000
1000
  restrictToWorkspace: boolean;
1001
1001
  enabled?: string[] | undefined;
1002
1002
  disabled?: string[] | undefined;
@@ -1006,6 +1006,9 @@ declare const ConfigSchema: z.ZodObject<{
1006
1006
  export?: string | undefined;
1007
1007
  }[] | undefined;
1008
1008
  }, {
1009
+ exec?: {
1010
+ timeout?: number | undefined;
1011
+ } | undefined;
1009
1012
  enabled?: string[] | undefined;
1010
1013
  web?: {
1011
1014
  search?: {
@@ -1013,9 +1016,6 @@ declare const ConfigSchema: z.ZodObject<{
1013
1016
  maxResults?: number | undefined;
1014
1017
  } | undefined;
1015
1018
  } | undefined;
1016
- exec?: {
1017
- timeout?: number | undefined;
1018
- } | undefined;
1019
1019
  restrictToWorkspace?: boolean | undefined;
1020
1020
  disabled?: string[] | undefined;
1021
1021
  custom?: {
@@ -1035,18 +1035,18 @@ declare const ConfigSchema: z.ZodObject<{
1035
1035
  };
1036
1036
  };
1037
1037
  channels: {
1038
- line: {
1039
- enabled: boolean;
1040
- allowFrom: string[];
1041
- channelSecret: string;
1042
- channelAccessToken: string;
1043
- };
1044
1038
  telegram: {
1045
1039
  enabled: boolean;
1046
1040
  token: string;
1047
1041
  allowFrom: string[];
1048
1042
  proxy?: string | null | undefined;
1049
1043
  };
1044
+ line: {
1045
+ enabled: boolean;
1046
+ allowFrom: string[];
1047
+ channelSecret: string;
1048
+ channelAccessToken: string;
1049
+ };
1050
1050
  };
1051
1051
  providers: {
1052
1052
  anthropic: {
@@ -1110,15 +1110,15 @@ declare const ConfigSchema: z.ZodObject<{
1110
1110
  port: number;
1111
1111
  };
1112
1112
  tools: {
1113
+ exec: {
1114
+ timeout: number;
1115
+ };
1113
1116
  web: {
1114
1117
  search: {
1115
1118
  apiKey: string;
1116
1119
  maxResults: number;
1117
1120
  };
1118
1121
  };
1119
- exec: {
1120
- timeout: number;
1121
- };
1122
1122
  restrictToWorkspace: boolean;
1123
1123
  enabled?: string[] | undefined;
1124
1124
  disabled?: string[] | undefined;
@@ -1139,18 +1139,18 @@ declare const ConfigSchema: z.ZodObject<{
1139
1139
  } | undefined;
1140
1140
  } | undefined;
1141
1141
  channels?: {
1142
- line?: {
1143
- enabled?: boolean | undefined;
1144
- allowFrom?: string[] | undefined;
1145
- channelSecret?: string | undefined;
1146
- channelAccessToken?: string | undefined;
1147
- } | undefined;
1148
1142
  telegram?: {
1149
1143
  enabled?: boolean | undefined;
1150
1144
  token?: string | undefined;
1151
1145
  allowFrom?: string[] | undefined;
1152
1146
  proxy?: string | null | undefined;
1153
1147
  } | undefined;
1148
+ line?: {
1149
+ enabled?: boolean | undefined;
1150
+ allowFrom?: string[] | undefined;
1151
+ channelSecret?: string | undefined;
1152
+ channelAccessToken?: string | undefined;
1153
+ } | undefined;
1154
1154
  } | undefined;
1155
1155
  providers?: {
1156
1156
  anthropic?: {
@@ -1214,6 +1214,9 @@ declare const ConfigSchema: z.ZodObject<{
1214
1214
  port?: number | undefined;
1215
1215
  } | undefined;
1216
1216
  tools?: {
1217
+ exec?: {
1218
+ timeout?: number | undefined;
1219
+ } | undefined;
1217
1220
  enabled?: string[] | undefined;
1218
1221
  web?: {
1219
1222
  search?: {
@@ -1221,9 +1224,6 @@ declare const ConfigSchema: z.ZodObject<{
1221
1224
  maxResults?: number | undefined;
1222
1225
  } | undefined;
1223
1226
  } | undefined;
1224
- exec?: {
1225
- timeout?: number | undefined;
1226
- } | undefined;
1227
1227
  restrictToWorkspace?: boolean | undefined;
1228
1228
  disabled?: string[] | undefined;
1229
1229
  custom?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcheesepkg/nanobot",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "Lightweight AI assistant - TypeScript port",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -24,35 +24,36 @@ Dynamic task (kind="task", agent executes each time):
24
24
  cron(action="add", message="Check HKUDS/nanobot GitHub stars and report", kind="task", every_seconds=600)
25
25
  ```
26
26
 
27
+ Daily at 8am (user is in Asia/Tokyo):
28
+ ```
29
+ cron(action="add", message="おはよう!今日も頑張ろう", cron_expr="0 8 * * *", timezone="Asia/Tokyo")
30
+ ```
31
+
27
32
  List/remove:
28
33
  ```
29
34
  cron(action="list")
30
35
  cron(action="remove", job_id="abc123")
31
36
  ```
32
37
 
33
- ## Timezone — IMPORTANT
38
+ ## Timezone
34
39
 
35
- All `cron_expr` values and `at` timestamps are executed in **UTC**.
36
- The user's local timezone is shown in the system prompt under "Current Time > Timezone" (e.g. Asia/Tokyo, America/New_York).
37
- You MUST convert the user's local time to UTC before setting the schedule.
40
+ When using `cron_expr`, write it in the **user's local time** and pass the `timezone` parameter.
41
+ The server converts to UTC automatically. Read the user's timezone from the system prompt ("Current Time > Timezone").
38
42
 
39
- Example (Asia/Tokyo = UTC+9):
40
- - Local 8:00 AM UTC 23:00 (previous day) cron_expr: "0 23 * * *"
41
- - Local 5:00 PM → UTC 8:00 AM → cron_expr: "0 8 * * *"
43
+ - `cron_expr="0 8 * * *"` + `timezone="Asia/Tokyo"` runs at 8:00 AM JST
44
+ - `cron_expr="0 17 * * 1-5"` + `timezone="America/New_York"`runs at 5:00 PM ET on weekdays
42
45
 
43
- Example (America/New_York = UTC-5):
44
- - Local 8:00 AM → UTC 13:00 → cron_expr: "0 13 * * *"
45
- - Local 5:00 PM → UTC 22:00 → cron_expr: "0 22 * * *"
46
+ For `at` timestamps, use an ISO-8601 string with the timezone offset (e.g. `2025-03-01T09:00:00+09:00`).
46
47
 
47
- For `at` timestamps, always use the UTC equivalent with the Z suffix.
48
+ For `every_seconds`, no timezone is needed it's just an interval.
48
49
 
49
50
  ## Time Expressions
50
51
 
51
- | User says | Parameters (convert to UTC) |
52
+ | User says | Parameters |
52
53
  |-----------|------------|
53
54
  | every 20 minutes | every_seconds: 1200 |
54
55
  | every hour | every_seconds: 3600 |
55
- | every day at 8am | cron_expr: convert 8:00 local UTC hour |
56
- | weekdays at 5pm | cron_expr: convert 17:00 local UTC hour, days 1-5 |
57
- | In 10 minutes | at: (current UTC time + 10min) |
58
- | at a specific date/time | at: convert local time to UTC ISO-8601 with Z suffix |
56
+ | every day at 8am | cron_expr: "0 8 * * *", timezone: (from system prompt) |
57
+ | weekdays at 5pm | cron_expr: "0 17 * * 1-5", timezone: (from system prompt) |
58
+ | In 10 minutes | at: (current time + 10min, with tz offset) |
59
+ | at a specific date/time | at: ISO-8601 with timezone offset |