@howaboua/pi-durable-pulses 0.9.1 → 0.10.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.
- package/README.md +1 -1
- package/dist/activation.d.ts +5 -0
- package/dist/activation.js +1255 -0
- package/dist/contract.d.ts +9 -42
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4 -1
- package/dist/schedule.d.ts +2 -22
- package/package.json +24 -3
package/dist/contract.d.ts
CHANGED
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
import type { Context } from "@earendil-works/chord";
|
|
2
2
|
import type { ConversationId, SettledSubmissionRecord, TaskId, ToolExecutionApi, Tx } from "@earendil-works/pi-durable";
|
|
3
|
+
import type { ScheduledAdmissionDecision, ScheduledInput, ScheduledOccurrence, ScheduledResult, ScheduledSource, ScheduledTrigger, SchedulingBinding } from "@howaboua/pi-durable-components";
|
|
3
4
|
import type { PulseDefinition } from "./definitions.ts";
|
|
4
|
-
export type PulseBinding =
|
|
5
|
-
|
|
6
|
-
root: string;
|
|
7
|
-
parentConversationId?: ConversationId;
|
|
8
|
-
};
|
|
9
|
-
export type PulseSource = {
|
|
10
|
-
id: string;
|
|
11
|
-
text: string;
|
|
12
|
-
error?: string;
|
|
13
|
-
};
|
|
5
|
+
export type PulseBinding = SchedulingBinding;
|
|
6
|
+
export type PulseSource = ScheduledSource;
|
|
14
7
|
export type PulseRunRequest = {
|
|
15
8
|
bindingKey: string;
|
|
16
9
|
pulseId: string;
|
|
17
10
|
requestId: string;
|
|
18
11
|
};
|
|
19
|
-
export type PulseTrigger =
|
|
20
|
-
export type PulseOccurrence =
|
|
21
|
-
count: number;
|
|
22
|
-
startAt: number;
|
|
23
|
-
endAt: number;
|
|
24
|
-
};
|
|
12
|
+
export type PulseTrigger = ScheduledTrigger;
|
|
13
|
+
export type PulseOccurrence = ScheduledOccurrence;
|
|
25
14
|
export type PulseAdmission = {
|
|
26
15
|
binding: PulseBinding;
|
|
27
16
|
definition: PulseDefinition;
|
|
@@ -31,33 +20,11 @@ export type PulseAdmission = {
|
|
|
31
20
|
conversationId: ConversationId;
|
|
32
21
|
occurrence?: PulseOccurrence;
|
|
33
22
|
};
|
|
34
|
-
export type PulseAdmissionDecision =
|
|
35
|
-
|
|
36
|
-
} | {
|
|
37
|
-
status: "blocked";
|
|
38
|
-
reason: string;
|
|
39
|
-
retryAt?: number;
|
|
40
|
-
};
|
|
41
|
-
export type PulseInputDelivery = {
|
|
42
|
-
conversationId: ConversationId;
|
|
43
|
-
taskId: TaskId;
|
|
44
|
-
requestId: string;
|
|
45
|
-
content: string;
|
|
46
|
-
};
|
|
23
|
+
export type PulseAdmissionDecision = ScheduledAdmissionDecision;
|
|
24
|
+
export type PulseInputDelivery = ScheduledInput;
|
|
47
25
|
/** The abort-before-dispatch case has a native task outcome but no submission receipt. */
|
|
48
|
-
export type PulseOutcome =
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
export type PulseResultDelivery = {
|
|
52
|
-
parentConversationId: ConversationId;
|
|
53
|
-
conversationId: ConversationId;
|
|
54
|
-
taskId: TaskId;
|
|
55
|
-
outcome: PulseOutcome;
|
|
56
|
-
requestId: string;
|
|
57
|
-
title: string;
|
|
58
|
-
text: string;
|
|
59
|
-
occurrence?: PulseOccurrence;
|
|
60
|
-
};
|
|
26
|
+
export type PulseOutcome = ScheduledResult["outcome"];
|
|
27
|
+
export type PulseResultDelivery = ScheduledResult;
|
|
61
28
|
export interface PulsesOptions {
|
|
62
29
|
/** Resolve the caller's authorised binding in api.env. Never infer from global bindings or host paths. */
|
|
63
30
|
resolveToolBinding?(api: ToolExecutionApi, context: Context): Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -125,6 +125,8 @@ export declare function createPulses(options: PulsesOptions): {
|
|
|
125
125
|
pulseId: string;
|
|
126
126
|
}, context: Context): Promise<void>;
|
|
127
127
|
bind(value: Harness, context: Context): Promise<void>;
|
|
128
|
-
/** Stop
|
|
128
|
+
/** Stop new admissions and drain admission work while task bindings remain available. */
|
|
129
|
+
stopAdmission(): Promise<void>;
|
|
130
|
+
/** Release only after the host has drained/closed native task invocations. */
|
|
129
131
|
unbind(): Promise<void>;
|
|
130
132
|
};
|
package/dist/index.js
CHANGED
|
@@ -1178,7 +1178,7 @@ function createPulses(options) {
|
|
|
1178
1178
|
bindingFlight.catch(options.onError);
|
|
1179
1179
|
return bindingFlight;
|
|
1180
1180
|
},
|
|
1181
|
-
async
|
|
1181
|
+
async stopAdmission() {
|
|
1182
1182
|
accepting = false;
|
|
1183
1183
|
unsubscribeClose?.();
|
|
1184
1184
|
unsubscribeClose = undefined;
|
|
@@ -1190,6 +1190,9 @@ function createPulses(options) {
|
|
|
1190
1190
|
await pending;
|
|
1191
1191
|
if (bindingFlight)
|
|
1192
1192
|
await bindingFlight.catch(() => {});
|
|
1193
|
+
},
|
|
1194
|
+
async unbind() {
|
|
1195
|
+
await component.stopAdmission();
|
|
1193
1196
|
bindingFlight = undefined;
|
|
1194
1197
|
harness = undefined;
|
|
1195
1198
|
}
|
package/dist/schedule.d.ts
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
export type PulseSchedule
|
|
2
|
-
|
|
3
|
-
} | {
|
|
4
|
-
kind: "interval";
|
|
5
|
-
everyMs: number;
|
|
6
|
-
} | {
|
|
7
|
-
kind: "daily";
|
|
8
|
-
hour: number;
|
|
9
|
-
minute: number;
|
|
10
|
-
} | {
|
|
11
|
-
kind: "weekly";
|
|
12
|
-
day: number;
|
|
13
|
-
hour: number;
|
|
14
|
-
minute: number;
|
|
15
|
-
} | {
|
|
16
|
-
kind: "at";
|
|
17
|
-
atMs: number;
|
|
18
|
-
};
|
|
19
|
-
export type PulseQuietHours = {
|
|
20
|
-
startMinute: number;
|
|
21
|
-
endMinute: number;
|
|
22
|
-
};
|
|
1
|
+
export type { ScheduledQuietHours as PulseQuietHours, ScheduledTiming as PulseSchedule, } from "@howaboua/pi-durable-components";
|
|
2
|
+
import type { ScheduledQuietHours as PulseQuietHours, ScheduledTiming as PulseSchedule } from "@howaboua/pi-durable-components";
|
|
23
3
|
export declare function parsePulseQuietHours(raw: string): PulseQuietHours | null;
|
|
24
4
|
export declare function isPulseQuietAt(quietHours: PulseQuietHours, nowMs: number): boolean;
|
|
25
5
|
export declare function parsePulseSchedule(raw: string): PulseSchedule | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@howaboua/pi-durable-pulses",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Persistent native scheduled pulse conversations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
".": {
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"import": "./dist/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./component": {
|
|
24
|
+
"types": "./dist/activation.d.ts",
|
|
25
|
+
"import": "./dist/activation.js"
|
|
22
26
|
}
|
|
23
27
|
},
|
|
24
28
|
"files": [
|
|
@@ -30,15 +34,32 @@
|
|
|
30
34
|
],
|
|
31
35
|
"sideEffects": false,
|
|
32
36
|
"dependencies": {
|
|
33
|
-
"typebox": "1.3.27"
|
|
37
|
+
"typebox": "1.3.27",
|
|
38
|
+
"@howaboua/pi-durable-components": "0.10.0"
|
|
34
39
|
},
|
|
35
40
|
"peerDependencies": {
|
|
36
41
|
"@earendil-works/chord": "1.4.0",
|
|
37
42
|
"@earendil-works/pi-ai": "1.4.0",
|
|
38
43
|
"@earendil-works/pi-durable": "1.4.0",
|
|
39
|
-
"@modelcontextprotocol/sdk": "1.25.2"
|
|
44
|
+
"@modelcontextprotocol/sdk": ">=1.25.2 <2"
|
|
40
45
|
},
|
|
41
46
|
"publishConfig": {
|
|
42
47
|
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"durable": {
|
|
50
|
+
"schemaVersion": 1,
|
|
51
|
+
"kind": "extension",
|
|
52
|
+
"entry": "./component",
|
|
53
|
+
"runtimes": [
|
|
54
|
+
"node"
|
|
55
|
+
],
|
|
56
|
+
"requires": [
|
|
57
|
+
"durable.scheduling.v1"
|
|
58
|
+
],
|
|
59
|
+
"permissions": [
|
|
60
|
+
"storage",
|
|
61
|
+
"filesystem",
|
|
62
|
+
"models"
|
|
63
|
+
]
|
|
43
64
|
}
|
|
44
65
|
}
|