@aitne-sh/aitne 0.1.8 → 0.1.10
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 +251 -164
- package/agent-assets/agent-profiles/_safety.md +3 -3
- package/agent-assets/agent-profiles/browser-task.md +108 -0
- package/agent-assets/agent-profiles/conversational.md +3 -3
- package/agent-assets/agent-profiles/profile-importer.md +2 -2
- package/agent-assets/agent-profiles/routine-fetch-window.md +30 -19
- package/agent-assets/agents/context-index-reconcile/agent.md +52 -0
- package/agent-assets/agents/evening-review/agent.md +53 -0
- package/agent-assets/agents/hourly-check/agent.md +62 -0
- package/agent-assets/agents/monthly-review/agent.md +55 -0
- package/agent-assets/agents/morning-routine/agent.md +78 -0
- package/agent-assets/agents/roadmap-maintenance/agent.md +52 -0
- package/agent-assets/agents/skill-curation/agent.md +52 -0
- package/agent-assets/agents/user-profile-sweep-evening/agent.md +48 -0
- package/agent-assets/agents/user-profile-sweep-morning/agent.md +53 -0
- package/agent-assets/agents/weekly-review/agent.md +51 -0
- package/agent-assets/docs/concepts/agent-day.md +13 -11
- package/agent-assets/docs/concepts/auth-health.md +47 -10
- package/agent-assets/docs/concepts/backends-and-tiers.md +66 -31
- package/agent-assets/docs/concepts/costs-and-quotas.md +51 -15
- package/agent-assets/docs/concepts/delegated-mode.md +56 -17
- package/agent-assets/docs/concepts/memory-model.md +77 -34
- package/agent-assets/docs/concepts/observations.md +49 -11
- package/agent-assets/docs/concepts/process-keys.md +56 -22
- package/agent-assets/docs/concepts/routines.md +60 -33
- package/agent-assets/docs/concepts/safety-and-execution.md +50 -21
- package/agent-assets/docs/concepts/safety-model.md +61 -50
- package/agent-assets/docs/concepts/skills.md +34 -18
- package/agent-assets/docs/features/integrations/browser-history.md +196 -0
- package/agent-assets/docs/features/integrations/calendar.md +39 -29
- package/agent-assets/docs/features/integrations/git.md +18 -7
- package/agent-assets/docs/features/integrations/github.md +84 -33
- package/agent-assets/docs/features/integrations/mail.md +61 -17
- package/agent-assets/docs/features/integrations/notion.md +18 -6
- package/agent-assets/docs/features/integrations/obsidian.md +28 -5
- package/agent-assets/docs/features/lifestyle/git.md +44 -40
- package/agent-assets/docs/features/lifestyle/reading.md +57 -22
- package/agent-assets/docs/features/lifestyle/receipts.md +51 -21
- package/agent-assets/docs/features/lifestyle/travel-bookings.md +77 -14
- package/agent-assets/docs/features/memory-files/agent-journal.md +132 -53
- package/agent-assets/docs/features/memory-files/agent-lessons.md +177 -0
- package/agent-assets/docs/features/memory-files/projects.md +73 -17
- package/agent-assets/docs/features/memory-files/roadmap.md +54 -11
- package/agent-assets/docs/features/memory-files/schedule.md +113 -70
- package/agent-assets/docs/features/memory-files/today.md +46 -21
- package/agent-assets/docs/features/memory-files/user-profile.md +63 -33
- package/agent-assets/docs/features/messaging/bang-commands.md +113 -36
- package/agent-assets/docs/features/messaging/dashboard-chat.md +43 -21
- package/agent-assets/docs/features/messaging/discord.md +35 -4
- package/agent-assets/docs/features/messaging/overview.md +37 -19
- package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +94 -27
- package/agent-assets/docs/features/messaging/slack.md +67 -14
- package/agent-assets/docs/features/messaging/telegram.md +22 -8
- package/agent-assets/docs/features/messaging/whatsapp.md +71 -17
- package/agent-assets/docs/features/operations/activity-and-conversations.md +45 -15
- package/agent-assets/docs/features/operations/approvals.md +49 -16
- package/agent-assets/docs/features/operations/backend-routing.md +68 -16
- package/agent-assets/docs/features/operations/cost-tracking.md +84 -17
- package/agent-assets/docs/features/operations/managed-chromium.md +222 -0
- package/agent-assets/docs/features/operations/notifications.md +52 -11
- package/agent-assets/docs/features/operations/quiet-hours.md +64 -40
- package/agent-assets/docs/features/operations/schedule-approaching.md +54 -24
- package/agent-assets/docs/features/routines/custom-routines.md +98 -26
- package/agent-assets/docs/features/routines/evening-review.md +82 -21
- package/agent-assets/docs/features/routines/hourly-check.md +149 -29
- package/agent-assets/docs/features/routines/morning-routine.md +54 -35
- package/agent-assets/docs/features/routines/weekly-review.md +46 -21
- package/agent-assets/docs/features/wiki/commands.md +26 -16
- package/agent-assets/docs/features/wiki/cost-and-approval.md +241 -0
- package/agent-assets/docs/features/wiki/dashboard.md +256 -0
- package/agent-assets/docs/features/wiki/overview.md +70 -12
- package/agent-assets/docs/features/wiki/search.md +248 -0
- package/agent-assets/docs/features/wiki/workspaces.md +254 -0
- package/agent-assets/docs/getting-started/01-what-is-this.md +34 -23
- package/agent-assets/docs/getting-started/02-first-steps.md +17 -10
- package/agent-assets/docs/getting-started/03-what-can-this-do.md +25 -14
- package/agent-assets/docs/getting-started/04-first-day.md +39 -21
- package/agent-assets/docs/glossary.md +235 -24
- package/agent-assets/docs/guides/add-a-custom-routine.md +63 -23
- package/agent-assets/docs/guides/backup-and-restore.md +80 -16
- package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +57 -26
- package/agent-assets/docs/guides/build-your-wiki.md +22 -9
- package/agent-assets/docs/guides/change-which-model-handles-x.md +64 -10
- package/agent-assets/docs/guides/connect-a-new-mail-account.md +66 -15
- package/agent-assets/docs/guides/explore-with-trace-and-connect.md +32 -14
- package/agent-assets/docs/guides/import-knowledge-file.md +50 -40
- package/agent-assets/docs/guides/install-and-run.md +49 -20
- package/agent-assets/docs/guides/maintain-wiki-health.md +35 -10
- package/agent-assets/docs/guides/migrate-machines.md +74 -18
- package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +111 -60
- package/agent-assets/docs/guides/pause-the-agent.md +69 -24
- package/agent-assets/docs/guides/reinstall-cleanly.md +88 -18
- package/agent-assets/docs/guides/setup-wizard.md +116 -54
- package/agent-assets/docs/guides/switch-default-backend.md +62 -16
- package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +30 -14
- package/agent-assets/docs/reference/api.md +153 -32
- package/agent-assets/docs/reference/cli-commands.md +39 -18
- package/agent-assets/docs/reference/config.md +241 -49
- package/agent-assets/docs/reference/disallowed-tools.md +34 -13
- package/agent-assets/docs/reference/keyboard-shortcuts.md +34 -10
- package/agent-assets/docs/reference/knowledge-layout.md +629 -0
- package/agent-assets/docs/reference/process-keys.md +62 -6
- package/agent-assets/docs/reference/skills.md +41 -14
- package/agent-assets/docs/troubleshooting/auth-failed.md +51 -21
- package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +97 -28
- package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +86 -22
- package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +68 -24
- package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +80 -20
- package/agent-assets/docs/troubleshooting/observation-not-detected.md +73 -21
- package/agent-assets/docs/troubleshooting/quota-exhausted.md +33 -8
- package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +126 -54
- package/agent-assets/docs/troubleshooting/wiki-write-failed.md +29 -12
- package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
- package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +1 -1
- package/agent-assets/optimizer-skills/skill-curation/SKILL.md +1 -1
- package/agent-assets/sandbox/linux/aitne-chromium.apparmor +91 -0
- package/agent-assets/sandbox/macos/aitne-chromium.sb +156 -0
- package/agent-assets/skills/agent-actions/SKILL.md +25 -41
- package/agent-assets/skills/agent-create/SKILL.md +158 -0
- package/agent-assets/skills/attach/SKILL.md +10 -29
- package/agent-assets/skills/browser-history/SKILL.md +211 -0
- package/agent-assets/skills/browser-history-respond/SKILL.md +111 -0
- package/agent-assets/skills/browser-task/SKILL.md +164 -0
- package/agent-assets/skills/context/SKILL.md +35 -44
- package/agent-assets/skills/context/curation.json +14 -14
- package/agent-assets/skills/context/references/api.md +52 -40
- package/agent-assets/skills/context/references/required-frontmatter.md +13 -12
- package/agent-assets/skills/context/references/snapshot-files.md +18 -17
- package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +8 -8
- package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
- package/agent-assets/skills/docs-search/SKILL.md +23 -34
- package/agent-assets/skills/external-services/SKILL.delegated.claude.md +17 -114
- package/agent-assets/skills/external-services/SKILL.delegated.codex.md +17 -113
- package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +17 -113
- package/agent-assets/skills/external-services/SKILL.md +3 -3
- package/agent-assets/skills/external-services/SKILL.native.claude.md +7 -7
- package/agent-assets/skills/external-services/SKILL.native.codex.md +7 -7
- package/agent-assets/skills/external-services/SKILL.native.gemini.md +4 -4
- package/agent-assets/skills/external-services/references/calendar-apple.md +2 -2
- package/agent-assets/skills/external-services/references/calendar-outlook.md +1 -1
- package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
- package/agent-assets/skills/external-services/references/obsidian.md +2 -2
- package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
- package/agent-assets/skills/gmail-lifestyle/SKILL.md +11 -83
- package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
- package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
- package/agent-assets/skills/mail/SKILL.delegated.claude.md +15 -18
- package/agent-assets/skills/mail/SKILL.delegated.codex.md +11 -6
- package/agent-assets/skills/mail/SKILL.delegated.gemini.md +11 -6
- package/agent-assets/skills/mail/SKILL.md +10 -18
- package/agent-assets/skills/mail/SKILL.native.claude.md +8 -7
- package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
- package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
- package/agent-assets/skills/mail/references/api.md +10 -3
- package/agent-assets/skills/mail/references/examples.md +2 -1
- package/agent-assets/skills/mail/references/providers.md +1 -1
- package/agent-assets/skills/managed-tasks/SKILL.md +48 -81
- package/agent-assets/skills/managed-tasks/references/errors.md +33 -19
- package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
- package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +7 -5
- package/agent-assets/skills/management-policy/SKILL.md +42 -42
- package/agent-assets/skills/management-policy/curation.json +1 -1
- package/agent-assets/skills/management-policy/references/policy-workflow.md +11 -12
- package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +1 -1
- package/agent-assets/skills/notify/SKILL.md +14 -16
- package/agent-assets/skills/notify/references/priority.md +28 -20
- package/agent-assets/skills/notion/SKILL.delegated.claude.md +2 -2
- package/agent-assets/skills/notion/SKILL.delegated.codex.md +2 -2
- package/agent-assets/skills/notion/SKILL.delegated.gemini.md +2 -2
- package/agent-assets/skills/notion/SKILL.md +17 -17
- package/agent-assets/skills/notion/SKILL.native.claude.md +11 -7
- package/agent-assets/skills/notion/SKILL.native.codex.md +10 -5
- package/agent-assets/skills/notion/SKILL.native.gemini.md +10 -5
- package/agent-assets/skills/observations/SKILL.md +29 -28
- package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
- package/agent-assets/skills/project-doc/SKILL.md +10 -7
- package/agent-assets/skills/project-doc/curation.json +3 -3
- package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +8 -5
- package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +5 -5
- package/agent-assets/skills/reading/SKILL.md +18 -42
- package/agent-assets/skills/reading/references/reading-taste.md +7 -7
- package/agent-assets/skills/roadmap/SKILL.md +8 -24
- package/agent-assets/skills/roadmap/curation.json +1 -1
- package/agent-assets/skills/roadmap/references/api.md +21 -11
- package/agent-assets/skills/roadmap/references/cross-check.md +15 -8
- package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
- package/agent-assets/skills/roadmap/references/migration.md +12 -10
- package/agent-assets/skills/roadmap/references/retention.md +18 -0
- package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +1 -1
- package/agent-assets/skills/schedule/SKILL.md +41 -50
- package/agent-assets/skills/schedule/references/batch.md +2 -2
- package/agent-assets/skills/schedule/references/errors.md +7 -4
- package/agent-assets/skills/schedule/references/importance.md +23 -0
- package/agent-assets/skills/schedule/references/model-selection.md +3 -3
- package/agent-assets/skills/schedule/references/recurrence-rule.md +7 -5
- package/agent-assets/skills/scheduled-managed-task/SKILL.md +77 -70
- package/agent-assets/skills/today/SKILL.md +24 -83
- package/agent-assets/skills/today/curation.json +3 -3
- package/agent-assets/skills/today/references/agent-plan-lifecycle.md +6 -5
- package/agent-assets/skills/today/references/today-skeleton.md +66 -0
- package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
- package/agent-assets/skills/today/seeds/section-shape.seed.json +7 -7
- package/agent-assets/skills/user-interview/SKILL.md +21 -93
- package/agent-assets/skills/user-interview/references/op-briefing.md +3 -3
- package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
- package/agent-assets/skills/user-interview/references/op-morning.md +1 -1
- package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +9 -1
- package/agent-assets/skills/user-profile/SKILL.md +29 -39
- package/agent-assets/skills/user-profile/curation.json +4 -4
- package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
- package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +8 -8
- package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +6 -6
- package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
- package/agent-assets/skills/wiki/wiki-compile/SKILL.md +9 -8
- package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
- package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
- package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
- package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
- package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
- package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
- package/agent-assets/system-prompts/routine-fetch-window.md +22 -12
- package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +4 -2
- package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +4 -2
- package/agent-assets/task-flows/_partials/capture-user-info.md +2 -2
- package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +1 -1
- package/agent-assets/task-flows/_partials/dm-intent.project.md +9 -9
- package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
- package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +3 -2
- package/agent-assets/task-flows/_partials/notion-acquire.notion.md +10 -5
- package/agent-assets/task-flows/browser_task.md +84 -0
- package/agent-assets/task-flows/github.assigned.md +1 -1
- package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
- package/agent-assets/task-flows/github.workflow_run.failed.md +2 -2
- package/agent-assets/task-flows/knowledge.import.md +14 -14
- package/agent-assets/task-flows/message.received.dm.md +13 -4
- package/agent-assets/task-flows/message.received.dm_first.md +7 -3
- package/agent-assets/task-flows/routine.custom.md +3 -3
- package/agent-assets/task-flows/routine.evening_review.md +88 -8
- package/agent-assets/task-flows/routine.fetch_window.md +2 -2
- package/agent-assets/task-flows/routine.hourly_check.md +16 -12
- package/agent-assets/task-flows/routine.monthly_review.md +93 -21
- package/agent-assets/task-flows/routine.morning_routine_journal.md +119 -97
- package/agent-assets/task-flows/routine.morning_routine_today.md +43 -43
- package/agent-assets/task-flows/routine.research_cluster_update.md +35 -0
- package/agent-assets/task-flows/routine.research_dispatch.md +38 -0
- package/agent-assets/task-flows/routine.research_offer_dm.md +125 -0
- package/agent-assets/task-flows/routine.research_wiki_summary.md +53 -0
- package/agent-assets/task-flows/routine.roadmap_refresh.md +10 -10
- package/agent-assets/task-flows/routine.today_refresh.md +4 -4
- package/agent-assets/task-flows/routine.user_profile_sweep.md +10 -10
- package/agent-assets/task-flows/routine.weekly_review.md +114 -24
- package/agent-assets/task-flows/schedule.approaching.md +0 -1
- package/agent-assets/task-flows/scheduled.dm.md +5 -5
- package/agent-assets/task-flows/scheduled.task.md +4 -4
- package/agent-assets/task-flows/setup.initial.md +21 -21
- package/agent-assets/task-flows/setup.update.md +2 -2
- package/agent-assets/task-flows/wiki.trace.md +1 -1
- package/agent-assets/templates/README.md +27 -20
- package/agent-assets/templates/_index.md +42 -26
- package/agent-assets/templates/_manifest.json +34 -99
- package/agent-assets/templates/{user → identity}/_index.md +1 -1
- package/agent-assets/templates/{user → identity}/profile.md +2 -2
- package/agent-assets/templates/{dossiers → knowledge/dossiers}/_index.md +1 -1
- package/agent-assets/templates/{projects → plans/projects}/_active.base +1 -1
- package/agent-assets/templates/policies/_index.md +21 -0
- package/agent-assets/templates/{rules → policies}/journal-export.md +1 -1
- package/agent-assets/templates/{rules → policies}/journal-format.md +5 -5
- package/agent-assets/templates/{rules/policies → policies/management-captures}/_index.md +2 -2
- package/agent-assets/templates/{rules → policies}/management.md +3 -3
- package/agent-assets/templates/{rules → policies}/mcp.md +1 -1
- package/agent-assets/templates/{rules → policies}/redaction.md +1 -1
- package/agent-assets/templates/{routines → policies/routines}/_index.md +1 -1
- package/agent-assets/templates/{routines → policies/routines}/evening.md +2 -2
- package/agent-assets/templates/{routines → policies/routines}/hourly.md +1 -1
- package/agent-assets/templates/{routines → policies/routines}/monthly.md +2 -2
- package/bin/aitne.mjs +58 -15
- package/package.json +5 -4
- package/scripts/commands/doctor.mjs +25 -10
- package/scripts/commands/run-now.mjs +6 -21
- package/scripts/lib/ports.d.mts +27 -0
- package/scripts/lib/ports.mjs +36 -0
- package/scripts/lib/process-identity.d.mts +46 -0
- package/scripts/lib/process-identity.mjs +193 -0
- package/scripts/lib/read-api-token.mjs +176 -0
- package/scripts/start.mjs +16 -5
- package/agent-assets/docs/features/lifestyle/travel-time.md +0 -58
- package/agent-assets/skills/gmail-lifestyle/references/travel-time-api.md +0 -59
- package/agent-assets/skills/schedule/references/recurring.md +0 -185
- package/agent-assets/templates/context-index.md +0 -42
- package/agent-assets/templates/rules/_index.md +0 -19
- /package/agent-assets/templates/{user → identity}/expertise.md +0 -0
- /package/agent-assets/templates/{user → identity}/goals.md +0 -0
- /package/agent-assets/templates/{user → identity}/people.md +0 -0
- /package/agent-assets/templates/{user → identity}/personal.md +0 -0
- /package/agent-assets/templates/{user → identity}/work.md +0 -0
- /package/agent-assets/templates/{agent/journal.md → journal/agent.md} +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/evening.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/hourly.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/monthly.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/morning.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/roadmap.md +0 -0
- /package/agent-assets/templates/{dossiers → knowledge/dossiers}/weekly.md +0 -0
- /package/agent-assets/templates/{projects → plans/projects}/_index.md +0 -0
- /package/agent-assets/templates/{roadmap.md → plans/roadmap.md} +0 -0
- /package/agent-assets/templates/{routines → policies/routines}/morning.md +0 -0
- /package/agent-assets/templates/{routines → policies/routines}/weekly.md +0 -0
- /package/agent-assets/templates/{agent → state}/profile-questions.md +0 -0
- /package/agent-assets/templates/{today.md → state/today.md} +0 -0
|
@@ -22,7 +22,7 @@ because the human user doesn't journal by hand — but the perspective,
|
|
|
22
22
|
voice, and content all belong to the user.
|
|
23
23
|
|
|
24
24
|
Agent-side bookkeeping (action counts, internal anomalies, audit
|
|
25
|
-
trail) lives in `agent
|
|
25
|
+
trail) lives in `journal/agent.md` — not here. If you find yourself
|
|
26
26
|
about to log "the agent ran N tools today" or "the hourly check
|
|
27
27
|
fired M times", that belongs in the agent-side log instead. Filter
|
|
28
28
|
it out.
|
|
@@ -108,7 +108,7 @@ day, etc.
|
|
|
108
108
|
**Sections deliberately NOT in the daily journal:**
|
|
109
109
|
|
|
110
110
|
- ❌ Agent action counts (`agent_actions` breakdown by type). Lives
|
|
111
|
-
in `agent
|
|
111
|
+
in `journal/agent.md` instead — the audit-trail footprint.
|
|
112
112
|
- ❌ Internal stage status, retry counts, anomalies. Same as above.
|
|
113
113
|
- ❌ "The agent did X for the user" framing. The user's diary uses
|
|
114
114
|
user voice; agent meta-narration belongs in the agent-side log.
|
|
@@ -129,7 +129,7 @@ day, etc.
|
|
|
129
129
|
|
|
130
130
|
- When `settings.vault_mode` is `obsidian`, Stage B renders project /
|
|
131
131
|
people references throughout the body as `[[wikilinks]]` targeting
|
|
132
|
-
`projects/<slug>.md` or `
|
|
132
|
+
`projects/<slug>.md` or `identity/people.md#<person>` (basename resolves
|
|
133
133
|
automatically). The `## Summary` paragraph is the primary surface,
|
|
134
134
|
but data sections may also receive wikilinks where a project / person
|
|
135
135
|
name appears (e.g. a meeting title containing a person's name).
|
|
@@ -140,10 +140,10 @@ day, etc.
|
|
|
140
140
|
|
|
141
141
|
## Redaction
|
|
142
142
|
|
|
143
|
-
- Apply `
|
|
143
|
+
- Apply `policies/redaction.md` patterns to the entire body Stage B
|
|
144
144
|
authors (Summary + data sections both — Stage B owns the body, so
|
|
145
145
|
redaction applies wherever sensitive content might surface).
|
|
146
|
-
- Apply `
|
|
146
|
+
- Apply `policies/journal-export.md` user rules to the entire body.
|
|
147
147
|
- If yesterday.md frontmatter had `no_journal_export: true`, write
|
|
148
148
|
`[Skipped by user request]` as the body of `## Summary` and omit
|
|
149
149
|
the data sections (they would echo information the export rule is
|
|
@@ -8,8 +8,8 @@ template_version: 2
|
|
|
8
8
|
|
|
9
9
|
Auto-maintained by the daemon's policy-index reconciler. Direct edits
|
|
10
10
|
are overwritten on the next reconcile pass — to add or modify a policy,
|
|
11
|
-
edit its `
|
|
12
|
-
skill).
|
|
11
|
+
edit its `policies/management-captures/<slug>.md` file (or use the
|
|
12
|
+
`management-policy` skill).
|
|
13
13
|
|
|
14
14
|
## Active
|
|
15
15
|
|
|
@@ -32,15 +32,15 @@ or the dashboard's Settings → Management page._
|
|
|
32
32
|
## C. Active Policies
|
|
33
33
|
|
|
34
34
|
Auto-maintained by the daemon (do not edit). Source files live under
|
|
35
|
-
`
|
|
36
|
-
`management-policy` skill. Full index: [[
|
|
35
|
+
`policies/management-captures/<slug>.md`; capture new policies via the
|
|
36
|
+
`management-policy` skill. Full index: [[policies/management-captures/_index.md]]
|
|
37
37
|
|
|
38
38
|
_No active policies yet._
|
|
39
39
|
|
|
40
40
|
## Notes
|
|
41
41
|
|
|
42
42
|
- The agent cannot use `Edit` / `Write` tools on this file — writes go
|
|
43
|
-
through `/api/context/
|
|
43
|
+
through `/api/context/policies/management` (locked + snapshotted) or the
|
|
44
44
|
managed-tasks / sot-bindings API surfaces.
|
|
45
45
|
- This file is injected into every flow via `policy-files.ts`. Keep it
|
|
46
46
|
concise so prompt assembly stays cheap.
|
|
@@ -16,7 +16,7 @@ This file governs how the agent uses attached Model Context Protocol
|
|
|
16
16
|
the target with me via DM when the change is visible to others (a new
|
|
17
17
|
issue, a posted message, an edited doc).
|
|
18
18
|
- Failures are loggable events. On repeated MCP call failures, the agent
|
|
19
|
-
appends to `agent
|
|
19
|
+
appends to `journal/agent.md` and surfaces the pattern at the next
|
|
20
20
|
hourly check.
|
|
21
21
|
- Scope to the active task. MCP calls unrelated to the current flow's
|
|
22
22
|
stated goal are skipped.
|
|
@@ -22,7 +22,7 @@ redaction is performed in code by `packages/shared/src/secret-redaction.ts`.
|
|
|
22
22
|
## Context-specific (journal export)
|
|
23
23
|
|
|
24
24
|
When exporting `daily/*.md` to an external vault (B-005), additional
|
|
25
|
-
user-defined rules in `
|
|
25
|
+
user-defined rules in `policies/journal-export.md` are applied on top.
|
|
26
26
|
|
|
27
27
|
## Appearance in logs
|
|
28
28
|
|
|
@@ -17,4 +17,4 @@ I've added later via DM). All checks are treated equally.
|
|
|
17
17
|
| `evening.md` | evening | `routine.evening_review` |
|
|
18
18
|
| `weekly.md` | Friday | `routine.weekly_review` |
|
|
19
19
|
| `monthly.md` | month-end | `routine.monthly_review` |
|
|
20
|
-
| custom/<slug>.md | user-defined cron in `routines/custom/` | `routine.custom.<slug>` |
|
|
20
|
+
| custom/<slug>.md | user-defined cron in `policies/routines/custom/` | `routine.custom.<slug>` |
|
|
@@ -10,7 +10,7 @@ template_version: 1
|
|
|
10
10
|
## Checks
|
|
11
11
|
|
|
12
12
|
### Today → Handoff
|
|
13
|
-
- **Action**: scan `today.md` for open items and summarize them into
|
|
13
|
+
- **Action**: scan `state/today.md` for open items and summarize them into
|
|
14
14
|
`## Handoff` so tomorrow's morning routine can pick them up
|
|
15
15
|
|
|
16
16
|
### Tomorrow preview
|
|
@@ -18,5 +18,5 @@ template_version: 1
|
|
|
18
18
|
deadlines into `## Handoff`
|
|
19
19
|
|
|
20
20
|
### Journal tail
|
|
21
|
-
- **Action**: append a 1–2 sentence note to `agent
|
|
21
|
+
- **Action**: append a 1–2 sentence note to `journal/agent.md` describing
|
|
22
22
|
anything surprising the agent observed today
|
|
@@ -21,7 +21,7 @@ skipping any whose preconditions are not met.
|
|
|
21
21
|
|
|
22
22
|
### Upcoming schedule
|
|
23
23
|
- **Precondition**: always
|
|
24
|
-
- **Action**: scan `today.md` `## Agent Plan` for items in the next 60
|
|
24
|
+
- **Action**: scan `state/today.md` `## Agent Plan` for items in the next 60
|
|
25
25
|
min; ensure each has a `scheduled.task` row.
|
|
26
26
|
|
|
27
27
|
## Skip conditions (applied before any check)
|
|
@@ -17,9 +17,9 @@ Fires on the last calendar day of the month. Output target:
|
|
|
17
17
|
`daily/*.md` items
|
|
18
18
|
|
|
19
19
|
### Roadmap delta
|
|
20
|
-
- **Action**: compare current `roadmap.md` against the month's progress;
|
|
20
|
+
- **Action**: compare current `plans/roadmap.md` against the month's progress;
|
|
21
21
|
highlight completed + delayed items
|
|
22
22
|
|
|
23
23
|
### Habit + health snapshot
|
|
24
|
-
- **Action**: if the user logged health/habit data in `
|
|
24
|
+
- **Action**: if the user logged health/habit data in `identity/personal.md`,
|
|
25
25
|
surface month-over-month changes (opt-in only)
|
package/bin/aitne.mjs
CHANGED
|
@@ -8,6 +8,21 @@ import process from "node:process";
|
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { ensureBuild } from "../scripts/run-node.mjs";
|
|
10
10
|
import { fetchHttpOk, openBrowser } from "../scripts/browser.mjs";
|
|
11
|
+
// Port defaults live in this plain-ESM module (NOT @aitne/shared, per the
|
|
12
|
+
// pre-build constraint noted below). scripts/lib/ ships in the published
|
|
13
|
+
// `files` list, so this import works in global installs too.
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_API_PORT,
|
|
16
|
+
DEFAULT_DASHBOARD_PORT,
|
|
17
|
+
resolveApiPort,
|
|
18
|
+
resolveDashboardPort,
|
|
19
|
+
} from "../scripts/lib/ports.mjs";
|
|
20
|
+
import {
|
|
21
|
+
classifyPid,
|
|
22
|
+
parsePidMeta,
|
|
23
|
+
readProcessStartToken,
|
|
24
|
+
serializePidMeta,
|
|
25
|
+
} from "../scripts/lib/process-identity.mjs";
|
|
11
26
|
|
|
12
27
|
const IS_WINDOWS = process.platform === "win32";
|
|
13
28
|
|
|
@@ -55,8 +70,8 @@ const DAEMON_PID_FILE = path.join(PIDS_DIR, "daemon.pid");
|
|
|
55
70
|
const DASHBOARD_PID_FILE = path.join(PIDS_DIR, "dashboard.pid");
|
|
56
71
|
const DAEMON_LOG_FILE = path.join(DATA_DIR, "logs", "daemon.log");
|
|
57
72
|
const DASHBOARD_LOG_FILE = path.join(DATA_DIR, "logs", "dashboard.log");
|
|
58
|
-
const DAEMON_PORT =
|
|
59
|
-
const DASHBOARD_PORT =
|
|
73
|
+
const DAEMON_PORT = resolveApiPort();
|
|
74
|
+
const DASHBOARD_PORT = resolveDashboardPort();
|
|
60
75
|
|
|
61
76
|
const VERSION = JSON.parse(
|
|
62
77
|
fs.readFileSync(path.join(PROJECT_ROOT, "package.json"), "utf8"),
|
|
@@ -89,18 +104,25 @@ function rotateLogFile(logFile) {
|
|
|
89
104
|
try { fs.renameSync(logFile, rotated); } catch { /* ignore */ }
|
|
90
105
|
}
|
|
91
106
|
|
|
92
|
-
function
|
|
107
|
+
function readPidMeta(pidFile) {
|
|
93
108
|
try {
|
|
94
|
-
|
|
95
|
-
const pid = parseInt(content, 10);
|
|
96
|
-
return Number.isFinite(pid) ? pid : null;
|
|
109
|
+
return parsePidMeta(fs.readFileSync(pidFile, "utf8"));
|
|
97
110
|
} catch {
|
|
98
111
|
return null;
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Persist the PID plus a start-identity token so a later `start`/`stop`/`status`
|
|
117
|
+
* can tell *our* process from a recycled PID after an unclean shutdown. Line 1
|
|
118
|
+
* stays the bare PID so an older aitne still reads the file. If the OS
|
|
119
|
+
* start-time read fails we write just the bare PID and degrade to the legacy
|
|
120
|
+
* unverified-but-trusted behavior. See process-lifecycle-2 in
|
|
121
|
+
* CROSS_PLATFORM_REAUDIT_2026-06.md.
|
|
122
|
+
*/
|
|
102
123
|
function writePid(pidFile, pid) {
|
|
103
|
-
|
|
124
|
+
const startToken = readProcessStartToken(pid);
|
|
125
|
+
fs.writeFileSync(pidFile, serializePidMeta({ pid, startToken }));
|
|
104
126
|
}
|
|
105
127
|
|
|
106
128
|
function removePid(pidFile) {
|
|
@@ -177,11 +199,25 @@ function nextSpawnArgs(dashboardDir, nextBin, userArgs) {
|
|
|
177
199
|
return userArgs;
|
|
178
200
|
}
|
|
179
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Resolve the live PID recorded in `pidFile`, or null. This is the single
|
|
204
|
+
* chokepoint every command (start/stop/status, plus open/uninstall/doctor via
|
|
205
|
+
* ctx.helpers) funnels through, so identity reconciliation here fixes them all
|
|
206
|
+
* at once. A recycled PID (start-time token mismatch) classifies `stale` → the
|
|
207
|
+
* pidfile is removed and null returned, so `start` won't false-"Already
|
|
208
|
+
* running" and `stop` won't kill an unrelated tree. `running-unverified`
|
|
209
|
+
* (legacy file with no token, or an OS start-time read failure) degrades to the
|
|
210
|
+
* pre-fix bare-PID behavior — no regression; a legacy file self-heals on the
|
|
211
|
+
* next writePid. verifyStartup() deliberately does NOT route through here: it
|
|
212
|
+
* checks the freshly-spawned in-memory pid via isAlive + health, preserving its
|
|
213
|
+
* "alive but health not responding = hung" branch.
|
|
214
|
+
*/
|
|
180
215
|
function getRunningPid(pidFile) {
|
|
181
|
-
const
|
|
182
|
-
if (pid == null) return null;
|
|
183
|
-
|
|
184
|
-
return
|
|
216
|
+
const meta = readPidMeta(pidFile);
|
|
217
|
+
if (!meta || meta.pid == null) return null;
|
|
218
|
+
const verdict = classifyPid(meta, { readToken: readProcessStartToken, isAlive });
|
|
219
|
+
if (verdict === "stale") { removePid(pidFile); return null; }
|
|
220
|
+
return meta.pid;
|
|
185
221
|
}
|
|
186
222
|
|
|
187
223
|
/**
|
|
@@ -305,7 +341,14 @@ async function cmdLogRunner(args) {
|
|
|
305
341
|
}
|
|
306
342
|
};
|
|
307
343
|
|
|
308
|
-
|
|
344
|
+
// Under shell:true on Windows, cmd.exe re-parses the line and does NOT
|
|
345
|
+
// auto-quote the command, so a spaced install path (C:\\Users\\First Last\\...)
|
|
346
|
+
// would split at the space. Double-quote the command so it stays one token.
|
|
347
|
+
// POSIX is byte-identical: spec.shell is never true off Windows (the `.cmd`
|
|
348
|
+
// predicate at the call site is gated on IS_WINDOWS). Args here are static
|
|
349
|
+
// literals (start --port <n>) with no metacharacters, so they need no escaping.
|
|
350
|
+
const runCommand = spec.shell === true ? `"${spec.command}"` : spec.command;
|
|
351
|
+
const child = spawn(runCommand, spec.args, {
|
|
309
352
|
cwd: spec.cwd,
|
|
310
353
|
env: process.env,
|
|
311
354
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -418,7 +461,7 @@ async function cmdStart(args = []) {
|
|
|
418
461
|
// cmd.exe and are kept only as a last fallback.
|
|
419
462
|
const nextBin = resolveNextBin(dashboardDir);
|
|
420
463
|
const dashArgs = nextSpawnArgs(dashboardDir, nextBin, [
|
|
421
|
-
"start", "--port", String(DASHBOARD_PORT),
|
|
464
|
+
"start", "--port", String(DASHBOARD_PORT), "--hostname", "127.0.0.1",
|
|
422
465
|
]);
|
|
423
466
|
const dashboard = spawnLoggedService({
|
|
424
467
|
command: nextBin,
|
|
@@ -1004,8 +1047,8 @@ Options:
|
|
|
1004
1047
|
|
|
1005
1048
|
Environment:
|
|
1006
1049
|
PA_DATA_DIR Data directory (default: ~/.personal-agent)
|
|
1007
|
-
PA_API_PORT Daemon port (default:
|
|
1008
|
-
PA_DASHBOARD_PORT Dashboard port (default:
|
|
1050
|
+
PA_API_PORT Daemon port (default: ${DEFAULT_API_PORT})
|
|
1051
|
+
PA_DASHBOARD_PORT Dashboard port (default: ${DEFAULT_DASHBOARD_PORT})
|
|
1009
1052
|
|
|
1010
1053
|
Examples:
|
|
1011
1054
|
aitne start Launch in background
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aitne-sh/aitne",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Aitne — a local-first, proactive personal AI agent. A long-running TypeScript daemon is the nervous system; Claude Code (or Codex / Gemini CLI) is the brain. All persistent memory lives in local Markdown files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"README.md"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@aitne/daemon": "0.1.
|
|
47
|
-
"@aitne/dashboard": "0.1.
|
|
48
|
-
"@aitne/shared": "0.1.
|
|
46
|
+
"@aitne/daemon": "0.1.10",
|
|
47
|
+
"@aitne/dashboard": "0.1.10",
|
|
48
|
+
"@aitne/shared": "0.1.10"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"test": "node scripts/check-redaction-coverage.mjs && vitest run --coverage",
|
|
76
76
|
"test:watch": "vitest",
|
|
77
77
|
"check:redaction": "node scripts/check-redaction-coverage.mjs",
|
|
78
|
+
"check:vault-paths": "node scripts/check-vault-path-drift.mjs",
|
|
78
79
|
"lint": "turbo run lint",
|
|
79
80
|
"typecheck:tests": "turbo run typecheck:tests",
|
|
80
81
|
"clean": "turbo run clean && node scripts/rm-paths.mjs node_modules .buildstamp"
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
import { execFileSync } from "node:child_process";
|
|
13
13
|
import fs from "node:fs";
|
|
14
14
|
import net from "node:net";
|
|
15
|
+
import os from "node:os";
|
|
15
16
|
import path from "node:path";
|
|
17
|
+
import { pathToFileURL } from "node:url";
|
|
16
18
|
|
|
17
19
|
export async function run(args, ctx) {
|
|
18
20
|
if (args.includes("--help") || args.includes("-h")) {
|
|
@@ -38,7 +40,7 @@ Exit code:
|
|
|
38
40
|
await checkSecretStore(ctx),
|
|
39
41
|
await checkBackendCli(),
|
|
40
42
|
await checkProcessProbe(),
|
|
41
|
-
await checkBrowserOpener(),
|
|
43
|
+
await checkBrowserOpener(ctx.DASHBOARD_PORT),
|
|
42
44
|
await checkDataDirWritable(ctx.DATA_DIR),
|
|
43
45
|
await checkBetterSqlite3(ctx.PROJECT_ROOT),
|
|
44
46
|
await checkAgentAssets(ctx.PROJECT_ROOT),
|
|
@@ -127,8 +129,8 @@ async function checkPort(label, port, pidFile, getRunningPid) {
|
|
|
127
129
|
label,
|
|
128
130
|
detail: `${port} in use by another process`,
|
|
129
131
|
hint: label.startsWith("Daemon")
|
|
130
|
-
? `Set PA_API_PORT to an open port (e.g. PA_API_PORT=
|
|
131
|
-
: `Set PA_DASHBOARD_PORT to an open port (e.g. PA_DASHBOARD_PORT=
|
|
132
|
+
? `Set PA_API_PORT to an open port (e.g. PA_API_PORT=8331 aitne start), or stop the conflicting process.`
|
|
133
|
+
: `Set PA_DASHBOARD_PORT to an open port (e.g. PA_DASHBOARD_PORT=8333 aitne start), or stop the conflicting process.`,
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
136
|
|
|
@@ -164,7 +166,13 @@ async function checkSecretStore(ctx) {
|
|
|
164
166
|
return { status: "pass", label: "Secret store", detail: "libsecret (`secret-tool`) reachable" };
|
|
165
167
|
} catch {
|
|
166
168
|
const hasMaster = !!process.env.PA_MASTER_PASSWORD;
|
|
167
|
-
|
|
169
|
+
// The daemon's secret clients hardcode ~/.personal-agent/secrets and do
|
|
170
|
+
// NOT honor PA_DATA_DIR (secret-client-file.ts:99,209 — homedir-hardcoded;
|
|
171
|
+
// createSecretClient passes no dir). Probe the same homedir-anchored path
|
|
172
|
+
// so this diagnostic agrees with where keys are actually read. If the
|
|
173
|
+
// daemon is ever changed to honor PA_DATA_DIR for secrets, revert this and
|
|
174
|
+
// fix at the factory (secret-client-factory.ts) instead.
|
|
175
|
+
const keyfile = path.join(os.homedir(), ".personal-agent", "secrets", ".master-key");
|
|
168
176
|
const hasKeyfile = fs.existsSync(keyfile);
|
|
169
177
|
if (hasMaster || hasKeyfile) {
|
|
170
178
|
return {
|
|
@@ -182,11 +190,17 @@ async function checkSecretStore(ctx) {
|
|
|
182
190
|
}
|
|
183
191
|
}
|
|
184
192
|
if (platform === "win32") {
|
|
185
|
-
|
|
193
|
+
// Match the factory's terminal fallback (secret-client-factory.ts:37-41): prefer
|
|
194
|
+
// in-box powershell.exe, else pwsh.exe, else default to powershell.exe — the exact
|
|
195
|
+
// binary the daemon will exec — so a both-missing FAIL names the right binary.
|
|
196
|
+
const psBinary = whichSync("powershell.exe") ? "powershell.exe" : (whichSync("pwsh.exe") ? "pwsh.exe" : "powershell.exe");
|
|
186
197
|
try {
|
|
198
|
+
// Mirror WindowsDpapiSecretClient's real encrypt path: ConvertTo/From-SecureString
|
|
199
|
+
// (no -Key => DPAPI). Works on both powershell.exe (5.1) and pwsh.exe (7+); the prior
|
|
200
|
+
// [ProtectedData] type check false-fails on PowerShell-Core-only hosts that work fine.
|
|
187
201
|
execFileSync(psBinary, [
|
|
188
|
-
"-NoProfile", "-Command",
|
|
189
|
-
"
|
|
202
|
+
"-NoProfile", "-NonInteractive", "-Command",
|
|
203
|
+
"$s = ConvertTo-SecureString 'probe' -AsPlainText -Force; $e = ConvertFrom-SecureString $s; if (-not $e) { exit 1 }; exit 0",
|
|
190
204
|
], { stdio: "pipe", timeout: 5000 });
|
|
191
205
|
return { status: "pass", label: "Secret store", detail: `Windows DPAPI via ${psBinary} reachable` };
|
|
192
206
|
} catch (err) {
|
|
@@ -253,7 +267,7 @@ async function checkProcessProbe() {
|
|
|
253
267
|
* Warn-only: nothing in the daemon depends on this; users can navigate to
|
|
254
268
|
* the dashboard URL by hand if missing.
|
|
255
269
|
*/
|
|
256
|
-
async function checkBrowserOpener() {
|
|
270
|
+
async function checkBrowserOpener(dashboardPort) {
|
|
257
271
|
const platform = process.platform;
|
|
258
272
|
const tool =
|
|
259
273
|
platform === "darwin" ? "open"
|
|
@@ -268,7 +282,7 @@ async function checkBrowserOpener() {
|
|
|
268
282
|
detail: `${tool} not on PATH`,
|
|
269
283
|
hint:
|
|
270
284
|
platform === "linux"
|
|
271
|
-
?
|
|
285
|
+
? `apt install xdg-utils · or open http://localhost:${dashboardPort} manually after \`aitne start\`.`
|
|
272
286
|
: "Auto-open is a convenience; the dashboard URL works in any browser.",
|
|
273
287
|
};
|
|
274
288
|
}
|
|
@@ -365,7 +379,8 @@ async function checkRepositoryGithubLinkDrift(dataDir) {
|
|
|
365
379
|
},
|
|
366
380
|
];
|
|
367
381
|
}
|
|
368
|
-
|
|
382
|
+
const mod = await import(pathToFileURL(found).href);
|
|
383
|
+
Database = mod.default ?? mod;
|
|
369
384
|
} catch (err) {
|
|
370
385
|
return [
|
|
371
386
|
{
|
|
@@ -9,8 +9,10 @@
|
|
|
9
9
|
* `docs/design/appendices/evening-review-slimdown.md` §2.2.
|
|
10
10
|
*
|
|
11
11
|
* Implementation:
|
|
12
|
-
* - Reads the daemon's apiToken from the
|
|
13
|
-
*
|
|
12
|
+
* - Reads the daemon's apiToken from the OS secret store (macOS
|
|
13
|
+
* Keychain, Windows DPAPI, Linux libsecret, or the encrypted file
|
|
14
|
+
* fallback) via the shared cross-platform reader — the same entry
|
|
15
|
+
* the dashboard proxy uses. Bearer-auth required because
|
|
14
16
|
* `POST /api/agent/run-now/*` routes are Approve-tier in the
|
|
15
17
|
* `risk-classifier`.
|
|
16
18
|
* - POSTs to `http://127.0.0.1:<PA_API_PORT>/api/agent/run-now/<job>`.
|
|
@@ -23,7 +25,7 @@
|
|
|
23
25
|
* - 3 daemon not running, not reachable, or 5xx
|
|
24
26
|
* - 4 result.status === "failed" — the job reported errors[]
|
|
25
27
|
*/
|
|
26
|
-
import {
|
|
28
|
+
import { readApiToken } from "../lib/read-api-token.mjs";
|
|
27
29
|
|
|
28
30
|
const SUPPORTED_JOBS = new Set(["roadmap_maintenance"]);
|
|
29
31
|
|
|
@@ -53,7 +55,7 @@ export async function run(args, ctx) {
|
|
|
53
55
|
const token = readApiToken();
|
|
54
56
|
if (!token) {
|
|
55
57
|
process.stderr.write(
|
|
56
|
-
"Failed to read daemon API token from the
|
|
58
|
+
"Failed to read the daemon API token from the OS secret store.\n" +
|
|
57
59
|
"Is the daemon initialized? Run `aitne start` once first.\n",
|
|
58
60
|
);
|
|
59
61
|
process.exit(3);
|
|
@@ -125,23 +127,6 @@ function parseArgs(args) {
|
|
|
125
127
|
return opts;
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
function readApiToken() {
|
|
129
|
-
try {
|
|
130
|
-
return execFileSync(
|
|
131
|
-
"security",
|
|
132
|
-
[
|
|
133
|
-
"find-generic-password",
|
|
134
|
-
"-s",
|
|
135
|
-
"com.personal-agent.secret.apiToken",
|
|
136
|
-
"-w",
|
|
137
|
-
],
|
|
138
|
-
{ encoding: "utf-8" },
|
|
139
|
-
).trim();
|
|
140
|
-
} catch {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
130
|
function printSummary(job, result) {
|
|
146
131
|
if (job === "roadmap_maintenance") {
|
|
147
132
|
if (!result || typeof result !== "object") {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for the plain-ESM launcher mirror `ports.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* `ports.mjs` is hand-written JavaScript (it must run before the TypeScript
|
|
5
|
+
* build), so it carries no inferred types. This sidecar lets TypeScript
|
|
6
|
+
* consumers — notably the `packages/shared/src/ports.test.ts` drift guard,
|
|
7
|
+
* which imports this module to assert it stays in lockstep with the TS
|
|
8
|
+
* source-of-truth `packages/shared/src/ports.ts` — typecheck the import under
|
|
9
|
+
* `strict`. Keep these signatures identical to `ports.ts`'s exports (minus
|
|
10
|
+
* `loopbackOrigins`, which is TS-only and not mirrored here).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Daemon HTTP API port. Overridable via `PA_API_PORT`. */
|
|
14
|
+
export const DEFAULT_API_PORT: number;
|
|
15
|
+
|
|
16
|
+
/** Dashboard (Next.js) port. Overridable via `PA_DASHBOARD_PORT`. */
|
|
17
|
+
export const DEFAULT_DASHBOARD_PORT: number;
|
|
18
|
+
|
|
19
|
+
/** Resolve the daemon API port from env, falling back to DEFAULT_API_PORT. */
|
|
20
|
+
export function resolveApiPort(
|
|
21
|
+
env?: Record<string, string | undefined>,
|
|
22
|
+
): number;
|
|
23
|
+
|
|
24
|
+
/** Resolve the dashboard port from env, falling back to DEFAULT_DASHBOARD_PORT. */
|
|
25
|
+
export function resolveDashboardPort(
|
|
26
|
+
env?: Record<string, string | undefined>,
|
|
27
|
+
): number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default network ports for the Aitne daemon API and dashboard.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH (launcher / plain-ESM side). `bin/aitne.mjs` and the
|
|
5
|
+
* `scripts/**` launchers cannot import `@aitne/shared`: they run *before* the
|
|
6
|
+
* TypeScript build that produces it (running `aitne start` is what triggers
|
|
7
|
+
* that build), and the published package ships only `bin` + `scripts/*.mjs` +
|
|
8
|
+
* `agent-assets`, never `packages/`. So the defaults are mirrored here in a
|
|
9
|
+
* build-independent module that lives under the published `scripts/lib/`.
|
|
10
|
+
*
|
|
11
|
+
* The TypeScript mirror lives in `packages/shared/src/ports.ts`. The two are
|
|
12
|
+
* pinned together by `packages/shared/src/ports.test.ts`, which fails CI if
|
|
13
|
+
* the values ever drift. Change a default in BOTH or the test goes red.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Daemon HTTP API port. Overridable via `PA_API_PORT`. */
|
|
17
|
+
export const DEFAULT_API_PORT = 8321;
|
|
18
|
+
|
|
19
|
+
/** Dashboard (Next.js) port. Overridable via `PA_DASHBOARD_PORT`. Not 3000 — that collides with most dev servers. */
|
|
20
|
+
export const DEFAULT_DASHBOARD_PORT = 8322;
|
|
21
|
+
|
|
22
|
+
function parsePort(raw) {
|
|
23
|
+
if (raw == null || raw === "") return null;
|
|
24
|
+
const n = Number.parseInt(raw, 10);
|
|
25
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Resolve the daemon API port from env, falling back to DEFAULT_API_PORT. */
|
|
29
|
+
export function resolveApiPort(env = process.env) {
|
|
30
|
+
return parsePort(env.PA_API_PORT) ?? DEFAULT_API_PORT;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Resolve the dashboard port from env, falling back to DEFAULT_DASHBOARD_PORT. */
|
|
34
|
+
export function resolveDashboardPort(env = process.env) {
|
|
35
|
+
return parsePort(env.PA_DASHBOARD_PORT) ?? DEFAULT_DASHBOARD_PORT;
|
|
36
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for the plain-ESM launcher module `process-identity.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* `process-identity.mjs` is hand-written JavaScript (it must run before the
|
|
5
|
+
* TypeScript build, from `bin/aitne.mjs`), so it carries no inferred types.
|
|
6
|
+
* This sidecar lets the `packages/shared/src/process-identity.test.ts` peer
|
|
7
|
+
* test typecheck the import under `strict`. Mirrors the `ports.d.mts`
|
|
8
|
+
* precedent. Keep these signatures in lockstep with the `.mjs` exports.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** Parsed pidfile contents. `startToken` is null for a legacy (tokenless) file. */
|
|
12
|
+
export interface PidMeta {
|
|
13
|
+
pid: number;
|
|
14
|
+
startToken: string | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Injectable OS shims for {@link readProcessStartToken} (tests only). */
|
|
18
|
+
export interface ReadTokenDeps {
|
|
19
|
+
platform?: NodeJS.Platform;
|
|
20
|
+
execFileSync?: (command: string, args?: readonly string[], options?: unknown) => string | Buffer;
|
|
21
|
+
readFileSync?: (path: string, encoding: string) => string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Liveness + start-time reader injected into {@link classifyPid}. */
|
|
25
|
+
export interface ClassifyDeps {
|
|
26
|
+
readToken: (pid: number) => string | null;
|
|
27
|
+
isAlive: (pid: number) => boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type PidClassification = "stale" | "running-ours" | "running-unverified";
|
|
31
|
+
|
|
32
|
+
export function serializePidMeta(input: { pid: number; startToken?: string | null }): string;
|
|
33
|
+
|
|
34
|
+
export function parsePidMeta(content: string): PidMeta | null;
|
|
35
|
+
|
|
36
|
+
export function parseLinuxStat(statContent: string): string | null;
|
|
37
|
+
|
|
38
|
+
export function readProcessStartToken(
|
|
39
|
+
pid: number | null | undefined,
|
|
40
|
+
deps?: ReadTokenDeps,
|
|
41
|
+
): string | null;
|
|
42
|
+
|
|
43
|
+
export function classifyPid(
|
|
44
|
+
meta: { pid?: number | null; startToken?: string | null } | null | undefined,
|
|
45
|
+
deps: ClassifyDeps,
|
|
46
|
+
): PidClassification;
|