@holon-run/agentinbox 0.1.4 → 0.2.0

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.
@@ -0,0 +1,45 @@
1
+ create table subscriptions__new (
2
+ subscription_id text primary key,
3
+ agent_id text not null,
4
+ source_id text not null,
5
+ filter_json text not null,
6
+ tracked_resource_ref text,
7
+ cleanup_policy_json text not null,
8
+ start_policy text not null,
9
+ start_offset integer,
10
+ start_time text,
11
+ created_at text not null
12
+ );
13
+
14
+ insert into subscriptions__new (
15
+ subscription_id,
16
+ agent_id,
17
+ source_id,
18
+ filter_json,
19
+ tracked_resource_ref,
20
+ cleanup_policy_json,
21
+ start_policy,
22
+ start_offset,
23
+ start_time,
24
+ created_at
25
+ )
26
+ select
27
+ subscription_id,
28
+ agent_id,
29
+ source_id,
30
+ filter_json,
31
+ null as tracked_resource_ref,
32
+ case
33
+ when expires_at is not null then json_object('mode', 'at', 'at', expires_at)
34
+ when lifecycle_mode = 'temporary' then json_object('mode', 'manual')
35
+ else json_object('mode', 'manual')
36
+ end as cleanup_policy_json,
37
+ start_policy,
38
+ start_offset,
39
+ start_time,
40
+ created_at
41
+ from subscriptions;
42
+
43
+ drop table subscriptions;
44
+
45
+ alter table subscriptions__new rename to subscriptions;
@@ -0,0 +1,14 @@
1
+ create table if not exists subscription_lifecycle_retirements (
2
+ subscription_id text primary key,
3
+ source_id text not null,
4
+ tracked_resource_ref text not null,
5
+ retire_at text not null,
6
+ terminal_state text,
7
+ terminal_result text,
8
+ terminal_occurred_at text,
9
+ created_at text not null,
10
+ updated_at text not null
11
+ );
12
+
13
+ create index if not exists idx_subscription_lifecycle_retirements_retire_at
14
+ on subscription_lifecycle_retirements(retire_at);
@@ -0,0 +1,10 @@
1
+ create table if not exists source_idle_states (
2
+ source_id text primary key not null,
3
+ idle_since text not null,
4
+ auto_pause_at text not null,
5
+ auto_paused_at text,
6
+ updated_at text not null
7
+ );
8
+
9
+ create index if not exists idx_source_idle_states_auto_pause_at
10
+ on source_idle_states(auto_pause_at);
package/drizzle/schema.ts CHANGED
@@ -14,6 +14,16 @@ export const sources = sqliteTable("sources", {
14
14
  sourceTypeKey: uniqueIndex("idx_sources_type_key").on(table.sourceType, table.sourceKey),
15
15
  }));
16
16
 
17
+ export const sourceIdleStates = sqliteTable("source_idle_states", {
18
+ sourceId: text("source_id").primaryKey(),
19
+ idleSince: text("idle_since").notNull(),
20
+ autoPauseAt: text("auto_pause_at").notNull(),
21
+ autoPausedAt: text("auto_paused_at"),
22
+ updatedAt: text("updated_at").notNull(),
23
+ }, (table) => ({
24
+ autoPauseAtIdx: index("idx_source_idle_states_auto_pause_at").on(table.autoPauseAt),
25
+ }));
26
+
17
27
  export const agents = sqliteTable("agents", {
18
28
  agentId: text("agent_id").primaryKey(),
19
29
  status: text("status").notNull(),
@@ -40,14 +50,26 @@ export const subscriptions = sqliteTable("subscriptions", {
40
50
  agentId: text("agent_id").notNull(),
41
51
  sourceId: text("source_id").notNull(),
42
52
  filterJson: text("filter_json").notNull(),
43
- lifecycleMode: text("lifecycle_mode").notNull(),
44
- expiresAt: text("expires_at"),
53
+ trackedResourceRef: text("tracked_resource_ref"),
54
+ cleanupPolicyJson: text("cleanup_policy_json").notNull(),
45
55
  startPolicy: text("start_policy").notNull(),
46
56
  startOffset: integer("start_offset"),
47
57
  startTime: text("start_time"),
48
58
  createdAt: text("created_at").notNull(),
49
59
  });
50
60
 
61
+ export const subscriptionLifecycleRetirements = sqliteTable("subscription_lifecycle_retirements", {
62
+ subscriptionId: text("subscription_id").primaryKey(),
63
+ sourceId: text("source_id").notNull(),
64
+ trackedResourceRef: text("tracked_resource_ref").notNull(),
65
+ retireAt: text("retire_at").notNull(),
66
+ terminalState: text("terminal_state"),
67
+ terminalResult: text("terminal_result"),
68
+ terminalOccurredAt: text("terminal_occurred_at"),
69
+ createdAt: text("created_at").notNull(),
70
+ updatedAt: text("updated_at").notNull(),
71
+ });
72
+
51
73
  export const activationTargets = sqliteTable("activation_targets", {
52
74
  targetId: text("target_id").primaryKey(),
53
75
  agentId: text("agent_id").notNull(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holon-run/agentinbox",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Local event subscription and delivery service for agents.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {