niahere 0.2.69 → 0.2.70
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/package.json +1 -1
- package/src/prompts/environment.md +3 -0
- package/src/prompts/index.ts +4 -2
- package/src/utils/time.ts +30 -0
package/package.json
CHANGED
|
@@ -6,8 +6,11 @@ You are running as part of the assistant daemon.
|
|
|
6
6
|
- Database: PostgreSQL ({{dbUrl}})
|
|
7
7
|
- Persona files: {{selfDir}}/
|
|
8
8
|
- Timezone: {{timezone}}
|
|
9
|
+
- Current date (authoritative): {{currentDate}}
|
|
9
10
|
- Current time: {{currentTime}}
|
|
10
11
|
|
|
12
|
+
When writing calendar digests, standups, reminders, or any dated message, preserve the weekday/date pairing from the authoritative current date above. If a weekday/date mismatch would matter, verify with the system date or source calendar before sending.
|
|
13
|
+
|
|
11
14
|
## Nia CLI
|
|
12
15
|
|
|
13
16
|
You are `nia` — the CLI and daemon. You have access to Bash, so you can run `nia` commands directly.
|
package/src/prompts/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "fs";
|
|
|
2
2
|
import { join, resolve } from "path";
|
|
3
3
|
import { getPaths } from "../utils/paths";
|
|
4
4
|
import { getConfig } from "../utils/config";
|
|
5
|
-
import {
|
|
5
|
+
import { formatPromptDate, formatPromptDateTime } from "../utils/time";
|
|
6
6
|
import type { Mode } from "../types";
|
|
7
7
|
|
|
8
8
|
const PROMPTS_DIR = resolve(import.meta.dir);
|
|
@@ -20,6 +20,7 @@ function interpolate(template: string, vars: Record<string, string>): string {
|
|
|
20
20
|
export function getEnvironmentPrompt(): string {
|
|
21
21
|
const paths = getPaths();
|
|
22
22
|
const config = getConfig();
|
|
23
|
+
const now = new Date();
|
|
23
24
|
|
|
24
25
|
// Build watch channel summary if Slack is configured with watch channels
|
|
25
26
|
let slackWatch = "";
|
|
@@ -34,7 +35,8 @@ export function getEnvironmentPrompt(): string {
|
|
|
34
35
|
dbUrl: config.database_url.replace(/\/\/.*@/, "//***@"),
|
|
35
36
|
selfDir: paths.selfDir,
|
|
36
37
|
timezone: config.timezone,
|
|
37
|
-
|
|
38
|
+
currentDate: formatPromptDate(now, config.timezone),
|
|
39
|
+
currentTime: formatPromptDateTime(now, config.timezone),
|
|
38
40
|
activeStart: config.activeHours.start,
|
|
39
41
|
activeEnd: config.activeHours.end,
|
|
40
42
|
model: config.model,
|
package/src/utils/time.ts
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
const PROMPT_DATE_LOCALE = "en-US";
|
|
2
|
+
|
|
1
3
|
export function localTime(date: Date = new Date(), timezone?: string): string {
|
|
2
4
|
return date.toLocaleString(undefined, timezone ? { timeZone: timezone } : undefined);
|
|
3
5
|
}
|
|
6
|
+
|
|
7
|
+
export function formatPromptDate(date: Date = new Date(), timezone?: string): string {
|
|
8
|
+
const formatted = new Intl.DateTimeFormat(PROMPT_DATE_LOCALE, {
|
|
9
|
+
weekday: "long",
|
|
10
|
+
year: "numeric",
|
|
11
|
+
month: "long",
|
|
12
|
+
day: "numeric",
|
|
13
|
+
...(timezone ? { timeZone: timezone } : {}),
|
|
14
|
+
}).format(date);
|
|
15
|
+
|
|
16
|
+
return timezone ? `${formatted} (${timezone})` : formatted;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function formatPromptDateTime(date: Date = new Date(), timezone?: string): string {
|
|
20
|
+
const formatted = new Intl.DateTimeFormat(PROMPT_DATE_LOCALE, {
|
|
21
|
+
weekday: "long",
|
|
22
|
+
year: "numeric",
|
|
23
|
+
month: "long",
|
|
24
|
+
day: "numeric",
|
|
25
|
+
hour: "numeric",
|
|
26
|
+
minute: "2-digit",
|
|
27
|
+
second: "2-digit",
|
|
28
|
+
timeZoneName: "short",
|
|
29
|
+
...(timezone ? { timeZone: timezone } : {}),
|
|
30
|
+
}).format(date);
|
|
31
|
+
|
|
32
|
+
return timezone ? `${formatted} (${timezone})` : formatted;
|
|
33
|
+
}
|