@hivemagnus/ardent 0.0.0-stage → 1.0.2

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.
Files changed (115) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +274 -2
  3. package/dist/a2a-client.d.ts +35 -0
  4. package/dist/a2a-client.js +172 -0
  5. package/dist/a2a-hermes-alias.d.ts +3 -0
  6. package/dist/a2a-hermes-alias.js +57 -0
  7. package/dist/a2a-idempotency.d.ts +13 -0
  8. package/dist/a2a-idempotency.js +86 -0
  9. package/dist/a2a-peers.d.ts +28 -0
  10. package/dist/a2a-peers.js +108 -0
  11. package/dist/a2a-push-inbox.d.ts +22 -0
  12. package/dist/a2a-push-inbox.js +84 -0
  13. package/dist/a2a-push.d.ts +27 -0
  14. package/dist/a2a-push.js +188 -0
  15. package/dist/a2a-server.d.ts +37 -0
  16. package/dist/a2a-server.js +186 -0
  17. package/dist/a2a-store.d.ts +10 -0
  18. package/dist/a2a-store.js +122 -0
  19. package/dist/a2a.d.ts +19 -0
  20. package/dist/a2a.js +466 -0
  21. package/dist/api.d.ts +6 -0
  22. package/dist/api.js +381 -0
  23. package/dist/artifacts.d.ts +15 -0
  24. package/dist/artifacts.js +41 -0
  25. package/dist/backend-events.d.ts +49 -0
  26. package/dist/backend-events.js +8 -0
  27. package/dist/channels.d.ts +52 -0
  28. package/dist/channels.js +184 -0
  29. package/dist/cli.d.ts +2 -0
  30. package/dist/cli.js +845 -0
  31. package/dist/codex-output-budget.d.ts +17 -0
  32. package/dist/codex-output-budget.js +31 -0
  33. package/dist/codex-output-budget.test.d.ts +1 -0
  34. package/dist/codex-output-budget.test.js +29 -0
  35. package/dist/codex.d.ts +82 -0
  36. package/dist/codex.js +431 -0
  37. package/dist/config.d.ts +171 -0
  38. package/dist/config.js +244 -0
  39. package/dist/context-checkpoints.d.ts +49 -0
  40. package/dist/context-checkpoints.js +248 -0
  41. package/dist/context.d.ts +16 -0
  42. package/dist/context.js +101 -0
  43. package/dist/gateway-lock.d.ts +18 -0
  44. package/dist/gateway-lock.js +104 -0
  45. package/dist/hermes-compat.d.ts +15 -0
  46. package/dist/hermes-compat.js +62 -0
  47. package/dist/identity.d.ts +15 -0
  48. package/dist/identity.js +52 -0
  49. package/dist/index.d.ts +9 -0
  50. package/dist/index.js +8 -0
  51. package/dist/job-engine.d.ts +222 -0
  52. package/dist/job-engine.js +497 -0
  53. package/dist/job-news-handlers.d.ts +54 -0
  54. package/dist/job-news-handlers.js +153 -0
  55. package/dist/job-ownership.d.ts +9 -0
  56. package/dist/job-ownership.js +17 -0
  57. package/dist/json-schema.d.ts +9 -0
  58. package/dist/json-schema.js +20 -0
  59. package/dist/llamacpp.d.ts +49 -0
  60. package/dist/llamacpp.js +216 -0
  61. package/dist/magnus-control.d.ts +3 -0
  62. package/dist/magnus-control.js +99 -0
  63. package/dist/magnus-node-dependency-impact.d.ts +1 -0
  64. package/dist/magnus-node-dependency-impact.js +126 -0
  65. package/dist/magnus-owner-reads.d.ts +4 -0
  66. package/dist/magnus-owner-reads.js +99 -0
  67. package/dist/magnus-readiness.d.ts +1 -0
  68. package/dist/magnus-readiness.js +108 -0
  69. package/dist/mattermost.d.ts +18 -0
  70. package/dist/mattermost.js +303 -0
  71. package/dist/memory-tools.d.ts +5 -0
  72. package/dist/memory-tools.js +49 -0
  73. package/dist/memory.d.ts +40 -0
  74. package/dist/memory.js +128 -0
  75. package/dist/model-policy.d.ts +64 -0
  76. package/dist/model-policy.js +56 -0
  77. package/dist/news.d.ts +10 -0
  78. package/dist/news.js +291 -0
  79. package/dist/owner-read.d.ts +32 -0
  80. package/dist/owner-read.js +130 -0
  81. package/dist/plugins.d.ts +74 -0
  82. package/dist/plugins.js +115 -0
  83. package/dist/research.d.ts +110 -0
  84. package/dist/research.js +164 -0
  85. package/dist/runtime.d.ts +33 -0
  86. package/dist/runtime.js +665 -0
  87. package/dist/skills.d.ts +13 -0
  88. package/dist/skills.js +87 -0
  89. package/dist/store.d.ts +142 -0
  90. package/dist/store.js +322 -0
  91. package/dist/team-artifacts.d.ts +138 -0
  92. package/dist/team-artifacts.js +241 -0
  93. package/dist/team-child.d.ts +21 -0
  94. package/dist/team-child.js +130 -0
  95. package/dist/team-contract.d.ts +116 -0
  96. package/dist/team-contract.js +84 -0
  97. package/dist/team-control.d.ts +8 -0
  98. package/dist/team-control.js +152 -0
  99. package/dist/telegram.d.ts +35 -0
  100. package/dist/telegram.js +284 -0
  101. package/dist/tools.d.ts +48 -0
  102. package/dist/tools.js +58 -0
  103. package/dist/version.d.ts +1 -0
  104. package/dist/version.js +5 -0
  105. package/model-policy.default.json +20 -0
  106. package/package.json +84 -4
  107. package/profiles/assistant/IDENTITY.md +9 -0
  108. package/profiles/assistant/SOUL.md +8 -0
  109. package/profiles/assistant/config.yaml +88 -0
  110. package/profiles/assistant/peers.yaml +12 -0
  111. package/profiles/assistant/skills/grounded-answers/SKILL.md +18 -0
  112. package/protocol/LICENSE-A2A.txt +202 -0
  113. package/protocol/README.md +12 -0
  114. package/protocol/a2a.proto +811 -0
  115. package/protocol/lock.json +9 -0
