@ericsanchezok/synergy-plugin-light-loop 0.0.0-stage → 3.1.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/AGENTS.md +9 -0
- package/dist/adapter.js +38 -0
- package/dist/component.js +16 -0
- package/dist/features.js +4 -0
- package/dist/register.js +8 -0
- package/dist/worker.js +6 -0
- package/package.json +68 -4
- package/src/adapter.ts +42 -0
- package/src/component.ts +17 -0
- package/src/features.ts +4 -0
- package/src/register.ts +8 -0
- package/src/worker.ts +6 -0
- package/README.md +0 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# plugin-light-loop Package
|
|
2
|
+
|
|
3
|
+
Plugin Host Light Loop services and terminal observer delivery. Required components: Plugin Host and Light Loop. See [owning architecture](../../docs/architecture/workflows.md).
|
|
4
|
+
|
|
5
|
+
Preserve generation checks and retryable terminal acknowledgments. Light Loop does not depend on Plugin Host.
|
|
6
|
+
|
|
7
|
+
Expose selection through `./component`; imports are inert. Keep factory requirements, published `synergy` metadata, worker roles and production dependencies aligned. Register owner schemas, events, tools and HTTP features before Runtime composition closes.
|
|
8
|
+
|
|
9
|
+
Tests under `test/` select this owner and its real requirements. Run `bun run typecheck` and focused `bun test test/<file>.test.ts` with the package preload; then run the root dependency and installed-composition checks.
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Session } from "@ericsanchezok/synergy-harness/session";
|
|
2
|
+
import { WorkflowSessionService } from "@ericsanchezok/synergy-light-loop/session/workflow";
|
|
3
|
+
import { LightLoopRuntime } from "@ericsanchezok/synergy-light-loop/light-loop/runtime";
|
|
4
|
+
import { LightLoopTerminalStore } from "@ericsanchezok/synergy-light-loop/light-loop/terminal-hook";
|
|
5
|
+
export const lightLoopPluginAdapter = {
|
|
6
|
+
async start(sessionID, input) {
|
|
7
|
+
await WorkflowSessionService.startLightloop(sessionID, input.instructions);
|
|
8
|
+
await Session.update(sessionID, (draft) => {
|
|
9
|
+
if (draft.workflow?.kind !== "lightloop")
|
|
10
|
+
return;
|
|
11
|
+
draft.workflow = { ...draft.workflow, ...input };
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
async clear(sessionID) {
|
|
15
|
+
await Session.update(sessionID, (draft) => {
|
|
16
|
+
draft.workflow = undefined;
|
|
17
|
+
draft.time.archived = Date.now();
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
getActive(session) {
|
|
21
|
+
const workflow = session.workflow?.kind === "lightloop" ? session.workflow : undefined;
|
|
22
|
+
if (!workflow)
|
|
23
|
+
return undefined;
|
|
24
|
+
return {
|
|
25
|
+
instructions: workflow.instructions,
|
|
26
|
+
pluginOwner: workflow.pluginOwner,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
scheduleDeadline(sessionID, deadlineAt) {
|
|
30
|
+
LightLoopRuntime.scheduleDeadline(sessionID, deadlineAt);
|
|
31
|
+
},
|
|
32
|
+
setTerminalStatus(sessionID, status, error) {
|
|
33
|
+
return LightLoopRuntime.setTerminalStatus(sessionID, status, error);
|
|
34
|
+
},
|
|
35
|
+
getTerminal(session) {
|
|
36
|
+
return LightLoopTerminalStore.get(session);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { componentFeatures } from "./features.js";
|
|
2
|
+
import { version } from "../package.json" with { type: "json" };
|
|
3
|
+
import { registerBridge } from "./register.js";
|
|
4
|
+
export function pluginLightLoop() {
|
|
5
|
+
return {
|
|
6
|
+
id: "plugin-light-loop",
|
|
7
|
+
features: componentFeatures,
|
|
8
|
+
apiVersion: 1,
|
|
9
|
+
version,
|
|
10
|
+
requires: { "plugin-host": version, "light-loop": version },
|
|
11
|
+
workers: { agent: new URL("./worker.js", import.meta.url) },
|
|
12
|
+
register() {
|
|
13
|
+
registerBridge();
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
package/dist/features.js
ADDED
package/dist/register.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from "@ericsanchezok/synergy-plugin-host/plugin";
|
|
2
|
+
import { registerPluginLightLoopAdapter } from "@ericsanchezok/synergy-plugin-host/plugin/host-services";
|
|
3
|
+
import { setTerminalHookDeliverer } from "@ericsanchezok/synergy-light-loop/light-loop/runtime";
|
|
4
|
+
import { lightLoopPluginAdapter } from "./adapter.js";
|
|
5
|
+
export function registerBridge() {
|
|
6
|
+
setTerminalHookDeliverer((...args) => Plugin.deliverHookForPlugin(...args));
|
|
7
|
+
registerPluginLightLoopAdapter(lightLoopPluginAdapter);
|
|
8
|
+
}
|
package/dist/worker.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ericsanchezok/synergy-plugin-light-loop",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"exports": {
|
|
7
|
+
"./adapter": {
|
|
8
|
+
"types": "./src/adapter.ts",
|
|
9
|
+
"bun": "./dist/adapter.js",
|
|
10
|
+
"import": "./dist/adapter.js"
|
|
11
|
+
},
|
|
12
|
+
"./component": {
|
|
13
|
+
"types": "./src/component.ts",
|
|
14
|
+
"bun": "./dist/component.js",
|
|
15
|
+
"import": "./dist/component.js"
|
|
16
|
+
},
|
|
17
|
+
"./register": {
|
|
18
|
+
"types": "./src/register.ts",
|
|
19
|
+
"bun": "./dist/register.js",
|
|
20
|
+
"import": "./dist/register.js"
|
|
21
|
+
},
|
|
22
|
+
"./worker": {
|
|
23
|
+
"types": "./src/worker.ts",
|
|
24
|
+
"bun": "./dist/worker.js",
|
|
25
|
+
"import": "./dist/worker.js"
|
|
26
|
+
},
|
|
27
|
+
"./features": {
|
|
28
|
+
"types": "./src/features.ts",
|
|
29
|
+
"bun": "./dist/features.js",
|
|
30
|
+
"import": "./dist/features.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@ericsanchezok/synergy-harness": "3.1.0",
|
|
35
|
+
"@ericsanchezok/synergy-light-loop": "3.1.0",
|
|
36
|
+
"@ericsanchezok/synergy-plugin-host": "3.1.0"
|
|
37
|
+
},
|
|
38
|
+
"synergy": {
|
|
39
|
+
"formatVersion": 1,
|
|
40
|
+
"kind": "component",
|
|
41
|
+
"id": "plugin-light-loop",
|
|
42
|
+
"version": "3.1.0",
|
|
43
|
+
"compatibility": {
|
|
44
|
+
"synergy": "3.1.0"
|
|
45
|
+
},
|
|
46
|
+
"apiVersion": 1,
|
|
47
|
+
"entry": "./dist/component.js",
|
|
48
|
+
"export": "pluginLightLoop",
|
|
49
|
+
"requires": {
|
|
50
|
+
"plugin-host": "3.1.0",
|
|
51
|
+
"light-loop": "3.1.0"
|
|
52
|
+
},
|
|
53
|
+
"packages": {
|
|
54
|
+
"@ericsanchezok/synergy-light-loop": "3.1.0"
|
|
55
|
+
},
|
|
56
|
+
"features": {
|
|
57
|
+
"kind": "bridge",
|
|
58
|
+
"definitions": []
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"files": [
|
|
62
|
+
"src",
|
|
63
|
+
"dist",
|
|
64
|
+
"README.md",
|
|
65
|
+
"AGENTS.md"
|
|
66
|
+
],
|
|
67
|
+
"engines": {
|
|
68
|
+
"bun": ">=1.4.3"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/src/adapter.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PluginLightLoopAdapter } from "@ericsanchezok/synergy-plugin-host/plugin/host-services"
|
|
2
|
+
import { Session } from "@ericsanchezok/synergy-harness/session"
|
|
3
|
+
import { WorkflowSessionService } from "@ericsanchezok/synergy-light-loop/session/workflow"
|
|
4
|
+
import { LightLoopRuntime } from "@ericsanchezok/synergy-light-loop/light-loop/runtime"
|
|
5
|
+
import { LightLoopTerminalStore } from "@ericsanchezok/synergy-light-loop/light-loop/terminal-hook"
|
|
6
|
+
|
|
7
|
+
export const lightLoopPluginAdapter: PluginLightLoopAdapter = {
|
|
8
|
+
async start(sessionID, input) {
|
|
9
|
+
await WorkflowSessionService.startLightloop(sessionID, input.instructions)
|
|
10
|
+
await Session.update(sessionID, (draft) => {
|
|
11
|
+
if (draft.workflow?.kind !== "lightloop") return
|
|
12
|
+
draft.workflow = { ...draft.workflow, ...input }
|
|
13
|
+
})
|
|
14
|
+
},
|
|
15
|
+
async clear(sessionID) {
|
|
16
|
+
await Session.update(sessionID, (draft) => {
|
|
17
|
+
draft.workflow = undefined
|
|
18
|
+
draft.time.archived = Date.now()
|
|
19
|
+
})
|
|
20
|
+
},
|
|
21
|
+
getActive(session) {
|
|
22
|
+
const workflow = session.workflow?.kind === "lightloop" ? session.workflow : undefined
|
|
23
|
+
if (!workflow) return undefined
|
|
24
|
+
return {
|
|
25
|
+
instructions: workflow.instructions,
|
|
26
|
+
pluginOwner: workflow.pluginOwner,
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
scheduleDeadline(sessionID: string, deadlineAt: number) {
|
|
30
|
+
LightLoopRuntime.scheduleDeadline(sessionID, deadlineAt)
|
|
31
|
+
},
|
|
32
|
+
setTerminalStatus(
|
|
33
|
+
sessionID: string,
|
|
34
|
+
status: Parameters<typeof LightLoopRuntime.setTerminalStatus>[1],
|
|
35
|
+
error?: string,
|
|
36
|
+
) {
|
|
37
|
+
return LightLoopRuntime.setTerminalStatus(sessionID, status, error)
|
|
38
|
+
},
|
|
39
|
+
getTerminal(session: Parameters<typeof LightLoopTerminalStore.get>[0]) {
|
|
40
|
+
return LightLoopTerminalStore.get(session)
|
|
41
|
+
},
|
|
42
|
+
}
|
package/src/component.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { componentFeatures } from "./features"
|
|
2
|
+
import type { RuntimeComponent } from "@ericsanchezok/synergy-harness/lifecycle"
|
|
3
|
+
import { version } from "../package.json" with { type: "json" }
|
|
4
|
+
import { registerBridge } from "./register"
|
|
5
|
+
export function pluginLightLoop(): RuntimeComponent {
|
|
6
|
+
return {
|
|
7
|
+
id: "plugin-light-loop",
|
|
8
|
+
features: componentFeatures,
|
|
9
|
+
apiVersion: 1,
|
|
10
|
+
version,
|
|
11
|
+
requires: { "plugin-host": version, "light-loop": version },
|
|
12
|
+
workers: { agent: new URL("./worker.ts", import.meta.url) },
|
|
13
|
+
register() {
|
|
14
|
+
registerBridge()
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/features.ts
ADDED
package/src/register.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Plugin } from "@ericsanchezok/synergy-plugin-host/plugin"
|
|
2
|
+
import { registerPluginLightLoopAdapter } from "@ericsanchezok/synergy-plugin-host/plugin/host-services"
|
|
3
|
+
import { setTerminalHookDeliverer } from "@ericsanchezok/synergy-light-loop/light-loop/runtime"
|
|
4
|
+
import { lightLoopPluginAdapter } from "./adapter"
|
|
5
|
+
export function registerBridge() {
|
|
6
|
+
setTerminalHookDeliverer((...args) => Plugin.deliverHookForPlugin(...args))
|
|
7
|
+
registerPluginLightLoopAdapter(lightLoopPluginAdapter)
|
|
8
|
+
}
|
package/src/worker.ts
ADDED
package/README.md
DELETED