@@ -0,0 +1,9 @@
1
+ export { ArdentRuntime, type RunResult } from './runtime.js';
2
+ export { ConfigSchema, loadConfig, initProfile, saveConfig, profilePath, parseConfig, runtimeProblems, type ArdentConfig, type LoadedConfig } from './config.js';
3
+ export { ResearchBriefSchema } from './research.js';
4
+ export { TaskStore, type Task } from './store.js';
5
+ export { defineTool, ToolRegistry, ProvenNoEffectError, type Tool, type ToolContext, type ToolEffect, type ToolResult } from './tools.js';
6
+ export { createArdentApi, ardentOpenApi } from './api.js';
7
+ export { JobEngine, validateJobDefinitions, type JobContext, type JobDefinition, type JobHandler, type JobRegistry, type JobResult, type OwnershipCheck } from './job-engine.js';
8
+ export { definePlugin, registerPlugin, registeredPlugins, clearRegisteredPlugins, loadPlugins, type ArdentPlugin, type ArdentPluginContext, type ArdentCliCommand, type ArdentCliInvocation } from './plugins.js';
9
+ export type { TeamEnvelope, TeamMission, TeamResult } from './team-contract.js';
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export { ArdentRuntime } from './runtime.js';
2
+ export { ConfigSchema, loadConfig, initProfile, saveConfig, profilePath, parseConfig, runtimeProblems } from './config.js';
3
+ export { ResearchBriefSchema } from './research.js';
4
+ export { TaskStore } from './store.js';
5
+ export { defineTool, ToolRegistry, ProvenNoEffectError } from './tools.js';
6
+ export { createArdentApi, ardentOpenApi } from './api.js';
7
+ export { JobEngine, validateJobDefinitions } from './job-engine.js';
8
+ export { definePlugin, registerPlugin, registeredPlugins, clearRegisteredPlugins, loadPlugins } from './plugins.js';
@@ -0,0 +1,222 @@
1
+ import type Database from 'better-sqlite3';
2
+ import { z } from 'zod';
3
+ declare const definition: z.ZodObject<{
4
+ id: z.ZodString;
5
+ owner: z.ZodEnum<{
6
+ external: "external";
7
+ ardent: "ardent";
8
+ }>;
9
+ enabled: z.ZodBoolean;
10
+ handler: z.ZodString;
11
+ schedule: z.ZodUnion<readonly [z.ZodObject<{
12
+ cron: z.ZodString;
13
+ timezone: z.ZodString;
14
+ missed_window: z.ZodEnum<{
15
+ skip: "skip";
16
+ catch_up: "catch_up";
17
+ }>;
18
+ catch_up_minutes: z.ZodNumber;
19
+ }, z.core.$strict>, z.ZodObject<{
20
+ kind: z.ZodLiteral<"interval">;
21
+ every_minutes: z.ZodNumber;
22
+ anchor_at: z.ZodString;
23
+ }, z.core.$strict>]>;
24
+ input: z.ZodOptional<z.ZodUnknown>;
25
+ delivery: z.ZodObject<{
26
+ kind: z.ZodEnum<{
27
+ none: "none";
28
+ telegram: "telegram";
29
+ mattermost: "mattermost";
30
+ }>;
31
+ target_ref: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strict>;
33
+ policy: z.ZodObject<{
34
+ max_attempts: z.ZodNumber;
35
+ retry_backoff_seconds: z.ZodNumber;
36
+ }, z.core.$strict>;
37
+ }, z.core.$strict>;
38
+ export declare const JobDefinitionSchema: z.ZodObject<{
39
+ id: z.ZodString;
40
+ owner: z.ZodEnum<{
41
+ external: "external";
42
+ ardent: "ardent";
43
+ }>;
44
+ enabled: z.ZodBoolean;
45
+ handler: z.ZodString;
46
+ schedule: z.ZodUnion<readonly [z.ZodObject<{
47
+ cron: z.ZodString;
48
+ timezone: z.ZodString;
49
+ missed_window: z.ZodEnum<{
50
+ skip: "skip";
51
+ catch_up: "catch_up";
52
+ }>;
53
+ catch_up_minutes: z.ZodNumber;
54
+ }, z.core.$strict>, z.ZodObject<{
55
+ kind: z.ZodLiteral<"interval">;
56
+ every_minutes: z.ZodNumber;
57
+ anchor_at: z.ZodString;
58
+ }, z.core.$strict>]>;
59
+ input: z.ZodOptional<z.ZodUnknown>;
60
+ delivery: z.ZodObject<{
61
+ kind: z.ZodEnum<{
62
+ none: "none";
63
+ telegram: "telegram";
64
+ mattermost: "mattermost";
65
+ }>;
66
+ target_ref: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strict>;
68
+ policy: z.ZodObject<{
69
+ max_attempts: z.ZodNumber;
70
+ retry_backoff_seconds: z.ZodNumber;
71
+ }, z.core.$strict>;
72
+ }, z.core.$strict>;
73
+ export type JobDefinition = z.infer<typeof definition>;
74
+ export declare const JobDefinitionsSchema: z.ZodObject<{
75
+ schema_version: z.ZodLiteral<1>;
76
+ profile: z.ZodString;
77
+ revision: z.ZodNumber;
78
+ jobs: z.ZodArray<z.ZodObject<{
79
+ id: z.ZodString;
80
+ owner: z.ZodEnum<{
81
+ external: "external";
82
+ ardent: "ardent";
83
+ }>;
84
+ enabled: z.ZodBoolean;
85
+ handler: z.ZodString;
86
+ schedule: z.ZodUnion<readonly [z.ZodObject<{
87
+ cron: z.ZodString;
88
+ timezone: z.ZodString;
89
+ missed_window: z.ZodEnum<{
90
+ skip: "skip";
91
+ catch_up: "catch_up";
92
+ }>;
93
+ catch_up_minutes: z.ZodNumber;
94
+ }, z.core.$strict>, z.ZodObject<{
95
+ kind: z.ZodLiteral<"interval">;
96
+ every_minutes: z.ZodNumber;
97
+ anchor_at: z.ZodString;
98
+ }, z.core.$strict>]>;
99
+ input: z.ZodOptional<z.ZodUnknown>;
100
+ delivery: z.ZodObject<{
101
+ kind: z.ZodEnum<{
102
+ none: "none";
103
+ telegram: "telegram";
104
+ mattermost: "mattermost";
105
+ }>;
106
+ target_ref: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$strict>;
108
+ policy: z.ZodObject<{
109
+ max_attempts: z.ZodNumber;
110
+ retry_backoff_seconds: z.ZodNumber;
111
+ }, z.core.$strict>;
112
+ }, z.core.$strict>>;
113
+ }, z.core.$strict>;
114
+ export type JobDefinitions = z.infer<typeof JobDefinitionsSchema>;
115
+ export type JobReceipt = {
116
+ effect_status: 'none' | 'confirmed' | 'unknown';
117
+ evidence?: unknown;
118
+ };
119
+ export type JobResult = {
120
+ state: 'completed' | 'retry' | 'failed' | 'unknown';
121
+ receipt: JobReceipt;
122
+ };
123
+ export type JobContext = {
124
+ job: JobDefinition;
125
+ input: unknown;
126
+ window_key: string;
127
+ scheduled_at: Date;
128
+ now: Date;
129
+ attempt: number;
130
+ signal: AbortSignal;
131
+ /** Aborts when the scheduler stops admitting work; a handler must not claim new delivery rows after it fires. */
132
+ stopping?: AbortSignal;
133
+ };
134
+ export type JobHandler = {
135
+ input: z.ZodType<unknown>;
136
+ delivery?: z.ZodType<unknown>;
137
+ effect: 'none' | 'external';
138
+ run(ctx: JobContext): Promise<JobResult>;
139
+ };
140
+ export type JobRegistry = Record<string, JobHandler>;
141
+ export type OwnershipCheck = (job: JobDefinition, now: Date) => Promise<void>;
142
+ declare const rowSchema: z.ZodObject<{
143
+ window_key: z.ZodString;
144
+ job_id: z.ZodString;
145
+ local_key: z.ZodString;
146
+ scheduled_ms: z.ZodNumber;
147
+ definition_revision: z.ZodNumber;
148
+ definition_sha256: z.ZodString;
149
+ state: z.ZodEnum<{
150
+ unknown: "unknown";
151
+ queued: "queued";
152
+ failed: "failed";
153
+ completed: "completed";
154
+ running: "running";
155
+ retry: "retry";
156
+ superseded: "superseded";
157
+ }>;
158
+ attempts: z.ZodNumber;
159
+ next_attempt_ms: z.ZodNumber;
160
+ receipt_json: z.ZodNullable<z.ZodString>;
161
+ receipt_sha256: z.ZodNullable<z.ZodString>;
162
+ error: z.ZodNullable<z.ZodString>;
163
+ updated_ms: z.ZodNumber;
164
+ }, z.core.$strip>;
165
+ export type JobWindow = z.infer<typeof rowSchema>;
166
+ export type JobWindowStatus = Omit<JobWindow, 'receipt_json' | 'error'> & {
167
+ error: string | null;
168
+ };
169
+ /** Validates all data before it can be selected. Definitions are data, never executable code. */
170
+ export declare function validateJobDefinitions(raw: unknown, registry: JobRegistry, expectedProfile?: string): {
171
+ definitions: JobDefinitions;
172
+ sha256: string;
173
+ job_count: number;
174
+ };
175
+ /** A profile-local SQLite scheduler. No work is admitted without a fresh ownership check. */
176
+ export declare class JobEngine {
177
+ #private;
178
+ readonly db: Database.Database;
179
+ readonly profileDir: string;
180
+ readonly profile: string;
181
+ readonly registry: JobRegistry;
182
+ readonly ownershipCheck: OwnershipCheck;
183
+ readonly clock: () => number;
184
+ /** `clock` measures elapsed time within a tick; the injected tick time stays the timeline origin. */
185
+ constructor(db: Database.Database, profileDir: string, profile: string, registry: JobRegistry, ownershipCheck: OwnershipCheck, clock?: () => number);
186
+ load(): Promise<{
187
+ definitions: JobDefinitions;
188
+ sha256: string;
189
+ job_count: number;
190
+ }>;
191
+ recover(now?: Date): number;
192
+ /** Startup reconciliation requires the gateway's exclusive profile lock. */
193
+ recoverAfterRestart(now?: Date): Promise<number>;
194
+ status(limit?: number, now?: Date): Promise<{
195
+ active_revision: number | null;
196
+ active_sha256: string | null;
197
+ last_validation_error: string | null;
198
+ active_jobs: number;
199
+ unknown_jobs: number;
200
+ counts: Record<string, number>;
201
+ jobs: Array<{
202
+ job_id: string;
203
+ next_window: string | null;
204
+ last_window: string | null;
205
+ counts: Record<string, number>;
206
+ }>;
207
+ windows: JobWindowStatus[];
208
+ }>;
209
+ /**
210
+ * `now` selects which windows are due. Ownership checks, claims, receipts and
211
+ * retry backoff use a fresh instant on the same timeline. `signal` aborts
212
+ * running handlers; `stopping` only prevents new claims.
213
+ */
214
+ tick(now?: Date, signal?: AbortSignal, stopping?: AbortSignal): Promise<{
215
+ scanned: number;
216
+ claimed: number;
217
+ completed: number;
218
+ retry: number;
219
+ unknown: number;
220
+ }>;
221
+ }
222
+ export {};